Compare commits

..

1000 Commits

Author SHA1 Message Date
moodler 326a83e109 Bumped to 1.6.4 2007-01-17 04:13:23 +00:00
moodler 182e92853e Automatic installer.php lang files by installer_builder (20070117) 2007-01-17 03:17:44 +00:00
mchurch dcd74d318f Fixing bug where quizzes from 1.4 will lose their answers when upgraded to later versions.
Fixes MDL-8207.
2007-01-16 21:33:11 +00:00
thepurpleblob 19874f6151 MDL-6769 Backported to 1.6 as requested. Shuffleanswers default as set in $CFG 2007-01-16 10:49:10 +00:00
moodler b5bbd35f96 Automatic installer.php lang files by installer_builder (20070116) 2007-01-16 03:15:52 +00:00
moodler c2dd7cadf8 Automatic installer.php lang files by installer_builder (20070113) 2007-01-13 10:19:45 +00:00
moodler 801ec7da79 Automatic installer.php lang files by installer_builder (20070113) 2007-01-12 17:43:29 +00:00
moodler 8ffb888712 Automatic installer.php lang files by installer_builder (20070112) 2007-01-12 03:16:31 +00:00
skodak 7a16844405 MDL-7990 Undefined variable: my_course - already fixed in 1.7 2007-01-08 21:53:31 +00:00
moodler 11e8c61f48 Automatic installer.php lang files by installer_builder (20070108) 2007-01-08 03:19:44 +00:00
skodak 38d5b701af revised adobe XSS protection SC#346 - backported from HEAD 2007-01-06 15:25:52 +00:00
moodler 9201c4146f Automatic installer.php lang files by installer_builder (20070105) 2007-01-05 03:28:18 +00:00
gbateson b15b35f6e6 fix import of Hot Potatoes quizzes using two-byte characters 2007-01-04 11:59:05 +00:00
skodak 5cdfc06bd3 Adobe Acrobat JavaScript Execution Bug SC#346; backported from HEAD 2007-01-04 00:11:09 +00:00
moodler 653d21470d Automatic installer.php lang files by installer_builder (20070103) 2007-01-03 03:20:19 +00:00
moodler 53be4b873f Automatic installer.php lang files by installer_builder (20070102) 2007-01-02 03:14:37 +00:00
moodler 18425af78f Automatic installer.php lang files by installer_builder (20061231) 2006-12-31 03:18:04 +00:00
skodak 795a0d8c34 MDL-7829 zipping with binary zip broken under windows when moodledata on different disk; backported from HEAD 2006-12-29 22:56:09 +00:00
skodak c545000a26 MDL-7837 auth_ldap_bulk_insert() fails when user data contains single quotes - patch by Iñaki Arenaza; backported from HEAD 2006-12-29 21:19:59 +00:00
skodak 0b5657c765 MDL-7404 updated currencies in 1.6.x - backport from HEAD 2006-12-29 19:20:29 +00:00
moodler ec354d2a91 Automatic installer.php lang files by installer_builder (20061229) 2006-12-29 03:09:55 +00:00
moodler ea7dee0d8a Automatic installer.php lang files by installer_builder (20061228) 2006-12-28 03:12:11 +00:00
moodler 19fc43f5eb Automatic installer.php lang files by installer_builder (20061226) 2006-12-26 03:14:13 +00:00
tjhunt d985ae5bdd MDL-7975 - Make import and export of truefalse questions more reliable. 2006-12-18 18:06:08 +00:00
tjhunt ad4dd3d4b8 MDL-7972 - improve GIFT import export for truefalse questions.
Also clean up whitespace in question/format/gift/format.php
2006-12-18 16:30:13 +00:00
moodler 0e7b1d7ac7 Automatic installer.php lang files by installer_builder (20061218) 2006-12-18 03:41:40 +00:00
moodler 9d3ea5340d Automatic installer.php lang files by installer_builder (20061215) 2006-12-15 03:17:10 +00:00
mits 513a01bfaf Fixed a missing closing brace }. 2006-12-14 20:18:56 +00:00
skodak 4ee3d4ac06 SC#341 fixed initilaization of navtail variable; backported from HEAD 2006-12-14 08:15:55 +00:00
moodler 696f45ea73 fix for MDL-7696, adding addslash for message 2006-12-12 02:48:16 +00:00
tjhunt 3866b318aa MDL-7896 - error from random question type in adaptive mode. 2006-12-11 23:33:15 +00:00
tjhunt da4c604c9d MDL-7886 - typo in overview report javascript. 2006-12-11 14:03:04 +00:00
skodak 348375da21 MDL-6668 Database mod search error on Postgres; patch by Lorenzo Nicora; backported from HEAD 2006-12-10 19:29:04 +00:00
skodak 337b664176 MDL-6613 Apostrophe in locked field prevents user updating profile - patch by Iñaki Arenaza; backported from HEAD 2006-12-10 17:44:56 +00:00
moodler 297b1bd905 Automatic installer.php lang files by installer_builder (20061210) 2006-12-10 03:04:10 +00:00
moodler ff1f958c13 Automatic installer.php lang files by installer_builder (20061209) 2006-12-09 03:12:43 +00:00
gbateson 3bdb864d50 abandoned attempts are now included in all reports. Added new help file regarding columns in "Click Trail Report" table 2006-12-08 04:16:59 +00:00
moodler 192f479e2b Automatic installer.php lang files by installer_builder (20061208) 2006-12-08 03:03:30 +00:00
gbateson 24644d6a56 fix undefined property "cr_timefinish", when viewing clickreport 2006-12-08 02:38:49 +00:00
ethem 231836a596 Don't show authorize.net login info at config page due to security precautions; Backported from MOODLE_17_STABLE. 2006-12-06 09:51:18 +00:00
mark-nielsen f9fbfb4659 Changed the fix to match what is in HEAD 2006-12-06 01:45:31 +00:00
mark-nielsen 9b00e4cf72 Bug fix: student response was not displaying for numerical questions, this bug does not exist in 1.7 2006-12-06 01:35:11 +00:00
tjhunt 0bf87d3181 MDL-7804 - Essay questions do not backup properly. 2006-12-05 18:46:45 +00:00
tjhunt 5b77a01ea4 Add $level parameters to each backup method. 2006-12-05 18:13:56 +00:00
moodler f0a7c95b24 Automatic installer.php lang files by installer_builder (20061205) 2006-12-05 03:19:49 +00:00
tjhunt adec76796a Typo in help. Thanks to Ken Wilson. 2006-12-04 16:08:04 +00:00
moodler d8b440ec76 Latest timezones from 1.8 2006-12-04 07:02:29 +00:00
moodler 19ff614093 Automatic installer.php lang files by installer_builder (20061204) 2006-12-04 03:12:15 +00:00
skodak 917a1974a3 MDL-7756 Recent Activity block gives 'Fatal error' when displayed on 'Sticky blocks' admin page; backported MDL-5931 from MOODLE_17_STABLE 2006-12-03 21:29:04 +00:00
skodak 2c54796fcb MDL-7783 Non-internal authentication change password URL doesn't work - patch by Iñaki Arenaza; backported from HEAD 2006-12-03 20:09:26 +00:00
skodak fab42b82f3 MDL-7757 URL check is too restrictive, allow port; backported from HEAD 2006-12-03 10:26:51 +00:00
skodak 6886a6fc5b MDL-7234 Smilies don't load in HTML editor for some languages; backported from HEAD 2006-12-01 09:55:13 +00:00
skodak 240e3cde63 Forgotten password page does not check secret MDL-7755; backported from HEAD 2006-12-01 09:18:23 +00:00
thepurpleblob d6751efc2b Fixed typo and notice 2006-11-28 09:36:28 +00:00
moodler f09a285a6a Automatic installer.php lang files by installer_builder (20061128) 2006-11-28 03:14:28 +00:00
moodler 5480a9bee0 Automatic installer.php lang files by installer_builder (20061127) 2006-11-27 03:12:41 +00:00
skodak 3dd1cc23b6 MDL-7631 Incorrect grading when Each attempt builds on the last and questions on more than one page; backported from HEAD 2006-11-26 23:03:15 +00:00
skodak edf174b46a Double quotes breaking short answers in a multianswer/cloze question MDL-6676; backported from HEAD 2006-11-26 21:59:23 +00:00
skodak 15d0d20614 incorrect table width in Exercise MDL-7690; backported from HEAD 2006-11-26 21:38:57 +00:00
moodler 33a50fa858 Automatic installer.php lang files by installer_builder (20061125) 2006-11-25 03:17:50 +00:00
moodler e9bbfc15fc Automatic installer.php lang files by installer_builder (20061123) 2006-11-23 03:09:22 +00:00
urs_hunkler 066f42726a 'removed overflow:hidden because there are some display issues on some pages. min-width: 0 is enough to trigger IE7 hasLayout to avoid collapsing divs' 2006-11-22 20:35:23 +00:00
urs_hunkler e2a93751ff 'removed overflow:hidden because there are some display issues on some pages. min-width: 0 is enough to trigger IE7 hasLayout to avoid collapsing divs' 2006-11-22 20:34:51 +00:00
moodler b06d0196b4 Automatic installer.php lang files by installer_builder (20061121) 2006-11-21 03:16:31 +00:00
thepurpleblob 54ccc96b58 Various improvements to Examview import.
Fixes MDL-7087 and MDL-7349. Fixes Examview part in MDL-7184
2006-11-20 12:57:04 +00:00
ethem ef10728a74 Make Zend Studio happy :)
Code Analyzer Output:

Variable $errno was used before it was defined (line 221)
Variable $errstr was used before it was defined (line 221)

Category: Coding Style

A local variable is used before it is defined.
Even though PHP initializes variables with empty values on the first use,
it is considered a good practice to explicitly initialize variables
to make code more readable and avoid unnecessary bugs.
2006-11-20 08:20:30 +00:00
moodler 0960421191 Automatic installer.php lang files by installer_builder (20061119) 2006-11-19 03:10:47 +00:00
gbateson 7cdd2a596f fix sorting order of questions in legend, which caused mismatch between question numbers used in Detailed Statistics report and those used in the legend 2006-11-18 08:52:14 +00:00
moodler a2f89145fd Automatic installer.php lang files by installer_builder (20061118) 2006-11-18 03:11:30 +00:00
ethem d810bd41cb Renamed some form fields. 2006-11-17 08:10:08 +00:00
moodler f6f75237a9 Automatic installer.php lang files by installer_builder (20061117) 2006-11-17 03:09:57 +00:00
ethem 5402e5dec3 choosemethod is too long for heading, added <br /> 2006-11-16 14:13:07 +00:00
tjhunt 14a62bfcd5 MDL-7428 - Quiz regrade removes student answers from essay questions that have been graded. 2006-11-15 17:32:32 +00:00
tjhunt 3a4cd9d998 MDL-7567 Numerical questions occasionally mix up the order of their answers 2006-11-15 16:55:40 +00:00
tjhunt 32fd8433d9 Remove obsolete code. 2006-11-15 16:47:58 +00:00
tjhunt f9cd1321ac MDL-7309 Add error checking to the Quiz DB upgrade script. This should prevent the mysterious failures that some people are seeing when upgrading quizzes from 1.5.x to 1.6.x. 2006-11-15 12:33:14 +00:00
moodler 2718918af5 Automatic installer.php lang files by installer_builder (20061115) 2006-11-15 03:14:30 +00:00
tjhunt 5c578b2bc2 MDL-6380 - added required include to make blocks work on the quiz pages. Backported from HEAD. See also MDL-7420. 2006-11-15 00:30:30 +00:00
moodler 2357b57391 Initial commit of gu_utf8 installer file 2006-11-14 19:56:25 +00:00
moodler bbf1f5d397 file installer.php was added on branch MOODLE_16_STABLE on 2006-11-14 19:56:25 +0000 2006-11-14 19:52:55 +00:00
ethem 8ef0bbf6c3 * Lessen the course list.
* Fixed pagination problem for orders when selected a course.
2006-11-13 14:25:53 +00:00
ikawhero da70138cfa Replacing with working image 2006-11-13 06:31:12 +00:00
ethem 84f7bcc8ee Get course before require_login(); 2006-11-12 13:17:46 +00:00
moodler 362c2fd638 Automatic installer.php lang files by installer_builder (20061112) 2006-11-12 03:09:58 +00:00
moodler 440d212f5c Automatic installer.php lang files by installer_builder (20061111) 2006-11-11 03:14:52 +00:00
moodler c7c6c2ea0b Automatic installer.php lang files by installer_builder (20061110) 2006-11-10 09:46:29 +00:00
moodler bc63c4bac3 field data should be backed up/restored regardless of whether user data is selected 2006-11-10 04:20:57 +00:00
moodler 89edf6b390 Automatic installer.php lang files by installer_builder (20061110) 2006-11-10 03:15:56 +00:00
moodler 5d7a6597c1 Automatic installer.php lang files by installer_builder (20061107) 2006-11-07 03:09:25 +00:00
skodak b13cfe12a6 prevent duplicate content in search engines MDL-7299; backported from MOODLE_17_STABLE 2006-11-06 21:50:49 +00:00
skodak a4495be67a better param handling SC#331; backported from MOODLE_17_STABLE 2006-11-06 20:36:16 +00:00
stronk7 0f7cac279c And, finally, IE is able to display IMS packages properly! B-)
One of the worst to solve bugs in my life! MDL-6417

Backported from HEAD
2006-11-06 17:23:54 +00:00
skodak eff26434e0 MDL-7176 fixed comment; backported from MOODLE_17_STABLE 2006-11-05 18:28:54 +00:00
moodler 74fe60674c Automatic installer.php lang files by installer_builder (20061105) 2006-11-05 03:14:26 +00:00
stronk7 e8e05625ec Now GD is checked before displaying course overview graphs. MDL-7204
Backported from HEAD
2006-11-04 23:35:50 +00:00
wildgirl 1040d76e82 MDL-6474 fix 2006-11-04 21:57:58 +00:00
wildgirl 4531718527 file langswitchstorage.html was added on branch MOODLE_16_STABLE on 2006-11-04 21:57:58 +0000 2006-11-04 21:56:42 +00:00
ethem d56eaba132 Show site name at top when selecting courses. 2006-11-03 12:45:12 +00:00
urs_hunkler a8c20a1629 'CSS update, mainly for MDL-7330' 2006-11-03 07:42:39 +00:00
moodler 12ef3b787b Automatic installer.php lang files by installer_builder (20061103) 2006-11-03 03:03:45 +00:00
watcanz 4aeab730e9 Updated for 1.6 2006-11-02 18:10:14 +00:00
bobopinna 18a742f9c6 Fixed a storic problem with & during package import
NOW Moodle full support prerequisites
2006-11-02 16:15:42 +00:00
moodler 822d3bfdc4 fix for MDL-7139 print_paging_bar at the bottom of page 2006-11-02 05:52:48 +00:00
moodler b620f6843b fix for MDL-7140, duplicate course name in header 2006-11-02 03:19:37 +00:00
ethem 6351bf91c9 Make authorize.net config page secure.
See: http://moodle.org/mod/forum/discuss.php?d=56728
Backported from 17stable.
2006-11-01 13:06:37 +00:00
ethem fffe36691f Make authorize.net config page secure.
See: http://moodle.org/mod/forum/discuss.php?d=56728
Backported from 17stable.
2006-11-01 12:55:24 +00:00
moodler 8327b31057 Merged fix from 1.7 MDL-7211 2006-11-01 06:59:26 +00:00
tjhunt 3080f36495 MDL-5811 - Quiz editing outputs nasty junk before print_header sometimes. Second attempt at fixing. I forgot to mention the bug number in the previous commit to mod/quiz/edit.php. Backported from MOODLE_17_STABLE. 2006-10-31 12:12:11 +00:00
tjhunt 4bb30981a0 Make the close_window function better. Backported from MOODLE_17_STABLE. 2006-10-31 11:58:04 +00:00
bobopinna 423ffdeda2 Fixed a typo 2006-10-31 11:38:58 +00:00
tjhunt 3f12881e16 Fix junk being output before print_header, which happened sometimes. Backported from MOODLE_17_STABLE. 2006-10-31 10:48:13 +00:00
tjhunt 4ca8d4783b Add return option to notify(). Backported from MOODLE_17_STABLE. 2006-10-31 10:48:01 +00:00
moodler fee8ca9ee9 Argh, no-one bumped it to post-1.6.3 2006-10-31 05:25:55 +00:00
martinlanghoff e22ebd9267 lib/textlib.class: Cache dir is now created correctly, allowing speed increase (SR# 595)
Previous logic had dir created only when mbstring wasn't used, but the
typo3 lib needs to cache some data regardless, for the specCharsToASCII
function, which uses internal translation tables.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-10-31 05:05:35 +00:00
thepurpleblob 81b65d5a10 Whoops - left some debugging stuff in place. 2006-10-30 16:19:32 +00:00
thepurpleblob 272871028e Removed loads of tabs and fixed a notice. 2006-10-30 16:13:27 +00:00
ethem 48e8c9562e Sorry, this string is not necesary for 1.6. 2006-10-30 13:28:44 +00:00
ethem 5f118ae0dd New string: All Pending Orders 2006-10-30 11:07:39 +00:00
gbateson 2456a9fbf6 corrected the settiing of fixed flag in JMatch quizzes 2006-10-30 08:52:40 +00:00
ethem 5dc9e87812 Get only courses made transactions. This lessens the course list. 2006-10-30 08:17:15 +00:00
moodler 2143ce3083 fix for MDL-6895, gradebook group view missing optional_param, thanks for the fix 2006-10-30 03:59:26 +00:00
moodler 94a7364394 Automatic installer.php lang files by installer_builder (20061030) 2006-10-30 03:05:47 +00:00
moodler dc1b9006e5 Automatic installer.php lang files by installer_builder (20061028) 2006-10-28 03:10:42 +00:00
urs_hunkler e6c83418a4 'added min-width: 0; and overflow: hidden; to clearfix to make clearing work in IE7' 2006-10-27 13:27:52 +00:00
gbateson 7b6c589a50 corrected the detection and display of fixed JMatch items (jmt files) 2006-10-27 00:41:28 +00:00
ethem 745c14145b get_courses() is only getting visible courses. This is a problem when an user wants to view old payments.
Backported from HEAD.
2006-10-26 09:09:26 +00:00
moodler b86e99c98d Automatic installer.php lang files by installer_builder (20061026) 2006-10-26 03:20:31 +00:00
skodak 7bead1ecf8 better cleaning of rss feeds SC#328; backported from MOODLE_17_STABLE 2006-10-25 21:29:32 +00:00
skodak 14400b8274 Query to get a list of tags in block_blog_tags.php broken with PostgreSQL MDL-6259; already fixed in MOODLE_17_STABLE 2006-10-25 19:32:23 +00:00
skodak 8f8ac09b6d select_color.php popup should specify charset MDL-7193; patch by Hiroto Kagotani; backported from MOODLE_17_STABLE 2006-10-24 21:40:28 +00:00
skodak 1e1a04a695 Lang file for auth specifies incorrect file path in lang/en_utf8/auth.php MDL-7205 revisited - new patch by Martin Langhoff; backported from MOODLE_17_STABLE 2006-10-24 21:31:02 +00:00
skodak 55e677148c Lang file for auth specifies incorrect file path in lang/en_utf8/auth.php MDL-7205 - found by Inaki Arenaza; backported from MOODLE_17_STABLE 2006-10-24 20:49:05 +00:00
skodak 2fc775008e Assignment Reports incomplete MDL-6301 ; backported from MOODLE_17_STABLE 2006-10-23 21:04:09 +00:00
skodak b204171348 Excel export returns a zero bytes file when system temp not writable MDL-7176; backported from MOODLE_17_STABLE 2006-10-23 19:28:33 +00:00
moodler 0ee781c85a Automatic installer.php lang files by installer_builder (20061023) 2006-10-23 03:01:20 +00:00
moodler 9af0972fd1 Automatic installer.php lang files by installer_builder (20061022) 2006-10-22 03:08:46 +00:00
moodler 447f9047cd Automatic installer.php lang files by installer_builder (20061021) 2006-10-21 03:01:25 +00:00
moodler d61edeec07 New automatic installer lang file added (from HEAD) 2006-10-20 06:56:23 +00:00
moodler 5987855a0a file installer.php was added on branch MOODLE_16_STABLE on 2006-10-20 06:56:23 +0000 2006-10-20 06:52:11 +00:00
moodler 86668a76ec Automatic installer.php lang files by installer_builder (20061020) 2006-10-20 03:03:12 +00:00
thepurpleblob 855165f531 Focus is now loaded in Name edit box. 2006-10-19 13:03:31 +00:00
moodler ee766268a3 fix for MDL-7095, missing string 2006-10-19 06:52:30 +00:00
moodler 0a0c56807c Automatic installer.php lang files by installer_builder (20061019) 2006-10-19 03:01:19 +00:00
skodak 3c4d4cd8e7 Delete user fails if apostrophe in email address MDL-4762 ; found and solution provided by Inaki Arenaza - backported from MOODLE_17_STABLE 2006-10-18 21:47:40 +00:00
skodak 3d5690d8b0 improved validation when deleting comments from glossary SC#325 ; backported from MOODLE_17_STABLE 2006-10-18 20:22:47 +00:00
skodak 2aaed68eee changed email obfuscation character to * MDL-6935 ; backported from MOODLE_17_STABLE 2006-10-18 19:42:43 +00:00
thepurpleblob ca477ee66a Put the cursor in the edit box for a label rather than do nothing. 2006-10-18 13:01:39 +00:00
urs_hunkler d535f143ac 'added Bitstream Vera Serif for better display in Linux browsers. It looks better than Georgia on Windows ;-)' 2006-10-18 06:29:41 +00:00
moodler eec943ef26 Automatic installer.php lang files by installer_builder (20061018) 2006-10-18 03:02:19 +00:00
tjhunt 24fcdd14c0 MDL-6315 - Manually grading a question 0 marks was not being registered. I took the opportunity to clean up the logic in this function a bit. 2006-10-17 23:19:15 +00:00
tjhunt dd08b0d166 MDL-6848 - Display problem with < > characters in shortanswer when outputting the correct answer. 2006-10-17 22:16:47 +00:00
tjhunt 3d365baa65 MDL-6386 - stripslashes missing in multianswer qustions. Thank to Joseph Rezeau. 2006-10-17 22:00:51 +00:00
tjhunt 70a892eb51 MDL-7054 - Prevent creation of question categories with blank names. 2006-10-17 21:38:51 +00:00
skodak 6ec0b677e7 Automatic deletion of users when deleteunconfirmed is setted to 'never' MDL-6726 ; backported from MOODLE_17_STABLE; patch submitted by Jesús Torres 2006-10-17 20:50:04 +00:00
thepurpleblob 224a2b4c05 fix for bug MDL-7040. Focus not set when form loaded. 2006-10-17 12:26:00 +00:00
vyshane ac9bdaadc1 Fixes for MDL-6363 2006-10-17 07:16:50 +00:00
skodak 98b4d4d6a8 RSS update and caching broken for some feeds MDL-7045; backported from MOODLE_17_STABLE 2006-10-17 07:11:28 +00:00
moodler 914a7bcad3 Automatic installer.php lang files by installer_builder (20061017) 2006-10-17 03:03:39 +00:00
ethem 75ad2e9487 Fix for sending welcome messages to students.
Iterate arrays by reset and next, access by array[index] cannot be accepted due to the fact that get_records_sql() returns primary key as index.
Backported from HEAD.
2006-10-16 10:08:36 +00:00
tjhunt 6117074c05 MDL-6984 - Problem with Blackboard 5 import in PHP5. Fix based on a suggestion from Arthur Manning. 2006-10-16 09:59:36 +00:00
skodak 02d62036db MDL-6444 Typo in Course/Report/Participation/index.php, patch by Stephen Bourget; backported from MOODLE_17_STABLE 2006-10-16 09:09:01 +00:00
moodler bb19f33228 Automatic installer.php lang files by installer_builder (20061016) 2006-10-16 03:04:09 +00:00
danmarsden 6b06e02c33 Fix for MDL-6550 - patch from Graeme Byrne thanks! :-)
+ a bit of a tidy - get rid of all those tabs! :-)
2006-10-15 23:56:36 +00:00
moodler 6a66541391 Automatic installer.php lang files by installer_builder (20061015) 2006-10-15 03:00:48 +00:00
moodler 3f62782cd9 Automatic installer.php lang files by installer_builder (20061014) 2006-10-14 03:02:24 +00:00
gustav_delius c848b76045 When javascript was turned off the group menu did not work because the Go button linked to course/view.php rather than mod/forum/view.php 2006-10-13 22:28:42 +00:00
moodler d75825e75b Automatic installer.php lang files by installer_builder (20061013) 2006-10-13 03:04:00 +00:00
gbateson 64d92486a5 removed a debug line which showed up in Rottmeier DropDown quizzes 2006-10-12 21:46:03 +00:00
gbateson c049c12abf add "Group Mode" and "Visible to students" as per other standard modules 2006-10-12 07:56:29 +00:00
gbateson fef4937cb1 fixed the reporting of results from Rottmeier DropDown 2.4 quizzes 2006-10-12 07:50:23 +00:00
moodler 375a0ea8de Automatic installer.php lang files by installer_builder (20061012) 2006-10-12 03:02:56 +00:00
gbateson d4f098178a removed "Selecting courses" section and modfied "Selecting users" section 2006-10-11 01:46:44 +00:00
gbateson 268ab771b6 use "noattemptstoshow" instead of "noattempts" 2006-10-11 01:41:26 +00:00
gbateson cb94fd11d5 allow selection of groups in reports 2006-10-11 01:29:51 +00:00
gbateson 8ec2d86edf removed "Select course" drop-down menu, because it is unusable, and separated enrolled and unenrolled students in "Select users" drop-down list 2006-10-10 23:54:14 +00:00
moodler ce422c25d6 Bump for release 2006-10-10 06:05:19 +00:00
vyshane e4af9c32ff Fix for MDL-6537. Added checkbox to allow deletion of forum subscriptions when resetting a course. Added code for forum subscriptions deletion. 2006-10-10 05:15:10 +00:00
vyshane 94d52f8f02 Added string for forum reset fix (MDL-6537) 2006-10-10 05:12:30 +00:00
stronk7 46b5cf7cb7 Raising MSSQL min req. to 2005 (9.0) 2006-10-09 16:17:33 +00:00
skodak 856683e596 fixed data/index.php when no databases available, initialized array in get_all_instances_in_course() from datalib.php 2006-10-08 19:44:33 +00:00
skodak d4d2a5bc3e problem with incorrect redirect url - wwwroot without the trailning slash in not standard compliant MDL-6193 ; backported from HEAD 2006-10-08 19:03:52 +00:00
skodak fbda575645 Insert a Chinese charachter string to label resource result error MDL-6757 ; backported from HEAD 2006-10-08 10:07:54 +00:00
gustav_delius 572badbdce Fixed bug that prevented guest access to courses that are not enrollable 2006-10-08 09:53:12 +00:00
skodak bcde80f2b3 add note to admin settings to check max_allowed_packet when enabling db sessions in MySQL - MDL-6866 , fixed quotes :-( backported from HEAD 2006-10-08 09:21:32 +00:00
skodak 6b63e3d905 add note to admin settings to check max_allowed_packet when enabling db sessions in MySQL - MDL-6866 ; backported from HEAD 2006-10-08 09:18:22 +00:00
skodak 39cbc2bf7b Grades computed incorrectly if assignment name appears more than twice in a course MDL-6876 , patch submitted by Gary Anderson; backported from HEAD 2006-10-08 09:06:21 +00:00
skodak 33f0ea4178 fixed encoding header() in messaging frames MDL-6128 - 1.6, special chars and messaging system; backported from HEAD 2006-10-08 08:31:12 +00:00
skodak 992d6a3a44 Resource frameset error in IE6 MDL-6842, patch submitted by Chris Fryer; backported from HEAD 2006-10-08 08:21:54 +00:00
skodak ea0d8cea76 Scalable Vector Graphics (SVG) files in Moodle are not correctly displayed in many Browsers MDL-6878, patch submitted by Geoffrey Rowland, thanks! backported from HEAD 2006-10-08 08:14:36 +00:00
moodler 1b6cc50342 Automatic installer.php lang files by installer_builder (20061008) 2006-10-08 02:54:24 +00:00
gustav_delius 3d2e01f6c8 Don't strip slashes from data send to htmlarea, after all it is not being stripped from data going to the normal textarea either. 2006-10-07 17:07:36 +00:00
gustav_delius 4ae8c9aca1 Don't use addslashes on data coming from form and don't use stripslashes on data coming from database 2006-10-07 16:34:20 +00:00
tjhunt e1088a97ec Hopefully improve performance on site with lots of question categories. 2006-10-06 16:45:16 +00:00
stronk7 80006e6017 Typo recently introduced. MDL-6336 2006-10-06 15:00:20 +00:00
toyomoyo b9f4f2227c fix for MDL-6336 2006-10-06 08:29:29 +00:00
gbateson 509f5d23e0 change default setting for reportusers to "allusers" (was "all") 2006-10-06 03:41:03 +00:00
gbateson ffd7d3d7c2 replace indent tabs with 4 spaces 2006-10-06 03:19:33 +00:00
moodler eb0208d591 Automatic installer.php lang files by installer_builder (20061006) 2006-10-06 02:58:31 +00:00
gustav_delius a32090a4c1 Incomplete user record (the one where the username is still 'changeme') should not be included in user listing. See bug 4570 2006-10-05 22:19:10 +00:00
gustav_delius 7b66125271 Incomplete user record (the one where the username is still 'changeme') should not be included in user listing. See bug 4570 2006-10-05 21:22:43 +00:00
tjhunt 98632cd3c8 MDL-6837 - move warning about pupup blockers into the lang file. 2006-10-05 15:53:18 +00:00
vyshane 0a60ef6e45 Fix for MDL-6819. Patch submitted by Nicolas Martignoni 2006-10-05 07:20:42 +00:00
gbateson 49ebbad5fa as per other mods, use "strip_slashes" and "format_string" when printing HotPot name to browser 2006-10-05 07:12:15 +00:00
gbateson e873787168 added names of unenrolled students to drop-down list of users names for which a report can be generated 2006-10-05 06:43:32 +00:00
gbateson fb4990ca39 In the "Selecting Users" section, "All users" was added and "All participants" was modified. 2006-10-05 06:21:26 +00:00
gbateson 7032c917e3 In the "Selecting users" section, "All Users" has been added and "All participants" has been modified. 2006-10-05 06:19:27 +00:00
gbateson a4a6aafe48 enabled display of attempts by students who are no longer enrolled in the course 2006-10-05 06:02:47 +00:00
vyshane 718647bcb1 Fixes for MDL-2583 2006-10-05 03:14:20 +00:00
stronk7 14a60a077b One missing global was preventig users becoming teacher of
the course being restored. MDL-6084
2006-10-04 17:33:48 +00:00
urs_hunkler 14e0fcb120 'MDL-6824, redundant declaration: .categorybox .category' 2006-10-04 15:41:39 +00:00
moodler 64422b601f Merged fixes from HEAD, bug MDL-6791 2006-10-04 12:59:05 +00:00
tjhunt 8419513e13 MDL-6297 shuffleanswers option not imported correctly for MC questions. Backported from HEAD. 2006-10-04 10:07:42 +00:00
moodler f990f10f77 Automatic installer.php lang files by installer_builder (20061004) 2006-10-04 02:58:37 +00:00
ethem 4ab16d477d Put back last commit. Some functions check $extra->id. 2006-10-03 19:35:57 +00:00
ethem 2e633ad500 If an error occures, id returns 0.
The user, who will be sent email, may be confused for $record->id=0.
2006-10-03 18:16:19 +00:00
gustav_delius 00ba27c582 The course upload size limit applies to students only, it should not be imposed for teacher uploads. 2006-10-03 18:13:47 +00:00
tjhunt 6ca5cf268b Reverting last change. I committed the wrong file. 2006-10-03 17:59:51 +00:00
tjhunt b9bdd0c7b6 MDL-5601 - restoring a course with a multianswer question sometimes causes an error() for a non-fatal contition. Change it to a notify, and everything seems to work. I don't really understand why, but this change does not make matters worse, so I am committing it. Thanks to Joseph Rezeau. 2006-10-03 17:56:51 +00:00
tjhunt 594c911aad MDL-6649 Only show the HTML editor for the first essay question on a page, since it is unreliable when there are lots. 2006-10-03 17:28:43 +00:00
ethem cfca034aed No need extra $order->status check. These functions expired() and settled() do it for us. 2006-10-03 09:00:20 +00:00
moodler 2c669a7383 Removed focus as too much trouble. MDL-6750 2006-10-03 07:30:23 +00:00
moodler ca72bce30c Automatic installer.php lang files by installer_builder (20061003) 2006-10-03 02:57:41 +00:00
moodler c8f1d1ca37 Added extra conditions to loops to prevent infinite loops
ref the same fix made for daily loops already:

   http://moodle.cvs.sourceforge.net/moodle/moodle/lib/statslib.php?r1=1.21.2.4&r2=1.21.2.5
2006-10-03 01:44:15 +00:00
moodler f18c648ae7 Patched login action on news forum 2006-10-03 01:17:37 +00:00
gbateson 2da3d6983b version number of final HotPot v1 (2005050900) was beyond version number of initial HotPot v2 (2004122000), added code to adjust $oldversion to trigger correct upgrade of tables for HotPot v1 2006-10-02 23:57:37 +00:00
skodak 2a02ff39c6 Student cannot see handed-in upload single assignment MDL-6770; backported from HEAD 2006-10-02 08:36:49 +00:00
moodler 0a69834d90 Automatic installer.php lang files by installer_builder (20061002) 2006-10-02 02:58:41 +00:00
gbateson a8fdaa5c38 corrected display of best grade on "index.php" when maximum grade for the HotPot is not 100 2006-10-02 00:30:32 +00:00
gbateson 1387c879d5 removed a leftover debug print "SELECT ... GROUP BY ..." 2006-10-01 23:59:51 +00:00
tjhunt dfa4dd740a Fix performance problem with lots of categories. http://moodle.org/mod/forum/discuss.php?d=54945#252145 2006-10-01 20:31:47 +00:00
gbateson 164c865fc7 calendar events are now added/deleted when hotpots are added/updated/deleted 2006-10-01 06:22:12 +00:00
gbateson 1dfae875f2 added "hotpotopens" and "hotpotcloses" for calendar events 2006-10-01 06:20:58 +00:00
gbateson ff5d1865c4 do not join attempts and details tables when select attempts details. This may speed up display of hotpot/index.php where there are many, many hotpots 2006-09-30 22:40:59 +00:00
julmis 29177c6a0d Fixing $tempfiledir path 2006-09-30 16:04:22 +00:00
skodak 4454213c7b fixed parameter cleanup SC#318 2006-09-29 20:53:09 +00:00
toyomoyo e340d9f14b fix for MDL-6182 2006-09-29 03:16:51 +00:00
stronk7 d36d45416f Added PHP 5.0.x restriction to Moodle 1.7. MDL-5653 2006-09-28 16:41:00 +00:00
gbateson 3fc2c3c266 added PARAM types when calling "required_param" and "optional_param" functions 2006-09-28 12:41:49 +00:00
vyshane 008537d5c3 Fixed unneeded notify output for bug MDL-6681. 2006-09-28 08:26:32 +00:00
moodler f65b8599b5 Much smaller tags :-) 2006-09-28 07:23:46 +00:00
martinlanghoff 80161aad61 enrol/db/enrol.php ignore delt'd usrs when enroling
Previously the import process would throw a non-fatal error when it found a
non-one number of users with the remote key.  This meant that
when there was a deleted user with the same remote key as an existing user, it
would throw an error, and report that there were no users for that remote key.
Fixed it so that it now ignores deleted users, and provides more accurate
and more precise error messages in the event that there are further
problems.

Author: Peter Bulmer
2006-09-28 01:16:01 +00:00
martinlanghoff dc77f7b55c auth/db/lib (bugfix) only update mdl fields during login if 'onlogin' set
Previous operation was update all moodle fields from the external database
during each login & sync ignoring this setting. Now if this setting is
'oncreation' then the field is only copied once (on creation of user).
2006-09-28 01:04:49 +00:00
martinlanghoff c83afe4ec2 Set student enrolment end date to course enrolment period for external
database enrolments.  (fix MDL-6272)
2006-09-28 00:15:54 +00:00
martinlanghoff 8aa18dddc8 Comments. 2006-09-28 00:12:42 +00:00
martinlanghoff d0f5c048e2 Allow Chinese/Japanese UTF-8 strings to be truncated at character
boundaries instead of word boundaries. (fix MDL-5378)
2006-09-28 00:10:15 +00:00
martinlanghoff 498ce7e832 Fix for breadcrumb problem (MDL-6271). 2006-09-28 00:07:51 +00:00
moodler f329c16428 Added EU to country list 2006-09-27 12:58:24 +00:00
moodler 3398e99d5d Merged fixes for MDL-6334 from HEAD 2006-09-27 08:32:36 +00:00
gbateson 158210e49f added functions for participation report: hotpot_get_view_actions + hotpot_get_post_actions 2006-09-26 12:21:38 +00:00
moodler 85fb025135 Automatic installer.php lang files by installer_builder (20060926) 2006-09-26 02:49:20 +00:00
vyshane 4fbf8bd7b3 Forums of type 'single' should not be splittable. Added check for this. 2006-09-25 05:08:38 +00:00
vyshane 1762e9204c Fix for MDL-6521 2006-09-25 04:55:49 +00:00
vyshane 5f57a74789 Merged fix for MDL-6363 2006-09-25 04:01:53 +00:00
vyshane f009e194ec Fix for MDL-6615. Patch by Luis Peralta. 2006-09-24 15:19:54 +00:00
urs_hunkler 9f686c8a69 'add height to sideblock commands div against collapsing' 2006-09-24 09:44:05 +00:00
mark-nielsen c630b0ba86 MDL-6628 bug fix 2006-09-24 06:03:18 +00:00
moodler 38c1666070 Automatic installer.php lang files by installer_builder (20060923) 2006-09-23 02:45:13 +00:00
urs_hunkler debad50603 'reduced the distance above the footer from 100px to 40px' 2006-09-22 15:17:12 +00:00
moodler a234a89cc8 Hive updates 2006-09-22 13:23:12 +00:00
moodler 8583655bf9 Allow personal dictionaries in spell checker using $CFG->aspellextradicts
Aspell files look like this:

=========================
personal_ws-1.1 en 4
moodle
moodler
moodlemoot
moodling
=========================
2006-09-22 04:37:35 +00:00
moodler 1796aa9fcc Automatic installer.php lang files by installer_builder (20060921) 2006-09-21 02:46:11 +00:00
skodak 7c1376125d fix for old email confirmation - spotted by Dirk Grunwald 2006-09-20 21:46:50 +00:00
skodak 1c66afe8f1 minor fix backport from HEAD 2006-09-20 18:33:24 +00:00
moodler 2989d4cc7c Automatic installer.php lang files by installer_builder (20060920) 2006-09-20 03:01:53 +00:00
tjhunt f0db2fe9c3 Fix JavaScript problem reported in this thread: http://moodle.org/mod/forum/discuss.php?d=54432 2006-09-19 21:47:44 +00:00
bobopinna 5679493192 Removed the scorm_string_wrap unused function 2006-09-19 09:45:19 +00:00
bobopinna d6bddd46c6 Fixed multiattempt grading system 2006-09-19 09:07:44 +00:00
moodler 7ac61104a3 FIx for message icons, changed style to avoid problems with MDL-6020 2006-09-19 04:52:56 +00:00
urs_hunkler 987e0d3be5 'MDL-6020 - CSS changes to align text beside images' 2006-09-18 11:49:51 +00:00
moodler 7980ea00c3 Automatic installer.php lang files by installer_builder (20060918) 2006-09-18 03:06:31 +00:00
gustav_delius 02cc013abf Removed a PHP notice 2006-09-17 17:33:42 +00:00
gustav_delius 01b91ac459 Fixed bug MDL-6341 which meant that studentview was not working in hidden courses. 2006-09-17 10:14:05 +00:00
martinlanghoff 4f70e2756a Fix bug 6342 - cannot move forum post to other forum when the subject includes an apostrophe
This is actually a merge of a similar fix from HEAD
2006-09-17 02:32:00 +00:00
martinlanghoff f6965dc685 datalib: Fixed erroneous documentation.
The function sql_fullname had the same documentation as the function sql_ilike, which was not correct.  Now updated to reflect what the function
actually does.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-09-17 01:35:49 +00:00
skodak 86218462fc fixed recursive backing up of backup folder when resource diretory reference is course files root - MDL-6280 2006-09-16 18:14:15 +00:00
skodak 383df89595 backupdata folder is not visible in directory resource any more, the backup files were not downloadable, but they might be stored in browser cache when teacher and student were logged from the same browser and computer account - MDL-6280 2006-09-16 17:11:00 +00:00
moodler dc7dd83b88 Automatic installer.php lang files by installer_builder (20060916) 2006-09-16 02:52:24 +00:00
vyshane a901d8fd4c Changes to ensure the xhtml markup validates 2006-09-15 08:05:08 +00:00
thepurpleblob ea8e7f9936 Removed bunch of tabs and sorted out badly formatted comments
Provides fix for bug MDL-5893
2006-09-14 13:58:09 +00:00
moodler 0d2b4325ec Added fix from http://moodle.org/mod/forum/discuss.php?d=38860#178716 2006-09-14 05:45:32 +00:00
moodler b1d70beafa Bump version to 1.6.2+ 2006-09-14 05:17:55 +00:00
moodler 3827e2d359 Merged fix for MDL-6247 2006-09-14 05:16:02 +00:00
moodler 58d079df96 Remove obsolete themes link MDL-6518 2006-09-14 03:36:04 +00:00
vyshane b139f7ae4b Fix for bug MDL-6517. Patch by David Mudrak (thanks!). 2006-09-14 03:11:56 +00:00
gbateson 0e448ae3c0 removed unnecessary $db declaration 2006-09-14 00:24:31 +00:00
gbateson 79fc4a6726 copied code from "hotpot/db/postgres.php" to detect hotpot_attempts.details field 2006-09-13 23:27:21 +00:00
gbateson 0d3b042fec fix bug 6538, in which $db->MetaColumns was not defined in some PG sites 2006-09-13 21:25:58 +00:00
urs_hunkler 2864912fe0 some style updates 2006-09-13 17:11:00 +00:00
moodler 5b3a7e59a8 Fix for MDL-6508, bad version number in Hotpot 2006-09-13 15:08:55 +00:00
urs_hunkler 7b0d235253 Added CSS to correct the login form - See bug MDL-6028 2006-09-13 14:45:54 +00:00
gbateson 22c633e8b7 when updating, if the version number indicates this could be an early HotPot v2.1 (Moodle 1.6) then check this is not HotPot v2.0 (Moodle 1.5) with an overly advanced version number. Also, added backwards compatability back to Moodle 1.1.1 New release is HotPot v2.1.23, version is 2006082900 2006-09-13 08:26:16 +00:00
gbateson 664f80662e don't show &nbsp; in empty grades cells in Excel format 2006-09-13 08:19:26 +00:00
gbateson ac63de90c6 add get_coursemodule functions for Moodle <1.5.4 2006-09-13 08:17:50 +00:00
gbateson 5f4a37b5b2 limit worksheet length to 31 chars on Moodle 1.5: prevents fatal error lib/excel/workbook.php 2006-09-13 08:16:00 +00:00
moodler 666ebd7bcf Automatic installer.php lang files by installer_builder (20060913) 2006-09-13 02:53:55 +00:00
moodler 9b4f94bd92 Bumping to 1.6.2 for releasing 2006-09-12 16:05:51 +00:00
moodler a88c450679 Merged fix from HEAD 2006-09-12 14:28:04 +00:00
bobopinna 6a973240af added support to hyphen and tilde in CMIIdentifier 2006-09-12 08:46:23 +00:00
moodler 3e3c6eec08 Automatic installer.php lang files by installer_builder (20060912) 2006-09-12 02:48:41 +00:00
exe-cutor 8de4f2e23e Again added get_first_string ... 2006-09-11 09:05:35 +00:00
stronk7 9d3089562a 1.6 installer langs files added. 2006-09-11 08:28:49 +00:00
moodler 77ec0e627e Automatic installer.php lang files by installer_builder (20060911) 2006-09-11 08:12:16 +00:00
stronk7 abf39fb332 file installer.php was added on branch MOODLE_16_STABLE on 2006-09-11 08:28:54 +0000 2006-09-11 08:09:58 +00:00
skodak 2877856383 validate local redirection actions in jumpto.php SC#310; backported from HEAD 2006-09-11 07:13:03 +00:00
gbateson f03e81eb03 removed reportselector.html as it was unused and has been replaced by reportcontent.html and reportformat.html 2006-09-10 05:27:41 +00:00
gbateson 75e59b1a22 correct a small formatting error in "Show Legend" -> "No" explanation 2006-09-10 05:25:13 +00:00
mark-nielsen e2eb506371 MDL-5430 - branch table redirect problem 2006-09-09 17:25:21 +00:00
mark-nielsen 9f811896b8 Security fix for grading Essays. Mentioned in MDL-6477 2006-09-08 18:01:12 +00:00
skodak a12743a49b fixed typo - trailing backslash; backported from HEAD 2006-09-08 15:51:40 +00:00
thepurpleblob e8131aa214 Added Clifford Tham's changes - Thanks Clifford :-)
Also fixed some notices
2006-09-08 10:21:51 +00:00
skodak faafe84561 fixed serious breakage during upgrades caused by double redirects 2006-09-07 20:33:03 +00:00
skodak df8ac6d2e6 forced conversion to proper numeric type in _adodb_column_sql() SC#259; backported from HEAD 2006-09-07 10:21:43 +00:00
skodak c98d228b96 allow less verbose operation of forget_password.php SC#282, backported from HEAD 2006-09-07 05:50:05 +00:00
vyshane 9180b308f4 Added $CFG->pagepath so that editing questions will link to the relevant question types in moodle docs. Fix for bug MDL-5866. 2006-09-06 08:50:50 +00:00
skodak 586e08ac32 backported detection of potentially insecure dataroot location SC#295 2006-09-05 22:38:59 +00:00
skodak 13ad4e12e1 fix for bug MDL-5403 , you can now force redirect with 0 delay even when header already printed 2006-09-05 21:51:31 +00:00
moodler f83a24b87b Stripping tags from titles MDL-6431 2006-09-05 03:14:02 +00:00
moodler bf08108c94 Added $CFG->coursesperpage which changes default paging of category listing 2006-09-05 03:03:42 +00:00
gustav_delius f610ac5e18 Had to comment out the line that updates the timemodified field when a discussion is moved from one forum to another one because the timemodified field is used to sort the list of discussions and also to provide the "Last post" date. It should really be renamed to something like "timeoflastpost". 2006-09-04 22:00:26 +00:00
moodler bfd5c5d7f6 Change the format of the email signup link to make it work better on Hotmail 2006-09-04 02:25:35 +00:00
moodler 5decc6f064 DOn't process stats if it's blocked 2006-09-03 15:44:25 +00:00
moodler f598a45f2e Added a hidden $CFG->disablestatsprocessing variable to disable stats completely 2006-09-03 15:42:05 +00:00
gustav_delius eb9b7f1a3e Take out invalid </tr>. While this makes the html valid some work should still be done on the layout of this. 2006-09-03 12:22:02 +00:00
gustav_delius 4508fdd282 The file countries.php does not exist in lang/en, only in lang/en_utf8. Therefore the fallback default in the function get_list_of_countries() should always be en_utf8. 2006-09-03 11:39:54 +00:00
gustav_delius 6a2f9ca922 Remove undefined variable notice 2006-09-03 11:22:48 +00:00
moodler a565cb2f8e Automatic installer.php lang files by installer_builder (20060902) 2006-09-02 02:44:29 +00:00
gustav_delius bf9cdc2b90 Fix by Jesse Scott so that database sessions respect sessiontimeout setting. Closing bug 5912 2006-09-01 20:27:54 +00:00
ethem 19660487d0 + Don't show AVS message if not applicable.
+ Email message that translated instead of english if cc will be autoconfigured.
2006-09-01 14:39:52 +00:00
gbateson 5ab3937c6e correct the detection of HotPot 2.0 backups (from Moodle 1.5) 2006-09-01 03:58:09 +00:00
ethem 22fa4da34f New feature: Autoconfigure credit card types, if the merchant does not accept this type of credit card; Backported from HEAD. 2006-08-31 07:35:16 +00:00
ethem 0ee1574512 New feature: Autoconfigure credit card types, if the merchant does not accept this type of credit card; Backported from HEAD. 2006-08-31 07:29:44 +00:00
skodak b02b2f70d7 better input validation in files/index.php SC#307; backported from HEAD 2006-08-30 08:04:43 +00:00
gbateson 0679583490 convert relative URLs to absolute URLs in quiz questions and answers 2006-08-30 07:54:48 +00:00
moodler 5ba8b19939 Automatic installer.php lang files by installer_builder (20060830) 2006-08-30 02:46:44 +00:00
skodak 4d21686218 better handling of anchor name in docs index SC#306; backported from HEAD 2006-08-29 20:39:24 +00:00
ethem 79cd394c82 fixo 2006-08-29 08:11:04 +00:00
skodak 18e2de4313 show detailed log messages only when debug is not off SC#303; backported from HEAD 2006-08-28 21:34:39 +00:00
skodak 0eeec1a96f create safer .htaccess SC#302; backported from HEAD 2006-08-28 21:13:12 +00:00
mark-nielsen 4e2cbb28e5 MDL-6325 Bug Fix 2006-08-28 20:01:13 +00:00
gustav_delius 5a521aa30f Small correction in the documentation for the $CFG global 2006-08-28 08:59:57 +00:00
moodler 01b9db69e2 Automatic installer.php lang files by installer_builder (20060826) 2006-08-26 02:50:02 +00:00
mark-nielsen 91bfeb65ea MDL-6323 - Fixed - changed feedback to response 2006-08-25 22:51:24 +00:00
mark-nielsen 16ae471c30 Removed undefined index notices by using empty to make sure the index exists 2006-08-25 18:27:12 +00:00
danmarsden e22b34ec32 MDL-4493 issue with 405 pages for IIS users - must specify actual page, as the notice function does a post - you cannot use the POST Verb on a directory in IIS. 2006-08-24 02:10:01 +00:00
tjhunt 7025366210 MDL-6338 - Short answer questions with ' in the answer don't work. Yet another unpleasant quiz bug caused by the current broken way we do things with addslashes. 2006-08-23 18:53:40 +00:00
stronk7 e133c32ff3 Adding one PHP close tag that has been missing (but working) since years! 2006-08-23 15:18:20 +00:00
stronk7 84e6ee9c38 Bump to 1.6.2 (no DB changes) 2006-08-23 15:04:05 +00:00
thepurpleblob 4c831b7078 bug MDL-5458
XML format now supports Essay questions
Improved the comments
2006-08-23 14:54:05 +00:00
skodak cd79115069 debug off level is now 5 instead of 7 to prevent E_WARNING on production sites SC#294 2006-08-22 22:19:54 +00:00
skodak cd1e684b2c fixed trailing whitespace in last commit :-( 2006-08-22 22:09:33 +00:00
skodak d67514acb8 Rewritten help.php by Tim Hunt with minor fixes - SC#292 2006-08-22 22:03:08 +00:00
tjhunt 0d4537c796 SC 299 2006-08-22 21:33:27 +00:00
skodak fdb76e639f fixed some notices in scheduled backup 2006-08-21 20:38:44 +00:00
stronk7 e59fded4ef Solved hh (horrible-hidden) bug in backup_scheduled code.
Credits go to Thirot Jean-Luc. http://moodle.org/mod/forum/discuss.php?d=52156
2006-08-21 19:06:38 +00:00
tjhunt 8529d9b6d8 Bug #6305 - Quiz settings form field order could be better - proper fix this time.
Sorry, I screwed up with the previous revision. This is the proper fix. Diff this with revision 1.61 to see what the change really is, and ignore 1.61.2.1.
2006-08-21 10:07:48 +00:00
tjhunt c23339e968 Bug #6305 - Quiz settings form field order could be better. 2006-08-20 20:10:15 +00:00
tjhunt 5fc3c306f4 Bug #6303 - True / False applies penalty factor wrongly. 2006-08-20 15:37:06 +00:00
moodler 207793f82f Automatic installer.php lang files by installer_builder (20060819) 2006-08-19 02:47:51 +00:00
tjhunt 2b64c31597 Bug #6293 - Cannot regrade a question when a teacher has added a comment with a ' Stupid, wreched, datalib. Why can't datalib take care of addslashes, so the whole of the rest of the code can forget about it? That is how a database abstraction layer should work. I know, it is pointless to moan about it, but it has just cost me 3 hours, so I feel I have earned the right to moan. 2006-08-18 22:34:25 +00:00
tjhunt f7abe85cc0 Code cleanup. 2006-08-18 22:25:39 +00:00
tjhunt 5cd1517bc3 Fix some Eclipse code warnings. 2006-08-18 21:21:59 +00:00
ethem 7ecefcb090 Colorize refunds and show refunded total.
Red: Refunded/Pending Settlement
Green: Refunded/Settled
Black: Cancelled

Backported from HEAD(1.25-1.26)
2006-08-18 16:11:30 +00:00
ethem 7a23b4d63c Display capture/void/delete instead of 'Yes'. 2006-08-18 14:48:41 +00:00
tjhunt 00c5890a15 Bug #3481 - wildcard problem in cloze question. Thanks to Joseph Rezeau. 2006-08-18 10:28:15 +00:00
tjhunt 45cd0cfde8 Changed include to use dirroot not wwwroot. 2006-08-18 08:05:45 +00:00
skodak 0a861d4506 Bug #6276 - Multiple questions not showing up from scale page 2006-08-17 21:33:26 +00:00
tjhunt dcd2895639 Bug #6277 - Missed function renaming in question/format/multianswer. 2006-08-17 17:37:54 +00:00
ethem b88378acb9 Allow teachers to cancel refunded transactions if admin set up $CFG->an_teachermanagepay.
enrol_authorize.courseid must be passed to authorize_get_status_action function; Joined 2 tables to get courseid field.
2006-08-17 15:30:20 +00:00
moodler 06bbfff66e Automatic installer.php lang files by installer_builder (20060817) 2006-08-17 02:54:23 +00:00
tjhunt da4714358a Bug #6267 - questionlib.php delete_question infinite loop with rantom questions. Thanks to mbockol at carleton dot edu. 2006-08-16 16:16:42 +00:00
moodler 48e2bf159a Automatic installer.php lang files by installer_builder (20060816) 2006-08-16 02:52:23 +00:00
thepurpleblob 48b358ba56 Bug #6231. Question name truncated to 250 characters. 2006-08-15 14:38:38 +00:00
skodak 029d0a28bd $CFG->debug=0 from config.php is not overriden by setup.php anymore SC#293 2006-08-14 20:55:58 +00:00
skodak c26ac7924f adding proper checks that the requested help file exists SC#292 2006-08-14 20:07:35 +00:00
moodler 51034f13f8 In rare cases (some timezones?) this while loop went forever because
$timestart == $nextmidnight

which led to disks filling up   :-(
2006-08-14 15:19:36 +00:00
moodler a1ecd20a19 Merged fixes from HEAD 2006-08-14 09:01:31 +00:00
skodak a7ea2d7dcc prevent access to filters when disabled in filter settings SC#291 2006-08-14 06:22:15 +00:00
tjhunt 915db857b8 SC 289, small, but non-exploitable hole in backup permissions checking. 2006-08-13 20:25:46 +00:00
moodler 6c05439a08 Automatic installer.php lang files by installer_builder (20060813) 2006-08-13 02:51:13 +00:00
skodak b5c240e397 fixed format_text caching - now respects text format, current language and course id (lang fix is needed for my multilang filter rewrite ;-) 2006-08-12 12:41:55 +00:00
stronk7 e8e814e5c7 An example of how one unitialized variable can generate really
dificult-to-trace bugs. Thanks to Jens Gammelgaard and support  B-)
(http://moodle.org/bugs/bug.php?op=show&bugid=6233)
2006-08-12 09:12:15 +00:00
bobopinna 0fc2503718 Fixed a problem during scorm update.
Now tracks are deleted only if the scoes are really changed
2006-08-11 12:21:23 +00:00
thepurpleblob f5c2ff517f Correctly reflect 1.6 match grades change and make it more clear about blank line usage - bug #6231 2006-08-11 10:42:19 +00:00
stronk7 74948bb2e7 Changing //TRANSLIT to //IGNORE because some weird bug
in the OS iconv libraries was breaking some texts.
2006-08-11 09:34:47 +00:00
thepurpleblob ec7a860ff5 Removed credits section (along with very out of date 'last-updated' bit). Doesn't seem appropriate any more. 2006-08-11 08:10:15 +00:00
skodak 0f69811d98 new function get_coursemodule_from_id() is now used for obtaining of valid $cm from coursemodule id SC#283; backported from HEAD 2006-08-10 15:30:49 +00:00
moodler 0b038e2d43 Automatic installer.php lang files by installer_builder (20060810) 2006-08-10 03:02:49 +00:00
toyomoyo 02f0217c20 fix a bug when user's lang is not set, fall back to site lang 2006-08-10 02:41:19 +00:00
skodak 105a8f399f obfuscation of the email addresses 2006-08-09 20:39:24 +00:00
skodak c071606525 Bug #6199 - A typo in edit.php 2006-08-09 19:45:41 +00:00
skodak dfa8b0f06a Bug #4936 - Highlighting a question text fragment with different color 2006-08-09 19:29:34 +00:00
skodak 8953a3b44f Bug #6225 - Moodle bug #4658 Breaks assignment type: Upload Single 2006-08-09 18:35:42 +00:00
skodak 6223b2eb1e Bug #6106 - HTML editor inserting unwanted hard return between images 2006-08-09 09:36:01 +00:00
bobopinna f4f18fb00c Fixed a bug in AICC package importing 2006-08-08 07:25:19 +00:00
moodler 98830278dc Automatic installer.php lang files by installer_builder (20060808) 2006-08-08 02:50:28 +00:00
skodak 2928e3d2d6 Swf now disabled by default in Mediaplugin and added explanation SC#284 2006-08-07 14:48:51 +00:00
moodler ea07be815b Automatic installer.php lang files by installer_builder (20060806) 2006-08-06 02:52:42 +00:00
bobopinna 10d7f1525d fixed a problem with Explorer and popup windows 2006-08-04 13:49:00 +00:00
bobopinna d51d6583a7 Fixed a problem with explorer and popup windows 2006-08-04 13:41:54 +00:00
bobopinna 6703e4af2d removed object tags. I'm thinking to return to frameset... 2006-08-04 13:01:35 +00:00
martinlanghoff 530c61afe7 login: forgot password now works for guest again (bug #6214) 2006-08-04 06:11:34 +00:00
martinlanghoff 58c98fa207 mod/assignment if we are not using a numeric scale and a custom scale
return that as the max grade


Author: Jun Yamog <jun@catalyst.net.nz>
2006-08-04 05:47:37 +00:00
tjhunt beb6c6cdb7 Bug #6206 - Quiz can't be created on some mysql configurations 2006-08-03 16:30:21 +00:00
tjhunt 964f6d4f17 Bug #6048 - Fix 'are you sure you want to start an attempt' warning. Backported from HEAD. 2006-08-03 14:51:34 +00:00
moodler 905c6f3261 Pushing beyond 1.6.1 2006-08-02 06:18:26 +00:00
moodler e1210ad3c3 Automatic installer.php lang files by installer_builder (20060802) 2006-08-02 02:49:38 +00:00
toyomoyo 2492b30859 fix for 6178 2006-08-01 05:10:33 +00:00
ethem 8e9f9bec69 Don't show authorize.net password for security reasons. 2006-07-31 12:30:44 +00:00
skodak 47c8660050 Bug #6146 - Smiley popup can not be translated 2006-07-31 10:26:18 +00:00
skodak 8860ceb4d2 fixed warning when no referer available 2006-07-31 10:04:18 +00:00
skodak a45c1d139a Bug #6168 - missing link for course request - fixed 2006-07-31 09:17:53 +00:00
skodak ecdb04ca06 Bug #6168 - missing link for course request 2006-07-31 09:14:13 +00:00
martinlanghoff 0f7fcc8377 Backing out fix for bug #4874 2006-07-31 05:56:48 +00:00
martinlanghoff 4b8df782c6 Bug #6147 - Upgrade from 1.5.x breaks with Postgres 7.4.x
Even though Postgres 7.4.x is officially supported, several upgrade scripts use syntax that only works in Postgres 8.x. and it's impossible to finish the upgrade.

The attached patch fixes those scripts.

Saludos. I?aki.

Author: I?aki Arenaza
Review: Jun Yamog, Martin Langhoff
2006-07-31 05:38:20 +00:00
martinlanghoff 3ad4a1097b assignment: count_user_files() no longer creates extraneous dirs (bug#4658)
Applied the fix by Samuli.Karevaara, from the bug report - the directory is checked for existence beforehand.
Previously it was created if it didn't exist, then the files within it were counted.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-07-31 04:57:08 +00:00
martinlanghoff 21c2f2ef29 wiki: Added a link to force reloading of the page (WR#515)
The link allows the page to be reloaded, which saves people from only seeing the cached copy. This is the equivalent of doing Shift+Reload in most
browsers.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-07-31 04:55:59 +00:00
martinlanghoff c58f4f10b3 forum: notification of a moved dicussion (bug#4874)
Moving a discussion now leaves a notification message in the
original location with a link to the new location.


Author: Luke Hudson <luke@catalyst.net.nz>
2006-07-31 04:54:06 +00:00
julmis 9978506b11 Removing formathtml function since it is never going to work. 2006-07-30 23:16:12 +00:00
julmis 980b1e04bc Trying to get rid of insert link bug once and for all 2006-07-30 23:07:49 +00:00
skodak 0fc71cc508 SC #280 force downloading of database files 2006-07-30 22:43:58 +00:00
skodak 9a0d8fd2b3 Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text and other minor cleanup 2006-07-30 22:23:43 +00:00
skodak d2b00aae1d Bug #6170 - Glossary bug: it displays nothing when autolinking to non-ascii text and other minor cleanup 2006-07-30 22:18:14 +00:00
skodak 2a94a64a06 Bug #6135 - Reduce unnecessary use of strtolower to make non-English languages look better 2006-07-30 21:46:31 +00:00
skodak d7a5c75f30 Bug #6176 - locale setting on config variables page not functioning correctly 2006-07-30 10:30:07 +00:00
moodler 54ac3dd31a Automatic installer.php lang files by installer_builder (20060730) 2006-07-30 02:49:23 +00:00
skodak be029bdf25 Bug #6181 - icelandic doesn't migrate 2006-07-29 09:43:36 +00:00
skodak b573d77752 Bug #6183 - typo in clean_param() description 2006-07-28 20:56:21 +00:00
urs_hunkler db5219aacd adding missing icons 2006-07-27 19:51:21 +00:00
skodak 9a2539db21 Fixed Call to undefined function: print_progress() in /usr/share/moodle/admin/upgradeforumread.php 2006-07-27 11:48:19 +00:00
ethem dd241f341a Select records as tablename.fieldname when joining tables.
Someone, can add  these fields userid,courseid to course table . :)
2006-07-27 11:23:25 +00:00
ethem fe2bc06329 Bug: Column 'timecreated' in where clause is ambiguous.
We joins 2 tables: course and enrol_authorize.
We didn't select course.timecreated, but it gives this error.
2006-07-27 10:49:54 +00:00
moodler 58643a8110 Automatic installer.php lang files by installer_builder (20060727) 2006-07-27 02:52:30 +00:00
moodler 1a10d9049f Automatic installer.php lang files by installer_builder (20060726) 2006-07-26 02:45:50 +00:00
ethem 4221b8647c Cron error: When authorizenetlib.php require enrol.php, it includes admin/enrol.php. Interesting. Solved as $CFG->dirroot.'/enrol/authorize/enrol.php 2006-07-25 17:34:00 +00:00
ethem 8fd49aa444 New string: costdefaultdesc
<strong>In course settings, enter -1</strong> to cost field to use this default cost.
2006-07-25 17:03:55 +00:00
ethem d91f79789a New string: costdefaultdesc
<strong>In course settings, enter -1</strong> to cost field to use this default cost.
2006-07-25 16:58:22 +00:00
ethem 5eeebefba9 Sometimes ssl connections are slow. Increase max_execution_time to 5 minutes. 2006-07-24 16:27:51 +00:00
tjhunt 87cb44ac9f Bug #6157 - lang strings using concatenation, not $a. 2006-07-24 14:35:03 +00:00
ethem 644600315c * Update record as soon as possible. If update/insert record fails email to admin to have update manually.
* ignore_user_abort(true) at critical section (before fwrite($fp, "POST /gateway/transact.dll).
   This is last change to ignore request for user.
 * Made some functions "static" to call function directly. So, no need new enrolment_plugin_authorize() instance.
   Now, these are static:
   get_list_of_creditcards, zero_cost, get_course_cost, prevent_double_paid, email_to_admin, check_openssl_loaded
 * Some mtrace cleanup. Removed default new line.

This is big work. When PHP5 is required for moodle in the future, I will add static modifier to functions.
Now and future, this plugin is/will unbreakable. :)
2006-07-24 11:42:17 +00:00
skodak 905fdcaa31 Bug #6159 Site settings interface typo - Combo list - my first commit form UK MoodleMoot :-) 2006-07-24 10:31:21 +00:00
danmarsden a97a4a87bd Bug #5882 ldap enrolment doesn't work. $USER->student getting munged 2006-07-24 00:32:06 +00:00
danmarsden c3d36a923f Bug 6130 session has bad entries causes calendar to fail showing events
Workaround untill Session is fixed properly.
2006-07-24 00:14:07 +00:00
danmarsden 3cfe476b39 Fixes for Bug 5749 and Bug 5750
summary of bug 5749 and 5750
fixes for: function causes timeout when deleting temporary files for large scorm objects
scorm\validate.php calls function scorm_delete_files from scorm\lib.php - but lib.php not included in validate.php

Validation of Scorm objects broken - adds entry in modules database even when scorm object is not created.
2006-07-23 23:40:00 +00:00
danmarsden 146a1735ac Fix for Bug 6119 - gives error when choice full, and user submits a choice they have already selected 2006-07-23 22:12:40 +00:00
danmarsden 8dc6117433 fix for Bug #4733 title gets garbled when html inside title. 2006-07-23 22:03:39 +00:00
moodler 08f72e477c Automatic installer.php lang files by installer_builder (20060722) 2006-07-22 02:46:09 +00:00
tjhunt d1c93d9605 Replace a few odd tabs with spaces. 2006-07-21 08:01:34 +00:00
stronk7 eede7619ef Bump to 1.6.1. No DB changes. 2006-07-21 07:55:35 +00:00
tjhunt bf6f63ae00 Bug #5946 - matching question php notice 2006-07-21 07:19:04 +00:00
urs_hunkler 2f1dff3561 corrected bug with teacher rights 2006-07-21 04:53:08 +00:00
urs_hunkler d0b4e8226f corrected a bug with teacher rights 2006-07-21 04:49:47 +00:00
gbateson 889d2b5ead microincrement version to 2.1.21 2006-07-21 00:10:29 +00:00
moodler 43935e12c9 Bump to 1.6.1 2006-07-20 23:43:47 +00:00
skodak ad44e5c049 fixed minor PHP5 compatibility problem with clone() 2006-07-20 06:53:29 +00:00
skodak 4075eb10da Bug #6075 - file admin/index.php is ISO encoded - headers broken by ob_end_flush(), fixed version check 2006-07-20 06:38:12 +00:00
skodak 10bafd3d21 Bug #6141 - Cron output is not plain text - <pre> and missing encoding, minor lang issues 2006-07-20 06:35:25 +00:00
skodak 605737cdfb Bug #6097 - HTML editor and brackets - fixes lesson problems 2006-07-20 06:30:10 +00:00
ikawhero 595eda8d9c Fixed typo. 2006-07-20 00:42:56 +00:00
skodak 56def90b83 yet another fix for course list for guests 2006-07-19 13:57:57 +00:00
skodak 74f6a9fb7e fixed course list for guests 2006-07-19 13:43:40 +00:00
skodak 8e764b36b1 admin should not see list of courses on the frontpage when there are too many of them 2006-07-19 13:33:18 +00:00
skodak 93f973f08b fixed course/index.php category display affected by previous commit - improved category and course list display on front page 2006-07-19 13:15:11 +00:00
skodak 4e7d821b34 section not always moved when requested - page reloading prevented by anchor; added random parameter to force reloading 2006-07-19 12:49:55 +00:00
skodak 31c46027aa Bug #6093 - Removed course sections re-appear after moving existing sections 2006-07-19 12:28:41 +00:00
skodak 4e2b4b1bc2 Improved category and course list display on front page- see bug Bug #5965 - Frontpage Category List also showing courses; new Combo List(categories + courses), fixed categories list and separate settings for not logged in / logged in users 2006-07-19 12:01:38 +00:00
moodler 2fa6e1ff26 Added missing global 2006-07-19 10:17:48 +00:00
moodler e63dc8ea91 Just simplifying logic a little 2006-07-19 10:16:15 +00:00
skodak 8c251d1a93 Bug #6136 - Hard coded admin paths 2006-07-19 07:59:16 +00:00
stronk7 4985c39b50 minor bump to perform some changes on grade_letter 2006-07-18 16:23:28 +00:00
stronk7 4f1c93d6dc Fixing one recently added DB upgrade. Please be careful on STABLE! ;-) 2006-07-18 16:22:36 +00:00
tjhunt 96ef5c792a Fixed typo which caused images in questions to fail to display if NOT using slasharguments. Merged from HEAD - original checkin was 1.49 to 1.50 by danstowell. 2006-07-18 15:37:17 +00:00
tjhunt e10e4fdd55 Bug #6033 - missing string for unknown questiontype. Also tidied up some messy code. 2006-07-18 15:27:50 +00:00
tjhunt f2ea23a1bd SC#277 2006-07-18 13:32:54 +00:00
tjhunt 6b319a8087 Bug #6116 - Quiz database upgrade scripts call renamed function by the old name. 2006-07-18 10:58:40 +00:00
urs_hunkler 172d326c41 enhancements and bugfixes, works now in Safari and Konqueror 2006-07-18 09:06:06 +00:00
urs_hunkler 8d6c9a68b1 some style updates 2006-07-18 07:22:06 +00:00
skodak e2337127eb Bug #2149 - admin/creators.html javascript error 2006-07-18 07:16:29 +00:00
skodak 462a25fe75 Bug #6134 - error of coding, in function grade_download_form() 2006-07-18 06:42:21 +00:00
martinlanghoff 8a774fddb7 Close Bug #5670 - get_courses_page() - remove costly and redundant DISTINCT
get_courses_page() uses get_records_sql() which means that it will actually
break if the first field requested isn't c.id. This in turn means that
the DISTINCT is not needed at all.

So let's go fast again!
2006-07-18 04:35:45 +00:00
martinlanghoff 059366fe22 Course restore - Restrict shortname to <= 15 characters, like the database table.
Author: Donal McMullan <donal@catalyst.net.nz>
2006-07-18 03:32:51 +00:00
moodler 834f10e9b2 Automatic installer.php lang files by installer_builder (20060718) 2006-07-18 02:42:48 +00:00
toyomoyo 14080bd00a fixed a bug where user can view site posts when not logged in 2006-07-18 02:27:17 +00:00
martinlanghoff 23ea06dfbe auth/db: When using internal passwords we must register auth_update_user_password()
Now users can update their password correctly. We did have this before, I
wonder if it got dropped in a merge.
2006-07-18 01:34:19 +00:00
martinlanghoff 8d2529e59e auth/db: use auth_validate_form() to set auth_db_stdchangepassword when passtype is 'internal'
When using the 'internal' password handling, set auth_db_stdchangepassword
so we allow users to change their password normally.
2006-07-18 01:33:45 +00:00
martinlanghoff 8f527a42ee auth: extend API to support auth_validate_form()
Now Auth plugins can register auth_validate_form to get a chance
to validate config form input. Needed on MOODLE_16_STABLE to fix
a bug with auth/db.

The auth API must follow suit with the enrol API, where we can safely
do method_exists().
2006-07-18 01:31:45 +00:00
jgraham909 f8100e3629 Fix for grade_letter table and how MySQL version 5.0.3+ handles DECIMAL
fields

Versions: 5.0.3+ truncate to 99.99 if a value of 100.00 or greater is
input for grade_high or grade_low.

See the following for more info:
http://dev.mysql.com/doc/refman/5.0/en/precision-math-decimal-changes.html
2006-07-17 22:38:58 +00:00
skodak 25cbc9d08f Bug #1395 - Calandar view.php should respect forcelogin 2006-07-17 21:07:06 +00:00
skodak 88e912b1b1 Bug #6129 - Incorrect glossary import file size limit 2006-07-17 13:34:17 +00:00
tjhunt 31222bc4ef Bug 5840 - Image not displayed in Cloze question. 2006-07-17 08:47:29 +00:00
skodak 34db6d30a0 Bug #6120 - Course creation - loginproblem 2006-07-17 08:38:45 +00:00
skodak 63d337cf47 correction - bug 6130, not 3130 2006-07-17 07:29:46 +00:00
skodak 285105fbf1 workaround by Dan for bug #3130, fixed some warnings 2006-07-17 07:28:54 +00:00
martinlanghoff b1682ee480 enrol API: Updated documentation 2006-07-17 06:01:31 +00:00
stronk7 226f066ed5 Close properly the showentry page. Bug 5986.
(http://moodle.org/bugs/bug.php?op=show&bugid=5986)
2006-07-16 08:59:33 +00:00
gbateson 08a1da2bb9 micro-increment version number to v2.1.21 2006-07-16 06:54:53 +00:00
gbateson 9b2f93bcf3 add double quotes to index fields to avoid reserved words errors in pg7. correct setting of default values in HotPot 2006050201 which was incompatible with pg7.3 2006-07-16 06:53:41 +00:00
moodler ec64d5223d Automatic installer.php lang files by installer_builder (20060716) 2006-07-16 02:40:00 +00:00
gbateson 6ce20e4d58 initialized objects using new stdClass() and adjusted use use of empty() and isset() in hotpot_restore_records() function 2006-07-15 14:28:22 +00:00
gbateson e48bc9eb25 fixed setting of empty secondary fields during restore (bug 6113) 2006-07-15 13:47:09 +00:00
stronk7 74b29acec4 Soled bug 6089 plus some minor iteration savings...
(http://moodle.org/bugs/bug.php?op=show&bugid=6089)
2006-07-15 08:38:19 +00:00
skodak 613b02036f Bug #6080 - Loancalc block doesn't define a footer string 2006-07-14 21:04:27 +00:00
skodak 495f166ec4 todo: add detection of incorrect chars in wwwroot 2006-07-14 20:56:16 +00:00
tjhunt d0f8a899f8 Bug 6111 - Rewrite the code for making an indented list of question categories, becase the existing code was so horrible. 2006-07-14 15:32:57 +00:00
moodler 0183254bc5 Automatic installer.php lang files by installer_builder (20060714) 2006-07-14 02:39:22 +00:00
skodak bbdb1c3815 Bug #6099 - Restore alternatively failing on data module - fixed status codes of module restore process 2006-07-13 15:33:37 +00:00
moodler e9dbe49121 Document $CFG->allowvisiblecoursesinhiddencategories 2006-07-13 14:17:49 +00:00
moodler e714706c42 In Moodle 1.6 the behaviour of course access was changed so that visible
courses would be invisible if they were within a hidden category.

However, the old behaviour was useful in many instances, so I've added
a $CFG->coursesinhiddencategoriesarehidden that will return to that old
behaviour if required.
2006-07-13 13:58:14 +00:00
moodler f450edd426 Updates to assignment language file to support upload assignment type
(which is not in 1.6, it's 1.7, but should work in 1.6 in case people
want to try it already)
2006-07-13 07:42:13 +00:00
mark-nielsen 09447862c0 [BugFix] Bug #5466 - Cluster and End of Cluster pages no longer display scores in extended editing view. Also added page type display for cluster and end of cluster pages in the extended editing view (which is displayed for all other pages as well). 2006-07-13 00:34:20 +00:00
skodak 96856b5798 Bug #6087 - alphabetic problem in glossary 2006-07-12 20:28:21 +00:00
moodler 28e58deb41 Automatic installer.php lang files by installer_builder (20060712) 2006-07-12 08:18:08 +00:00
moodler ab6508500c FIxed bad lines 2006-07-12 08:12:16 +00:00
moodler 0b32ca3ba0 Removed bad lines 2006-07-12 08:11:24 +00:00
moodler 9a2e6ce88c Automatic installer.php lang files by installer_builder (20060712) 2006-07-12 08:08:58 +00:00
martinlanghoff 070a7cc0c2 Fixing up broken language packs for sm and to in install. 2006-07-12 06:31:46 +00:00
skodak 2277cfb8fb fixed printing of filenames from zip archives - SC#273 2006-07-12 05:54:37 +00:00
martinlanghoff 551d2b59bf chat: Prevent user from submitting a 2nd message before his 1st is received.
Some users reported that mod/chat was silently dropping some messages. The
user's browser may not be able to keep up with the rate at which he submits
chat messages. This update keeps things sane.

Author: Donal McMullan <donal@catalyst.net.nz>
2006-07-12 02:28:37 +00:00
tjhunt 7203acd306 Bug #6077 - Teacher saving their grades destroys student essay! 2006-07-11 16:10:56 +00:00
moodler 07f579d0bd Automatic installer.php lang files by installer_builder (20060711) 2006-07-11 14:22:47 +00:00
moodler 732581eb56 Manually fixed 2006-07-11 14:14:15 +00:00
skodak 344c23c0ef better cleaning of $file parameter SC#276 2006-07-11 13:18:59 +00:00
skodak b515688ddb workaround for Bug #6035 - editing quiz in one tab changes quiz in other 2006-07-11 13:00:34 +00:00
skodak 76f8821cfc Bug #6067 - The restore process behaves differently depending on which module contains the absolute links 2006-07-11 10:00:02 +00:00
moodler 95e34d9299 new installer.php files added. (stronk7) 2006-07-11 09:41:13 +00:00
toyomoyo bc77686a08 changed feedback in the function that handles user table 2006-07-11 03:35:19 +00:00
moodler 720669a6db Automatic installer.php lang files by installer_builder (20060711) 2006-07-11 02:39:43 +00:00
skodak d6b7aa9c25 Bug #5988 - Branch Tables in 1.6+ (Lesson Module) 2006-07-10 22:38:45 +00:00
skodak 4287b1f51b Bug #5732 - Lesson Scores &quot;out of XX&quot; marks report incorrect mark 2006-07-10 21:51:20 +00:00
ethem 2dc90eb90e - authorize_expired function added to lessen the code.
- All functions in authorize plugin are named with authorize_ prefix.
2006-07-10 09:43:00 +00:00
moodler 243c0e302a Merged fixes from HEAD for missing backup data 2006-07-09 16:26:37 +00:00
mudrd8mz f392379a36 Replaced by improved lang.php from HEAD which is now considered as stable. 2006-07-09 15:20:34 +00:00
skodak 8fdaba4020 Bug #6050 - import glossary entries to new glossary not creating new glossary 2006-07-07 19:53:28 +00:00
thepurpleblob 7e1a25bbdd Note that 'span' tags are permitted as well as 'lang' in multi-language
filter
2006-07-07 10:36:01 +00:00
skodak d8b7f70be3 fixed warning in glossary export 2006-07-06 21:25:42 +00:00
skodak ca567fc69b Bug #5820 - IE returns unsecure items with SSL on login 2006-07-06 15:51:17 +00:00
thepurpleblob ef1c5c394e Bug #4375 - did not work correctly in blocks. 2006-07-06 14:00:43 +00:00
ethem f5a4f9a980 Some outputting debugging info for cron. 2006-07-06 13:23:05 +00:00
ethem 905c4d38ad Performance for welcome message sending to students.
Order by students.
Dear student, welcome to these courses:
Coursename1
Coursename2
Coursename3

This sends an email for each student.
2006-07-06 11:57:43 +00:00
ethem 2044f30ec3 New string: welcometocoursesemail 2006-07-06 11:53:02 +00:00
tjhunt 52bf72770c Bug 6031 - missing parameter for warningmissingtype in libquestionlib.php 2006-07-06 11:09:03 +00:00
skodak 3294198a19 Bug #4698 - Login block is broken!, improved cookie test 2006-07-06 10:09:34 +00:00
tjhunt 68f039dedf 6030 - Can't move question categories back to the top level. 2006-07-06 10:07:02 +00:00
skodak 8c68b750a8 Bug #5921 - editing forum post bug 2006-07-06 10:00:08 +00:00
skodak de288c6099 Bug #5615 - Assigment listing shows duplicate names with paged display 2006-07-06 09:46:49 +00:00
thepurpleblob 39c18c39d1 Bug #4838 - removing spurious blank line at end 2006-07-06 08:36:38 +00:00
martinlanghoff 05a289bf1f wiki: fix for IE6 bug with HTMLArea, where the text area is not drawn
IE6 measures a page element and - sometimes - it does this before the
element is drawn, so the dimensions it finds are zero. This update sets
sensible minimum for the width.

Author:  Donal McMullan <donal@catalyst.net.nz>
2006-07-06 05:35:47 +00:00
martinlanghoff 904bd828c7 wiki: Fix for broken view on new (empty) wiki pages.
The wiki should display the 'edit' screen when a user tries to view a page
that doesn't exist. This output should not be filtered.

Author: Donal McMullan
2006-07-06 05:06:07 +00:00
ethem 27b1d9d581 Daily cron seperated from main cron for performance.
To do:
Performance for welcome message sending to students. Group by student and courses. Like this:
Dear student, welcome to these courses:
1- Coursename 1
2- Coursename 2
3- Coursename 3
2006-07-05 16:54:43 +00:00
thepurpleblob cdc03b2a02 Bug #6011 - fixed bug dropping question name from cloze questions. 2006-07-05 12:38:51 +00:00
thepurpleblob 87e2569a2b Fix for bug #6013. Unable to import blackboard. Some of the changes
in moving to question banks had broken the format.
Also tidied up some notices.
2006-07-05 10:55:24 +00:00
tjhunt e4f8392813 Bug 6019: Quiz timer does not submit the form when it reaches zero. 2006-07-05 10:43:13 +00:00
skodak ce4af6df62 changed memory limit test in healthcenter 2006-07-05 08:37:32 +00:00
skodak a520b47745 healthcenter fixes - new extra whitespace detection, fixed automatic slasharguments detection 2006-07-05 07:41:51 +00:00
toyomoyo e1ddd943fb fixing a bug where global lang is not respected in user table 2006-07-05 01:53:43 +00:00
skodak cb43ec58fb fix for mysqladmin links 2006-07-04 09:39:21 +00:00
skodak c72387b7a0 removing healthcenter link in MOODLE_16_STABLE 2006-07-04 09:30:27 +00:00
skodak 57ba975b11 Bug #5909 - Fix use of user_group() because it returns arrays now - part 2 forum search fixed too 2006-07-04 08:30:16 +00:00
skodak 2cfa6389c8 fixed $site->id warning 2006-07-04 06:04:35 +00:00
skodak fc62b3ed36 Bug #6007 - &quot;The requested URL /course/report/log/view.php was not found on this server&quot; 2006-07-04 05:25:39 +00:00
moodler 825eadf070 Automatic installer.php lang files by installer_builder (20060704) 2006-07-04 02:39:44 +00:00
skodak 25e80a87f9 Bug #5909 - Fix use of user_group() because it returns arrays now - part 1 2006-07-03 21:07:41 +00:00
skodak fdfffda00f Bug #5974 - Course overview report should not error when stats are not up to date; fixed by changing the return value from stats_check_uptodate(), NULL is now OK, string value describes error and adding notify() where needed 2006-07-03 15:42:29 +00:00
skodak 173de2e8fa Bug #5991 - The calendar does not show the month's first day's event 2006-07-03 09:09:15 +00:00
skodak 9f1eaeda4f Bug #5995 - poor English in expiry notice 2006-07-03 07:18:58 +00:00
skodak daf27b51b4 Bug #5996 - block+resource=problem 2006-07-03 06:25:40 +00:00
moodler 2fe6249d41 Automatic installer.php lang files by installer_builder (20060701) 2006-07-01 02:39:58 +00:00
skodak 27e7895379 slashargument fix for healthcenter, better diagnostic messages; renamed file.php/pic.jpg option to file.php/1/pic.jpg because the course number is mandatory -continued 2006-06-30 13:39:04 +00:00
skodak 0b7911a748 slashargument fix for healthcenter, better diagnostic messages; renamed file.php/pic.jpg option to file.php/1/pic.jpg because the course number is mandatory 2006-06-30 13:38:05 +00:00
skodak 92a6edf143 cleanup in admin/index.php; preparation for health center, loginas gui, password salts 2006-06-30 12:54:41 +00:00
skodak 4a4c960d99 fixed // in course root when browsing files 2006-06-30 11:55:41 +00:00
tjhunt 2f12aae186 Bug 5967 - Missing lang strings and help for quiz reports. 2006-06-30 10:27:17 +00:00
skodak 1530745ba6 Bug #5961 - small grammar error 2006-06-30 07:33:16 +00:00
skodak bd93091c8a Bug #5802 - Incorrect length in http partial content (206) packets. 2006-06-30 07:21:55 +00:00
moodler 609784e0aa Automatic installer.php lang files by installer_builder (20060630) 2006-06-30 02:42:55 +00:00
skodak 7c58698a8a Bug #5937 - Fix nonascii chars in graphs:
* text is converted to unicode - no html entities anymore
 * then all nonascii chars are converted to decimal number entites
 * default.ttf is searched in dataroot/lang and local language packs too
 * removed lang_decode() - obsoleded by proper entity converison above
 * updated documentation in lang/en_utf8/fonts/README.txt
2006-06-29 21:19:10 +00:00
ethem 0cf39f9160 Put back last commit. If cost is 0, it always falls back to manual method. 2006-06-29 19:15:26 +00:00
ethem e65b5a1dce Bug #5941, Petr's patch is incorrect. Rewritten.
If course cost is 0 then always fall back to manual method. This is not authorize problem if enrolment key is empty and guest access with key.
2006-06-29 18:59:49 +00:00
ethem ec4fda2d3d Bug #5941, Petr's patch is incorrect. Rewritten.
If course cost is 0 then fall back manual method.
2006-06-29 18:13:03 +00:00
moodler e8b5984085 new installer.php file added. (stronk7) 2006-06-29 16:53:32 +00:00
ethem 0dafbf714a $teacher is used in manual form. No need global. 2006-06-29 15:00:17 +00:00
ethem 381cc85743 get_student_courses and get_teacher_courses functions added for future reference.
Cron description added.
2006-06-29 12:39:42 +00:00
ethem f59c789b28 Don't show choose method string if course cost is 0. 2006-06-29 11:25:04 +00:00
ethem f6c29f43ae New string. No cost yet. 2006-06-29 11:10:27 +00:00
ethem e99b6fb404 Interactive plugins (authorize and paypal ) must use 'manual'.
Some patches must be applied to lib/db.
http://moodle.org/bugs/bug.php?op=show&bugid=5941
Look: version.patch, lib_db.patch

Eloy, your question about enrol fields for interactive plugins were solved.
Now, we sure we never use authorize and paypal field for backup and restore.
Because manual is active and cannot be disabled when restoring.
Bug #5358 - Add support for enrol systems in backup/restore
http://moodle.org/bugs/bug.php?op=show&bugid=5358&pos=0
2006-06-29 10:24:08 +00:00
ethem a395180a81 Bug #5941 - Myriad of problems with Paypal enrollmemts, au_enrol.patch 2006-06-29 09:46:10 +00:00
skodak ce72ff9018 Bug #5944 - error message when moving thread 2006-06-29 08:00:48 +00:00
skodak 4314bcdd89 Bug #5952 - bad links in &quot;about wysiwyg editor&quot; 2006-06-29 07:19:44 +00:00
skodak d23f9f5d48 Bug #5953 - problem in /auth/ldap/lib.php 2006-06-29 07:03:38 +00:00
skodak 1eb6f0cd22 Bug #5955 - link to help item for html editor looks funny 2006-06-29 06:59:26 +00:00
skodak fee582844b Bug #5959 - save and view takes to wrong place 2006-06-29 06:52:48 +00:00
skodak 1c813b4080 Bug #5960 - can't delete or edit comments 2006-06-29 06:47:35 +00:00
moodler 993d8956ea Automatic installer.php lang files by installer_builder (20060629) 2006-06-29 02:40:22 +00:00
tjhunt e067c3a1f0 Bug #5918 - essay question comments from teachers lost in 1.6 upgrade. Thanks to Mark Nielsen the suggestion of how to fix. 2006-06-28 17:13:17 +00:00
skodak 1a833b5836 Bug #5941 - Myriad of problems with Paypal enrollmemts, part 3 - fixed 'login as student' button, now plain guest login action 2006-06-28 15:36:53 +00:00
skodak 48653e6c05 Bug #5941 - Myriad of problems with Paypal enrollmemts, part 2 - Login as guest not shown to guests and there is login link instead of paypal button for guests 2006-06-28 15:25:05 +00:00
skodak 804cc92184 minor loginas cleanup 2006-06-28 14:57:44 +00:00
ethem e5cf77cd19 Multienrol FIX: Move error message from this to manual plugin to show error message. This plugin is never inherited anymore. Each time, we create new manual_plugin() and this causes hiding error message. 2006-06-28 14:47:01 +00:00
skodak 0ea68a9cdd Bug #5941 - Myriad of problems with Paypal enrollmemts, part 1 2006-06-28 12:42:43 +00:00
tjhunt 6d812d61a2 Bug #5922 - comment from manualgraded questions lost during regrade. Thanks to Jean-Michel Vedrine for the fix. 2006-06-28 11:40:56 +00:00
tjhunt a9f56a8f0d Bug #5945: Lang string name missmatch when starting quiz attempt. 2006-06-28 10:10:28 +00:00
moodler 2dc8a5c519 Automatic installer.php lang files by installer_builder (20060628) 2006-06-28 02:39:18 +00:00
skodak 7bd9c89714 Bug #5927 - extending enrollments doesn't 2006-06-26 21:57:42 +00:00
skodak 24999ce035 Bug #5931 - blocks block database 2006-06-26 21:34:13 +00:00
skodak 31053d630f assignments on mymoodle page, Bug #5839 - Found more than one record in get_record_sql ! 2006-06-26 16:15:29 +00:00
skodak 01ac5c3191 fixed broken stats image link, Bug #5924 - User profile statistics tab 2006-06-26 13:47:52 +00:00
tjhunt 6aeb5a1f35 Bug 5889 - Regrading a quiz wipes student answers. Thanks to Jean-Michel Vedrine for the fix. 2006-06-26 11:21:08 +00:00
toyomoyo a73a0a6d8c fix for 5916, when blogs disabled do not print link of blog in profile 2006-06-26 08:30:32 +00:00
skodak d3d91e9a72 fixed Turkish problems see, Bug #5878 - Teachers can't add blog and blocks. 2006-06-26 07:21:13 +00:00
vyshane f64475c360 Using notify instead of error to display error message when purging of RSS
files fail during a discussion move between forums.
2006-06-26 03:59:28 +00:00
stronk7 459154ffbd Some minor changes in order to avoid some notices... 2006-06-25 10:15:31 +00:00
julmis b7504102dc commenting out ob_gzhandler. 2006-06-23 19:50:42 +00:00
toyomoyo 4590fe5598 added support for custom langs, and Eloy's change to 1000 record, see HEAD commit message 2006-06-23 01:51:36 +00:00
toyomoyo f7c1de925b added support for custom lang packs, and Eloy's change to 1000 records before system responds. Please see his commit msg on HEAD for details. 2006-06-23 01:48:18 +00:00
thepurpleblob 07ccf0a68d Fixed mix-up between MikTeX and MimeTeX. 2006-06-21 10:18:51 +00:00
toyomoyo 6408f30173 fix for 5881, no closing tag 2006-06-21 03:12:54 +00:00
moodler bdaee88fac Automatic installer.php lang files by installer_builder (20060621) 2006-06-21 02:43:53 +00:00
ethem 552f0e47dc Very small change. A little performance for cron if admin enabled sending email for pending orders expiring.
1- If dailysettlement is 00:05 and cron executes at this time, nothing will occur. If it is executes at 00:10 it works. I think "<" works faster then "<=" :))
2- Don't compare course->ids by authorize->courseid, because courses are grouped by courseid. We sure each line is unique.
3- Only get pendingorderexpiring strings for sending email if course teachers exist.
2006-06-20 17:07:56 +00:00
moodler 84331e061f Bump past 1.6 2006-06-20 14:58:55 +00:00
stronk7 de43be04ae helper string to explain $CFG->doctonewwindow added. 2006-06-20 14:22:14 +00:00
stronk7 54374e63f0 Now docs are showed in a new window based on $CFG->doctonewwindow 2006-06-20 13:51:47 +00:00
stronk7 294c6adb0a Added new option to decide if docs will be showed in a new window. 2006-06-20 13:40:27 +00:00
moodler 1c05b46ac2 Added back homelink to standard theme 2006-06-19 16:30:00 +00:00
moodler ddc6b0e31d Merged error fix for RSS deletion 2006-06-19 16:21:33 +00:00
moodler 1d9a81c347 OKAY! THIS IS IT! MOODLE 1.6! 2006-06-19 15:35:50 +00:00
moodler 262ec64be3 New tags file 2006-06-19 15:33:01 +00:00
moodler 4541181369 When the tags block is shown in a course context, then make the
links to blogs stay in the same context.
2006-06-19 14:16:42 +00:00
moodler 4d0036e8be Don't show users tab if you can't go there 2006-06-19 13:51:58 +00:00
moodler 0e83e4f5ca FIxed some missing headers 2006-06-19 13:34:46 +00:00
toyomoyo d40b3e1034 changed &amp;copy; to &#169 to validate better 2006-06-19 03:52:23 +00:00
toyomoyo 72343793f6 give IE a bit more time 2006-06-19 03:29:15 +00:00
moodler d4e8a03c53 Added new class FPDF_Protection (see Bug #5855). Code submitted by chardelle at lifeworkouts dot com, commited by vy-shane at moodle dot com. 2006-06-19 02:39:05 +00:00
moodler 6c979e8a24 Some changes to improve the UTF migration output a little 2006-06-18 10:09:12 +00:00
moodler 794e4a05a3 The forum search form was always wrapping no matter what I tried.
I swapped the textbox and helpbutton around (and got rid of one more table)
2006-06-18 08:20:48 +00:00
moodler d067b2005b Moved the "helplink" CSS span outside the help text and image. No effect on themes. 2006-06-18 08:09:51 +00:00
moodler c6d79e46d9 FIxed up the print_header calls 2006-06-18 07:44:21 +00:00
moodler 2b8a5e83ac Fix for resource parameters for users not logged in 2006-06-16 09:41:41 +00:00
moodler 2a1e7c302c Added check for $CFG->disablemycourses 2006-06-16 04:29:22 +00:00
toyomoyo 59b4825741 fixing centering of tabs on blog page 2006-06-16 02:58:44 +00:00
mjollnir_ 38d0c10e3c participants list last access filter should only show for teachers! I noticed this on moodle.org this morning :| 2006-06-15 21:33:06 +00:00
ethem 50d2685d0e $a->course: course information added. 2006-06-15 14:19:49 +00:00
ethem f187b7f98b $a->course: course information added. 2006-06-15 14:06:53 +00:00
ethem 0726456942 pendingordersemailteacher string added 2006-06-15 13:34:30 +00:00
ethem 1bf6b1cc18 pendingordersemailteacher string added 2006-06-15 13:29:10 +00:00
ethem efbd1fc514 When the number of pending orders expiring are sent to the teachers via email, which one is important? The number of the orders or the total of the amounts. 2006-06-15 12:23:46 +00:00
ethem 9900b2f103 If we enabled manual-capture and teachers can manage payment and teachers can be notified about pending orders expiring,
admins can also chooise that what is the sort of importance of expiring orders? 'Sum of total' or 'Count of orders' are emailed first.
You know that the amount of money is important :)
2006-06-15 10:30:55 +00:00
ethem 2716e73e9e Order by order count. Courses that have many orders are emailed first. 2006-06-15 07:45:18 +00:00
toyomoyo abe51bbed9 fix for 5633 2006-06-15 06:32:26 +00:00
toyomoyo cd09750495 fix for 5814 2006-06-15 03:23:47 +00:00
ethem 3377c60427 Email subject for pending orders expiring. 2006-06-14 16:30:46 +00:00
ethem 5242595975 Email subject for pending orders expiring. 2006-06-14 16:19:23 +00:00
tjhunt 2605a5ba8f Moved constant definitions out of function, so they are not run repeatedly giving lots of warnings. 2006-06-14 15:34:22 +00:00
tjhunt 1aa43ea576 Corrected reference to lang string. 2006-06-14 15:30:55 +00:00
ethem f12b2a7d5d If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. 2006-06-14 11:52:01 +00:00
ethem 834d5863b9 If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. 2006-06-14 11:33:00 +00:00
moodler c8825cfd2d Fix for bug:
Notice: Undefined property: id in /home/moodle/public_html/certificate/mod/forum/discuss.php on line 38

when user is not logged in and want to view a forum of type news.
2006-06-14 08:44:36 +00:00
moodler 380b3b305c Added missing $a to print_error 2006-06-14 03:15:34 +00:00
moodler 2ae294c9d6 Automatic installer.php lang files by installer_builder (20060614) 2006-06-14 02:37:39 +00:00
tjhunt cb82934b8d * Quiz module sometimes left the user staring at a blank page. Now there is an error message. 2006-06-13 18:58:17 +00:00
tjhunt c1c70a909a Bug #5812 - Standard theme font size CSS not sufficiently defensive 2006-06-13 18:52:17 +00:00
ethem 541ba098e7 Link to Payment Management page? 2006-06-13 18:29:28 +00:00
ethem c298a8b8e0 Link to help file 'Order Review'. 2006-06-13 18:02:24 +00:00
ethem 94863d1946 Help file for 'Order Review'. Merged from HEAD 2006-06-13 17:52:58 +00:00
ethem 6b8155d4a8 file orderreview.html was added on branch MOODLE_16_STABLE on 2006-06-13 17:52:58 +0000 2006-06-13 17:51:11 +00:00
ethem d9e4f9eb2a Handle also formatted time 00:30 for settlement time. 2006-06-13 15:59:11 +00:00
ethem d864c083c2 Predict the time of settlement at first time. Probably, admin user set up own country timezone and we can use this time as settlement time.
Function used: get_user_timezone_offset()
2006-06-13 15:24:28 +00:00
tjhunt 80970e2938 Bug #5810 missing ' > 7' in debug test. 2006-06-13 14:36:08 +00:00
vyshane c196e0f3cb Merged from 1.5. Fix for Bug #5767 - Section links block is removed from
course view after settings update.
2006-06-13 07:47:51 +00:00
tjhunt 5a6dba91bb Fix restore notice. 2006-06-12 15:35:28 +00:00
tjhunt 4600286cd2 Bug #5793: remember whether Show all has been clicked in the question bank. 2006-06-12 13:51:11 +00:00
tjhunt 4bbd7130f1 Bug #5790: Answer order for MC qtype not specified. Fix. Thanks to Peter Bulmer. 2006-06-12 11:03:11 +00:00
toyomoyo b862c77e93 proper html for help file 2006-06-12 07:24:24 +00:00
toyomoyo 1a149c0d33 a few mismatches between db and this html 2006-06-12 07:17:59 +00:00
toyomoyo 84f3391271 adding help file 2006-06-12 04:07:27 +00:00
moodler 1f66b55e6e Fixed hardcoded style widths in all formats 2006-06-11 06:47:43 +00:00
moodler 4339f32452 Removing hardcoded style widths and replaced with table widths, which improves page build appearance 2006-06-11 06:42:42 +00:00
stronk7 00b8db5f4f Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775)
the [[cntrl]] pcre class was breaking some chars. Changed to a safer
alternative. Bug 5777.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)
2006-06-10 23:31:21 +00:00
stronk7 b0bba0e704 Change the moodle_strtolower() function to use textlib services.
Also, mark it as deprecated, code should use text services directly.
Partially, bug 5777. It continues under investigation.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)
2006-06-10 10:38:27 +00:00
moodler d501331e75 Automatic installer.php lang files by installer_builder (20060610) 2006-06-10 02:36:19 +00:00
moodler ac9ed861a4 Automatic installer.php lang files by installer_builder (20060610) 2006-06-09 18:58:21 +00:00
moodler effa8cd5d1 Automatic installer.php lang files by installer_builder (20060610) 2006-06-09 17:19:42 +00:00
stronk7 3dbdb64c89 The absolutely incredible bug! It was working being wrong! Bug 5775.
(http://moodle.org/bugs/bug.php?op=show&bugid=5775)
2006-06-09 14:21:49 +00:00
ethem 660e6d5f9d Sending email for pending orders expiring string (adminemailexpired) seperated.
Settings moved to adminemailexpsetting.
2006-06-09 11:24:09 +00:00
ethem 277ea82b49 Sending email for pending orders expiring string (adminemailexpired) seperated.
Settings moved to adminemailexpsetting.
2006-06-09 11:18:16 +00:00
ethem dce99d41f4 Show 'name on card' string instead of moodle.php's user string. 2006-06-09 10:56:54 +00:00
ethem 44c4e47a1c Some config sections 'Order Review' moved to
an_teachermanagepay -> Site-Wide Settings
an_emailexpired: -> Email-Sending Settings
an_cutoff: -> Authorize.net Settings
2006-06-09 10:25:24 +00:00
stronk7 ba4f9b230f Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)
2006-06-09 10:00:47 +00:00
stronk7 2ba777cd5a Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)
2006-06-09 09:43:59 +00:00
stronk7 03b40486ca Avoid empty processing both for PLAIN_SQL_UPDATE and PHP_FUNCTION
Merged from HEAD
2006-06-09 09:18:35 +00:00
toyomoyo ea257a167e typo should be 0 not 1 2006-06-09 02:52:05 +00:00
toyomoyo a666b9dbcf disable the blog tag if blog is disabled 2006-06-09 02:44:49 +00:00
bobopinna 986a50e26d change advanced to parameters 2006-06-08 15:35:06 +00:00
bobopinna 625c8a70aa Fixed some language refinements 2006-06-08 15:24:23 +00:00
moodler 66a14b7292 Help content for available tags. 2006-06-08 08:26:50 +00:00
skodak 0a265f0fcd Bug #5663 - errors after changing grade weight 2006-06-08 06:38:08 +00:00
skodak be8137a81b Fixed course searching 2006-06-08 06:23:34 +00:00
vyshane 8bdb6d99a8 Added missing string norecentactivity. 2006-06-08 06:18:06 +00:00
toyomoyo 07c8c52cbf bug fix for 5748 2006-06-08 04:07:24 +00:00
toyomoyo b588ef46f4 changed recordset size to 50 2006-06-08 02:45:48 +00:00
stronk7 cdb048acd7 Solve one issue with skipped courses and email to admin
being set every xx minutes. Bug 5621.
(http://moodle.org/bugs/bug.php?op=show&bugid=5621)
2006-06-07 22:17:31 +00:00
ethem dd9a68560e Unnecesary strings removed. 2006-06-07 18:42:47 +00:00
skodak c731399ff1 Bug #5522 - question/restorelib.php error 2006-06-07 14:56:36 +00:00
skodak c8d483b80c incorrect course number in categories after course delete 2006-06-07 14:04:55 +00:00
vyshane 75775efcf7 Fix for Bug #5131 - RSS Feeds and Moving Discussions. 2006-06-07 08:16:01 +00:00
toyomoyo de8c6852d3 fix for 5720 2006-06-07 06:03:41 +00:00
toyomoyo 36d7c02847 fix for 5720 2006-06-07 05:56:59 +00:00
vyshane 64375cb146 Fixed bug: SCORM module window options were not being saved properly - array
values used instead of keys in scorm_option2text().
2006-06-07 04:34:29 +00:00
toyomoyo 1f7569c38a some javescript progress bar changes, 1) status updates correctly when resuming 2) table numbers is not hardcoded anymore 2006-06-07 04:30:50 +00:00
toyomoyo d636096334 changes are made to facilitate the migration of user table by row. function migrate2utf_user is added. This only affects mysql atm. Please help test and report bugs! 2006-06-07 04:09:37 +00:00
skodak 1f1a9a809c Bug #5659 - Problem with build-in buttons when creating templates 2006-06-06 20:54:16 +00:00
skodak fe19f91525 Bug #5734 - Enrolled students can't access metacourse after unhiding while logged in 2006-06-06 19:00:51 +00:00
tjhunt aea38264b5 Fix notices when you restore a course with an empty forum. 2006-06-06 17:23:42 +00:00
tjhunt 44e2500992 Bug #5559: revised fix - using better CSS class names. 2006-06-06 17:07:58 +00:00
stronk7 ecf140979f Adding two new strings for RESTRICTED tests in environmenlib. 2006-06-06 16:56:16 +00:00
stronk7 9531202c10 Now environmentlib supports RESTRICT sections (to be able to deny
any general test with more detail (the opposite to the BYPASS section)
(http://moodle.org/bugs/bug.php?op=show&bugid=5653)

Merged from MOODLE_15_STABLE
2006-06-06 16:15:35 +00:00
skodak a5436ee747 Bug #5535 - Database module backup error in 1.5.4, patch submitted by Patrick Pollet 2006-06-06 15:11:34 +00:00
bobopinna 826067335c Fixed some regular expression Bug 5041 2006-06-06 14:33:10 +00:00
tjhunt d5306794ec Fix for calculated questions where each one builds on the last. 2006-06-06 14:27:45 +00:00
tjhunt 89905101b7 Fix notices from the quiz module on backup and restore. 2006-06-06 14:13:55 +00:00
tjhunt f6849778a7 Make cron a bit more rebust by changing the way the require is done. 2006-06-06 14:10:33 +00:00
skodak c0f904046c Bug #5678 - Question marks, single quotes in field name cause trouble - cleaning hack ported from clean_filename() 2006-06-06 10:15:49 +00:00
tjhunt 23da79eff2 Fix notice. 2006-06-06 10:10:07 +00:00
skodak 176d1229af Bug #5680 - Fixed duplicate field names 2006-06-06 09:34:23 +00:00
skodak 6aef11722c Bug #5444 - Import PowerPoint - PHP5 clone bug 2006-06-06 08:52:51 +00:00
vyshane 5218d67aca New stats admin report. This shares code with /course/report/stats. Basically
the same report, but in an admin context.
2006-06-06 04:18:16 +00:00
vyshane 9b037d3842 New files with required code after refactoring this report module. 2006-06-06 04:13:44 +00:00
vyshane 6481349eb3 Refactored this report module so that we can also use it from
/admin/reports/stats.
2006-06-06 04:09:31 +00:00
tjhunt 9abb0f813a Bug #5672: Make calculated questions less confusing to create. 2006-06-05 16:56:31 +00:00
tjhunt 914d8f5801 Fixed reference to incorrect language string. 2006-06-05 14:14:12 +00:00
ethem 7a553f06a3 Some cron performance. Run clean-ups and send email daily on settlement date.
an_nextmail config deleted, instead of old config new an_dailysettlement inserted into config_plugins table.
2006-06-05 12:58:16 +00:00
skodak a9fd047eea Bug #5725 - Assignment grading pop up windows do not close, broken by 4976 2006-06-05 12:17:20 +00:00
bobopinna b225c41b53 Fixed a typo 2006-06-05 08:23:34 +00:00
bobopinna 2d0ee29b15 Added class name for IFRAME element 2006-06-05 07:40:18 +00:00
bobopinna 0bfac2fe7a Fixed a modified name for some constants 2006-06-05 07:19:07 +00:00
skodak c7d9b99dae Bug #5715 - error message in messaging - notice lastaccess 2006-06-04 23:10:32 +00:00
skodak f87c87b9ba Bug #5721 - students cannot take quiz when course language set to French 2006-06-04 23:00:00 +00:00
skodak 88c0c27c83 fixed warning when no students graded yet (caused by useless assignment) 2006-06-04 21:34:14 +00:00
stronk7 395c75becd make_default_scale() now searches properly under
both dataroot and dirroot, defaulting to en_utf8. Bug 5719.
(http://moodle.org/bugs/bug.php?op=show&bugid=5719)
2006-06-04 15:17:03 +00:00
stronk7 b02e4ee384 report XXXX actions added. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-04 00:35:04 +00:00
stronk7 fae3f45758 course report xxxx actions now are supported on restore. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-04 00:00:02 +00:00
skodak 5d46f73a3c Bug #5716 - Impossible to turn off highlighted current topic 2006-06-03 23:46:50 +00:00
stronk7 1ac7d05730 course report xxxx actions must send courseid in the info field. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-03 20:33:44 +00:00
stronk7 27f60090f6 And some more (the last) notices out! Bug 5713.
(http://moodle.org/bugs/bug.php?op=show&bugid=5713)
2006-06-03 20:16:19 +00:00
stronk7 28dc928f43 And one more collection of innocent notices avoided. Bug 5712.
(http://moodle.org/bugs/bug.php?op=show&bugid=5712)
2006-06-03 20:00:10 +00:00
skodak 7fe8550e18 clarification for restrict modules option - bug #5688 2006-06-03 19:57:42 +00:00
stronk7 c9aecec6be And another notice in restore out. Bug 5711.
(http://moodle.org/bugs/bug.php?op=show&bugid=5711)
2006-06-03 19:48:50 +00:00
stronk7 69b693dbc9 One less notice. Bug 5710.
(http://moodle.org/bugs/bug.php?op=show&bugid=5710)
2006-06-03 19:44:15 +00:00
stronk7 0803379406 Avoid one notice in backup. Bug 5709.
(http://moodle.org/bugs/bug.php?op=show&bugid=5709&)
2006-06-03 18:59:35 +00:00
stronk7 4eb4b874ba Adding support to the forum user report action
in restore. Bug 3854.
(http://moodle.org/bugs/bug.php?op=show&bugid=3854)
2006-06-03 17:44:05 +00:00
skodak aff589d128 Making sure timelimit is converted to integer before being written to database, otherwise postgreSQL complains. Closing bug 5401; merged from MOODLE_15_STABLE 2006-06-02 16:01:05 +00:00
tjhunt c4c9a5d860 Bug #5559: Move CLOZE qtype hightight colours into CSS insted of hardcoding, so themes can override. 2006-06-02 15:37:10 +00:00
nfreear 805720ebd3 Fix, bug 5614 - added ALT text for link icons (x 5), based on TITLE. 2006-06-02 13:11:38 +00:00
ethem af70ea6a96 Merged from HEAD. 2006-06-02 09:48:27 +00:00
thepurpleblob ae8df5acdf Added CLOZE question support.
Thanks to Joseph Rezeau for this one!
2006-06-02 09:44:13 +00:00
vyshane 1e900c139d Fixed bug: php warnings when there are no users in the selected course. 2006-06-02 07:35:36 +00:00
skodak ef93a24f23 fixed warning and removed ugly hack in attachment path 2006-06-02 06:47:26 +00:00
vyshane 47737013d3 Fix for Bug #5682 - 'Reset template' button in CSS template adds HTML 2006-06-02 04:27:42 +00:00
vyshane 476b3195fa Added missing language string. 2006-06-02 04:19:06 +00:00
toyomoyo ed7ce12186 fix for 5686, include_once course/lib.php in case it doesn't get included when interrupted 2006-06-02 02:53:31 +00:00
stronk7 de78b7e81b Adding propper support for the forum->user report log action. It was
a bit wrong. Code credits go to Petr!
2006-06-01 23:11:55 +00:00
skodak bf48c7abcd fixed problem in restricted modules - mods were accessed using strtolower(translated module name) instead of directory name as usual, it partially worked for English 2006-06-01 19:48:37 +00:00
skodak 26e6e8c048 fixed - unable to disable blocks 2006-06-01 19:12:42 +00:00
ethem d0bdb4d3c9 Documentation for status codes and actions. 2006-06-01 16:05:29 +00:00
skodak 7af4d79611 Bug #5643 - add Yahoo online status to user profile 2006-06-01 15:18:10 +00:00
skodak 49f020ec0c Bug #5684 - frameset page in UTF8 doesn't appear on IE 2006-06-01 14:49:31 +00:00
thepurpleblob a4bb593422 Fixing bugs #5676 and #5677
Text strings not properly escaped in a couple of places.
Conditional check inserted for optional units data in numerical questions.
2006-06-01 10:12:00 +00:00
ethem d799a9aef2 Just some tidy-ups 2006-06-01 08:44:01 +00:00
vyshane 6b611eb82d Fix for Bug #5552 - Filters conf. table looks awful. 2006-06-01 08:08:23 +00:00
ethem 1e04f3179a Just some tidy-ups 2006-06-01 07:38:23 +00:00
skodak ec7418d3ce Bug #5661 - mymoodle redirect problem 2006-06-01 05:39:46 +00:00
vyshane 6d895ae5e9 Fixed missing string 2006-06-01 04:07:23 +00:00
vyshane b194dfbf15 Fix for get_string(), which was not building the path to the language files
for reports correctly.
2006-06-01 03:05:18 +00:00
toyomoyo 278bd07a17 bug fix for 5352, setting ignore_user_abort to false 2006-06-01 02:30:20 +00:00
danmarsden 2aa86d2d33 BUG 5662 - bad check for 1.6 version. 2006-05-31 20:25:37 +00:00
stronk7 74e97cf096 Prevent doubleslashes once and again in paths. Also prevent them when writing config.php 2006-05-31 17:50:42 +00:00
tjhunt d86503c7cf Fix for bug 5379: Item analysis report should not have a hard coded list of question types.
Please test this if you have a moodle install with some unusual question types. Thanks.
2006-05-31 15:53:12 +00:00
julmis ee16e98eb1 Another try to fix IE's problem to load editable iframe. 2006-05-31 11:35:32 +00:00
moodler 800085d9ae Don't show stupid warnings to teachers 2006-05-31 08:24:28 +00:00
toyomoyo c8937fb8ea changepassword obsolete 2006-05-31 07:23:11 +00:00
toyomoyo 08d1ef9d83 changepassword is obsolete 2006-05-31 07:11:16 +00:00
toyomoyo 2fd3511227 changepassword obsolete 2006-05-31 06:57:58 +00:00
toyomoyo 3abe15dd14 change password obsolete 2006-05-31 06:41:55 +00:00
toyomoyo 213b568441 always allow admin to check the force password change box, if using internal_auth 2006-05-31 06:28:07 +00:00
stronk7 91a036b599 Users with messages (and messages) are only included in
SITEID backup. Bug 5658.
(http://moodle.org/bugs/bug.php?op=show&bugid=5658)

Merged from MOODLE_15_STABLE
2006-05-30 16:57:20 +00:00
nfreear 5484222182 Fix bug 5628 (Farsi RTL language), modify '.accesshide' style so top is large negative, not left. 2006-05-30 11:16:52 +00:00
skodak 321a23004b blacklist PHP 5.0.x in installation precheck 2006-05-30 09:49:22 +00:00
skodak 272fecfce4 blacklist PHP 5.0.x in installation precheck 2006-05-30 09:37:26 +00:00
ethem ffccc532c6 If config wwwroot starts with 'https', ignore config loginhttps value.
Dependency: Bug #5647
2006-05-30 08:25:57 +00:00
skodak ad6ae2c4e5 fixed typo - randomsmatch notice bug 5652 2006-05-30 06:27:59 +00:00
toyomoyo 76816913ed fix for 5648, utf-8 migration bug 2006-05-30 02:50:16 +00:00
martinlanghoff 4c74601224 auth/ldap: better handling of empty values from ldap 2006-05-30 00:42:53 +00:00
stronk7 b4c8301258 Bump or I'll forget it. 2006-05-29 22:49:54 +00:00
skodak c446109283 fixed warning from clone($SITE) during site setup 2006-05-29 20:30:07 +00:00
stronk7 b4ab174902 Normalize oracle driver name.
Merged from HEAD.
2006-05-29 17:43:07 +00:00
stronk7 2deb9e2501 Adding environmental checks for 1.7 (mssql and oracle added)
Merged from HEAD
2006-05-29 17:38:48 +00:00
moodler be02c7520a Improved title 2006-05-29 09:55:07 +00:00
moodler 364f1151a6 Updated some "my moodle" strings 2006-05-29 09:39:55 +00:00
moodler fb3a583b2b Improved the appearance of the My Moodle page with some CSS 2006-05-29 09:27:01 +00:00
moodler 83bf9af99e DOn't even show assignments without a due date 2006-05-29 09:20:53 +00:00
moodler a00095da48 FIxed some bugs 2006-05-29 09:09:22 +00:00
moodler 3ed4068ee1 Cleaned up admin reports a little 2006-05-29 09:03:13 +00:00
skodak 949f570992 Bug #5620 - MyMoodle shows bogus Assignment due date 2006-05-29 08:36:52 +00:00
moodler 2bef2c7dca FIxed admin block link for reports 2006-05-29 08:35:33 +00:00
moodler 36e32ba459 Checking in skodak's fixes to help blocks in more contexts (esp MyMoodle) 2006-05-29 08:15:23 +00:00
moodler baa1209e37 Merged from HEAD, better definition of $COURSE 2006-05-29 07:34:55 +00:00
skodak 4878c5a6d2 fixed array warning when editting blocks 2006-05-29 06:03:17 +00:00
skodak 5d4353a158 global $course fix 2006-05-29 05:55:39 +00:00
wildgirl 446088fa5d Updated small MP3 player to handle autoPlay (by Andrew Walker, Alton College) 2006-05-28 20:20:55 +00:00
skodak 33f519119b sanitize submitted numerical values 2006-05-26 11:52:35 +00:00
skodak 7acc6626c5 sanitize submitted numerical values 2006-05-26 11:46:32 +00:00
skodak e616f403eb sanitize submitted numerical values 2006-05-26 11:38:16 +00:00
skodak b51b3dd05c sanitize submitted numerical values 2006-05-26 11:31:16 +00:00
skodak e4fd3f4f06 Bug #5619 - Assignment Feedback mail lacks linefeed 2006-05-26 09:06:05 +00:00
skodak bce3627ed9 Bug #4647 - Undefined property in lib/statslib.php 2006-05-26 08:59:52 +00:00
skodak 567596e8c2 Bug #5456 - Item Analysis fails to calculate results for random question type 2006-05-26 06:54:22 +00:00
skodak f703afe925 Bug #5472 - Download quiz grades in Excel format does not show correct foelds 2006-05-26 06:47:32 +00:00
skodak 6483738028 Bug #5612 - language string missing in blog 2006-05-25 19:23:54 +00:00
skodak 086018ae01 Bug #5582 - sort by numerical field doesn't work properly with decimals 2006-05-25 15:55:55 +00:00
nfreear ae04fba0cd Ongoing fix, bug 5614 - added ALT text for link icons, based on TITLE. 2006-05-25 15:50:19 +00:00
skodak db9529f65f Bug #5416 - sorting by question column in overview report plugin broken - please test 2006-05-25 09:59:06 +00:00
skodak 97ae5efdf0 Bug #5566 - wrong display of student's answers in MATCHING question type 2006-05-25 08:12:30 +00:00
skodak a636a125da Bug #4779 - lib/moodlelib.php: typo 2006-05-25 06:33:01 +00:00
vyshane b3ed98f7ba Changed string to make it more general so we can use it for error message that
is shown when a student tries to add an entry and no fields are defined.
2006-05-25 05:16:43 +00:00
vyshane 46941b6043 Fix for bug: when students try to add an entry while no field is defined, the
foreach barfs on the value of $fields, which is false.
2006-05-25 05:14:53 +00:00
gbateson 670cced63a added blank lines for to improve readability 2006-05-25 05:14:49 +00:00
toyomoyo f6c74641dd backup-restore, utfmigrate for rsstitletemplate field 2006-05-25 02:29:15 +00:00
toyomoyo 3141843a1a dropping backticks 2006-05-25 02:06:44 +00:00
toyomoyo 4da8b58b36 forgot to check this in 2006-05-25 01:43:32 +00:00
gbateson 7c8304a6c9 clarified the wording in point (5) of the "TO USE" section 2006-05-25 00:00:34 +00:00
skodak fee588e503 fixed my yet another bug 2006-05-24 21:53:46 +00:00
skodak 42e2fba317 fixed broken operations in subfolders - result of my recent patching :-( :-( bug #5603 2006-05-24 21:49:25 +00:00
skodak 48c54e90ce Bug #5604 - LDAP error notice when users update profile 2006-05-24 21:11:56 +00:00
skodak dad92a063d fixed warnings on save profile 2006-05-24 21:04:33 +00:00
skodak 9033ed3212 Bug #5587 - Redirect fails after a failed login and proper variable initialisation 2006-05-24 20:54:59 +00:00
skodak 146132bffc fixed bug #5562 I hope 2006-05-24 18:55:41 +00:00
gbateson 331c6f4620 fixed typos in $string['configshowtimes'] 2006-05-24 11:22:07 +00:00
toyomoyo ed501d3e98 added a rsstitle field 2006-05-24 07:01:33 +00:00
toyomoyo d2780b2594 added rsstitletemplate field 2006-05-24 06:14:16 +00:00
toyomoyo 3054f2faf2 renaming reads and writes to statsreads and statswrites 2006-05-24 05:02:09 +00:00
vyshane 3c0fd35102 Fix for undefined property notice when cron.php is run. 2006-05-24 03:06:16 +00:00
stronk7 67e55d7e0b Solving one SQL error in data_get_participants()
plus some improved readability.
2006-05-23 22:30:58 +00:00
stronk7 5b0d565bcd course_modules->deleted and user->guid are now out.
(they disappeared from DB ages ago)
2006-05-23 22:04:50 +00:00
skodak ade83600e1 fix for printing of multiple group pictures bug #5548 2006-05-23 19:16:04 +00:00
skodak b87862b89a fixed bug #5593 - logged in nested in <p> and <div> 2006-05-23 18:58:37 +00:00
skodak 30faf003ba fixed file backup and converted other forgotten "assignments" 2006-05-23 18:37:05 +00:00
skodak c9a53bb206 fixed broken SQL that was throwing errors in backup 2006-05-23 18:14:56 +00:00
skodak 6fb6c9d960 fixed bug 5594 - can not save group details 2006-05-23 17:59:19 +00:00
skodak 5d502dc3e4 fixed warning 2006-05-23 13:32:43 +00:00
skodak 30d36e2f3e fixed incorrect output buffer use - bug #5590 2006-05-23 10:54:43 +00:00
skodak 989e230b3d fixed RSS feeds warning bug #5591 2006-05-23 10:24:40 +00:00
skodak f45b5a05c0 make sure variables are properly cleaned 2006-05-23 09:46:56 +00:00
skodak 48cd99809d proper initialisation of $oldquestionid 2006-05-23 09:31:04 +00:00
skodak 6ebca3c77e removed reliance on register globals 2006-05-23 09:10:23 +00:00
skodak 2e311d898c extra cleaning of variables 2006-05-23 09:00:58 +00:00
stronk7 a87bbde1a1 Allowing also numbers and underscores in sessioncookie.
Merged from MOODLE_15_STABLE
2006-05-22 17:54:13 +00:00
skodak 71777355b1 fixed register globals issues for $sort SC #256 2006-05-22 16:51:56 +00:00
tjhunt 01d50616ee Fix for Bug #5588 - Editing a question after sorting leads to an error. 2006-05-22 15:42:42 +00:00
skodak d44136dee7 fixed bug #5578 - remove login as button for other teachers in course 2006-05-22 13:14:14 +00:00
tjhunt 5c9fe50894 Fix an undefined variable notice. 2006-05-22 13:04:17 +00:00
tjhunt e620c033cb Fix an undefined variable notice. 2006-05-22 11:19:32 +00:00
nfreear d3b5c5f081 Ongoing, fix bug 5400, navbar/breadcrumb TABLE to DIV, to improve semantics. 2006-05-22 09:11:10 +00:00
skodak 6936ef91df fixed bug #5572 missing PARAM_CLEAN 2006-05-22 05:59:06 +00:00
toyomoyo 3f94709321 fix for 5551, can not edit post when set to 1 discussion 2006-05-22 02:38:11 +00:00
gbateson 6428434a5f fixed typo: clck -> click 2006-05-22 00:21:00 +00:00
gbateson 9bb14972af modified CVS URLs to start http://moodle.cvs.sourceforge.net 2006-05-22 00:19:51 +00:00
gbateson 01f3128264 Give Up button modified to send results and set status to abandoned. Microincrement version to 2006052200 (release = v2.1.20) 2006-05-22 00:07:33 +00:00
skodak 3e55705455 fixed register globals issue with $loginasguest 2006-05-21 20:50:50 +00:00
skodak 889209d1fa fixed redirection to https:// for edit profile and change password when loginhttps on 2006-05-21 20:34:31 +00:00
skodak efc346b5ca temporary workaround for bug #5534, html editor now disabled for IE when loginhttps on and wwwroot starts with http:// 2006-05-21 20:20:45 +00:00
skodak 5eb64d447e removed isset 2006-05-21 10:10:54 +00:00
skodak 9446d15749 fixed register globals issue with $text 2006-05-21 08:08:48 +00:00
skodak dc28278d18 proper initialisation of passwordchangeurl 2006-05-21 07:50:21 +00:00
skodak d04f1621e8 proper initialisation of sqlsortkey SC#258 2006-05-21 07:42:05 +00:00
koenr ef38765d91 adding missing </p> and one point 2006-05-20 19:14:13 +00:00
skodak 7c3c8b7249 fixed register globals issues in course/search.php 2006-05-20 18:39:48 +00:00
skodak eb676fdf9a proper initialisation of $focus SC#257 2006-05-20 18:18:30 +00:00
skodak bf55369e5d do not show pending courses button for nonadmins bug #5564 2006-05-20 18:07:25 +00:00
skodak 56a6a9ff49 fixed cleaning of path in custom scripts SC#221 2006-05-20 17:21:44 +00:00
stronk7 91e4976c08 Bump to Beta5 2006-05-20 00:10:13 +00:00
skodak 299560a9fc fixed block width calculation 2006-05-19 21:00:28 +00:00
skodak 23cb8a304c submission in post.php cleanup, fixes for bugs #5530, #5484 and SC#252 2006-05-19 20:15:44 +00:00
skodak 9c71eb42b8 fixed - disabled autologinguest not always respected in require_login() SC#255 2006-05-19 19:10:19 +00:00
nfreear f642809590 Ongoing, fix bug 5400, DIV to H1, to improve semantics. 2006-05-19 13:24:48 +00:00
nfreear 3edb646260 Fix bug 5434 - hardcoded missing Alt text, with a warning comment. 2006-05-19 10:29:08 +00:00
vyshane 7828580904 Fix for Bug #5541 2006-05-19 06:23:16 +00:00
mark-nielsen 2711fbb039 [BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grad
ing lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.

This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off

Changed the reporting of minquestions setting to match the help file.  Now it is question based instead of attempt based
.

Changed the reporting of ongoing score to use the new grade function.
2006-05-19 00:59:22 +00:00
mark-nielsen d226adef8b [BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grad
ing lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.

This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off

Changed the reporting of minquestions setting to match the help file.  Now it is question based instead of attempt based
.

Changed the reporting of ongoing score to use the new grade function.
2006-05-19 00:54:15 +00:00
skodak 88aba6189b deprecated nvl() function similar to optional_variable() - fixed missing global $CFG 2006-05-18 22:10:40 +00:00
skodak e371190c10 deprecated nvl() function similar to optional_variable() 2006-05-18 22:09:25 +00:00
dwoolhead dd3b147a87 Bug 5536 Replaced references to hide by show 2006-05-18 16:10:33 +00:00
ethem 653c70a063 Removed </td>. Help button appears on top :))
Merged from HEAD
2006-05-18 10:04:42 +00:00
ethem bb75ef114c I have just found a cute function called print_checkbox. :)
Merged from HEAD.
2006-05-18 07:58:54 +00:00
skodak f220d982f2 fixed bug #5533, could not choose from file root 2006-05-18 05:46:58 +00:00
martinlanghoff 1db555e84d login: Changing passwords now works when logged in as guest 2006-05-18 00:53:08 +00:00
skodak 2c97ca5d59 admins can now edit user images even when $CFG->disableuserimages = true; see bug #5494 and SC#253 2006-05-17 18:57:18 +00:00
skodak 4a1f1588f0 fixed version number 2006-05-17 18:15:43 +00:00
skodak 2b5c23c82b fixed some warnings and removed ugly hack error_reporting(E_ALL ^ E_NOTICE); that was only hiding warnings in this and other code
I am going to watch forums and bug tracker and fix any other problems that may surface before the release
2006-05-17 18:05:28 +00:00
tjhunt e1b8eb512c Convert tabs to spaces in files where there were only a few rogue tabs. 2006-05-17 16:37:14 +00:00
exe-cutor fca3ef18aa Removed all tabs 2006-05-17 12:37:13 +00:00
exe-cutor d2c77a0dc0 Fixed some typos 2006-05-17 12:33:01 +00:00
tjhunt f76e87652c Fix URL syntax error when slasharguments is off. 2006-05-17 11:29:31 +00:00
tjhunt 108145970d Fix wrong variable name. 2006-05-17 11:28:59 +00:00
ethem d4d1873933 action.php renamed to authorizenetlib.php 2006-05-17 08:12:41 +00:00
martinlanghoff 52a85b5475 moodle16cleanup: lib/db correct prefix, patch by Tim Hunt for bug 5515 2006-05-17 06:26:32 +00:00
martinlanghoff 6f1c69ec02 mod/choice mod/lesson mod/scorm moodle16cleanup: Added notification
for cleanup that may fail if one is starting fresh from moodle 1.5.3+,
previous cleanup before 1.5.3 is not needed
2006-05-17 06:25:46 +00:00
martinlanghoff f184d1610b moodle16cleanup: mod/forum correctly dropping the constraint, so it does
not report an error during upgrade
2006-05-17 06:25:20 +00:00
martinlanghoff 7832d94156 moodle16cleanup: mod/quiz correctly sync the constraints and indexes
which was not changed when it was moved from quiz module to question lib
2006-05-17 06:24:59 +00:00
martinlanghoff 289b648803 moodle16cleanup: mod/quiz uniqueid does not exists, taking upgrade script
from mysql.php ver 2005070202. dropping some unused tables during the
transition from quiz to question lib
2006-05-17 06:24:28 +00:00
martinlanghoff c86c9b30c5 moodle16cleanup: lib/db correctly put the default values, change the
length of log_display.module which is just 20 chars on postgres7.sql
2006-05-17 06:20:52 +00:00
martinlanghoff a722923c62 moodle16cleanup: backup/ set the correct column datatype and default value 2006-05-17 06:20:37 +00:00
martinlanghoff ae3f15fac1 moodle16cleanup: blocks/rss_client set the correct column default value 2006-05-17 06:20:09 +00:00
martinlanghoff d5b0187a32 moodle16cleanup: enrol/authorize not null set which is similar to mysql
and that was upgraded on postgres7.php
2006-05-17 06:19:50 +00:00
martinlanghoff 100aa1d7be moodle16cleanup: mod/hotpot set the correct column datatype and default
value
2006-05-17 06:19:34 +00:00
martinlanghoff 4ff35d69bc moodle16cleanup: mod/lesson drop unused table lesson_essay, set the
correct column datatype and default value
2006-05-17 06:19:17 +00:00
martinlanghoff ec29c403be moodle16cleanup: mod/dialog we need to drop some more dialog module tables 2006-05-17 06:18:43 +00:00
martinlanghoff a576feacb8 moodle16cleanup: mod/scorm drop a weird check constraint that is showing
up after upgrade
2006-05-17 06:18:16 +00:00
martinlanghoff 9c44a6972c moodle16cleanup: mod/scrom set the correct defaults and correctly recreate
the new check constraint
2006-05-17 06:17:53 +00:00
martinlanghoff 1ce5928d35 moodle16cleanup: mod/scorm version column should not be dropped, it must
exist. it was not upgraded as with mysql.php 2005041600
2006-05-17 06:17:32 +00:00
martinlanghoff 35c30e915e moodle16cleanup: mod/wiki synch upgrade script and .sql with mysql
counterpart, drop the not null constraint to sync with postgres7.sql
2006-05-17 06:17:06 +00:00
martinlanghoff f59139d640 moodle16cleanup: mod/forum added notification message 2006-05-17 06:15:48 +00:00
martinlanghoff b4bdcbe535 blocklib: cache (and used cached) block instances properly in $pageblocks
Now blocks_have_content() caches instantiated block objects inside $pageblocks
and blocks_print_blocks() uses them if available. This behaviour now matches
the documentation: blocks instances are created only once, get_content()
may be invoked several times.

A better fix would be to cache the _output_ of the block (the ->content
property) but it may bite us if any block is counting on being called twice.

Discussion at: http://moodle.org/mod/forum/discuss.php?d=45867
2006-05-17 04:51:12 +00:00
skodak b6d175eeb7 I hope this is the last patch for header already printed trouble in error() and redirect() 2006-05-16 20:29:20 +00:00
ethem a7084ab10b confirm_sesskey() implementation for capture,delete,refund and void. I hope it works. :)
Merged from HEAD.
2006-05-16 15:37:06 +00:00
ethem 6a4c28904a Allow showing error message when insert_record fails. 2006-05-16 15:00:08 +00:00
ethem d0e1fd06c5 Manual capture settings for sending email: cron=enabled, an_review=checked, an_capture_day=0, an_emailexpired=1-5
merged from HEAD
2006-05-16 11:40:00 +00:00
nfreear 287a93580b Fix bug 5477 "Strange 'you are here'...", <span> now <h2> in function print_navigation. 2006-05-16 11:31:50 +00:00
ethem 53fedccb0b (Manual capture settings: cron=enabled, an_review=checked, an_capture_day=0)
Merged from HEAD.
2006-05-16 10:46:55 +00:00
thepurpleblob a08ccf0a61 Added note that export now exports all subcategories. 2006-05-16 09:38:03 +00:00
toyomoyo df8baa04c3 forgot to take out comment 2006-05-16 08:22:03 +00:00
toyomoyo 3b0e0d4df4 fix for 5513 2006-05-16 07:57:54 +00:00
vyshane 250ea6271e Fixed bug #5467. Converted newlines to UNIX format, tabs to spaces and removed
extra newlines at the end of php scripts.
2006-05-16 07:04:05 +00:00
vyshane f356fbe45e Fix for grade_drop_lowest (missed from last fix for bug 5354) 2006-05-16 06:57:08 +00:00
vyshane 37f401637b Fixed Bug #5354 - Gradebook [DropXLowest and Exclude] 2006-05-16 05:49:59 +00:00
mark-nielsen 13f944bc55 [BugFix] Bug 5485 - problem with regular expressions with simple analysis 2006-05-16 03:04:44 +00:00
stronk7 3e21f15895 Updated to latest version (1.56). Bug 5165.
(http://moodle.org/bugs/bug.php?op=show&bugid=5165)
2006-05-15 23:29:13 +00:00
danmarsden fc410020b8 Fixes bug 5464 also makes response clearer to students -see:
http://moodle.org/mod/forum/discuss.php?d=45504

also finishes off Bug 662
2006-05-15 23:21:39 +00:00
mjollnir_ 200460b0c8 mod/quiz/view No-longer display final grade when quiz settings forbid it.
Changed view.php so that it checked if there were any attempts with
concealed grades before printing the student's overall score.
Credit: Peter Bulmer <peter.bulmer@catalyst.net.nz>
2006-05-15 21:51:30 +00:00
skodak d1014faf32 fixed problem when set both loginhttps and https in wwwroot, closes bug #5507 and #3848 2006-05-15 21:32:21 +00:00
gustav_delius b692cb65b7 Answers to essay questions are now saved correctly when navigating to another page, fixing bug 4478 2006-05-15 20:27:04 +00:00
mark-nielsen 3f566d8f2e [BugFix] Bug 5505 - function lesson_print_tree now checks for teacher editing priv before printing editing icons. Had to change arguments for this function as well which is the edit in view.php.
lesson.php how checks for teacher editing priv for all actions except for continue.  This is just in case the user hacks the URL.
2006-05-15 19:05:58 +00:00
stronk7 46beca01b3 Avoid [[namesite]] to appear when ADDING site activities.
I sent this on May 8th! :-(
2006-05-15 17:52:39 +00:00
stronk7 0257c6d6b0 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)

IMPORTANT: I sent this to CVS on May, 8th and changes have dissapear!
           It could be possible than other commits sent near SF crash
           were affected too!
2006-05-15 17:28:02 +00:00
stronk7 b10192c1e4 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)

IMPORTANT: I sent this to CVS on May, 8th and changes had dissapear!
           It could be possible than other commits sent near SF crash
           were affected too!
2006-05-15 17:26:38 +00:00
skodak 0772879f24 fix my previous incorrect short tag fix, fixed register globals, IP address used as mail user when not logged in 2006-05-15 15:44:36 +00:00
skodak 5563b4e151 fixed short php tags 2006-05-15 15:10:49 +00:00
skodak ffcce04152 changed cleaning of entry title, now matches handling of forum post titles 2006-05-15 15:03:44 +00:00
skodak b374d60430 better cleaning of post title SC#251 revisited 2006-05-15 14:47:09 +00:00
skodak 848e124eab better cleaning of post title SC#251 2006-05-15 14:31:09 +00:00
exe-cutor a53b09c16b Fixed an inconsistent link 2006-05-15 12:18:40 +00:00
toyomoyo 8374432bdb fix for 5493 2006-05-15 02:58:43 +00:00
toyomoyo 18ab64ef11 tidying up constants 2006-05-15 02:56:56 +00:00
toyomoyo e1b6fbf2eb fix for 4404 2006-05-15 02:25:42 +00:00
toyomoyo a37df0735f fix for 5465 2006-05-15 02:01:54 +00:00
skodak 8b0c3b6551 fixed secure forms handling when POST url contained GET parameters (cookieless mode and some other forms) 2006-05-14 20:57:01 +00:00
skodak 5ee7e12e26 fixed bug #5489 - can not edit file, minor bugfixes and whitespace cleanup 2006-05-14 19:08:34 +00:00
skodak f4aaf2f7b5 fixed whitespace and Id tag 2006-05-14 17:21:02 +00:00
skodak c385f70296 I hope final fix for warnings when using error() after print_header() with buffering on, solution was to flush all buffers and reenable SID rewrite when needed. 2006-05-14 17:10:35 +00:00
gbateson 00fe4b8045 microincrement version number to v2.1.19 2006-05-14 08:34:23 +00:00
gustav_delius 0472d056f6 Removing obsolete defaults 2006-05-13 17:04:11 +00:00
gustav_delius 07f8831194 Introduce question_attempts table, closing bug 5468
Fixed incorrect check for whether to update state or insert new one in save_question_session()
Deal with manually graded states correctly during regrading
Increase state sequence number during manual grading
Supplied missing userid to quiz_save_best_grade() during manual grading
2006-05-13 16:41:22 +00:00
ethem a7f53e74f6 Fix: Redirect to order details page 10 seconds later, not home page. 2006-05-13 16:14:36 +00:00
gustav_delius 8a6733ead1 Updated comments and made sure teacher preview gets restarted when changes are saved, fixing bug 5478 2006-05-13 10:34:02 +00:00
ethem e5bafac7d2 *** empty log message *** 2006-05-13 08:55:38 +00:00
ethem f101e4f736 Language direction is important. Changed as: <b>AVS Result:</b> $a 2006-05-13 08:51:12 +00:00
thepurpleblob 53b824ef1f Fixes for bugs #5435 - subcategories were not exported and
#5470 - true/false questions not exported due to internal format
change.
2006-05-13 08:47:57 +00:00
ethem 672007443c More readable coding. Now, I understand everything. :) 2006-05-13 08:30:06 +00:00
ethem 1180c98509 Deleting test transactions are not good. They may be in proggress. Let's update WHERE transid<>'0'. 2006-05-13 05:58:17 +00:00
ethem 337f36b459 Fix: Don't show newly created orders prior to 2 minutes.
They may be still in proggress and these aren't test transacions(transid=0).
We check timecreated field to prevent this.
2006-05-12 19:48:42 +00:00
ethem be1ed90464 Fix: Delete test transactions before update status as AN_STATUS_AUTHCAPTURE. 2006-05-12 18:32:02 +00:00
ethem 55c0d5b8a4 Status: 'New' string. Merged from HEAD. 2006-05-12 17:23:59 +00:00
stronk7 aa912c49e2 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)
2006-05-08 16:36:40 +00:00
nfreear 8abfee6962 Fixes bug 5412 "Recent Activity block, New Users, markup should be a list" - style and lib.php: print_recent_activity. 2006-05-08 11:24:35 +00:00
thepurpleblob f1068df6c6 Moved some category functions back to questionlib. Original move
caused all sorts of problems.
2006-05-08 10:40:42 +00:00
thepurpleblob 3b438e0db9 Moved some of the category functions back here. Caused much
more grief than I anticipated.
2006-05-08 10:38:03 +00:00
toyomoyo 6d699a924d fix for 5438 2006-05-08 07:07:51 +00:00
vyshane f6de1e03d7 Fix for Bug #5441. Typo was causing an undefined variable notice. 2006-05-08 03:53:49 +00:00
vyshane 0416a3be25 Changed field length to 20 for module field in log table (Bug #5419). 2006-05-08 03:07:27 +00:00
moodler 1e4f7f125b Updated hints about stable versions 2006-05-08 01:47:25 +00:00
stronk7 1b2472e584 glossary print view is now valid XHTML. 2006-05-07 10:48:10 +00:00
stronk7 51aca6a92f Now, when a single forum is restored and no user data was created,
the initial discussion/post is automatically generated. Bug 5418.
(http://moodle.org/bugs/bug.php?op=show&bugid=5418)

Merged from MOODLE_15_STABLE
2006-05-06 16:55:38 +00:00
ethem 04803a039d Admin can setup which credit card types will be accepted. 2006-05-05 18:25:03 +00:00
ethem 8d101bc522 Admin can setup which credit card types will be accepted. 2006-05-05 18:09:38 +00:00
stronk7 474c8d3f00 Now the help link in the admin block points to Docs. Bug 4803.
(http://moodle.org/bugs/bug.php?op=show&bugid=4803)
2006-05-05 17:54:59 +00:00
vyshane e48f4e502d Fix for Bug #5419 - Inconsistency between log_display and log tables. 2006-05-05 08:01:27 +00:00
toyomoyo 00b9ff724b fix for 4478 2006-05-05 06:43:36 +00:00
toyomoyo d5be1194cb fix for 5428 2006-05-05 05:13:12 +00:00
thepurpleblob d3176779c8 htmlentities() replaced by s() 2006-05-04 11:15:11 +00:00
stronk7 8e4485c69b Anything against the ISO-8859-1 word? 2006-05-04 10:38:17 +00:00
toyomoyo e565767d24 fix for 5426, inconsistent prefixes, and lengthened some index to varchar(100) during migration 2006-05-04 09:36:32 +00:00
ethem aca29171b4 Enable 'Authorize.net plugin' and setup cron properly; or uncheck an_review again. 2006-05-04 08:15:29 +00:00
toyomoyo 1710f639ae fix for 3644 2006-05-04 06:56:24 +00:00
moodler 711d6de23f Whoops, proper merge now 2006-05-04 05:47:27 +00:00
moodler fdee3caacb Merged fixes from stable 2006-05-04 04:42:18 +00:00
vyshane 0c19b8fd99 Fix for Bug #4805 2006-05-04 04:25:22 +00:00
toyomoyo 1bad990a14 fix for 5417 2006-05-04 02:22:37 +00:00
stronk7 155a4e17a2 Now more quiz actions are restored properly:
-preview
 -start attempt
 -close attempt
 -continue attempt (too long. See Bug 5419)
Bug 5122
(http://moodle.org/bugs/bug.php?op=show&bugid=5122)
2006-05-03 23:45:55 +00:00
stronk7 11a5d6c147 Fixing some non-production values I left after testing.
Thanks James!
2006-05-03 22:03:06 +00:00
stronk7 ca5b6b6506 XHTML validation. Bug 5332.
(http://moodle.org/bugs/bug.php?op=show&bugid=5332)
2006-05-03 18:20:09 +00:00
urs_hunkler d0fcd925f9 patch: 2 if propertyIsEnumerable blocks added to make HTMLeditor work with the prototype AJAX library 2006-05-03 18:14:42 +00:00
stronk7 b985f62858 1.6 compliance added
Merged from HEAD
2006-05-03 17:57:26 +00:00
stronk7 e793cddc22 Solving some changes in course-view and sections... 2006-05-03 17:47:29 +00:00
3791 changed files with 157253 additions and 538702 deletions
+12256
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
README $Id$
README $Id$
------
QUICK INSTALL
+103
View File
@@ -0,0 +1,103 @@
<form name="adminform" id="adminform" method="post" action="admin.php">
<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table align="center" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<?php
$a->count = count($admins);
$a->items = $strexistingadmins;
print_string('counteditems', '', $a);
?>
</td>
<td></td>
<td valign="top">
<?php
$a->count = $usercount;
$a->items = $strpotentialadmins;
print_string('counteditems', '', $a);
?>
</td>
</tr>
<tr>
<td valign="top">
<select name="removeselect[]" size="20" id="removeselect" multiple
onFocus="document.adminform.add.disabled=true;
document.adminform.remove.disabled=false;
document.adminform.addselect.selectedIndex=-1;">
<?php
if (count($admins) == 1) {
$disabled = 'disabled';
$removebuttontype = 'hidden';
} else {
$disabled = '';
$removebuttontype = 'submit';
}
foreach ($admins as $admin) {
$fullname = fullname($admin, true);
echo "<option value=\"$admin->id\" $disabled>".$fullname.", ".$admin->email."</option>\n";
}
?>
</select></td>
<td valign="top">
<br />
<input name="add" type="submit" id="add" value="&larr;" />
<br />
<input name="remove" type="<?php echo $removebuttontype ?>" id="remove" value="&rarr;" />
<br />
</td>
<td valign="top">
<select name="addselect[]" size="20" id="addselect" multiple
onFocus="document.adminform.add.disabled=false;
document.adminform.remove.disabled=true;
document.adminform.removeselect.selectedIndex=-1;">
<?php
if (!empty($searchusers)) {
echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
foreach ($searchusers as $user) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
echo "</optgroup>\n";
} else {
if ($usercount > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else {
if (!empty($users)) {
foreach ($users as $user) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
}
}
?>
</select>
<br />
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
onFocus ="document.adminform.add.disabled=true;
document.adminform.remove.disabled=true;
document.adminform.removeselect.selectedIndex=-1;
document.adminform.addselect.selectedIndex=-1;"
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
if (keyCode == 13) {
document.adminform.previoussearch.value=1;
document.adminform.submit();
} " />
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
<?php
if (!empty($searchusers)) {
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
}
?>
</td>
</tr>
</table>
</form>
+125
View File
@@ -0,0 +1,125 @@
<?PHP // $Id$
// Admin-only script to assign administrative rights to users
require_once('../config.php');
define("MAX_USERS_PER_PAGE", 50);
if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php");
}
require_login();
if (!isadmin()) {
error("You must be an administrator to use this page.");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
$primaryadmin = get_admin();
/// If you want any administrator to have the ability to assign admin
/// rights, then comment out the following if statement
if ($primaryadmin->id != $USER->id) {
error("You must be the primary administrator to use this page.");
}
/// assign all of the configurable language strings
$stringstoload = array (
"assignadmins",
"administration",
"existingadmins",
"potentialadmins",
"search",
"users",
"searchresults",
"showall"
);
foreach ($stringstoload as $stringtoload){
$strstringtoload = "str" . $stringtoload;
$$strstringtoload = get_string($stringtoload);
}
print_header("$site->shortname: $strassignadmins",
"$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $strassignadmins", "adminform.searchtext");
if (!$frm = data_submitted()) {
print_simple_box("<center>".get_string("adminhelpassignadmins")."</center>", "center", "50%");
/// A form was submitted so process the input
} else {
if (!empty($frm->add) and !empty($frm->addselect)) {
foreach ($frm->addselect as $addadmin) {
if (! add_admin($addadmin)) {
error("Could not add admin with user id $addadmin!");
}
}
} else if (!empty($frm->remove) and !empty($frm->removeselect)) {
$admins = get_admins();
if (count($admins) > count($frm->removeselect)) {
foreach ($frm->removeselect as $removeadmin) {
if (! remove_admin($removeadmin)) {
error("Could not remove admin with user id $removeadmin!");
}
}
}
} else if (!empty($frm->showall)) {
unset($frm->searchtext);
$frm->previoussearch = 0;
}
}
/// Is there a current search?
$previoussearch = (!empty($frm->search) or (isset($frm->previoussearch) and $frm->previoussearch == 1)) ;
/// Get all existing admins
$admins = get_admins();
$adminarray = array();
foreach ($admins as $admin) {
$adminarray[] = $admin->id;
}
$adminlist = implode(',', $adminarray);
unset($adminarray);
/// Get search results excluding any current admins
if (!empty($frm->searchtext) and $previoussearch) {
$searchusers = get_users(true, $frm->searchtext, true, $adminlist, 'firstname ASC, lastname ASC',
'', '', 0, 99999, 'id, firstname, lastname, email');
$usercount = get_users(false, '', true, $adminlist);
}
/// If no search results then get potential users excluding current admins
if (empty($searchusers)) {
$usercount = get_users(false, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
0, 99999, 'id, firstname, lastname, email');
$users = array();
if ($usercount <= MAX_USERS_PER_PAGE) {
if (!$users = get_users(true, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
0, 99999, 'id, firstname, lastname, email') ) {
$users = array();
}
}
}
$searchtext = (isset($frm->searchtext)) ? $frm->searchtext : "";
$previoussearch = ($previoussearch) ? '1' : '0';
include('./admin.html');
print_footer();
?>
+324 -92
View File
@@ -1,102 +1,334 @@
<?php
<?PHP // $Id$
// config.php - allows admin to edit all configuration variables
/**
* Allows admin to edit all auth plugin settings.
*
* JH: copied and Hax0rd from admin/enrol.php and admin/filters.php
*
*/
require_once('../config.php');
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
$auth = optional_param('auth', '', PARAM_SAFEDIR);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_login();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
if (!$site = get_site()) {
redirect("index.php");
}
$action = optional_param('action', '', PARAM_ACTION);
$auth = optional_param('auth', '', PARAM_SAFEDIR);
if (!isadmin()) {
error("Only the admin can use this page");
}
// get currently installed and enabled auth plugins
$authsavailable = get_list_of_plugins('auth');
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
get_enabled_auth_plugins(true); // fix the list of enabled auths
if (empty($CFG->auth)) {
$authsenabled = array();
} else {
$authsenabled = explode(',', $CFG->auth);
$focus = '';
/// If data submitted, then process and store.
if ($config = data_submitted()) {
$config = (array)$config;
// extract and sanitize the auth key explicitly
$modules = get_list_of_plugins("auth");
if (in_array($config['auth'], $modules)) {
$auth = $config['auth'];
} else {
notify("Error defining the authentication method");
}
// load the auth plugin library
require_once("{$CFG->dirroot}/auth/$auth/lib.php");
$err = array();
if (function_exists('auth_validate_form')) {
auth_validate_form($config, $err);
}
if (count($err) == 0) {
foreach ($config as $name => $value) {
if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
$name = $matches[1];
if (! set_config($name, $value, $plugin)) {
notify("Problem saving config $name as $value for plugin $plugin");
}
} else { // normal handling for
if (! set_config($name, $value)) {
notify("Problem saving config $name as $value");
}
}
}
redirect("auth.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
exit;
} else {
foreach ($err as $key => $value) {
$focus = "form.$key";
}
}
}
/// Otherwise fill and print the form.
if (empty($config)) {
$config = $CFG;
}
$modules = get_list_of_plugins("auth");
$options = array();
foreach ($modules as $module) {
$options[$module] = get_string("auth_$module"."title", "auth");
}
asort($options);
if (!empty($auth) && in_array($auth, $modules)) {
} else {
$auth = $config->auth;
}
// changepassword link replaced by individual auth setting
if (!empty($config->changepassword)) {
if (empty($config->{'auth_'.$auth.'_changepasswordurl'})) {
$config->{'auth_'.$auth.'_changepasswordurl'} = $config->changepassword;
}
set_config('changepassword','');
}
$auth = clean_param($auth,PARAM_SAFEDIR);
require_once("$CFG->dirroot/auth/$auth/lib.php"); //just to make sure that current authentication functions are loaded
if (! isset($config->guestloginbutton)) {
$config->guestloginbutton = 1;
}
if (! isset($config->alternateloginurl)) {
$config->alternateloginurl = '';
}
if (! isset($config->auth_instructions)) {
$config->auth_instructions = "";
}
if (! isset($config->changepassword)) {
$config->changepassword = "";
}
if (! isset($config->{'auth_'.$auth.'_changepasswordurl'})) {
$config->{'auth_'.$auth.'_changepasswordurl'} = '';
}
if (! isset($config->{'auth_'.$auth.'_changepasswordhelp'})) {
$config->{'auth_'.$auth.'_changepasswordhelp'} = '';
}
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
$guestoptions[0] = get_string("hide");
$guestoptions[1] = get_string("show");
$createoptions[0] = get_string("no");
$createoptions[1] = get_string("yes");
$stradministration = get_string("administration");
$strauthentication = get_string("authentication");
$strauthenticationoptions = get_string("authenticationoptions","auth");
$strsettings = get_string("settings");
$strusers = get_string("users");
print_header("$site->shortname: $strauthenticationoptions", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $strauthenticationoptions", "$focus");
echo "<center><b>";
echo "<form target=\"{$CFG->framename}\" name=\"authmenu\" method=\"post\" action=\"auth.php\">";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
print_string("chooseauthmethod","auth");
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?sesskey=$USER->sesskey&auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
echo "</b></center>";
print_simple_box_start("center", "100%");
print_heading($options[$auth]);
print_simple_box_start("center", "60%", '', 5, 'informationbox');
print_string("auth_$auth"."description", "auth");
print_simple_box_end();
echo "<hr />";
print_heading($strsettings);
echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\">";
require_once("$CFG->dirroot/auth/$auth/config.html");
$CFG->pagepath = 'auth/' . $auth;
echo '<tr><td colspan="3">';
print_heading(get_string('auth_common_settings', 'auth'));
echo '<td/></tr>';
if ($auth != "email" and $auth != "none" and $auth != "manual") {
// display box for URL to change password. NB now on a per-method basis (multiple auth)
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("changepassword", "auth");
echo ":</td>";
echo "<td>";
$passurl = $config->{'auth_'.$auth.'_changepasswordurl'};
echo "<input type=\"text\" name=\"auth_{$auth}_changepasswordurl\" size=\"40\" value=\"$passurl\" />";
echo "</td>";
echo "<td>";
print_string("auth_changepasswordurl_expl","auth",$auth);
echo "</td></tr>";
// display textbox for lost password help. NB now on a per-method basis (multiple auth)
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("auth_changepasswordhelp", "auth");
echo ":</td>";
echo "<td>";
$passhelp = $config->{'auth_'.$auth.'_changepasswordhelp'};
echo "<textarea name=\"auth_{$auth}_changepasswordhelp\" cols=\"30\" rows=\"10\" wrap=\"virtual\">";
echo $passhelp;
echo "</textarea>\n";
echo "</td>";
echo "<td>";
print_string("auth_changepasswordhelp_expl","auth",$auth);
echo "</td></tr>";
}
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("guestloginbutton", "auth");
echo ":</td>";
echo "<td>";
choose_from_menu($guestoptions, "guestloginbutton", $config->guestloginbutton, "");
echo "</td>";
echo "<td>";
print_string("showguestlogin","auth");
echo "</td></tr>";
if (function_exists('auth_user_create')){
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("auth_user_create", "auth");
echo ":</td>";
echo "<td>";
choose_from_menu($createoptions, "auth_user_create", $config->auth_user_create, "");
echo "</td>";
echo "<td>";
print_string("auth_user_creation","auth");
echo "</td></tr>";
}
/// An alternate url for the login form. It means we can use login forms that are integrated
/// into non-moodle pages
echo '<tr valign="top">';
echo '<td algin="right" nowrap="nowrap">';
print_string('alternateloginurl', 'auth');
echo '</td>';
echo '<td>';
echo '<input type="text" size="40" name="alternateloginurl" alt="'.get_string('alternateloginurl', 'auth').'" value="'.$config->alternateloginurl.'" />';
echo '</td>';
echo '<td>';
print_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php'));
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<p align="center"><input type="submit" value="'.get_string('savechanges').'"></p>';
echo '</form>';
print_simple_box_end();
print_footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////
//
// Good enough for most auth plugins
// but some may want a custom one if they are offering
// other options
// Note: pluginconfig_ fields have special handling.
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
echo '<tr><td colspan="3">';
if ($retrieveopts) {
print_heading(get_string('auth_data_mapping', 'auth'));
} else {
print_heading(get_string('auth_fieldlocks', 'auth'));
}
echo '<td/></tr>';
$lockoptions = array ('unlocked' => get_string('unlocked', 'auth'),
'unlockedifempty' => get_string('unlockedifempty', 'auth'),
'locked' => get_string('locked', 'auth'));
$updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'),
'onlogin' => get_string('update_onlogin', 'auth'));
$updateextoptions = array('0' => get_string('update_never', 'auth'),
'1' => get_string('update_onupdate', 'auth'));
$pluginconfig = get_config("auth/$auth");
// helptext is on a field with rowspan
if (empty($helptext)) {
$helptext = '&nbsp;';
}
foreach ($user_fields as $field) {
// Define some vars we'll work with
if(empty($pluginconfig->{"field_map_$field"})) {
$pluginconfig->{"field_map_$field"} = '';
}
if(empty($pluginconfig->{"field_updatelocal_$field"})) {
$pluginconfig->{"field_updatelocal_$field"} = '';
}
if (empty($pluginconfig->{"field_updateremote_$field"})) {
$pluginconfig->{"field_updateremote_$field"} = '';
}
if (empty($pluginconfig->{"field_lock_$field"})) {
$pluginconfig->{"field_lock_$field"} = '';
}
// define the fieldname we display to the user
$fieldname = $field;
if ($fieldname === 'lang') {
$fieldname = get_string('language');
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
} else {
$fieldname = get_string($fieldname);
}
echo '<tr valign="top"><td align="right">';
echo $fieldname;
echo '</td><td>';
if ($retrieveopts) {
$varname = 'field_map_' . $field;
echo "<input name=\"pluginconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\">";
echo '<div align="right">';
echo get_string('auth_updatelocal', 'auth') . '&nbsp;&nbsp;';
choose_from_menu($updatelocaloptions, "pluginconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, "");
echo '<br />';
if ($updateopts) {
echo get_string('auth_updateremote', 'auth') . '&nbsp;&nbsp;';
'&nbsp;&nbsp;';
choose_from_menu($updateextoptions, "pluginconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, "");
echo '<br />';
}
echo get_string('auth_fieldlock', 'auth') . '&nbsp;&nbsp;';
choose_from_menu($lockoptions, "pluginconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
echo '</div>';
} else {
choose_from_menu($lockoptions, "pluginconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
}
echo '</td>';
if (!empty($helptext)) {
echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
$helptext = '';
}
echo '</tr>';
}
}
if (!empty($auth) and !exists_auth_plugin($auth)) {
print_error('pluginnotinstalled', 'auth', $url, $auth);
}
////////////////////////////////////////////////////////////////////////////////
// process actions
if (!confirm_sesskey()) {
redirect($returnurl);
}
switch ($action) {
case 'disable':
// remove from enabled list
$key = array_search($auth, $authsenabled);
if ($key !== false) {
unset($authsenabled[$key]);
set_config('auth', implode(',', $authsenabled));
}
if ($auth == $CFG->registerauth) {
set_config('registerauth', '');
}
break;
case 'enable':
// add to enabled list
if (!in_array($auth, $authsenabled)) {
$authsenabled[] = $auth;
$authsenabled = array_unique($authsenabled);
set_config('auth', implode(',', $authsenabled));
}
break;
case 'down':
$key = array_search($auth, $authsenabled);
// check auth plugin is valid
if ($key === false) {
print_error('pluginnotenabled', 'auth', $url, $auth);
}
// move down the list
if ($key < (count($authsenabled) - 1)) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key + 1];
$authsenabled[$key + 1] = $fsave;
set_config('auth', implode(',', $authsenabled));
}
break;
case 'up':
$key = array_search($auth, $authsenabled);
// check auth is valid
if ($key === false) {
print_error('pluginnotenabled', 'auth', $url, $auth);
}
// move up the list
if ($key >= 1) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key - 1];
$authsenabled[$key - 1] = $fsave;
set_config('auth', implode(',', $authsenabled));
}
break;
default:
break;
}
redirect ($returnurl);
?>
-181
View File
@@ -1,181 +0,0 @@
<?php
/**
* Edit configuration for an individual auth plugin
*/
require_once '../config.php';
require_once $CFG->libdir.'/adminlib.php';
$auth = required_param('auth', PARAM_SAFEDIR);
$CFG->pagepath = 'auth/' . $auth;
admin_externalpage_setup('authsetting'.$auth);
$authplugin = get_auth_plugin($auth);
$err = array();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
// save configuration changes
if ($frm = data_submitted() and confirm_sesskey()) {
$frm = stripslashes_recursive($frm);
$authplugin->validate_form($frm, $err);
if (count($err) == 0) {
// save plugin config
if ($authplugin->process_config($frm)) {
// save field lock configuration
foreach ($frm as $name => $value) {
if (preg_match('/^lockconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
$name = $matches[1];
if (!set_config($name, $value, $plugin)) {
error("Problem saving config $name as $value for plugin $plugin");
}
}
}
redirect($returnurl);
exit;
}
} else {
foreach ($err as $key => $value) {
$focus = "form.$key";
}
}
} else {
$frm = get_config("auth/$auth");
}
$user_fields = $authplugin->userfields;
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
/// Get the auth title (from core or own auth lang files)
$authtitle = $authplugin->get_title();
/// Get the auth descriptions (from core or own auth lang files)
$authdescription = $authplugin->get_description();
// output configuration form
admin_externalpage_print_header();
// choose an authentication method
echo "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />\n";
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
// auth plugin description
print_simple_box_start('center', '80%');
print_heading($authtitle);
print_simple_box_start('center', '80%', '', 5, 'informationbox');
echo $authdescription;
print_simple_box_end();
echo "<hr />\n";
$authplugin->config_form($frm, $err, $user_fields);
print_simple_box_end();
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
echo "</div>\n";
echo "</form>\n";
admin_externalpage_print_footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////
// Good enough for most auth plugins
// but some may want a custom one if they are offering
// other options
// Note: lockconfig_ fields have special handling.
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
echo '<tr><td colspan="3">';
if ($retrieveopts) {
print_heading(get_string('auth_data_mapping', 'auth'));
} else {
print_heading(get_string('auth_fieldlocks', 'auth'));
}
echo '</td></tr>';
$lockoptions = array ('unlocked' => get_string('unlocked', 'auth'),
'unlockedifempty' => get_string('unlockedifempty', 'auth'),
'locked' => get_string('locked', 'auth'));
$updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'),
'onlogin' => get_string('update_onlogin', 'auth'));
$updateextoptions = array('0' => get_string('update_never', 'auth'),
'1' => get_string('update_onupdate', 'auth'));
$pluginconfig = get_config("auth/$auth");
// helptext is on a field with rowspan
if (empty($helptext)) {
$helptext = '&nbsp;';
}
foreach ($user_fields as $field) {
// Define some vars we'll work with
if (!isset($pluginconfig->{"field_map_$field"})) {
$pluginconfig->{"field_map_$field"} = '';
}
if (!isset($pluginconfig->{"field_updatelocal_$field"})) {
$pluginconfig->{"field_updatelocal_$field"} = '';
}
if (!isset($pluginconfig->{"field_updateremote_$field"})) {
$pluginconfig->{"field_updateremote_$field"} = '';
}
if (!isset($pluginconfig->{"field_lock_$field"})) {
$pluginconfig->{"field_lock_$field"} = '';
}
// define the fieldname we display to the user
$fieldname = $field;
if ($fieldname === 'lang') {
$fieldname = get_string('language');
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
} elseif ($fieldname == 'url') {
$fieldname = get_string('webpage');
} else {
$fieldname = get_string($fieldname);
}
if ($retrieveopts) {
$varname = 'field_map_' . $field;
echo '<tr valign="top"><td align="right">';
echo '<label for="lockconfig_'.$varname.'">'.$fieldname.'</label>';
echo '</td><td>';
echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\" />";
echo '<div style="text-align: right">';
echo '<label for="menulockconfig_field_updatelocal_'.$field.'">'.get_string('auth_updatelocal', 'auth') . '</label>&nbsp;';
choose_from_menu($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, "");
echo '<br />';
if ($updateopts) {
echo '<label for="menulockconfig_field_updateremote_'.$field.'">'.get_string('auth_updateremote', 'auth') . '</label>&nbsp;';
choose_from_menu($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, "");
echo '<br />';
}
echo '<label for="menulockconfig_field_lock_'.$field.'">'.get_string('auth_fieldlock', 'auth') . '</label>&nbsp;';
choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
echo '</div>';
} else {
echo '<tr valign="top"><td align="right">';
echo '<label for="menulockconfig_field_lock_'.$field.'">'.$fieldname.'</label>';
echo '</td><td>';
choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
}
echo '</td>';
if (!empty($helptext)) {
echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
$helptext = '';
}
echo '</tr>';
}
}
?>
+132
View File
@@ -0,0 +1,132 @@
<?PHP // $Id$
// backup.php - allows admin to edit all configuration variables for scheduled backups
require_once("../config.php");
require_once("../backup/lib.php");
require_once("../backup/backup_scheduled.php");
require_login();
if (!isadmin()) {
error("Only an admin can use this page");
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
//Initialise error variables
$error = false;
$sche_destination_error = "";
/// If data submitted, then process and store.
if (($config = data_submitted()) && confirm_sesskey()) {
//First of all we check that everything is correct
//Check for trailing slash and backslash in backup_sche_destination
if (!empty($backup_sche_destination) and
(substr($backup_sche_destination,-1) == "/" or substr($backup_sche_destination,-1) == "\\")) {
$error = true;
$sche_destination_error = get_string("pathslasherror");
//Now check that backup_sche_destination dir exists
} else if (!empty($backup_sche_destination) and
!is_dir($backup_sche_destination)) {
$error = true;
$sche_destination_error = get_string("pathnotexists");
}
//We need to do some weekdays conversions prior to continue
$i = 0;
$temp = "";
$a_config = (array)$config;
while ($i<7) {
$tocheck = "dayofweek_".$i;
if (isset($a_config[$tocheck])) {
$temp .= "1";
} else {
$temp .= "0";
}
unset($a_config[$tocheck]);
$i++;
}
$a_config['backup_sche_weekdays'] = $temp;
$config = (object)$a_config;
//weekdays conversions done. Continue
foreach ($config as $name => $value) {
backup_set_config($name, $value);
}
//And now, we execute schedule_backup_next_execution() for each course in the server to have the next
//execution time updated automatically everytime it's changed.
$status = true;
//get admin
$admin = get_admin();
if (!$admin) {
$status = false;
}
//get backup config
if (! $backup_config = backup_get_config()) {
$status = false;
}
if ($status) {
//get courses
if ($courses = get_records('course', '', '', '', 'id,shortname')) {
//For each course, we check (insert, update) the backup_course table
//with needed data
foreach ($courses as $course) {
//We check if the course exists in backup_course
$backup_course = get_record("backup_courses","courseid",$course->id);
//If it doesn't exist, create
if (!$backup_course) {
$temp_backup_course->courseid = $course->id;
$newid = insert_record("backup_courses",$temp_backup_course);
//And get it from db
$backup_course = get_record("backup_courses","id",$newid);
}
//Now, calculate next execution of the course
$nextstarttime = schedule_backup_next_execution ($backup_course,$backup_config,time(),$admin->timezone);
//Save it to db
set_field("backup_courses","nextstarttime",$nextstarttime,"courseid",$backup_course->courseid);
}
}
}
if (!$error) {
redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1);
exit;
}
}
/// Otherwise print the form.
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
$strbackup = get_string("backup");
print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> ".
$strbackup);
echo "<p align=\"right\"><a href=\"../backup/log.php\">".get_string("logs")."</a></p>";
print_heading($strbackup);
print_simple_box("<center>".get_string("adminhelpbackup")."</center>", "center", "50%");
echo "<br />";
print_simple_box_start("center");
//Check for required functions...
if (!function_exists('utf8_encode')) {
notify("You need to add XML support to your PHP installation");
}
include ("$CFG->dirroot/backup/config.html");
print_simple_box_end();
print_footer();
?>
+24 -9
View File
@@ -3,16 +3,22 @@
// block.php - allows admin to edit all local configuration variables for a block
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/blocklib.php');
$blockid = required_param('block', PARAM_INT);
require_login();
if(!$blockrecord = blocks_get_record($blockid)) {
error('This block does not exist');
if (!isadmin()) {
error('Only an admin can use this page');
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
admin_externalpage_setup('blocksetting'.$blockrecord->name);
$blockid = required_param('block', PARAM_INT);
if(($blockrecord = blocks_get_record($blockid)) === false) {
error('This block does not exist');
}
$block = block_instance($blockrecord->name);
if($block === false) {
@@ -31,7 +37,7 @@
if ($config = data_submitted()) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
error(get_string('confirmsesskeybad', 'error'));
}
if(!$block->has_config()) {
error('This block does not support global configuration');
@@ -47,14 +53,23 @@
/// Otherwise print the form.
$stradmin = get_string('administration');
$strconfiguration = get_string('configuration');
$strmanageblocks = get_string('manageblocks');
$strblockname = $block->get_title();
admin_externalpage_print_header();
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'block/' . $block->name() . '/config';
print_header($site->shortname.': '.$strblockname.": $strconfiguration", $site->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> ".
"<a href=\"blocks.php\">$strmanageblocks</a> -> ".$strblockname);
print_heading($strblockname);
print_simple_box(get_string('configwarning', 'admin'), 'center', '50%');
print_simple_box('<center>'.get_string('configwarning', 'admin').'</center>', 'center', '50%');
echo '<br />';
echo '<form method="post" action="block.php">';
+55 -70
View File
@@ -3,12 +3,8 @@
// Allows the admin to configure blocks (hide/show, delete and configure)
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/ddllib.php');
admin_externalpage_setup('manageblocks');
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
@@ -16,8 +12,21 @@
$delete = optional_param('delete', 0, PARAM_INT);
$multiple = optional_param('multiple', 0, PARAM_INT);
require_login();
if (!isadmin()) {
error("Only administrators can use this page!");
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
/// Print headings
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmanageblocks = get_string('manageblocks');
$strdelete = get_string('delete');
$strversion = get_string('version');
@@ -27,7 +36,12 @@
$strcourses = get_string('blockinstances', 'admin');
$strname = get_string('name');
$strmultiple = get_string('blockmultiple', 'admin');
$strshowblockcourse = get_string('showblockcourse');
print_header("$site->shortname: $strmanageblocks", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanageblocks");
print_heading($strmanageblocks);
/// If data submitted, then process and store.
@@ -36,7 +50,6 @@
error("Block doesn't exist!");
}
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($show) && confirm_sesskey() ) {
@@ -44,7 +57,6 @@
error("Block doesn't exist!");
}
set_field('block', 'visible', '1', 'id', $block->id); // Show block
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($multiple) && confirm_sesskey()) {
@@ -53,12 +65,9 @@
}
$block->multiple = !$block->multiple;
update_record('block', $block);
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($delete) && confirm_sesskey()) {
admin_externalpage_print_header();
print_heading($strmanageblocks);
if (!$block = blocks_get_record($delete)) {
error("Block doesn't exist!");
@@ -76,38 +85,34 @@
notice_yesno(get_string('blockdeleteconfirm', '', $strblockname),
'blocks.php?delete='.$block->id.'&amp;confirm=1&amp;sesskey='.$USER->sesskey,
'blocks.php');
admin_externalpage_print_footer();
print_footer();
exit;
} else {
// Inform block it's about to be deleted
$blockobject = block_instance($block->name);
if ($blockobject) {
$blockobject->before_delete(); //only if we can create instance, block might have been already removed
}
// First delete instances and then block
$instances = get_records('block_instance', 'blockid', $block->id);
if(!empty($instances)) {
foreach($instances as $instance) {
blocks_delete_instance($instance);
blocks_delete_instance($instance, true);
}
}
// Delete block
if (!delete_records('block', 'id', $block->id)) {
notify("Error occurred while deleting the $strblockname record from blocks table");
}
drop_plugin_tables($block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false); // old obsoleted table names
drop_plugin_tables('block_'.$block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false);
$instances = get_records('block_instance', 'blockid', $block->id);
if(!empty($instances)) {
foreach($instances as $instance) {
blocks_delete_instance($instance);
}
}
// Delete the capabilities that were defined by this block
capabilities_cleanup('block/'.$block->name);
// Then the tables themselves
// remove entent handlers and dequeue pending events
events_uninstall('block/'.$block->name);
if ($tables = $db->Metatables()) {
$prefix = $CFG->prefix.$block->name;
foreach ($tables as $table) {
if (strpos($table, $prefix) === 0) {
if (!execute_sql("DROP TABLE $table", false)) {
notify("ERROR: while trying to drop table $table");
}
}
}
}
$a->block = $strblockname;
$a->directory = $CFG->dirroot.'/blocks/'.$block->name;
@@ -115,9 +120,6 @@
}
}
admin_externalpage_print_header();
print_heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
@@ -130,7 +132,7 @@
foreach ($blocks as $block) {
if(!block_is_compatible($block->name)) {
notify('Block '. $block->name .' is not compatible with the current version of Moodle and needs to be updated by a programmer.');
notify('Block '. $block->name .' is not compatible with the current version of Mooodle and needs to be updated by a programmer.');
$incompatible[] = $block;
continue;
}
@@ -155,51 +157,33 @@
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'multiple', 'delete', 'settings'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strmultiple, $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'blocks');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->set_attribute('class', 'generaltable generalbox');
$table->setup();
foreach ($blockbyname as $blockname => $blockid) {
$blockobject = $blockobjects[$blockid];
$block = $blocks[$blockid];
$delete = '<a href="blocks.php?delete='.$blockid.'&amp;sesskey='.$USER->sesskey.'">'.$strdelete.'</a>';
$settings = ''; // By default, no configuration
if ($blockobject->has_config()) {
if (file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else {
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
}
if($blockobject->has_config()) {
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
}
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
// and it should not show up on course search page
$totalcount = count_records('block_instance', 'blockid', $blockid);
$count = count_records_sql('SELECT COUNT(*)
FROM '.$CFG->prefix.'block_instance
WHERE blockid = '.$blockid.' AND
pagetype = \'course-view\'');
if ($count>0) {
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&amp;sesskey={$USER->sesskey}\" ";
$blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
}
else {
$blocklist = "$totalcount";
}
$count = count_records('block_instance', 'blockid', $blockid);
$class = ''; // Nothing fancy, by default
if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.$USER->sesskey.'" title="'.$strhide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" class="icon" alt="'.$strhide.'" /></a>';
'<img src="'.$CFG->pixpath.'/i/hide.gif" height="16" width="16" alt="" /></a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.$USER->sesskey.'" title="'.$strshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" class="icon" alt="'.$strshow.'" /></a>';
'<img src="'.$CFG->pixpath.'/i/show.gif" height="16" width="16" alt="" /></a>';
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($blockobject->instance_allow_multiple()) {
@@ -216,8 +200,8 @@
$table->add_data(array(
'<span'.$class.'>'.$blockobject->get_title().'</span>',
$blocklist,
'<span'.$class.'>'.$blockobject->get_version().'</span>',
$count,
$blockobject->get_version(),
$visible,
$multiple,
$delete,
@@ -231,14 +215,15 @@
print_heading(get_string('incompatibleblocks', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'delete'));
$table->define_headers(array($strname, $strdelete));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'incompatible');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->set_attribute('class', 'generaltable generalbox');
$table->setup();
foreach ($incompatible as $block) {
@@ -250,6 +235,6 @@
$table->print_html();
}
admin_externalpage_print_footer();
print_footer();
?>
+68
View File
@@ -0,0 +1,68 @@
<form method="post" action="calendar.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<table class="formtable">
<tr>
<th>adminseesall:</th>
<td>
<div><?php print_string('helpadminseesall', 'admin'); ?></div>
<p>
<select name="adminseesallcourses">
<option value="0" <?php if(empty($CFG->calendar_adminseesall)) echo "selected='selected'"; ?>><?php print_string('adminseesownevents', 'admin'); ?></option>
<option value="1" <?php if(!empty($CFG->calendar_adminseesall)) echo "selected='selected'"; ?>><?php print_string('adminseesallevents', 'admin'); ?></option>
</select>
</p>
</td>
</tr>
<tr>
<th>startwday:</th>
<td>
<div><?php print_string('helpstartofweek', 'admin'); ?></div>
<p><?php choose_from_menu($weekdays, 'startwday', empty($CFG->calendar_startwday) ? 0 : $CFG->calendar_startwday, ''); ?></p>
</td>
</tr>
<tr>
<th>weekenddays:</th>
<td>
<div><?php print_string('helpweekenddays', 'admin'); ?></div>
<p>
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="1" id="weekend1" <?php if(CALENDAR_WEEKEND & 2) echo 'checked="checked"'; ?> /> <label for="weekend1"><?php print_string('monday', 'calendar'); ?></label></span>
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="2" id="weekend2" <?php if(CALENDAR_WEEKEND & 4) echo 'checked="checked"'; ?> /> <label for="weekend2"><?php print_string('tuesday', 'calendar'); ?></label></span>
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="3" id="weekend3" <?php if(CALENDAR_WEEKEND & 8) echo 'checked="checked"'; ?> /> <label for="weekend3"><?php print_string('wednesday', 'calendar'); ?></label></span>
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="4" id="weekend4" <?php if(CALENDAR_WEEKEND & 16) echo 'checked="checked"'; ?> /> <label for="weekend4"><?php print_string('thursday', 'calendar'); ?></label></span>
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="5" id="weekend5" <?php if(CALENDAR_WEEKEND & 32) echo 'checked="checked"'; ?> /> <label for="weekend5"><?php print_string('friday', 'calendar'); ?></label></span>
<br />
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="6" id="weekend6" <?php if(CALENDAR_WEEKEND & 64) echo 'checked="checked"'; ?> /> <label for="weekend6"><?php print_string('saturday', 'calendar'); ?></label></span>
<span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="0" id="weekend0" <?php if(CALENDAR_WEEKEND & 1) echo 'checked="checked"'; ?> /> <label for="weekend0"><?php print_string('sunday', 'calendar'); ?></label></span>
</p>
</td>
</tr>
<tr>
<th>upcoming_lookahead:</th>
<td>
<div><?php print_string('helpupcominglookahead', 'admin'); ?></div>
<p><input type="text" name="lookahead" size="3" value="<?php echo CALENDAR_UPCOMING_DAYS; ?>" /></p>
</td>
</tr>
<tr>
<th>upcoming_maxevents:</th>
<td>
<div><?php print_string('helpupcomingmaxevents', 'admin'); ?></div>
<p><input type="text" name="maxevents" size="3" value="<?php echo CALENDAR_UPCOMING_MAXEVENTS; ?>" /></p>
</td>
</tr>
<tr>
<th>timezones:</th>
<td>
<div><?php print_string('helpforcetimezone', 'admin'); ?></div>
<p><?php choose_from_menu($timezones, 'forcetimezone', $CFG->forcetimezone, get_string('timezonenotforced', 'admin'), '', '99'); ?></p>
<p><a href="timezoneimport.php"><?php print_string('importtimezones', 'admin'); ?>...</a></p>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="<?php print_string('savechanges'); ?>" />
</td>
</tr>
</table>
</form>
+98
View File
@@ -0,0 +1,98 @@
<?PHP // $Id$
// Allows the admin to configure calendar and date/time stuff
require_once('../config.php');
require_login();
if (!isadmin()) {
error('Only administrators can use this page!');
}
if (!$site = get_site()) {
error('Site isn\'t defined!');
}
/// Print headings
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strcalendarsettings = get_string('calendarsettings', 'admin');
print_header("$site->shortname: $strcalendarsettings", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strcalendarsettings");
print_heading($strcalendarsettings);
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
if(isset($form->adminseesallcourses)) {
set_config('calendar_adminseesall', intval($form->adminseesallcourses) != 0);
unset($SESSION->cal_courses_shown);
}
if(isset($form->forcetimezone)) {
// To protect from SQL injections ...
$form->timezone = clean_param($form->timezone, PARAM_PATH); //not a path, but it looks like it anyway
set_config('forcetimezone', $form->forcetimezone);
}
if(isset($form->startwday)) {
$startwday = intval($form->startwday);
if($startwday >= 0 && $startwday <= 6) {
set_config('calendar_startwday', $startwday);
}
}
if(isset($form->weekend)) {
if(is_array($form->weekend)) {
// Creating a packed bitfield; look at /calendar/lib.php if you can't figure it out
$bitfield = 0;
foreach($form->weekend as $day) {
$bitfield |= (1 << (intval($day) % 7));
}
if($bitfield > 0) {
set_config('calendar_weekend', $bitfield);
}
}
}
if(isset($form->lookahead)) {
$lookahead = intval($form->lookahead);
if($lookahead > 0) {
set_config('calendar_lookahead', $lookahead);
}
}
if(isset($form->maxevents)) {
$maxevents = intval($form->maxevents);
if($maxevents > 0) {
set_config('calendar_maxevents', $maxevents);
}
}
redirect('index.php');
}
// Include the calendar library AFTER modifying the data, so we read the latest values
require_once($CFG->dirroot.'/calendar/lib.php');
// Populate some variables we 're going to need in calendar.html
$timezones = get_list_of_timezones();
$weekdays = array(
0 => get_string('sunday', 'calendar'),
1 => get_string('monday', 'calendar'),
2 => get_string('tuesday', 'calendar'),
3 => get_string('wednesday', 'calendar'),
4 => get_string('thursday', 'calendar'),
5 => get_string('friday', 'calendar'),
6 => get_string('saturday', 'calendar')
);
// Main display starts here
print_simple_box_start("center", "80%");
include('./calendar.html');
print_simple_box_end();
print_footer();
?>
+198
View File
@@ -0,0 +1,198 @@
<?php // $Id$
// config.php - allows admin to edit all configuration variables
require_once('../config.php');
$installing = optional_param('installing', 0, PARAM_BOOL);
$focus = '';
if ($site = get_site()) { // If false then this is a new installation
require_login();
if (!isadmin()) {
error('Only the admin can use this page');
}
}
/// This is to overcome the "insecure forms paradox"
if (isset($secureforms) and $secureforms == 0) {
$match = 'nomatch';
} else {
$match = '';
}
/// If data submitted, then process and store.
if ($config = data_submitted($match)) {
if (!empty($USER->id)) { // Additional identity check
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
}
validate_form($config, $err);
if (count($err) == 0) {
foreach ($config as $name => $value) {
if ($name == "sessioncookie") {
$value = eregi_replace("[^a-zA-Z0-9_]", "", $value);
}
if ($name == "defaultallowedmodules") {
$value = implode(',',$value);
}
if ($name == 'hiddenuserfields') {
if (in_array('none', $value)) {
$value = '';
} else {
$value = implode(',',$value);
}
}
if ($name == "locale") {
$value = trim($value);
}
$conf = new object();
$conf->name = $name;
$conf->value = $value;
if ($current = get_record('config', 'name', $name)) {
$conf->id = $current->id;
if (! update_record('config', $conf)) {
notify("Could not update $name to $value");
}
} else {
if (! insert_record('config', $conf)) {
notify("Error: could not add new variable $name !");
}
}
}
if ($installing) {
print_header();
notify(get_string('changessaved'), 'notifysuccess');
print_continue('index.php');
exit;
} else {
// the following redirect was randomly breaking upgrades because it did double redirects,
// we must not use it during install/upgrade
redirect('index.php', get_string('changessaved'), 1);
}
} else {
foreach ($err as $key => $value) {
$focus = "form.$key";
}
}
}
/// Otherwise fill and print the form.
if (empty($config)) {
$config = $CFG;
}
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
$stradmin = get_string('administration');
$strconfiguration = get_string('configuration');
$strconfigvariables = get_string('configvariables', 'admin');
if ($site) {
print_header("$site->shortname: $strconfigvariables", $site->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strconfigvariables", $focus);
print_heading($strconfigvariables);
} else {
print_header();
print_heading($strconfigvariables);
print_simple_box(get_string('configintro', 'admin'), 'center', "50%");
echo '<br />';
}
/// Get all the configuration fields and helptext
require('configvars.php');
/// Cycle through the sections to get the sectionnames
$linktext = '';
foreach($configvars as $sectionname=>$section) {
if ($linktext !== '') {
$linktext .= ' | ';
}
$linktext .= '<a href="#configsection'.$sectionname.'">'.get_string('configsection'.$sectionname, 'admin').'</a>';
}
echo "<center>$linktext</center>\n";
echo '<form method="post" action="config.php" name="form">';
echo '<center><input type="submit" value="'.get_string('savechanges').'" /></center>';
/// Cycle through each section of the configuration
foreach ($configvars as $sectionname=>$section) {
print_heading('<a name="configsection'.$sectionname.'"></a>'.get_string('configsection'.$sectionname, 'admin'));
$table = NULL;
$table->data = array();
foreach ($section as $configvariable=>$configobject) {
$table->data[] = array ( $configvariable.': ',
$configobject->field
);
if ($configobject->display_warning()) {
$table->data[] = array ( '&nbsp;',
'<span class="configwarning">'.$configobject->warning.'</span>'
);
}
$table->data[] = array ( '&nbsp;',
'<span class="confighelp">'.$configobject->help.'</span>'
);
$table->align = array ('right', 'left');
}
print_table($table);
}
echo '<center>';
echo '<input type="hidden" name="installing" value="'.$installing.'" />';
echo '<input type="hidden" name="sesskey" value="'.$sesskey.'" />';
echo '<input type="submit" value="'.get_string('savechanges').'" />';
echo '</center>';
echo '</form>';
/// Lock some options
$httpsurl = str_replace('http://', 'https://', $CFG->wwwroot);
if ($httpsurl != $CFG->wwwroot) {
if (ini_get('allow_url_fopen')) {
if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
echo '<script type="text/javascript">'."\n";
echo '<!--'."\n";
echo "eval('document.form.loginhttps.disabled=true');\n";
echo '-->'."\n";
echo '</script>'."\n";
}
}
}
if ($site) {
print_footer();
}
exit;
/// Functions /////////////////////////////////////////////////////////////////
function validate_form(&$form, &$err) {
// Currently no checks are needed ...
return true;
}
?>
+56
View File
@@ -0,0 +1,56 @@
<?php // $Id$
require_once('../config.php');
require_login();
if (!isadmin()) {
error('Only admins can access this page');
}
if (!$site = get_site()) {
redirect('index.php');
}
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
print_header("$site->shortname: $stradministration: $strconfiguration", "$site->fullname",
'<a href="index.php">'. "$stradministration</a> -> $strconfiguration");
print_heading($strconfiguration);
$table->align = array ('right', 'left');
$table->data[] = array("<strong><a href=\"config.php\">". get_string('configvariables', 'admin') .'</a></strong>',
get_string('adminhelpconfigvariables'));
$table->data[] = array("<strong><a href=\"site.php\">". get_string('sitesettings') .'</a></strong>',
get_string('adminhelpsitesettings'));
$table->data[] = array("<strong><a href=\"../theme/index.php\">". get_string('themes') .'</a></strong>',
get_string('adminhelpthemes'));
$table->data[] = array("<strong><a href=\"lang.php\">". get_string('language') .'</a></strong>',
get_string('adminhelplanguage'));
$table->data[] = array("<strong><a href=\"modules.php\">".get_string('managemodules'). ' </a></strong>',
get_string('adminhelpmanagemodules'));
$table->data[] = array("<strong><a href=\"blocks.php\">". get_string('manageblocks') .'</a></strong>',
get_string('adminhelpmanageblocks'));
$table->data[] = array("<strong><a href=\"filters.php\">". get_string('managefilters') .'</a></strong>',
get_string('adminhelpmanagefilters'));
if (!isset($CFG->disablescheduledbackups)) {
$table->data[] = array("<strong><a href=\"backup.php\">".get_string("backup")."</a></strong>",
get_string('adminhelpbackup'));
}
$table->data[]= array("<strong><a href=\"editor.php\">". get_string('editorsettings') ."</a></strong>",
get_string('adminhelpeditorsettings'));
$table->data[]= array("<strong><a href=\"calendar.php\">". get_string('calendarsettings', 'admin') ."</a></strong>",
get_string('helpcalendarsettings', 'admin'));
$table->data[]= array("<strong><a href=\"maintenance.php\">". get_string('sitemaintenancemode', 'admin') ."</a></strong>",
get_string('helpsitemaintenance', 'admin'));
print_table($table);
print_footer($site);
?>
+660
View File
@@ -0,0 +1,660 @@
<?php // $Id$
// Shane Elliott
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
/// Add new sitewide configuration variables to this file.
/// $configvars is parsed by config.php
/// It is an array of arrays of objects
/// $configvars[sectionname][configvariablename] = configvar object
$configvars = array();
/// no, yes strings and menu options are used in a number of places
/// so we define them here to save time on repeatedly calling
/// get_string()
$stryes = get_string('yes');
$strno = get_string('no');
$noyesoptions[0] = $strno;
$noyesoptions[1] = $stryes;
/// A class to hold the configurable information
/// $field - the html code for the form field
/// $help - help text for the field
/// $warning - optional warning text to be displayed
/// method display_warning() - a generic function that can be used in an extended class
/// e.g. enablerssfeeds
class configvar {
var $field;
var $help;
var $warning;
function configvar($help, $field, $warning='') {
$this->help = $help;
$this->field = $field;
$this->warning = $warning;
}
function display_warning() {
return false;
}
}
////////////////////////////////////////////////////////////////////
/// Miscellaneous config variables
////////////////////////////////////////////////////////////////////
$misc = array();
/// maxeditingtime
unset($options);
$options[3600] = get_string('numminutes', '', 60);
$options[2700] = get_string('numminutes', '', 45);
$options[1800] = get_string('numminutes', '', 30);
$options[900] = get_string('numminutes', '', 15);
$options[300] = get_string('numminutes', '', 5);
$options[60] = get_string('numminutes', '', 1);
$misc['maxeditingtime'] = new configvar (get_string('configmaxeditingtime', 'admin'),
choose_from_menu ($options, 'maxeditingtime', $config->maxeditingtime, '', '', '', true) );
/// debug
unset($options);
$options[5] = $strno;
$options[15] = $stryes;
$misc['debug'] = new configvar (get_string('configdebug', 'admin'),
choose_from_menu ($options, 'debug', $config->debug, '', '', '', true) );
$misc['perfdebug'] = new configvar (get_string('configperfdebug', 'admin'),
choose_from_menu ($options, 'perfdebug', $config->perfdebug, '', '', '', true) );
/// enablerssfeeds
class configvarrss extends configvar {
function display_warning() {
return (!function_exists('utf8_encode'));
}
}
$misc['enablerssfeeds'] = new configvarrss (get_string('configenablerssfeeds', 'admin'),
choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
'<font color="red"> You need to add XML support to your PHP installation.</font>' );
$misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'),
choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true));
unset($options);
$options[5] = get_string('worldblogs','blog');
$options[4] = get_string('siteblogs','blog');
$options[3] = get_string('courseblogs','blog');
$options[2] = get_string('groupblogs','blog');
$options[1] = get_string('personalblogs','blog');
$options[0] = get_string('disableblogs','blog');
$misc['bloglevel'] = new configvar (get_string('configbloglevel', 'admin'),
choose_from_menu ($options, 'bloglevel', $config->bloglevel,'','','',true));
////////////////////////////////////////////////////////////////////
/// OPERATING SYSTEM config variables
////////////////////////////////////////////////////////////////////
$operatingsystem = array();
/// gdversion
unset($options);
$options[0] = get_string('gdnot');
$options[1] = get_string('gd1');
$options[2] = get_string('gd2');
$installed = check_gd_version();
$operatingsystem['gdversion'] = new configvar (get_string('configgdversion', 'admin'),
choose_from_menu ($options, 'gdversion', $installed, '', '', '', true) );
/// dbsessions
$operatingsystem['dbsessions'] = new configvar (get_string('configdbsessions', 'admin'),
choose_from_menu ($noyesoptions, 'dbsessions', $config->dbsessions, '', '', '', true) );
/// sessiontimeout
unset($options);
$options[14400] = get_string('numhours', '', 4);
$options[10800] = get_string('numhours', '', 3);
$options[7200] = get_string('numhours', '', 2);
$options[5400] = get_string('numhours', '', '1.5');
$options[3600] = get_string('numminutes', '', 60);
$options[2700] = get_string('numminutes', '', 45);
$options[1800] = get_string('numminutes', '', 30);
$options[900] = get_string('numminutes', '', 15);
$options[300] = get_string('numminutes', '', 5);
$operatingsystem['sessiontimeout'] = new configvar (get_string('configsessiontimeout', 'admin'),
choose_from_menu ($options, 'sessiontimeout', $config->sessiontimeout, '', '', '', true) );
/// sessioncookie
$operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'),
'<input name="sessioncookie" type="text" size="10" value="'.s($config->sessioncookie).'" alt="sessioncookie" />' );
$operatingsystem['sessioncookiepath'] = new configvar (get_string('configsessioncookiepath', 'admin'),
'<input name="sessioncookiepath" type="text" size="10" value="'.s($config->sessioncookiepath).'" alt="sessioncookiepath" />' );
/// zip
$operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'),
'<input name="zip" type="text" size="30" value="'.s($config->zip).'" alt="zip" />' );
/// unzip
$operatingsystem['unzip'] = new configvar (get_string('configunzip', 'admin'),
'<input name="unzip" type="text" size="30" value="'.s($config->unzip).'" alt="unzip" />' );
$operatingsystem['pathtodu'] = new configvar(get_string('configpathtodu', 'admin'),
'<input name="pathtodu" type="text" size="30" value="'.s($config->pathtodu).'" alt="pathtodu" />');
/// slasharguments
unset($options);
$options[0] = "file.php?file=/1/pic.jpg";
$options[1] = "file.php/1/pic.jpg";
$operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'),
choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) );
/// proxyhost
$operatingsystem['proxyhost'] = new configvar (get_string('configproxyhost', 'admin'),
'<input name="proxyhost" type="text" size="30" value="'.s($config->proxyhost).'" alt="proxyhost" />' );
/// proxyport
$operatingsystem['proxyport'] = new configvar ('',
'<input name="proxyport" type="text" size="5" value="'.s($config->proxyport).'" alt="proxyport" />' );
////////////////////////////////////////////////////////////////////
/// PERMISSIONS config variables
////////////////////////////////////////////////////////////////////
$permissions = array();
/// teacherassignteachers
$permissions['teacherassignteachers'] = new configvar (get_string('configteacherassignteachers', 'admin'),
choose_from_menu ($noyesoptions, 'teacherassignteachers', $config->teacherassignteachers, '', '', '', true) );
/// allowunenroll
$permissions['allowunenroll'] = new configvar (get_string('configallowunenroll', 'admin'),
choose_from_menu ($noyesoptions, 'allowunenroll', $config->allowunenroll, '', '', '', true) );
/// allusersaresitestudents
$permissions['allusersaresitestudents'] = new configvar (get_string('configallusersaresitestudents', 'admin'),
choose_from_menu ($noyesoptions, 'allusersaresitestudents', $config->allusersaresitestudents, '', '', '', true) );
/// showsiteparticipantslist
unset($options);
$options[0] = get_string('siteteachers');
$options[1] = get_string('allteachers');
$options[2] = get_string('studentsandteachers');
$permissions['showsiteparticipantslist'] = new configvar (get_string('configshowsiteparticipantslist', 'admin'),
choose_from_menu ($options, 'showsiteparticipantslist', $config->showsiteparticipantslist, '', '', '', true) );
/// forcelogin
$permissions['forcelogin'] = new configvar (get_string('configforcelogin', 'admin'),
choose_from_menu ($noyesoptions, 'forcelogin', $config->forcelogin, '', '', '', true) );
/// forceloginforprofiles
$permissions['forceloginforprofiles'] = new configvar (get_string('configforceloginforprofiles', 'admin'),
choose_from_menu ($noyesoptions, 'forceloginforprofiles', $config->forceloginforprofiles, '', '', '', true) );
/// opentogoogle
$permissions['opentogoogle'] = new configvar (get_string('configopentogoogle', 'admin'),
choose_from_menu ($noyesoptions, 'opentogoogle', $config->opentogoogle, '', '', '', true) );
/// maxbytes
$options = get_max_upload_sizes();
$permissions['maxbytes'] = new configvar (get_string('configmaxbytes', 'admin'),
choose_from_menu ($options, 'maxbytes', $config->maxbytes, '', '', 0, true) );
/// messaging
$permissions['messaging'] = new configvar (get_string('configmessaging', 'admin'),
choose_from_menu ($noyesoptions, 'messaging', $config->messaging, '', '', '', true) );
/// allowobjectembed
$permissions['allowobjectembed'] = new configvar (get_string('configallowobjectembed', 'admin'),
choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
unset($options);
$options['none'] = 'No courses';
$options['all'] = 'All courses';
$options['requested'] = 'Requested courses';
$permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
' <script language="JavaScript">
function togglemodules(index) {
if (index == 0) {
document.getElementById(\'allowedmodules\').disabled=true;
}
else {
document.getElementById(\'allowedmodules\').disabled=false;
}
}
</script>'.
choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
$permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
$allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
$allowedmodules = array();
if (!empty($config->defaultallowedmodules)) {
$allowedmodules = explode(',',$config->defaultallowedmodules);
}
// On a fresh install of Moodle, this could be empty; prevent a warning on the following loop.
if (!$mods = get_records("modules")) {
$mods = array();
}
$s = "selected=\"selected\"";
$allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
foreach ($mods as $mod) {
$selected = "";
if (in_array($mod->id,$allowedmodules))
$selected = $s;
$allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
}
$allowstr .= '</select>';
$permissions['defaultallowedmodules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr);
/// course requests
$reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'),
choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) );
/// default category for course requests
require_once($CFG->dirroot.'/course/lib.php');
$reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'),
choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) );
$reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'),
'<input type="text" name="requestedteachername" size="20" maxlength="100" value="'.s($config->requestedteachername).'" />');
$reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'),
'<input type="text" name="requestedteachersname" size="20" maxlength="100" value="'.s($config->requestedteachersname).'" />');
$reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'),
'<input type="text" name="requestedstudentname" size="20" maxlength="100" value="'.s($config->requestedstudentname).'" />');
$reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'),
'<input type="text" name="requestedstudentsname" size="20" maxlength="100" value="'.s($config->requestedstudentsname).'" />');
////////////////////////////////////////////////////////////////////
/// INTERFACE config variables
////////////////////////////////////////////////////////////////////
$interface = array();
/// language settings
$interface['lang'] = new configvar ( get_string('configlang', 'admin'),
choose_from_menu(get_list_of_languages(), 'lang', $config->lang, '', '', '', true) );
/// language menu
$interface['langmenu'] = new configvar ( get_string('configlangmenu', 'admin'),
choose_from_menu($noyesoptions, 'langmenu', $config->langmenu, '', '', '', true) );
/// language list
$interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'),
'<input name="langlist" type="text" size="60" value="'.s($config->langlist).'" alt="langlist" />' );
/// language menu
$interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
/// locale
$interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
'<input name="locale" type="text" size="15" value="'.s($config->locale).'" alt="locale" />' );
/// docroot
$interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'),
'<input name="docroot" type="text" size="60" value="'.s($config->docroot).'" alt="docroot" />' );
/// doctonewwindow
$interface['doctonewwindow'] = new configvar ( get_string('configdoctonewwindow', 'admin'),
choose_from_menu($noyesoptions, 'doctonewwindow', $config->doctonewwindow, '', '', '', true) );
/// timezone
$interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
/// country
$interface['country'] = new configvar ( get_string('configcountry', 'admin'),
choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) );
/// framename
if (empty($config->framename)) {
$config->framename = "_top";
}
$interface['framename'] = new configvar (get_string('configframename', 'admin'),
'<input name="framename" type="text" size="15" value="'.s($config->framename).'" alt="framename" />' );
/// language list
$interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'),
'<input name="themelist" type="text" size="60" value="'.s($config->themelist).'" alt="themelist" />' );
/// user themes
$interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'),
choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) );
/// course themes
$interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'),
choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) );
/// allowuserblockhiding
$interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'),
choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) );
/// showblocksonmodpages
$interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'),
choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) );
/// tabselectedtofront
$interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'),
choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// USER config variables
////////////////////////////////////////////////////////////////////
$user = array();
/// sitepolicy
$user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'),
'<input type="text" name="sitepolicy" size="60" value="'.$config->sitepolicy.'" alt="sitepolicy" />' );
/// fullnamedisplay
unset($options);
$options['language'] = get_string('language');
$options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname');
$options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname');
$options['firstname'] = get_string('firstname');
$user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'),
choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) );
/// extendedusernamechars
$user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'),
choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) );
/// autologinguests
$user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
/// hiddenuserfields
$fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
if (empty($config->hiddenuserfields)) {
$config->hiddenuserfields = 'none';
}
$configfields = array_flip(explode(',', $config->hiddenuserfields));
$fieldoptions = '';
foreach ($fields as $value) {
$fieldoptions .= '<option value="'.$value.'"';
if (isset($configfields[$value])) {
$fieldoptions .= ' selected="selected"';
}
$fieldoptions .= '>'.get_string($value).'</option>';
}
$user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
'<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
////////////////////////////////////////////////////////////////////
/// SECURITY config variables
////////////////////////////////////////////////////////////////////
$security = array();
/// displayloginfailures
unset($options);
$options[''] = get_string('nobody');
$options['admin'] = get_string('administrators');
$options['teacher'] = get_string('administratorsandteachers');
$options['everybody'] = get_string('everybody');
$security['displayloginfailures'] = new configvar (get_string('configdisplayloginfailures', 'admin'),
choose_from_menu($options, 'displayloginfailures', $config->displayloginfailures, '', '', '', true) );
/// notifyloginfailures
unset($options);
$options[''] = get_string('nobody');
$options['mainadmin'] = get_string('administrator');
$options['alladmins'] = get_string('administratorsall');
$security['notifyloginfailures'] = new configvar (get_string('confignotifyloginfailures', 'admin'),
choose_from_menu($options, 'notifyloginfailures', $config->notifyloginfailures, '', '', '', true) );
/// notifyloginthreshold
unset($options);
for ($i=1; $i<=100; $i++) {
$options[$i] = "$i";
}
$security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
$security['protectusernames'] = new configvar (get_string('configprotectusernames', 'admin'),
choose_from_menu($noyesoptions, 'protectusernames', $config->protectusernames, '', '', '', true) );
/// secureforms
$security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
/// loginhttps
$security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
/// runclamonupload
$security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
/// pathtoclam
$security['pathtoclam'] = new configvar (get_string('configpathtoclam', 'admin'),
'<input type="text" name="pathtoclam" size="30" value="'.$config->pathtoclam.'" alt="pathtoclam" />' );
/// quarantinedir
$security['quarantinedir'] = new configvar (get_string('configquarantinedir', 'admin'),
'<input type="text" name="quarantinedir" size="30" value="'.$config->quarantinedir.'" alt="quarantinedir" />' );
/// clamfailureonupload
unset($options);
$options['donothing'] = get_string('configclamdonothing', 'admin');
$options['actlikevirus'] = get_string('configclamactlikevirus', 'admin');
$security['clamfailureonupload'] = new configvar (get_string('configclamfailureonupload', 'admin'),
choose_from_menu($options, 'clamfailureonupload', $config->clamfailureonupload, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// MAINTENANCE config variables
////////////////////////////////////////////////////////////////////
$maintenance = array();
/// longtimenosee
unset($options);
$options[0] = get_string('never');
$options[1000] = get_string('numdays', '', 1000);
$options[365] = get_string('numdays', '', 365);
$options[180] = get_string('numdays', '', 180);
$options[150] = get_string('numdays', '', 150);
$options[120] = get_string('numdays', '', 120);
$options[90] = get_string('numdays', '', 90);
$options[60] = get_string('numdays', '', 60);
$options[30] = get_string('numdays', '', 30);
$options[21] = get_string('numdays', '', 21);
$options[14] = get_string('numdays', '', 14);
$options[7] = get_string('numdays', '', 7);
$maintenance['longtimenosee'] = new configvar (get_string('configlongtimenosee', 'admin'),
choose_from_menu ($options, 'longtimenosee', $config->longtimenosee, '', '', '', true) );
/// deleteunconfirmed
unset($options);
$options[0] = get_string('never');
$options[168] = get_string('numdays', '', 7);
$options[144] = get_string('numdays', '', 6);
$options[120] = get_string('numdays', '', 5);
$options[96] = get_string('numdays', '', 4);
$options[72] = get_string('numdays', '', 3);
$options[48] = get_string('numdays', '', 2);
$options[24] = get_string('numdays', '', 1);
$options[12] = get_string('numhours', '', 12);
$options[6] = get_string('numhours', '', 6);
$options[1] = get_string('numhours', '', 1);
$maintenance['deleteunconfirmed'] = new configvar (get_string('configdeleteunconfirmed', 'admin'),
choose_from_menu ($options, 'deleteunconfirmed', $config->deleteunconfirmed, '', '', '', true) );
/// loglifetime
unset($options);
$options[0] = get_string('neverdeletelogs');
$options[1000] = get_string('numdays', '', 1000);
$options[365] = get_string('numdays', '', 365);
$options[180] = get_string('numdays', '', 180);
$options[150] = get_string('numdays', '', 150);
$options[120] = get_string('numdays', '', 120);
$options[90] = get_string('numdays', '', 90);
$options[60] = get_string('numdays', '', 60);
$options[30] = get_string('numdays', '', 30);
$maintenance['loglifetime'] = new configvar (get_string('configloglifetime', 'admin'),
choose_from_menu ($options, 'loglifetime', $config->loglifetime, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// MAIL config variables
////////////////////////////////////////////////////////////////////
$mail = array();
/// smtphosts
$mail['smtphosts'] = new configvar (get_string('configsmtphosts', 'admin'),
'<input name="smtphosts" type="text" size="30" value="'.s($config->smtphosts).'" alt="smtphosts" />' );
/// smtpuser
$mail['smtpuser'] = new configvar (get_string('configsmtpuser', 'admin'),
'<input name="smtpuser" type="text" size="10" value="'.s($config->smtpuser).'" alt="smtpuser" />' );
/// smtppass
$mail['smtppass'] = new configvar ('',
'<input name="smtppass" type="password" size="10" value="'.s($config->smtppass).'" alt="smtppass" />' );
/// noreplyaddress
$mail['noreplyaddress'] = new configvar (get_string('confignoreplyaddress', 'admin'),
'<input name="noreplyaddress" type="text" size="30" value="'.s($config->noreplyaddress).'" alt="noreplyaddress" />' );
/// digestmailtime
$hours = array();
for ($i=0; $i<=23; $i++) {
$hours[$i] = sprintf("%02d",$i);
}
$mail['digestmailtime'] = new configvar (get_string('configdigestmailtime', 'admin'),
choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, '', '', 0, true) );
/// allowemailaddresses
$mail['allowemailaddresses'] = new configvar (get_string('configallowemailaddresses', 'admin'),
'<input name="allowemailaddresses" type="text" size="60" value="'.s($config->allowemailaddresses).'" alt="allowemailaddresses" />' );
/// denyemailaddresses
$mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
'<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
if (!empty($CFG->unicodedb)) { ///These options are only available if running under unicodedb
/// sitemailcharset
unset($options);
unset($charsets);
$charsets = get_list_of_charsets();
$options['0'] = get_string('none');
$options = array_merge($options, $charsets);
$mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
/// allowusermailcharset
$mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
}
/// enable stats
if (empty($CFG->disablestatsprocessing)) {
$stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
unset($options);
$options['none'] = get_string('none');
$options[60*60*24*7] = get_string('numweeks','moodle',1);
$options[60*60*24*14] = get_string('numweeks','moodle',2);
$options[60*60*24*21] = get_string('numweeks','moodle',3);
$options[60*60*24*28] = get_string('nummonths','moodle',1);
$options[60*60*24*56] = get_string('nummonths','moodle',2);
$options[60*60*24*84] = get_string('nummonths','moodle',3);
$options[60*60*24*112] = get_string('nummonths','moodle',4);
$options[60*60*24*140] = get_string('nummonths','moodle',5);
$options[60*60*24*168] = get_string('nummonths','moodle',6);
$options['all'] = get_string('all');
$stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
unset($options);
$options[0] = get_string('untilcomplete');
$options[60*60] = '1 '.get_string('hour');
$options[60*60*2] = '2 '.get_string('hours');
$options[60*60*3] = '3 '.get_string('hours');
$options[60*60*4] = '4 '.get_string('hours');
$options[60*60*5] = '5 '.get_string('hours');
$options[60*60*6] = '6 '.get_string('hours');
$options[60*60*7] = '7 '.get_string('hours');
$options[60*60*8] = '8 '.get_string('hours');
if (empty($config->statsruntimestarthour)) {
$config->statsruntimestarthour = 0;
}
if (empty($config->statsruntimestartminute)) {
$config->statsruntimestartminute = 0;
}
$stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );
$stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
$stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
'<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
}
////////////////////////////////////////////////////////////////////
$configvars['interface'] = $interface;
$configvars['security'] = $security;
$configvars['operatingsystem'] = $operatingsystem;
$configvars['maintenance'] = $maintenance;
$configvars['mail'] = $mail;
$configvars['user'] = $user;
$configvars['permissions'] = $permissions;
$configvars['requestedcourse'] = $reqcourse;
$configvars['misc'] = $misc;
if (empty($CFG->disablestatsprocessing)) {
$configvars['stats'] = $stats;
}
?>
+42
View File
@@ -0,0 +1,42 @@
<?php // $Id$
require_once('../config.php');
require_login();
if (!isadmin()) {
error("Only admins can access this page");
}
if (!$site = get_site()) {
redirect("index.php");
}
$stradministration = get_string("administration");
$strcourses = get_string("courses");
print_header("$site->shortname: $stradministration: $strcourses", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> $strcourses");
print_heading($strcourses);
$table->align = array ("right", "left");
$table->data[] = array('<b><a href="../course/index.php?edit=on&amp;sesskey='.$USER->sesskey.'">'.get_string("managecourses")."</a></b>",
get_string("adminhelpcourses"));
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolmentplugins")."</a></b>",
get_string("adminhelpenrolments"));
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&amp;sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
get_string("adminhelpassignstudents"));
$table->data[] = array("<b><a href=\"../course/index.php?edit=on&amp;sesskey=$USER->sesskey\">".get_string("assignteachers")."</a></b>",
get_string("adminhelpassignteachers")." <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" />");
$table->data[] = array("<b><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a></b>",
get_string("adminhelpassigncreators"));
$table->data[] = array("<b><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a></b>",
get_string("adminhelpassignadmins"));
print_table($table);
print_footer($site);
?>
+88
View File
@@ -0,0 +1,88 @@
<form name="creatorsform" id="creatorsform" method="post" action="creators.php">
<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table align="center" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<?php
$a->count = count($creators);
$a->items = $strexistingcreators;
print_string('counteditems', '', $a);
?>
</td>
<td></td>
<td valign="top">
<?php
$a->count = $usercount;
$a->items = $strpotentialcreators;
print_string('counteditems', '', $a);
?>
</td>
</tr>
<tr>
<td valign="top">
<select name="removeselect[]" size="20" id="removeselect" multiple
onFocus="document.creatorsform.add.disabled=true;
document.creatorsform.remove.disabled=false;
document.creatorsform.addselect.selectedIndex=-1;">
<?php
foreach ($creators as $creator) {
$fullname = fullname($creator, true);
echo "<option value=\"$creator->id\">".$fullname.", ".$creator->email."</option>\n";
}
?>
</select></td>
<td valign="top">
<br />
<input name="add" type="submit" id="add" value="&larr;" />
<br />
<input name="remove" type="submit" id="remove" value="&rarr;" />
<br />
</td>
<td valign="top">
<select name="addselect[]" size="20" id="addselect" multiple
onFocus="document.creatorsform.add.disabled=false;
document.creatorsform.remove.disabled=true;
document.creatorsform.removeselect.selectedIndex=-1;">
<?php
if (!empty($searchusers)) {
echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
foreach ($searchusers as $user) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
echo "</optgroup>\n";
}
if (!empty($users)) {
foreach ($users as $user) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
?>
</select>
<br />
<input type="text" name="searchtext" size="30" value="<?php p($searchtext) ?>"
onFocus ="document.creatorsform.add.disabled=true;
document.creatorsform.remove.disabled=true;
document.creatorsform.removeselect.selectedIndex=-1;
document.creatorsform.addselect.selectedIndex=-1;"
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
if (keyCode == 13) {
document.creatorsform.previoussearch.value=1;
document.creatorsform.submit();
} " />
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>"/>
<?php
if (!empty($searchusers)) {
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
}
?>
</td>
</tr>
</table>
</form>
+113
View File
@@ -0,0 +1,113 @@
<?PHP // $Id$
// Admin only script to assign course creator rights to users
require_once('../config.php');
define("MAX_USERS_PER_PAGE", 50);
if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php");
}
require_login();
if (!isadmin()) {
error("You must be an administrator to use this page.");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
$primaryadmin = get_admin();
/// assign all of the configurable language strings
$stringstoload = array (
"assigncreators",
"administration",
"existingcreators",
"potentialcreators",
"search",
"users",
"searchresults",
"showall"
);
foreach ($stringstoload as $stringtoload){
$strstringtoload = "str" . $stringtoload;
$$strstringtoload = get_string($stringtoload);
}
print_header("$site->shortname: $strassigncreators",
"$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> ->
$strassigncreators", "creatorsform.searchtext");
if (!$frm = data_submitted()) {
print_simple_box("<center>".get_string("adminhelpassigncreators")."</center>", "center", "50%");
$frm = new object();
/// A form was submitted so process the input
} else {
if (!empty($frm->add) and !empty($frm->addselect)) {
foreach ($frm->addselect as $addcreator) {
if (! add_creator($addcreator)) {
error("Could not add course creator with user id $addcreator!");
}
}
} else if (!empty($frm->remove) and !empty($frm->removeselect)) {
foreach ($frm->removeselect as $removecreator) {
if (! remove_creator($removecreator)) {
error("Could not remove course creator with user id $removecreator!");
}
}
} else if (!empty($frm->showall)) {
unset($frm->searchtext);
$frm->previoussearch = 0;
}
}
/// Is there a current search?
$previoussearch = (!empty($frm->search) or (isset($frm->previoussearch) && $frm->previoussearch == 1)) ;
/// Get all existing creators
if (! $creators = get_creators()) {
$creators = array();
}
$creatorsarray = array();
foreach ($creators as $creator) {
$creatorsarray[] = $creator->id;
}
$creatorlist = implode(',', $creatorsarray);
unset($creatorarray);
/// Get search results excluding any current admins
if (!empty($frm->searchtext) and $previoussearch) {
$searchusers = get_users(true, $frm->searchtext, true, $creatorlist, 'firstname ASC, lastname ASC',
'', '', 0, 99999, 'id, firstname, lastname, email');
$usercount = get_users(false, '', true, $creatorlist);
}
/// If no search results then get potential users excluding current creators
if (empty($searchusers)) {
if (!$users = get_users(true, '', true, $creatorlist, 'firstname ASC, lastname ASC', '', '',
0, 99999, 'id, firstname, lastname, email') ) {
$users = array();
}
$usercount = count($users);
}
$searchtext = (isset($frm->searchtext)) ? $frm->searchtext : "";
$previoussearch = ($previoussearch) ? '1' : '0';
include('./creators.html');
print_footer();
?>
+86 -294
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
/// This script looks through all the module directories for cron.php files
/// and runs them. These files can contain cleanup functions, email functions
@@ -10,18 +10,14 @@
///
/// eg wget -q -O /dev/null 'http://moodle.somewhere.edu/admin/cron.php'
/// or php /web/moodle/admin/cron.php
set_time_limit(0);
$starttime = microtime();
/// The following is a hack necessary to allow this script to work well
/// from the command line.
define('FULLME', 'cron');
/// Do not set moodle cookie because we do not need it here, it is better to emulate session
$nomoodlecookie = true;
/// The current directory in PHP version 4.3.0 and above isn't necessarily the
/// directory of the script when run from the command line. The require_once()
/// would fail, so we'll have to chdir()
@@ -31,65 +27,33 @@
}
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/lib/adminlib.php');
/// Extra debugging (set in config.php)
if (!empty($CFG->showcronsql)) {
$db->debug = true;
}
if (!empty($CFG->showcrondebugging)) {
$CFG->debug = DEBUG_DEVELOPER;
$CFG->displaydebug = true;
if (!$alreadyadmin = isadmin()) {
unset($_SESSION['USER']);
unset($USER);
unset($_SESSION['SESSION']);
unset($SESSION);
$USER = get_admin(); /// Temporarily, to provide environment for this script
// we need to override the admin timezone to the moodle timezone!
$USER->timezone = $CFG->timezone;
}
/// extra safety
@session_write_close();
//unset test cookie, user must login again anyway
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/');
/// check if execution allowed
if (isset($_SERVER['REMOTE_ADDR'])) { // if the script is accessed via the web.
if (!empty($CFG->cronclionly)) {
// This script can only be run via the cli.
print_error('cronerrorclionly', 'admin');
exit;
}
// This script is being called via the web, so check the password if there is one.
if (!empty($CFG->cronremotepassword)) {
$pass = optional_param('password', '', PARAM_RAW);
if($pass != $CFG->cronremotepassword) {
// wrong password.
print_error('cronerrorpassword', 'admin');
exit;
}
}
/// switch to site language and locale
if (!empty($CFG->courselang)) {
unset ($CFG->courselang);
}
if (!empty($SESSION->lang)) {
unset ($SESSION->lang);
}
/// emulate normal session
$SESSION = new object();
$USER = get_admin(); /// Temporarily, to provide environment for this script
/// ignore admins timezone, language and locale - use site deafult instead!
$USER->timezone = $CFG->timezone;
$USER->lang = '';
$USER->theme = '';
course_setup(SITEID);
moodle_setlocale();
/// send mime type and encoding
if (check_browser_version('MSIE')) {
//ugly IE hack to work around downloading instead of viewing
@header('Content-Type: text/html; charset=utf-8');
echo "<xmp>"; //<pre> is not good enough for us here
} else {
//send proper plaintext header
@header('Content-Type: text/plain; charset=utf-8');
}
/// no more headers and buffers
while(@ob_end_flush());
/// increase memory limit (PHP 5.2 does different calculation, we need more memory now)
@raise_memory_limit('128M');
@header('Content-Type: text/plain; charset='.current_charset());
/// Start output log
@@ -100,8 +64,7 @@
/// Run all cron jobs for each module
mtrace("Starting activity modules");
get_mailer('buffer');
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1 ")) {
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron)")) {
foreach ($mods as $mod) {
$libfile = "$CFG->dirroot/mod/$mod->name/lib.php";
if (file_exists($libfile)) {
@@ -109,32 +72,20 @@
$cron_function = $mod->name."_cron";
if (function_exists($cron_function)) {
mtrace("Processing module function $cron_function ...", '');
$pre_dbqueries = null;
if (!empty($PERF->dbqueries)) {
$pre_dbqueries = $PERF->dbqueries;
$pre_time = microtime(1);
}
if ($cron_function()) {
if (! set_field("modules", "lastcron", $timenow, "id", $mod->id)) {
mtrace("Error: could not update timestamp for $mod->fullname");
}
}
if (isset($pre_dbqueries)) {
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
mtrace("... used " . (microtime(1) - $pre_time) . " seconds");
}
/// Reset possible changes by modules to time_limit. MDL-11597
@set_time_limit(0);
mtrace("done.");
}
}
}
}
get_mailer('close');
mtrace("Finished activity modules");
mtrace("Starting blocks");
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1")) {
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron)")) {
// we will need the base class.
require_once($CFG->dirroot.'/blocks/moodleblock.class.php');
foreach ($blocks as $block) {
@@ -150,79 +101,19 @@
mtrace('Error: could not update timestamp for '.$block->name);
}
}
/// Reset possible changes by blocks to time_limit. MDL-11597
@set_time_limit(0);
mtrace('done.');
}
}
}
}
mtrace('Finished blocks');
mtrace('Starting admin reports');
// Admin reports do not have a database table that lists them. Instead a
// report includes cron.php with function report_reportname_cron() if it wishes
// to be cronned. It is up to cron.php to handle e.g. if it only needs to
// actually do anything occasionally.
$reports = get_list_of_plugins($CFG->admin.'/report');
foreach($reports as $report) {
$cronfile = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$report.'/cron.php';
if (file_exists($cronfile)) {
require_once($cronfile);
$cronfunction = 'report_'.$report.'_cron';
mtrace('Processing cron function for '.$report.'...', '');
$pre_dbqueries = null;
if (!empty($PERF->dbqueries)) {
$pre_dbqueries = $PERF->dbqueries;
$pre_time = microtime(true);
}
$cronfunction();
if (isset($pre_dbqueries)) {
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
mtrace("... used " . round(microtime(true) - $pre_time, 2) . " seconds");
}
mtrace('done.');
}
}
mtrace('Finished admin reports');
mtrace("Finished blocks");
if (!empty($CFG->langcache)) {
mtrace('Updating languages cache');
get_list_of_languages(true);
get_list_of_languages();
}
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
$timenow = time();
$somefound = false;
// The preferred way saves memory, dmllib.php
// find courses where limited enrolment is enabled
global $CFG;
$rs_enrol = get_recordset_sql("SELECT ra.roleid, ra.userid, ra.contextid
FROM {$CFG->prefix}course c
INNER JOIN {$CFG->prefix}context cx ON cx.instanceid = c.id
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.contextid = cx.id
WHERE cx.contextlevel = '".CONTEXT_COURSE."'
AND ra.timeend > 0
AND ra.timeend < '$timenow'
AND c.enrolperiod > 0
");
while ($oldenrolment = rs_fetch_next_record($rs_enrol)) {
role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid);
$somefound = true;
}
rs_close($rs_enrol);
if($somefound) {
mtrace('Done');
} else {
mtrace('none found');
}
mtrace('Starting main gradebook job ...');
grade_cron();
mtrace('done.');
/// Run all core cron jobs, but not every time since they aren't too important.
/// These don't have a timer to reduce load, so we'll use a random number
@@ -237,107 +128,71 @@
/// Unenrol users who haven't logged in for $CFG->longtimenosee
if ($CFG->longtimenosee) { // value in days
$cuttime = $timenow - ($CFG->longtimenosee * 3600 * 24);
$rs = get_recordset_sql ("SELECT id, userid, courseid
FROM {$CFG->prefix}user_lastaccess
WHERE courseid != ".SITEID."
AND timeaccess < $cuttime ");
while ($assign = rs_fetch_next_record($rs)) {
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
if (role_unassign(0, $assign->userid, 0, $context->id)) {
mtrace("Deleted assignment for user $assign->userid from course $assign->courseid");
$longtime = $timenow - ($CFG->longtimenosee * 3600 * 24);
if ($students = get_users_longtimenosee($longtime)) {
foreach ($students as $student) {
if (unenrol_student($student->userid, $student->course)) {
mtrace("Deleted student enrolment for user $student->userid from course $student->course");
}
}
}
rs_close($rs);
/// Execute the same query again, looking for remaining records and deleting them
/// if the user hasn't moodle/course:view in the CONTEXT_COURSE context (orphan records)
$rs = get_recordset_sql ("SELECT id, userid, courseid
FROM {$CFG->prefix}user_lastaccess
WHERE courseid != ".SITEID."
AND timeaccess < $cuttime ");
while ($assign = rs_fetch_next_record($rs)) {
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
if (!has_capability('moodle/course:view', $context, $assign->userid)) {
delete_records('user_lastaccess', 'userid', $assign->userid, 'courseid', $assign->courseid);
mtrace("Deleted orphan user_lastaccess for user $assign->userid from course $assign->courseid");
}
}
}
rs_close($rs);
}
flush();
/// Delete users who haven't confirmed within required period
if (!empty($CFG->deleteunconfirmed)) {
$cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
$rs = get_recordset_sql ("SELECT id, firstname, lastname
FROM {$CFG->prefix}user
WHERE confirmed = 0
AND firstaccess > 0
AND firstaccess < $cuttime");
while ($user = rs_fetch_next_record($rs)) {
if (delete_records('user', 'id', $user->id)) {
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
if ($users = get_users_unconfirmed($oneweek)) {
foreach ($users as $user) {
if (delete_records('user', 'id', $user->id)) {
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
}
}
}
rs_close($rs);
}
flush();
/// Delete users who haven't completed profile within required period
if (!empty($CFG->deleteincompleteusers)) {
$cuttime = $timenow - ($CFG->deleteincompleteusers * 3600);
$rs = get_recordset_sql ("SELECT id, username
FROM {$CFG->prefix}user
WHERE confirmed = 1
AND lastaccess > 0
AND lastaccess < $cuttime
AND deleted = 0
AND (lastname = '' OR firstname = '' OR email = '')");
while ($user = rs_fetch_next_record($rs)) {
if (delete_user($user)) {
mtrace("Deleted not fully setup user $user->username ($user->id)");
if (!empty($CFG->deleteunconfirmed)) {
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
if ($users = get_users_not_fully_set_up($oneweek)) {
foreach ($users as $user) {
if (delete_records('user', 'id', $user->id)) {
mtrace("Deleted not fully setup user $user->username ($user->id)");
}
}
}
rs_close($rs);
}
flush();
/// Delete old logs to save space (this might need a timer to slow it down...)
if (!empty($CFG->loglifetime)) { // value in days
$loglifetime = $timenow - ($CFG->loglifetime * 3600 * 24);
if (delete_records_select("log", "time < '$loglifetime'")) {
mtrace("Deleted old log records");
}
delete_records_select("log", "time < '$loglifetime'");
}
flush();
/// Delete old cached texts
if (!empty($CFG->cachetext)) { // Defined in config.php
$cachelifetime = time() - $CFG->cachetext - 60; // Add an extra minute to allow for really heavy sites
if (delete_records_select('cache_text', "timemodified < '$cachelifetime'")) {
mtrace("Deleted old cache_text records");
}
delete_records_select('cache_text', "timemodified < '$cachelifetime'");
}
flush();
if (!empty($CFG->notifyloginfailures)) {
notify_login_failures();
mtrace('Notified login failured');
}
flush();
sync_metacourses();
mtrace('Synchronised metacourses');
//
// generate new password emails for users
@@ -363,33 +218,15 @@
}
}
}
if (!empty($CFG->usetags)) {
require_once($CFG->dirroot.'/tag/lib.php');
tag_cron();
mtrace ('Executed tag cron');
}
// Accesslib stuff
cleanup_contexts();
mtrace ('Cleaned up contexts');
gc_cache_flags();
mtrace ('Cleaned cache flags');
// If you suspect that the context paths are somehow corrupt
// replace the line below with: build_context_path(true);
build_context_path();
mtrace ('Built context paths');
mtrace("Finished clean-up tasks...");
} // End of occasional clean-up tasks
if (empty($CFG->disablescheduledbackups)) { // Defined in config.php
if (!isset($CFG->disablescheduledbackups)) { // Defined in config.php
//Execute backup's cron
//Perhaps a long time and memory could help in large sites
@set_time_limit(0);
@raise_memory_limit("192M");
@raise_memory_limit("128M");
if (function_exists('apache_child_terminate')) {
// if we are running from Apache, give httpd a hint that
// it can recycle the process after it's done. Apache's
@@ -441,91 +278,51 @@
unset($enrol);
}
/// Run the auth cron, if any
$auths = get_enabled_auth_plugins();
mtrace("Running auth crons if required...");
foreach ($auths as $auth) {
$authplugin = get_auth_plugin($auth);
if (method_exists($authplugin, 'cron')) {
mtrace("Running cron for auth/$auth...");
$authplugin->cron();
if (!empty($authplugin->log)) {
mtrace($authplugin->log);
}
}
unset($authplugin);
}
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
require_once($CFG->dirroot.'/lib/statslib.php');
// check we're not before our runtime
$timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour*60*60 + $CFG->statsruntimestartminute*60;
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
if (time() > $timetocheck) {
// process max 31 days per cron execution
if (stats_cron_daily(31)) {
if (stats_cron_weekly()) {
if (stats_cron_monthly()) {
stats_clean_old();
}
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
$clobber = true;
if (!empty($CFG->statsmaxruntime)) {
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour just to make sure (it could take that long to break out of the loop)
}
if (!get_field_sql('SELECT id FROM '.$CFG->prefix.'stats_daily LIMIT 1')) {
// first run, set another lock. we'll check for this in subsequent runs to set the timeout to later for the normal lock.
set_cron_lock('statsfirstrunlock',true,$time,true);
$firsttime = true;
}
$time = 60*60*2; // this time set to 2.. (overridden by $CFG)
if (!empty($CFG->statsmaxruntime)) {
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour to make sure (it could take that long to break out of the loop)
}
if ($config = get_record('config','name','statsfirstrunlock')) {
if (!empty($config->value)) {
$clobber = false; // if we're on the first run, just don't clobber it.
}
}
@set_time_limit(0);
} else {
mtrace('Next stats run after:'. userdate($timetocheck));
}
}
// run gradebook import/export/report cron
if ($gradeimports = get_list_of_plugins('grade/import')) {
foreach ($gradeimports as $gradeimport) {
if (file_exists($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php')) {
require_once($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php');
$cron_function = 'grade_import_'.$gradeimport.'_cron';
if (function_exists($cron_function)) {
mtrace("Processing gradebook import function $cron_function ...", '');
$cron_function;
if (set_cron_lock('statsrunning',true,$time, $clobber)) {
require_once($CFG->dirroot.'/lib/statslib.php');
$return = stats_cron_daily();
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
stats_cron_weekly();
}
}
}
}
if ($gradeexports = get_list_of_plugins('grade/export')) {
foreach ($gradeexports as $gradeexport) {
if (file_exists($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php')) {
require_once($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php');
$cron_function = 'grade_export_'.$gradeexport.'_cron';
if (function_exists($cron_function)) {
mtrace("Processing gradebook export function $cron_function ...", '');
$cron_function;
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
$return = $return && stats_cron_monthly();
}
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
stats_clean_old();
}
set_cron_lock('statsrunning',false);
if (!empty($firsttime)) {
set_cron_lock('statsfirstrunlock',false);
}
}
}
}
if ($gradereports = get_list_of_plugins('grade/report')) {
foreach ($gradereports as $gradereport) {
if (file_exists($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php')) {
require_once($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php');
$cron_function = 'grade_report_'.$gradereport.'_cron';
if (function_exists($cron_function)) {
mtrace("Processing gradebook report function $cron_function ...", '');
$cron_function;
}
}
}
}
// run any customized cronjobs, if any
// looking for functions in lib/local/cron.php
if (file_exists($CFG->dirroot.'/local/cron.php')) {
mtrace('Processing customized cron script ...', '');
include_once($CFG->dirroot.'/local/cron.php');
mtrace('done.');
}
//Unset session variables and destroy it
@session_unset();
@session_destroy();
@@ -535,9 +332,4 @@
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
/// finish the IE hack
if (check_browser_version('MSIE')) {
echo "</xmp>";
}
?>
+5 -8
View File
@@ -3,26 +3,23 @@
require_once('../config.php');
// disable moodle specific debug messages that would be breaking the frames
disable_debugging();
$topframe = optional_param('topframe', 0, PARAM_BOOL);
$bottomframe = optional_param('bottomframe', 0, PARAM_BOOL);
$do = optional_param('do', '', PARAM_ALPHA);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
if (!isadmin()) {
error("Only the admin can use this page");
}
$strdatabaseperformance = get_string("databaseperformance");
$stradministration = get_string("administration");
$site = get_site();
$navigation = build_navigation(array(
array('name'=>$stradministration, 'link'=>'index.php', 'type'=>'misc'),
array('name'=>$strdatabaseperformance, 'link'=>null, 'type'=>'misc')));
if (!empty($topframe)) {
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname", $navigation);
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> Database performance");
exit;
}
+8 -19
View File
@@ -4,35 +4,25 @@
// BE VERY CAREFUL USING THIS!
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('purgemoodledata');
require_login();
$sure = optional_param('sure', 0, PARAM_BOOL);
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
if (!isadmin()) {
error('You must be admin to use this script!');
}
$deletedir = $CFG->dataroot; // The directory to delete!
admin_externalpage_print_header();
print_heading('Purge moodledata');
if (empty($sure)) {
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());
notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?',
'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', 'delete.php?sure=yes&amp;sesskey='.sesskey(), 'index.php');
exit;
}
if (!data_submitted() or empty($reallysure)) {
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?',
'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
if (empty($reallysure)) {
notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?', 'delete.php?sure=yes&amp;reallysure=yes&amp;sesskey='.sesskey(), 'index.php');
exit;
}
@@ -46,7 +36,6 @@
echo '<h1 align="center">Done!</h1>';
print_continue($CFG->wwwroot);
admin_externalpage_print_footer();
exit;
@@ -54,7 +43,7 @@ function delete_subdirectories($rootdir) {
$dir = opendir($rootdir);
while (false !== ($file = readdir($dir))) {
while ($file = readdir($dir)) {
if ($file != '.' and $file != '..') {
$fullfile = $rootdir .'/'. $file;
if (filetype($fullfile) == 'dir') {
@@ -77,5 +66,5 @@ function delete_subdirectories($rootdir) {
}
closedir($dir);
}
?>
+331
View File
@@ -0,0 +1,331 @@
<form method="post" action="editor.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="tab" value="<?php p($currentpage) ?>" />
<table border="0" cellpadding="4" cellspacing="2">
<tr>
<td align="right" valign="top">htmleditor:</td>
<td valign="top">
<?php
unset($options);
$options[0] = get_string("allownot");
$options[1] = get_string("allow");
choose_from_menu ($options, "htmleditor", $CFG->htmleditor, "", "", "");
?>
</td>
<td>
<?php print_string('confightmleditor', 'admin') ?>
</td>
</tr>
<?php if ( $currenttab == 'htmlarea' ) { ?>
<tr>
<td align="right" valign="top">editorbackgroundcolor:</td>
<td valign="top"><input type="text" name="backgroundcolor" size="10" value="<?php print($CFG->editorbackgroundcolor);?>" /></td>
<td valign="top"><?php print_string("edhelpbgcolor");?></td>
</tr>
<tr>
<td align="right" valign="top">editorfontfamily:</td>
<td valign="top"><input type="text" name="fontfamily" size="30" value="<?php print($CFG->editorfontfamily);?>" /></td>
<td valign="top"><?php print_string("edhelpfontfamily");?></td>
</tr>
<tr>
<td align="right" valign="top">editorfontsize:</td>
<td valign="top"><input type="text" name="fontsize" size="10" value="<?php print($CFG->editorfontsize);?>" /></td>
<td valign="top"><?php print_string("edhelpfontsize");?></td>
</tr>
<tr>
<td align="right" valign="top">editorkillword:</td>
<td valign="top"><select name="killword">
<option value="1"<?php print(!$CFG->editorkillword)?"":" selected=\"selected\"";?>><?php print_string("yes");?></option>
<option value="0"<?php print(!$CFG->editorkillword)?" selected=\"selected\"":"";?>><?php print_string("no");?></option>
</select></td>
<td valign="top"><?php print_string("edhelpcleanword");?></td>
</tr>
<tr>
<td align="right" valign="top">aspellpath:</td>
<td valign="top"><input onchange="change_state()" id="aspellpath" type="text" name="aspellpath" size="25" value="<?php print($CFG->aspellpath);?>" /></td>
<td valign="top"><?php print_string("edhelpaspellpath");?></td>
</tr>
<tr>
<td align="right" valign="top">editorspelling:</td>
<td valign="top"><select onchange="change_state()" id="spelling" name="spelling"<?php
if (empty($CFG->aspellpath)) {
echo " disabled=\"disabled\"";
$CFG->editorspelling = false;
}
?>>
<option value="1"<?php print(!$CFG->editorspelling)?"":" selected=\"selected\"";?>><?php print_string("yes");?></option>
<option value="0"<?php print(!$CFG->editorspelling)?" selected=\"selected\"":"";?>><?php print_string("no");?></option>
</select>
<select id="dictionary" name="dictionary"<?php
if (empty($CFG->aspellpath)) {
echo " disabled=\"disabled\"";
$CFG->editordictionary = false;
}
?>>
<?php
if (is_array($dicts)) {
foreach ($dicts as $dict) {
echo "<option value=\"$dict\"";
if (!empty($CFG->editordictionary)) {
print ($CFG->editordictionary != $dict) ? "" : " selected=\"selected\"";
}
echo ">$dict</option>\n";
}
} else if (is_string($dicts)) {
echo '<option value="">'. $dicts .'</option>' . "\n";
}
?>
</select>
</td>
<td valign="top"><?php print_string("edhelpenablespelling");?></td>
</tr>
<tr><td colspan="3"><br /><?php print_string("edhelpfontlist");?></td></tr>
<?php
if(is_array($fontlist)) {
foreach($fontlist as $fontkey => $fontvalue) {
?>
<tr>
<td>&nbsp;</td>
<td colspan="2"><input type="text" name="fontname[]" size="15" value="<?php print($fontkey);?>">
<input type="text" name="fontnamevalue[]" size="30" value="<?php print($fontvalue);?>" /></td>
</tr>
<?php
}
}
?>
<tr>
<td>&nbsp;</td>
<td colspan="2"><input type="text" name="fontname[]" size="15" value="" />
<input type="text" name="fontnamevalue[]" size="30" value="" /></td>
</tr>
<tr>
<td valign="top" align="right">editorhidebuttons:</td>
<td colspan="2">
<?php
$buttons = array();
if (!empty($CFG->editorhidebuttons)) {
$buttons = explode(chr(32), $CFG->editorhidebuttons);
}
?>
<table border="0" cellpadding="2" cellspacing="1">
<tr>
<td colspan="12"><input type="checkbox" name="buttons[fontname]"<?php print(in_array("fontname", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("fontname","editor");?>
<input type="checkbox" name="buttons[fontsize]"<?php print(in_array("fontsize", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("fontsize","editor");?>
<input type="checkbox" name="buttons[formatblock]"<?php print(in_array("formatblock", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("formatblock","editor");?></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_bold.gif" width="18" height="18" alt="<?php print_string("bold","editor");?>" title="<?php print_string("bold","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_italic.gif" width="18" height="18" alt="<?php print_string("italic","editor");?>" title="<?php print_string("italic","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_underline.gif" width="18" height="18" alt="<?php print_string("underline","editor");?>" title="<?php print_string("underline","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_strike.gif" width="18" height="18" alt="<?php print_string("strikethrough","editor");?>" title="<?php print_string("strikethrough","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_sub.gif" width="18" height="18" alt="<?php print_string("subscript","editor");?>" title="<?php print_string("subscript","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_format_sup.gif" width="18" height="18" alt="<?php print_string("superscript","editor");?>" title="<?php print_string("superscript","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_copy.gif" width="18" height="18" alt="<?php print_string("copy","editor");?>" title="<?php print_string("copy","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_cut.gif" width="18" height="18" alt="<?php print_string("cut","editor");?>" title="<?php print_string("cut","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_paste.gif" width="18" height="18" alt="<?php print_string("paste","editor");?>" title="<?php print_string("paste","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_wordclean.gif" width="18" height="18" alt="<?php print_string("wordclean","editor");?>" title="<?php print_string("wordclean","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_undo.gif" width="18" height="18" alt="<?php print_string("undo","editor");?>" title="<?php print_string("undo","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_redo.gif" width="18" height="18" alt="<?php print_string("redo","editor");?>" title="<?php print_string("redo","editor");?>" /></td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[bold]"<?php print(in_array("bold", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[italic]"<?php print(in_array("italic", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[underline]"<?php print(in_array("underline", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[strikethrough]"<?php print(in_array("strikethrough", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[subscript]"<?php print(in_array("subscript", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[superscript]"<?php print(in_array("superscript", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[copy]"<?php print(in_array("copy", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[cut]"<?php print(in_array("cut", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[paste]"<?php print(in_array("paste", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[clean]"<?php print(in_array("clean", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[undo]"<?php print(in_array("undo", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[redo]"<?php print(in_array("redo", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_left.gif" width="18" height="18" alt="<?php print_string("justifyleft","editor");?>" title="<?php print_string("justifyleft","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_center.gif" width="18" height="18" alt="<?php print_string("justifycenter","editor");?>" title="<?php print_string("justifycenter","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_right.gif" width="18" height="18" alt="<?php print_string("justifyright","editor");?>" title="<?php print_string("justifyright","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_align_justify.gif" width="18" height="18" alt="<?php print_string("justifyfull","editor");?>" title="<?php print_string("justifyfull","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_left_to_right.gif" width="18" height="18" alt="<?php print_string("lefttoright","editor");?>" title="<?php print_string("lefttoright","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_right_to_left.gif" width="18" height="18" alt="<?php print_string("righttoleft","editor");?>" title="<?php print_string("righttoleft","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_list_num.gif" width="18" height="18" alt="<?php print_string("orderedlist","editor");?>" title="<?php print_string("orderedlist","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_list_bullet.gif" width="18" height="18" alt="<?php print_string("unorderedlist","editor");?>" title="<?php print_string("unorderedlist","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_indent_less.gif" width="18" height="18" alt="<?php print_string("outdent","editor");?>" title="<?php print_string("outdent","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_indent_more.gif" width="18" height="18" alt="<?php print_string("indent","editor");?>" title="<?php print_string("indent","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_color_fg.gif" width="18" height="18" alt="<?php print_string("forecolor","editor");?>" title="<?php print_string("forecolor","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_color_bg.gif" width="18" height="18" alt="<?php print_string("hilitecolor","editor");?>" title="<?php print_string("hilitecolor","editor");?>" /></td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[justifyleft]"<?php print(in_array("justifyleft", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[justifycenter]"<?php print(in_array("justifycenter", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[justifyright]"<?php print(in_array("justifyright", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[justifyfull]"<?php print(in_array("justifyfull", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[lefttoright]"<?php print(in_array("lefttoright", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[righttoleft]"<?php print(in_array("righttoleft", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertorderedlist]"<?php print(in_array("insertorderedlist", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertunorderedlist]"<?php print(in_array("insertunorderedlist", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[outdent]"<?php print(in_array("outdent", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[indent]"<?php print(in_array("indent", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[forecolor]"<?php print(in_array("forecolor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[hilitecolor]"<?php print(in_array("hilitecolor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_hr.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("horizontalrule","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_anchor.gif" width="18" height="18" alt="<?php print_string("createanchor","editor");?>" title="<?php print_string("createanchor","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_link.gif" width="18" height="18" alt="<?php print_string("insertlink","editor");?>" title="<?php print_string("insertlink","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_unlink.gif" width="18" height="18" alt="<?php print_string("removelink","editor");?>" title="<?php print_string("removelink","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_image.gif" width="18" height="18" alt="<?php print_string("insertimage","editor");?>" title="<?php print_string("insertimage","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/insert_table.gif" width="18" height="18" alt="<?php print_string("inserttable","editor");?>" title="<?php print_string("inserttable","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/em.icon.smile.gif" width="18" height="18" alt="<?php print_string("insertsmile","editor");?>" title="<?php print_string("insertsmile","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/icon_ins_char.gif" width="18" height="18" alt="<?php print_string("insertchar","editor");?>" title="<?php print_string("insertchar","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/spell-check.gif" width="18" height="18" alt="<?php print_string("spellcheck","editor");?>" title="<?php print_string("spellcheck","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_html.gif" width="18" height="18" alt="<?php print_string("htmlmode","editor");?>" title="<?php print_string("htmlmode","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/fullscreen_maximize.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("popupeditor","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_replace.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("searchandreplace","editor");?>" /></td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[inserthorizontalrule]"<?php print(in_array("inserthorizontalrule", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[createanchor]"<?php print(in_array("createanchor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[createlink]"<?php print(in_array("createlink", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[unlink]"<?php print(in_array("unlink", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertimage]"<?php print(in_array("insertimage", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[inserttable]"<?php print(in_array("inserttable", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertsmile]"<?php print(in_array("insertsmile", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertchar]"<?php print(in_array("insertchar", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[spellcheck]"<?php print(in_array("spellcheck", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[htmlmode]"<?php print(in_array("htmlmode", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[popupeditor]"<?php print(in_array("popupeditor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[search_replace]"<?php print(in_array("search_replace", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/images/ed_nolink.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("nolink","editor");?>" /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[nolink]"<?php print(in_array("nolink", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</td>
</tr>
<?php
}
else if ( $currenttab == 'tinymce' ) {
?>
<tr>
<td>tinymcetheme:</td>
<td><?php
$options = array('advanced' => 'Advanced','simple' => 'Simple');
choose_from_menu ($options, "tinymcetheme", $CFG->tinymcetheme, "", "", "");
?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top">tinymceplugins:</td>
<td nowrap="nowrap"><?php
$pluginsdir = $CFG->libdir .'/editor/tinymce/jscripts/tiny_mce/plugins';
$plugins = editor_get_tiny_plugins();
$pluginsinuse = explode(",", $CFG->tinymceplugins);
sort($plugins);
$cnt = 0;
echo '<table border="0" cellpadding="2">';
foreach ( $plugins as $plugin ) {
$num = ($cnt % 2);
if ( $num < 1 ) {
echo '<tr>';
}
echo '<td><input type="checkbox" name="tinymceplugins[]" value="'. s($plugin) .'"';
if ( in_array($plugin, $pluginsinuse) ) {
echo ' checked="checked"';
}
echo ' /> '. $plugin .'</td>'."\n";
if ( $num > 0 ) {
echo '</tr>';
}
$cnt++;
}
echo '</table>';
?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>tinymcecontentcss:</td>
<td><input type="text" name="tinymcecontentcss" value="<?php
!empty($CFG->tinymcecontentcss) ? p($CFG->tinymcecontentcss) : ''; ?>" size="40" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>tinymcepopupcss:</td>
<td><input type="text" name="tinymcepopupcss" value="<?php
!empty($CFG->tinymcepopupcss) ? p($CFG->tinymcepopupcss) : ''; ?>" size="40" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>tinymceeditorcss:</td>
<td><input type="text" name="tinymceeditorcss" value="<?php
!empty($CFG->tinymceeditorcss) ? p($CFG->tinymceeditorcss) : ''; ?>" size="40" /></td>
<td>&nbsp;</td>
</tr>
<?php
}
?>
<tr>
<td colspan="3" align="center"><input type="submit" value="<?php print_string("savechanges");?>" /></td>
</tr>
</table>
</form>
<form method="post" action="<?php print($GLOBALS['ME']);?>">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="tab" value="<?php p($currentpage) ?>" />
<center>
<input type="submit" name="resettodefaults" value="<?php print_string('editorresettodefaults') ?>" />
</center>
</form>
<script language="javascript" type="text/javascript">
<!--
function change_state () {
var choice = document.forms[0].spelling;
var speller = choice.options[choice.selectedIndex].value;
var spellpath = document.forms[0].aspellpath.value;
if (spellpath == '') {
document.forms[0].spelling.disabled = true;
} else {
document.forms[0].spelling.disabled = false;
}
if (speller != 1) {
document.forms[0].dictionary.disabled = true;
} else {
document.forms[0].dictionary.disabled = false;
}
}
document.onload = change_state();
-->
</script>
+306
View File
@@ -0,0 +1,306 @@
<?php // $Id$
/// configuration routines for HTMLArea editor
require_once('../config.php');
$currentpage = optional_param('tab', 1, PARAM_INT);
require_login();
if (!isadmin()) {
error("Only admins can access this page");
}
if (($data = data_submitted()) && confirm_sesskey()) {
// do we want default values?
if (isset($data->resettodefaults)) {
if (!(reset_to_defaults($currentpage))) {
error("Editor settings could not be restored!");
}
} else {
if (!(editor_update_config($data, $currentpage))) {
error("Editor settings could not be updated!");
}
}
redirect("$CFG->wwwroot/$CFG->admin/editor.php?tab=$currentpage", get_string("changessaved"), 1);
} else {
// Generate edit form
$inactive = array();
switch ( $currentpage ) {
case 1:
$currenttab = 'htmlarea';
break;
case 2:
$currenttab = 'tinymce';
break;
default:
error("Unknown currentpage: $currentpage");
}
//$url = 'editor.php?tab=';
//$tabrow = array();
//$tabrow[] = new tabobject('htmlarea',$url . '1', 'HTMLArea');
//$tabrow[] = new tabobject('tinymce',$url . '2', 'TinyMCE');
//$tabs = array($tabrow);
$fontlist = editor_convert_to_array($CFG->editorfontlist);
$dicts = editor_get_dictionaries();
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
$streditorsettings = get_string("editorsettings");
$streditorsettingshelp = get_string("adminhelpeditorsettings");
print_header("Editor settings","Editor settings",
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $streditorsettings");
print_heading($streditorsettings);
print_simple_box("<center>$streditorsettingshelp</center>","center","50%");
print("<br />\n");
//print_tabs($tabs, $currenttab, $inactive);
print_simple_box_start("center");
include("editor.html");
print_simple_box_end();
print_footer();
}
/// FUNCTIONS
function editor_convert_to_array ($string) {
/// Converts $CFG->editorfontlist to array
if (empty($string) || !is_string($string)) {
return false;
}
$fonts = array();
$lines = explode(";", $string);
foreach ($lines as $line) {
if (!empty($line)) {
list($fontkey, $fontvalue) = explode(":", $line);
$fonts[$fontkey] = $fontvalue;
}
}
return $fonts;
}
function editor_update_config ($data, $editor) {
/// Updates the editor config values.
if (!is_object($data)) {
return false;
}
switch($editor) {
case 1: // HTMLArea.
// Make array for unwanted characters.
$nochars = array(chr(33),chr(34),chr(35),chr(36),chr(37),
chr(38),chr(39),chr(40),chr(41),chr(42),
chr(43),chr(46),chr(47),chr(58),chr(59),
chr(60),chr(61),chr(62),chr(63),chr(64),
chr(91),chr(92),chr(93),chr(94),chr(95),
chr(96),chr(123),chr(124),chr(125),chr(126));
$fontlist = '';
// make font string
$cnt = count($data->fontname);
for ($i = 0; $i < $cnt; $i++) {
if (!empty($data->fontname[$i])) {
$fontlist .= str_replace($nochars, "", $data->fontname[$i]) .":";
$fontlist .= str_replace($nochars, "", $data->fontnamevalue[$i]) .";";
}
}
// strip last semicolon
$fontlist = substr($fontlist, 0, strlen($fontlist) - 1);
// make array of values to update
$updatedata = array();
$updatedata['htmleditor'] = !empty($data->htmleditor) ? $data->htmleditor : 0;
$updatedata['editorbackgroundcolor'] = !empty($data->backgroundcolor) ? $data->backgroundcolor : "#ffffff";
$updatedata['editorfontfamily'] = !empty($data->fontfamily) ? str_replace($nochars,"",$data->fontfamily) : "Times New Roman, Times";
$updatedata['editorfontsize'] = !empty($data->fontsize) ? $data->fontsize : "";
$updatedata['editorkillword'] = !empty($data->killword) ? $data->killword : 0;
$updatedata['editorspelling'] = !empty($data->spelling) ? $data->spelling : 0;
$updatedata['editorfontlist'] = $fontlist;
$updatedata['editordictionary'] = !empty($data->dictionary) ? $data->dictionary : '';
$updatedata['aspellpath'] = !empty($data->aspellpath) ? $data->aspellpath : '';
$hidebuttons = '';
if (!empty($data->buttons) && is_array($data->buttons)) {
foreach ($data->buttons as $key => $value) {
$hidebuttons .= $key . " ";
}
}
$updatedata['editorhidebuttons'] = trim($hidebuttons);
break;
case 2: // TinyMCE.
$updatedata = array();
$updatedata['htmleditor'] = !empty($data->htmleditor) ? $data->htmleditor : 0;
// Process plugins
if ( !empty($data->tinymceplugins) ) {
foreach ( $data->tinymceplugins as $key => $value ) {
$value = stripslashes(clean_param($value, PARAM_ALPHA));
$data->tinymceplugins[$key] = addslashes($value);
}
}
$updatedata['tinymceplugins'] = !empty($data->tinymceplugins) ? implode(",", $data->tinymceplugins) : '';
$updatedata['tinymcetheme'] = !empty($data->tinymcetheme) ?
clean_param($data->tinymcetheme, PARAM_ALPHA) : '';
$updatedata['tinymcecontentcss'] = !empty($data->tinymcecontentcss) ?
clean_param($data->tinymcecontentcss, PARAM_URL) : '';
$updatedata['tinymcepopupcss'] = !empty($data->tinymcepopupcss) ?
clean_param($data->tinymcepopupcss, PARAM_URL) : '';
$updatedata['tinymceeditorcss'] = !empty($data->tinymceeditorcss) ?
clean_param($data->tinymceeditorcss, PARAM_URL) : '';
break;
}
foreach ($updatedata as $name => $value) {
if (!(set_config($name, $value))) {
return false;
}
}
return true;
}
function reset_to_defaults ($editor) {
/// Reset the values to default
global $CFG;
include_once($CFG->dirroot .'/lib/defaults.php');
$updatedata = array();
switch ( $editor ) {
case 1: // HTMLArea.
$updatedata['editorbackgroundcolor'] = $defaults['editorbackgroundcolor'];
$updatedata['editorfontfamily'] = $defaults['editorfontfamily'];
$updatedata['editorfontsize'] = $defaults['editorfontsize'];
$updatedata['editorkillword'] = $defaults['editorkillword'];
$updatedata['editorspelling'] = $defaults['editorspelling'];
$updatedata['editorfontlist'] = $defaults['editorfontlist'];
$updatedata['editorhidebuttons'] = $defaults['editorhidebuttons'];
$updatedata['editordictionary'] = '';
break;
case 2: // TinyMCE.
$updatedata['tinymceplugins'] = $defaults['tinymceplugins'];
$updatedata['tinymcetheme'] = $defaults['tinymcetheme'];
$updatedata['tinymcecontentcss'] = $defaults['tinymcecontentcss'];
$updatedata['tinymcepopupcss'] = $defaults['tinymcepopupcss'];
$updatedata['tinymceeditorcss'] = $defaults['tinymceeditorcss'];
break;
}
foreach ($updatedata as $name => $value) {
if (!(set_config($name, $value))) {
return false;
}
}
return true;
}
function editor_get_dictionaries () {
/// Get all installed dictionaries in the system
global $CFG;
error_reporting(E_ALL); // for debug, final version shouldn't have this...
clearstatcache();
$strerror = '';
// If aspellpath isn't set don't even bother ;-)
if (empty($CFG->aspellpath)) {
return $strerror = 'Empty aspell path!';
}
// Do we have access to popen function?
if (!function_exists('popen')) {
return $strerror = "Popen function disabled!";
exit;
}
global $CFG;
$cmd = $CFG->aspellpath;
$output = '';
$dictionaries = array();
$dicts = array();
if(!($handle = @popen(escapeshellarg($cmd) .' dump dicts', 'r'))) {
return $strerror = "Couldn't create handle!";
exit;
}
while(!feof($handle)) {
$output .= fread($handle, 1024);
}
@pclose($handle);
$dictionaries = explode(chr(10), $output);
// Get rid of possible empty values
if (is_array($dictionaries)) {
$cnt = count($dictionaries);
for ($i = 0; $i < $cnt; $i++) {
if (!empty($dictionaries[$i])) {
$dicts[] = $dictionaries[$i];
}
}
}
if (count($dicts) >= 1) {
return $dicts;
}
$strerror = "Error! Check your aspell installation!";
return $strerror;
}
function editor_get_tiny_plugins() {
global $CFG;
$plugins = array();
$plugindir = $CFG->libdir .'/editor/tinymce/jscripts/tiny_mce/plugins';
if ( !$fp = opendir($plugindir) ) {
return $plugins;
exit;
}
while ( ($file = readdir($fp)) !== false ) {
if ( preg_match("/^\.+/", $file) ) {
continue;
}
if ( is_dir($plugindir .'/'. $file) ) {
array_push($plugins, $file);
}
}
if ( $fp ) {
closedir($fp);
}
return $plugins;
}
?>
+22 -17
View File
@@ -3,23 +3,29 @@
// Yes, enrol is correct English spelling.
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
$CFG->pagepath = 'enrol';
require_login();
admin_externalpage_setup('enrolment');
if (!$site = get_site()) {
redirect("index.php");
}
if (!isadmin()) {
error("Only the admin can use this page");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
/// Save settings
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
if (empty($frm->enable)) {
$frm->enable = array();
}
@@ -33,14 +39,16 @@
$frm->enable = array_merge(array('manual'), $frm->enable); // make sure manual plugin is called first
set_config('enrol_plugins_enabled', implode(',', $frm->enable));
set_config('enrol', $frm->default);
redirect("enrol.php", get_string("changessaved"), 1);
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
}
/// Print the form
$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));
admin_externalpage_print_header();
print_header("$site->shortname: $str->enrolmentplugins", "$site->fullname",
"<a href=\"index.php\">$str->administration</a> ->
<a href=\"users.php\">$str->users</a> -> $str->enrolmentplugins");
$modules = get_list_of_plugins("enrol");
$options = array();
@@ -51,9 +59,8 @@
print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
echo "<div>";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
echo "<form target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
$table = new stdClass();
$table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings);
@@ -63,7 +70,6 @@
$table->data = array();
$modules = get_list_of_plugins("enrol");
$enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
foreach ($modules as $module) {
// skip if directory is empty
@@ -74,7 +80,7 @@
$name = get_string("enrolname", "enrol_$module");
$plugin = enrolment_factory::factory($module);
$enable = '<input type="checkbox" name="enable[]" value="'.$module.'"';
if (in_array($module, $enabledplugins)) {
if (stristr($CFG->enrol_plugins_enabled, $module) !== false) {
$enable .= ' checked="checked"';
}
if ($module == 'manual') {
@@ -91,16 +97,15 @@
$default = '';
}
$table->data[$name] = array($name, $enable, $default,
'<a href="enrol_config.php?enrol='.$module.'">'.$str->edit.'</a>');
'<a href="enrol_config.php?sesskey='.$USER->sesskey.'&amp;enrol='.$module.'">'.$str->edit.'</a>');
}
asort($table->data);
print_table($table);
echo "<div style=\"text-align:center\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></div>\n";
echo "</div>";
echo "<center><input type=\"submit\" value=\"".get_string("savechanges")."\"></center>\n";
echo "</form>";
admin_externalpage_print_footer();
print_footer();
?>
?>
+35 -18
View File
@@ -3,13 +3,23 @@
// Yes, enrol is correct English spelling.
require_once("../config.php");
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('enrolment');
$enrol = required_param('enrol', PARAM_ALPHA);
$CFG->pagepath = 'enrol/' . $enrol;
require_login();
if (!$site = get_site()) {
redirect("index.php");
}
if (!isadmin()) {
error("Only the admin can use this page");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
@@ -18,9 +28,6 @@
/// If data submitted, then process and store.
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
if ($enrolment->process_config($frm)) {
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
}
@@ -33,7 +40,6 @@
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
unset($options);
$modules = get_list_of_plugins("enrol");
foreach ($modules as $module) {
@@ -41,14 +47,25 @@
}
asort($options);
admin_externalpage_print_header();
print_header("$site->shortname: $str->enrolmentplugins", "$site->fullname",
"<a href=\"index.php\">$str->administration</a> ->
<a href=\"users.php\">$str->users</a> ->
<a href=\"enrol.php?sesskey=$USER->sesskey\">$str->enrolmentplugins</a> ->
$str->configuration");
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
echo "<div>";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";
echo "<form target=\"{$CFG->framename}\" name=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
echo "<div align=\"center\"><p><b>";
/// Print current enrolment type description
/// Choose an enrolment method
echo get_string('chooseenrolmethod').': ';
choose_from_menu ($options, "enrol", $enrol, "",
"document.location='enrol_config.php?sesskey=$USER->sesskey&enrol='+document.enrolmenu.enrol.options[document.enrolmenu.enrol.selectedIndex].value", "");
echo "</b></p></div>";
/// Print current enrolment type description
print_simple_box_start("center", "80%");
print_heading($options[$enrol]);
@@ -57,15 +74,15 @@
print_simple_box_end();
echo "<hr />";
$enrolment->config_form($frm);
echo "<p class=\"centerpara\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p>\n";
print_simple_box_end();
echo "</div>";
echo "<center><p><input type=\"submit\" value=\"".get_string("savechanges")."\"></p></center>\n";
echo "</form>";
admin_externalpage_print_footer();
print_simple_box_end();
print_footer();
exit;
?>
+31 -16
View File
@@ -7,7 +7,7 @@
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com //
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
// //
// This program is free software; you can redistribute it and/or modify //
@@ -30,16 +30,24 @@
// from moodle.org be able to check more and more versions.
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/environmentlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
admin_externalpage_setup('environment');
/// Parameters
$action = optional_param('action', '', PARAM_ACTION);
$version = optional_param('version', '', PARAM_FILE); //
/// Security checks
require_login();
if (!isadmin()) {
error('You need to be admin to use this page');
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
/// Get some strings
$stradmin = get_string('administration');
@@ -52,7 +60,9 @@
$strmisc = get_string('miscellaneous');
/// Print the header stuff
admin_externalpage_print_header();
print_header("$SITE->shortname: $strenvironment", $SITE->fullname,
"<a href=\"index.php\">$stradmin</a> -> <a href=\"misc.php\">$strmisc</a> -> "
.$strenvironment);
/// Print the component download link
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&amp;sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
@@ -65,10 +75,10 @@
if ($cd = new component_installer('http://download.moodle.org',
'environment',
'environment.zip')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
switch ($status) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
case ERROR:
if ($cd->get_error() == 'remotedownloadnotallowed') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/environment/environment.zip';
$a->dest= $CFG->dataroot.'/';
@@ -77,10 +87,10 @@
print_simple_box(get_string($cd->get_error(), 'error'), 'center', '', '', 5, 'errorbox');
}
break;
case COMPONENT_UPTODATE:
case UPTODATE:
print_simple_box(get_string($cd->get_error(), 'error'), 'center');
break;
case COMPONENT_INSTALLED:
case INSTALLED:
print_simple_box(get_string('componentinstalled', 'admin'), 'center');
break;
}
@@ -90,7 +100,7 @@
/// Start of main box
print_simple_box_start('center');
echo "<div style=\"text-align:center\">".$stradminhelpenvironment."</div><br />";
echo "<center>".$stradminhelpenvironment."</center><br />";
/// Get current Moodle version
$current_version = $CFG->release;
@@ -120,17 +130,22 @@
}
/// Print form and popup menu
echo '<div style="text-align:center">'.$strmoodleversion.' ';
popup_form("$CFG->wwwroot/$CFG->admin/environment.php?version=",
$versions, 'selectversion', $version, '');
echo '</div>';
echo '<center><form method="post" action="environment.php">';
echo $strmoodleversion.' ';
choose_from_menu ($versions, 'version', $version, null, 'this.form.submit();' );
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo '</form></center>';
/// End of main box
print_simple_box_end();
/// Gather and show results
$status = check_moodle_environment($version, $environment_results);
/// Other links
echo '<div align="center">';
print_single_button('phpinfo.php', NULL, get_string('phpinfo'));
echo '</div>';
/// Print footer
admin_externalpage_print_footer();
print_footer();
?>
+1 -218
View File
@@ -35,11 +35,6 @@
</PHP_EXTENSIONS>
</MOODLE>
<MOODLE version="1.7">
<UNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="unicoderecommended" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="4.1.16">
<FEEDBACK>
@@ -49,12 +44,10 @@
</VENDOR>
<VENDOR name="postgres" version="7.4" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="9.0" />
</DATABASE>
<PHP version="4.3.0" level="required">
<RESTRICT function="restrict_php50_version" message="php50restricted" />
<RESTRICT function="restrict_php50_version" message="php50restricted" />
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="optional">
@@ -69,214 +62,4 @@
</PHP_EXTENSION>
</PHP_EXTENSIONS>
</MOODLE>
<MOODLE version="1.8">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="4.1.16">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="7.4" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="9.0" />
</DATABASE>
<PHP version="4.3.0" level="required">
<RESTRICT function="restrict_php50_version" message="php50restricted" />
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="optional">
<FEEDBACK>
<ON_CHECK message="iconvrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="optional">
<FEEDBACK>
<ON_CHECK message="curlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="optional">
<FEEDBACK>
<ON_CHECK message="ctyperecommended" />
</FEEDBACK>
</PHP_EXTENSION>
</PHP_EXTENSIONS>
</MOODLE>
<MOODLE version="1.9">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="4.1.16">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="8.0" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="9.0" />
</DATABASE>
<PHP version="4.3.0" level="required">
<RESTRICT function="restrict_php50_version" message="php50restricted" />
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="optional">
<FEEDBACK>
<ON_CHECK message="iconvrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="optional">
<FEEDBACK>
<ON_CHECK message="curlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="optional">
<FEEDBACK>
<ON_CHECK message="ctyperecommended" />
</FEEDBACK>
</PHP_EXTENSION>
</PHP_EXTENSIONS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
<FEEDBACK>
<ON_CHECK message="qtyperqpwillberemovedanyway" />
<ON_OK message="qtyperqpwillberemoved" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/upgrade.php" function="question_random_check" level="optional">
<FEEDBACK>
<ON_OK message="questioncwqpfsok" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
<FEEDBACK>
<ON_CHECK message="globalswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="2.0" requires="1.9">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="4.1.16">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="8.0" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="9.0" />
</DATABASE>
<PHP version="5.2.0" level="required">
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="optional">
<FEEDBACK>
<ON_CHECK message="iconvrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="optional">
<FEEDBACK>
<ON_CHECK message="curlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
</PHP_EXTENSIONS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
<FEEDBACK>
<ON_CHECK message="qtyperqpwillberemovedanyway" />
<ON_OK message="qtyperqpwillberemoved" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
<FEEDBACK>
<ON_CHECK message="globalswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+40 -22
View File
@@ -3,19 +3,30 @@
// Edit text filter settings
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
$filterfull = required_param('filter', PARAM_PATH);
$forcereset = optional_param('reset', 0, PARAM_BOOL);
// check for allowed access
require_login();
if (!isadmin()) {
error( 'Only administrators can use the filters administration page' );
}
if (!$site = get_site()) {
error( 'Site is not defined in filters administration page' );
}
$filtername = substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
// get parameters
$param = new Object;
admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
$param->filter = required_param('filter', PARAM_PATH);
$param->submit = optional_param('submit', 0, PARAM_BOOL);
$param->reset = optional_param('reset', 0, PARAM_BOOL);
$filtername = substr($param->filter, strpos( $param->filter, '/' )+1 ) ;
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'filter/' . $filtername . '/config';
// get translated strings for use on page
$txt = new Object;
$txt->managefilters = get_string( 'managefilters' );
@@ -27,7 +38,12 @@
//======================
// if reset pressed let filter config page handle it
if ($config = data_submitted() and !$forcereset) {
$forcereset = false;
if (!empty($param->reset)) {
$forcereset = true;
}
else
if ($config = data_submitted()) {
// check session key
if (!confirm_sesskey()) {
@@ -48,43 +64,45 @@
// run through submitted data
// reject if does not start with filter_
foreach ($config as $name => $value) {
set_config($name, stripslashes($value));
set_config( $name,$value );
}
}
reset_text_filters_cache();
redirect($returnurl);
redirect( "$CFG->wwwroot/$CFG->admin/filters.php", get_string('changessaved'), 1);
exit;
}
//==============================
// Display logic
//==============================
$filtername = ucfirst($filtername);
admin_externalpage_print_header();
print_heading( $filtername );
print_header( "$site->shortname: $txt->managefilters", "$site->fullname",
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
"-> <a href=\"filters.php\">$txt->managefilters</a> -> $filtername" );
print_simple_box(get_string("configwarning", "admin"), "center", "50%");
print_heading( $txt->managefilters );
print_simple_box("<center>".get_string("configwarning", "admin")."</center>", "center", "50%");
echo "<br />";
print_simple_box_start("center",'');
?>
<form action="filter.php?filter=<?php echo urlencode($filterfull); ?>" method="post">
<div style="text-align: center">
<form action="filter.php?filter=<?php echo urlencode($param->filter); ?>" method="post">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
<?php include "$CFG->dirroot/$param->filter/filterconfig.html"; ?>
<center>
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
</div>
</center>
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
print_simple_box_end();
print_footer();
?>
+272 -40
View File
@@ -1,73 +1,142 @@
<?php // $Id$
// filters.php
// Edit list of available text filters
require_once('../config.php');
require_once($CFG->libdir.'/tablelib.php');
$action = optional_param('action', '', PARAM_ACTION);
$filterpath = optional_param('filterpath', '', PARAM_PATH);
// defines
define('FILTER_TABLE','filter_administration_table');
// check for allowed access
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
if (!confirm_sesskey()) {
redirect($returnurl);
if (!isadmin()) {
error('Only administrators can use the filters administration page');
}
if (!$site = get_site()) {
error('Site is not defined in filters administration page');
}
// get a list of installed filters
// get values from page
$params = new object();
$params->action = optional_param('action', '', PARAM_ACTION);
$params->filterpath = optional_param('filterpath', '', PARAM_PATH);
$params->cachetext = optional_param('cachetext', 0, PARAM_INT);
$params->filterall = optional_param('filterall', 0, PARAM_BOOL);
$params->filteruploadedfiles = optional_param('filteruploadedfiles', 0, PARAM_INT);
$params->filtermatchoneperpage = optional_param('filtermatchoneperpage', 0, PARAM_BOOL);
$params->filtermatchonepertext = optional_param('filtermatchonepertext', 0, PARAM_BOOL);
// some basic information
$url = 'filters.php';
$myurl = "$url?sesskey=" . sesskey();
$img = "$CFG->pixpath/t";
// get translated strings for use on page
$txt = new object();
$txt->managefilters = get_string('managefilters');
$txt->administration = get_string('administration');
$txt->configuration = get_string('configuration');
$txt->name = get_string('name');
$txt->hide = get_string('hide');
$txt->show = get_string('show');
$txt->hideshow = "$txt->hide/$txt->show";
$txt->settings = get_string('settings');
$txt->up = get_string('up');
$txt->down = get_string('down');
$txt->updown = "$txt->up/$txt->down";
$txt->cachetext = get_string('cachetext', 'admin');
$txt->configcachetext = get_string('configcachetext', 'admin');
$txt->filteruploadedfiles = get_string('filteruploadedfiles','admin');
$txt->configfilteruploadedfiles = get_string('configfilteruploadedfiles','admin');
$txt->filterall = get_string('filterall','admin');
$txt->filtermatchoneperpage = get_string('filtermatchoneperpage','admin');
$txt->filtermatchonepertext = get_string('filtermatchonepertext','admin');
$txt->configfilterall = get_string('configfilterall','admin');
$txt->configfiltermatchoneperpage = get_string('configfiltermatchoneperpage','admin');
$txt->configfiltermatchonepertext = get_string('configfiltermatchonepertext','admin');
$txt->cachecontrols = get_string('cachecontrols');
$txt->yes = get_string('yes');
$txt->no = get_string('no');
$txt->none = get_string('none');
$txt->allfiles = get_string('allfiles');
$txt->htmlfilesonly = get_string('htmlfilesonly');
// get a list of possible filters (and translate name if possible)
// note filters can be in the dedicated filters area OR in their
// associated modules
$installedfilters = array();
$filtersettings = array();
$filterlocations = array('mod','filter');
foreach ($filterlocations as $filterlocation) {
$plugins = get_list_of_plugins($filterlocation);
foreach ($plugins as $plugin) {
$pluginpath = "$CFG->dirroot/$filterlocation/$plugin/filter.php";
$settingspath = "$CFG->dirroot/$filterlocation/$plugin/filterconfig.html";
if (is_readable($pluginpath)) {
$installedfilters["$filterlocation/$plugin"] = "$filterlocation/$plugin";
$name = trim(get_string("filtername", $plugin));
if (empty($name) or ($name == '[[filtername]]')) {
$name = ucfirst($plugin);
}
$installedfilters["$filterlocation/$plugin"] = $name;
if (is_readable($settingspath)) {
$filtersettings[] = "$filterlocation/$plugin";
}
}
}
}
// get all the currently selected filters
if (!empty($CFG->textfilters)) {
$activefilters = explode(',', $CFG->textfilters);
$oldactivefilters = explode(',', $CFG->textfilters);
$oldactivefilters = array_unique($oldactivefilters);
} else {
$activefilters = array();
$oldactivefilters = array();
}
// take this opportunity to clean up filters
$activefilters = array();
foreach ($oldactivefilters as $oldactivefilter) {
if (!empty($oldactivefilter) and array_key_exists($oldactivefilter, $installedfilters)) {
$activefilters[] = $oldactivefilter;
}
}
//======================
// Process Actions
//======================
switch ($action) {
case 'hide':
$key=array_search($filterpath, $activefilters);
if ($params->action=="") {
// store cleaned active filers in db
set_config('textfilters', implode(',', $activefilters));
} elseif (($params->action=="hide") and confirm_sesskey()) {
$key=array_search($params->filterpath, $activefilters);
// check filterpath is valid
if ($key===false) {
break;
// ignore it - doubleclick??
} else {
// just delete it
unset($activefilters[$key]);
set_config('textfilters', implode(',', $activefilters));
}
// just delete it
unset($activefilters[$key]);
break;
case 'show':
} elseif (($params->action=="show") and confirm_sesskey()) {
// check filterpath is valid
if (!array_key_exists($filterpath, $installedfilters)) {
error("Filter $filterpath is not currently installed", $url);
} elseif (array_search($filterpath,$activefilters)) {
if (!array_key_exists($params->filterpath, $installedfilters)) {
error("Filter $params->filterpath is not currently installed", $url);
} elseif (array_search($params->filterpath,$activefilters)) {
// filterpath is already active - doubleclick??
} else {
// add it to installed filters
$activefilters[] = $filterpath;
$activefilters[] = $params->filterpath;
$activefilters = array_unique($activefilters);
set_config('textfilters', implode(',', $activefilters));
}
break;
case 'down':
$key=array_search($filterpath, $activefilters);
} elseif (($params->action=="down") and confirm_sesskey()) {
$key=array_search($params->filterpath, $activefilters);
// check filterpath is valid
if ($key===false) {
error("Filter $filterpath is not currently active", $url);
error("Filter $params->filterpath is not currently active", $url);
} elseif ($key>=(count($activefilters)-1)) {
// cannot be moved any further down - doubleclick??
} else {
@@ -75,14 +144,13 @@
$fsave = $activefilters[$key];
$activefilters[$key] = $activefilters[$key+1];
$activefilters[$key+1] = $fsave;
set_config('textfilters', implode(',', $activefilters));
}
break;
case 'up':
$key=array_search($filterpath, $activefilters);
} elseif (($params->action=="up") and confirm_sesskey()) {
$key=array_search($params->filterpath, $activefilters);
// check filterpath is valid
if ($key===false) {
error("Filter $filterpath is not currently active", $url);
error("Filter $params->filterpath is not currently active", $url);
} elseif ($key<1) {
//cannot be moved any further up - doubleclick??
} else {
@@ -90,13 +158,177 @@
$fsave = $activefilters[$key];
$activefilters[$key] = $activefilters[$key-1];
$activefilters[$key-1] = $fsave;
set_config('textfilters', implode(',', $activefilters));
}
break;
} elseif (($params->action=="config") and confirm_sesskey()) {
set_config('cachetext', $params->cachetext);
set_config('filteruploadedfiles', $params->filteruploadedfiles);
set_config('filterall', $params->filterall);
set_config('filtermatchoneperpage', $params->filtermatchoneperpage);
set_config('filtermatchonepertext', $params->filtermatchonepertext);
}
// save, reset cache and return
set_config('textfilters', implode(',', $activefilters));
reset_text_filters_cache();
redirect($returnurl);
//======================
// Build Display Objects
//======================
// construct the display array with installed filters
// at the top in the right order
$displayfilters = array();
foreach ($activefilters as $activefilter) {
$name = $installedfilters[$activefilter];
$displayfilters[$activefilter] = $name;
}
foreach ($installedfilters as $key => $filter) {
if (!array_key_exists($key, $displayfilters)) {
$displayfilters[$key] = $filter;
}
}
// construct the flexible table ready to display
$table = new flexible_table(FILTER_TABLE);
$table->define_columns(array('name', 'hideshow', 'order', 'settings'));
$table->column_style('hideshow', 'text-align', 'center');
$table->column_style('order', 'text-align', 'center');
$table->column_style('settings', 'text-align', 'center');
$table->define_headers(array($txt->name, $txt->hideshow, $txt->updown, $txt->settings));
$table->define_baseurl("$CFG->wwwroot/$CFG->admin/filters.php");
$table->set_attribute('id', 'blocks');
$table->set_attribute('class', 'flexible generaltable generalbox');
$table->set_attribute('style', 'margin:auto;');
$table->set_attribute('cellpadding', '5');
$table->setup();
// iterate through filters adding to display table
$updowncount = 1;
$activefilterscount = count($activefilters);
foreach ($displayfilters as $path => $name) {
$upath = urlencode($path);
// get hide/show link
if (in_array($path, $activefilters)) {
$hideshow = "<a href=\"$myurl&amp;action=hide&amp;filterpath=$upath\">";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" height=\"16\" width=\"16\" alt=\"hide\" /></a>";
$hidden = false;
$displayname = "<span>$name</span>";
}
else {
$hideshow = "<a href=\"$myurl&amp;action=show&amp;filterpath=$upath\">";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" height=\"16\" width=\"16\" alt=\"show\" /></a>";
$hidden = true;
$displayname = "<span class=\"dimmed_text\">$name</span>";
}
// get up/down link (only if not hidden)
$updown = '';
if (!$hidden) {
if ($updowncount>1) {
$updown .= "<a href=\"$myurl&amp;action=up&amp;filterpath=$upath\">";
$updown .= "<img src=\"$img/up.gif\" alt=\"up\" /></a>&nbsp;";
}
else {
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" height=\"16\" width=\"16\" alt=\"\" />&nbsp;";
}
if ($updowncount<$activefilterscount) {
$updown .= "<a href=\"$myurl&amp;action=down&amp;filterpath=$upath\">";
$updown .= "<img src=\"$img/down.gif\" alt=\"down\" /></a>";
}
else {
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" height=\"16\" width=\"16\" alt=\"\" />";
}
++$updowncount;
}
// settings link (if defined)
$settings = '';
if (in_array($path, $filtersettings)) {
$settings = "<a href=\"filter.php?filter=" . urlencode($path) . "\">";
$settings .= "{$txt->settings}</a>";
}
// write data into the table object
$table->add_data(array($displayname, $hideshow, $updown, $settings));
}
// build options list for cache lifetime
$seconds = array(604800,86400,43200,10800,7200,3600,2700,1800,900,600,540,480,420,360,300,240,180,120,60,30,0);
unset($lifetimeoptions);
foreach ($seconds as $second) {
if ($second>=86400) {
$options[$second] = get_string('numdays','',$second/86400);
}
elseif ($second>=3600) {
$options[$second] = get_string('numhours','',$second/3600);
}
elseif ($second>=60) {
$options[$second] = get_string('numminutes','',$second/60);
}
elseif ($second>=1) {
$options[$second] = get_string('numseconds','',$second);
}
else {
$options[$second] = get_string('no');
}
}
//==============================
// Display logic
//==============================
print_header("$site->shortname: $txt->managefilters", "$site->fullname",
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
"-> $txt->managefilters");
print_heading_with_help($txt->managefilters, 'filters');
// print the table of all the filters
$table->print_html();
// print the table for the cache controls
print_heading($txt->cachecontrols);
print_simple_box_start('center');
?>
<form name="options" id="options" method="post" action="<?php echo $url; ?>" >
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<input type="hidden" name="action" value="config" />
<table cellpadding="20">
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->cachetext; ?></td>
<td><?php choose_from_menu($options, "cachetext", $CFG->cachetext, "", "", ""); ?></td>
<td><?php echo $txt->configcachetext; ?></td>
</tr>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->filteruploadedfiles; ?></td>
<td><?php choose_from_menu(array($txt->none,$txt->allfiles,$txt->htmlfilesonly),
"filteruploadedfiles", $CFG->filteruploadedfiles,"","",""); ?></td>
<td><?php echo $txt->configfilteruploadedfiles; ?></td>
</tr>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->filtermatchoneperpage; ?></td>
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filtermatchoneperpage", $CFG->filtermatchoneperpage,"","",""); ?></td>
<td><?php echo $txt->configfiltermatchoneperpage; ?></td>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->filtermatchonepertext; ?></td>
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filtermatchonepertext", $CFG->filtermatchonepertext,"","",""); ?></td>
<td><?php echo $txt->configfiltermatchonepertext; ?></td>
</tr>
</tr>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->filterall; ?></td>
<td><?php choose_from_menu(array($txt->no,$txt->yes), "filterall", $CFG->filterall,"","",""); ?></td>
<td><?php echo $txt->configfilterall; ?></td>
</tr>
<tr valign="top">
<td>&nbsp;</td>
<td><input type="submit" value="<?php print_string('savechanges'); ?>" /></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
<?php
print_simple_box_end();
print_footer();
?>
+2 -2
View File
@@ -40,7 +40,7 @@ while(!feof($fd)) {
$user = get_record("user","id",$log->userid);
$course = get_record("course","id",$log->course);
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
$subject = get_string('virusfoundsubject','moodle',$site->fullname);
$a->date = userdate($log->time);
$a->action = $action;
@@ -78,7 +78,7 @@ function notify_admins_unknown($file,$a) {
global $site;
$admins = get_admins();
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
$subject = get_string('virusfoundsubject','moodle',$site->fullname);
$body = get_string('virusfoundlateradminnolog','moodle',$a);
foreach ($admins as $admin) {
email_to_user($admin,$admin,$subject,$body);
+20 -17
View File
@@ -3,19 +3,15 @@
ob_start(); //for whitespace test
require_once('../config.php');
// extra whitespace test - intentionally breaks cookieless mode
$extraws = '';
// extra whitespace test - intentionally breaks cookieless mode
$extraws = '';
while (true) {
$extraws .= ob_get_contents();
if (!@ob_end_clean()) {
if (!@ob_end_clean()) { //
break;
}
}
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('healthcenter');
define('SEVERITY_NOTICE', 'notice');
define('SEVERITY_ANNOYANCE', 'annoyance');
define('SEVERITY_SIGNIFICANT', 'significant');
@@ -24,11 +20,18 @@
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
if (!isadmin()) {
error('Only the admin can use this page');
}
$site = get_site();
$stradmin = get_string('administration');
$strhealthcenter = get_string('healthcenter');
$strmisc = get_string('miscellaneous');
admin_externalpage_print_header();
print_header($site->shortname.': '.$strhealthcenter, $site->fullname,
'<a href="index.php">'.$stradmin.'</a> -> <a href="misc.php">'.$strmisc.'</a> ->'.
$strhealthcenter);
echo <<<STYLES
<style type="text/css">
@@ -100,7 +103,7 @@ STYLES;
}
admin_externalpage_print_footer();
print_footer();
function health_find_problems() {
@@ -418,7 +421,7 @@ class problem_000010 extends problem_base {
}
function exists() {
if (!$this->is_enabled()) {
return true;
return true;
}
if ($this->status() < 1) {
return true;
@@ -428,7 +431,7 @@ class problem_000010 extends problem_base {
function severity() {
if ($this->is_enabled() and $this->status() == 0) {
return SEVERITY_SIGNIFICANT;
} else {
} else {
return SEVERITY_ANNOYANCE;
}
}
@@ -436,9 +439,9 @@ class problem_000010 extends problem_base {
global $CFG;
$desc = 'Slasharguments are needed for relative linking in uploaded resources:<ul>';
if (!$this->is_enabled()) {
$desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
$desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
} else {
$desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
$desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
}
if ($this->status() == -1) {
$desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a> manually</li>';
@@ -469,9 +472,9 @@ class problem_000010 extends problem_base {
$solution .= 'Congratulations - everything seems OK now :-D';
}
if ($status < 1) {
$solution .= '<p>IIS:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li><li>do NOT enable AllowPathInfoForScriptMappings !!!</li><li>slasharguments may not work when using ISAPI and PHP 4.3.10 and older</li></ul></p>';
$solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>Apache 2:<ul><li>you must add <code>AcceptPathInfo on</code> to php.ini or .htaccess</li><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>IIS:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li><li>do NOT enable AllowPathInfoForScriptMappings !!!</li><li>slasharguments may not work when using ISAPI and PHP 4.3.10 and older</li></ul></p>';
$solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>Apache 2:<ul><li>you must add <code>AcceptPathInfo on</code> to php.ini or .htaccess</li><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
}
return $solution;
}
+255 -436
View File
@@ -22,32 +22,16 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php'); // Contains various admin-only functions
require_once($CFG->libdir.'/ddllib.php'); // Install/upgrade related db functions
require_once($CFG->libdir.'/db/upgradelib.php'); // Upgrade-related functions
include_once($CFG->dirroot.'/lib/adminlib.php'); // Contains various admin-only functions
$id = optional_param('id', '', PARAM_TEXT);
$id = optional_param('id', '', PARAM_ALPHANUM);
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
$confirmplugincheck = optional_param('confirmplugincheck', 0, PARAM_BOOL);
$agreelicence = optional_param('agreelicence',0, PARAM_BOOL);
/// check upgrade status first
if ($ignoreupgradewarning and !empty($_SESSION['upgraderunning'])) {
$_SESSION['upgraderunning'] = 0;
}
upgrade_check_running("Upgrade already running in this session, please wait!<br />Click on the exclamation marks to ignore this warning (<a href=\"index.php?ignoreupgradewarning=1\">!!!</a>).", 10);
/// set install/upgrade autocontinue session flag
if ($autopilot) {
$_SESSION['installautopilot'] = $autopilot;
}
/// Check some PHP server settings
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
$documentationlink = "please read the <a href=\"../doc/?frame=install.html&amp;sub=webserver\">install documentation</a>";
if (ini_get_bool('session.auto_start')) {
error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
@@ -61,13 +45,6 @@
error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
}
if (empty($CFG->prefix) && $CFG->dbfamily != 'mysql') { //Enforce prefixes for everybody but mysql
error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')');
}
if ($CFG->dbfamily == 'oracle' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc
error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.');
}
/// Check that config.php has been edited
@@ -99,14 +76,6 @@
$CFG->version = "";
}
if (is_readable("$CFG->dirroot/version.php")) {
include_once("$CFG->dirroot/version.php"); # defines $version
}
if (!$version or !$release) {
error('Main version.php was not readable or specified');# without version, stop
}
/// Check if the main tables have been installed yet or not.
if (! $tables = $db->Metatables() ) { // No tables yet at all.
@@ -116,7 +85,7 @@
$maintables = true;
$mtables = array("config", "course", "course_categories", "course_modules",
"course_sections", "log", "log_display", "modules",
"user");
"user", "user_admins", "user_students", "user_teachers");
foreach ($mtables as $mtable) {
if (!in_array($CFG->prefix.$mtable, $tables)) {
$maintables = false;
@@ -124,110 +93,38 @@
}
}
}
if (! $maintables) {
/// hide errors from headers in case debug enabled in config.php
$origdebug = $CFG->debug;
$CFG->debug = DEBUG_MINIMAL;
error_reporting($CFG->debug);
if (empty($agreelicense)) {
$strlicense = get_string('license');
$navigation = build_navigation(array(array('name'=>$strlicense, 'link'=>null, 'type'=>'misc')));
print_header($strlicense, $strlicense, $navigation, "", "", false, "&nbsp;", "&nbsp;");
if (empty($agreelicence)) {
$strlicense = get_string("license");
print_header($strlicense, $strlicense, $strlicense, "", "", false, "&nbsp;", "&nbsp;");
print_heading("<a href=\"http://moodle.org\">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment");
print_heading(get_string('copyrightnotice'));
print_box(text_to_html(get_string('gpl')), 'copyrightnotice');
print_heading(get_string("copyrightnotice"));
print_simple_box_start('center');
echo text_to_html(get_string("gpl"));
print_simple_box_end();
echo "<br />";
notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1",
notice_yesno(get_string("doyouagree"), "index.php?agreelicence=true",
"http://docs.moodle.org/en/License");
print_footer('none');
exit;
}
if (empty($confirmrelease)) {
$strcurrentrelease = get_string("currentrelease");
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
echo '<form action="index.php"><div>';
echo '<input type="hidden" name="agreelicense" value="1" />';
echo '<input type="hidden" name="confirmrelease" value="1" />';
echo '</div>';
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
echo '</form>';
print_footer('none');
die;
}
$strdatabasesetup = get_string("databasesetup");
$strdatabasesuccess = get_string("databasesuccess");
$navigation = build_navigation(array(array('name'=>$strdatabasesetup, 'link'=>null, 'type'=>'misc')));
print_header($strdatabasesetup, $strdatabasesetup, $navigation,
"", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
/// return to original debugging level
$CFG->debug = $origdebug;
error_reporting($CFG->debug);
upgrade_log_start();
$db->debug = true;
/// Both old .sql files and new install.xml are supported
/// But we prioritise install.xml (XMLDB) if present
change_db_encoding(); // first try to change db encoding to utf8
if (!setup_is_unicodedb()) {
// If could not convert successfully, throw error, and prevent installation
print_error('unicoderequired', 'admin');
}
$status = false;
if (file_exists("$CFG->libdir/db/install.xml")) {
$status = install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
} else if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
$status = modify_database("$CFG->libdir/db/$CFG->dbtype.sql"); //Old method
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup, "", "", false, "&nbsp;", "&nbsp;");
if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
$db->debug = true;
if (modify_database("$CFG->libdir/db/$CFG->dbtype.sql")) {
$db->debug = false;
notify($strdatabasesuccess, "green");
} else {
$db->debug = false;
error("Error: Main databases NOT set up successfully");
}
} else {
error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.");
error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle. See the lib/db directory.");
}
// all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
set_config('unicodedb', 1);
/// Continue with the instalation
$db->debug = false;
if ($status) {
/// Groups install is now in core above.
// Install the roles system.
moodle_install_roles();
set_config('statsrolesupgraded',time());
// install core event handlers
events_update_definition();
/// This is used to handle any settings that must exist in $CFG but which do not exist in
/// admin_get_root()/$ADMIN as admin_setting objects (there are some exceptions).
apply_default_exception_settings(array('auth' => 'email',
'auth_pop3mailbox' => 'INBOX',
'enrol' => 'manual',
'enrol_plugins_enabled' => 'manual',
'style' => 'default',
'template' => 'default',
'theme' => 'standardwhite',
'filter_multilang_converted' => 1));
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
// (this should only have any effect during initial install).
admin_apply_default_settings(NULL, true);
notify($strdatabasesuccess, "green");
require_once $CFG->dirroot.'/mnet/lib.php';
} else {
error("Error: Main databases NOT set up successfully");
}
print_continue('index.php');
print_footer('none');
print_continue("index.php");
die;
}
@@ -235,343 +132,163 @@
/// Check version of Moodle code on disk compared with database
/// and upgrade if possible.
if (file_exists("$CFG->dirroot/lib/db/$CFG->dbtype.php")) {
include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines old upgrades
}
if (file_exists("$CFG->dirroot/lib/db/upgrade.php")) {
include_once("$CFG->dirroot/lib/db/upgrade.php"); # defines new upgrades
}
include_once("$CFG->dirroot/version.php"); # defines $version
include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines upgrades
$stradministration = get_string("administration");
if ($CFG->version) {
if ($version > $CFG->version) { // upgrade
/// If the database is not already Unicode then we do not allow upgrading!
/// Instead, we print an error telling them to upgrade to 1.7 first. MDL-6857
if (empty($CFG->unicodedb)) {
print_error('unicodeupgradeerror', 'error', '', $version);
}
$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";
$strdatabasechecking = get_string("databasechecking", "", $a);
// hide errors from headers in case debug is enabled
$origdebug = $CFG->debug;
$CFG->debug = DEBUG_MINIMAL;
error_reporting($CFG->debug);
// logo ut in case we are upgrading from pre 1.9 version in order to prevent
// weird session/role problems caused by incorrect data in USER and SESSION
if ($CFG->version < 2007101500) {
require_logout();
}
if (empty($confirmupgrade)) {
$navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
print_header($strdatabasechecking, $stradministration, $navigation,
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
"", "", false, "&nbsp;", "&nbsp;");
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
print_footer('none');
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
exit;
} else if (empty($confirmrelease)){
$strcurrentrelease = get_string("currentrelease");
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
require_once($CFG->libdir.'/environmentlib.php');
print_heading(get_string('environment', 'admin'));
if (!check_moodle_environment($release, $environment_results, true)) {
print_box_start('generalbox', 'notice'); // MDL-8330
print_string('langpackwillbeupdated', 'admin');
print_box_end();
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
} else {
notify(get_string('environmentok', 'admin'), 'notifysuccess');
print_box_start('generalbox', 'notice'); // MDL-8330
print_string('langpackwillbeupdated', 'admin');
print_box_end();
echo '<form action="index.php"><div>';
echo '<input type="hidden" name="confirmupgrade" value="1" />';
echo '<input type="hidden" name="confirmrelease" value="1" />';
echo '</div>';
echo '<div class="continuebutton">';
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
echo '</form>';
}
print_footer('none');
die;
} elseif (empty($confirmplugincheck)) {
$strplugincheck = get_string('plugincheck');
$navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, "&nbsp;", "&nbsp;");
print_heading($strplugincheck);
print_box_start('generalbox', 'notice'); // MDL-8330
print_string('pluginchecknotice');
print_box_end();
print_plugin_tables();
echo "<br />";
echo '<div class="continuebutton">';
print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
echo '</div><br />';
echo '<form action="index.php"><div>';
echo '<input type="hidden" name="confirmupgrade" value="1" />';
echo '<input type="hidden" name="confirmrelease" value="1" />';
echo '<input type="hidden" name="confirmplugincheck" value="1" />';
echo '</div>';
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
echo '</form>';
print_footer('none');
die();
} else {
$strdatabasesuccess = get_string("databasesuccess");
$navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
print_header($strdatabasechecking, $stradministration, $navigation,
"", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
/// return to original debugging level
$CFG->debug = $origdebug;
error_reporting($CFG->debug);
upgrade_log_start();
/// Upgrade current language pack if we can
upgrade_language_pack();
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
"", "", false, "&nbsp;", "&nbsp;");
print_heading($strdatabasechecking);
$db->debug=true;
/// Launch the old main upgrade (if exists)
$status = true;
if (function_exists('main_upgrade')) {
$status = main_upgrade($CFG->version);
}
/// If succesful and exists launch the new main upgrade (XMLDB), called xmldb_main_upgrade
if ($status && function_exists('xmldb_main_upgrade')) {
$status = xmldb_main_upgrade($CFG->version);
}
$db->debug=false;
/// If successful, continue upgrading roles and setting everything properly
if ($status) {
if (empty($CFG->rolesactive)) {
/// Groups upgrade is now in core above.
// Upgrade to the roles system.
moodle_install_roles();
set_config('rolesactive', 1);
} else if (!update_capabilities()) {
error('Had trouble upgrading the core capabilities for the Roles System');
}
// update core events
events_update_definition();
require_once($CFG->libdir.'/statslib.php');
if (!stats_upgrade_for_roles_wrapper()) {
notify('Couldn\'t upgrade the stats tables to use the new roles system');
}
if (main_upgrade($CFG->version)) {
$db->debug=false;
if (set_config("version", $version)) {
remove_dir($CFG->dataroot . '/cache', true); // flush cache
notify($strdatabasesuccess, "green");
print_continue("upgradesettings.php");
print_footer('none');
print_continue("index.php");
exit;
} else {
error('Upgrade failed! (Could not update version in config table)');
notify("Upgrade failed! (Could not update version in config table)");
}
/// Main upgrade not success
} else {
notify('Main Upgrade failed! See lib/db/upgrade.php');
print_continue('index.php?confirmupgrade=1&amp;confirmrelease=1&amp;confirmplugincheck=1');
print_footer('none');
die;
$db->debug=false;
notify("Upgrade failed! See /version.php");
}
upgrade_log_finish();
}
} else if ($version < $CFG->version) {
upgrade_log_start();
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
upgrade_log_finish();
}
} else {
$strcurrentversion = get_string("currentversion");
print_header($strcurrentversion, $stradministration, $strcurrentversion,
"", "", false, "&nbsp;", "&nbsp;");
if (!set_config("version", $version)) {
error("A problem occurred inserting current version into databases");
$db->debug=true;
if (main_upgrade(0)) {
print_continue("index.php");
} else {
error("A problem occurred inserting current version into databases");
}
$db->debug=false;
}
}
/// Updated human-readable release version if necessary
if ($release <> $CFG->release) { // Update the release version
$strcurrentrelease = get_string("currentrelease");
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
if (!set_config("release", $release)) {
error("ERROR: Could not update release version in database!!");
notify("ERROR: Could not update release version in database!!");
}
notice(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'index.php');
exit;
}
/// Insert default values for any important configuration variables
include_once("$CFG->dirroot/lib/defaults.php");
foreach ($defaults as $name => $value) {
if (!isset($CFG->$name)) {
$CFG->$name = $value;
set_config($name, $value);
$configchange = true;
}
}
/// Groups install/upgrade is now in core above.
/// Send $CFG->unicodedb to DB to have it available for next requests
set_config('unicodedb', $CFG->unicodedb);
/// If any new configurations were found then send to the config page to check
if (!empty($configchange)) {
redirect("config.php?installing=1");
}
/// Find and check all main modules and load them up or upgrade them if necessary
/// first old *.php update and then the new upgrade.php script
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Check all questiontype plugins and upgrade if necessary
/// first old *.php update and then the new upgrade.php script
/// It is important that this is done AFTER the quiz module has been upgraded
// It is important that this is done AFTER the quiz module has been upgraded
upgrade_plugins('qtype', 'question/type', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Upgrade backup/restore system if necessary
/// first old *.php update and then the new upgrade.php script
require_once("$CFG->dirroot/backup/lib.php");
upgrade_backup_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Upgrade blocks system if necessary
/// first old *.php update and then the new upgrade.php script
require_once("$CFG->dirroot/lib/blocklib.php");
upgrade_blocks_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Check all blocks and load (or upgrade them if necessary)
/// first old *.php update and then the new upgrade.php script
upgrade_blocks_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Check all enrolment plugins and upgrade if necessary
/// first old *.php update and then the new upgrade.php script
upgrade_plugins('enrol', 'enrol', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Check all auth plugins and upgrade if necessary
upgrade_plugins('auth','auth',"$CFG->wwwroot/$CFG->admin/index.php");
/// Check all course formats and upgrade if necessary
upgrade_plugins('format','course/format',"$CFG->wwwroot/$CFG->admin/index.php");
/// Check for local database customisations
/// first old *.php update and then the new upgrade.php script
require_once("$CFG->dirroot/lib/locallib.php");
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Check for changes to RPC functions
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
upgrade_RPC_functions("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Upgrade all plugins for gradebook
upgrade_plugins('gradeexport', 'grade/export', "$CFG->wwwroot/$CFG->admin/index.php");
upgrade_plugins('gradeimport', 'grade/import', "$CFG->wwwroot/$CFG->admin/index.php");
upgrade_plugins('gradereport', 'grade/report', "$CFG->wwwroot/$CFG->admin/index.php");
/// Check all message output plugins and upgrade if necessary
upgrade_plugins('message','message/output',"$CFG->wwwroot/$CFG->admin/index.php");
/// Check all admin report plugins and upgrade if necessary
upgrade_plugins('report', $CFG->admin.'/report', "$CFG->wwwroot/$CFG->admin/index.php");
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
unset($_SESSION['installautopilot']);
/// Set up the blank site - to be customized later at the end of install.
/// Set up the overall site name etc.
if (! $site = get_site()) {
// We are about to create the site "course"
require_once($CFG->libdir.'/blocklib.php');
$newsite = new object();
$newsite->fullname = "";
$newsite->shortname = "";
$newsite->summary = NULL;
$newsite->newsitems = 3;
$newsite->numsections = 0;
$newsite->category = 0;
$newsite->format = 'site'; // Only for this course
$newsite->teacher = get_string("defaultcourseteacher");
$newsite->teachers = get_string("defaultcourseteachers");
$newsite->student = get_string("defaultcoursestudent");
$newsite->students = get_string("defaultcoursestudents");
$newsite->timemodified = time();
if (!$newid = insert_record('course', $newsite)) {
error("Serious Error! Could not set up the site!");
}
// make sure course context exists
get_context_instance(CONTEXT_COURSE, $newid);
// Site created, add blocks for it
$page = page_create_object(PAGE_COURSE_VIEW, $newid);
blocks_repopulate_page($page); // Return value not checked because you can always edit later
$cat = new object();
$cat->name = get_string('miscellaneous');
$cat->depth = 1;
if (!$catid = insert_record('course_categories', $cat)) {
error("Serious Error! Could not set up a default course category!");
}
// make sure category context exists
get_context_instance(CONTEXT_COURSECAT, $catid);
mark_context_dirty('/'.SYSCONTEXTID);
redirect('index.php');
}
// initialise default blocks on admin and site page if needed
if (empty($CFG->adminblocks_initialised)) {
require_once("$CFG->dirroot/$CFG->admin/pagelib.php");
require_once($CFG->libdir.'/blocklib.php');
page_map_class(PAGE_ADMIN, 'page_admin');
$page = page_create_object(PAGE_ADMIN, 0); // there must be some id number
blocks_repopulate_page($page);
//add admin_tree block to site if not already present
if ($admintree = get_record('block', 'name', 'admin_tree')) {
$page = page_create_object(PAGE_COURSE_VIEW, SITEID);
$pageblocks=blocks_get_by_page($page);
blocks_execute_action($page, $pageblocks, 'add', (int)$admintree->id, false, false);
if ($admintreeinstance = get_record('block_instance', 'pagetype', $page->type, 'pageid', SITEID, 'blockid', $admintree->id)) {
$pageblocks=blocks_get_by_page($page); // Needs to be re-got, since has just changed
blocks_execute_action($page, $pageblocks, 'moveleft', $admintreeinstance, false, false);
}
}
set_config('adminblocks_initialised', 1);
redirect("site.php");
}
/// Define the unique site ID code if it isn't already
if (empty($CFG->siteidentifier)) { // Unique site identification code
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
set_config('siteidentifier', random_string(32));
}
/// Check if the guest user exists. If not, create one.
if (! record_exists("user", "username", "guest")) {
if (! $guest = create_guest_record()) {
$guest->auth = "manual";
$guest->username = "guest";
$guest->password = md5("guest");
$guest->firstname = addslashes(get_string("guestuser"));
$guest->lastname = " ";
$guest->email = "root@localhost";
$guest->description = addslashes(get_string("guestuserinfo"));
$guest->confirmed = 1;
$guest->lang = $CFG->lang;
$guest->timemodified= time();
if (! $guest->id = insert_record("user", $guest)) {
notify("Could not create guest user record !!!");
}
}
/// Set up the admin user
if (empty($CFG->rolesactive)) {
build_context_path(); // just in case - should not be needed
create_admin_user();
if (! record_exists("user_admins")) { // No admin user yet
redirect("user.php");
}
/// Check for valid admin user - no guest autologin
require_login(0, false);
/// Check for valid admin user
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
/// check that site is properly customized
if (empty($site->shortname)) {
// probably new installation - lets return to frontpage after this step
// remove settings that we want uninitialised
unset_config('registerauth');
redirect('upgradesettings.php?return=site');
if (!isadmin()) {
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
/// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
@@ -582,47 +299,32 @@
}
}
$adminroot =& admin_get_root();
/// At this point everything is set up and the user is an admin, so print menu
/// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)){
redirect('upgradesettings.php');
}
/// Everything should now be set up, and the user is an admin
/// Print default admin page with notifications.
admin_externalpage_setup('adminnotifications');
admin_externalpage_print_header();
$stradministration = get_string("administration");
print_header("$site->shortname: $stradministration","$site->fullname", "$stradministration");
print_simple_box_start('center', '100%', '', 20);
print_heading($stradministration);
/// Deprecated database! Warning!!
if (!empty($CFG->migrated_to_new_db)) {
print_box(print_string('dbmigrationdeprecateddb', 'admin'), 'generalbox adminwarning');
print_simple_box_start('center','60%');
print_string('dbmigrationdeprecateddb','admin');
print_simple_box_end();
}
/// Check for any special upgrades that might need to be run
if (!empty($CFG->upgrade)) {
print_box(get_string("upgrade$CFG->upgrade", "admin", "$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"));
if (!empty($CFG->upgrade)) { // Print notice about extra upgrading that needs to be done
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center", '60%');
print_spacer(10,10);
}
if (ini_get_bool('register_globals')) {
print_box(get_string('globalswarning', 'admin'), 'generalbox adminwarning');
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
print_simple_box(get_string('globalsquoteswarning', 'admin'), 'center', '60%');
}
if (is_dataroot_insecure()) {
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
}
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
print_box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
}
if (substr($CFG->wwwroot, -1) == '/') {
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
}
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
print_simple_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'center', '60%');
}
/// If no recently cron run
@@ -630,44 +332,161 @@
if (time() - $lastcron > 3600 * 24) {
$strinstallation = get_string('installation', 'install');
$helpbutton = helpbutton('install', $strinstallation, 'moodle', true, false, '', true);
print_box(get_string('cronwarning', 'admin')."&nbsp;".$helpbutton, 'generalbox adminwarning');
}
/// Print multilang upgrade notice if needed
if (empty($CFG->filter_multilang_converted)) {
print_box(get_string('multilangupgradenotice', 'admin'), 'generalbox adminwarning');
print_simple_box(get_string('cronwarning', 'admin')."&nbsp;".$helpbutton, 'center', '60%');
}
/// Alert if we are currently in maintenance mode
if (file_exists($CFG->dataroot.'/1/maintenance.html')) {
print_box(get_string('sitemaintenancewarning', 'admin'), 'generalbox adminwarning');
print_simple_box(get_string('sitemaintenancewarning', 'admin') , 'center', '60%');
}
/// Alert if we are currently in maintenance mode
if (empty($CFG->unicodedb)) {
print_simple_box(get_string('unicodeupgradenotice', 'admin') , 'center', '60%');
}
/// Print slightly annoying registration button every six months ;-)
/// You can set the "registered" variable to something far in the future
/// if you really want to prevent this. eg 9999999999
if (!isset($CFG->registered) || $CFG->registered < (time() - 3600*24*30*6)) {
$options = array();
$options['sesskey'] = $USER->sesskey;
print_simple_box_start('center','60%');
echo '<div align="center">';
print_string('pleaseregister', 'admin');
print_single_button('register.php', $options, get_string('registration'));
echo '</div>';
print_simple_box_end();
}
$table->tablealign = "center";
$table->align = array ("right", "left");
$table->wrap = array ("nowrap", "nowrap");
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '40%';
$configdata = '<div class="adminlink"><a href="config.php">'.get_string('configvariables', 'admin').
'</a> - <span class="explanation">'.get_string('adminhelpconfigvariables').'</span></div>';
$configdata .= '<div class="adminlink"><a href="site.php">'.get_string('sitesettings').
'</a> - <span class="explanation">'.get_string('adminhelpsitesettings').'</span></div>';
$configdata .= '<div class="adminlink"><a href="../theme/index.php">'.get_string('themes').
'</a> - <span class="explanation">'.get_string('adminhelpthemes').'</span></div>';
$configdata .= '<div class="adminlink"><a href="lang.php">'.get_string('language').
'</a> - <span class="explanation">'.get_string('adminhelplanguage').'</span></div>';
$configdata .= '<div class="adminlink"><a href="modules.php">'.get_string('managemodules').
'</a> - <span class="explanation">'.get_string('adminhelpmanagemodules').'</span></div>';
$configdata .= '<div class="adminlink"><a href="blocks.php">'.get_string('manageblocks').
'</a> - <span class="explanation">'.get_string('adminhelpmanageblocks').'</span></div>';
$configdata .= '<div class="adminlink"><a href="filters.php">'.get_string('managefilters').
'</a> - <span class="explanation">'.get_string('adminhelpmanagefilters').'</span></div>';
if (!isset($CFG->disablescheduledbackups)) {
$configdata .= '<div class="adminlink"><a href="backup.php">'.get_string('backup').
'</a> - <span class="explanation">'.get_string('adminhelpbackup').'</span></div>';
}
$configdata .= '<div class="adminlink"><a href="editor.php">'.get_string('editorsettings').
'</a> - <span class="explanation">'.get_string('adminhelpeditorsettings').'</span></div>';
$configdata .= '<div class="adminlink"><a href="calendar.php">'.get_string('calendarsettings', 'admin').
'</a> - <span class="explanation">'.get_string('helpcalendarsettings', 'admin').'</span></div>';
$configdata .= '<div class="adminlink"><a href="maintenance.php">'.get_string('sitemaintenancemode', 'admin').
'</a> - <span class="explanation">'.get_string('helpsitemaintenance', 'admin').'</span></div>';
$table->data[] = array('<strong><a href="configure.php">'.get_string('configuration').'</a></strong>', $configdata);
$userdata = '<div class="adminlink"><a href="auth.php?sesskey='.$USER->sesskey.'">'.get_string("authentication").
'</a> - <span class="explanation">'.get_string('adminhelpauthentication').'</span></div>';
$userdata .= '<div class="adminlink"><a href="user.php">'.get_string('edituser').
'</a> - <span class="explanation">'.get_string('adminhelpedituser').'</span></div>';
$userdata .= '<div class="adminlink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/user.php?newuser=true&amp;sesskey='.$USER->sesskey.'">'.
get_string('addnewuser').'</a> - <span class="explanation">'.get_string('adminhelpaddnewuser').'</span></div>';
$userdata .= '<div class="adminlink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/uploaduser.php?sesskey='.$USER->sesskey.'">'.
get_string('uploadusers').'</a> - <span class="explanation">'.get_string('adminhelpuploadusers').'</span></div>';
$table->data[] = array('<strong><a href="users.php">'.get_string('users').'</a></strong>', $userdata);
$coursedata = '<div class="adminlink"><a href="../course/index.php?edit=on&amp;sesskey='.$USER->sesskey.'">'.get_string('managecourses').
'</a> - <span class="explanation">'.get_string('adminhelpcourses').'</span></div>';
$coursedata .= '<div class="adminlink"><a href="enrol.php?sesskey='.$USER->sesskey.'">'.get_string('enrolmentplugins').
'</a> - <span class="explanation">'.get_string('adminhelpenrolments').'</span></div>';
$coursedata .= '<div class="adminlink"><a href="../course/index.php?edit=off&amp;sesskey='.$USER->sesskey.'">'.
get_string('assignstudents').'</a> - <span class="explanation">'.get_string('adminhelpassignstudents').'</span></div>';
$coursedata .= '<div class="adminlink"><a href="../course/index.php?edit=on&amp;sesskey='.$USER->sesskey.'">'.
get_string('assignteachers').'</a> - <span class="explanation">'.get_string('adminhelpassignteachers').
' <img src="../pix/t/user.gif" height="11" width="11" alt="" /></span></div>';
$coursedata .= '<div class="adminlink"><a href="creators.php?sesskey='.$USER->sesskey.'">'.get_string('assigncreators').
'</a> - <span class="explanation">'.get_string('adminhelpassigncreators').'</span></div>';
$coursedata .= '<div class="adminlink"><a href="admin.php?sesskey='.$USER->sesskey.'">'.get_string('assignadmins').
'</a> - <span class="explanation">'.get_string('adminhelpassignadmins').'</span></div>';
$table->data[] = array('<strong><a href="courses.php">'.get_string('courses').'</a></strong>', $coursedata);
$miscdata = '<div class="adminlink"><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').
'</a> - <span class="explanation">'.get_string('adminhelpsitefiles').'</span></div>';
$miscdata .= '<div class="adminlink"><a href="stickyblocks.php">'.get_string('stickyblocks','admin').
'</a> - <span class="explanation">'.get_string('adminhelpstickyblocks').'</span></div>';
$miscdata .= '<div class="adminlink"><a href="report.php">'.get_string('reports').
'</a> - <span class="explanation">'.get_string('adminhelpreports').'</span></div>';
//to be enabled later
/* $miscdata .= '<div class="adminlink"><a href="health.php">'.get_string('healthcenter').
'</a> - <span class="explanation">'.get_string('adminhelphealthcenter').'</span></div>';*/
$miscdata .= '<div class="adminlink"><a href="environment.php">'.get_string('environment', 'admin').
'</a> - <span class="explanation">'.get_string('adminhelpenvironment').'</span></div>';
/// Optional stuff
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
$miscdata .= '<div class="adminlink"><a href="'.$CFG->dbtype.'/frame.php">'.get_string('managedatabase').
'</a> - <span class="explanation">'.get_string('adminhelpmanagedatabase').'</span></div>';
}
$table->data[] = array('<strong><a href="misc.php">'.get_string('miscellaneous').'</a></strong>', $miscdata);
/// Hooks for Matt Oquists contrib code for repositories and portfolio.
/// The eventual official versions may not look like this
if (isset($CFG->portfolio) && file_exists("$CFG->dirroot/$CFG->portfolio")) {
$table->data[] = array("<strong><a href=\"../portfolio/\">".get_string('portfolio','portfolio').'</a></
trong>',
'<div class="explanation">'.get_string('adminhelpportfolio','portfolio').'</div>');
}
if (isset($CFG->repo) && file_exists("$CFG->dirroot/$CFG->repo")) {
$table->data[] = array("<strong><a href=\"../repository/?repoid=1&action=list\">".get_string('repository','
epository').'</a></strong>',
'<div class="explanation">'.get_string('adminhelprepository','repository').'</div>');
}
/// Print slightly annoying registration button
print_table($table);
//////////////////////////////////////////////////////////////////////////////////////////////////
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO REMOVE OR MODIFY THE COPYRIGHT NOTICE BELOW ////
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
'<a href="http://docs.moodle.org/en/Release">'.$CFG->release.'</a> ('.$CFG->version.')<br />'.
'Copyright &copy; 1999 onwards, Martin Dougiamas<br />'.
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
echo '<p class="copyright">'.$copyrighttext.'</p>';
//////////////////////////////////////////////////////////////////////////////////////////////////
echo '<div align="center">';
$options = array();
$options['sesskey'] = $USER->sesskey;
print_box_start('generalbox adminwarning');
if(!isset($CFG->registered)) {
print_string('pleaseregister', 'admin');
}
else { /* if (isset($CFG->registered) && $CFG->registered < (time() - 3600*24*30*6)) { */
print_string('pleaserefreshregistration', 'admin', userdate($CFG->registered));
}
print_single_button('register.php', $options, get_string('registration'));
print_box_end();
echo '</div>';
//////////////////////////////////////////////////////////////////////////////////////////////////
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
'<a href="http://docs.moodle.org/en/Release" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
'Copyright &copy; 1999 onwards, Martin Dougiamas<br />'.
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
print_box($copyrighttext, 'copyright');
//////////////////////////////////////////////////////////////////////////////////////////////////
print_simple_box_end();
admin_externalpage_print_footer();
if (optional_param('dbmigrate')) { // ??? Is this actually used?
print_simple_box_start('center','60%');
require_once($CFG->dirroot.'/admin/utfdbmigrate.php');
db_migrate2utf8();
print_simple_box_end();
}
print_footer($site);
?>
+10 -21
View File
@@ -1,43 +1,32 @@
<?php
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('toinodb');
$confirm = optional_param('confirm', 0, PARAM_BOOL);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
admin_externalpage_print_header();
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
if ($CFG->dbfamily != 'mysql') {
notice('This function is for MySQL databases only!', 'index.php');
if (!isadmin()) {
error('Admin only');
}
if (data_submitted() and $confirm and confirm_sesskey()) {
print_header("Convert all tables from MYISAM to InnoDB", "Convert all tables from MYISAM to InnoDB",
"Convert all tables from MYISAM to InnoDB");
notify('Please be patient and wait for this to complete...', 'notifysuccess');
if ($confirm and confirm_sesskey()) {
print_heading("Please be patient and wait for this to complete...");
if ($tables = $db->MetaTables()) {
$db->debug = true;
foreach ($tables as $table) {
execute_sql("ALTER TABLE $table TYPE=INNODB; ");
}
$db->debug = false;
}
notify('... done.', 'notifysuccess');
print_continue('index.php');
admin_externalpage_print_footer();
} else {
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
notice_yesno('Are you sure you want convert all your tables to the InnoDB format?',
'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
notice_yesno("Are you sure you want convert all your tables to the InnoDB format?",
"innodb.php?confirm=1&sesskey=".sesskey(), "index.php");
}
?>
+289 -1036
View File
File diff suppressed because it is too large Load Diff
+48 -50
View File
@@ -1,17 +1,15 @@
<?php // $Id$
/**
* This script enables Moodle translators to edit /docs and /help language
* files directly via WWW interface.
*
* Author: mudrd8mz@uxit.pedf.cuni.cz (http://moodle.cz)
* Based on: lang.php in 1.4.3+ release
* Thanks: Jaime Villate for important bug fixing, koen roggemans for his job and all moodlers
* for intensive testing of this my first contribution
*/
This script enables Moodle translators to edit /docs and /help language
files directly via WWW interface.
Author: mudrd8mz@uxit.pedf.cuni.cz (http://moodle.cz)
Based on: lang.php in 1.4.3+ release
Thanks: Jaime Villate for important bug fixing, koen roggemans for his job and all moodlers
for intensive testing of this my first contribution
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('langedit');
//
// Some local configuration
@@ -26,15 +24,28 @@
$currentfile = optional_param('currentfile', 'docs/README.txt', PARAM_PATH);
require_login();
if (!isadmin()) {
error("You need to be admin to edit this page");
}
if (! $site = get_site()) {
error("Site not defined!");
}
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strlanguage = get_string("language");
$strcurrentlanguage = get_string("currentlanguage");
$strthislanguage = get_string("thislanguage");
$stredithelpdocs = get_string('edithelpdocs', 'admin');
admin_externalpage_print_header();
notify('NOTICE: This interface is obsolete now and will be removed. You should use
improved <a href="lang.php?mode=helpfiles">lang.php</a> interface.');
print_header("$site->shortname: $stredithelpdocs: $currentfile", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> ->
<a href=\"lang.php\">$strlanguage</a> -> $stredithelpdocs",
'choosefile.popup', '', true);
$currentlang = current_language();
$langdir = "$CFG->dataroot/lang/$currentlang";
@@ -160,10 +171,7 @@ $langdir/$currentfile")."</font></p>";
echo htmlspecialchars(file_get_contents("$enlangdir/$currentfile"));
echo "</textarea>\n";
//link_to_popup_window("/lang/en_utf8/$currentfile", "popup", get_string("preview"));
$preview_url = langdoc_preview_url($currentfile);
if ($preview_url) {
link_to_popup_window($preview_url.'&amp;forcelang=en_utf8', 'popup', get_string('preview'));
}
link_to_popup_window(help_preview_url($currentfile).'&amp;forcelang=en_utf8', 'popup', get_string('preview'));
echo "</td>\n";
if ($fileeditorinline == 1) {
echo "</tr>\n<tr valign=\"center\">\n";
@@ -171,32 +179,30 @@ $langdir/$currentfile")."</font></p>";
echo "<td align=\"center\">\n";
if ($editable) {
echo "<form id=\"$currentfile\" action=\"langdoc.php\" method=\"post\">";
echo "<form name=\"$currentfile\" action=\"langdoc.php\" method=\"post\">";
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo '<input type="hidden" name="currentfile" value="'.$currentfile.'" />';
}
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
if (file_exists("$langdir/$currentfile")) {
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
} else {
echo ($filetemplate);
}
echo "</textarea>\n";
$preview_url = langdoc_preview_url($currentfile);
if ($preview_url) {
link_to_popup_window($preview_url, 'popup', get_string('preview'));
}
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
if (file_exists("$langdir/$currentfile")) {
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
} else {
echo ($filetemplate);
}
echo "</textarea>\n";
link_to_popup_window(help_preview_url($currentfile), 'popup', get_string('preview'));
echo "</td>\n</tr>\n</table>";
if ($editable) {
echo '<div align="center"><input type="submit" value="'.get_string('savechanges').': lang/'.$currentlang.'/'.$currentfile.'" /></div>';
echo '</form>';
}
echo "</td>\n</tr>\n</table>";
error_reporting($CFG->debug);
}
admin_externalpage_print_footer();
print_footer();
//////////////////////////////////////////////////////////////////////
@@ -234,26 +240,18 @@ function langdoc_save_file($path, $file, $content) {
return true;
}
/**
* Return a preview URL for the file, if available.
*
* Documentation will be moved into moodle.org wiki and current version 1.6 does not
* seem to be able to display local documentation. Thus, return empty URL for doc files.
* See lib/moodlelib.php document_file() - it still relies on old pre-UTF8 lang/ location.
*/
function langdoc_preview_url($currentfile) {
function help_preview_url($currentfile) {
if (substr($currentfile, 0, 5) == 'help/') {
$currentfile = substr($currentfile, 5);
$currentpathexp = explode('/', $currentfile);
if (count($currentpathexp) > 1) {
$url = '/help.php?module='.implode('/',array_slice($currentpathexp,0,count($currentpathexp)-1)).'&amp;file='.end($currentpathexp);
} else {
$url = '/help.php?module=moodle&amp;file='.$currentfile;
}
}
$currentpathexp = explode('/', $currentfile);
if (count($currentpathexp) > 1) {
$url = '/help.php?module='.$currentpathexp[0].'&amp;file='.$currentpathexp[1];
} else {
$url = '';
$url = '/help.php?module=moodle&amp;file='.$currentfile;
}
return $url;
}
?>
?>
+258 -273
View File
@@ -5,99 +5,108 @@
///This helps to avoid confusion.
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
admin_externalpage_setup('langimport');
$mode = optional_param('mode', 0, PARAM_INT); //phase
$pack = optional_param('pack', array(), PARAM_FILE); //pack to install
$pack = optional_param('pack', '', PARAM_FILE); //pack to install
$displaylang = $pack;
$uninstalllang = optional_param('uninstalllang', '', PARAM_FILE);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$sitelang = optional_param('sitelangconfig', '', PARAM_FILE);
define('INSTALLATION_OF_SELECTED_LANG', 2);
define('CHANGE_SITE_LANG', 3);
define('DELETION_OF_SELECTED_LANG', 4);
define('UPDATE_ALL_LANG', 5);
$strlang = get_string('langimport','admin');
$strlanguage = get_string('language');
$strthislanguage = get_string('thislanguage');
$title = $strlang;
require_login();
//reset and diagnose lang cache permissions
@unlink($CFG->dataroot.'/cache/languages');
if (file_exists($CFG->dataroot.'/cache/languages')) {
error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
if (!isadmin()) {
error('You must be an admin');
}
get_list_of_languages(true); //refresh lang cache
$notice_ok = array();
$notice_error = array();
if (!$site = get_site()) {
error("Site not defined!");
}
$strlang = get_string('langimport','admin');
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strlanguage = get_string("language");
$strthislanguage = get_string("thislanguage");
$title = $strlang;
print_header("$site->shortname: $title", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> ".
"<a href=\"lang.php\">$strlanguage</a> -> $strlang",
'', '', true, '');
print_heading('');
switch ($mode){
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
if (confirm_sesskey() and !empty($pack)) {
set_time_limit(0);
if (confirm_sesskey()) {
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
@mkdir ($CFG->dataroot.'/lang/');
require_once($CFG->libdir.'/componentlib.class.php');
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
$pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
switch ($status) {
if (is_array($pack)) {
$packs = $pack;
} else {
$packs = array($pack);
}
case ERROR:
if ($cd->get_error() == 'remotedownloadnotallowed') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'zip';
$a->dest= $CFG->dataroot.'/lang';
error(get_string($cd->get_error(), 'error', $a));
} else {
error(get_string($cd->get_error(), 'error'));
}
break;
foreach ($packs as $pack) {
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
$pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
switch ($status) {
case INSTALLED:
@unlink($CFG->dataroot.'/cache/languages');
redirect('langimport.php', get_string('langpackupdated','admin',$pack));
break;
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new object();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$a->dest= $CFG->dataroot.'/lang';
print_error($cd->get_error(), 'error', 'langimport.php', $a);
} else {
print_error($cd->get_error(), 'error', 'langimport.php');
}
break;
case UPTODATE:
break;
case COMPONENT_INSTALLED:
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
break;
case COMPONENT_UPTODATE:
break;
}
} else {
notify('Had an unspecified error with the component installer, sorry.');
}
} else {
notify('Had an unspecified error with the component installer, sorry.');
}
}
break;
case CHANGE_SITE_LANG: //change site language
if (confirm_sesskey()) {
$langconfig = get_record('config','name','lang');
$langconfig->value = $sitelang;
if (!empty($sitelang) && update_record('config',$langconfig)){
redirect('langimport.php', get_string('sitelangchanged','admin'));
} else {
error('Could not update the default site language!');
}
}
break;
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
if ($uninstalllang == 'en_utf8') {
$notice_error[] = 'en_utf8 can not be uninstalled!';
} else if (!$confirm && confirm_sesskey()) {
admin_externalpage_print_header();
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&amp;uninstalllang='.$uninstalllang.'&amp;confirm=1&amp;sesskey='.sesskey(),
if (!$confirm && confirm_sesskey()) {
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
'langimport.php?mode=4&amp;uninstalllang='.$uninstalllang.'&amp;confirm=1&amp;sesskey='.sesskey(),
'langimport.php');
print_footer();
die;
} else if (confirm_sesskey()) {
if ($uninstalllang == 'en_utf8') {
error ('en_utf8 can not be uninstalled!');
}
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
$rm1 = false;
@@ -108,30 +117,31 @@
if (file_exists($dest2)){
$rm2 = remove_dir($dest2);
}
get_list_of_languages(true); //refresh lang cache
//delete the direcotries
if ($rm1 or $rm2) {
$notice_ok[] = get_string('langpackremoved','admin');
redirect('langimport.php', get_string('langpackremoved','admin'));
} else { //nothing deleted, possibly due to permission error
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
error('An error has occurred, language pack is not completely uninstalled, please check file permissions');
}
}
@unlink($CFG->dataroot.'/cache/languages');
break;
case UPDATE_ALL_LANG: //1 click update for all updatable language packs
set_time_limit(0);
//0th pull a list from download.moodle.org,
//key = langname, value = md5
$source = 'http://download.moodle.org/lang16/languages.md5';
$md5array = array();
$updated = 0; //any packs updated?
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
unset($CFG->langlist); // ignore admin's langlist
$alllangs = array_keys(get_list_of_languages());
$lang16 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
$packs = array(); //all the packs that needs updating
if (!$availablelangs = get_remote_list_of_languages()) {
print_error('cannotdownloadlanguageupdatelist');
if (!$availablelangs = proxy_url($source)) {
error ('can not read from course');
}
//and build an associative array
@@ -139,12 +149,8 @@
$md5array[$alang[0]] = $alang[1];
}
//filtering out non-16 and unofficial packs
//filtering out non-16 packs
foreach ($alllangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
$notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$dest2 = $CFG->dirroot.'/lang/'.$clang;
@@ -166,7 +172,6 @@
if ($pack == 'en_utf8') { // no update for en_utf8
continue;
}
//1. delete old director(ies)
$dest1 = $CFG->dataroot.'/lang/'.$pack;
@@ -174,40 +179,38 @@
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)) {
if (!remove_dir($dest1)) {
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
continue;
}
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)) {
if (!remove_dir($dest2)) {
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
continue;
}
$rm2 = remove_dir($dest2);
}
if (!($rm1 || $rm2)) {
error ('could not delete old directory, update failed');
}
//2. copy & unzip into new
require_once($CFG->libdir.'/componentlib.class.php');
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
$pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
$status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED
switch ($status) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
case ERROR:
if ($cd->get_error() == 'remotedownloadnotallowed') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$a->url = 'http://download.moodle.org/lang16/'.$pack.'zip';
$a->dest= $CFG->dataroot.'/lang';
print_error($cd->get_error(), 'error', "", $a); // not probable
error(get_string($cd->get_error(), 'error', $a));
} else {
print_error($cd->get_error(), 'error'); // not probable
error(get_string($cd->get_error(), 'error'));
}
break;
case COMPONENT_UPTODATE:
case UPTODATE:
//Print error string or whatever you want to do
break;
case COMPONENT_INSTALLED:
$notice_ok[] = get_string('langpackupdated', 'admin', $pack);
case INSTALLED:
notify(get_string('langpackupdated','admin',$pack), 'notifysuccess');
$updated = true;
//Print/do whatever you want
break;
@@ -219,187 +222,158 @@
}
if ($updated) {
$notice_ok[] = get_string('langupdatecomplete','admin');
notice(get_string('langupdatecomplete','admin'), 'langimport.php');
} else {
$notice_ok[] = get_string('nolangupdateneeded','admin');
notice(get_string('nolangupdateneeded','admin'), 'langimport.php');
}
break;
default: //display choice mode
$source = 'http://download.moodle.org/lang16/languages.md5';
$remote = 0; //flag for reading from remote or local
if ($availablelangs = proxy_url($source)) {
$remote = 1;
} else {
$availablelangs = get_local_list_of_languages();
}
/*
if ($fp = fopen($source, 'r')){ /// attempt to get the list from Moodle.org.
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
$remote = 1; //can read from download.moodle.org
} else { /// fopen failed, we find local copy of list.
$availablelangs = get_local_list_of_languages();
}
*/
if (!$remote) {
print_simple_box_start('center','60%');
echo '<div align="center">';
print_string('remotelangnotavailable','admin',$CFG->dataroot.'/lang/');
echo '</div>';
print_simple_box_end();
}
print_simple_box_start('center','60%');
echo '<table width="100%"><tr><td align="center">';
echo get_string('installedlangs','admin');
echo '</td><td align="center">';
echo get_string('availablelangs','admin');
echo '</td></tr>';
echo '<tr><td align="center" valign="top">';
echo '<form name="uninstallform" action="langimport.php?mode=4" method="POST">';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
unset($CFG->langlist); // ignore admin's langlist
$installedlangs = get_list_of_languages();
/// display installed langs here
echo '<select name="uninstalllang" size="15">';
foreach ($installedlangs as $clang =>$ilang){
echo '<option value="'.$clang.'">'.$ilang.'</option>';
}
echo '</select>';
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
echo '</form>';
echo '<form name="updateform" action="langimport.php?mode=5" method="POST">';
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
echo '</form>';
echo '<p />';
/// Display option to change site language
print_string('changesitelang','admin');
$sitelanguage = get_record('config','name','lang');
echo '<form name="changelangform" action="langimport.php?mode=3" method="POST">';
echo '<select name="sitelangconfig">';
foreach ($installedlangs as $clang =>$ilang) {
if ($clang == $sitelanguage->value){
echo '<option value="'.$clang.'" selected="selected">'.$ilang.'</option>';
} else {
echo '<option value="'.$clang.'">'.$ilang.'</option>';
}
}
echo '</select>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="submit" value="'.get_string('change','admin').'" />';
echo '</form>';
/// display to be installed langs here
echo '</td><td align="center" valign="top">';
echo '<table><tr><td valign="top" align="center">'; //availabe langs table
$empty = 1; //something to pring
/// if this language pack is not already installed, then we allow installation
echo '<form name="installform" method="POST" action="langimport.php?mode=2">';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
if ($remote) {
echo '<select name="pack" size="15">';
}
foreach ($availablelangs as $alang) {
if (trim($alang[0]) != "en_utf8") {
if ($remote){
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
$shortlang = substr($alang[0], 0, -5);
} else {
$shortlang = $alang[0];
}
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
}
} else { //print list in local format, and instruction to install
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a>';
}
$empty = 0;
}
}
if ($remote) {
echo '</select>';
echo '<br/ ><input type="submit" value="<-- '.get_string('install','admin').'">';
}
echo '</form>';
if ($empty) {
echo '<tr><td align="center">';
print_string('nolanguagetodownload','admin');
echo '</td></tr>';
}
echo '</td><tr></table>'; //close available langs table
echo '<form>';
echo '</td></tr></table>';
print_simple_box_end();
break;
} //close of main switch
admin_externalpage_print_header();
$installedlangs = get_list_of_languages(true, true);
$missingparents = array();
$oldlang = isset($SESSION->lang) ? $SESSION->lang : null; // override current lang
foreach($installedlangs as $l=>$unused) {
$SESSION->lang = $l;
$parent = get_string('parentlanguage');
if ($parent == 'en_utf8') {
continue;
}
if (strpos($parent, '[[') !== false) {
continue; // no parent
}
if (!isset($installedlangs[$parent])) {
$missingparents[$l] = $parent;
}
}
if (isset($oldlang)) {
$SESSION->lang = $oldlang;
} else {
unset($SESSION->lang);
}
if ($availablelangs = get_remote_list_of_languages()) {
$remote = 1;
} else {
$remote = 0; //flag for reading from remote or local
$availablelangs = get_local_list_of_languages();
}
if (!$remote) {
print_box_start();
print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/');
print_box_end();
}
if ($notice_ok) {
$info = implode('<br />', $notice_ok);
notify($info, 'notifysuccess');
}
if ($notice_error) {
$info = implode('<br />', $notice_error);
notify($info, 'notifyproblem');
}
if ($missingparents) {
foreach ($missingparents as $l=>$parent) {
$a = new object();
$a->lang = $installedlangs[$l];
$a->parent = $parent;
foreach ($availablelangs as $alang) {
if ($alang[0] == $parent) {
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
$shortlang = substr($alang[0], 0, -5);
} else {
$shortlang = $alang[0];
}
$a->parent = $alang[2].' ('.$shortlang.')';
}
}
$info = get_string('missinglangparent', 'admin', $a);
notify($info, 'notifyproblem');
}
}
print_box_start();
echo '<table summary="">';
echo '<tr><td align="center" valign="top">';
echo '<form id="uninstallform" action="langimport.php?mode='.DELETION_OF_SELECTED_LANG.'" method="post">';
echo '<fieldset class="invisiblefieldset">';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
/// display installed langs here
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
foreach ($installedlangs as $clang =>$ilang){
echo '<option value="'.$clang.'">'.$ilang.'</option>';
}
echo '</select>';
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
echo '</fieldset>';
echo '</form>';
if ($remote) {
echo '<form id="updateform" action="langimport.php?mode='.UPDATE_ALL_LANG.'" method="post">';
echo '<div>';
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
echo '</div>';
echo '</form>';
}
/// Display option to change site language
/// display to be installed langs here
echo '</td><td align="center" valign="top">';
//availabe langs table
$empty = 1; //something to pring
/// if this language pack is not already installed, then we allow installation
echo '<form id="installform" method="post" action="langimport.php?mode='.INSTALLATION_OF_SELECTED_LANG.'">';
echo '<fieldset class="invisiblefieldset">';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
if ($remote) {
echo '<select name="pack[]" id="pack" size="15" multiple="multiple">';
}
foreach ($availablelangs as $alang) {
if ($alang[0] == '') {
continue;
}
if (trim($alang[0]) != "en_utf8") {
if ($remote) {
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
$shortlang = substr($alang[0], 0, -5);
} else {
$shortlang = $alang[0];
}
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
}
} else { //print list in local format, and instruction to install
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
}
$empty = 0;
}
}
if ($remote) {
echo '</select>';
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
}
echo '</fieldset>';
echo '</form>';
if ($empty) {
echo '<br />';
print_string('nolanguagetodownload','admin');
}
//close available langs table
echo '</td></tr></table>';
print_box_end();
admin_externalpage_print_footer();
/**
* Returns a list of available language packs from a
print_footer();
/* returns a list of available language packs from a
* local copy shipped with standard moodle distro
* this is for site that can't download components.
* this is for site that can't perform fopen
* @return array
*/
function get_local_list_of_languages() {
global $CFG;
$source = $CFG->dirroot.'/lib/languages.md5';
$source = $CFG->wwwroot.'/lib/languages.md5';
$availablelangs = array();
if ($fp = fopen($source, 'r')) {
if ($fp = fopen($source, 'r')){
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
}
return $availablelangs;
}
/**
* checks the md5 of the zip file, grabbed from download.moodle.org,
/* checks the md5 of the zip file, grabbed from download.moodle.org,
* against the md5 of the local language file from last update
* @param string $lang
* @param string $md5check
@@ -413,27 +387,38 @@
}
return false;
}
//returns an array of languages, or false if can not read from source
//uses a socket if proxy is set as a config variable
function proxy_url($url) {
global $CFG;
/**
* Returns the latest list of available language packs from
* moodle.org
* @return array or false if can not download
*/
function get_remote_list_of_languages() {
$source = 'http://download.moodle.org/lang16/languages.md5';
$availablelangs = array();
if ($CFG->proxyhost && $CFG->proxyport) {
if ($content = download_file_content($source)) {
$alllines = split("\n", $content);
foreach($alllines as $line) {
if (!empty($line)){
$availablelangs[] = split(',', $line);
}
$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
return $availablelangs;
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
$i = 0;
while(!feof($proxy_fp)) {
$string = fgets($proxy_fp, 1024);
if ($i > 11) { //12 lines of info skipped
$availablelangs[] = split(',', $string);
}
$i++;
}
fclose($proxy_fp);
} else {
return false;
} else { //proxy not in use
if ($fp = fopen($url, 'r')){ /// attempt to get the list from Moodle.org.
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
} else { /// fopen failed, return false.
return false;
}
}
return $availablelangs;
}
?>
-77
View File
@@ -1,77 +0,0 @@
#!/usr/bin/php
<?php
/*
* Utility to debug mailouts - will save the content of emails to a
* logfile instead of sending them out. Use it as a sendmail
* "stand-in" when testing mailouts.
*
* It is not Moodle specific - use it anywhere by setting the php
* "sendmail_path" setting to this file with a logfile parameter.
*
* - Set in php.ini (not settable in config.php):
* sendmail_path=/path-to-moodle/admin/mailout-debugger.php');
* Or from the commandline
* php -d sendmail_path='/path-to-moodle/admin/mailout-debugger.php' /path/to/cron.php
*
* - Create a file in admin called mailout-debugger.enable
* (this is a security check to prevent execution in prod environments)
* touch /path/to/moodle/admin/mailout-debugger.enable
*
* - Mark as executable: chmod ugo+rx mailout-debugger.php
*
* - Run your admin/cron.php
*
* - Read /tmp/moodle-mailout.log
*
*
* This script will create logfiles in /tmp/ or in $TMPDIR if set.
* On windows, use php -r 'print sys_get_temp_dir()' to see where the file is saved.
*/
// Security check.
if (!file_exists(dirname(__FILE__).'/mailout-debugger.enable')) {
mdie("Disabled.");
}
$tmpdir=sys_get_temp_dir(); // default
if (isset($_SERVER['REMOTE_ADDR'])) {
mdie("should not be called from web server!");
}
if (isset($_ENV['TMPDIR']) && is_dir($_ENV['TMPDIR'])) {
$tmpdir = $_ENV['TMPDIR'];
}
$tmpfile = $tmpdir . '/moodle-mailout.log';
$fh = fopen($tmpfile, 'a+', false)
or mdie("Error openning $tmpfile on append\n");
fwrite($fh, "==== ".strftime("%a %b %e %H:%M:%S %Y", time())." ====\n");
fwrite($fh, "==== Commandline: " . implode(' ',$argv) . "\n");
$stdin = fopen('php://stdin', 'r');
while ($line = fgets($stdin)) {
fwrite($fh, $line);
}
fwrite($fh, "\n");
fclose($fh);
fclose($stdin);
/**
* Print an error to STDOUT and exit with a non-zero code. For commandline scripts.
* Default errorcode is 1.
*
* Very useful for perl-like error-handling:
*
* do_somethting() or mdie("Something went wrong");
*
* @param string $msg Error message
* @param integer $errorcode Error code to emit
*
*/
function mdie($msg='', $errorcode=1) {
trigger_error($msg);
exit($errorcode);
}
?>
+27 -18
View File
@@ -2,11 +2,14 @@
// Enables/disables maintenance mode
require('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = optional_param('action', '', PARAM_ALPHA);
admin_externalpage_setup('maintenancemode');
require_login();
if (!isadmin()) {
error('You need to be admin to use this page');
}
//Check folder exists
if (! make_upload_directory(SITEID)) { // Site folder
@@ -19,51 +22,57 @@
if (confirm_sesskey()) {
if ($form->action == "disable") {
unlink($filename);
redirect('maintenance.php', get_string('sitemaintenanceoff','admin'));
redirect('index.php', get_string('sitemaintenanceoff','admin'));
} else {
$file = fopen($filename, 'w');
fwrite($file, stripslashes($form->text));
fclose($file);
redirect('maintenance.php', get_string('sitemaintenanceon', 'admin'));
redirect('index.php', get_string('sitemaintenanceon', 'admin'));
}
}
}
/// Print the header stuff
admin_externalpage_print_header();
$strmaintenance = get_string('sitemaintenancemode', 'admin');
$stradmin = get_string('administration');
$strconfiguration = get_string('configuration');
print_header("$SITE->shortname: $strmaintenance", $SITE->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strmaintenance");
print_heading($strmaintenance);
/// Print the appropriate form
if (file_exists($filename)) { // We are in maintenance mode
echo '<div style="margin-left:auto;margin-right:auto">';
echo '<center>';
echo '<form action="maintenance.php" method="post">';
echo '<input type="hidden" name="action" value="disable" />';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<p><input type="submit" value="'.get_string('disable').'" /></p>';
echo '<input type="hidden" name="action" value="disable">';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'">';
echo '<p><input type="submit" value="'.get_string('disable').'"></p>';
echo '</form>';
echo '</div>';
echo '</center>';
} else { // We are not in maintenance mode
$usehtmleditor = can_use_html_editor();
echo '<div style="text-align:center;margin-left:auto;margin-right:auto">';
echo '<center>';
echo '<form action="maintenance.php" method="post">';
echo '<div>';
echo '<input type="hidden" name="action" value="enable" />';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<p><input type="submit" value="'.get_string('enable').'" /></p>';
echo '<input type="hidden" name="action" value="enable">';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'">';
echo '<p><input type="submit" value="'.get_string('enable').'"></p>';
echo '<p>'.get_string('optionalmaintenancemessage', 'admin').':</p>';
echo '<table><tr><td>';
print_textarea($usehtmleditor, 20, 50, 600, 400, "text");
echo '</td></tr></table>';
echo '</div>';
echo '</form>';
echo '</div>';
echo '</center>';
if ($usehtmleditor) {
use_html_editor();
}
}
admin_externalpage_print_footer();
print_footer();
?>
+47
View File
@@ -0,0 +1,47 @@
<?php // $Id$
require_once('../config.php');
require_login();
if (!isadmin()) {
error("Only admins can access this page");
}
if (!$site = get_site()) {
redirect("index.php");
}
$stradministration = get_string("administration");
$strmisc = get_string("miscellaneous");
print_header("$site->shortname: $stradministration: $strmisc", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> $strmisc");
print_heading($strmisc);
$table->align = array ("right", "left");
$table->data[] = array('<b><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').'</a></b>',
get_string("adminhelpsitefiles"));
$table->data[] = array('<b><a href="stickyblocks.php">'.get_string('stickyblocks','admin')."</a></b>",
get_string('adminhelpstickyblocks'));
$table->data[] = array('<b><a href="report.php">'.get_string('reports')."</a></b>",
get_string('adminhelpreports'));
// to be enabled later
/* $table->data[] = array('<b><a href="health.php">'.get_string('healthcenter')."</a></b>",
get_string('adminhelphealthcenter'));*/
$table->data[] = array('<b><a href="environment.php">'.get_string('environment', 'admin')."</a></b>",
get_string('adminhelpenvironment'));
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
$table->data[] = array('<b><a href="'.$CFG->dbtype.'/frame.php">'.get_string('managedatabase')."</a></b>",
get_string('adminhelpmanagedatabase'));
}
print_table($table);
print_footer($site);
?>
-583
View File
@@ -1,583 +0,0 @@
<?php
/**
* Adapted for Moodle from the AMFPHP Project at http://www.amfphp.org/
* Creates the methodTable for a service class.
*
* @usage $this->methodTable = MethodTable::create($this);
* @author Christophe Herreman
* @since 05/01/2005
* @version $id$
*
* Special contributions by Allessandro Crugnola and Ted Milker
*/
if (!defined('T_ML_COMMENT')) {
define('T_ML_COMMENT', T_COMMENT);
} else {
define('T_DOC_COMMENT', T_ML_COMMENT);
}
/**
* Return string from start of haystack to first occurance of needle, or whole
* haystack, if needle does not occur
*
* @access public
* @param $haystack(String) Haystack to search in
* @param $needle(String) Needle to look for
*/
function strrstr($haystack, $needle)
{
return substr($haystack, 0, strpos($haystack.$needle,$needle));
}
/**
* Return substring of haystack from end of needle onwards, or FALSE
*
* @access public
* @param $haystack(String) Haystack to search in
* @param $needle(String) Needle to look for
*/
function strstrafter($haystack, $needle)
{
return substr(strstr($haystack, $needle), strlen($needle));
}
class MethodTable
{
/**
* Constructor.
*
* Since this class should only be accessed through the static create() method
* this constructor should be made private. Unfortunately, this is not possible
* in PHP4.
*
* @access private
*/
function MethodTable(){
}
/**
* Creates the methodTable for a passed class.
*
* @static
* @access public
* @param $sourcePath(String) The path to the file you want to parse
* @param $containsClass(Bool) True if the file is a class definition (optional)
*/
function create($sourcePath, $containsClass = false){
$methodTable = array();
if(!file_exists($sourcePath))
{
return false;
}
$source = file_get_contents($sourcePath);
$tokens = (array)token_get_all($source);
$waitingForOpenParenthesis = false;
$waitingForFunction = false;
$waitingForClassName = false;
$bufferingArgs = false;
$argBuffer = "";
$lastFunction = "";
$lastFunctionComment = "";
$lastComment = "";
$classMethods = array();
$realClassName = "";
if($containsClass) {
$openBraces = -10000;
}
else
{
$openBraces = 1;
}
$waitingForEndEncapsedString = false;
foreach($tokens as $token)
{
if (is_string($token)) {
if($token == '{')
{
$openBraces++;
}
if($token == '}')
{
if($waitingForEndEncapsedString)
{
$waitingForEndEncapsedString = false;
}
else
{
$lastComment = '';
$openBraces--;
if($openBraces == 0)
{
break;
}
}
}
elseif($waitingForOpenParenthesis && $token == '(')
{
$bufferingArgs = true;
$argBuffer = "";
$waitingForOpenParenthesis = false;
}
elseif($bufferingArgs)
{
if($token != ')')
{
$argBuffer .= $token;
}
else
{
if($lastFunction != $realClassName)
{
$classMethods[] = array("name" => $lastFunction,
"comment" => $lastFunctionComment,
"args" => $argBuffer);
$bufferingArgs = false;
$argBuffer = "";
$lastFunction = "";
$lastFunctionComment = "";
}
}
}
} else {
// token array
list($id, $text) = $token;
if($bufferingArgs)
{
$argBuffer .= $text;
}
switch ($id)
{
case T_COMMENT:
case T_ML_COMMENT: // we've defined this
case T_DOC_COMMENT: // and this
// no action on comments
$lastComment = $text;
break;
case T_FUNCTION:
if($openBraces >= 1)
{
$waitingForFunction = true;
}
break;
case T_STRING:
if($waitingForFunction)
{
$waitingForFunction = false;
$waitingForOpenParenthesis = true;
$lastFunction = $text;
$lastFunctionComment = $lastComment;
$lastComment = "";
}
if($waitingForClassName)
{
$waitingForClassName = false;
$realClassName = $text;
}
break;
case T_CLASS:
$openBraces = 0;
$waitingForClassName = true;
break;
case T_CURLY_OPEN:
case T_DOLLAR_OPEN_CURLY_BRACES:
$waitingForEndEncapsedString = true;
break;
}
}
}
foreach ($classMethods as $key => $value) {
$methodSignature = $value['args'];
$methodName = $value['name'];
$methodComment = $value['comment'];
$description = MethodTable::getMethodDescription($methodComment) . " " . MethodTable::getMethodCommentAttribute($methodComment, "desc");
$description = trim($description);
$access = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "access");
$roles = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "roles");
$instance = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "instance");
$returns = MethodTable::getMethodReturnValue($methodComment);
$pagesize = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "pagesize");
$params = MethodTable::getMethodCommentArguments($methodComment);
//description, arguments, access, [roles, [instance, [returns, [pagesize]]]]
$methodTable[$methodName] = array();
//$methodTable[$methodName]["signature"] = $methodSignature; //debug purposes
$methodTable[$methodName]["description"] = ($description == "") ? "No description given." : $description;
$methodTable[$methodName]["arguments"] = MethodTable::getMethodArguments($methodSignature, $params);
$methodTable[$methodName]["access"] = ($access == "") ? "private" : $access;
if($roles != "") $methodTable[$methodName]["roles"] = $roles;
if($instance != "") $methodTable[$methodName]["instance"] = $instance;
if($returns != "") $methodTable[$methodName]["returns"] = $returns;
if($pagesize != "") $methodTable[$methodName]["pagesize"] = $pagesize;
}
return $methodTable;
}
/**
*
*/
function getMethodCommentServices($comment)
{
$pieces = explode('@service', $comment);
$args = array();
if(is_array($pieces) && count($pieces) > 1)
{
for($i = 0; $i < count($pieces) - 1; $i++)
{
$ps = strrstr($pieces[$i + 1], '@');
$ps = strrstr($ps, '*/');
$args[] = MethodTable::cleanComment($ps);
}
}
return $args;
}
/**
*
*/
function getMethodCommentArguments($comment)
{
$pieces = explode('@param', $comment);
$args = array();
if(is_array($pieces) && count($pieces) > 1)
{
for($i = 0; $i < count($pieces) - 1; $i++)
{
$ps = strrstr($pieces[$i + 1], '@');
$ps = strrstr($ps, '*/');
$args[] = MethodTable::cleanComment($ps);
}
}
return $args;
}
/**
* Returns the description from the comment.
* The description is(are) the first line(s) in the comment.
*
* @static
* @private
* @param $comment(String) The method's comment.
*/
function getMethodDescription($comment){
$comment = MethodTable::cleanComment(strrstr($comment, "@"));
return trim($comment);
}
/**
* Returns the value of a comment attribute.
*
* @static
* @private
* @param $comment(String) The method's comment.
* @param $attribute(String) The name of the attribute to get its value from.
*/
function getMethodCommentAttribute($comment, $attribute){
$pieces = strstrafter($comment, '@' . $attribute);
if($pieces !== FALSE)
{
$pieces = strrstr($pieces, '@');
$pieces = strrstr($pieces, '*/');
return MethodTable::cleanComment($pieces);
}
return "";
}
/**
* Returns the value of a comment attribute.
*
* @static
* @private
* @param $comment(String) The method's comment.
* @param $attribute(String) The name of the attribute to get its value from.
*/
function getMethodCommentAttributeFirstLine($comment, $attribute){
$pieces = strstrafter($comment, '@' . $attribute);
if($pieces !== FALSE)
{
$pieces = strrstr($pieces, '@');
$pieces = strrstr($pieces, "*");
$pieces = strrstr($pieces, "/");
$pieces = strrstr($pieces, "-");
$pieces = strrstr($pieces, "\n");
$pieces = strrstr($pieces, "\r");
$pieces = strrstr($pieces, '*/');
return MethodTable::cleanComment($pieces);
}
return "";
}
/**
* Returns the value of a comment attribute.
*
* @static
* @private
* @param $comment(String) The method's comment.
* @param $attribute(String) The name of the attribute to get its value from.
*/
function getMethodReturnValue($comment){
$result = array('type' => 'void', 'description' => '');
$pieces = strstrafter($comment, '@returns');
if(FALSE == $pieces) $pieces = strstrafter($comment, '@return');
if($pieces !== FALSE)
{
$pieces = strrstr($pieces, '@');
$pieces = strrstr($pieces, "*");
$pieces = strrstr($pieces, "/");
$pieces = strrstr($pieces, "-");
$pieces = strrstr($pieces, "\n");
$pieces = strrstr($pieces, "\r");
$pieces = strrstr($pieces, '*/');
$pieces = trim(MethodTable::cleanComment($pieces));
@list($result['type'], $result['description']) = explode(' ', $pieces, 2);
$result['type'] = MethodTable::standardizeType($result['type']);
}
return $result;
}
function getMethodCommentAttributeFirstWord($comment, $attribute){
$pieces = strstrafter($comment, '@' . $attribute);
if($pieces !== FALSE)
{
$val = MethodTable::cleanComment($pieces);
return trim(strrstr($val, ' '));
}
return "";
}
/**
* Returns an array with the arguments of a method.
*
* @static
* @access private
* @param $methodSignature(String) The method's signature;
*/
function getMethodArguments($methodSignature, $commentParams){
if(strlen($methodSignature) == 0){
//no arguments, return an empty array
$result = array();
}else{
//clean the arguments before returning them
$result = MethodTable::cleanArguments(explode(",", $methodSignature), $commentParams);
}
return $result;
}
/**
* Cleans the function or method's return value.
*
* @static
* @access private
* @param $value(String) The "dirty" value.
*/
function cleanReturnValue($value){
$result = array();
$value = trim($value);
list($result['type'], $result['description']) = explode(' ', $value, 2);
$result['type'] = MethodTable::standardizeType($result['type']);
return $result;
}
/**
* Takes a string and returns the XMLRPC type that most closely matches it.
*
* @static
* @access private
* @param $type(String) The given type string.
*/
function standardizeType($type) {
$type = strtolower($type);
if('str' == $type || 'string' == $type) return 'string';
if('int' == $type || 'integer' == $type) return 'int';
if('bool' == $type || 'boolean' == $type) return 'boolean';
// Note that object is not a valid XMLRPC type
if('object' == $type || 'class' == $type) return 'object';
if('float' == $type || 'dbl' == $type || 'double' == $type || 'flt' == $type) return 'double';
// Note that null is not a valid XMLRPC type. The null type can have
// only one value - null.
if('null' == $type) return 'null';
// Note that mixed is not a valid XMLRPC type
if('mixed' == $type) return 'mixed';
if('array' == $type || 'arr' == $type) return 'array';
if('assoc' == $type || 'struct' == $type) return 'struct';
// Note that this is not a valid XMLRPC type. As references cannot be
// serialized or exported, there is no way this could be XML-RPCed.
if('reference' == $type || 'ref' == $type) return 'reference';
return 'string';
}
/**
* Cleans the arguments array.
* This method removes all whitespaces and the leading "$" sign from each argument
* in the array.
*
* @static
* @access private
* @param $args(Array) The "dirty" array with arguments.
*/
function cleanArguments($args, $commentParams){
$result = array();
if(!is_array($args)) return array();
foreach($args as $index => $arg){
$arg = strrstr(str_replace(array('$','&$'), array('','&'), $arg), '=');
if(!isset($commentParams[$index]))
{
$result[] = trim($arg);
}
else
{
$start = trim($arg);
$end = trim(str_replace('$', '', $commentParams[$index]));
// Suppress Notice of 'Undefined offset' with @
@list($word0, $word1, $tail) = preg_split("/[\s]+/", $end, 3);
$word0 = strtolower($word0);
$word1 = strtolower($word1);
$wordBase0 = ereg_replace('^[&$]+','',$word0);
$wordBase1 = ereg_replace('^[&$]+','',$word1);
$startBase = strtolower(ereg_replace('^[&$]+','',$start));
if ($wordBase0 == $startBase) {
$type = str_replace(array('(',')'),'', $word1);
} elseif($wordBase1 == $startBase) {
$type = str_replace(array('(',')'),'', $word0);
} elseif( ereg('(^[&$]+)|(\()([a-z0-9]+)(\)$)', $word0, $regs) ) {
$tail = str_ireplace($word0, '', $end);
$type = $regs[3];
} else {
// default to string
$type = 'string';
}
$type = MethodTable::standardizeType($type);
/*
if($type == 'str') {
$type = 'string';
} elseif($type == 'int' || $type == 'integer') {
$type = 'int';
} elseif($type == 'bool' || $type == 'boolean') {
$type = 'boolean';
} elseif($type == 'object' || $type == 'class') {
// Note that this is not a valid XMLRPC type
$type = 'object';
} elseif($type == 'float' || $type == 'dbl' || $type == 'double' || $type == 'flt') {
$type = 'double';
} elseif($type == 'null') {
// Note that this is not a valid XMLRPC type
// The null type can have only one value - null. Why would
// that be an argument to a function? Just in case:
$type = 'null';
} elseif($type == 'mixed') {
// Note that this is not a valid XMLRPC type
$type = 'mixed';
} elseif($type == 'array' || $type == 'arr') {
$type = 'array';
} elseif($type == 'assoc') {
$type = 'struct';
} elseif($type == 'reference' || $type == 'ref') {
// Note that this is not a valid XMLRPC type
// As references cannot be serialized or exported, there is
// no way this could be XML-RPCed.
$type = 'reference';
} else {
$type = 'string';
}
*/
$result[] = array('type' => $type, 'description' => $start . ' - ' . $tail);
}
}
return $result;
}
/**
* Cleans the comment string by removing all comment start and end characters.
*
* @static
* @private
* @param $comment(String) The method's comment.
*/
function cleanComment($comment){
$comment = str_replace("/**", "", $comment);
$comment = str_replace("*/", "", $comment);
$comment = str_replace("*", "", $comment);
$comment = str_replace("\n", "\\n", trim($comment));
$comment = eregi_replace("[\r\t\n ]+", " ", trim($comment));
$comment = str_replace("\"", "\\\"", $comment);
return $comment;
}
/**
*
*/
function showCode($methodTable){
if(!is_array($methodTable)) $methodTable = array();
foreach($methodTable as $methodName=>$methodProps){
$result .= "\n\t\"" . $methodName . "\" => array(";
foreach($methodProps as $key=>$value){
$result .= "\n\t\t\"" . $key . "\" => ";
if($key=="arguments"){
$result .= "array(";
for($i=0; $i<count($value); $i++){
$result .= "\"" . addslashes($value[$i]) . "\"";
if($i<count($value)-1){
$result .= ", ";
}
}
$result .= ")";
}else{
$result .= "\"" . $value . "\"";
}
$result .= ",";
}
$result = substr($result, 0, -1);
$result .= "\n\t),";
}
$result = substr($result, 0, -1);
$result = "\$this->methodTable = array(" . $result;
$result .= "\n);";
return $result;
}
}
?>
-237
View File
@@ -1,237 +0,0 @@
<?php // $Id$
// Allows the admin to control user logins from remote moodles.
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
$sort = optional_param('sort', 'username', PARAM_ALPHA);
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 30, PARAM_INT);
$action = trim(strtolower(optional_param('action', '', PARAM_ALPHA)));
require_login();
admin_externalpage_setup('ssoaccesscontrol');
admin_externalpage_print_header();
if (!extension_loaded('openssl')) {
print_error('requiresopenssl', 'mnet');
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$sesskey = sesskey();
$formerror = array();
// grab the mnet hosts and remove the localhost
$mnethosts = get_records_menu('mnet_host', '', '', 'name', 'id, name');
if (array_key_exists($CFG->mnet_localhost_id, $mnethosts)) {
unset($mnethosts[$CFG->mnet_localhost_id]);
}
// process actions
if (!empty($action) and confirm_sesskey()) {
// boot if insufficient permission
if (!has_capability('moodle/user:delete', $sitecontext)) {
print_error('nomodifyacl','mnet');
}
// fetch the record in question
$id = required_param('id', PARAM_INT);
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
print_error('recordnoexists','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
switch ($action) {
case "delete":
delete_records('mnet_sso_access_control', 'id', $id);
redirect('access_control.php', get_string('deleteuserrecord', 'mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
break;
case "acl":
// require the access parameter, and it must be 'allow' or 'deny'
$accessctrl = trim(strtolower(required_param('accessctrl', PARAM_ALPHA)));
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
print_error('invalidaccessparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
if ($accessctrl == 'allow') {
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
} elseif ($accessctrl == 'deny') {
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
}
}
break;
default:
print_error('invalidactionparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
}
// process the form results
if ($form = data_submitted() and confirm_sesskey()) {
// check permissions and verify form input
if (!has_capability('moodle/user:delete', $sitecontext)) {
print_error('nomodifyacl','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
if (empty($form->username)) {
$formerror['username'] = get_string('enterausername','mnet');
}
if (empty($form->mnet_host_id)) {
$formerror['mnet_host_id'] = get_string('selectahost','mnet');
}
if (empty($form->accessctrl)) {
$formerror['accessctrl'] = get_string('selectaccesslevel','mnet'); ;
}
// process if there are no errors
if (count($formerror) == 0) {
// username can be a comma separated list
$usernames = explode(',', $form->username);
foreach ($usernames as $username) {
$username = trim(moodle_strtolower($username));
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array($username, $mnethosts[$form->mnet_host_id])));
} elseif ($form->accessctrl == 'deny') {
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array($username, $mnethosts[$form->mnet_host_id])));
}
}
}
}
}
exit;
}
// Explain
print_box(get_string('ssoacldescr','mnet'));
// Are the needed bits enabled?
$warn = '';
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
$warn = '<p>' . get_string('mnetdisabled','mnet') .'</p>';
}
if (!is_enabled_auth('mnet')) {
$warn .= '<p>' . get_string('authmnetdisabled','mnet').'</p>';
}
if (get_config('auth/mnet', 'auto_add_remote_users') != true) {
$warn .= '<p>' . get_string('authmnetautoadddisabled','mnet').'</p>';
}
if (!empty($warn)) {
$warn = '<p>' . get_string('ssoaclneeds','mnet').'</p>' . $warn;
print_box($warn);
}
// output the ACL table
$columns = array("username", "mnet_host_id", "access", "delete");
$headings = array();
$string = array('username' => get_string('username'),
'mnet_host_id' => get_string('remotehost', 'mnet'),
'access' => get_string('accesslevel', 'mnet'),
'delete' => get_string('delete'));
foreach ($columns as $column) {
if ($sort != $column) {
$columnicon = "";
$columndir = "ASC";
} else {
$columndir = $dir == "ASC" ? "DESC" : "ASC";
$columnicon = $dir == "ASC" ? "down" : "up";
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
}
$headings[$column] = "<a href=\"?sort=$column&amp;dir=$columndir&amp;\">".$string[$column]."</a>$columnicon";
}
$headings['delete'] = '';
$acl = get_records('mnet_sso_access_control', '', '', "$sort $dir", '*'); //, $page * $perpage, $perpage);
$aclcount = count_records('mnet_sso_access_control');
if (!$acl) {
print_heading(get_string('noaclentries','mnet'));
$table = NULL;
} else {
$table->head = $headings;
$table->align = array('left', 'left', 'center');
$table->width = "95%";
foreach ($acl as $aclrecord) {
if ($aclrecord->accessctrl == 'allow') {
$accesscolumn = get_string('allow', 'mnet')
. " (<a href=\"?id={$aclrecord->id}&amp;action=acl&amp;accessctrl=deny&amp;sesskey={$USER->sesskey}\">"
. get_string('deny', 'mnet') . "</a>)";
} else {
$accesscolumn = get_string('deny', 'mnet')
. " (<a href=\"?id={$aclrecord->id}&amp;action=acl&amp;accessctrl=allow&amp;sesskey={$USER->sesskey}\">"
. get_string('allow', 'mnet') . "</a>)";
}
$deletecolumn = "<a href=\"?id={$aclrecord->id}&amp;action=delete&amp;sesskey={$USER->sesskey}\">"
. get_string('delete') . "</a>";
$table->data[] = array ($aclrecord->username, $aclrecord->mnet_host_id, $accesscolumn, $deletecolumn);
}
}
if (!empty($table)) {
print_table($table);
echo '<p>&nbsp;</p>';
print_paging_bar($aclcount, $page, $perpage, "?sort=$sort&amp;dir=$dir&amp;perpage=$perpage&amp;");
}
// output the add form
print_simple_box_start('center','90%','','20');
?>
<div class="mnetaddtoaclform">
<form id="mnetaddtoacl" method="post">
<input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>" />
<?php
// enter a username
echo get_string('username') . ":\n";
if (!empty($formerror['username'])) {
echo '<span class="error"> * </span>';
}
echo '<input type="text" name="username" size="20" maxlength="100" />';
// choose a remote host
echo " " . get_string('remotehost', 'mnet') . ":\n";
if (!empty($formerror['mnet_host_id'])) {
echo '<span class="error"> * </span>';
}
choose_from_menu($mnethosts, 'mnet_host_id');
// choose an access level
echo " " . get_string('accesslevel', 'mnet') . ":\n";
if (!empty($formerror['accessctrl'])) {
echo '<span class="error"> * </span>';
}
$accessmenu['allow'] = get_string('allow', 'mnet');
$accessmenu['deny'] = get_string('deny', 'mnet');
choose_from_menu($accessmenu, 'accessctrl');
// submit button
echo '<input type="submit" value="' . get_string('addtoacl', 'mnet') . '" />';
echo "</form></div>\n";
// print errors
foreach ($formerror as $error) {
echo "<br><span class=\"error\">$error<span>";
}
print_simple_box_end();
admin_externalpage_print_footer();
?>
-182
View File
@@ -1,182 +0,0 @@
<?php
/**
* Library functions for mnet
*
* @author Donal McMullan donal@catalyst.net.nz
* @version 0.0.1
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mnet
*/
/**
* Parse a file to find out what functions/methods exist in it, and add entries
* for the remote-call-enabled functions to the database.
*
* The path to a file, e.g. auth/mnet/auth.php can be thought of as
* type/parentname/docname
*
* @param string $type mod, auth or enrol
* @param string $parentname Implementation of type, e.g. 'mnet' in the
* case of auth/mnet/auth.php
* @return bool True on success, else false
*/
function mnet_get_functions($type, $parentname) {
global $CFG;
$dataobject = new stdClass();
$docname = $type.'.php';
$publishes = array();
if ('mod' == $type) {
$docname = 'rpclib.php';
$relname = '/mod/'.$parentname.'/'.$docname;
$filename = $CFG->dirroot.$relname;
if (file_exists($filename)) include_once $filename;
$mnet_publishes = $parentname.'_mnet_publishes';
if (function_exists($mnet_publishes)) {
(array)$publishes = $mnet_publishes();
}
} else {
// auth or enrol
$relname = '/'.$type.'/'.$parentname.'/'.$docname;
$filename = $CFG->dirroot.$relname;
if (file_exists($filename)) include_once $filename;
$class = $type.($type=='enrol'? 'ment':'').'_plugin_'.$parentname;
if (class_exists($class)) {
$object = new $class();
if (method_exists($object, 'mnet_publishes')) {
(array)$publishes = $object->mnet_publishes();
}
}
}
$methodServiceArray = array();
foreach($publishes as $service) {
if (is_array($service['methods'])) {
foreach($service['methods'] as $methodname) {
$methodServiceArray[$methodname][] = $service;
}
}
}
// Disable functions that don't exist (any more) in the source
// Should these be deleted? What about their permissions records?
$rpcrecords = get_records_select('mnet_rpc', ' parent=\''.$parentname.'\' AND parent_type=\''.$type.'\' ', 'function_name ASC ');
if (!empty($rpcrecords)) {
foreach($rpcrecords as $rpc) {
if (!array_key_exists($rpc->function_name, $methodServiceArray)) {
$rpc->enabled = 0;
update_record('mnet_rpc', $rpc);
}
}
}
if (!file_exists($filename)) return false;
if (extension_loaded('tokenizer')) {
include_once "$CFG->dirroot/$CFG->admin/mnet/MethodTable.php";
$functions = (array)MethodTable::create($filename,false);
}
foreach($methodServiceArray as $method => $servicearray) {
if (!empty($functions[$method])) {
$details = $functions[$method];
$profile = $details['arguments'];
if (!isset($details['returns'])) {
array_unshift($profile, array('type' => 'void', 'description' => 'No return value'));
} else {
array_unshift($profile, $details['returns']);
}
$dataobject->profile = serialize($profile);
$dataobject->help = addslashes($details['description']);
} else {
$dataobject->profile = serialize(array(array('type' => 'void', 'description' => 'No return value')));
$dataobject->help = '';
}
$dataobject->function_name = $method;
$dataobject->xmlrpc_path = $type.'/'.$parentname.'/'.$docname.'/'.$method;
$dataobject->parent_type = $type;
$dataobject->parent = $parentname;
$dataobject->enabled = '0';
if ($record_exists = get_record('mnet_rpc', 'xmlrpc_path', $dataobject->xmlrpc_path)) {
$dataobject->id = $record_exists->id;
$dataobject->enabled = $record_exists->enabled;
update_record('mnet_rpc', $dataobject);
} else {
$dataobject->id = insert_record('mnet_rpc', $dataobject, true);
}
foreach($servicearray as $service) {
$serviceobj = get_record('mnet_service', 'name', $service['name']);
if (false == $serviceobj) {
$serviceobj = new stdClass();
$serviceobj->name = $service['name'];
$serviceobj->apiversion = $service['apiversion'];
$serviceobj->offer = 1;
$serviceobj->id = insert_record('mnet_service', $serviceobj, true);
}
if (false == get_record('mnet_service2rpc', 'rpcid', $dataobject->id, 'serviceid', $serviceobj->id)) {
$obj = new stdClass();
$obj->rpcid = $dataobject->id;
$obj->serviceid = $serviceobj->id;
insert_record('mnet_service2rpc', $obj, true);
}
}
}
return true;
}
function upgrade_RPC_functions($returnurl) {
global $CFG;
$basedir = $CFG->dirroot.'/mod';
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
continue;
}
if (filetype($basedir .'/'. $dir) != 'dir') {
continue;
}
mnet_get_functions('mod', $dir);
}
}
$basedir = $CFG->dirroot.'/auth';
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
continue;
}
if (filetype($basedir .'/'. $dir) != 'dir') {
continue;
}
mnet_get_functions('auth', $dir);
}
}
$basedir = $CFG->dirroot.'/enrol';
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
continue;
}
if (filetype($basedir .'/'. $dir) != 'dir') {
continue;
}
mnet_get_functions('enrol', $dir);
}
}
}
?>
-55
View File
@@ -1,55 +0,0 @@
<?php
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => get_string('mnetsettings', 'mnet'), 'link' => "$CFG->wwwroot/$CFG->admin/mnet/index.php", 'type' => 'misc');
$navlinks[] = array('name' => get_string('deletehost', 'mnet'), 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strmnetsettings", "$site->fullname", $navigation);
print_heading(get_string('mnetsettings', 'mnet'));
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<table class="generalbox standard" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header" cellpadding="0"><span><?php print_string('deleteaserver', 'mnet'); ?>Deleting a Server</span></td>
</tr>
<?php
if (count($warn) > 0){
?>
<tr valign="top">
<td align="right" colspan="2"><?php print_string('receivedwarnings','mnet'); ?>:<br />
<?php foreach($warn as $warning) echo $warning .'<br />'; ?>
</td>
</tr>
<?php
}
?>
<tr valign="top">
<td colspan="2"><?php print_string('reallydeleteserver','mnet'); ?>: "<?php echo $mnet_peer->name; ?>"?</td>
</tr>
<tr valign="top">
<td width="80">
<form method="post" action="delete.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="hostid" value="<?php echo $mnet_peer->id; ?>" />
<input type="hidden" name="step" value="delete" />
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
</form>
</td>
<td>
<form method="get" action="index.php">
<input type="submit" name="ignore" value="<?php print_string('cancel'); ?>"/>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?php
print_footer();
?>
-48
View File
@@ -1,48 +0,0 @@
<?PHP // $Id$
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
include_once($CFG->dirroot.'/mnet/lib.php');
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmnetsettings = get_string('mnetsettings', 'mnet');
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!$site = get_site()) {
print_error('nosite', '', '', NULL, true);
}
/// Initialize variables.
// Step must be one of:
// input Parse the details of a new host and fetch its public key
// commit Save our changes (to a new OR existing host)
$step = optional_param('step', 'verify', PARAM_ALPHA);
$hostid = required_param('hostid', PARAM_INT);
$warn = array();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
redirect('index.php', get_string('postrequired','mnet') ,7);
}
if ('verify' == $step) {
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$live_users = $mnet_peer->count_live_sessions();
if ($live_users > 0) {
$warn[] = get_string('usersareonline', 'mnet', $live_users);
}
include('delete.html');
} elseif ('delete' == $step) {
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$mnet_peer->delete();
redirect('peers.php', get_string('hostdeleted', 'mnet'), 5);
}
?>
-104
View File
@@ -1,104 +0,0 @@
<form id="assignform" method="post" action="">
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
<input type="hidden" name="host" value="<?php p($mnet_peer->id) ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
<table class="generaltable" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<?php print_string('existingusers', 'role', count($mnetenrolledusers)); ?>
</td>
<td></td>
<td valign="top">
<?php print_string('potentialusers', 'role', $availableusers->_numOfRows); ?>
</td>
</tr>
<tr>
<td valign="top">
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=false;
getElementById('assignform').addselect.selectedIndex=-1;">
<?php
foreach ($mnetenrolledusers as $enrolleduser) {
$fullname = fullname($enrolleduser, true);
echo "<option value=\"$enrolleduser->id\">".s($fullname)." (".s($enrolleduser->rolename).")</option>\n";
}
?>
</select></td>
<td valign="top">
<br />
<input name="add" type="submit" id="add" value="&larr;" />
<br />
<input name="remove" type="submit" id="remove" value="&rarr;" />
<br />
</td>
<td valign="top">
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=false;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;">
<?php
if (!empty($searchtext)) {
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
while ($user = rs_fetch_next_record($availableusers)) {
if (!isset($enrolledusers[$user->id])) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
echo "</optgroup>\n";
} else {
if ($availableusers->_numOfRows > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else {
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
}
?>
</select>
<br />
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
onfocus ="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;
getElementById('assignform').addselect.selectedIndex=-1;"
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
if (keyCode == 13) {
getElementById('assignform').previoussearch.value=1;
getElementById('assignform').submit();
} " />
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
<?php
if (!empty($searchusers)) {
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
}
?>
</td>
</tr>
<tr>
<td valign="top"><?php print_string('otherenrolledusers', 'mnet'); ?>:<br />
<ul>
<?php
foreach ($remtenrolledusers as $enrolleduser) {
$fullname = fullname($enrolleduser, true);
print '<li>'
. s($fullname) . ' (' . s($enrolleduser->rolename) . ') '
. s($enrolleduser->enroltype)."</li>\n";
}
?></ul></td>
<td valign="top"></td>
<td valign="top"></td>
</tr>
</table>
</div>
</form>
-279
View File
@@ -1,279 +0,0 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
$mnethostid = required_param('host', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$mnet_peer = new mnet_peer();
if (!$mnet_peer->set_id($mnethostid)) {
print_error('hostcoursenotfound','mnet');
}
$course = get_record('mnet_enrol_course', 'id', $courseid, 'hostid', $mnet_peer->id);
if (empty($course)) {
print_error('hostcoursenotfound','mnet');
}
define("MAX_USERS_PER_PAGE", 5000);
$add = optional_param('add', 0, PARAM_BOOL);
$remove = optional_param('remove', 0, PARAM_BOOL);
$showall = optional_param('showall', 0, PARAM_BOOL);
$searchtext = optional_param('searchtext', '', PARAM_RAW); // search string
$previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$errors = array();
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
$baseurl = "remote_enrolment.php?courseid={$course->id}&amp;host={$mnet_peer->id}";
if (!empty($userid)) {
$baseurl .= '&amp;userid='.$userid;
}
/// Process incoming role assignment
if ($frm = data_submitted()) {
if ($add and !empty($frm->addselect) and confirm_sesskey()) {
$timemodified = time();
foreach ($frm->addselect as $adduser) {
if (!$adduser = clean_param($adduser, PARAM_INT)) {
continue;
}
if (! $enrolment->req_enrol_user($adduser, $course->id)) {
$errors[] = "Could not add user with id $adduser to course {$course->id}!";
}
}
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
foreach ($frm->removeselect as $removeuser) {
$removeuser = clean_param($removeuser, PARAM_INT);
if (! $enrolment->req_unenrol_user($removeuser, $course->id)) {
$errors[] = "Could not remove user with id $removeuser from course {$course->id}!";
}
}
} else if ($showall) {
$searchtext = '';
$previoussearch = 0;
}
}
/// Prepare data for users / enrolled users panes
/// Create a new request object
$mnet_request = new mnet_xmlrpc_client();
/// Pass it the path to the method that we want to execute
$mnet_request->set_method('enrol/mnet/enrol.php/course_enrolments');
$mnet_request->add_param($course->remoteid, 'int');
$mnet_request->send($mnet_peer);
$all_enrolled_users = $mnet_request->response;
unset($mnet_request);
$select = '';
$all_enrolled_usernames = '';
$timemodified = array();
/// List all the users (homed on this server) who are enrolled on the course
/// This will include mnet-enrolled users, and those who have enrolled
/// themselves, etc.
if (is_array($all_enrolled_users) && count($all_enrolled_users)) {
foreach($all_enrolled_users as $username => $data) {
$all_enrolled_usernames .= "'$username', ";
}
$select = ' u.username IN (' .substr($all_enrolled_usernames, 0, -2) .') AND ';
} else {
$all_enrolled_users = array();
}
/// Synch our mnet_enrol_assignments with remote server
$sql = "
SELECT
u.id,
u.firstname,
u.lastname,
u.username,
u.email,
a.enroltype,
a.id as enrolid,
COALESCE(a.hostid, 0) as wehaverecord,
a.courseid
FROM
{$CFG->prefix}user u
LEFT JOIN
{$CFG->prefix}mnet_enrol_assignments a
ON
a.userid = u.id AND a.courseid={$courseid}
WHERE
$select
u.deleted = 0 AND
u.confirmed = 1 AND
u.mnethostid = {$CFG->mnet_localhost_id}
ORDER BY
u.firstname ASC,
u.lastname ASC";
if (!$enrolledusers = get_records_sql($sql)) {
$enrolledusers = array();
}
foreach($enrolledusers as $user) {
$dataobj = new stdClass();
$dataobj->userid = $user->id;
$dataobj->hostid = $mnet_peer->id;
$dataobj->courseid = $courseid;
$dataobj->rolename = $all_enrolled_users[$user->username]['name'];
$dataobj->enroltype = $all_enrolled_users[$user->username]['enrol'];
if ($user->wehaverecord == 0) {
$dataobj->enroltime = $all_enrolled_users[$user->username]['timemodified'];
$dataobj->id = insert_record('mnet_enrol_assignments', $dataobj);
} elseif (array_key_exists($user->username, $all_enrolled_users)) {
$dataobj->id = $user->enrolid;
update_record('mnet_enrol_assignments', $dataobj);
} elseif (is_array($all_enrolled_users) && count($all_enrolled_users)) {
delete_record('mnet_enrol_assignments', 'id', $user->enrolid);
}
}
unset($enrolledusers);
// Read about our remote enrolments in 2 sets
// first, get the remote enrolments done via enrol/mnet $mnetenrolledusers
// second, get the remote enrolments done with other plugins $remtenrolledusers
// NOTE: both arrays are keyed on the userid!
$sql = "
SELECT
u.id,
u.firstname,
u.lastname,
a.rolename,
a.enroltype,
a.courseid
FROM
{$CFG->prefix}user u,
{$CFG->prefix}mnet_enrol_assignments a
WHERE
a.userid = u.id AND
a.courseid={$courseid} AND
a.enroltype = 'mnet' AND
u.deleted = 0 AND
u.confirmed = 1 AND
u.mnethostid = {$CFG->mnet_localhost_id}
ORDER BY
u.firstname ASC,
u.lastname ASC";
if (!$mnetenrolledusers = get_records_sql($sql)) {
$mnetenrolledusers = array();
}
$sql = "
SELECT
u.id,
u.firstname,
u.lastname,
a.rolename,
a.enroltype,
a.courseid
FROM
{$CFG->prefix}user u,
{$CFG->prefix}mnet_enrol_assignments a
WHERE
a.userid = u.id AND
a.courseid={$courseid} AND
a.enroltype != 'mnet' AND
u.deleted = 0 AND
u.confirmed = 1 AND
u.mnethostid = {$CFG->mnet_localhost_id}
ORDER BY
u.firstname ASC,
u.lastname ASC";
if (!$remtenrolledusers = get_records_sql($sql)) {
$remtenrolledusers = array();
}
$select = '';
$exclude = array_merge(array_keys($mnetenrolledusers), array_keys($remtenrolledusers));
$exclude[] = 0;
$select = 'AND u.username!=\'guest\' AND u.id NOT IN ('. join(',',$exclude) .') ';
unset($exclude);
$searchtext = trim($searchtext);
if ($searchtext !== '') { // Search for a subset of remaining users
$LIKE = sql_ilike();
$FULLNAME = sql_fullname();
$select .= " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
}
$sql = ('SELECT id, firstname, lastname, email
FROM '.$CFG->prefix.'user u
WHERE deleted = 0 AND confirmed = 1
AND mnethostid = '.$CFG->mnet_localhost_id.' '
.$select
.'ORDER BY lastname ASC, firstname ASC');
$availableusers = get_recordset_sql($sql, 0, MAX_USERS_PER_PAGE);
/// Print the page
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
/// Get some language strings
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strroletoassign = get_string('roletoassign', 'role');
$strcurrentcontext = get_string('currentcontext', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');
$strparticipants = get_string('participants');
$strsearchresults = get_string('searchresults');
admin_externalpage_print_header();
print_box('<strong>' . s($mnet_peer->name) . ' : '
. format_string($course->shortname) .' '. format_string($course->fullname)
. '</strong><br />'
. get_string("enrolcourseenrol_desc", "mnet"));
echo "<hr />";
include(dirname(__FILE__).'/enr_course_enrol.html');
if (!empty($errors)) {
$msg = '<p>';
foreach ($errors as $e) {
$msg .= $e.'<br />';
}
$msg .= '</p>';
notify($msg);
}
admin_externalpage_print_footer();
?>
-57
View File
@@ -1,57 +0,0 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
$mnethost = required_param('host', PARAM_INT);
$host = get_record('mnet_host', 'id', $mnethost);
$courses = $enrolment->fetch_remote_courses($mnethost);
/// Print the page
admin_externalpage_print_header();
print_box('<strong>' . s($host->name) . ' </strong><br />'
. get_string("enrolcourses_desc", "mnet"));
echo '<hr />';
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
. '<table class="generaltable">';
$icon = "<img src=\"$CFG->pixpath/i/course.gif\"".
" class=\"icon\" alt=\"".get_string("course")."\" />";
foreach ($courses as $course) {
$link = "$CFG->wwwroot/$CFG->admin/mnet/enr_course_enrol.php?"
. "host={$mnethost}&amp;courseid={$course->id}&amp;sesskey={$USER->sesskey}";
echo '<tr>'
. "<td>$icon</td>"
. "<td><a href=\"$link\">".format_string($course->fullname). "</a></td>"
. '</tr><tr>'
. '<td></td>'
. '<td>'.format_string($course->shortname). ' - ' .format_string($course->cat_name).'</td>'
. '</tr><tr>'
. '<td></td>'
. "<td align=\"left\" >{$course->summary}</td>"
. '</tr>';
}
echo '</table></div>';
admin_externalpage_print_footer();
?>
-61
View File
@@ -1,61 +0,0 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
/// Otherwise fill and print the form.
/// get language strings
admin_externalpage_print_header();
print_box(get_string("remoteenrolhosts_desc", "mnet"));
echo '<hr />';
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
print_box(get_string('mnetdisabled','mnet'));
}
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
. '<table cellspacing="0" cellpadding="5" id="hosts" class="generaltable generalbox" >'
. '<tr>'
. '<th class="header c0"> '.get_string('host', 'mnet').' </th>'
. '<th class="header c1"> '.get_string('enrolments', 'mnet').' </th>'
. '<th class="header c2"> '.get_string('courses', 'mnet').' </th>'
// . '<th class="header c3"> &nbsp; </th>'
. '</tr>';
$hosts = $enrolment->list_remote_servers();
foreach ($hosts as $host) {
$coursesurl = "$CFG->wwwroot/$CFG->admin/mnet/enr_courses.php?host={$host->id}&amp;sesskey={$USER->sesskey}";
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
if (empty($coursecount)) {
$coursecount = '?';
}
$enrolcount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_assignments WHERE hostid={$host->id}");
echo '<tr>'
. "<td><a href=\"{$coursesurl}\">{$host->name}</a></td>"
. "<td align=\"center\" >$enrolcount</td>"
. "<td align=\"center\" >$coursecount - <a href=\"{$coursesurl}\">".get_string('editenrolments', 'mnet')."</a></td>"
// TODO: teach report/log/index.php to show per-host-logs
// . '<td align="center" ><a href="$CFG->wwwroot/$CFG->admin/report/log/index.php?course_host={$host->id}">'
// . get_string('logs', 'mnet').'</a> </td>'
. '</tr>';
}
echo '</table>'
. '</div>';
admin_externalpage_print_footer();
?>
-151
View File
@@ -1,151 +0,0 @@
<?PHP // $Id$
// Allows the admin to configure mnet stuff
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('net');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!extension_loaded('openssl')) {
admin_externalpage_print_header();
set_config('mnet_dispatcher_mode', 'off');
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
if (!$site = get_site()) {
admin_externalpage_print_header();
set_config('mnet_dispatcher_mode', 'off');
print_error('nosite', '', '', NULL, true);
}
if (!function_exists('curl_init') ) {
admin_externalpage_print_header();
set_config('mnet_dispatcher_mode', 'off');
print_error('nocurl', 'mnet', '', NULL, true);
}
if (!isset($CFG->mnet_dispatcher_mode)) {
set_config('mnet_dispatcher_mode', 'off');
}
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
if (!empty($form->submit) && $form->submit == get_string('savechanges')) {
if (in_array($form->mode, array("off", "strict", "dangerous"))) {
if (set_config('mnet_dispatcher_mode', $form->mode)) {
redirect('index.php', get_string('changessaved'));
} else {
error('Invalid action parameter.', 'index.php');
}
}
} elseif (!empty($form->submit) && $form->submit == get_string('delete')) {
$MNET->get_private_key();
$_SESSION['mnet_confirm_delete_key'] = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time();
notice_yesno(get_string("deletekeycheck", "mnet"),
"index.php?sesskey=$USER->sesskey&amp;confirm=".md5($MNET->public_key),
"index.php",
array('sesskey' => $USER->sesskey),
NULL,
'post',
'get');
exit;
} else {
// We're deleting
if (!isset($_SESSION['mnet_confirm_delete_key'])) {
// fail - you're being attacked?
}
$key = '';
$time = '';
@list($key, $time) = explode(':',$_SESSION['mnet_confirm_delete_key']);
$MNET->get_private_key();
if($time < time() - 60) {
// fail - you're out of time.
print_error ('deleteoutoftime', 'mnet', 'index.php');
exit;
}
if ($key != md5(sha1($MNET->keypair['keypair_PEM']))) {
// fail - you're being attacked?
print_error ('deletewrongkeyvalue', 'mnet', 'index.php');
exit;
}
$MNET->replace_keys();
redirect('index.php', get_string('keydeleted','mnet'));
exit;
}
}
$hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' );
admin_externalpage_print_header();
?>
<center>
<form method="post" action="index.php">
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header" cellpadding="0"><?php print_string('aboutyourhost', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('publickey', 'mnet'); ?>:</td>
<td><pre><?php echo $MNET->public_key; ?></pre></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('expires', 'mnet'); ?>:</td>
<td><?php echo userdate($MNET->public_key_expires); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('net', 'mnet'); ?>:</td>
<td><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="radio" name="mode" value="off" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('off', 'mnet'); ?> <br />
<input type="radio" name="mode" value="strict" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('on', 'mnet'); ?><br />
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<form method="post" action="index.php">
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header" cellpadding="0"><?php print_string('expireyourkey', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td colspan="2" cellpadding="0"><?php print_string('expireyourkeyexplain', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td align="left" width="10" nowrap="nowrap"><?php print_string('expireyourkey', 'mnet'); ?></td>
<td align="left"><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="deleteKey" value="" />
<input type="submit" name="submit" value="<?php print_string('delete'); ?>" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</center>
<?php
admin_externalpage_print_footer();
?>
-140
View File
@@ -1,140 +0,0 @@
<?php
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
admin_externalpage_print_header();
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
if ($mnet_peer->application->name == 'moodle') {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
} else {
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
}
print_tabs(array($tabs), 'mnetdetails');
print_simple_box_start("center", "");
?>
<form method="post" action="peers.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="step" value="commit" />
<input type="hidden" name="last_connect_time" value="<?php echo $mnet_peer->last_connect_time; ?>" />
<input type="hidden" name="id" value="<?php echo isset($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
<input type="hidden" name="applicationid" value="<?php echo isset($mnet_peer->applicationid)? $mnet_peer->applicationid : '0' ; ?>" />
<input type="hidden" name="applicationname" value="<?php echo isset($mnet_peer->application->name)? $mnet_peer->application->name : '' ; ?>" />
<table cellpadding="9" cellspacing="0" width="635">
<tr>
<td align="right" valign="top"><?php print_string('site'); ?>:</td>
<td valign="top"><input type="text" name="name" size="30" value="<?php echo $mnet_peer->name; ?>" /></td>
</tr>
<tr>
<td align="right" valign="top"><?php print_string('hostname', 'mnet'); ?>:</td>
<td valign="top"><input type="text" name="wwwroot" size="30" value="<?php echo $mnet_peer->wwwroot; ?>" /></td>
</tr>
<?php
if (empty($mnet_peer->public_key)) $mnet_peer->public_key = '';
?>
<tr>
<td align="right" valign="top"><?php
print_string('publickey', 'mnet');
echo ': <br />';
helpbutton("publickey", get_string('publickey', 'mnet'), "mnet", true, true);
?></td>
<?php
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0) {
$key = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application->xmlrpc_server_url);
$mnet_peer->public_key = clean_param($key, PARAM_PEM);
}
?>
<td valign="top">
<?php
if (empty($mnet_peer->public_key)) {
print_string('nopubkey', 'mnet');
}
?><br />
<textarea rows="17" cols="65" name="public_key" style="font-size: 8px;"><?php echo $mnet_peer->public_key; ?></textarea>
</td>
</tr>
<tr>
<td align="right" valign="top"><?php print_string('expires', 'mnet'); ?>:</td>
<td valign="top">
<?php
if($mnet_peer->public_key_expires < time()) {
print_string('expired', 'mnet');
echo ' ';
}
echo userdate($mnet_peer->public_key_expires);
?>
</td>
</tr>
<?php
if(!empty($currentkey)) {
?>
<tr>
<td align="right" valign="top"></td>
<td valign="top"><?php print_string('keymismatch', 'mnet'); ?></td>
</tr>
<tr>
<td align="right" valign="top"><?php print_string('currentkey', 'mnet'); ?>:</td>
<td valign="top"><pre style="font-size: 8px;"><?php echo $currentkey;?></pre></td>
</tr>
<?php
}
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
?>
<tr>
<td align="right" valign="top"><?php print_string('last_connect_time', 'mnet'); ?>:</td>
<td valign="top"><?php echo ($mnet_peer->last_connect_time == 0)? get_string('never','mnet') : date('H:i:s d/m/Y',$mnet_peer->last_connect_time);?></td>
</tr>
<?php
}
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0){
?>
<tr>
<td align="right" valign="top"><?php print_string('deleted'); ?>:</td>
<td valign="top">
<input type="radio" name="deleted" value="0" checked="checked" /> <?php print_string('reenableserver','mnet'); ?><br />
<input type="radio" name="deleted" value="1" /> <?php print_string('yes'); ?><br />
</td>
</tr>
<?php
}
if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
?>
<tr>
<td align="right" valign="top"><?php print_string('ipaddress', 'mnet');
echo ': <br />';
helpbutton("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true, true);
?>:</td>
<td valign="top"><?php echo $mnet_peer->ip_address; ?></td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td><input type="submit" value="<?php print_string("savechanges"); ?>" /></td>
</tr>
</table>
</div>
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
-23
View File
@@ -1,23 +0,0 @@
<?php
admin_externalpage_print_header();
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
print_tabs(array($tabs), 'mnetdetails');
print_simple_box_start("center", "");
?>
<table cellpadding="9" cellspacing="0" >
<tr>
<td align="right" valign="top"><?php print_string('site'); ?>:</td>
<td valign="top"><?php echo $mnet_peer->name; ?></td>
</tr>
<tr>
<td align="right" valign="top" colspan="2"><?php print_string('allhosts_no_options'); ?>:</td>
</tr>
</table>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
-103
View File
@@ -1,103 +0,0 @@
<?php
admin_externalpage_print_header();
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
if ($mnet_peer->id != $CFG->mnet_all_hosts_id && $mnet_peer->application->name == 'moodle') {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
print_tabs(array($tabs), 'mnetservices');
print_simple_box_start("center", "");
?>
<form method="post" action="mnet_services.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="step" value="<?php echo $mnet_peer->nextstep; ?>" />
<input type="hidden" name="hostid" value="<?php echo ($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
<table cellpadding="9" cellspacing="0" >
<?php
foreach($myservices as $name => $versions) {
$version = current($versions);
?>
<tr>
<td align="left" valign="top" colspan="2">
<h3><?php echo get_string($name.'_name', $version['parent_type'].'_'.$version['parent'] , $mnet_peer->name); ?></h3>
<?php echo get_string($name.'_description', $version['parent_type'].'_'.$version['parent'], $mnet_peer->name); ?>
<?php
$breakstring = '';
foreach($versions as $version){
if (count($versions) > 1) {
$versionstring = '('.get_string('version','mnet') .' '.$version['apiversion'].')';
} else {
$versionstring = '';
}
echo $breakstring;
?>
<input type="hidden" name="exists[<?php echo $version['serviceid']; ?>]" value="1" />
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked="checked" ': '' ; ?>/>
<?php
print_string('publish','mnet');
echo $versionstring;
if (!empty($version['hostsubscribes'])) {
echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">&radic;</a> ';
}
if (!empty($version['allhosts_publish'])) {
print_string("enabled_for_all",'mnet',!empty($version['I_publish']));
}
echo '<br />';
?>
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked="checked" ': '' ; ?>/>
<?php
print_string('subscribe','mnet');
echo $versionstring;
if (!empty($version['hostpublishes'])) {
echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">&radic;</a> ';
}
if (!empty($version['allhosts_subscribe'])) {
print_string("enabled_for_all",'mnet',!empty($version['I_subscribe']));
}
echo '<br />';
$breakstring = '. . . . . . . . . . . . . . . . . . . . . . . . <br>';
} // end foreach
?>
</td>
</tr>
<?php
} // end foreach
?>
<tr>
<td align="left" valign="top" colspan="2">
<div id="pubTreeLoc"></div>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">
<div id="subTreeLoc"></div>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">
<div id="formElements"><input type="hidden" name="outer" value="4" /></div>
</td>
</tr>
</table>
</div>
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
-183
View File
@@ -1,183 +0,0 @@
<?php
// Allows the admin to configure services for remote hosts
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!$site = get_site()) {
print_error('nosite', '', '', NULL, true);
}
/// Initialize variables.
// Step must be one of:
// input Parse the details of a new host and fetch its public key
// commit Save our changes (to a new OR existing host)
// force Go ahead with something we've been warned is strange
$step = optional_param('step', NULL, PARAM_ALPHA);
$hostid = optional_param('hostid', NULL, PARAM_INT);
$nocertstring = '';
$nocertmatch = '';
$badcert = '';
$certerror = '';
$noipmatch = '';
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmnetsettings = get_string('mnetsettings', 'mnet');
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetthemes = get_string('mnetthemes', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$strmneteditservices = get_string('reviewhostservices', 'mnet');
$mnet_peer = new mnet_peer();
if (($form = data_submitted()) && confirm_sesskey()) {
$mnet_peer->set_id($hostid);
$treevals = array();
foreach($_POST['exists'] as $key => $value) {
$host2service = get_record('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
$publish = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
$subscribe = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
if ($publish != 1 && $subscribe != 1) {
if (false == $host2service) {
// We don't have or need a record - do nothing!
} else {
// We don't need the record - delete it
delete_records('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
}
} elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
$host2service = new stdClass();
$host2service->hostid = $_POST['hostid'];
$host2service->serviceid = $key;
$host2service->publish = $publish;
$host2service->subscribe = $subscribe;
$host2service->id = insert_record('mnet_host2service', $host2service);
} elseif ($host2service->publish != $publish || $host2service->subscribe != $subscribe) {
$host2service->publish = $publish;
$host2service->subscribe = $subscribe;
$tf = update_record('mnet_host2service', $host2service);
}
}
}
if (is_int($hostid)) {
if (0 == $mnet_peer->id) $mnet_peer->set_id($hostid);
$mnet_peer->nextstep = 'verify';
$id_list = $mnet_peer->id;
if (!empty($CFG->mnet_all_hosts_id)) {
$id_list .= ', '.$CFG->mnet_all_hosts_id;
}
$concat = sql_concat('COALESCE(h2s.id,0) ', ' \'-\' ', ' svc.id');
$query = "
SELECT DISTINCT
$concat as id,
svc.id as serviceid,
svc.name,
svc.offer,
svc.apiversion,
r.parent_type,
r.parent,
h2s.hostid,
h2s.publish,
h2s.subscribe
FROM
{$CFG->prefix}mnet_service2rpc s2r,
{$CFG->prefix}mnet_rpc r,
{$CFG->prefix}mnet_service svc
LEFT JOIN
{$CFG->prefix}mnet_host2service h2s
ON
h2s.hostid in ($id_list) AND
h2s.serviceid = svc.id
WHERE
svc.offer = '1' AND
s2r.serviceid = svc.id AND
s2r.rpcid = r.id
ORDER BY
svc.name ASC";
$resultset = get_records_sql($query);
if (is_array($resultset)) {
$resultset = array_values($resultset);
} else {
$resultset = array();
}
require_once $CFG->dirroot.'/mnet/xmlrpc/client.php';
$remoteservices = array();
if ($hostid != $CFG->mnet_all_hosts_id) {
// Create a new request object
$mnet_request = new mnet_xmlrpc_client();
// Tell it the path to the method that we want to execute
$mnet_request->set_method('system/listServices');
$mnet_request->send($mnet_peer);
if (is_array($mnet_request->response)) {
foreach($mnet_request->response as $service) {
$remoteservices[$service['name']][$service['apiversion']] = $service;
}
}
}
$myservices = array();
foreach($resultset as $result) {
$result->hostpublishes = false;
$result->hostsubscribes = false;
if (isset($remoteservices[$result->name][$result->apiversion])) {
if ($remoteservices[$result->name][$result->apiversion]['publish'] == 1) {
$result->hostpublishes = true;
}
if ($remoteservices[$result->name][$result->apiversion]['subscribe'] == 1) {
$result->hostsubscribes = true;
}
}
if (empty($myservices[$result->name][$result->apiversion])) {
$myservices[$result->name][$result->apiversion] = array('serviceid' => $result->serviceid,
'name' => $result->name,
'offer' => $result->offer,
'apiversion' => $result->apiversion,
'parent_type' => $result->parent_type,
'parent' => $result->parent,
'hostsubscribes' => $result->hostsubscribes,
'hostpublishes' => $result->hostpublishes
);
}
// allhosts_publish allows us to tell the admin that even though he
// is disabling a service, it's still available to the host because
// he's also publishing it to 'all hosts'
if ($result->hostid == $CFG->mnet_all_hosts_id && $CFG->mnet_all_hosts_id != $mnet_peer->id) {
$myservices[$result->name][$result->apiversion]['allhosts_publish'] = $result->publish;
$myservices[$result->name][$result->apiversion]['allhosts_subscribe'] = $result->subscribe;
} elseif (!empty($result->hostid)) {
$myservices[$result->name][$result->apiversion]['I_publish'] = $result->publish;
$myservices[$result->name][$result->apiversion]['I_subscribe'] = $result->subscribe;
}
}
} else {
redirect('peers.php', get_string('nohostid','mnet'), '5');
exit;
}
include('./mnet_services.html');
?>
-127
View File
@@ -1,127 +0,0 @@
<?php
admin_externalpage_print_header();
print_heading(get_string('themes'));
$original_theme = fullclone($THEME);
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
if ($mnet_peer->id != $CFG->mnet_all_hosts_id) {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
print_tabs(array($tabs), 'mnetthemes');
$themes = get_list_of_plugins("theme");
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">";
if (count($report)) {
echo '<tr>';
echo '<td align="center" colspan="2">';
echo '<span class="'.$report[1].'">'.$report[0].'</span>';
echo '</td>';
echo '</tr>';
}
if (!$USER->screenreader) {
echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th>";
echo "<th scope=\"col\">$strinfo</th></tr>";
}
echo "<tr>";
echo '<td align="center"><span class="informationbox">Choose this option to use your site\'s default theme: <strong>'.$CFG->theme.'</strong>.</span></td>';
if ($mnet_peer->theme == '') {
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
} else {
echo '<td valign="top">';
}
echo '<p style="font-size:1.5em;font-style:bold;">Site Theme</p>';
$options = null;
$options['choose'] = $unlikely_name;// Something unlikely to ever be a theme name... initially $unlikely_name = 'ZoqZoqZ';
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
print_single_button('mnet_themes.php', $options, $strchoose);
echo '</td>';
echo "</tr>";
foreach ($themes as $theme) {
unset($THEME);
if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder
continue;
}
include($CFG->themedir.'/'.$theme.'/config.php');
$readme = '';
$screenshot = '';
$screenshotpath = '';
if (file_exists($CFG->themedir.'/'.$theme.'/README.html')) {
$readme = '<li>'.
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
} else if (file_exists($CFG->themedir.'/'.$theme.'/README.txt')) {
$readme = '<li>'.
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
}
if (file_exists("$theme/screenshot.png")) {
$screenshotpath = "$theme/screenshot.png";
} else if (file_exists("$theme/screenshot.jpg")) {
$screenshotpath = "$theme/screenshot.jpg";
}
echo "<tr>";
// no point showing this if user is using screen reader
if (!$USER->screenreader) {
echo "<td align=\"center\">";
if ($screenshotpath) {
$screenshot = '<li><a href='.$CFG->wwwroot .'/theme/'. $theme.'/screenshot.jpg">'.$strscreenshot.'</a></li>';
echo "<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object></td>";
} else {
echo '<object type="text/html" data="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'" height="200" width="400">'.$theme.'</object></td>';
}
}
if ($mnet_peer->theme == $theme) {
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
} else {
echo '<td valign="top">';
}
if (isset($THEME->sheets)) {
echo '<p style="font-size:1.5em;font-style:bold;">'.$theme.'</p>';
} else {
echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
}
if ($screenshot or $readme) {
echo '<ul>';
if (!$USER->screenreader) {
echo '<li><a href="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'">'.$strpreview.'</a></li>';
}
echo $screenshot.$readme;
echo '</ul>';
}
$options = null;
$options['choose'] = $theme;
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
print_single_button('mnet_themes.php', $options, $strchoose);
echo '</td>';
echo "</tr>";
}
echo "</table>";
$THEME = $original_theme;
admin_externalpage_print_footer();
?>
-78
View File
@@ -1,78 +0,0 @@
<?php
// Allows the admin to configure services for remote hosts
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!$site = get_site()) {
print_error('nosite', '', '', NULL, true);
}
/// Initialize variables.
$hostid = required_param('hostid', PARAM_INT);
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$strmnetsettings = get_string('mnetsettings', 'mnet');
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetthemes = get_string('mnetthemes', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$mnet_peer = new mnet_peer();
if (is_int($hostid)) {
$mnet_peer->set_id($hostid);
}
$choose = optional_param("choose",'',PARAM_FILE); // set this theme as default
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strthemes = get_string("themes");
$strpreview = get_string("preview");
$strchoose = get_string("choose");
$strinfo = get_string("info");
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
$strscreenshot = get_string("screenshot");
$stroldtheme = get_string("oldtheme");
$report = array();
$unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
if ($choose) {
if (confirm_sesskey()) {
if ($choose == $unlikely_name) {
$mnet_peer->force_theme = 1;
$mnet_peer->theme = '';
if ($mnet_peer->commit()) {
$report = array(get_string('themesaved'), 'informationbox');
} else {
$report = array(get_string('themesavederror', 'mnet'), 'errorbox');
}
} elseif (!is_dir($CFG->themedir .'/'. $choose) || !file_exists($CFG->themedir .'/'. $choose .'/config.php')) {
echo 'CHOOSE -'.$choose.' '. $CFG->themedir .'/'. $choose .'/config.php' ;
$report = array('This theme is not installed!'.'3', 'errorbox');
} else {
$mnet_peer->force_theme = 1;
$mnet_peer->theme = addslashes($choose);
if ($mnet_peer->commit()) {
$report = array(get_string('themesaved').'1', 'informationbox');
} else {
$report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
}
}
}
}
$adminroot = admin_get_root();
require('./mnet_themes.html');
?>
-101
View File
@@ -1,101 +0,0 @@
<?php
admin_externalpage_print_header();
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
print_box(get_string('mnetdisabled','mnet'));
}
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<form method="post" action="peers.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="updateregisterall" value="1" />
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
<tr>
<th class="header c0" colspan="2"><?php print_string('registerallhosts', 'mnet'); ?></th>
</tr>
<tr>
<td class="cell c1" colspan="2"><?php print_string('registerallhostsexplain', 'mnet'); ?></td>
</tr>
<tr>
<td class="cell c1"><input type="checkbox" name="registerallhosts" <?php if (!empty($CFG->mnet_register_allhosts)) echo 'checked="checked" '; ?>/></td>
<td class="cell c1"> <?php print_string('registerallhosts', 'mnet'); ?> </td>
</tr>
<tr>
<td align="right" colspan="2"><input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" /></td>
</tr>
</table>
</div>
</form>
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
<tr>
<th class="header c0"><?php print_string('site'); ?></th>
<th class="header c1"><?php print_string('system','mnet'); ?></th>
<th class="header c2"><?php print_string('last_connect_time', 'mnet'); ?></th>
<th class="header c3"></th>
</tr>
<?php
foreach($hosts as $host) {
if ($host->last_connect_time == 0) {
$last_connect = get_string('never');
} else {
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
}
?>
<tr>
<td class="cell c0"><a href="peers.php?step=update&amp;hostid=<?php echo $host->id; ?>"><?php echo $host->name; ?></a></td>
<td class="cell c1"><a href="peers.php?step=update&amp;hostid=<?php echo $host->id; ?>"><?php echo $host->wwwroot; ?></a></td>
<td class="cell c2"><?php if ($host->id != $CFG->mnet_all_hosts_id) echo $last_connect; ?></td>
<td class="cell c3">
<?php if ($host->id != $CFG->mnet_all_hosts_id){ ?>
<form method="post" action="delete.php">
<div>
<input type="hidden" name="hostid" value="<?php echo $host->id; ?>" />
<input type="hidden" name="step" value="verify" />
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
</div>
</form>
<?php } ?>
</td>
</tr>
<?php
}
?>
</table>
<form method="post" action="peers.php">
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
<tr>
<th class="header c4" colspan="4">
<?php print_string('addnewhost', 'mnet'); ?>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="step" value="input" />
</th>
</tr>
<tr>
<td class="cell c0">wwwroot:</td>
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
<td class="cell c2">
<select name="applicationid">
<?php
foreach($applications as $application) {
echo ' <option value="'.$application->id.'">'.$application->display_name."</option>\n";
}
?>
</select>
</td>
<td class="cell c3"></td>
</tr>
<tr>
<td class="cell c4" align="right" colspan="4"><input type="submit" value="<?php print_string('addhost','mnet'); ?>" /></td>
</tr>
</table>
</form>
</div>
<?php
admin_externalpage_print_footer();
?>
-182
View File
@@ -1,182 +0,0 @@
<?PHP // $Id$
// Allows the admin to configure other Moodle hosts info
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!extension_loaded('openssl')) {
admin_externalpage_print_header();
print_error('requiresopenssl', 'mnet');
}
if (!$site = get_site()) {
admin_externalpage_print_header();
print_error('nosite', '');
}
if (!function_exists('curl_init') ) {
admin_externalpage_print_header();
print_error('nocurl', 'mnet');
}
/// Initialize variables.
// Step must be one of:
// input Parse the details of a new host and fetch its public key
// commit Save our changes (to a new OR existing host)
$step = optional_param('step', NULL, PARAM_ALPHA);
$hostid = optional_param('hostid', NULL, PARAM_INT);
// Fetch some strings for the HTML templates
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$strmnetthemes = get_string('mnetthemes', 'mnet');
if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
if (!empty($form->wwwroot)) {
// ensure we remove trailing slashes
$form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
// ensure the wwwroot starts with a http or https prefix
if (strtolower(substr($form->wwwroot, 0, 4)) != 'http') {
$form->wwwroot = 'http://'.$form->wwwroot;
}
}
if(!function_exists('xmlrpc_encode_request')) {
trigger_error("You must have xml-rpc enabled in your PHP build to use this feature.");
print_error('xmlrpc-missing', 'mnet','peers.php');
exit;
}
if (!empty($form->updateregisterall)) {
if (!empty($form->registerallhosts)) {
set_config('mnet_register_allhosts',1);
} else {
set_config('mnet_register_allhosts',0);
}
redirect('peers.php', get_string('changessaved'));
} else {
$mnet_peer = new mnet_peer();
if (!empty($form->id)) {
$form->id = clean_param($form->id, PARAM_INT);
$mnet_peer->set_id($form->id);
} else {
// PARAM_URL requires a genuine TLD (I think) This breaks my testing
$temp_wwwroot = clean_param($form->wwwroot, PARAM_URL);
if ($temp_wwwroot !== $form->wwwroot) {
trigger_error("We now parse the wwwroot with PARAM_URL. Your URL will need to have a valid TLD, etc.");
print_error("invalidurl", 'mnet','peers.php');
exit;
}
unset($temp_wwwroot);
$mnet_peer->set_applicationid($form->applicationid);
$application = get_field('mnet_application', 'name', 'id', $form->applicationid);
$mnet_peer->bootstrap($form->wwwroot, null, $application);
}
if (isset($form->name) && $form->name != $mnet_peer->name) {
$form->name = clean_param($form->name, PARAM_NOTAGS);
$mnet_peer->set_name($form->name);
}
if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
$mnet_peer->deleted = $form->deleted;
}
if (isset($form->public_key)) {
$form->public_key = clean_param($form->public_key, PARAM_PEM);
if (empty($form->public_key)) {
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&amp;hostid='.$mnet_peer->id);
exit;
} else {
$oldkey = $mnet_peer->public_key;
$mnet_peer->public_key = $form->public_key;
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
if ($mnet_peer->public_key_expires == false) {
$mnet_peer->public_key == $oldkey;
$errmsg = '<br />';
foreach ($mnet_peer->error as $err) {
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
}
error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&amp;hostid='.$mnet_peer->id);
//print_error("invalidpubkey", 'mnet', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $errmsg);
exit;
}
}
}
// PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
if ('input' == $form->step) {
if ( isset($mnet_peer->id) && $mnet_peer->id > 0 ) {
print_error("hostexists", 'mnet', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $mnet_peer->id);
}
}
if ('input' == $form->step) {
include('./mnet_review.html');
} elseif ('commit' == $form->step) {
$bool = $mnet_peer->commit();
if ($bool) {
redirect('peers.php?step=update&amp;hostid='.$mnet_peer->id, get_string('changessaved'));
} else {
error('Invalid action parameter.', 'index.php');
}
}
}
} elseif (is_int($hostid)) {
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
if($currentkey == $mnet_peer->public_key) unset($currentkey);
$form = new stdClass();
if ($hostid != $CFG->mnet_all_hosts_id) {
include('./mnet_review.html');
} else {
include('./mnet_review_allhosts.html');
}
} else {
$hosts = get_records_sql(' SELECT
h.id,
h.wwwroot,
h.ip_address,
h.name,
h.public_key,
h.public_key_expires,
h.transport,
h.portno,
h.last_connect_time,
h.last_log_id,
h.applicationid,
a.name as app_name,
a.display_name as app_display_name,
a.xmlrpc_server_url
FROM
'.$CFG->prefix.'mnet_host h,
'.$CFG->prefix.'mnet_application a
WHERE
h.id != \''.$CFG->mnet_localhost_id.'\' AND
h.deleted = \'0\' AND
h.applicationid=a.id');
if (empty($hosts)) $hosts = array();
$applications = get_records('mnet_application');
include('./peers.html');
}
?>
-68
View File
@@ -1,68 +0,0 @@
<?php
admin_externalpage_print_header();
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
<tr>
<th class="header c0" colspan="2"><?php print_string('trustedhosts', 'mnet'); ?></th>
</tr>
<tr>
<td class="cell c1" colspan="2"><?php print_string('trustedhostsexplain', 'mnet'); ?></td>
</tr>
<tr>
<td class="cell c1" colspan="2">
<form method="post" action="trustedhosts.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<textarea name="hostlist" cols="40" rows="20"><?php echo $trusted_hosts; ?></textarea><br />
<input type="submit" value="<?php print_string('savechanges'); ?>" />
</div>
</form>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
<tr>
<th class="header c0" colspan="2"><?php print_string('testtrustedhosts', 'mnet'); ?></th>
</tr>
<?php
if (!empty($test_ip_address)){
?>
<tr>
<td class="cell c1" colspan="2">
<?php
if ($in_range) {
print_string('is_in_range', 'mnet', $test_ip_address);
echo '<br />';
print_string('validated_by', 'mnet', $validated_by);
} else {
print_string('not_in_range', 'mnet', $test_ip_address);
}
?>
</td>
</tr>
<?php
} else {
?>
<tr>
<td class="cell c1" colspan="2"><?php print_string('testtrustedhostsexplain', 'mnet'); ?></td>
</tr>
<?php
}
?>
<tr>
<td class="cell c1" colspan="2">
<form method="get" action="trustedhosts.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="text" name="testipaddress" value="<?php echo $test_ip_address; ?>" />
<input type="submit" value="<?php print_string('go'); ?>" />
</div>
</form>
</td>
</tr>
</table>
</div>
<?php
admin_externalpage_print_footer();
?>
-71
View File
@@ -1,71 +0,0 @@
<?php
// Allows the admin to configure services for remote hosts
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('trustedhosts');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!extension_loaded('openssl')) {
admin_externalpage_print_header();
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
if (!$site = get_site()) {
admin_externalpage_print_header();
print_error('nosite', '', '', NULL, true);
}
$trusted_hosts = '';//array();
$old_trusted_hosts = get_config('mnet', 'mnet_trusted_hosts');
if (!empty($old_trusted_hosts)) {
$old_trusted_hosts = explode(',', $old_trusted_hosts);
} else {
$old_trusted_hosts = array();
}
$test_ip_address = optional_param('testipaddress', NULL, PARAM_HOST);
$in_range = false;
if (!empty($test_ip_address)) {
foreach($old_trusted_hosts as $host) {
list($network, $mask) = explode('/', $host.'/');
if (empty($network)) continue;
if (strlen($mask) == 0) $mask = 32;
if (ip_in_range($test_ip_address, $network, $mask)) {
$in_range = true;
$validated_by = $network.'/'.$mask;
break;
}
}
}
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
$hostlist = preg_split("/[\s,]+/", $form->hostlist);
foreach($hostlist as $host) {
list($address, $mask) = explode('/', $host.'/');
if (empty($address)) continue;
if (strlen($mask) == 0) $mask = 32;
$trusted_hosts .= trim($address).'/'.trim($mask)."\n";
unset($address, $mask);
}
set_config('mnet_trusted_hosts', str_replace("\n", ',', $trusted_hosts), 'mnet');
} elseif (!empty($old_trusted_hosts)) {
foreach($old_trusted_hosts as $host) {
list($address, $mask) = explode('/', $host.'/');
if (empty($address)) continue;
if (strlen($mask) == 0) $mask = 32;
$trusted_hosts .= trim($address).'/'.trim($mask)."\n";
unset($address, $mask);
}
}
include('./trustedhosts.html');
?>
+24 -13
View File
@@ -2,7 +2,16 @@
// module.php - allows admin to edit all local configuration variables for a module
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_login();
if (!isadmin()) {
error("Only an admin can use this page");
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
/// If data submitted, then process and store.
@@ -10,12 +19,11 @@
$module = optional_param('module', '', PARAM_SAFEDIR);
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
error(get_string('confirmsesskeybad', 'error'));
}
if ($module != '') {
include_once("$CFG->dirroot/mod/$module/lib.php");
admin_externalpage_setup('modsetting'.$module);
require_once("$CFG->dirroot/mod/$module/lib.php");
// if the config.html contains a hidden form field giving
// the module name then the form does not have to prefix all
// its variable names, we will do it here.
@@ -27,8 +35,6 @@
$moduleconfig($config);
}
} else {
admin_externalpage_setup('managemodules');
$moduleprefix = '';
}
@@ -44,26 +50,31 @@
/// Otherwise print the form.
$module = required_param('module', PARAM_SAFEDIR);
include_once("$CFG->dirroot/mod/$module/lib.php");
admin_externalpage_setup('modsetting'.$module);
require_once("$CFG->dirroot/mod/$module/lib.php");
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
$strmanagemodules = get_string("managemodules");
$strmodulename = get_string("modulename", $module);
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'mod/' . $module . '/config';
admin_externalpage_print_header();
print_header("$site->shortname: $strmodulename: $strconfiguration", $site->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> ".
"<a href=\"modules.php\">$strmanagemodules</a> -> $strmodulename");
print_heading($strmodulename);
print_simple_box(get_string("configwarning", 'admin'), "center", "60%");
print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "60%");
echo "<br />";
print_simple_box_start("center", "");
include("$CFG->dirroot/mod/$module/config.html");
print_simple_box_end();
admin_externalpage_print_footer();
print_footer();
?>
+68 -128
View File
@@ -3,24 +3,28 @@
require_once('../config.php');
require_once('../course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/ddllib.php');
// defines
define('MODULE_TABLE','module_administration_table');
admin_externalpage_setup('managemodules');
$show = optional_param('show', '', PARAM_SAFEDIR);
$hide = optional_param('hide', '', PARAM_SAFEDIR);
$delete = optional_param('delete', '', PARAM_SAFEDIR);
$confirm = optional_param('confirm', '', PARAM_BOOL);
require_login();
if (!isadmin()) {
error("Only administrators can use this page!");
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
/// Print headings
$stractivities = get_string("activities");
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strmanagemodules = get_string("managemodules");
$strdelete = get_string("delete");
$strversion = get_string("version");
$strhide = get_string("hide");
@@ -28,7 +32,15 @@
$strsettings = get_string("settings");
$stractivities = get_string("activities");
$stractivitymodule = get_string("activitymodule");
$strshowmodulecourse = get_string('showmodulecourse');
print_header("$site->shortname: $strmanagemodules", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanagemodules");
print_heading($strmanagemodules);
$coursesaffected = false;
/// If data submitted, then process and store.
@@ -36,54 +48,31 @@
if (!$module = get_record("modules", "name", $hide)) {
error("Module doesn't exist!");
}
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
// Remember the visibility status in visibleold
// and hide...
$sql = "UPDATE {$CFG->prefix}course_modules
SET visibleold=visible,
visible=0
WHERE module={$module->id}";
execute_sql($sql, false);
// clear the course modinfo cache for courses
// where we just deleted something
$sql = "UPDATE {$CFG->prefix}course
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {$CFG->prefix}course_modules
WHERE visibleold=1 AND module={$module->id})";
execute_sql($sql, false);
admin_get_root(true, false); // settings not required - only pages
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
set_field('course_modules', 'visibleold', '1', 'visible' ,'1', 'module', $module->id); // Remember the previous visible state so we can toggle this back if the module is unhidden.
set_field('course_modules', 'visibleold', '0', 'visible' ,'0', 'module', $module->id);
set_field("course_modules", "visible", "0", "module", $module->id); // Hide all related activity modules
$coursesaffected = true;
}
if (!empty($show) and confirm_sesskey()) {
if (!$module = get_record("modules", "name", $show)) {
error("Module doesn't exist!");
}
set_field("modules", "visible", "1", "id", $module->id); // Show main module
set_field('course_modules', 'visible', '1', 'visibleold',
'1', 'module', $module->id); // Get the previous saved visible state for the course module.
// clear the course modinfo cache for courses
// where we just made something visible
$sql = "UPDATE {$CFG->prefix}course
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {$CFG->prefix}course_modules
WHERE visible=1 AND module={$module->id})";
execute_sql($sql, false);
admin_get_root(true, false); // settings not required - only pages
set_field("modules", "visible", "1", "id", $module->id); // Show main module
set_field('course_modules', 'visible', '1', 'visibleold', '1', 'module', $module->id); // Get the previous saved visible state for the course module.
$coursesaffected = true;
}
if (!empty($delete) and confirm_sesskey()) {
admin_externalpage_print_header();
print_heading($stractivities);
$strmodulename = get_string("modulename", "$delete");
if (!$confirm) {
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
"modules.php");
admin_externalpage_print_footer();
print_footer();
exit;
} else { // Delete everything!!
@@ -105,26 +94,12 @@
}
}
// delete calendar events
if (!delete_records("event", "modulename", $delete)) {
notify("Error occurred while deleting all $strmodulename records in calendar event table");
}
// clear course.modinfo for courses
// that used this module...
$sql = "UPDATE {$CFG->prefix}course
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {$CFG->prefix}course_modules
WHERE module={$module->id})";
execute_sql($sql, false);
// Now delete all the course module records
if (!delete_records("course_modules", "module", $module->id)) {
notify("Error occurred while deleting all $strmodulename records in course_modules table");
}
// Then delete all the logs
// Then delete all the logs
if (!delete_records("log", "module", $module->name)) {
notify("Error occurred while deleting all $strmodulename records in log table");
}
@@ -139,43 +114,32 @@
notify("Error occurred while deleting the $strmodulename record from modules table");
}
// And the module configuration records
if (!execute_sql("DELETE FROM {$CFG->prefix}config WHERE name LIKE '{$module->name}_%'")) {
notify("Error occurred while deleting the $strmodulename records from the config table");
}
// cleanup the gradebook
require_once($CFG->libdir.'/gradelib.php');
grade_uninstalled_module($module->name);
// Then the tables themselves
drop_plugin_tables($module->name, "$CFG->dirroot/mod/$module->name/db/install.xml", false);
// Delete the capabilities that were defined by this module
capabilities_cleanup('mod/'.$module->name);
// remove entent handlers and dequeue pending events
events_uninstall('mod/'.$module->name);
// Perform any custom uninstall tasks
if (file_exists($CFG->dirroot . '/mod/' . $module->name . '/lib.php')) {
require_once($CFG->dirroot . '/mod/' . $module->name . '/lib.php');
$uninstallfunction = $module->name . '_uninstall';
if (function_exists($uninstallfunction)) {
if (! $uninstallfunction() ) {
notify('Encountered a problem running uninstall function for '. $module->name.'!');
if ($tables = $db->Metatables()) {
$prefix = $CFG->prefix.$module->name;
foreach ($tables as $table) {
if (strpos($table, $prefix) === 0) {
if (!execute_sql("DROP TABLE $table", false)) {
notify("ERROR: while trying to drop table $table");
}
}
}
}
}
//rebuild_course_cache(); // Because things have changed
$coursesaffected = true;
$a->module = $strmodulename;
$a->directory = "$CFG->dirroot/mod/$delete";
notice(get_string("moduledeletefiles", "", $a), "modules.php");
}
}
admin_externalpage_print_header();
print_heading($stractivities);
if ($coursesaffected) {
rebuild_course_cache(); // Because things have changed
}
/// Get and sort the existing modules
@@ -191,74 +155,50 @@
}
$modulebyname[$strmodulename] = $module;
}
ksort($modulebyname, SORT_LOCALE_STRING);
ksort($modulebyname);
/// Print the table of all modules
// construct the flexible table ready to display
$table = new flexible_table(MODULE_TABLE);
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'delete', 'settings'));
$table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/modules.php');
$table->set_attribute('id', 'modules');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
$table->head = array ($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings);
$table->align = array ("left", "right", "left", "center", "center", "center");
$table->wrap = array ("nowrap", "", "", "", "","");
$table->size = array ("100%", "10", "10", "10", "10","12");
$table->width = "100";
foreach ($modulebyname as $modulename => $module) {
// took out hspace="\10\", because it does not validate. don't know what to replace with.
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" class=\"icon\" alt=\"\" />";
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" hspace=\"10\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" />";
$delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=$USER->sesskey\">$strdelete</a>";
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php")) {
$settings = "<a href=\"settings.php?section=modsetting$module->name\">$strsettings</a>";
} else if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
$settings = "<a href=\"module.php?module=$module->name\">$strsettings</a>";
} else {
$settings = "";
}
$count = count_records_select("$module->name",'course<>0');
if ($count>0) {
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
"&amp;sesskey={$USER->sesskey}\" title=\"$strshowmodulecourse\">$count</a>";
}
else {
$countlink = "$count";
}
$count = count_records("$module->name");
if ($module->visible) {
$visible = "<a href=\"modules.php?hide=$module->name&amp;sesskey=$USER->sesskey\" title=\"$strhide\">".
"<img src=\"$CFG->pixpath/i/hide.gif\" class=\"icon\" alt=\"$strhide\" /></a>";
"<img src=\"$CFG->pixpath/i/hide.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
$class = "";
} else {
$visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=$USER->sesskey\" title=\"$strshow\">".
"<img src=\"$CFG->pixpath/i/show.gif\" class=\"icon\" alt=\"$strshow\" /></a>";
$class = " class=\"dimmed_text\"";
"<img src=\"$CFG->pixpath/i/show.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
$class = "class=\"dimmed_text\"";
}
if ($module->name == "forum") {
$delete = "";
$visible = "";
$class = "";
}
$extra = '';
if (!file_exists("$CFG->dirroot/mod/$module->name/lib.php")) {
$extra = ' <span class="notifyproblem">('.get_string('missingfromdisk').')</span>';
}
$table->add_data(array(
'<span'.$class.'>'.$icon.' '.$modulename.$extra.'</span>',
$countlink,
'<span'.$class.'>'.$module->version.'</span>',
$visible,
$delete,
$settings
));
$table->data[] = array ("<span $class>$icon $modulename</span>", $count, $module->version, $visible, $delete, $settings);
}
print_table($table);
$table->print_html();
echo "<br /><br />";
admin_externalpage_print_footer();
print_footer();
?>
-121
View File
@@ -1,121 +0,0 @@
<?php /// $Id$
/// Search and replace strings throughout all texts in the whole database
require_once('../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('multilangupgrade');
$go = optional_param('go', 0, PARAM_BOOL);
###################################################################
admin_externalpage_print_header();
print_heading(get_string('multilangupgrade', 'admin'));
$strmultilangupgrade = get_String('multilangupgradeinfo', 'admin');
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get');
admin_externalpage_print_footer();
die;
}
if (!$tables = $db->Metatables() ) { // No tables yet at all.
error("no tables");
}
print_simple_box_start('center');
/// Turn off time limits, sometimes upgrades can be slow.
@set_time_limit(0);
@ob_implicit_flush(true);
while(@ob_end_flush());
echo '<strong>Progress:</strong>';
$i = 0;
$skiptables = array($CFG->prefix.'config', $CFG->prefix.'user_students', $CFG->prefix.'user_teachers');//, $CFG->prefix.'sessions2');
foreach ($tables as $table) {
if (($CFG->prefix && strpos($table, $CFG->prefix) !== 0)
or strpos($table, $CFG->prefix.'pma') === 0) { // Not our tables
continue;
}
if (in_array($table, $skiptables)) { // Don't process these
continue;
}
if ($columns = $db->MetaColumns($table, false)) {
if (!array_key_exists('id', $columns) and !array_key_exists('ID', $columns)) {
continue; // moodle tables have id
}
foreach ($columns as $column => $data) {
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
// first find candidate records
$rs = get_recordset_sql("SELECT id, $column FROM $table WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'");
if ($rs) {
while (!$rs->EOF) {
$text = $rs->fields[$column];
$id = $rs->fields['id'];
if ($i % 600 == 0) {
echo '<br />';
}
if ($i % 10 == 0) {
echo '.';
}
$i++;
$rs->MoveNext();
if (empty($text) or is_numeric($text)) {
continue; // nothing to do
}
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is';
$newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text);
if (is_null($newtext)) {
continue; // regex error
}
if ($newtext != $text) {
$newtext = addslashes($newtext);
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=$id", false);
}
}
rs_close($rs);
}
}
}
}
}
// set conversion flag - switches to new plugin automatically
set_config('filter_multilang_converted', 1);
print_simple_box_end();
/// Rebuild course cache which might be incorrect now
notify('Rebuilding course cache...', 'notifysuccess');
rebuild_course_cache();
notify('...finished', 'notifysuccess');
print_continue('index.php');
admin_externalpage_print_footer();
die;
function multilangupgrade_impl($langblock) {
$searchtosplit = '/<(?:lang|span) lang="([a-zA-Z0-9_-]*)".*?>(.+?)<\/(?:lang|span)>/is';
preg_match_all($searchtosplit, $langblock[0], $rawlanglist);
$return = '';
foreach ($rawlanglist[1] as $index=>$lang) {
$return .= '<span lang="'.$lang.'" class="multilang">'.$rawlanglist[2][$index].'</span>';
}
return $return;
}
?>
+14 -8
View File
@@ -3,13 +3,19 @@
if (!isset($CFG)) {
require('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('oacleanup');
require_login();
if (!isadmin()) {
error('You must be an admin to use this script');
exit;
}
print_header_simple('Online Assignment Cleanup','Online Assignment Cleanup', 'Admin');
admin_externalpage_print_header();
online_assignment_cleanup(true);
admin_externalpage_print_footer();
print_footer();
}
@@ -42,7 +48,7 @@ function online_assignment_cleanup($output=false) {
/// get a list of all courses on this site
$courses = get_records('course');
$courses = get_courses();
/// cycle through each course
foreach ($courses as $course) {
@@ -69,7 +75,7 @@ function online_assignment_cleanup($output=false) {
/// cycle through the instances
foreach ($instances as $instance) {
/// is this an instance of an online assignment
$sql = "SELECT a.id
$sql = "SELECT a.id
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}assignment a
WHERE cm.id = '$instance' AND
@@ -95,7 +101,7 @@ function online_assignment_cleanup($output=false) {
/// grab the section record
if (!($section = get_record('course_sections', 'id', $newsection))) {
if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. format_string($course->fullname) .'<br />';
if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '.$course->fullname.'<br />';
continue;
}
@@ -134,7 +140,7 @@ function online_assignment_cleanup($output=false) {
set_field('course_sections', 'sequence', $section->sequence, 'id', $section->id);
if ($output) echo 'Online Assignment (instance '.$instance.') moved from section '.$section->id.': to section '.$newsection.'<br />';
}
-132
View File
@@ -1,132 +0,0 @@
<?php // $Id$
require_once($CFG->libdir.'/pagelib.php');
define('PAGE_ADMIN', 'admin');
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
$lmin = (empty($THEME->block_l_min_width)) ? 0 : $THEME->block_l_min_width;
$lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
$rmin = (empty($THEME->block_r_min_width)) ? 0 : $THEME->block_r_min_width;
$rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width;
define('BLOCK_L_MIN_WIDTH', $lmin);
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
define('BLOCK_R_MAX_WIDTH', $rmax);
page_map_class(PAGE_ADMIN, 'page_admin');
class page_admin extends page_base {
var $section;
var $visiblepathtosection;
// hack alert!
// this function works around the inability to store the section name
// in default block, maybe we should "improve" the blocks a bit?
function init_extra($section) {
global $CFG;
if($this->full_init_done) {
return;
}
$adminroot =& admin_get_root(false, false); //settings not required - only pages
// fetch the path parameter
$this->section = $section;
$current =& $adminroot->locate($section, true);
$this->visiblepathtosection = array_reverse($current->visiblepath);
// all done
$this->full_init_done = true;
}
function blocks_get_default() {
return 'admin_tree,admin_bookmarks';
}
// seems reasonable that the only people that can edit blocks on the admin pages
// are the admins... but maybe we want a role for this?
function user_allowed_editing() {
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
}
// has to be fixed. i know there's a "proper" way to do this
function user_is_editing() {
global $USER;
return $USER->adminediting;
}
function url_get_path() {
global $CFG;
$adminroot =& admin_get_root(false, false); //settings not required - only pages
$root =& $adminroot->locate($this->section);
if (is_a($root, 'admin_externalpage')) {
return $root->url;
} else {
return ($CFG->wwwroot . '/' . $CFG->admin . '/settings.php');
}
}
function url_get_parameters() { // only handles parameters relevant to the admin pagetype
return array('section' => (isset($this->section) ? $this->section : ''));
}
function blocks_get_positions() {
return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
}
function blocks_default_position() {
return BLOCK_POS_LEFT;
}
function blocks_move_position(&$instance, $move) {
if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
return BLOCK_POS_RIGHT;
} else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
return BLOCK_POS_LEFT;
}
return $instance->position;
}
// does anything need to be done here?
function init_quick($data) {
parent::init_quick($data);
}
function print_header($section = '', $focus='') {
global $USER, $CFG, $SITE;
$this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
// if not, print_header() has to be called with a $section parameter
// The search page currently doesn't handle block editing
if ($this->section != 'search' and $this->user_allowed_editing()) {
$buttons = '<div><form '.$CFG->frametarget.' method="get" action="' . $this->url_get_path() . '">'.
'<div><input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
'<input type="hidden" name="section" value="'.$this->section.'" />'.
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></div>';
} else {
$buttons = '&nbsp;';
}
$navlinks = array();
foreach ($this->visiblepathtosection as $element) {
$navlinks[] = array('name' => $element, 'link' => null, 'type' => 'misc');
}
$navigation = build_navigation($navlinks);
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');
}
function get_type() {
return PAGE_ADMIN;
}
}
?>
+26 -20
View File
@@ -2,32 +2,38 @@
// phpinfo.php - shows phpinfo for the current server
require_once("../config.php");
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('phpinfo');
$topframe = optional_param('topframe', false, PARAM_BOOL);
$bottomframe = optional_param('bottomframe', false, PARAM_BOOL);
admin_externalpage_print_header();
require_login();
echo '<div class="phpinfo">';
if (!isadmin()) {
error("Only the admin can use this page");
}
ob_start();
phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES);
$html = ob_get_contents();
ob_end_clean();
if (!$topframe && !$bottomframe) {
?>
/// Delete styles from output
$html = preg_replace('#(\n?<style[^>]*?>.*?</style[^>]*?>)|(\n?<style[^>]*?/>)#is', '', $html);
$html = preg_replace('#(\n?<head[^>]*?>.*?</head[^>]*?>)|(\n?<head[^>]*?/>)#is', '', $html);
/// Delete DOCTYPE from output
$html = preg_replace('/<!DOCTYPE html PUBLIC.*?>/is', '', $html);
/// Delete body and html tags
$html = preg_replace('/<html.*?>.*?<body.*?>/is', '', $html);
$html = preg_replace('/<\/body><\/html>/is', '', $html);
<head>
<title>PHP info</title>
</head>
echo $html;
<frameset rows="80,*">
<frame src="phpinfo.php?topframe=true&amp;sesskey=<?php echo $USER->sesskey ?>">
<frame src="phpinfo.php?bottomframe=true&amp;sesskey=<?php echo $USER->sesskey ?>">
</frameset>
echo '</div>';
admin_externalpage_print_footer();
<?php
} else if ($topframe && confirm_sesskey()) {
$stradministration = get_string("administration");
$site = get_site();
print_header("$site->shortname: phpinfo", "$site->fullname",
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> PHP info");
exit;
} else if ($bottomframe && confirm_sesskey()) {
phpinfo();
exit;
}
?>
+3 -3
View File
@@ -16,8 +16,8 @@ if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
}
$site = get_site();
$subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname));
$body = get_string('noreplybouncemessage','moodle',format_string($site->fullname))."\n\n";
$subject = get_string('noreplybouncesubject','moodle',$site->fullname);
$body = get_string('noreplybouncemessage','moodle',$site->fullname)."\n\n";
$fd = fopen('php://stdin','r');
if ($fd) {
@@ -54,7 +54,7 @@ if ($modid == '0') { // special
}
else {
$modname = get_field("modules","name","id",$modid);
include_once('mod/'.$modname.'/lib.php');
require_once('mod/'.$modname.'/lib.php');
}
$function = $modname.'_process_email';
+171
View File
@@ -0,0 +1,171 @@
<?PHP // $Id$
// Allows the admin to manage questiontypes
// This page is adapted from modules.php
// This page is not yet in service, the whole plug-in architecture
// for question types is still under construction.
require_once('../config.php');
$show = optional_param('show', '', PARAM_SAFEDIR);
$hide = optional_param('hide', '', PARAM_SAFEDIR);
$delete = optional_param('delete', '', PARAM_SAFEDIR);
$confirm = optional_param('confirm', '', PARAM_BOOL);
require_login();
if (!isadmin()) {
error("Only administrators can use this page!");
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
/// Print headings
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strdelete = get_string("delete");
$strversion = get_string("version");
$strhide = get_string("hide");
$strshow = get_string("show");
$strsettings = get_string("settings");
$strquestions = get_string("questions");
$strquestiontype = get_string("questiontype", 'quiz');
print_header("$site->shortname: $strquestions", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strquestions");
print_heading($strquestions);
/// If data submitted, then process and store.
if (!empty($hide) and confirm_sesskey()) {
if (!$qtype = get_record("question_types", "name", $hide)) {
error("Question type doesn't exist!");
}
set_field("question_types", "visible", "0", "id", $qtype->id); // Hide question type
}
if (!empty($show) and confirm_sesskey()) {
if (!$qtype = get_record("question_types", "name", $show)) {
error("Question type doesn't exist!");
}
set_field("question_types", "visible", "1", "id", $qtype->id); // Show question type
}
if (!empty($delete) and confirm_sesskey()) {
$strqtypename = get_string("qtypename", "qtype_$delete");
if (!$confirm) {
notice_yesno(get_string("qtypedeleteconfirm", "admin", $strqtypename),
"questiontypes.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
"questiontypes.php");
print_footer();
exit;
} else { // Delete everything!!
if ($delete == "random") {
error("You can not delete the random question type!!");
}
if (!$qtype = get_record("question_types", "name", $delete)) {
error("Question type doesn't exist!");
}
// OK, first delete all the questions
if ($questions = get_records("quiz_questions", "qtype", $qtype->id)) {
foreach ($questions as $question) {
if (! quiz_delete_question($coursemod->id, $coursemod->section)) {
notify("Could not delete the $strqtypename with id = $question->id");
}
}
}
// And the qtype entry itself
if (!delete_records("question_types", "name", $qtype->name)) {
notify("Error occurred while deleting the $strqtypename record from question_types table");
}
// Then the tables themselves
if ($tables = $db->Metatables()) {
$prefix = $CFG->prefix.$qtype->name;
foreach ($tables as $table) {
if (strpos($table, $prefix) === 0) {
if (!execute_sql("DROP TABLE $table", false)) {
notify("ERROR: while trying to drop table $table");
}
}
}
}
$a->qtype = $strqtypename;
$a->directory = "$CFG->dirroot/qtype/$delete";
notice(get_string("qtypedeletefiles", "", $a), "questiontypes.php");
}
}
/// Get and sort the existing questiontypes
if (!$qtypes = get_records("question_types")) {
error("No question types found!!"); // Should never happen
}
foreach ($qtypes as $qtype) {
$strqtypename = get_string("qtypename", "qtype_$qtype->name");
$qtypebyname[$strqtypename] = $qtype;
}
ksort($qtypebyname);
/// Print the table of all questiontypes
$table->head = array ($strquestiontype, $strquestions, $strversion, "$strhide/$strshow", $strdelete, $strsettings);
$table->align = array ("left", "right", "left", "center", "center", "center");
$table->wrap = array ("nowrap", "", "", "", "","");
$table->size = array ("100%", "10", "10", "10", "10","12");
$table->width = "100";
foreach ($qtypebyname as $qtypename => $qtype) {
$icon = "<img src=\"$CFG->dirroot/mod/quiz/questiontypes/$qtype->name/icon.gif\" hspace=\"10\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" />";
if (file_exists("$CFG->dirroot/mod/quiz/questiontypes/$qtype->name/config.html")) {
$settings = "<a href=\"questiontype.php?qtype=$qtype->name\">$strsettings</a>";
} else {
$settings = "";
}
$count = count_records('quiz_questions', 'qtype', $qtype->id);
$delete = $count ? '' : "<a href=\"questiontypes.php?delete=$qtype->name&amp;sesskey=$USER->sesskey\">$strdelete</a>";
if ($qtype->visible) {
$visible = "<a href=\"questiontypes.php?hide=$qtype->name&amp;sesskey=$USER->sesskey\" title=\"$strhide\">".
"<img src=\"$CFG->pixpath/i/hide.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
$class = "";
} else {
$visible = "<a href=\"questiontypes.php?show=$qtype->name&amp;sesskey=$USER->sesskey\" title=\"$strshow\">".
"<img src=\"$CFG->pixpath/i/show.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
$class = "class=\"dimmed_text\"";
}
if ($qtype->name == "random") {
$delete = "";
$visible = "";
$class = "";
}
$table->data[] = array ("<span $class>$icon $qtypename</span>", $count, $qtype->version, $visible, $delete, $settings);
}
print_table($table);
echo "<br /><br />";
print_footer();
?>
+96 -94
View File
@@ -5,14 +5,16 @@
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
if (!isadmin()) {
error("Only the admin can use this page");
}
if (!$site = get_site()) {
redirect("index.php");
}
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
error(get_string('confirmsesskeybad', 'error'));
}
if (!$admin = get_admin()) {
@@ -24,7 +26,7 @@
}
if (empty($CFG->siteidentifier)) { // Unique site identification code
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
set_config('siteidentifier', random_string(32));
}
@@ -33,160 +35,160 @@
$stradministration = get_string("administration");
$strregistration = get_string("registration");
$strregistrationinfo = get_string("registrationinfo");
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strregistration", $site->fullname, $navigation);
print_header("$site->shortname: $strregistration", "$site->fullname",
"<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strregistration");
print_heading($strregistration);
print_simple_box($strregistrationinfo, "center", "70%");
echo "<br />";
/// Print the form
echo "<form id=\"mform1\" class=\"mform\" action=\"http://moodle.org/register/\" method=\"post\">\n";
echo '<fieldset id="registration">';
echo '<legend>Registration Information</legend>';
print_simple_box_start("center", "");
echo "<form name=\"form\" action=\"http://moodle.org/register/\" method=\"post\">\n";
echo "<table cellpadding=\"9\" border=\"0\">\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"center\" colspan=\"2\">".get_string("location")."</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">Moodle URL:</td>\n";
echo "<td>$CFG->wwwroot</td>\n";
echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\" />\n";
echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\" />\n";
echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\" />\n";
echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\" />\n";
echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\">\n";
echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\">\n";
echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\">\n";
echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\">\n";
echo "</td></tr>\n";
echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\" />\n";
echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\" />\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("currentversion").":</td>\n";
echo "<td>$CFG->release ($CFG->version)</td>\n";
echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\">\n";
echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\">\n";
echo "</td></tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>URL</label></div>';
echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
echo '</div>';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("fullsitename").":</td>\n";
echo "<td><input size=\"50\" type=\"text\" name=\"sitename\" value=\"$site->fullname\"></td>\n";
echo "</tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
echo '<div class="felement ftext">';
echo '<input size="50" id="sitename" type="text" name="sitename" value="'.format_string($site->fullname).'" />';
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menucountry">'.get_string("country").'</label></div>';
echo '<div class="felement ftext">';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("country").":</td>\n";
echo "<td>";
choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
echo '</div>';
echo '</div>';
echo "</td>\n";
echo "</tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menupublic">'."<a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"".get_string("publicdirectorytitle")."\">".get_string("publicdirectory")."</a>".'</label></div>';
echo '<div class="felement ftext">';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\"><a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"See the current list of sites\" target=_blank>".get_string("publicdirectory")."</a>:</td>\n";
echo "<td>";
$options[0] = get_string("publicdirectory0");
$options[1] = get_string("publicdirectory1");
$options[2] = get_string("publicdirectory2");
choose_from_menu ($options, "public", "2", "", "", "");
unset($options);
echo '</div>';
echo '</div>';
echo "</td>\n";
echo "</tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menucontact">'.get_string("registrationcontact").'</label></div>';
echo '<div class="felement ftext">';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("registrationcontact")."</a>:</td>\n";
echo "<td>\n";
$options[0] = get_string("registrationcontactno");
$options[1] = get_string("registrationcontactyes");
choose_from_menu ($options, "contact", "1", "", "", "");
unset($options);
echo '</div>';
echo '</div>';
echo "</td>\n";
echo "</tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
echo '<div class="felement ftext">';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("statistics").":";
echo "<br />(".get_string("notpublic").')';
echo "</td>\n";
echo "<td>";
$count = count_records('course')-1;
echo get_string("courses").": ".$count;
echo "<input type=\"hidden\" name=\"courses\" value=\"$count\" />\n";
echo "<input type=\"hidden\" name=\"courses\" value=\"$count\">\n";
echo '<br />';
$count = count_records('user', 'deleted', 0);
$count = count_records('user')-1;
echo get_string("users").": ".$count;
echo "<input type=\"hidden\" name=\"users\" value=\"$count\" />\n";
echo "<input type=\"hidden\" name=\"users\" value=\"$count\">\n";
echo '<br />';
// total number of role assignments
$count = count_records('role_assignments');
echo get_string('roleassignments', 'role').": ".$count;
echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
$count = count_records('user_students');
echo get_string("enrolments").": ".$count;
echo "<input type=\"hidden\" name=\"enrolments\" value=\"$count\">\n";
echo '<br />';
// first find all distinct roles with mod/course:update
// please change the name and strings to something appropriate to reflect the new data collected
$sql = "SELECT COUNT(DISTINCT u.id)
FROM {$CFG->prefix}role_capabilities rc,
{$CFG->prefix}role_assignments ra,
{$CFG->prefix}user u
WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything')
AND rc.roleid = ra.roleid
AND u.id = ra.userid";
$count = count_records_sql($sql);
$count = count_records('user_teachers');
echo get_string("teachers").": ".$count;
echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\" />\n";
echo "<input type=\"hidden\" name=\"teachers\" value=\"$count\">\n";
echo '<br />';
$count = count_records('forum_posts');
echo get_string("posts", 'forum').": ".$count;
echo "<input type=\"hidden\" name=\"posts\" value=\"$count\" />\n";
echo "<input type=\"hidden\" name=\"posts\" value=\"$count\">\n";
echo '<br />';
$count = count_records('question');
echo get_string("questions", 'quiz').": ".$count;
echo "<input type=\"hidden\" name=\"questions\" value=\"$count\" />\n";
echo "<input type=\"hidden\" name=\"questions\" value=\"$count\">\n";
echo '<br />';
$count = count_records('resource');
echo get_string("modulenameplural", "resource").": ".$count;
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
echo '</div>';
echo '</div>';
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\">\n";
echo '<br />';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
echo '<div class="felement ftext">';
echo "<input size=\"50\" type=\"text\" id=\"adminname\" name=\"adminname\" value=\"".fullname($admin, true)."\" />";
echo '</div>';
echo '</div>';
echo "</td>\n";
echo "</tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="adminemail">'.get_string("email").'</label></div>';
echo '<div class="felement ftext">';
echo "<input size=\"50\" type=\"text\" id=\"adminemail\" name=\"adminemail\" value=\"$admin->email\" />";
echo '</div>';
echo '</div>';
echo "<tr valign=\"top\">\n";
echo "<td align=\"center\" colspan=\"2\"><hr size=\"1\" noshade>".get_string("administrator")."</td>\n";
echo "</tr>\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menumailme">'.get_string("registrationemail").'</label></div>';
echo '<div class="felement ftext">';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("administrator").":</td>\n";
echo "<td><input size=\"50\" type=\"text\" name=\"adminname\" value=\"".fullname($admin, true)."\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("email").":</td>\n";
echo "<td><input size=\"50\" type=\"text\" name=\"adminemail\" value=\"$admin->email\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("registrationemail")."</a>:</td>\n";
echo "<td>\n";
$options[0] = get_string("registrationno");
$options[1] = get_string("registrationyes");
choose_from_menu ($options, "mailme", "1", "", "", "");
unset($options);
echo '</div>';
echo '</div>';
echo "</td>\n";
echo "</tr>\n";
echo '<div class="felement fsubmit"><input name="submitbutton" value="'.get_string('registrationsend').'" type="submit" id="id_submitbutton" /></div>';
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">&nbsp;</td>\n";
echo "<td><input type=\"submit\" value=\"".get_string("registrationsend")."\"></td>\n";
echo "</tr>\n";
echo "</fieldset>\n";
echo "</table>\n";
echo "</form>\n";
print_simple_box_end();
echo "<br />\n";
print_footer();
?>
+30 -24
View File
@@ -2,51 +2,57 @@
/// Search and replace strings throughout all texts in the whole database
require_once('../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('replace');
$search = optional_param('search', '', PARAM_RAW);
$replace = optional_param('replace', '', PARAM_RAW);
require_login();
if (!isadmin()) {
error("Admins only");
}
###################################################################
admin_externalpage_print_header();
print_heading('Search and replace text throughout the whole database');
print_header('Search and replace throughout the whole database', 'Replace text within the whole database');
if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Print a form
if (!$search or !$replace or !confirm_sesskey()) { /// Print a form
print_simple_box_start('center');
echo '<div align="center">';
echo '<form action="replace.php" method="post">';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo 'Search whole database for: <input type="text" name="search" /><br />';
echo 'Replace with this string: <input type="text" name="replace" /><br />';
echo '<input type="submit" value="Yes, do it now" /><br />';
echo '<form action="replace.php">';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">';
echo 'Search whole database for: <input type="text" name="search"><br />';
echo 'Replace with this string: <input type="text" name="replace"><br /></br />';
echo '<input type="submit" value="Yes, do it now"><br />';
echo '</form>';
echo '</div>';
print_simple_box_end();
admin_externalpage_print_footer();
die;
}
print_simple_box_start('center');
if (!db_replace($search, $replace)) {
error('An error has occured during this process');
if (!$tables = $db->Metatables() ) { // No tables yet at all.
error("no tables");
}
print_simple_box_start('center');
foreach ($tables as $table) {
if (in_array($table, array($CFG->prefix.'config'))) { // Don't process these
continue;
}
if ($columns = $db->MetaColumns($table, false)) {
foreach ($columns as $column => $data) {
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
$db->debug = true;
execute_sql("UPDATE $table SET $column = REPLACE($column, '$search', '$replace');");
$db->debug = false;
}
}
}
}
print_simple_box_end();
/// Rebuild course cache which might be incorrect now
notify('Rebuilding course cache...');
rebuild_course_cache();
notify('...finished');
print_continue('index.php');
admin_externalpage_print_footer();
?>
+28
View File
@@ -0,0 +1,28 @@
<?php // $Id$
// Display all the reports available in admin/report
require_once('../config.php');
if (!isadmin()) {
error("You are not allowed to look at this page");
}
$stradmin = get_string('administration');
$strreports = get_string('reports');
$strmisc = get_string('miscellaneous');
print_header($strreports, $strreports,
'<a href="index.php">'.$stradmin.'</a> -> <a href="misc.php">'.$strmisc.'</a> ->'.
$strreports);
$directories = get_list_of_plugins('admin/report');
foreach ($directories as $directory) {
echo '<div class="plugin '.$directory.'">';
include_once($CFG->dirroot.'/admin/report/'.$directory.'/mod.php'); // Fragment for listing
echo '</div>';
}
print_footer();
?>
-138
View File
@@ -1,138 +0,0 @@
<?php // $Id$
// index.php - scheduled backup logs
require_once('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/backup/lib.php');
admin_externalpage_setup('reportbackups');
admin_externalpage_print_header();
$courseid = optional_param('courseid', 0, PARAM_INT);
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM));
/// Scheduled backups are disabled by the server admin
if (!empty($CFG->disablescheduledbackups)) {
print_error('scheduledbackupsdisabled', '', '', NULL, true);
}
/// Scheduled backups aren't active by the site admin
$backup_config = backup_get_config();
if (empty($backup_config->backup_sche_active)) {
notify(get_string('scheduledbackupsinactive'));
}
/// Get needed strings
$backuploglaststatus = get_string("backuploglaststatus");
$backuplogdetailed = get_string("backuplogdetailed");
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
$strbackup = get_string("backup");
$strbackupdetails = get_string("backupdetails");
$strlogs = get_string("logs");
$strftimedatetime = get_string("strftimerecent");
$strftimetime = get_string("strftimetime").":%S";
$strerror = get_string("error");
$strok = get_string("ok");
$strunfinished = get_string("unfinished");
$strskipped = get_string("skipped");
$strcourse = get_string("course");
$strtimetaken = get_string("timetaken","quiz");
$strstatus = get_string("status");
$strnext = get_string("next");
/// Decide when to show last execution logs or detailed logs
/// Lastlog view
if (!$courseid) {
print_heading($backuploglaststatus);
print_simple_box_start('center');
/// Now, get every record from backup_courses
$courses = get_records("backup_courses");
if (!$courses) {
notify(get_string('nologsfound'));
} else {
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
//Print table header
echo "<tr>";
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
foreach ($courses as $course) {
/// Get the course shortname
$coursename = get_field ("course","fullname","id",$course->courseid);
if ($coursename) {
echo "<tr>";
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"index.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
if ($course->laststatus == 1) {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
} else if ($course->laststatus == 2) {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
} else if ($course->laststatus == 3) {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
} else {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
}
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
echo "</tr>";
}
}
echo "</table>";
}
print_simple_box_end();
/// Detailed View !!
} else {
print_heading($backuplogdetailed);
$coursename = get_field("course","fullname","id","$courseid");
print_heading("$strcourse: $coursename");
print_simple_box_start('center');
/// First, me get all the distinct backups for that course in backup_log
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
FROM {$CFG->prefix}backup_log
WHERE courseid = '$courseid'
ORDER BY laststarttime DESC");
/// Iterate over backup executions
if (!$executions) {
notify(get_string('nologsfound'));
} else {
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
foreach($executions as $execution) {
echo "<tr>";
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
echo "</td>";
echo "</tr>";
$logs = get_records_sql("SELECT *
FROM {$CFG->prefix}backup_log
WHERE courseid = '$courseid' AND
laststarttime = '$execution->laststarttime'
ORDER BY id");
if ($logs) {
foreach ($logs as $log) {
echo "<tr>";
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
$log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
$log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" ","&nbsp;&nbsp;&nbsp;&nbsp;",$log->info)."</font></td>";
echo "</tr>";
}
}
}
echo "</table>";
}
print_simple_box_end();
}
print_footer();
?>
+60 -64
View File
@@ -2,20 +2,19 @@
require_once('../../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('reportcourseoverview');
admin_externalpage_print_header();
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
$time = optional_param('time', 0, PARAM_INT);
$numcourses = optional_param('numcourses', 20, PARAM_INT);
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM)); // needed?
if (empty($CFG->enablestats)) {
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
error("Stats is not enabled.");
}
require_login();
if (!isadmin()) {
error("This page is for admins only");
}
$course = get_site();
@@ -24,14 +23,16 @@
$strreports = get_string('reports');
$strcourseoverview = get_string('courseoverview');
$strnav = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.get_string('administration').'</a> -> <a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report.php">'.$strreports.'</a> -> '.$strcourseoverview;
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
$tableprefix = $CFG->prefix.'stats_';
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend');
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
@@ -43,13 +44,15 @@
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
if (empty($timeoptions)) {
print_error('nostatstodisplay', "", $CFG->wwwroot.'/course/view.php?id='.$course->id);
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
print_header($strcourseoverview, $strcourseoverview, $strnav,'','',true,'&nbsp');
echo '<form action="index.php" method="post">'."\n";
echo '<div>';
$table->width = '*';
$table->align = array('left','left','left','left','left','left');
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
@@ -57,63 +60,56 @@
'<input type="submit" value="'.get_string('view').'" />') ;
print_table($table);
echo '</div>';
echo '</form>';
print_heading($reportoptions[$report]);
if (!empty($report) && !empty($time)) {
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
if (!empty($param->sql)) {
$sql = $param->sql;
} else {
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0"
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby;
}
error_log($sql);
$courses = get_records_sql($sql, 0, $numcourses);
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= ".$param->timeafter
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby
." LIMIT ".$numcourses;
$courses = get_records_sql($sql);
if (empty($courses)) {
notify(get_string('statsnodata'));echo '</td></tr></table>';echo '<p>after notify</p>';
} else {
if (empty($CFG->gdversion)) {
echo '<div class="graph">(' . get_string("gdneed") .')</div>';
} else {
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
}
$table = new StdClass;
$table->align = array('left','center','center','center');
$table->head = array(get_string('course'),$param->line1);
if (!empty($param->line2)) {
$table->head[] = $param->line2;
}
if (!empty($param->line3)) {
$table->head[] = $param->line3;
}
foreach ($courses as $c) {
$a = array();
$a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
$a[] = $c->line1;
if (isset($c->line2)) {
$a[] = $c->line2;
}
if (isset($c->line3)) {
$a[] = round($c->line3,2);
}
$table->data[] = $a;
}
print_table($table);
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/index.php');
}
if (empty($CFG->gdversion)) {
echo "<center>(".get_string("gdneed").")</center>";
} else {
echo '<center><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></center>';
}
$table = new object();
$table->align = array('left','center','center','center');
$table->head = array(get_string('course'),$param->line1);
if (!empty($param->line2)) {
$table->head[] = $param->line2;
}
if (!empty($param->line3)) {
$table->head[] = $param->line3;
}
foreach ($courses as $c) {
$a = array();
$a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
$a[] = $c->line1;
if (isset($c->line2)) {
$a[] = $c->line2;
}
if (isset($c->line3)) {
$a[] = $c->line3;
}
$table->data[] = $a;
}
print_table($table);
}
admin_externalpage_print_footer();
print_footer();
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
if (!empty($CFG->enablestats)) {
$strreports = get_string('reports');
$strcourseoverview = get_string('courseoverview');
print_heading("$strcourseoverview:");
require_once($CFG->dirroot.'/lib/statslib.php');
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
$time = optional_param('time', 0, PARAM_INT);
$numcourses = optional_param('numcourses', 20, PARAM_INT);
$course = get_site();
$statsstatus = stats_check_uptodate($course->id);
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
$tableprefix = $CFG->prefix.'stats_';
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
$now = stats_get_base_daily();
$lastweekend = stats_get_base_weekly();
$lastmonthend = stats_get_base_monthly();
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
$table->width = '*';
$table->align = array('left','left','left','left','left','left');
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
'<input type="submit" value="'.get_string('view').'" />') ;
echo '<form action="report/courseoverview/index.php" method="post">'."\n";
print_table($table);
echo '</form>';
if ($statsstatus !== NULL) {
notify ($statsstatus);
}
}
?>
+16 -19
View File
@@ -10,28 +10,27 @@
require_login();
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
if (!isadmin()) {
error("You must be an admin to use this page");
}
stats_check_uptodate();
stats_check_uptodate($course->id);
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
if (!empty($param->sql)) {
$sql = $param->sql;
} else {
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0"
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby;
}
$courses = get_records_sql($sql, 0, $numcourses);
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= ".$param->timeafter
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby
." LIMIT ".$numcourses;
$courses = get_records_sql($sql);
if (empty($courses)) {
print_error('statsnodata', "", $CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
}
$graph = new graph(750,400);
@@ -39,8 +38,6 @@
$graph->parameter['legend_size'] = 10;
$graph->parameter['x_axis_angle'] = 90;
$graph->parameter['title'] = false; // moodle will do a nicer job.
$graph->y_tick_labels = null;
$graph->offset_relation = null;
if ($report != STATS_REPORT_ACTIVE_COURSES) {
$graph->parameter['y_decimal_left'] = 2;
}
@@ -53,5 +50,5 @@
$graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
$graph->draw_stack();
?>
-31
View File
@@ -1,31 +0,0 @@
<?php // $Id$
require_once('../../../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/course/report/log/lib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('reportlog');
admin_externalpage_print_header();
$course = get_site();
print_heading(get_string('chooselogs') .':');
print_mnet_log_selector_form($CFG->mnet_localhost_id, $course);
echo '<br />';
print_heading(get_string('chooselivelogs') .':');
$heading = link_to_popup_window('/course/report/log/live.php?id='. $course->id,
'livelog', get_string('livelogs'),
500, 800, '', 'none', true);
print_heading($heading, 'center', 3);
admin_externalpage_print_footer();
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/course/report/log/lib.php');
$course = get_site();
print_heading(get_string('chooselogs') .':');
print_log_selector_form($course);
echo '<br />';
print_heading(get_string('chooselivelogs') .':');
echo '<center><h3>';
link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
echo '</h3></center>';
?>
-73
View File
@@ -1,73 +0,0 @@
<?php // $Id$
require_once('../../../config.php');
require_once($CFG->dirroot.'/question/upgrade.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('reportquestion');
admin_externalpage_print_header();
print_heading(get_string('adminreport', 'question'));
$probstr = '';
$contextupgradeversion = 2007081000;
if ($CFG->version < $contextupgradeversion){
///cwrqpfs issue
$probstr = print_heading(get_string('cwrqpfs', 'question'), '', 3, 'main', true);
if ($updates = question_cwqpfs_to_update()){
$probstr .=get_string('cwrqpfsinfo', 'question');
$probstr .= '<ul>';
$catlist = join(array_keys($updates), ',');
//get info about cateogries and no of questions used outside category's course
$categories = get_records_sql('SELECT qc.*, c.fullname as coursename FROM '.$CFG->prefix.'question_categories as qc, '
.$CFG->prefix.'course as c WHERE qc.course = c.id AND qc.id IN ('.$catlist.')');
foreach ($updates as $id => $publish){
$categories[$id]->caturl = "$CFG->wwwroot/question/category.php?sesskey=".sesskey().
"&amp;edit=$id&amp;courseid=".$categories[$id]->course;
if ($categories[$id]->publish){
$categories[$id]->changefrom = get_string('published', 'question');
$categories[$id]->changeto = get_string('unpublished', 'question');
} else {
$categories[$id]->changefrom = get_string('unpublished', 'question');
$categories[$id]->changeto = get_string('published', 'question');
}
$probstr .= '<li>'.get_string('changepublishstatuscat', 'question', $categories[$id]);
if ($questions = get_records_sql('SELECT q.*, qui.id as quizid, qui.name as quizname, cm.id as cmid, '
.'qui.course, c.fullname as coursename FROM '.$CFG->prefix.'question q, '
.$CFG->prefix.'quiz_question_instances qqi, '
.$CFG->prefix.'quiz qui, '
.$CFG->prefix.'course_modules cm, '
.$CFG->prefix.'modules m, '
.$CFG->prefix.'course c '
.'WHERE (q.category = '.$id.' AND qqi.question = q.id '
.'AND qqi.quiz = qui.id '
.'AND qui.course = c.id '
.'AND cm.instance = qui.id '
.'AND cm.module = m.id '
.'AND m.name = \'quiz\''
.'AND ('.$categories[$id]->course.' <> qui.course)) ORDER BY qui.id ASC')){
$probstr .= '<ul>';
foreach ($questions as $question){
$question->quizurl = "$CFG->wwwroot/mod/quiz/edit.php?cmid=".$question->cmid;
$question->qurl = "$CFG->wwwroot/question/question.php?cmid={$question->cmid}&amp;id={$question->id}&amp;returnurl=".urlencode($FULLME);
$probstr .= '<li>'.get_string('questionaffected', 'question', $question).'</li>';
}
$probstr .= '</ul>';
}
$probstr .= '</li>';
}
$probstr .= '</ul>';
} else {
$probstr .=('<p>'.get_string('cwrqpfsnoprob', 'question').'</p>');
}
}
if ($probstr) {
print_box($probstr);
} else {
print_box(get_string('noprobs', 'question'), 'boxwidthnarrow boxaligncenter generalbox');
}
admin_externalpage_print_footer();
?>
-196
View File
@@ -1,196 +0,0 @@
<?php
/**
* A SimpleTest report format for Moodle.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @version $Id$
* @package SimpleTestEx
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->libdir . '/simpletestlib/reporter.php');
/**
* Extended in-browser test displayer. HtmlReporter generates
* only failure messages and a pass count. ExHtmlReporter also
* generates pass messages and a time-stamp.
*
* @package SimpleTestEx
*/
class ExHtmlReporter extends HtmlReporter {
// Options set when the class is created.
var $showpasses;
// Lang strings. Set in the constructor.
var $strrunonlyfolder;
var $strrunonlyfile;
var $strseparator;
/**
* Constructor.
*
* @param bool $showpasses Whether this reporter should output anything for passes.
*/
function ExHtmlReporter($showpasses) {
global $CFG, $THEME;
$this->HtmlReporter();
$this->showpasses = $showpasses;
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
$this->strrunonlyfile = $this->get_string('runonlyfile');
$this->strseparator = get_separator();
}
/**
* Called when a pass needs to be output.
*/
function paintPass($message) {
//(Implicitly call grandparent, as parent not implemented.)
parent::paintPass($message);
if ($this->showpasses) {
$this->_paintPassFail('pass', $message);
}
}
/**
* Called when a fail needs to be output.
*/
function paintFail($message) {
// Explicitly call grandparent, not parent::paintFail.
SimpleScorer::paintFail($message);
$this->_paintPassFail('fail', $message);
}
/**
* Called when an error (uncaught exception or PHP error) needs to be output.
*/
function paintError($message) {
// Explicitly call grandparent, not parent::paintFail.
SimpleScorer::paintError($message);
$this->_paintPassFail('exception', $message);
}
/**
* Private method. Used by printPass/Fail/Error.
*/
function _paintPassFail($passorfail, $message) {
global $FULLME, $CFG;
print_simple_box_start('', '100%', '', 5, $passorfail . ' generalbox');
$url = $this->_htmlEntities($this->_stripParameterFromUrl($FULLME, 'path'));
echo '<b class="', $passorfail, '">', $this->get_string($passorfail), '</b>: ';
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$file = array_shift($breadcrumb);
$pathbits = preg_split('/\/|\\\\/', substr($file, strlen($CFG->dirroot) + 1));
$file = array_pop($pathbits);
$folder = '';
foreach ($pathbits as $pathbit) {
$folder .= $pathbit . '/';
echo "<a href=\"{$url}path=$folder\" title=\"$this->strrunonlyfolder\">$pathbit</a>/";
}
echo "<a href=\"{$url}path=$folder$file\" title=\"$this->strrunonlyfile\">$file</a>";
echo $this->strseparator, implode($this->strseparator, $breadcrumb);
echo $this->strseparator, '<br />', $this->_htmlEntities($message), "\n\n";
print_simple_box_end();
flush();
}
/**
* Called when a notice needs to be output.
*/
function paintNotice($message) {
$this->paintMessage($this->_htmlEntities($message));
}
/**
* Paints a simple supplementary message.
* @param string $message Text to display.
*/
function paintMessage($message) {
if ($this->showpasses) {
print_simple_box_start('', '100%');
echo '<span class="notice">', $this->get_string('notice'), '</span>: ';
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
echo implode($this->strseparator, $breadcrumb);
echo $this->strseparator, '<br />', $message, "\n";
print_simple_box_end();
flush();
}
}
/**
* Output anything that should appear above all the test output.
*/
function paintHeader($test_name) {
// We do this the moodle way instead.
}
/**
* Output anything that should appear below all the test output, e.g. summary information.
*/
function paintFooter($test_name) {
$summarydata = new stdClass;
$summarydata->run = $this->getTestCaseProgress();
$summarydata->total = $this->getTestCaseCount();
$summarydata->passes = $this->getPassCount();
$summarydata->fails = $this->getFailCount();
$summarydata->exceptions = $this->getExceptionCount();
if ($summarydata->fails == 0 && $summarydata->exceptions == 0) {
$status = "passed";
} else {
$status = "failed";
}
echo '<div class="unittestsummary ', $status, '">';
echo $this->get_string('summary', $summarydata);
echo '</div>';
echo '<div class="performanceinfo">',
$this->get_string('runat', date('<b>d-m-Y H:i T</b>')),
$this->get_string('version', SimpleTestOptions::getVersion()),
'</div>';
}
/**
* Strip a specified parameter from the query string of a URL, if present.
* Adds a separator to the end of the URL, so that a new parameter
* can easily be appended. For example (assuming $param = 'frog'):
*
* http://example.com/index.php -> http://example.com/index.php?
* http://example.com/index.php?frog=1 -> http://example.com/index.php?
* http://example.com/index.php?toad=1 -> http://example.com/index.php?toad=1&
* http://example.com/index.php?frog=1&toad=1 -> http://example.com/index.php?toad=1&
*
* @param string $url the URL to modify.
* @param string $param the parameter to strip from the URL, if present.
*
* @return string The modified URL.
*/
function _stripParameterFromUrl($url, $param) {
$url = preg_replace('/(\?|&)' . $param . '=[^&]*&?/', '$1', $url);
if (strpos($url, '?') === false) {
$url = $url . '?';
} else {
$url = $url . '&';
}
return $url;
}
/**
* Look up a lang string in the appropriate file.
*/
function get_string($identifier, $a = NULL) {
return get_string($identifier, 'simpletest', $a);
}
}
?>
-210
View File
@@ -1,210 +0,0 @@
<?php
/**
* A SimpleTest GroupTest that automatically finds all the
* test files in a directory tree according to certain rules.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @version $Id$
* @package SimpleTestEx
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->libdir . '/simpletestlib/test_case.php');
/**
* This is a composite test class for finding test cases and
* other RunnableTest classes in a directory tree and combining
* them into a group test.
* @package SimpleTestEx
*/
class AutoGroupTest extends GroupTest {
var $thorough;
var $showsearch;
function AutoGroupTest($showsearch, $thorough, $test_name = null) {
$this->GroupTest($test_name);
$this->showsearch = $showsearch;
$this->thorough = $thorough;
}
function setLabel($test_name) {
//:HACK: there is no GroupTest::setLabel, so access parent::_label.
$this->_label = $test_name;
}
function addIgnoreFolder($ignorefolder) {
$this->ignorefolders[]=$ignorefolder;
}
function _recurseFolders($path) {
if ($this->showsearch) {
echo '<li>' . basename(realpath($path)) . '<ul>';
}
$files = scandir($path);
static $s_count = 0;
foreach ($files as $file) {
if ($file == '.' || $file == '..') {
continue;
}
$file_path = $path . '/' . $file;
if (is_dir($file_path)) {
if ($file != 'CVS' && !in_array($file_path, $this->ignorefolders)) {
$this->_recurseFolders($file_path);
}
} elseif (preg_match('/simpletest(\/|\\\\)test.*\.php$/', $file_path) ||
($this->thorough && preg_match('/simpletest(\/|\\\\)slowtest.*\.php$/', $file_path))) {
$s_count++;
// OK, found: this shows as a 'Notice' for any 'simpletest/test*.php' file.
$this->addTestCase(new FindFileNotice($file_path, 'Found unit test file, '. $s_count));
// addTestFile: Unfortunately this doesn't return fail/success (bool).
$this->addTestFile($file_path, true);
}
}
if ($this->showsearch) {
echo '</ul></li>';
}
return $s_count;
}
function findTestFiles($dir) {
if ($this->showsearch) {
echo '<p>Searching folder: ' . realpath($dir) . '</p><ul>';
}
$path = $dir;
$count = $this->_recurseFolders($path);
if ($count <= 0) {
$this->addTestCase(new BadAutoGroupTest($path, 'Search complete. No unit test files found'));
} else {
$this->addTestCase(new AutoGroupTestNotice($path, 'Search complete. Total unit test files found: '. $count));
}
if ($this->showsearch) {
echo '</ul>';
}
return $count;
}
function addTestFile($file, $internalcall = false) {
if ($this->showsearch) {
if ($internalcall) {
echo '<li><b>' . basename($file) . '</b></li>';
} else {
echo '<p>Adding test file: ' . realpath($file) . '</p>';
}
// Make sure that syntax errors show up suring the search, otherwise you often
// get blank screens because evil people turn down error_reporting elsewhere.
error_reporting(E_ALL);
}
if(!is_file($file) ){
parent::addTestCase(new BadTest($file, 'Not a file or does not exist'));
}
parent::addTestFile($file);
}
}
/* ======================================================================= */
// get_class_ex: Insert spaces to prettify the class-name.
function get_class_ex($object) {
return preg_replace('/(.?)([A-Z])/', '${1} ${2}', get_class($object));
}
/**
* A failing test base-class for when a test suite has NOT loaded properly.
* See class, simple_test.php: BadGroupTest.
* @package SimpleTestEx
*/
class BadTest {
var $label;
var $error;
function BadTest($label, $error) {
$this->label = $label;
$this->error = $error;
}
function getLabel() {
return $this->label;
}
function run(&$reporter) {
$reporter->paintGroupStart(basename(__FILE__), $this->getSize());
$reporter->paintFail(get_class_ex($this) .' [' . $this->getLabel() .
'] with error [' . $this->error . ']');
$reporter->paintGroupEnd($this->getLabel());
return $reporter->getStatus();
}
/**
* @return int the number of test cases starting.
*/
function getSize() {
return 0;
}
}
/**
* An informational notice base-class for when a test suite is being processed.
* See class, simple_test.php: BadGroupTest.
* @package SimpleTestEx
*/
class Notice {
var $label;
var $status;
function Notice($label, $error) {
$this->label = $label;
$this->status = $error;
}
function getLabel() {
return $this->label;
}
function run(&$reporter) {
$reporter->paintGroupStart(basename(__FILE__), $this->getSize());
$reporter->paintNotice(get_class_ex($this) .
' ['. $this->getLabel() .'] with status [' . $this->status . ']');
$reporter->paintGroupEnd($this->getLabel());
return $reporter->getStatus();
}
function getSize() {
return 0;
}
}
/**
* A failing folder test for when the test-user specifies an invalid directory
* (run.php?folder=woops).
* @package SimpleTestEx
*/
class BadFolderTest extends BadTest { }
/**
* A failing auto test for when no unit test files are found.
* @package SimpleTestEx
*/
class BadAutoGroupTest extends BadTest { }
/**
* Auto group test notices - 1. Search complete. 2. A test file has been found.
* @package SimpleTestEx
*/
class AutoGroupTestNotice extends Notice { }
class FindFileNotice extends Notice { }
?>
-110
View File
@@ -1,110 +0,0 @@
<?php
/**
* Run the unit tests.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @version $Id$
* @package SimpleTestEx
*/
/** */
require_once(dirname(__FILE__).'/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/simpletestlib.php');
require_once('ex_simple_test.php');
require_once('ex_reporter.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
/* The UNITTEST constant can be checked elsewhere if you need to know
* when your code is being run as part of a unit test. */
define('UNITTEST', true);
$langfile = 'simpletest';
// CGI arguments
$path = optional_param('path', null, PARAM_PATH);
$showpasses = optional_param('showpasses', false, PARAM_BOOL);
$showsearch = optional_param('showsearch', false, PARAM_BOOL);
$thorough = optional_param('thorough', false, PARAM_BOOL);
// Print the header.
admin_externalpage_setup('reportsimpletest');
$strtitle = get_string('unittests', $langfile);
admin_externalpage_print_header();
if (!is_null($path)) {
// Create the group of tests.
$test =& new AutoGroupTest($showsearch, $thorough);
// OU specific. We use the _nonproject folder for stuff we want to
// keep in CVS, but which is not really relevant. It does no harm
// to leave this here.
$test->addIgnoreFolder($CFG->dirroot . '/_nonproject');
// Make the reporter, which is what displays the results.
$reporter = new ExHtmlReporter($showpasses);
if ($showsearch) {
print_heading('Searching for test cases');
}
flush();
// Work out what to test.
if (substr($path, 0, 1) == '/') {
$path = substr($path, 1);
}
$path = $CFG->dirroot . '/' . $path;
if (substr($path, -1) == '/') {
$path = substr($path, 0, -1);
}
$displaypath = substr($path, strlen($CFG->dirroot) + 1);
$ok = true;
if (is_file($path)) {
$test->addTestFile($path);
} else if (is_dir($path)){
$test->findTestFiles($path);
} else {
print_simple_box(get_string('pathdoesnotexist', $langfile, $path), '', '', '', '', 'errorbox');
$ok = false;
}
// If we have something to test, do it.
if ($ok) {
if ($path == $CFG->dirroot) {
$title = get_string('moodleunittests', $langfile, get_string('all', $langfile));
} else {
$title = get_string('moodleunittests', $langfile, $displaypath);
}
print_heading($title);
$test->run($reporter);
}
$formheader = get_string('retest', $langfile);
} else {
$displaypath = '';
$formheader = get_string('rununittests', $langfile);
}
// Print the form for adjusting options.
print_simple_box_start('center', '70%');
echo '<form method="get" action="index.php">';
echo '<fieldset class="invisiblefieldset">';
print_heading($formheader);
echo '<p>'; print_checkbox('showpasses', 1, $showpasses, get_string('showpasses', $langfile)); echo '</p>';
echo '<p>'; print_checkbox('showsearch', 1, $showsearch, get_string('showsearch', $langfile)); echo '</p>';
echo '<p>'; print_checkbox('thorough', 1, $thorough, get_string('thorough', $langfile)); echo '</p>';
echo '<p>';
echo '<label for="path">', get_string('onlytest', $langfile), '</label> ';
echo '<input type="text" id="path" name="path" value="', $displaypath, '" size="40" />';
echo '</p>';
echo '<input type="submit" value="' . get_string('runtests', $langfile) . '" />';
echo '</fieldset>';
echo '</form>';
print_simple_box_end();
// Footer.
admin_externalpage_print_footer();
?>
+24 -36
View File
@@ -4,31 +4,22 @@
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->dirroot.'/course/report/stats/lib.php');
require_once($CFG->libdir.'/adminlib.php');
if (empty($CFG->enablestats)) {
error("Stats is not enabled.");
}
admin_externalpage_setup('reportstats');
admin_externalpage_print_header();
$courseid = optional_param('course', SITEID, PARAM_INT);
$courseid = required_param('course', PARAM_INT);
$report = optional_param('report', 0, PARAM_INT);
$time = optional_param('time', 0, PARAM_INT);
$mode = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT);
$userid = optional_param('userid', 0, PARAM_INT);
$roleid = 0;
if ($report > 50) {
$roleid = substr($report,1);
$report = 5;
}
if ($report == STATS_REPORT_USER_LOGINS) {
$courseid = SITEID; //override
}
if ($mode == STATS_MODE_RANKED) {
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3);
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report.php?time='.$time);
}
if (!$course = get_record("course","id",$courseid)) {
@@ -42,34 +33,31 @@
}
require_login();
if (empty($CFG->enablestats)) {
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
if (!isteacher($course->id)) {
error("You need to be a teacher to use this page");
}
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
stats_check_uptodate($course->id);
$strreports = get_string("reports");
$strstats = get_string('stats');
$menu = report_stats_mode_menu($course, $mode, $time);
// $strreports = get_string("reports");
// $strstats = get_string('stats');
//
// $menu = report_stats_mode_menu($course, $mode, $time); // add 4th $url parameter if uncommented!
//
//
// $crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
// <a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
// $strstats";
// print_header("$course->shortname: $strstats", "$course->fullname",
// $crumb, '', '', true, '&nbsp;', $menu);
$crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
<a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
$strstats";
print_header("$course->shortname: $strstats", "$course->fullname",
$crumb, '', '', true, '&nbsp', $menu);
require_once($CFG->dirroot.'/course/report/stats/report.php');
print_footer();
admin_externalpage_print_footer();
?>
?>
+16
View File
@@ -0,0 +1,16 @@
<?php //$Id$
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
if (!empty($CFG->enablestats)) {
echo '<p style="text-align:center;">';
echo '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
echo '</p>';
$statsstatus = stats_check_uptodate($course->id);
if ($statsstatus !== NULL) {
notify ($statsstatus);
}
}
?>
-102
View File
@@ -1,102 +0,0 @@
<?php
/**
* this page defines what roles can access (grant user that role and override that roles'
* capabilities in different context. For example, we can say that Teachers can only grant
* student role or modify student role's capabilities. Note that you need both the right
* capability moodle/role:assign or moodle/role:manage and this database table roles_deny_grant
* to be able to grant roles. If a user has moodle/role:manage at site level assignment
* then he can modify the roles_allow_assign table via this interface.
*/
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('defineroles');
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/role:manage', $sitecontext);
/// form processiong here
/// get all roles
$roles = get_all_roles();
if ($grant = data_submitted()) {
foreach ($grant as $grole => $val) {
if ($grole == 'dummy') {
continue;
}
$string = explode('_', $grole);
$temp[$string[1]][$string[2]] = 1; // if set, means can access
}
// if current assignment is in data_submitted, ignore, else, write deny into db
foreach ($roles as $srole) {
foreach ($roles as $trole) {
if (isset($temp[$srole->id][$trole->id])) { // if set, need to write to db
if (!$record = get_record('role_allow_assign', 'roleid', $srole->id, 'allowassign', $trole->id)) {
allow_assign($srole->id, $trole->id);
}
} else { //if set, means can access, attempt to remove it from db
delete_records('role_allow_assign', 'roleid', $srole->id, 'allowassign', $trole->id);
}
}
}
// updated allowassigns sitewide...
mark_context_dirty($sitecontext->path);
}
/// displaying form here
admin_externalpage_print_header();
$currenttab='allowassign';
require_once('managetabs.php');
$table->tablealign = 'center';
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '90%';
$table->align[] = 'right';
/// get all the roles identifier
foreach ($roles as $role) {
$rolesname[] = format_string($role->name);
$roleids[] = $role->id;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
}
$table->head = array_merge(array(''), $rolesname);
foreach ($roles as $role) {
$beta = get_box_list($role->id, $roleids);
$table->data[] = array_merge(array(format_string($role->name)), $beta);
}
print_simple_box(get_string('configallowassign', 'admin'), 'center');
echo '<form action="allowassign.php" method="post">';
print_table($table);
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
echo '</div></form>';
admin_externalpage_print_footer();
function get_box_list($roleid, $arraylist){
foreach ($arraylist as $targetid) {
if (get_record('role_allow_assign', 'roleid', $roleid, 'allowassign', $targetid)) {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" checked="checked"/>';
} else {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" />';
}
}
return $array;
}
?>
-99
View File
@@ -1,99 +0,0 @@
<?php
/**
* this page defines what roles can override (override roles in different context. For example,
* we can say that Admin can override teacher roles in a course
* To be able to override roles. If a user has moodle/role:override at context level
* and be in the roles_allow_override table.
*/
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('defineroles');
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/role:manage', $sitecontext);
/// form processiong here
/// get all roles
$roles = get_all_roles();
if ($grant = data_submitted()) {
foreach ($grant as $grole => $val) {
if ($grole == 'dummy') {
continue;
}
$string = explode('_', $grole);
$temp[$string[1]][$string[2]] = 1; // if set, means can access
}
// if current assignment is in data_submitted, ignore, else, write deny into db
foreach ($roles as $srole) {
foreach ($roles as $trole) {
if (isset($temp[$srole->id][$trole->id])) { // if set, need to write to db
if (!$record = get_record('role_allow_override', 'roleid', $srole->id, 'allowoverride', $trole->id)) {
allow_override($srole->id, $trole->id);
}
} else { //if set, means can access, attempt to remove it from db
delete_records('role_allow_override', 'roleid', $srole->id, 'allowoverride', $trole->id);
}
}
}
// updated allowoverride sitewide...
mark_context_dirty($sitecontext->path);
}
/// displaying form here
admin_externalpage_print_header();
$currenttab='allowoverride';
require_once('managetabs.php');
$table->tablealign = 'center';
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '90%';
$table->align[] = 'right';
/// get all the roles identifier
foreach ($roles as $role) {
$rolesname[] = format_string($role->name);
$roleids[] = $role->id;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
}
$table->head = array_merge(array(''), $rolesname);
foreach ($roles as $role) {
$beta = get_box_list($role->id, $roleids);
$table->data[] = array_merge(array(format_string($role->name)), $beta);
}
print_simple_box(get_string('configallowoverride', 'admin'), 'center');
echo '<form action="allowoverride.php" method="post">';
print_table($table);
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
echo '</div></form>';
admin_externalpage_print_footer();
// returns array
function get_box_list($roleid, $arraylist){
foreach ($arraylist as $targetid) {
if (get_record('role_allow_override', 'roleid', $roleid, 'allowoverride', $targetid)) {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" checked="checked"/>';
} else {
$array[] = '<input type="checkbox" name="s_'.$roleid.'_'.$targetid.'" value="1" />';
}
}
return $array;
}
?>
-112
View File
@@ -1,112 +0,0 @@
<form id="assignform" method="post" action="">
<div style="text-align:center;">
<label for="extendperiod"><?php print_string('enrolperiod') ?></label> <?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?>
<label for="extendbase"><?php print_string('startingfrom') ?></label> <?php choose_from_menu($basemenu, "extendbase", 3, ""); ?>
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
<table summary="" style="margin-left:auto;margin-right:auto" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<label for="removeselect"><?php print_string('existingusers', 'role', count($contextusers)); ?></label>
<br />
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=false;
getElementById('assignform').addselect.selectedIndex=-1;">
<?php
$i = 0;
foreach ($contextusers as $contextuser) {
$fullname = fullname($contextuser, true);
if ($contextuser->hidden) {
$hidden=' ('.get_string('hiddenassign').') ';
} else {
$hidden="";
}
echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n";
$i++;
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?>
</select></td>
<td valign="top">
<br />
<label title="<?php print_string('hiddenassign') ?>">
<input type="checkbox" name="hidden" value="1" />
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" />
<?php helpbutton('hiddenassign', get_string('hiddenassign')); ?>
</label>
<?php check_theme_arrows(); ?>
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo $THEME->larrow.'&nbsp;'.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').'&nbsp;'.$THEME->rarrow; ?>" title="<?php print_string('remove'); ?>" />
</p>
</td>
<td valign="top">
<label for="addselect"><?php print_string('potentialusers', 'role', $usercount); ?></label>
<br />
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=false;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;">
<?php
$i=0;
if (!empty($searchtext)) {
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
echo "</optgroup>\n";
} else {
if ($usercount > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else {
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
}
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?>
</select>
<br />
<label for="searchtext" class="accesshide"><?php p($strsearch) ?></label>
<input type="text" name="searchtext" id="searchtext" size="30" value="<?php p($searchtext, true) ?>"
onfocus ="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;
getElementById('assignform').addselect.selectedIndex=-1;"
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
if (keyCode == 13) {
getElementById('assignform').previoussearch.value=1;
getElementById('assignform').submit();
} " />
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
<?php
if (!empty($searchtext)) {
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
}
?>
</td>
</tr>
</table>
</div>
</form>
-462
View File
@@ -1,462 +0,0 @@
<?php // $Id$
// Script to assign users to contexts
require_once('../../config.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->libdir.'/adminlib.php');
define("MAX_USERS_PER_PAGE", 5000);
define("MAX_USERS_TO_LIST_PER_ROLE", 10);
$contextid = required_param('contextid',PARAM_INT); // context id
$roleid = optional_param('roleid', 0, PARAM_INT); // required role id
$add = optional_param('add', 0, PARAM_BOOL);
$remove = optional_param('remove', 0, PARAM_BOOL);
$showall = optional_param('showall', 0, PARAM_BOOL);
$searchtext = optional_param('searchtext', '', PARAM_RAW); // search string
$previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
$hidden = optional_param('hidden', 0, PARAM_BOOL); // whether this assignment is hidden
$extendperiod = optional_param('extendperiod', 0, PARAM_INT);
$extendbase = optional_param('extendbase', 0, PARAM_INT);
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
$errors = array();
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
$baseurl = 'assign.php?contextid='.$contextid;
if (!empty($userid)) {
$baseurl .= '&amp;userid='.$userid;
}
if (!empty($courseid)) {
$baseurl .= '&amp;courseid='.$courseid;
}
if (! $context = get_context_instance_by_id($contextid)) {
error("Context ID was incorrect (can't find it)");
}
$inmeta = 0;
if ($context->contextlevel == CONTEXT_COURSE) {
$courseid = $context->instanceid;
if ($course = get_record('course', 'id', $courseid)) {
$inmeta = $course->metacourse;
} else {
error('Invalid course id');
}
} else if (!empty($courseid)){ // we need this for user tabs in user context
if (!$course = get_record('course', 'id', $courseid)) {
error('Invalid course id');
}
} else {
$courseid = SITEID;
$course = clone($SITE);
}
require_login($course);
require_capability('moodle/role:assign', $context);
/// needed for tabs.php
$overridableroles = get_overridable_roles($context, 'name', ROLENAME_BOTH);
$assignableroles = get_assignable_roles($context, 'name', ROLENAME_BOTH);
/// Get some language strings
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strroletoassign = get_string('roletoassign', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');
$strparticipants = get_string('participants');
$strsearchresults = get_string('searchresults');
$unlimitedperiod = get_string('unlimited');
$defaultperiod = $course->enrolperiod;
for ($i=1; $i<=365; $i++) {
$seconds = $i * 86400;
$periodmenu[$seconds] = get_string('numdays', '', $i);
}
$timeformat = get_string('strftimedate');
$today = time();
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
// MDL-12420, preventing course start date showing up as an option at system context and front page roles.
if ($course->startdate > 0) {
$basemenu[0] = get_string('startdate') . ' (' . userdate($course->startdate, $timeformat) . ')';
}
if ($course->enrollable != 2 || ($course->enrolstartdate == 0 || $course->enrolstartdate <= $today) && ($course->enrolenddate == 0 || $course->enrolenddate > $today)) {
$basemenu[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
}
if($course->enrollable == 2) {
if($course->enrolstartdate > 0) {
$basemenu[4] = get_string('courseenrolstartdate') . ' (' . userdate($course->enrolstartdate, $timeformat) . ')';
}
if($course->enrolenddate > 0) {
$basemenu[5] = get_string('courseenrolenddate') . ' (' . userdate($course->enrolenddate, $timeformat) . ')';
}
}
/// Make sure this user can assign that role
if ($roleid) {
if (!user_can_assign($context, $roleid)) {
error ('you can not override this role in this context');
}
}
if ($userid) {
$user = get_record('user', 'id', $userid);
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
}
/// Print the header and tabs
if ($context->contextlevel == CONTEXT_USER) {
/// course header
$navlinks = array();
if ($courseid != SITEID) {
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
}
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$fullname", "$fullname", $navigation, "", "", true, "&nbsp;", navmenu($course));
/// site header
} else {
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->fullname: $fullname", $course->fullname, $navigation, "", "", true, "&nbsp;", navmenu($course));
}
$showroles = 1;
$currenttab = 'assign';
include_once($CFG->dirroot.'/user/tabs.php');
} else if ($context->contextlevel == CONTEXT_SYSTEM) {
admin_externalpage_setup('assignroles');
admin_externalpage_print_header();
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
admin_externalpage_setup('frontpageroles');
admin_externalpage_print_header();
$currenttab = 'assign';
include_once('tabs.php');
} else {
$currenttab = 'assign';
include_once('tabs.php');
}
/// Process incoming role assignment
if ($frm = data_submitted()) {
if ($add and !empty($frm->addselect) and confirm_sesskey()) {
foreach ($frm->addselect as $adduser) {
if (!$adduser = clean_param($adduser, PARAM_INT)) {
continue;
}
$allow = true;
if ($inmeta) {
if (has_capability('moodle/course:managemetacourse', $context, $adduser)) {
//ok
} else {
$managerroles = get_roles_with_capability('moodle/course:managemetacourse', CAP_ALLOW, $context);
if (!empty($managerroles) and !array_key_exists($roleid, $managerroles)) {
$erruser = get_record('user', 'id', $adduser, '','','','', 'id, firstname, lastname');
$errors[] = get_string('metaassignerror', 'role', fullname($erruser));
$allow = false;
}
}
}
if ($allow) {
switch($extendbase) {
case 0:
$timestart = $course->startdate;
break;
case 3:
$timestart = $today;
break;
case 4:
$timestart = $course->enrolstartdate;
break;
case 5:
$timestart = $course->enrolenddate;
break;
}
if($extendperiod > 0) {
$timeend = $timestart + $extendperiod;
} else {
$timeend = 0;
}
if (! role_assign($roleid, $adduser, 0, $context->id, $timestart, $timeend, $hidden)) {
$errors[] = "Could not add user with id $adduser to this role!";
}
}
}
$rolename = get_field('role', 'name', 'id', $roleid);
add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$topleveladmin = false;
// we only worry about this if the role has doanything capability at site level
if ($context->id == $sitecontext->id && $adminroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext)) {
foreach ($adminroles as $adminrole) {
if ($adminrole->id == $roleid) {
$topleveladmin = true;
}
}
}
foreach ($frm->removeselect as $removeuser) {
$removeuser = clean_param($removeuser, PARAM_INT);
if ($topleveladmin && ($removeuser == $USER->id)) { // Prevent unassigning oneself from being admin
continue;
}
if (! role_unassign($roleid, $removeuser, 0, $context->id)) {
$errors[] = "Could not remove user with id $removeuser from this role!";
} else if ($inmeta) {
sync_metacourse($courseid);
$newroles = get_user_roles($context, $removeuser, false);
if (!empty($newroles) and !array_key_exists($roleid, $newroles)) {
$erruser = get_record('user', 'id', $removeuser, '','','','', 'id, firstname, lastname');
$errors[] = get_string('metaunassignerror', 'role', fullname($erruser));
$allow = false;
}
}
}
$rolename = get_field('role', 'name', 'id', $roleid);
add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
} else if ($showall) {
$searchtext = '';
$previoussearch = 0;
}
}
if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles');
} else {
print_heading_with_help(get_string('assignrolesin', 'role', print_context_name($context)), 'assignroles');
}
if ($context->contextlevel==CONTEXT_SYSTEM) {
print_box(get_string('globalroleswarning', 'role'));
}
if ($roleid) { /// prints a form to swap roles
/// Get all existing participants in this context.
// Why is this not done with get_users???
if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, ra.hidden')) {
$contextusers = array();
}
$select = "username <> 'guest' AND deleted = 0 AND confirmed = 1";
$usercount = count_records_select('user', $select) - count($contextusers);
$searchtext = trim($searchtext);
if ($searchtext !== '') { // Search for a subset of remaining users
$LIKE = sql_ilike();
$FULLNAME = sql_fullname();
$selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
$select .= $selectsql;
} else {
$selectsql = "";
}
if ($context->contextlevel > CONTEXT_COURSE) { // mod or block (or group?)
/************************************************************************
* *
* context level is above or equal course context level *
* in this case we pull out all users matching search criteria (if any) *
* *
* MDL-11324 *
* a mini get_users_by_capability() call here, this is done instead of *
* get_users_by_capability() because *
* 1) get_users_by_capability() does not deal with searching by name *
* 2) exceptions array can be potentially large for large courses *
* 3) get_recordset_sql() is more efficient *
* *
************************************************************************/
if ($possibleroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context)) {
$doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
$validroleids = array();
foreach ($possibleroles as $possiblerole) {
if (isset($doanythingroles[$possiblerole->id])) { // We don't want these included
continue;
}
if ($caps = role_context_capabilities($possiblerole->id, $context, 'moodle/course:view')) { // resolved list
if (isset($caps['moodle/course:view']) && $caps['moodle/course:view'] > 0) { // resolved capability > 0
$validroleids[] = $possiblerole->id;
}
}
}
if ($validroleids) {
$roleids = '('.implode(',', $validroleids).')';
$select = " SELECT u.id, u.firstname, u.lastname, u.email";
$countselect = "SELECT COUNT(u.id)";
$from = " FROM {$CFG->prefix}user u
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
INNER JOIN {$CFG->prefix}role r ON r.id = ra.roleid";
$where = " WHERE ra.contextid ".get_related_contexts_string($context)."
AND u.deleted = 0
AND ra.roleid in $roleids";
$excsql = " AND u.id NOT IN (
SELECT u.id
FROM {$CFG->prefix}role_assignments r,
{$CFG->prefix}user u
WHERE r.contextid = $contextid
AND u.id = r.userid
AND r.roleid = $roleid
$selectsql)";
$availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
}
$usercount = $availableusers->_numOfRows;
}
} else {
/************************************************************************
* *
* context level is above or equal course context level *
* in this case we pull out all users matching search criteria (if any) *
* *
************************************************************************/
/// MDL-11111 do not include user already assigned this role in this context as available users
/// so that the number of available users is right and we save time looping later
$availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
FROM '.$CFG->prefix.'user
WHERE '.$select.'
AND id NOT IN (
SELECT u.id
FROM '.$CFG->prefix.'role_assignments r,
'.$CFG->prefix.'user u
WHERE r.contextid = '.$contextid.'
AND u.id = r.userid
AND r.roleid = '.$roleid.'
'.$selectsql.')
ORDER BY lastname ASC, firstname ASC');
$usercount = $availableusers->_numOfRows;
}
echo '<div class="selector">';
$assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles;
popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&amp;courseid=$courseid&amp;contextid=$contextid&amp;roleid=",
$assignableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletoassign);
echo '</div>';
print_simple_box_start('center');
include('assign.html');
print_simple_box_end();
if (!empty($errors)) {
$msg = '<p>';
foreach ($errors as $e) {
$msg .= $e.'<br />';
}
$msg .= '</p>';
print_simple_box_start('center');
notify($msg);
print_simple_box_end();
}
} else { // Print overview table
// sync metacourse enrolments if needed
if ($inmeta) {
sync_metacourse($course);
}
// Get the names of role holders for roles with between 1 and MAX_USERS_TO_LIST_PER_ROLE users,
// and so determine whether to show the extra column.
$rolehodlercount = array();
$rolehodlernames = array();
$strmorethanten = get_string('morethan', 'role', MAX_USERS_TO_LIST_PER_ROLE);
$showroleholders = false;
foreach ($assignableroles as $roleid => $rolename) {
$countusers = count_role_users($roleid, $context);
$rolehodlercount[$roleid] = $countusers;
$roleusers = '';
if (0 < $countusers && $countusers <= MAX_USERS_TO_LIST_PER_ROLE) {
$roleusers = get_role_users($roleid, $context, false, 'u.id, u.lastname, u.firstname');
if (!empty($roleusers)) {
$strroleusers = array();
foreach ($roleusers as $user) {
$strroleusers[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '" >' . fullname($user) . '</a>';
}
$rolehodlernames[$roleid] = implode('<br />', $strroleusers);
$showroleholders = true;
}
} else if ($countusers > MAX_USERS_TO_LIST_PER_ROLE) {
$rolehodlernames[$roleid] = '<a href="'.$baseurl.'&amp;roleid='.$roleid.'">'.$strmorethanten.'</a>';
} else {
$rolehodlernames[$roleid] = '';
}
}
// Print overview table
$table->tablealign = 'center';
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '60%';
$table->head = array(get_string('roles', 'role'), get_string('description'), get_string('users'));
$table->wrap = array('nowrap', '', 'nowrap');
$table->align = array('right', 'left', 'center');
if ($showroleholders) {
$table->head[] = '';
$table->wrap[] = 'nowrap';
$table->align[] = 'left';
}
foreach ($assignableroles as $roleid => $rolename) {
$description = format_string(get_field('role', 'description', 'id', $roleid));
$row = array('<a href="'.$baseurl.'&amp;roleid='.$roleid.'">'.$rolename.'</a>',$description, $rolehodlercount[$roleid]);
if ($showroleholders) {
$row[] = $rolehodlernames[$roleid];
}
$table->data[] = $row;
}
print_table($table);
}
print_footer($course);
?>
-219
View File
@@ -1,219 +0,0 @@
<?php //$Id$
switch ($action) {
case 'add':
$submitlabel = get_string('addrole', 'role');
break;
case 'edit':
default:
$submitlabel = get_string('savechanges');
}
if ($action == 'view') {
?>
<?php
}
?>
<form id="rolesform" action="manage.php" method="post">
<fieldset class="invisiblefieldset">
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
<input type="hidden" name="action" value="<?php if ($action != 'view') { echo p($action); } ?>" />
</fieldset>
<table class="roledesc" cellpadding="9" cellspacing="0">
<?php if ($action == 'view') { ?>
<tr valign="top">
<td align="right"><?php print_string('name') ?>:</td>
<td><?php p($role->name); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('shortname') ?>:</td>
<td><?php p($role->shortname); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('description') ?>:</td>
<td><?php p($role->description); $usehtmleditor = false; ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('legacytype', 'role') ?>:</td>
<td><?php
$usehtmleditor = false;
if (empty($role->legacytype)) {
print_string('none');
} else {
print_string('legacy:'.$role->legacytype, 'role');
}
?>
</td>
</tr>
<?php } else { ?>
<tr valign="top">
<td align="right"><label for="name"><?php print_string('name') ?></label></td>
<td><?php
echo '<input type="text" id="name" name="name" maxlength="254" size="50" value="'.s($role->name).'" />';
if (isset($errors["name"])) formerr($errors["name"]);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><label for="shortname"><?php print_string('shortname') ?></label></td>
<td><?php
echo '<input type="text" id="shortname" name="shortname" maxlength="100" size="15" value="'.s($role->shortname).'" />';
if (isset($errors["shortname"])) formerr($errors["shortname"]);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><label for="edit-description"><?php print_string('description') ?></label></td>
<td><?php
print_textarea($usehtmleditor, 10, 50, 50, 10, 'description', $role->description);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><label for="menulegacytype"><?php print_string('legacytype', 'role') ?></label></td>
<td><?php
$options = array();
$options[''] = get_string('none');
$legacyroles = get_legacy_roles();
foreach($legacyroles as $ltype=>$lcap) {
$options[$ltype] = get_string('legacy:'.$ltype, 'role');
}
choose_from_menu($options, 'legacytype', $role->legacytype, '');
?>
</td>
</tr>
<?php } ?>
</table>
<?php
print_heading_with_help(get_string('permissions','role'), 'permissions');
$strinherit = get_string('notset','role');
$strallow = get_string('allow','role');
$strprevent = get_string('prevent','role');
$strprohibit = get_string('prohibit','role');
?>
<table class="rolecap">
<tr>
<th class="name" align="left" scope="col"><?php print_string('capability','role') ?></th>
<th class="inherit" scope="col"><?php p($strinherit); ?></th>
<th class="allow" scope="col"><?php p($strallow); ?></th>
<th class="prevent" scope="col"><?php p($strprevent); ?></th>
<th class="prohibit" scope="col"><?php p($strprohibit); ?></th>
<th class="risk" colspan="5" scope="col"><?php print_string('risks','role') ?></th>
</tr>
<?php
// init these 2
$contextlevel = 0;
$component = '';
$strrisks = s(get_string('risks', 'role'));
// MDL-11687
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
// prepare legacy defaults
if (!empty($role->legacytype)) {
$defaultcaps = get_default_capabilities($role->legacytype);
} else {
$defaultcaps = false;
}
foreach ($capabilities as $capability) {
//legacy caps have their own selector
if (islegacy($capability->name)) {
continue;
}
// prints a breaker if component or name or context level
if (component_level_changed($capability, $component, $contextlevel)) {
//if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.
get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
}
// these 2 are used to see to group same mod/core capabilities together
$contextlevel = $capability->contextlevel;
$component = $capability->component;
if (empty($errors)) {
// check the capability override for this cap, this role in this context
$localoverride = get_local_override($roleid, $sitecontext->id, $capability->name);
} else {
$localoverride = new object();
$localoverride->permission = $role->{$capability->name};
}
$disabled = ($action != 'edit' and $action != 'add') ? ' disabled="disabled" ' : '';
$riskinfo = '<td class="risk managetrust">';
$rowclasses = '';
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
$rowclasses .= ' riskmanagetrust';
}
$riskinfo .= '</td><td class="risk config">';
if (RISK_CONFIG & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
$rowclasses .= ' riskconfig';
}
$riskinfo .= '</td><td class="risk xss">';
if (RISK_XSS & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
$rowclasses .= ' riskxss';
}
$riskinfo .= '</td><td class="risk personal">';
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
$rowclasses .= ' riskpersonal';
}
$riskinfo .= '</td><td class="risk spam">';
if (RISK_SPAM & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
$rowclasses .= ' riskspam';
}
$riskinfo .= '</td>';
$isinherit = (!isset($defaultcaps[$capability->name]) or $defaultcaps[$capability->name] == CAP_INHERIT) ? 'capdefault' : '';
$isallow = (isset($defaultcaps[$capability->name]) and $defaultcaps[$capability->name] == CAP_ALLOW) ? 'capdefault' : '';
$isprevent = (isset($defaultcaps[$capability->name]) and $defaultcaps[$capability->name] == CAP_PREVENT) ? 'capdefault' : '';
$isprohibit = (isset($defaultcaps[$capability->name]) and $defaultcaps[$capability->name] == CAP_PROHIBIT) ? 'capdefault' : '';
?>
<tr class="rolecap <?php echo $rowclasses; ?>">
<td class="name"><span class="cap-desc"><a onclick="this.target='docspopup'" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></span></td>
<td class="inherit <?php echo $isinherit ?>">
<input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_INHERIT ?>" <?php if (!isset($localoverride->permission) || $localoverride->permission==CAP_INHERIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
<td class="allow <?php echo $isallow ?>">
<input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_ALLOW ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_ALLOW){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
<td class="prevent <?php echo $isprevent ?>" >
<input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PREVENT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PREVENT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
<td class="prohibit <?php echo $isprohibit ?>" >
<input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>" value="<?php echo CAP_PROHIBIT ?>" <?php if (isset($localoverride->permission) && $localoverride->permission==CAP_PROHIBIT){ echo 'checked="checked"'; }?> <?php echo $disabled; ?>/></td>
<?php echo $riskinfo; ?>
</tr>
<?php } ?>
</table>
<?php if ($action != 'view') { ?>
<div class="submit buttons">
<input type="submit" value="<?php p($submitlabel) ?>" />
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
</div>
<?php } ?>
</form>
-575
View File
@@ -1,575 +0,0 @@
<?php //$Id$
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('defineroles');
$roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editing a role
$name = optional_param('name', '', PARAM_MULTILANG); // new role name
$shortname = optional_param('shortname', '', PARAM_RAW); // new role shortname, special cleaning before storage
$description = optional_param('description', '', PARAM_CLEAN); // new role desc
$action = optional_param('action', '', PARAM_ALPHA);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$cancel = optional_param('cancel', 0, PARAM_BOOL);
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/role:manage', $sitecontext);
if ($cancel) {
redirect('manage.php');
}
$errors = array();
$newrole = false;
$roles = get_all_roles();
$rolescount = count($roles);
/// fix sort order if needed
$rolesort = array();
$i = 0;
foreach ($roles as $rolex) {
$rolesort[$i] = $rolex->id;
if ($rolex->sortorder != $i) {
$r = new object();
$r->id = $rolex->id;
$r->sortorder = $i;
update_record('role', $r);
$roles[$rolex->id]->sortorder = $i;
}
$i++;
}
// do not delete these default system roles
$defaultroles = array();
$defaultroles[] = $CFG->notloggedinroleid;
$defaultroles[] = $CFG->guestroleid;
$defaultroles[] = $CFG->defaultuserroleid;
$defaultroles[] = $CFG->defaultcourseroleid;
/// form processing, editing a role, adding a role, deleting a role etc.
switch ($action) {
case 'add':
if ($data = data_submitted() and confirm_sesskey()) {
$shortname = moodle_strtolower(clean_param(clean_filename($shortname), PARAM_SAFEDIR)); // only lowercase safe ASCII characters
$legacytype = required_param('legacytype', PARAM_RAW);
$legacyroles = get_legacy_roles();
if (!array_key_exists($legacytype, $legacyroles)) {
$legacytype = '';
}
if (empty($name)) {
$errors['name'] = get_string('errorbadrolename', 'role');
} else if (count_records('role', 'name', $name)) {
$errors['name'] = get_string('errorexistsrolename', 'role');
}
if (empty($shortname)) {
$errors['shortname'] = get_string('errorbadroleshortname', 'role');
} else if (count_records('role', 'shortname', $shortname)) {
$errors['shortname'] = get_string('errorexistsroleshortname', 'role');
}
if (empty($errors)) {
$newroleid = create_role($name, $shortname, $description);
// set proper legacy type
if (!empty($legacytype)) {
assign_capability($legacyroles[$legacytype], CAP_ALLOW, $newroleid, $sitecontext->id);
}
} else {
$newrole = new object();
$newrole->name = $name;
$newrole->shortname = $shortname;
$newrole->description = $description;
$newrole->legacytype = $legacytype;
}
$allowed_values = array(CAP_INHERIT, CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT);
$capabilities = fetch_context_capabilities($sitecontext); // capabilities applicable in this context
foreach ($capabilities as $cap) {
if (!isset($data->{$cap->name})) {
continue;
}
// legacy caps have their own selector
if (islegacy($data->{$cap->name})) {
continue;
}
$capname = $cap->name;
$value = clean_param($data->{$cap->name}, PARAM_INT);
if (!in_array($value, $allowed_values)) {
continue;
}
if (empty($errors)) {
assign_capability($capname, $value, $newroleid, $sitecontext->id);
} else {
$newrole->$capname = $value;
}
}
// added a role sitewide...
mark_context_dirty($sitecontext->path);
if (empty($errors)) {
$rolename = get_field('role', 'name', 'id', $newroleid);
add_to_log(SITEID, 'role', 'add', 'admin/roles/manage.php?action=add', $rolename, '', $USER->id);
redirect('manage.php');
}
}
break;
case 'edit':
if ($data = data_submitted() and confirm_sesskey()) {
$shortname = moodle_strtolower(clean_param(clean_filename($shortname), PARAM_SAFEDIR)); // only lowercase safe ASCII characters
$legacytype = required_param('legacytype', PARAM_RAW);
$legacyroles = get_legacy_roles();
if (!array_key_exists($legacytype, $legacyroles)) {
$legacytype = '';
}
if (empty($name)) {
$errors['name'] = get_string('errorbadrolename', 'role');
} else if ($rs = get_records('role', 'name', $name)) {
unset($rs[$roleid]);
if (!empty($rs)) {
$errors['name'] = get_string('errorexistsrolename', 'role');
}
}
if (empty($shortname)) {
$errors['shortname'] = get_string('errorbadroleshortname', 'role');
} else if ($rs = get_records('role', 'shortname', $shortname)) {
unset($rs[$roleid]);
if (!empty($rs)) {
$errors['shortname'] = get_string('errorexistsroleshortname', 'role');
}
}
if (!empty($errors)) {
$newrole = new object();
$newrole->name = $name;
$newrole->shortname = $shortname;
$newrole->description = $description;
$newrole->legacytype = $legacytype;
}
$allowed_values = array(CAP_INHERIT, CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT);
$capabilities = fetch_context_capabilities($sitecontext); // capabilities applicable in this context
foreach ($capabilities as $cap) {
if (!isset($data->{$cap->name})) {
continue;
}
// legacy caps have their own selector
if (islegacy($data->{$cap->name}) === 0 ) {
continue;
}
$capname = $cap->name;
$value = clean_param($data->{$cap->name}, PARAM_INT);
if (!in_array($value, $allowed_values)) {
continue;
}
if (!empty($errors)) {
$newrole->$capname = $value;
continue;
}
// edit default caps
$SQL = "SELECT * FROM {$CFG->prefix}role_capabilities
WHERE roleid = $roleid AND capability = '$capname'
AND contextid = $sitecontext->id";
$localoverride = get_record_sql($SQL);
if ($localoverride) { // update current overrides
if ($value == CAP_INHERIT) { // inherit = delete
unassign_capability($capname, $roleid, $sitecontext->id);
} else {
$localoverride->permission = $value;
$localoverride->timemodified = time();
$localoverride->modifierid = $USER->id;
update_record('role_capabilities', $localoverride);
}
} else { // insert a record
if ($value != CAP_INHERIT) {
assign_capability($capname, $value, $roleid, $sitecontext->id);
}
}
}
if (empty($errors)) {
// update normal role settings
$role->id = $roleid;
$role->name = $name;
$role->shortname = $shortname;
$role->description = $description;
if (!update_record('role', $role)) {
error('Could not update role!');
}
// set proper legacy type
foreach($legacyroles as $ltype=>$lcap) {
if ($ltype == $legacytype) {
assign_capability($lcap, CAP_ALLOW, $roleid, $sitecontext->id);
} else {
unassign_capability($lcap, $roleid);
}
}
// edited a role sitewide...
mark_context_dirty($sitecontext->path);
add_to_log(SITEID, 'role', 'edit', 'admin/roles/manage.php?action=edit&roleid='.$role->id, $role->name, '', $USER->id);
redirect('manage.php');
}
// edited a role sitewide - with errors, but still...
mark_context_dirty($sitecontext->path);
}
break;
case 'delete':
if (in_array($roleid, $defaultroles)) {
error('This role is used as one of the default system roles, it can not be deleted');
}
if ($confirm and data_submitted() and confirm_sesskey()) {
if (!delete_role($roleid)) {
// partially deleted a role sitewide...?
mark_context_dirty($sitecontext->path);
error('Could not delete role with ID '.$roleid);
}
// deleted a role sitewide...
mark_context_dirty($sitecontext->path);
} else if (confirm_sesskey()){
// show confirmation
admin_externalpage_print_header();
$optionsyes = array('action'=>'delete', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
$a = new object();
$a->id = $roleid;
$a->name = $roles[$roleid]->name;
$a->shortname = $roles[$roleid]->shortname;
$a->count = (int)count_records('role_assignments', 'roleid', $roleid);
notice_yesno(get_string('deleterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
die;
}
redirect('manage.php');
break;
case 'moveup':
if (array_key_exists($roleid, $roles) and confirm_sesskey()) {
$role = $roles[$roleid];
if ($role->sortorder > 0) {
$above = $roles[$rolesort[$role->sortorder - 1]];
if (!switch_roles($role, $above)) {
error("Cannot move role with ID $roleid");
}
}
}
redirect('manage.php');
break;
case 'movedown':
if (array_key_exists($roleid, $roles) and confirm_sesskey()) {
$role = $roles[$roleid];
if ($role->sortorder + 1 < $rolescount) {
$below = $roles[$rolesort[$role->sortorder + 1]];
if (!switch_roles($role, $below)) {
error("Cannot move role with ID $roleid");
}
}
}
redirect('manage.php');
break;
case 'duplicate':
if (!array_key_exists($roleid, $roles)) {
redirect('manage.php');
}
if ($confirm and data_submitted() and confirm_sesskey()) {
//ok - lets duplicate!
} else {
// show confirmation
admin_externalpage_print_header();
$optionsyes = array('action'=>'duplicate', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('action'=>'view', 'roleid'=>$roleid);
$a = new object();
$a->id = $roleid;
$a->name = $roles[$roleid]->name;
$a->shortname = $roles[$roleid]->shortname;
notice_yesno(get_string('duplicaterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get');
admin_externalpage_print_footer();
die;
}
// duplicate current role
$sourcerole = get_record('role','id',$roleid);
$fullname = $sourcerole->name;
$shortname = $sourcerole->shortname;
$currentfullname = "";
$currentshortname = "";
$counter = 0;
// find a name for the duplicated role
do {
if ($counter) {
$suffixfull = " ".get_string("copyasnoun")." ".$counter;
$suffixshort = "_".$counter;
} else {
$suffixfull = "";
$suffixshort = "";
}
$currentfullname = $fullname.$suffixfull;
// Limit the size of shortname - database column accepts <= 100 chars
$currentshortname = substr($shortname, 0, 100 - strlen($suffixshort)).$suffixshort;
$coursefull = get_record("role","name",addslashes($currentfullname));
$courseshort = get_record("role","shortname",addslashes($currentshortname));
$counter++;
} while ($coursefull || $courseshort);
$description = 'duplicate of '.$fullname;
if ($newrole = create_role($currentfullname, $currentshortname, $description)) {
// dupilcate all the capabilities
role_cap_duplicate($sourcerole, $newrole);
// dup'ed a role sitewide...
mark_context_dirty($sitecontext->path);
}
$rolename = get_field('role', 'name', 'id', $newrole);
add_to_log(SITEID, 'role', 'duplicate', 'admin/roles/manage.php?roleid='.$newrole.'&action=duplicate', $rolename, '', $USER->id);
redirect('manage.php');
break;
case 'reset':
if (!array_key_exists($roleid, $roles)) {
redirect('manage.php');
}
if ($confirm and data_submitted() and confirm_sesskey()) {
reset_role_capabilities($roleid);
// reset a role sitewide...
mark_context_dirty($sitecontext->path);
$rolename = get_field('role', 'name', 'id', $roleid);
add_to_log(SITEID, 'role', 'reset', 'admin/roles/manage.php?roleid='.$roleid.'&action=reset', $rolename, '', $USER->id);
redirect('manage.php?action=view&amp;roleid='.$roleid);
} else {
// show confirmation
admin_externalpage_print_header();
$optionsyes = array('action'=>'reset', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('action'=>'view', 'roleid'=>$roleid);
$a = new object();
$a->id = $roleid;
$a->name = $roles[$roleid]->name;
$a->shortname = $roles[$roleid]->shortname;
$a->legacytype = get_legacy_type($roleid);
if (empty($a->legacytype)) {
$warning = get_string('resetrolesurenolegacy', 'role', $a);
} else {
$warning = get_string('resetrolesure', 'role', $a);
}
notice_yesno($warning, 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get');
admin_externalpage_print_footer();
die;
}
break;
default:
break;
}
/// print UI now
admin_externalpage_print_header();
$currenttab = 'manage';
include_once('managetabs.php');
if (($roleid and ($action == 'view' or $action == 'edit')) or $action == 'add') { // view or edit role details
if ($action == 'add') {
$roleid = 0;
if (empty($errors) or empty($newrole)) {
$role = new object();
$role->name = '';
$role->shortname = '';
$role->description = '';
$role->legacytype = '';
} else {
$role = stripslashes_safe($newrole);
}
} else if ($action == 'edit' and !empty($errors) and !empty($newrole)) {
$role = stripslashes_safe($newrole);
} else {
if(!$role = get_record('role', 'id', $roleid)) {
error('Incorrect role ID!');
}
$role->legacytype = get_legacy_type($role->id);
}
foreach ($roles as $rolex) {
$roleoptions[$rolex->id] = strip_tags(format_string($rolex->name));
}
// this is the array holding capabilities of this role sorted till this context
$r_caps = role_context_capabilities($roleid, $sitecontext);
// this is the available capabilities assignable in this context
$capabilities = fetch_context_capabilities($sitecontext);
$usehtmleditor = can_use_html_editor();
switch ($action) {
case 'add':
print_heading_with_help(get_string('addrole', 'role'), 'roles');
break;
case 'view':
print_heading_with_help(get_string('viewrole', 'role'), 'roles');
break;
case 'edit':
print_heading_with_help(get_string('editrole', 'role'), 'roles');
break;
}
echo '<div class="selector">';
if ($action == 'view') {
popup_form('manage.php?action=view&amp;roleid=', $roleoptions, 'switchrole', $roleid, '', '', '',
false, 'self', get_string('selectrole', 'role'));
echo '<div class="buttons">';
$legacytype = get_legacy_type($roleid);
$options = array();
$options['roleid'] = $roleid;
$options['action'] = 'edit';
print_single_button('manage.php', $options, get_string('edit'));
$options['action'] = 'reset';
if (empty($legacytype)) {
print_single_button('manage.php', $options, get_string('resetrolenolegacy', 'role'));
} else {
print_single_button('manage.php', $options, get_string('resetrole', 'role'));
}
$options['action'] = 'duplicate';
print_single_button('manage.php', $options, get_string('duplicaterole', 'role'));
print_single_button('manage.php', null, get_string('listallroles', 'role'));
echo '</div>';
}
echo '</div>';
$lang = str_replace('_utf8', '', current_language());
print_simple_box_start('center');
include_once('manage.html');
print_simple_box_end();
if ($usehtmleditor) {
use_html_editor('description');
}
} else {
print_heading_with_help(get_string('roles', 'role'), 'roles');
$table = new object;
$table->tablealign = 'center';
$table->align = array('right', 'left', 'left', 'left');
$table->wrap = array('nowrap', '', 'nowrap','nowrap');
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '90%';
$table->data = array();
$table->head = array(get_string('name'),
get_string('description'),
get_string('shortname'),
get_string('edit'));
/*************************
* List all current roles *
**************************/
foreach ($roles as $role) {
$stredit = get_string('edit');
$strdelete = get_string('delete');
$strmoveup = get_string('moveup');
$strmovedown = get_string('movedown');
$row = array();
$row[0] = '<a href="manage.php?roleid='.$role->id.'&amp;action=view">'.format_string($role->name).'</a>';
$row[1] = format_text($role->description, FORMAT_HTML);
$row[2] = s($role->shortname);
$row[3] = '<a title="'.$stredit.'" href="manage.php?action=edit&amp;roleid='.$role->id.'">'.
'<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" /></a> ';
if (in_array($role->id, $defaultroles)) {
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
} else {
$row[3] .= '<a title="'.$strdelete.'" href="manage.php?action=delete&amp;roleid='.$role->id.'&amp;sesskey='.sesskey().'">'.
'<img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$strdelete.'" /></a> ';
}
if ($role->sortorder != 0) {
$row[3] .= '<a title="'.$strmoveup.'" href="manage.php?action=moveup&amp;roleid='.$role->id.'&amp;sesskey='.sesskey().'">'.
'<img src="'.$CFG->pixpath.'/t/up.gif" class="iconsmall" alt="'.$strmoveup.'" /></a> ';
} else {
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
}
if ($role->sortorder+1 < $rolescount) {
$row[3] .= '<a title="'.$strmovedown.'" href="manage.php?action=movedown&amp;roleid='.$role->id.'&amp;sesskey='.sesskey().'">'.
'<img src="'.$CFG->pixpath.'/t/down.gif" class="iconsmall" alt="'.$strmovedown.'" /></a> ';
} else {
$row[3] .= '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
}
$table->data[] = $row;
}
print_table($table);
$options = new object();
$options->action = 'add';
echo '<div class="buttons">';
print_single_button('manage.php', $options, get_string('addrole', 'role'), 'get');
echo '</div>';
}
admin_externalpage_print_footer();
die;
?>
-20
View File
@@ -1,20 +0,0 @@
<?php
// this page deals with the 2 tabs for manage.php and grant.php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
$toprow = array();
$toprow[] = new tabobject('manage', $CFG->wwwroot.'/'.$CFG->admin.'/roles/manage.php', get_string('manageroles', 'role'));
$toprow[] = new tabobject('allowassign', $CFG->wwwroot.'/'.$CFG->admin.'/roles/allowassign.php', get_string('allowassign', 'role'));
$toprow[] = new tabobject('allowoverride', $CFG->wwwroot.'/'.$CFG->admin.'/roles/allowoverride.php', get_string('allowoverride', 'role'));
$tabs = array($toprow);
print_tabs($tabs, $currenttab);
?>
-147
View File
@@ -1,147 +0,0 @@
<?php
$strinherit = get_string('inherit','role');
$strallow = get_string('allow','role');
$strprevent = get_string('prevent','role');
$strprohibit = get_string('prohibit','role');
?>
<form id="overrideform" action="override.php" method="post">
<fieldset class="invisiblefieldset">
<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
</fieldset>
<table class="rolecap">
<tr>
<th class="name" align="left" scope="col"><?php print_string('capability','role') ?></th>
<th class="inherit" scope="col"><?php p($strinherit); ?></th>
<th class="allow" scope="col"><?php p($strallow); ?></th>
<th class="prevent" scope="col"><?php p($strprevent); ?></th>
<th class="prohibit" scope="col"><?php p($strprohibit); ?></th>
<th class="risk" colspan="5" scope="col"><?php print_string('risks','role') ?></th>
</tr>
<?php
// init these 2
$contextlevel = 0;
$component = '';
$strrisks = s(get_string('risks', 'role'));
// MDL-11687
$strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
foreach ($capabilities as $capability) {
// legacy caps should not be overriden - we must use proper capabilities if needed
if (islegacy($capability->name)) {
continue;
}
// prints a breaker if component or name or context level
//if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
if (component_level_changed($capability, $component, $contextlevel)) {
echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
}
// these 2 are used to see to group same mod/core capabilities together
$contextlevel = $capability->contextlevel;
$component = $capability->component;
// check the capability override for this cap, this role in this context
if (isset($localoverrides[$capability->name])) {
$localpermission = $localoverrides[$capability->name]->permission;
} else {
$localpermission = 0; // Just inherit
}
if (isset($r_caps[$capability->name])) {
$isallow = $r_caps[$capability->name] > 0;
$isprevent = $r_caps[$capability->name] < 0 && $r_caps[$capability->name] > -500;
$isprohibit = $r_caps[$capability->name] <= -500;
} else {
$isallow = 0;
$isprevent = 0;
$isprohibit = 0;
}
$isdisabled = $isprohibit;
$riskinfo = '<td class="risk managetrust">';
$rowclasses = '';
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
$rowclasses .= ' riskmanagetrust';
}
$riskinfo .= '</td><td class="risk config">';
if (RISK_CONFIG & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
$rowclasses .= ' riskconfig';
}
$riskinfo .= '</td><td class="risk xss">';
if (RISK_XSS & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
$rowclasses .= ' riskxss';
}
$riskinfo .= '</td><td class="risk personal">';
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
$rowclasses .= ' riskpersonal';
}
$riskinfo .= '</td><td class="risk spam">';
if (RISK_SPAM & (int)$capability->riskbitmask) {
$riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/'.$strrisks.'">';
$riskinfo .= '<img src="'.$CFG->pixpath.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
$rowclasses .= ' riskspam';
}
$riskinfo .= '</td>';
?>
<tr class="rolecap <?php echo $rowclasses; ?>">
<td class="name"><span class="cap-desc"><a onclick="this.target='docspopup'" href="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php echo get_capability_string($capability->name); ?></a><span class="cap-name"><?php echo $capability->name ?></span></span></td>
<td class="inherit">
<input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="0"
<?php
if ($localpermission == CAP_INHERIT) {echo 'checked="checked" ';}
if ($isdisabled) {echo 'disabled="disabled"';}?> />
</td>
<td class="allow <?php if ($isallow) {echo ' capcurrent';} ?>">
<input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_ALLOW.'"';
if ($localpermission == CAP_ALLOW) {echo ' checked="checked" ';}
if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td class="prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
<input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_PREVENT.'"';
if ($localpermission == CAP_PREVENT) {echo ' checked="checked" ';}
if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td class="prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
<input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_PROHIBIT.'"';
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked" ';}
if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<?php echo $riskinfo; ?>
</tr>
<?php } ?>
</table>
<div class="submit buttons">
<input type="submit" value="<?php print_string('savechanges') ?>" />
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
</div>
</form>
-212
View File
@@ -1,212 +0,0 @@
<?php //$Id$
require_once('../../config.php');
$contextid = required_param('contextid', PARAM_INT); // context id
$roleid = optional_param('roleid', 0, PARAM_INT); // requested role id
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
$cancel = optional_param('cancel', 0, PARAM_BOOL);
if (!$context = get_record('context', 'id', $contextid)) {
error('Bad context ID');
}
if (!$sitecontext = get_context_instance(CONTEXT_SYSTEM)) {
error('No site ID');
}
if ($context->id == $sitecontext->id) {
error('Can not override base role capabilities');
}
if (!has_capability('moodle/role:override', $context)) {
error('You do not have permission to change overrides in this context!');
}
if ($courseid) {
if (!$course = get_record('course', 'id', $courseid)) {
error('Bad course ID');
}
} else {
$course = clone($SITE);
$courseid = SITEID;
}
require_login($course);
$baseurl = 'override.php?contextid='.$context->id;
if (!empty($userid)) {
$baseurl .= '&amp;userid='.$userid;
}
if ($courseid != SITEID) {
$baseurl .= '&amp;courseid='.$courseid;
}
if ($cancel) {
redirect($baseurl);
}
/// needed for tabs.php
$overridableroles = get_overridable_roles($context, 'name', ROLENAME_BOTH);
$assignableroles = get_assignable_roles($context, 'name', ROLENAME_BOTH);
/// Get some language strings
$strroletooverride = get_string('roletooverride', 'role');
$straction = get_string('overrideroles', 'role');
$strcurrentrole = get_string('currentrole', 'role');
$strparticipants = get_string('participants');
/// Make sure this user can override that role
if ($roleid) {
if (!user_can_override($context, $roleid)) {
error ('you can not override this role in this context');
}
}
if ($userid) {
$user = get_record('user', 'id', $userid);
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
}
/// get all cababilities
$capabilities = fetch_context_capabilities($context);
/// Process incoming role override
if ($data = data_submitted() and $roleid and confirm_sesskey()) {
$allowed_values = array(CAP_INHERIT, CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT);
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
'', 'capability, permission, id');
foreach ($capabilities as $cap) {
if (!isset($data->{$cap->name})) {
//cap not specified in form
continue;
}
if (islegacy($data->{$cap->name})) {
continue;
}
$capname = $cap->name;
$value = clean_param($data->{$cap->name}, PARAM_INT);
if (!in_array($value, $allowed_values)) {
continue;
}
if (isset($localoverrides[$capname])) {
// Something exists, so update it
assign_capability($capname, $value, $roleid, $context->id, true);
} else { // insert a record
if ($value != CAP_INHERIT) { // Ignore inherits
assign_capability($capname, $value, $roleid, $context->id);
}
}
}
// force accessinfo refresh for users visiting this context...
mark_context_dirty($context->path);
$rolename = get_field('role', 'name', 'id', $roleid);
add_to_log($course->id, 'role', 'override', 'admin/roles/override.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
redirect($baseurl);
}
/// Print the header and tabs
if ($context->contextlevel == CONTEXT_USER) {
$navlinks = array();
/// course header
if ($course->id != SITEID) {
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
}
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$fullname", "$fullname", $navigation, "", "", true, "&nbsp;", navmenu($course));
/// site header
} else {
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->fullname: $fullname", $course->fullname, $navigation, "", "", true, "&nbsp;", navmenu($course));
}
$showroles = 1;
$currenttab = 'override';
include_once($CFG->dirroot.'/user/tabs.php');
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('frontpageroles');
admin_externalpage_print_header();
$currenttab = 'override';
include_once('tabs.php');
} else {
$currenttab = 'override';
include_once('tabs.php');
}
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');
if ($roleid) {
/// prints a form to swap roles
echo '<div class="selector">';
$overridableroles = array('0'=>get_string('listallroles', 'role').'...') + $overridableroles;
popup_form("$CFG->wwwroot/$CFG->admin/roles/override.php?userid=$userid&amp;courseid=$courseid&amp;contextid=$contextid&amp;roleid=",
$overridableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletooverride);
echo '</div>';
$parentcontexts = get_parent_contexts($context);
if (!empty($parentcontexts)) {
$parentcontext = array_shift($parentcontexts);
$parentcontext = get_context_instance_by_id($parentcontext);
} else {
$parentcontext = $context; // site level in override??
}
$r_caps = role_context_capabilities($roleid, $parentcontext);
$localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id",
'', 'capability, permission, id');
$lang = str_replace('_utf8', '', current_language());
if (!empty($capabilities)) {
// Print the capabilities overrideable in this context
print_simple_box_start('center');
include_once('override.html');
print_simple_box_end();
} else {
notice(get_string('nocapabilitiesincontext', 'role'),
$CFG->wwwroot.'/'.$CFG->admin.'/roles/'.$baseurl);
}
} else { // Print overview table
$table->tablealign = 'center';
$table->cellpadding = 5;
$table->cellspacing = 0;
$table->width = '60%';
$table->head = array(get_string('roles', 'role'), get_string('description'), get_string('overrides', 'role'));
$table->wrap = array('nowrap', '', 'nowrap');
$table->align = array('right', 'left', 'center');
foreach ($overridableroles as $roleid => $rolename) {
$countusers = 0;
$overridecount = count_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id");
$description = format_string(get_field('role', 'description', 'id', $roleid));
$table->data[] = array('<a href="'.$baseurl.'&amp;roleid='.$roleid.'">'.$rolename.'</a>', $description, $overridecount);
}
print_table($table);
}
print_footer($course);
?>
-229
View File
@@ -1,229 +0,0 @@
<?php // $Id$
// Handles headers and tabs for the roles control at any level apart from SYSTEM level
// We also assume that $currenttab, $assignableroles and $overridableroles are defined
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
$navlinks = array();
if ($currenttab != 'update') {
switch ($context->contextlevel) {
case CONTEXT_SYSTEM:
$stradministration = get_string('administration');
$navlinks[] = array('name' => $stradministration, 'link' => '../index.php', 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($SITE->fullname, "$SITE->fullname", $navigation);
break;
case CONTEXT_USER:
print_header();
break;
case CONTEXT_COURSECAT:
$category = get_record('course_categories', 'id', $context->instanceid);
$strcategories = get_string("categories");
$strcategory = get_string("category");
$strcourses = get_string("courses");
$navlinks[] = array('name' => $strcategories,
'link' => "$CFG->wwwroot/course/index.php",
'type' => 'misc');
$navlinks[] = array('name' => $category->name,
'link' => "$CFG->wwwroot/course/category.php?id=$category->id",
'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses", $navigation, "", "", true);
break;
case CONTEXT_COURSE:
if ($context->instanceid != SITEID) {
$streditcoursesettings = get_string("editcoursesettings");
$course = get_record('course', 'id', $context->instanceid);
require_login($course);
$navlinks[] = array('name' => get_string('roles'),
'link' => "$CFG->wwwroot/admin/roles/assign.php?contextid=$context->id",
'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($streditcoursesettings, $course->fullname, $navigation);
}
break;
case CONTEXT_GROUP:
break;
case CONTEXT_MODULE:
// get module type?
if (!$cm = get_record('course_modules','id',$context->instanceid)) {
error('Bad course module ID');
}
if (!$module = get_record('modules','id',$cm->module)) { //$module->name;
error('Bad module ID');
}
if (!$course = get_record('course','id',$cm->course)) {
error('Bad course ID');
}
if (!$instance = get_record($module->name, 'id', $cm->instance)) {
error("The required instance of this module doesn't exist");
}
require_login($course);
$fullmodulename = get_string("modulename", $module->name);
$streditinga = get_string("editinga", "moodle", $fullmodulename);
$strmodulenameplural = get_string("modulenameplural", $module->name);
if ($module->name == "label") {
$focuscursor = "";
} else {
$focuscursor = "form.name";
}
$navlinks[] = array('name' => $strmodulenameplural,
'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id",
'type' => 'misc');
$navlinks[] = array('name' => $instance->name,
'link' => "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id",
'type' => 'misc');
$navlinks[] = array('name' => $streditinga,
'link' => "$CFG->wwwroot/course/mod.php?update=$cm->id&amp;sesskey=".sesskey(),
'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header_simple($streditinga, '', $navigation, $focuscursor, "", false);
break;
case CONTEXT_BLOCK:
if ($blockinstance = get_record('block_instance', 'id', $context->instanceid)) {
if ($block = get_record('block', 'id', $blockinstance->blockid)) {
$blockname = print_context_name($context);
switch ($blockinstance->pagetype) {
case 'course-view':
if ($course = get_record('course', 'id', $blockinstance->pageid)) {
require_login($course);
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$straction: $blockname", $course->fullname, $navigation);
}
break;
case 'blog-view':
$strblogs = get_string('blogs','blog');
$navlinks[] = array('name' => $strblogs,
'link' => $CFG->wwwroot.'/blog/index.php',
'type' => 'misc');
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$straction: $strblogs", $SITE->fullname, $navigation);
break;
case 'tag-index':
$strtags = get_string('tags');
$navlinks[] = array('name' => $strtags,
'link' => $CFG->wwwroot.'/tag/index.php',
'type' => 'misc');
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$straction: $strtags", $SITE->fullname, $navigation);
break;
default:
$navlinks[] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
$navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$straction: $blockname", $SITE->fullname, $navigation);
break;
}
}
}
break;
default:
error ('This is an unknown context (' . $context->contextlevel . ') in admin/roles/tabs.php!');
return false;
}
}
$toprow = array();
$inactive = array();
$activetwo = array();
if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything except SYSTEM context
if ($context->contextlevel == CONTEXT_MODULE) { // Only show update button if module
$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
$context->instanceid.'&amp;return=true&amp;sesskey='.sesskey(), get_string('settings'));
}
if (!empty($assignableroles)) {
$toprow[] = new tabobject('assign',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
get_string('localroles', 'role'),
get_string('showallroles', 'role'),
true);
}
if (!empty($overridableroles)) {
$toprow[] = new tabobject('override',
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
get_string('overridepermissions', 'role'),
get_string('showallroles', 'role'),
true);
}
}
/// Here other core tabs should go (always calling tabs.php files)
/// All the logic to decide what to show must be self-contained in the tabs file
/// eg:
/// include_once($CFG->dirroot . '/grades/tabs.php');
/// Finally, we support adding some 'on-the-fly' tabs here
/// All the logic to decide what to show must be self-cointained in the tabs file
if (isset($CFG->extratabs) && !empty($CFG->extratabs)) {
if ($extratabs = explode(',', $CFG->extratabs)) {
asort($extratabs);
foreach($extratabs as $extratab) {
/// Each extra tab must be one $CFG->dirroot relative file
if (file_exists($CFG->dirroot . '/' . $extratab)) {
include_once($CFG->dirroot . '/' . $extratab);
}
}
}
}
$inactive[] = $currenttab;
$tabs = array($toprow);
/// If there are any secondrow defined, let's introduce it
if (isset($secondrow) && is_array($secondrow) && !empty($secondrow)) {
$tabs[] = $secondrow;
}
print_tabs($tabs, $currenttab, $inactive, $activetwo);
?>
-62
View File
@@ -1,62 +0,0 @@
<?php // $Id$
// searches for admin settings
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$query = trim(stripslashes(optional_param('query', '', PARAM_NOTAGS))); // Search string
$adminroot =& admin_get_root(); // need all settings here
$adminroot->search = $query; // So we can reference it in search boxes later in this invocation
$statusmsg = '';
$errormsg = '';
$focus = '';
admin_externalpage_setup('search'); // now hidden page
// now we'll deal with the case that the admin has submitted the form with changed settings
if ($data = data_submitted() and confirm_sesskey()) {
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
}
$adminroot =& admin_get_root(true); //reload tree
if (!empty($adminroot->errors)) {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
$focus = $firsterror->id;
}
}
// and finally, if we get here, then there are matching settings and we have to print a form
// to modify them
admin_externalpage_print_header($focus);
if ($errormsg !== '') {
notify ($errormsg);
} else if ($statusmsg !== '') {
notify ($statusmsg, 'notifysuccess');
}
$resultshtml = admin_search_settings_html($query); // case insensitive search only
echo '<form action="search.php" method="post" id="adminsettings">';
echo '<div>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="query" value="'.s($query).'" />';
echo '</div>';
echo '<fieldset>';
echo '<div class="clearer"><!-- --></div>';
if ($resultshtml != '') {
echo $resultshtml;
} else {
echo get_string('noresults','admin');
}
echo '</fieldset>';
echo '</form>';
print_footer();
?>
-172
View File
@@ -1,172 +0,0 @@
<?php // $Id$
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/pagelib.php');
$section = required_param('section', PARAM_SAFEDIR);
$return = optional_param('return','', PARAM_ALPHA);
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
/// no guest autologin
require_login(0, false);
$adminroot =& admin_get_root(); // need all settings
$page =& $adminroot->locate($section);
if (empty($page) or !is_a($page, 'admin_settingpage')) {
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
die;
}
if (!($page->check_access())) {
print_error('accessdenied', 'admin');
die;
}
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
$statusmsg = '';
$errormsg = '';
$focus = '';
if ($data = data_submitted() and confirm_sesskey()) {
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
}
if (empty($adminroot->errors)) {
switch ($return) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
} else {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
$focus = $firsterror->id;
}
$adminroot =& admin_get_root(true); //reload tree
$page =& $adminroot->locate($section);
}
/// very hacky page setup
page_map_class(PAGE_ADMIN, 'page_admin');
$PAGE = page_create_object(PAGE_ADMIN, 0); // there must be any constant id number
$PAGE->init_extra($section);
$CFG->pagepath = 'admin/setting/'.$section;
if (!isset($USER->adminediting)) {
$USER->adminediting = false;
}
if ($PAGE->user_allowed_editing()) {
if ($adminediting == 1) {
$USER->adminediting = true;
} elseif ($adminediting == 0) {
$USER->adminediting = false;
}
}
/// print header stuff ------------------------------------------------------------
if (empty($SITE->fullname)) {
print_header($page->visiblename, $page->visiblename, '', $focus);
print_simple_box(get_string('configintrosite', 'admin'), 'center', '50%');
if ($errormsg !== '') {
notify ($errormsg);
} else if ($statusmsg !== '') {
notify ($statusmsg, 'notifysuccess');
}
// ---------------------------------------------------------------------------------------------------------------
echo '<form action="settings.php" method="post" id="adminsettings">';
echo '<div class="settingsform clearfix">';
echo '<input type="hidden" name="section" value="'.$PAGE->section.'" />';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo '<input type="hidden" name="return" value="'.$return.'" />';
echo $page->output_html();
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
echo '</div>';
echo '</form>';
} else {
$pageblocks = blocks_setup($PAGE);
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
BLOCK_R_MAX_WIDTH);
$PAGE->print_header('', $focus);
echo '<table id="layout-table"><tr>';
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
switch ($column) {
case 'left':
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
echo '</td>';
break;
case 'middle':
echo '<td id="middle-column">';
print_container_start();
echo '<a name="startofcontent"></a>';
if ($errormsg !== '') {
notify ($errormsg);
} else if ($statusmsg !== '') {
notify ($statusmsg, 'notifysuccess');
}
// ---------------------------------------------------------------------------------------------------------------
echo '<form action="settings.php" method="post" id="adminsettings">';
echo '<div class="settingsform clearfix">';
echo '<input type="hidden" name="section" value="'.$PAGE->section.'" />';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo '<input type="hidden" name="return" value="'.$return.'" />';
print_heading($page->visiblename);
echo $page->output_html();
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
echo '</div>';
echo '</form>';
print_container_end();
echo '</td>';
break;
case 'right':
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
break;
}
}
echo '</tr></table>';
}
if (!empty($CFG->adminusehtmleditor)) {
use_html_editor();
}
print_footer();
?>
-90
View File
@@ -1,90 +0,0 @@
<?php // $Id$
// This file defines settingpages and externalpages under the "appearance" category
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('appearance', new admin_category('themes', get_string('themes')));
// "themesettings" settingpage
$temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin'));
$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
$temp->add(new admin_setting_configselect('hideactivitytypenavlink', get_string('hideactivitytypenavlink', 'admin'), get_string('confighideactivitytypenavlink', 'admin'), 0,
array(
0 => get_string('hidefromnone', 'admin'),
1 => get_string('hidefromstudents', 'admin'),
2 => get_string('hidefromall', 'admin')
)));
$ADMIN->add('themes', $temp);
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
// calendar
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
$temp->add(new admin_setting_special_adminseesall());
//this is hacky because we do not want to include the stuff from calendar/lib.php
$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'),
get_string('explain_site_timeformat', 'calendar'), '0',
array('0' => get_string('default', 'calendar'),
'%I:%M %p' => get_string('timeformat_12', 'calendar'),
'%H:%M' => get_string('timeformat_24', 'calendar'))));
$temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0,
array(
0 => get_string('sunday', 'calendar'),
1 => get_string('monday', 'calendar'),
2 => get_string('tuesday', 'calendar'),
3 => get_string('wednesday', 'calendar'),
4 => get_string('thursday', 'calendar'),
5 => get_string('friday', 'calendar'),
6 => get_string('saturday', 'calendar')
)));
$temp->add(new admin_setting_special_calendar_weekend());
$temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT));
$temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT));
$ADMIN->add('appearance', $temp);
// "htmleditor" settingpage
$temp = new admin_settingpage('htmleditor', get_string('htmleditor', 'admin'));
$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
$temp->add(new admin_setting_configtext('editorbackgroundcolor', get_string('editorbackgroundcolor', 'admin'), get_string('edhelpbgcolor'), '#ffffff', PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfontfamily', 'admin'), get_string('edhelpfontfamily'), 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif', PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_special_editorfontlist());
$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
$temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
$temp->add(new admin_setting_special_editordictionary());
}
$temp->add(new admin_setting_special_editorhidebuttons());
$temp->add(new admin_setting_emoticons());
$ADMIN->add('appearance', $temp);
// "documentation" settingpage
$temp = new admin_settingpage('documentation', get_string('moodledocs'));
$temp->add(new admin_setting_configtext('docroot', get_string('docroot', 'admin'), get_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
$temp->add(new admin_setting_configcheckbox('doctonewwindow', get_string('doctonewwindow', 'admin'), get_string('configdoctonewwindow', 'admin'), 0));
$ADMIN->add('appearance', $temp);
$temp = new admin_settingpage('mymoodle', get_string('mymoodle', 'admin'));
$temp->add(new admin_setting_configcheckbox('mymoodleredirect', get_string('mymoodleredirect', 'admin'), get_string('configmymoodleredirect', 'admin'), 0));
$ADMIN->add('appearance', $temp);
// new CFG variable for coursemanager (what roles to display)
$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
$temp->add(new admin_setting_special_coursemanager());
$ADMIN->add('appearance', $temp);
$temp = new admin_settingpage('ajax', get_string('ajaxuse'));
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('disablecourseajax', get_string('disablecourseajax', 'admin'), get_string('configdisablecourseajax', 'admin'),
isset($CFG->disablecourseajax) ? 1 : empty($CFG->enableajax)));
$ADMIN->add('appearance', $temp);
// link to tag management interface
$ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php"));
} // end of speedup
?>
-64
View File
@@ -1,64 +0,0 @@
<?php // $Id$
// This file defines settingpages and externalpages under the "courses" category
if ($hassiteconfig
or has_capability('moodle/site:backup', $systemcontext)
or has_capability('moodle/category:update', $systemcontext)) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('courses', new admin_externalpage('coursemgmt', get_string('coursemgmt', 'admin'), $CFG->wwwroot . '/course/index.php?categoryedit=on','moodle/category:update'));
$ADMIN->add('courses', new admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php'));
// "courserequests" settingpage
$temp = new admin_settingpage('courserequest', get_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests', get_string('enablecourserequests', 'admin'), get_string('configenablecourserequests', 'admin'), 0));
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory', get_string('defaultrequestcategory', 'admin'), get_string('configdefaultrequestcategory', 'admin'), 1));
$ADMIN->add('courses', $temp);
// "backups" settingpage
if (!empty($CFG->backup_version)) {
$bi = array();
$bi[] = new admin_setting_configcheckbox('backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0);
$bi[] = new admin_setting_configselect('backup_sche_users', get_string('users'), get_string('backupusershelp'),
0, array(0 => get_string('all'), 1 => get_string('course')));
$bi[] = new admin_setting_configcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0);
$bi[] = new admin_setting_configcheckbox('backup_sche_blogs', get_string('blogs', 'blog'), get_string('backupblogshelp','blog'), 0);
$bi[] = new admin_setting_configselect('backup_sche_keep', get_string('keep'),
get_string('backupkeephelp'), 1, array(0 => get_string('all'), 1 => '1',
2 => '2',
5 => '5',
10 => '10',
20 => '20',
30 => '30',
40 => '40',
50 => '50',
100 => '100',
200 => '200',
300 => '300',
400 => '400',
500 => '500'));
$bi[] = new admin_setting_configcheckbox('backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0);
$bi[] = new admin_setting_special_backupdays();
$bi[] = new admin_setting_configtime('backup_sche_hour', 'backup_sche_minute', get_string('executeat'),
get_string('backupexecuteathelp'), array('h' => 0, 'm' => 0));
$bi[] = new admin_setting_configdirectory('backup_sche_destination', get_string('saveto'), get_string('backupsavetohelp'), '');
$temp = new admin_settingpage('backups', get_string('backups','admin'), 'moodle/site:backup');
foreach ($bi as $backupitem) {
$backupitem->plugin = 'backup';
$temp->add($backupitem);
}
$ADMIN->add('courses', $temp);
}
} // end of speedup
?>
-75
View File
@@ -1,75 +0,0 @@
<?php // $Id$
// This file defines everything related to frontpage
if (get_site()) { //do not use during installation
$frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
if ($hassiteconfig or has_any_capability(array(
'moodle/course:update',
'moodle/role:assign',
'moodle/site:restore',
'moodle/site:backup',
'moodle/course:managefiles',
'moodle/question:add',
'moodle/question:editmine',
'moodle/question:editall',
'moodle/question:viewmine',
'moodle/question:viewall',
'moodle/question:movemine',
'moodle/question:moveall'), $frontpagecontext)) {
// "frontpage" settingpage
$temp = new admin_settingpage('frontpagesettings', get_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', NULL)); // no default
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', NULL)); // no default
$temp->add(new admin_setting_special_frontpagedesc());
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
array('0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10')));
$temp->add(new admin_setting_configtext('coursesperpage', get_string('coursesperpage', 'admin'), get_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('allowvisiblecoursesinhiddencategories', get_string('allowvisiblecoursesinhiddencategories', 'admin'), get_string('configvisiblecourses', 'admin'), 0));
// front page default role
$roleoptions = array(0=>get_string('none')); // roles to choose from
if ($roles = get_all_roles()) {
foreach ($roles as $role) {
$roleoptions[$role->id] = strip_tags(format_string($role->name, true));
}
}
$temp->add(new admin_setting_configselect('defaultfrontpageroleid', get_string('frontpagedefaultrole', 'admin'), '', 0, $roleoptions));
$ADMIN->add('frontpage', $temp);
$ADMIN->add('frontpage', new admin_externalpage('frontpageroles', get_string('frontpageroles', 'admin'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $frontpagecontext->id, 'moodle/role:assign', false, $frontpagecontext));
$ADMIN->add('frontpage', new admin_externalpage('frontpagebackup', get_string('frontpagebackup', 'admin'), $CFG->wwwroot.'/backup/backup.php?id='.SITEID, 'moodle/site:backup', false, $frontpagecontext));
$ADMIN->add('frontpage', new admin_externalpage('frontpagerestore', get_string('frontpagerestore', 'admin'), $CFG->wwwroot.'/files/index.php?id='.SITEID.'&amp;wdir=/backupdata', 'moodle/site:restore', false, $frontpagecontext));
$questioncapabilites = array(
'moodle/question:add',
'moodle/question:editmine',
'moodle/question:editall',
'moodle/question:viewmine',
'moodle/question:viewall',
'moodle/question:movemine',
'moodle/question:moveall');
$ADMIN->add('frontpage', new admin_externalpage('frontpagequestions', get_string('frontpagequestions', 'admin'), $CFG->wwwroot.'/question/edit.php?courseid='.SITEID, $questioncapabilites, false, $frontpagecontext));
$ADMIN->add('frontpage', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID, 'moodle/course:managefiles', false, $frontpagecontext));
}
}
?>
-195
View File
@@ -1,195 +0,0 @@
<?php // $Id$
// This file defines settingpages and externalpages under the "grades" section
if (has_capability('moodle/grade:manage', $systemcontext)
or has_capability('moodle/grade:manageletters', $systemcontext)) { // speedup for non-admins, add all caps used on this page
// General settings
$temp = new admin_settingpage('gradessettings', get_string('generalsettings', 'grades'), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
require_once $CFG->libdir.'/grade/constants.php';
// new CFG variable for gradebook (what roles to display)
$temp->add(new admin_setting_special_gradebookroles());
// enable outcomes checkbox
$temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
$temp->add(new admin_setting_grade_profilereport());
$temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
$temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', get_string('includescalesinaggregation', 'grades'), get_string('configincludescalesinaggregation', 'grades'), 1));
$temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0));
// enable publishing in exports/imports
$temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0));
$temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
$temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
get_string('configexportdecimalpoints', 'grades'), 2,
array( '0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5')));
$temp->add(new admin_setting_special_gradeexport());
}
$ADMIN->add('grades', $temp);
/// Grade category settings
$temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), '1'));
$strnoforce = get_string('noforce', 'grades');
// Aggregation type
$options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
$temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options));
$options = array(0 => get_string('no'), 1 => get_string('yes'));
$defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
$temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options));
$defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
$temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options));
$temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
get_string('aggregatesubcatshelp', 'grades'), $defaults, $options));
$options = array(0 => get_string('none'));
for ($i=1; $i<=20; $i++) {
$options[$i] = $i;
}
$defaults['value'] = 0;
$defaults['forced'] = true;
$temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
get_string('keephighhelp', 'grades'), $defaults, $options));
$defaults['forced'] = false;
$temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
get_string('droplowhelp', 'grades'), $defaults, $options));
}
$ADMIN->add('grades', $temp);
/// Grade item settings
$temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
$temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
get_string('configdecimalpoints', 'grades'), 2,
array( '0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5')));
$temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('configgradeitemadvanced', 'grades'),
array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
array('iteminfo' => get_string('iteminfo', 'grades'),
'idnumber' => get_string('idnumbermod'),
'gradetype' => get_string('gradetype', 'grades'),
'scaleid' => get_string('scale'),
'grademin' => get_string('grademin', 'grades'),
'grademax' => get_string('grademax', 'grades'),
'gradepass' => get_string('gradepass', 'grades'),
'plusfactor' => get_string('plusfactor', 'grades'),
'multfactor' => get_string('multfactor', 'grades'),
'display' => get_string('gradedisplaytype', 'grades'),
'decimals' => get_string('decimalpoints', 'grades'),
'hidden' => get_string('hidden', 'grades'),
'hiddenuntil' => get_string('hiddenuntil', 'grades'),
'locked' => get_string('locked', 'grades'),
'locktime' => get_string('locktime', 'grades'),
'aggregationcoef' => get_string('aggregationcoef', 'grades'),
'parentcategory' => get_string('parentcategory', 'grades'))));
}
$ADMIN->add('grades', $temp);
/// Scales and outcomes
$scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
$ADMIN->add('grades', $scales);
$outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
$ADMIN->add('grades', $outcomes);
$letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
$ADMIN->add('grades', $letters);
// The plugins must implement a settings.php file that adds their admin settings to the $settings object
// Reports
$ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
foreach (get_list_of_plugins('grade/report') as $plugin) {
// Include all the settings commands for this plugin if there are any
if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
$settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
}
$ADMIN->add('gradereports', $settings);
}
}
// Imports
$ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
foreach (get_list_of_plugins('grade/import') as $plugin) {
// Include all the settings commands for this plugin if there are any
if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
$settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
}
$ADMIN->add('gradeimports', $settings);
}
}
// Exports
$ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
foreach (get_list_of_plugins('grade/export') as $plugin) {
// Include all the settings commands for this plugin if there are any
if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
$settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
}
$ADMIN->add('gradeexports', $settings);
}
}
} // end of speedup
?>
-29
View File
@@ -1,29 +0,0 @@
<?php // $Id$
// This file defines settingpages and externalpages under the "appearance" category
if ($hassiteconfig
or has_capability('moodle/site:langeditmaster', $systemcontext)
or has_capability('moodle/site:langeditlocal', $systemcontext)) { // speedup for non-admins, add all caps used on this page
// "languageandlocation" settingpage
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('autolang', get_string('autolang', 'admin'), get_string('configautolang', 'admin'), 1));
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
$temp->add(new admin_setting_langlist());
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
// new CFG variable for excel encoding
$temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
$ADMIN->add('language', $temp);
$ADMIN->add('language', new admin_externalpage('langedit', get_string('langedit', 'admin'), "$CFG->wwwroot/$CFG->admin/lang.php", array('moodle/site:langeditmaster', 'moodle/site:langeditlocal') ));
$ADMIN->add('language', new admin_externalpage('langimport', get_string('langpacks', 'admin'), "$CFG->wwwroot/$CFG->admin/langimport.php"));
} // end of speedup
?>
-27
View File
@@ -1,27 +0,0 @@
<?php // $Id$
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// "locations" settingpage
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
$options = get_list_of_timezones();
$options[99] = get_string('serverlocaltime');
$temp->add(new admin_setting_configselect('timezone', get_string('timezone','admin'), get_string('configtimezone', 'admin'), 99, $options));
$options[99] = get_string('timezonenotforced', 'admin');
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
$options = get_list_of_countries();
$options[0] = get_string('choose') .'...';
$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options));
$temp->add(new admin_setting_heading('iplookup', get_string('iplookup', 'admin'), get_string('iplookupinfo', 'admin')));
$temp->add(new admin_setting_configfile('geoipfile', get_string('geoipfile', 'admin'), get_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLiteCity.dat'));
$temp->add(new admin_setting_configtext('googlemapkey', get_string('googlemapkey', 'admin'), get_string('configgooglemapkey', 'admin', $CFG->wwwroot), ''));
$ADMIN->add('location', $temp);
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "$CFG->wwwroot/$CFG->admin/timezoneimport.php"));
} // end of speedup
?>
-30
View File
@@ -1,30 +0,0 @@
<?php // $Id$
// * Miscellaneous settings
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// Experimental settings page
$temp = new admin_settingpage('experimental', get_string('experimental', 'admin'));
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
$item = new admin_setting_configcheckbox('enablehtmlpurifier', get_string('enablehtmlpurifier', 'admin'), get_string('configenablehtmlpurifier', 'admin'), 0);
$item->set_updatedcallback('reset_text_filters_cache');
$temp->add($item);
$temp->add(new admin_setting_configcheckbox('enablegroupings', get_string('enablegroupings', 'admin'), get_string('configenablegroupings', 'admin'), 0));
$ADMIN->add('misc', $temp);
// XMLDB editor
$ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/"));
// hidden scripts linked from elsewhere
$ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true));
$ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true));
$ADMIN->add('misc', new admin_externalpage('upgradelogs', 'Upgrade logs', $CFG->wwwroot.'/'.$CFG->admin.'/upgradelogs.php', 'moodle/site:config', true));
$ADMIN->add('misc', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
} // end of speedup
?>

Some files were not shown because too many files have changed in this diff Show More