Compare commits

...

461 Commits

Author SHA1 Message Date
moodler bc9cec3cd6 Updated version for release 1.5 2005-06-06 05:21:11 +00:00
moodler f9cff66906 Merged all the changes in HEAD until now 2005-06-06 05:04:31 +00:00
ikawhero 5450baa28a Added a 'Save Changes' button to the top of the page for those of us too
lazy to scroll!
2005-06-06 03:35:28 +00:00
ikawhero 422eaecc13 Check array is initialised. Bug 3424. 2005-06-06 00:39:35 +00:00
moodler e10ed4e667 file preferences.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:48 +0000 2005-06-06 00:13:12 +00:00
moodler ecfbaad4b4 file preferences.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:28 +0000 2005-06-06 00:13:12 +00:00
ikawhero e4cedd797a Errors will now return to course page instead of site. Related to Bug 3418. 2005-06-05 23:57:19 +00:00
gustav_delius 9dadc1a89e Regrading now used the proper session mechanism. Also it now works with old-style attempts which have only a single state. 2005-06-05 20:37:52 +00:00
moodler 5b0ae9d41c file student.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 20:33:47 +00:00
gustav_delius 2ac3cee674 Restoring of user attempts and states disabled for now, see bug 3159 2005-06-05 20:25:04 +00:00
gustav_delius f3bb54f36f Fixed typo 2005-06-05 20:19:17 +00:00
moodler e8edd40064 file exceptions.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 19:56:09 +00:00
moodler b1120b07c9 file letter.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 19:56:09 +00:00
moodler 00fcb704d3 file weight.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 19:56:09 +00:00
moodler 2b1ebff73c file preferences.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 19:56:09 +00:00
moodler 26549e7692 file category.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 19:56:08 +00:00
moodler efd780a339 file teacher.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:13 +0000 2005-06-05 19:24:45 +00:00
urs_hunkler 0c4a965346 mainly corretion for a disply problem of the course page in MSIE plus some minor changes. 2005-06-05 16:38:01 +00:00
gustav_delius 7371dc44d0 removed some unnecessary fields 2005-06-05 15:52:18 +00:00
gustav_delius 16a8215aa1 just fixing some comments 2005-06-05 15:37:22 +00:00
gustav_delius 6d0ea08227 taken out a notice to temporarily fix bug 3130 2005-06-05 15:08:34 +00:00
gustav_delius 85a6b27786 Fixed the calculated question editing wizard temporarily for Moodle 1.5 until Julian gets his new version ready. 2005-06-05 14:14:54 +00:00
gustav_delius db7f11c3d7 fixed some typos 2005-06-05 13:59:37 +00:00
gustav_delius 98133a3eec Random questions now store both the wrapped question id and the response in the same state record, essentially going back to Julian's model. 2005-06-05 13:22:03 +00:00
moodler 52de50d2d5 Just a small fix for people tracking betas 2005-06-05 13:11:05 +00:00
gustav_delius 122299654f Improved the display of readonly form fields in questions so that they are no longer grey on grey 2005-06-05 12:03:50 +00:00
gustav_delius 52fa982eba Change to when newly created states get saved
Changes to what is printed during regrade
2005-06-05 11:49:32 +00:00
stronk7 5eab4b5c43 Removed reference to Journal (Diario in es) 2005-06-05 10:09:32 +00:00
stronk7 e68e7af8ed Merged from HEAD... 2005-06-05 09:46:33 +00:00
moodler 2e52e3c14b file gradinggrade.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:30 +0000 2005-06-05 08:55:11 +00:00
moodler 2be7e8b347 file grading.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:30 +0000 2005-06-05 08:49:33 +00:00
moodler b8187e5ae0 file grade.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:30 +0000 2005-06-05 08:44:38 +00:00
thepurpleblob 74be4f9a8d Removed reference to Journals. 2005-06-05 07:37:16 +00:00
moodler cb21e292fa file penalty.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:31 +0000 2005-06-05 07:31:24 +00:00
moodler 3a8e6b5f4b file adaptive.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:31 +0000 2005-06-05 07:31:24 +00:00
thepurpleblob cdd11103b7 Removed reference to Journal 2005-06-05 07:24:46 +00:00
thepurpleblob dab41ccfdc Removed reference to Journal. 2005-06-05 07:11:44 +00:00
thepurpleblob 49e8438753 Removed references to Journal. 2005-06-05 06:51:09 +00:00
thepurpleblob 12c3f08cb0 Removed reference to journals. 2005-06-05 06:47:02 +00:00
thepurpleblob 2f6b3b1966 Removed references to journals. 2005-06-05 06:44:09 +00:00
moodler 9d39272ded Added support for $CFG->allowobjectembed in the GUI 2005-06-05 05:39:25 +00:00
moodler 14bc8df569 Added $CFG->allowobjectembed in weblib.php so that these can be selected by admin 2005-06-05 05:25:02 +00:00
moodler 6dca5725ea file nextpageaction.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:49 +0000 2005-06-05 03:48:41 +00:00
moodler bf3932fc42 file nextpageaction.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:29 +0000 2005-06-05 03:48:40 +00:00
moodler 2c8a7e32db Turn off script access for autoembedded flash SC126 2005-06-05 03:31:44 +00:00
gustav_delius 3c76674f76 More graceful behaviour when there are not enough questions for the random questions. 2005-06-04 22:43:28 +00:00
ecastrolt fba559da7a *** empty log message *** 2005-06-04 21:07:57 +00:00
moodler 468f3c1cc4 file webquest.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler fe0df5f546 file tex.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler 370454c947 file workshop.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler 3010db0e48 file wiki.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler ae6a28706b file survey.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler 63fd025955 file scorm.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler f5e2a57092 file resource.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:16 +0000 2005-06-04 20:05:32 +00:00
moodler 1edf4fcaa6 file mediaplugin.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler 191ac5e692 file questionnaire.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler ad50e44876 file label.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler 1a833b187a file multilang.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler 5983511872 file message.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler df644c8811 file pix.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler 52183b89b1 file lesson.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:32 +00:00
moodler cfe70c4f90 file exercise.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:31 +00:00
moodler 98a68126ed file journal.php.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:31 +00:00
moodler 39538ed31a file grades.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:31 +00:00
moodler 42bdd31e68 file hotpot.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:31 +00:00
moodler d0fa39395c file install.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:31 +00:00
moodler 737d922645 file glossary.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:15 +0000 2005-06-04 20:05:31 +00:00
moodler 5e3b40221a file block_rss_client.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler fd91ea6371 file block_course_list.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler cee15d365b file countries.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler c29cc45005 file block_online_users.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 2db4405ca0 file attendance.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 2e3d0ff372 file editor.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler fe2c9820e8 file algebra.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 72df247c50 file censor.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler d35f4bcabd file enrol_paypal.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler a46eb2ee08 file enrol_ldap.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 18ac802f51 file dialogue.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler d520a0a173 file emailprotect.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler e264c29fa1 file appointment.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 406d542d00 file block_html.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler a02176516b file block_course_summary.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 27b0d869e6 file admin.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 21971c4ed0 file calendar.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler e1c24a9dba file block_social_activities.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler dcb1b0cbdf file enrol_database.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 9c94bb15aa file enrol_flatfile.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler bec8a5ca4b file error.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler cee8d7fb63 file block_quiz_results.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler 5a67edcc09 file enrol_internal.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
moodler c5f0945604 file block_section_links.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:14 +0000 2005-06-04 20:05:31 +00:00
defacer ff642e93ba Fixing all Tidy warnings in this page. This has to be A Good Thing. 2005-06-04 17:43:52 +00:00
gustav_delius 5ebe26c7d0 fixed typo 2005-06-04 17:22:00 +00:00
gustav_delius a616b09790 The versioning code will not be in Moodle 1.5 2005-06-04 17:13:26 +00:00
stronk7 e64dfa80dd Changed name of the container category a bit and avoided one notice. 2005-06-04 15:37:40 +00:00
gustav_delius 4a4d46cade slight improvement of layout 2005-06-04 11:40:57 +00:00
moodler 905746771f file quiz_analysis.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:05 +0000 2005-06-04 11:25:51 +00:00
moodler 82a838920f file block_search_forums.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:03 +0000 2005-06-04 11:25:51 +00:00
moodler d913dc4244 file enrol_authorize.php was added on branch MOODLE_15_STABLE on 2005-06-06 05:04:03 +0000 2005-06-04 11:25:51 +00:00
gustav_delius 4aa3ac1609 Print notice on preview when secure window will be used for students
Also improved some language strings
2005-06-04 11:19:48 +00:00
gustav_delius 775d4dd817 Print notice on preview when secure window will be used for students 2005-06-04 11:16:37 +00:00
gustav_delius e0b0ef395f Show link to attempts list only if student attemtps exist. 2005-06-04 11:10:36 +00:00
mindforge a21fc2b7c9 Cleaned up and documented regrading code. 2005-06-04 11:04:00 +00:00
mindforge aee2784751 Manual regrading page implemented. 2005-06-04 10:58:31 +00:00
ikawhero 3e41bf36a3 Link to add new courses only shown to course creators when there are no
courses available. Bug 3420.
2005-06-04 10:39:57 +00:00
urs_hunkler cf26a12c62 corrected width of the middle column in course view. 2005-06-04 09:16:20 +00:00
gustav_delius 90abc87934 attempts.php has moved to report/overview/report.php 2005-06-04 09:10:13 +00:00
gustav_delius 8c040068ca Removed the quiz upgrade warning. 2005-06-04 09:07:40 +00:00
gustav_delius 67a8ef4235 removing the old statistics reports 2005-06-04 08:58:16 +00:00
gustav_delius c17f91905a put back the overview report folder 2005-06-04 08:55:37 +00:00
gustav_delius 1b2457c312 added regrading page 2005-06-04 08:54:56 +00:00
gustav_delius 2fbd81b02d Fixed bug 3410. Admins are no longer shown ALL categories in drop-down menu. 2005-06-04 08:47:33 +00:00
gustav_delius e729020eda Improve alignment in table in mod.html for IE
Missing questions lead to notice rather than fatal error
Attempts report now moved to reports/overview
put in empty regrading page for Julian to complete
Moved some of the styles out of styles.php into standard style
Fixed error on reviewquestion.php
put infobox on reviewquestion.php
fixed <form> tag on item analysis report
2005-06-04 08:30:49 +00:00
defacer 6e296332ca Fix for bug 3316: Now students which have attempted the quiz but have
since been unenrolled from the course are shown with a dimmed style.
2005-06-04 00:18:57 +00:00
defacer 94640580f3 Forgot to prepend country codes to the teacher list as well when sorting. 2005-06-03 23:40:19 +00:00
defacer 113130bd32 Adding one new string: "Show $a per page" 2005-06-03 23:31:06 +00:00
defacer 1443433431 CSS styles for the revamped user/index.php 2005-06-03 23:26:31 +00:00
defacer 4fd2dff9fe A big big big patch:
Converted the students table to use the new table class

Fixed bug 3114: when sorting by country, prepend country code to the country name

Fixed behavior of autohiding teacher list; now there is a hide/show icon to be
consistent with the rest of Moodle

Fixed "show all" option so that the user can control it instead of relying on auto behavior

Fixed HTML, removed all inline styles

Improved accessibility (alt tags for images)

Updated obsolete optional_variable calls to optional_param

Several cosmetic and other improvements I 've already forgotten :P
2005-06-03 23:19:12 +00:00
defacer 680da3b4af Added function that exports current selection for first/last initial
Added extra CSS class to initial bars (can now differentiate first/last)
2005-06-03 22:46:54 +00:00
moodler dc0d77760a file maxpages.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:49 +0000 2005-06-03 21:53:41 +00:00
moodler c700b6c43b file review.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:49 +0000 2005-06-03 21:53:41 +00:00
moodler adb2f6e2fc file highscores.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:49 +0000 2005-06-03 21:53:41 +00:00
moodler def727dc7d file maxpages.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:29 +0000 2005-06-03 21:53:41 +00:00
moodler c5d16299de file review.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:29 +0000 2005-06-03 21:53:41 +00:00
moodler 93b2625047 file highscores.html was added on branch MOODLE_15_STABLE on 2005-06-06 05:03:28 +0000 2005-06-03 21:53:41 +00:00
gustav_delius b769175004 The popup window didn't always close. 2005-06-03 20:43:50 +00:00
stronk7 816f68c8aa Upgraded backup/restore TODO list. Only two points remains open:
- SCORM: restore. See bug 3404.
- QUIZ: 1.5 <=> 1.5 backup and restore. Gustav's team is polishing it.

Bump to 1.5 (Final)
2005-06-03 17:43:46 +00:00
stronk7 c3f0763f7b Added support for forum->trackingtype 2005-06-03 17:35:27 +00:00
moodler e0dcb5734f Merged many language files from HEAD 2005-06-03 17:17:15 +00:00
stronk7 321aae1d8b Small typo, preventing group events to be restored properly.
Records in backup_ids table must use the name of the table
without the prefix as name. Bug 3360. Thanks Jon.
(http://moodle.org/bugs/bug.php?op=show&bugid=3360)
2005-06-03 16:43:26 +00:00
ikawhero 9bb32eb744 Meaningful string shown in breadcrumb and heading when editing site topic.
Bug 3408.
2005-06-03 14:41:35 +00:00
mindforge 2c20f70dca Fix for bug #3357. Random questions now check properly if a question is already in use. 2005-06-03 12:56:53 +00:00
stronk7 a3247baa3a Bump!
Deletion (or move to site course) of orphan categories
executed in the upgrade process. Now we shouldn't have
such orphans anymore! B-)

Part of bug 2459
(http://moodle.org/bugs/bug.php?op=show&bugid=2459)

Important NOTE: In the upgrade code for postgreSQL I've included
                some steps that weren't up to date. They seem to
                standard SQL code but they should be tested
                properly.... hope all works!
2005-06-03 12:49:16 +00:00
stronk7 c0624b017b Deletion (or move to site course) of orphan categories
executed in the upgrade process. Now we shouldn't have
such orphans anymore! B-)

Part of bug 2459
(http://moodle.org/bugs/bug.php?op=show&bugid=2459)

Important NOTE: In the upgrade code for postgreSQL I've included
                some steps that weren't up to date. They seem to
                standard SQL code but they should be tested
                properly.... hope all works!
2005-06-03 12:47:44 +00:00
moodler 81b1951adf Labels can now have apostrophes again! :-) bug 3411 2005-06-03 12:21:16 +00:00
moodler 73c1140d6a Fix for Bug 3036. (SE) 2005-06-03 08:15:38 +00:00
moodler 20fe7276ff Merged French from HEAD 2005-06-03 05:25:09 +00:00
moodler dd8fb6e848 file autocontinue.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler 1ece975598 file browsemode.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler 4308feffbd file height.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler 66674833f6 file maxgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler 578462059e file width.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler bd8b6c6f0e file summary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler e5e43b42ec file package.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler f309507a9f file grademethod.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-06-03 03:55:38 +00:00
moodler 5c3cf81dfb file navigation.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler 5bf11225c4 file analysistable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler c10f0b5df7 file reportselector.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler abac5c2107 file mediaplayers.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler d6c5e20610 file forceplugins.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler b9b4610906 file responsestable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler 03231ca0b3 file outputformat.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
moodler 6d53e3b77d file shownextquiz.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-06-03 03:55:38 +00:00
martinlanghoff a0b22b3218 auth/ldap : minor html fix 2005-06-03 03:41:16 +00:00
moodler 0db7057a78 file browsemode.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-06-02 22:31:41 +00:00
moodler 7bc02fa10a file maxgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-06-02 22:31:41 +00:00
moodler 01737697a4 file grademethod.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-06-02 22:31:41 +00:00
moodler 2eb6412ef8 file maxgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-06-02 22:31:40 +00:00
moodler 4fad751ed9 file grademethod.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-06-02 22:31:40 +00:00
moodler e32e7ca09c file browsemode.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-06-02 22:31:34 +00:00
moodler da7d308c32 Disable Attendance in core tables because the module has been deleted 2005-06-02 15:01:12 +00:00
moodler 4a625f17af Remove attendance from 1.5 too 2005-06-02 14:59:38 +00:00
exe-cutor 9fa1dad004 Adapted Shibboleth authentication to new field lock/update mechanism by Martin 2005-06-02 14:34:22 +00:00
moodler 651dfa878e file itemanalysis.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-06-02 13:57:26 +00:00
urs_hunkler 50da41e264 some theme optimizations: manly font-sizes and the list pages. 2005-06-02 12:31:35 +00:00
martinlanghoff 6406bef13e Fixed typo in configuration of ldap_memberattribute for RFC2307-style LDAP servers. Should fix handling of iscreator group. Thanks to Teemu Haapoja for the diagnosis and fix. 2005-06-02 09:55:06 +00:00
martinlanghoff 5a2cfa7efb Version bump triggers config_plugin migration for locks and field mapping. 2005-06-02 04:25:36 +00:00
moodler 0bb30298d0 file nelements.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler 37553f8493 file managing2.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler 1761c44531 file regrading.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler d1869b995e file managing.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler 5e01a18606 file gradingstrategy.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler 1ef00c891f file password.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler 2d910a2d08 file gradinggrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:18 +00:00
moodler 3b61c3c5d6 file elements.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:17 +00:00
moodler 17dec907b9 file grade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:17 +00:00
moodler c90daf0b4b file comparisonofassessments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-06-02 02:46:17 +00:00
moodler a69f876e76 file removepages.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler a960f39fbb file wikitype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 474ce18912 file strippages.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 6c8f0ed5a8 file initialcontent.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 5ace54167e file htmlmode.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler d981f1b6e3 file wikilinkoptions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 0810574be1 file ewikiacceptbinary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler ee5b1788f7 file setpageflags.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 9a6222dd38 file revertpages.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 46cc45f293 file checklinks.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 8e8380fb97 file revertauthorfieldpattern.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 5aef10640e file wikiname.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler b34d0917a6 file howtowiki.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler 1067cb28f1 file wikiusage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler f94e02f057 file studentadminoptions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-06-02 02:46:17 +00:00
moodler fec8049d34 file leaguetable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler a111b749fc file finalgrades.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler f42449f77e file nelements.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler cc13541244 file takeownership.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler d67ad45602 file submissionofdescriptions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 0ef063825f file moreinfo.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 09be6630de file usemax.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 26b9be1d7a file regrading.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 10692d97e6 file leaguetablenames.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler f327821e4e file grade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler b9fc85815e file usepassword.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 312f8b5410 file specimen.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 6d163e8a59 file grading.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 888faa0559 file managing.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 62dec3d6b5 file gradingstrategy.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 06979a542b file password.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 2f4ae7848b file gradinggrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:06 +0000 2005-06-02 02:46:17 +00:00
moodler 9199bfc986 file elements.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler 3fde815636 file administration.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler ea6787cb2f file comparisonofassessments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler 4f0f9f52c6 file info.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler e628acf30d file dialoguetype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler 97d94ab7f2 file addsubject.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler 675522cb1b file multiple.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler 69f2570655 file deleteafter.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler 9206c92895 file closedialogue.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler d3f8a394bc file maildefault.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-06-02 02:46:17 +00:00
moodler de735d30a8 file reportselector.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-06-02 00:52:14 +00:00
moodler 8afa0586cc file reportselector.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:23 +0000 2005-06-02 00:52:14 +00:00
gustav_delius 72a054b9f9 Fixed bug 3393 2005-06-01 20:07:50 +00:00
zibas 643f215f0a file xsl_emulate_xslt.inc was added on branch MOODLE_15_STABLE on 2005-06-07 14:21:19 +0000 2005-06-01 19:32:52 +00:00
moodler 6acfcce9a8 file itemanalysis.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:55 +0000 2005-06-01 19:24:17 +00:00
gustav_delius 6be3c99802 replaced some error() by redirect() 2005-06-01 18:34:24 +00:00
gustav_delius 20101a6092 Improved error messages a bit 2005-06-01 18:16:52 +00:00
moodler 4d044e6e84 SQL should not assume mdl_ prefix on tables (bug 3390) 2005-06-01 08:08:37 +00:00
martinlanghoff d08c400d31 auth fieldlocks: smarter handling of UI strings for user fields 2005-06-01 08:05:28 +00:00
martinlanghoff 770764f392 config_plugins settings migration -- this is a DB upgrade block 2005-06-01 07:47:49 +00:00
martinlanghoff 4f6af1254b get_config() now preserves CFG if DB fails or is empty 2005-06-01 06:57:09 +00:00
martinlanghoff e3cd7f35b9 config_plugin with auth/shibboleth
* config.html now uses print_auth_lock_options()
 * config.html better handling of default vars, and removed some warnings
 * lib.php uses new config_plugin vars
2005-06-01 06:23:44 +00:00
martinlanghoff 2ba609cc8c config_plugin work
* lang updates and lang-related fixes
 * auth/db uses the new convention
2005-06-01 06:01:29 +00:00
gustav_delius 3d7a1cbf2b A missing ! led to bug 3377 2005-06-01 05:56:46 +00:00
martinlanghoff b50eee807b Almost there with config_plugins work!
* More solid checking for auth GET/POST var.
 * print_auth_lock_options() now handles user field mapping options for LDAP and similar modules
 * user mapping options have moved to config_plugins table
 * LDAP module has migrated to using new field mapping vars -- simplified config.html a lot
 * strings are mostly resolved
 * a bit of work pending on CAS and DB modules
 * need an upgrade path for field-mapping config entries -- limited to LDAP only
2005-06-01 04:44:17 +00:00
martinlanghoff 6b64601101 Bumping the revision for the config_plugins table. 2005-06-01 02:28:33 +00:00
moodler 28d21ce79e file gradingstrategy.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:27 +0000 2005-06-01 01:15:06 +00:00
moodler 07387b3124 file gradingstrategy.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-06-01 01:15:06 +00:00
moodler df699778c4 file autocontinue.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 2d7915885a file browsemode.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 9d24e151bc file height.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 9fbed4dc26 file maxgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 9896fa3de5 file mods.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler ea5cb3bbde file width.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 732216d72a file summary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler b08068e829 file package.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 1622a2d06f file grademethod.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 23:34:37 +00:00
moodler 0d4a213943 Better handling of dates when timedue isn't set 2005-05-31 23:28:08 +00:00
moodler 98823d2ac0 Hide due date when there isn;t one 2005-05-31 23:18:54 +00:00
moodler facf76eede Added event handling from trunk 2005-05-31 23:02:44 +00:00
moodler 41591a4a17 file categories_edit.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
moodler cd22423ceb file penalty.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
moodler 479c8e5958 file penaltyscheme.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
moodler 271228d527 file analysisoptions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
moodler d592dc462d file questionsperpage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
moodler bfaf3c876b file adaptive.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
moodler 3954fbf809 file rqp.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:15 +0000 2005-05-31 22:48:21 +00:00
stronk7 c63bcbf27c Complete refactor of quiz_delete_course()
Now this function works following this:
- Iterate over every quiz category in the course (following parent-child relationships).
- If the category is being used*, move it to site level (under a container category) and
      mark it as published.
- If the category isn't being used, remove** it completely (questions, instances...) and
      re-parent its child categories.
- Feedback is shown in a table detailing all the changes performed.

* One category is being used if it has one question that is being used in any quiz,
  independently of its publish status.
** Removal of categories (and associated questions) has benn improved but, it won't
  be perfect until bug 3366 was solved.

Tested against some large courses with reused questions and multiple levels of
categories. Seems to work but

PLEASE TEST IT AND SEND ANY FEEDBACK TO BUG 2459
(http://moodle.org/bugs/bug.php?op=show&bugid=2459)

Exactly this function is going to be used in the upgrade script to solve
the orphan categories issue and it must work perfectly!
2005-05-31 22:31:22 +00:00
stronk7 0242dc70f3 Four new strings added to show the work done
against quiz_categories when a course is deleted.
Part of bug 2459
(http://moodle.org/bugs/bug.php?op=show&bugid=2459)
2005-05-31 21:26:09 +00:00
moodler 25957101a8 file responsestable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-31 20:23:27 +00:00
moodler 6d079b698f file responsestable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:23 +0000 2005-05-31 20:23:27 +00:00
stronk7 0456f1c62a Simplify the quizzes_category_used() function.
I was using the $excluded parameter to avoid
loops between categories. A->B->A. Think we can
assume such loops won't exist, so I've deleted
the $excluded use.
2005-05-31 16:30:36 +00:00
thepurpleblob 5c6c7224eb Took out dos line endings 2005-05-31 15:17:20 +00:00
thepurpleblob a40014f758 Removed spurious aligns in <input> tags for optional units - now formats
properly in Apple Safari
2005-05-31 14:45:05 +00:00
thepurpleblob 53b9b145ab Fixed incorrect !important tags in CSS 2005-05-31 14:21:28 +00:00
thepurpleblob ded3459821 'Fixed' quizzes_category_used declaration to make it work. Based on it only
being called in one place. Might need a 'proper' fix though, but this gets us
moving!
2005-05-31 13:34:15 +00:00
thepurpleblob 331b64ac3f Removed uneccessary call-time pass by reference. 2005-05-31 10:11:00 +00:00
thepurpleblob b89246267b Checks import/export class file actually exists before trying to include it. 2005-05-31 10:02:48 +00:00
martinlanghoff cdbba24134 First cut of field locks support. functional but missing strings and support for LDAP/DB modules.
- Extended set_config()
- Implemented get_config() which takes over $CFG loading in setup.php
- admin/auth.php has special handling if post vars starting in pluginconfig_
- admin/auth.php print_auth_lock_options() prints a form fragment -- being called from most plugins now
- user/edit.php follows the new convention when locking down fields, both javascript UI and on POST.
2005-05-31 05:36:41 +00:00
moodler fa84313875 file quiz_analysis.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:06 +0000 2005-05-31 05:13:33 +00:00
moodler e2d02f322e file timezones.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:06 +0000 2005-05-31 05:13:33 +00:00
moodler 2b545bff3b file block_search_forums.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:05 +0000 2005-05-31 05:13:33 +00:00
moodler ec0e8976e9 file block_glossary_random.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:05 +0000 2005-05-31 05:13:33 +00:00
moodler 24ad970192 file grades.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:05 +0000 2005-05-31 05:13:33 +00:00
moodler 83bf0c7ac3 file block_html.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:05 +0000 2005-05-31 05:13:33 +00:00
moodler 2a55ad8736 file block_quiz_results.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:05 +0000 2005-05-31 05:13:33 +00:00
moodler 25b68ad11e Fix for SC122 2005-05-31 04:36:04 +00:00
moodler d347fbefd6 file qtype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-05-31 01:48:07 +00:00
moodler 6124af76ab file questionnaireid.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-05-31 01:48:07 +00:00
moodler 893e4ecc77 file qmanage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-05-31 01:48:07 +00:00
moodler f5925fe29a file respondenttype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:08 +0000 2005-05-31 01:48:07 +00:00
moodler d07e7183e6 file casesensitive.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler c82589c6b5 file editalways.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 2c0436b1a6 file importcategories.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler a1e04405ff file aliases2.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 0516af71ef file globalglossary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 8f459f900b file usedynalink.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 866885022f file aliases.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 350ad0ef85 file entbypage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 6b73dbaa20 file rssarticles.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 291f7bd8ba file studentcanpost.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 40fb06a8d0 file allowprintview.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler c4563fe0fb file shows.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 17c9ed588d file mainglossary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 9480b8f1f4 file linkcategory.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 6c45d66129 file allowduplicatedentries.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler ae29b65979 file destination.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler e43dd3defa file defaultapproval.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 02c71b5a1e file filetoimport.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler b6f1f29147 file rsstype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 6b9ab9e4fc file attachment.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler cffd20cede file usedynalinkentry.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 3372fd30ff file description.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 8353441838 file allowcomments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 5d213075c3 file displayformat.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler 5da1448d69 file fullmatch.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-31 01:48:07 +00:00
moodler cc082cb176 file dynsection.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-31 01:48:07 +00:00
moodler 53e1d700bf file hours.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-31 01:48:07 +00:00
moodler b9441c6e63 file maxgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-31 01:48:07 +00:00
moodler 98aa5c1e21 file choosedays.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-31 01:48:07 +00:00
moodler fa43dc51f8 file grade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-31 01:48:07 +00:00
moodler ef405b2a1b file autoattend.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-31 01:48:07 +00:00
moodler 58c4dc24c7 file penaltyscheme.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-31 00:12:27 +00:00
moodler 741ee69fad file questionsperpage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-31 00:12:27 +00:00
moodler 754e6ee60b file penaltyscheme.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-05-31 00:12:27 +00:00
moodler 780d107619 file questionsperpage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-05-31 00:12:27 +00:00
stronk7 61842c3a01 Added the sort_categories_by_tree() function that
returns an ordered array of categories following
the parent-child relationships. It doesn't forget
any category and returns all the categories passed
although their parent were incorrect. Try to build
as much tree structure as possible.
2005-05-30 23:56:38 +00:00
mjollnir_ 8c28ed7838 Fixing up problem in generate_email_processing_address -- using sitesecret rather than siteidentifier 2005-05-30 23:25:56 +00:00
martinlanghoff 8bfac5b93d Fixed field lenght in config_plugins 2005-05-30 22:30:50 +00:00
stronk7 6d64a7091d Deleting one debug message... 2005-05-30 22:27:20 +00:00
stronk7 22ad0a2e45 Now the quizzes_category_used() function supports searching
for uses recursively plus an array of excluded categories.

Needed to solve bug 2459...in progress.
2005-05-30 22:25:52 +00:00
moodler e8eaff0171 file analysisoptions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:55 +0000 2005-05-30 22:07:12 +00:00
moodler f3bfb270af Fixed _new with _blank 2005-05-30 18:42:41 +00:00
moodler 260d699c17 Added limit of 900 characters to subject line, to prevent overflows 2005-05-30 18:09:03 +00:00
defacer bb25fc1bca Fix for bug 3364:
The Great Global $course Hack strikes again. I had to put in another instance
of the hack for course themes to work in the "calendar" part of the course.

Hopefully some day we 'll do all that "correctly"! (search for "hack" in
weblib and despair).
2005-05-30 13:31:44 +00:00
defacer 7bc4158521 More correct handling of group events, we cannot simply omit them because
the course has "no groups" UNLESS groupmodeforce == 1 as well.

Sadly, this severely weakens the performace optimizations :(

See bug 3303 for an example of what the problem was before.
2005-05-30 12:40:44 +00:00
mudrd8mz a0028106e3 Included fix by Jaime Villate posted Sunday, 8 May 2005, 10:45 PM 2005-05-30 09:31:28 +00:00
martinlanghoff fc0ee03121 Capture the outcome of the config_plugins table creation. 2005-05-30 05:24:19 +00:00
martinlanghoff 987d846223 Created config_plugins table to manage configuration entries on a per-module/plugin. This breaks the rules a little bit, but it has been discussed with MD. 2005-05-30 05:10:22 +00:00
martinlanghoff e7c83f42ef enrol/ldap offers enrol_allowinternal config option as it should. 2005-05-30 03:51:07 +00:00
moodler c8198e1311 file summary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-30 01:49:53 +00:00
moodler 17620a4193 file package.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-30 01:49:53 +00:00
moodler 61b7abf279 file summary.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-05-30 01:49:52 +00:00
moodler 4be10f9c9d file package.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-05-30 01:49:52 +00:00
watcanz 606f29ff1d styles_layout.css updated for new sideblocks code. header.html removed logo. 2005-05-30 00:02:22 +00:00
ecastrolt 6a43c2aae4 *** empty log message *** 2005-05-29 20:50:14 +00:00
ecastrolt 29a4e4e556 *** empty log message *** 2005-05-29 19:45:14 +00:00
ecastrolt c65086aab0 *** empty log message *** 2005-05-29 19:36:41 +00:00
stronk7 6d85897f87 Added the quizzes_category_used() to detect the list of
quizzes that are using questions from one category.
It relies in the quizzes_question_used() function. Will
be use in the 'orphan_categories' bug (#2459)

(http://moodle.org/bugs/bug.php?op=show&bugid=2459)
2005-05-29 18:58:14 +00:00
stronk7 83c5e8f6b1 format_string() applied once deleting courses...
Merged from HEAD
2005-05-29 17:32:18 +00:00
moodler 3d8a508910 Fix for bug 3350 where older SESSION->wantsurl was hanging around 2005-05-29 07:58:37 +00:00
moodler cb9b40a576 file book.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:14 +0000 2005-05-29 07:07:18 +00:00
moodler e21964e8b0 file timerestrict.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-05-29 06:48:37 +00:00
moodler d15938ce5f file limit.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-05-29 06:48:37 +00:00
moodler 22f52e2bf3 file options.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-05-29 06:48:37 +00:00
moodler b6f8c22bc3 file chatting.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:05 +0000 2005-05-29 06:48:36 +00:00
moodler c89d8d7636 file resubmit.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-29 06:48:36 +00:00
moodler a17794496c file commentinline.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-29 06:48:36 +00:00
moodler e545ae1876 file types.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-29 06:48:36 +00:00
moodler 236ec5b9b6 file assignmenttype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-29 06:48:36 +00:00
moodler bae75cb826 file emailteachers.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-29 06:48:36 +00:00
moodler 89552fc789 file search.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:04 +0000 2005-05-29 06:48:36 +00:00
moodler 3684c9f4e2 file authchange.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:03 +0000 2005-05-29 06:48:36 +00:00
moodler db3a8b8a59 file advancedsettings.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:03 +0000 2005-05-29 06:48:36 +00:00
moodler 2b82654492 file cost.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:03 +0000 2005-05-29 06:48:36 +00:00
moodler bb4e105b49 FIxed a problem when stripping terms from search string for highlighting 2005-05-29 04:04:31 +00:00
defacer 1819221450 Now tablelib allows the GET variables that control sorting etc. to be
configured. Essential in order to allow two independent tables in the same
screen, which is required for /user/index.php.
2005-05-28 21:22:45 +00:00
defacer 4ac7b06a76 Revisited blocks administration page!
* Incompatible blocks which have been disabled during the upgrade
     from Moodle 1.4 can now be deleted.

   * Incompatible blocks (if any) are presented in a separate table
     and are clearly marked as such.

   * Using the new table class.

   * Improved visuals.

   * Fixed HTML and updated obsolete coding conventions all around.
2005-05-28 18:36:01 +00:00
defacer 379298d6ae NEW STRING ADDED for admin/blocks.php
One string we no longer use removed.
2005-05-28 18:28:26 +00:00
defacer 49307babf5 New styles for the revisited admin/blocks page, coming up next. 2005-05-28 18:22:28 +00:00
moodler ac6e8f1133 $CFG->ignoresesskey can override all sesskey checking 2005-05-28 14:02:53 +00:00
moodler ce34811cdd Addes mms protocol 2005-05-28 13:29:37 +00:00
moodler 51f2f92ca5 file trackingtype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:14 +0000 2005-05-28 08:58:56 +00:00
moodler 3bcee5d4c7 Fixed a missing global 2005-05-28 06:38:10 +00:00
moodler 07a5d7cb3e file penalty.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-28 01:27:05 +00:00
moodler 7adc79d42c file penalty.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:24 +0000 2005-05-28 01:27:05 +00:00
moodler 069577e929 file ungradedassessments_teacher.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler cffe2e51bd file usepassword.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:13 +0000 2005-05-28 01:04:34 +00:00
moodler 317dbb6f67 file submissionofexamples.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 0c06ed4263 file selfassessment.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler abb8d37084 file leaguetable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler f0cffb1e49 file resubmit.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 16b96bf3c9 file gradingsubmissions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler e47e30a11f file overallocation.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 4431f7188f file nattachments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 7f6d1637d0 file includeteachersgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 7e01657166 file nassessmentsofteachersexamples.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 51cb63459b file includeself.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 5992f232aa file ungradedassessments_student.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 688d2f7d5b file teacherweight.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler b5cb37d9ea file specimen.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler e892f04d05 file showinggrades.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 01c784002a file nassessmentsofstudentsubmissions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 267a7811fc file ungradedassessments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:34 +00:00
moodler 0ac29d7f60 file gradingassessments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:33 +00:00
moodler c975e6afad file finalgrades.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:33 +00:00
moodler 80118a25eb file breakdownoffinalgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:33 +00:00
moodler 13bc6270d6 file calculatingfinalgrade.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:33 +00:00
moodler 85b2ee359b file editingacomment.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:33 +00:00
moodler 9cd2e8b3d4 file grading.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:12 +0000 2005-05-28 01:04:33 +00:00
moodler 2dcc168e63 file assessmentofexamples.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
moodler 05f64e893d file addcommenttobank.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
moodler f40c81f9b7 file analysisofassessments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
moodler fac82b6f2a file agreeassessments.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
moodler d55bcca3a5 file assignmenttype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
moodler bbc338767a file addingacomment.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
moodler e88d8a3aa4 file anonymous.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:11 +0000 2005-05-28 01:04:33 +00:00
urs_hunkler bb0ceba26d I removed the inlinestyle for the userentry in the sideblock "online user" and added the class "listentry" to the div. The properties of th inline style are now defined in styles_layout.css and stylews_fonts.css. 2005-05-27 17:24:27 +00:00
moodler 2b63e793a2 file analysistable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-27 17:18:47 +00:00
moodler e0514c228d file analysistable.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:23 +0000 2005-05-27 17:18:47 +00:00
moodler 8f92195276 Added an extra style based on the glossary id which might allow
some nice effects.  This idea should probably be extended later,
perhaps with the ability to define the style in the glossary itself.
2005-05-27 14:56:43 +00:00
moodler 4a21ecc113 file block_search_forums.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:19 +0000 2005-05-27 12:25:38 +00:00
moodler 3217988a86 file emailprotect.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:19 +0000 2005-05-27 12:25:38 +00:00
bobopinna 65497822b9 Added AICC API to bug fix a problem with AICC package launch 2005-05-27 09:07:56 +00:00
bobopinna 5bd1036974 file aicc.js.php was added on branch MOODLE_15_STABLE on 2005-05-27 09:07:56 +0000 2005-05-27 09:05:04 +00:00
moodler 01d08c35d6 file quiz_analysis.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:00 +0000 2005-05-27 07:39:59 +00:00
moodler 8415a420df file authchange.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:14 +0000 2005-05-26 23:05:29 +00:00
moodler fa614c0451 file cost.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:14 +0000 2005-05-26 22:40:02 +00:00
moodler 532231e9e8 file retake.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-26 20:46:47 +00:00
moodler 98dba5cea6 file retake.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:23 +0000 2005-05-26 20:46:47 +00:00
moodler d29f2368de file slideshow.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-26 18:50:09 +00:00
moodler 234c4e5276 file slideshow.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:23 +0000 2005-05-26 18:50:09 +00:00
moodler f5e5206c00 file useeditor.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:26 +0000 2005-05-26 17:30:03 +00:00
moodler d19c7d4459 file useeditor.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:23 +0000 2005-05-26 17:30:03 +00:00
moodler 50e20544b7 Merged stability fix from HEAD 2005-05-26 15:25:47 +00:00
moodler a4f3ee5b1e New string for registration 2005-05-26 14:45:15 +00:00
moodler 192d6a6ea9 A little note for admins looking in the source who might be really annoyed. :-) 2005-05-26 14:44:51 +00:00
moodler 705e3a7f76 Registration is now a bit more in-your-face.
Every six months you get prompted by a slightly annoying button on
the admin page to re-register.  Once you've done so it disappears.
2005-05-26 14:43:31 +00:00
moodler d716e12ac4 More little fixes for the calendar days thing 2005-05-26 12:53:11 +00:00
moodler e8b9d71f03 Fixed Strange calls to get_string for weekdays in calendar
http://moodle.org/mod/forum/discuss.php?d=24476
2005-05-26 12:33:10 +00:00
ethem aabfe78ed5 $CFG 2005-05-26 11:22:30 +00:00
bobopinna e41e727022 Fixed some bugs. Now AICC seems to work. 2005-05-26 10:01:56 +00:00
ethem fcee2e9780 Fixing enrol_allowinternal. 2005-05-26 07:35:45 +00:00
gustav_delius 94acf297c6 Better name for the new function 2005-05-26 07:18:25 +00:00
gustav_delius b94257273c Disabled versioning and re-grading until it is fixed. 2005-05-26 07:11:20 +00:00
moodler fc071f0cfc file adaptive.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:55 +0000 2005-05-25 22:17:18 +00:00
gustav_delius 6680874953 reverted to version before Julian's attempt at fixing bug 3311 2005-05-25 21:41:39 +00:00
defacer dbf8f55057 Er, fix for bug 3334 once more.
If at first you don't succeed...
2005-05-25 17:54:58 +00:00
moodler 477647c885 Updated from HEAD 2005-05-25 16:29:16 +00:00
moodler 8fe1a6a72f file grades.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:59 +0000 2005-05-25 16:28:09 +00:00
moodler 6f1a4d5f55 file lesson.php was added on branch MOODLE_15_STABLE on 2005-06-03 17:16:59 +0000 2005-05-25 16:28:09 +00:00
moodler f96e334571 SOme cleaning up of the code 2005-05-25 16:25:43 +00:00
defacer 14b7da1527 Fixing the other half of bug 3334. 2005-05-25 14:26:28 +00:00
defacer 101415b202 Fixing one half of bug 3334 with the patch provided by the reporter.
Also fixing another unfriendly behavior in that screen.
2005-05-25 14:22:05 +00:00
gustav_delius 11e9ca5af1 updated database creation by exporting from my database that was created by updating from 1.4 2005-05-25 06:02:03 +00:00
moodler a4369a6ac4 file penaltyscheme.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:09 +0000 2005-05-25 02:24:44 +00:00
moodler f0eda67f46 file questionsperpage.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-05-25 02:24:44 +00:00
moodler 3ea6ab6652 file rqp.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:10 +0000 2005-05-25 02:24:44 +00:00
moodler 4597517cf5 file penalty.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:09 +0000 2005-05-25 02:24:44 +00:00
moodler d7a8d13cb4 file itemanalysis.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:09 +0000 2005-05-25 02:24:44 +00:00
moodler 289d8f834b file analysisoptions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:09 +0000 2005-05-25 02:24:44 +00:00
moodler cb219861eb file adaptive.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:09 +0000 2005-05-25 02:24:44 +00:00
moodler 206f13e19a file ratings.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler 141f2eb969 file rssarticles.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler 54c362fdaf file maxattachmentsize.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler b7f3681c1d file forumtype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler c71b977964 file subscription2.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler f86849b8e5 file subscription.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler 0d07ff6170 file allowdiscussions.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler cf1db6bad7 file rsstype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler 7e85d1188a file attachment.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
moodler 76de166ee1 file trackingtype.html was added on branch MOODLE_15_STABLE on 2005-06-03 17:17:07 +0000 2005-05-25 02:24:44 +00:00
defacer 76e2cb0a9b Backporting changes from HEAD 2005-05-24 18:58:02 +00:00
moodler 1b0649d558 Moved some things from People block to Administration. Each of them
will probably be tweaked a little more still.
2005-05-24 16:55:48 +00:00
thepurpleblob 05ac097e4c Now includes missing text re. missingword format suppporting short answer questions. 2005-05-24 16:53:34 +00:00
gustav_delius 4c21136a5b fixed bug 3329 2005-05-24 16:07:10 +00:00
bobopinna d38835ab1b Fixed some typo and bugs
Added support to Moodle 1.4 backup
2005-05-24 15:29:51 +00:00
thepurpleblob b0fe38fc78 Put addslashes around question name - truncate at unlucky point could break sql. 2005-05-24 15:17:07 +00:00
julmis ce2e784b47 Adding buttons:
- nolink
- search and replace
2005-05-24 14:21:00 +00:00
gustav_delius 9114cce39b file report.php was added on branch MOODLE_15_STABLE on 2005-06-04 08:54:56 +0000 2005-05-06 06:24:04 +00:00
gustav_delius 0d00dc375f file report.php was added on branch MOODLE_15_STABLE on 2005-06-04 08:55:37 +0000 2005-05-06 06:24:04 +00:00
moodler 27437410f4 file survey.php was added on branch MOODLE_15_STABLE on 2006-03-10 07:27:54 +0000 2005-04-05 20:54:43 +00:00
7235 changed files with 133998 additions and 389175 deletions
+3 -3
View File
@@ -5,9 +5,9 @@
define("MAX_USERS_PER_PAGE", 50);
$add = optional_param('add', "", PARAM_ALPHA);
$remove = optional_param('remove', '', PARAM_ALPHA);
$search = optional_param('search', '', PARAM_ALPHA);
optional_variable($add, "");
optional_variable($remove, "");
optional_variable($search, "");
if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php");
+9 -51
View File
@@ -2,9 +2,6 @@
// config.php - allows admin to edit all configuration variables
include("../config.php");
$auth = optional_param( 'auth','',PARAM_CLEAN );
require_login();
if (!$site = get_site()) {
@@ -21,7 +18,6 @@
/// If data submitted, then process and store.
if ($config = data_submitted()) {
$config = (array)$config;
@@ -36,6 +32,7 @@
}
if (count($err) == 0) {
print_header();
foreach ($config as $name => $value) {
if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
@@ -70,19 +67,11 @@
$options[$module] = get_string("auth_$module"."title", "auth");
}
asort($options);
if (!empty($auth) && in_array($auth, $modules)) {
if (isset($_GET['auth']) && in_array($_GET['auth'], $modules)) {
$auth = $_GET['auth'];
} else {
$auth = $config->auth;
}
// changepassword link replaced by individual auth setting
if (!empty($config->changepassword)) {
if (empty($config->{'auth_'.$auth.'_changepasswordurl'})) {
$config->{'auth_'.$auth.'_changepasswordurl'} = $config->changepassword;
}
set_config('changepassword','');
}
$auth = clean_filename($auth);
require_once("$CFG->dirroot/auth/$auth/lib.php"); //just to make sure that current authentication functions are loaded
if (! isset($config->guestloginbutton)) {
@@ -97,12 +86,6 @@
if (! isset($config->changepassword)) {
$config->changepassword = "";
}
if (! isset($config->{'auth_'.$auth.'_changepasswordurl'})) {
$config->{'auth_'.$auth.'_changepasswordurl'} = '';
}
if (! isset($config->{'auth_'.$auth.'_changepasswordhelp'})) {
$config->{'auth_'.$auth.'_changepasswordhelp'} = '';
}
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
if (empty($focus)) {
@@ -152,32 +135,15 @@
echo '<td/></tr>';
if ($auth != "email" and $auth != "none" and $auth != "manual") {
// display box for URL to change password. NB now on a per-method basis (multiple auth)
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("changepassword", "auth");
echo ":</td>";
echo "<td>";
$passurl = $config->{'auth_'.$auth.'_changepasswordurl'};
echo "<input type=\"text\" name=\"auth_{$auth}_changepasswordurl\" size=\"40\" value=\"$passurl\" />";
echo "<input type=\"text\" name=\"changepassword\" size=\"40\" value=\"$config->changepassword\" />";
echo "</td>";
echo "<td>";
print_string("auth_changepasswordurl_expl","auth",$auth);
echo "</td></tr>";
// display textbox for lost password help. NB now on a per-method basis (multiple auth)
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("auth_changepasswordhelp", "auth");
echo ":</td>";
echo "<td>";
$passhelp = $config->{'auth_'.$auth.'_changepasswordhelp'};
echo "<textarea name=\"auth_{$auth}_changepasswordhelp\" cols=\"30\" rows=\"10\" wrap=\"virtual\">";
echo $passhelp;
echo "</textarea>\n";
echo "</td>";
echo "<td>";
print_string("auth_changepasswordhelp_expl","auth",$auth);
print_string("changepasswordhelp","auth");
echo "</td></tr>";
}
@@ -274,18 +240,10 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
foreach ($user_fields as $field) {
// Define some vars we'll work with
if(empty($pluginconfig->{"field_map_$field"})) {
$pluginconfig->{"field_map_$field"} = '';
}
if(empty($pluginconfig->{"field_updatelocal_$field"})) {
$pluginconfig->{"field_updatelocal_$field"} = '';
}
if (empty($pluginconfig->{"field_updateremote_$field"})) {
$pluginconfig->{"field_updateremote_$field"} = '';
}
if (empty($pluginconfig->{"field_lock_$field"})) {
$pluginconfig->{"field_lock_$field"} = '';
}
optional_variable($pluginconfig->{"field_map_$field"}, '');
optional_variable($pluginconfig->{"field_updatelocal_$field"}, '');
optional_variable($pluginconfig->{"field_updateremote_$field"}, '');
optional_variable($pluginconfig->{"field_lock_$field"}, '');
// define the fieldname we display to the user
$fieldname = $field;
+1
View File
@@ -54,6 +54,7 @@
$config = (object)$a_config;
//weekdays conversions done. Continue
print_header();
foreach ($config as $name => $value) {
backup_set_config($name, $value);
}
+3 -1
View File
@@ -14,7 +14,8 @@
error("Site isn't defined!");
}
$blockid = required_param( 'block',PARAM_INT );
require_variable($_REQUEST['block']);
$blockid = intval($_REQUEST['block']);
if(($blockrecord = blocks_get_record($blockid)) === false) {
error('This block does not exist');
@@ -47,6 +48,7 @@
unset($config->$item);
}
$block->config_save($config);
print_header();
redirect("$CFG->wwwroot/$CFG->admin/blocks.php", get_string("changessaved"), 1);
exit;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<form method="post" action="calendar.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table class="formtable">
<tr>
<th>adminseesall:</th>
+1 -10
View File
@@ -30,20 +30,11 @@
validate_form($config, $err);
if (count($err) == 0) {
print_header();
foreach ($config as $name => $value) {
if ($name == "sessioncookie") {
$value = eregi_replace("[^a-zA-Z]", "", $value);
}
if ($name == "defaultallowedmodules") {
$value = implode(',',$value);
}
if ($name == 'hiddenuserfields') {
if (in_array('none', $value)) {
$value = '';
} else {
$value = implode(',',$value);
}
}
unset($conf);
$conf->name = $name;
$conf->value = $value;
+1 -148
View File
@@ -74,9 +74,6 @@ class configvar {
$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() {
@@ -88,8 +85,7 @@ class configvarrss extends configvar {
choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
'<font color="red"> You need to add XML support to your PHP installation.</font>' );
$misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'),
choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true));
////////////////////////////////////////////////////////////////////
@@ -139,9 +135,6 @@ class configvarrss extends configvar {
$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=/pic.jpg";
@@ -213,71 +206,6 @@ class configvarrss extends configvar {
choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
unset($options);
$options['none'] = 'No courses';
$options['all'] = 'All courses';
$options['requested'] = 'Requested courses';
$permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
' <script language="JavaScript">
function togglemodules(index) {
if (index == 0) {
document.getElementById(\'allowedmodules\').disabled=true;
}
else {
document.getElementById(\'allowedmodules\').disabled=false;
}
}
</script>'.
choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
$permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
$allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
$allowedmodules = array();
if (!empty($config->defaultallowedmodules)) {
$allowedmodules = explode(',',$config->defaultallowedmodules);
}
// On a fresh install of Moodle, this could be empty; prevent a warning on the following loop.
if (!$mods = get_records("modules")) {
$mods = array();
}
$s = "selected=\"selected\"";
$allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
foreach ($mods as $mod) {
$selected = "";
if (in_array($mod->id,$allowedmodules))
$selected = $s;
$allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
}
$allowstr .= '</select>';
$permissions['defaultallowedmoules'] = 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
@@ -375,23 +303,6 @@ class configvarrss extends configvar {
$user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
/// hiddenuserfields
$fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
if (empty($config->hiddenuserfields)) {
$config->hiddenuserfields = 'none';
}
$configfields = array_flip(explode(',', $config->hiddenuserfields));
$fieldoptions = '';
foreach ($fields as $value) {
$fieldoptions .= '<option value="'.$value.'"';
if (isset($configfields[$value])) {
$fieldoptions .= ' selected="selected"';
}
$fieldoptions .= '>'.get_string($value).'</option>';
}
$user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
'<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
@@ -554,66 +465,10 @@ class configvarrss extends configvar {
$mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
'<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
/// sitemailcharset
unset($options);
unset($charsets);
$charsets = get_list_of_charsets();
$options['0'] = get_string('none');
$options = array_merge($options, $charsets);
$mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
/// allowusermailcharset
$mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
/// enable stats
$stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
unset($options);
$options['none'] = get_string('none');
$options[60*60*24*7] = get_string('numweeks','moodle',1);
$options[60*60*24*14] = get_string('numweeks','moodle',2);
$options[60*60*24*21] = get_string('numweeks','moodle',3);
$options[60*60*24*28] = get_string('nummonths','moodle',1);
$options[60*60*24*56] = get_string('nummonths','moodle',2);
$options[60*60*24*84] = get_string('nummonths','moodle',3);
$options[60*60*24*112] = get_string('nummonths','moodle',4);
$options[60*60*24*140] = get_string('nummonths','moodle',5);
$options[60*60*24*168] = get_string('nummonths','moodle',6);
$options['all'] = get_string('all');
$stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
unset($options);
$options[0] = get_string('untilcomplete');
$options[60*60] = '1 '.get_string('hour');
$options[60*60*2] = '2 '.get_string('hours');
$options[60*60*3] = '3 '.get_string('hours');
$options[60*60*4] = '4 '.get_string('hours');
$options[60*60*5] = '5 '.get_string('hours');
$options[60*60*6] = '6 '.get_string('hours');
$options[60*60*7] = '7 '.get_string('hours');
$options[60*60*8] = '8 '.get_string('hours');
if (empty($config->statsruntimestarthour)) {
$config->statsruntimestarthour = 0;
}
if (empty($config->statsruntimestartminute)) {
$config->statsruntimestartminute = 0;
}
$stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );
$stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
$stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
'<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
////////////////////////////////////////////////////////////////////
@@ -624,8 +479,6 @@ class configvarrss extends configvar {
$configvars['mail'] = $mail;
$configvars['user'] = $user;
$configvars['permissions'] = $permissions;
$configvars['requestedcourse'] = $reqcourse;
$configvars['misc'] = $misc;
$configvars['stats'] = $stats;
?>
+3 -3
View File
@@ -5,9 +5,9 @@
define("MAX_USERS_PER_PAGE", 50);
$search = optional_param('search', '', PARAM_CLEAN);
$add = optional_param('add', '', PARAM_CLEAN);
$remove = optional_param('remove', '', PARAM_CLEAN );
optional_variable($search, "");
optional_variable($add, "");
optional_variable($remove, "");
if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php");
+1 -96
View File
@@ -27,7 +27,6 @@
}
require_once("../config.php");
require_once($CFG->dirroot.'/lib/adminlib.php');
if (!$alreadyadmin = isadmin()) {
unset($_SESSION['USER']);
@@ -35,8 +34,6 @@
unset($_SESSION['SESSION']);
unset($SESSION);
$USER = get_admin(); /// Temporarily, to provide environment for this script
// we need to override the admin timezone to the moodle timezone!
$USER->timezone = $CFG->timezone;
}
//unset test cookie, user must login again anyway
@@ -107,28 +104,12 @@
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
if ($users = get_users_unconfirmed($oneweek)) {
foreach ($users as $user) {
if (delete_records('user', 'id', $user->id)) {
if (delete_records("user", "id", $user->id)) {
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
}
}
}
flush();
/// Delete users who haven't completed profile within required period
$oneweek = $timenow - ($CFG->deleteunconfirmed * 3600);
if ($users = get_users_not_fully_set_up($oneweek)) {
foreach ($users as $user) {
if (delete_records('user', 'id', $user->id)) {
mtrace("Deleted not fully setup user $user->username ($user->id)");
}
}
}
flush();
/// Delete old logs to save space (this might need a timer to slow it down...)
@@ -153,31 +134,6 @@
sync_metacourses();
//
// generate new password emails for users
//
mtrace('checking for create_password');
if (count_records('user_preferences', 'name', 'create_password', 'value', '1')) {
mtrace('creating passwords for new users');
$newusers = get_records_sql("SELECT u.id as id, u.email, u.firstname,
u.lastname, u.username,
p.id as prefid
FROM {$CFG->prefix}user u
JOIN {$CFG->prefix}user_preferences p ON u.id=p.userid
WHERE p.name='create_password' AND p.value=1 AND u.email !='' ");
foreach ($newusers as $newuserid => $newuser) {
$newuser->emailstop = 0; // send email regardless
// email user
if (setnew_password_and_mail($newuser)) {
// remove user pref
delete_records('user_preferences', 'id', $newuser->prefid);
} else {
trigger_error("Could not create and mail new user password!");
}
}
}
} // End of occasional clean-up tasks
@@ -186,12 +142,6 @@
//Perhaps a long time and memory could help in large sites
@set_time_limit(0);
@raise_memory_limit("128M");
if (function_exists('apache_child_terminate')) {
// if we are running from Apache, give httpd a hint that
// it can recycle the process after it's done. Apache's
// memory management is truly awful but we can help it.
@apache_child_terminate();
}
if (file_exists("$CFG->dirroot/backup/backup_scheduled.php") and
file_exists("$CFG->dirroot/backup/backuplib.php") and
file_exists("$CFG->dirroot/backup/lib.php") and
@@ -229,51 +179,6 @@
mtrace($enrol->log);
}
if (!empty($CFG->enablestats)) {
// check we're not before our runtime
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
if (time() > $timetocheck) {
$time = 60*60*20; // set it to 20 here for first run... (overridden by $CFG)
$clobber = true;
if (!empty($CFG->statsmaxruntime)) {
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour just to make sure (it could take that long to break out of the loop)
}
if (!get_field_sql('SELECT id FROM '.$CFG->prefix.'stats_daily LIMIT 1')) {
// first run, set another lock. we'll check for this in subsequent runs to set the timeout to later for the normal lock.
set_cron_lock('statsfirstrunlock',true,$time,true);
$firsttime = true;
}
$time = 60*60*2; // this time set to 2.. (overridden by $CFG)
if (!empty($CFG->statsmaxruntime)) {
$time = $CFG->statsmaxruntime+(60*30); // add on half an hour to make sure (it could take that long to break out of the loop)
}
if ($config = get_record('config','name','statsfirstrunlock')) {
if (!empty($config->value)) {
$clobber = false; // if we're on the first run, just don't clobber it.
}
}
if (set_cron_lock('statsrunning',true,$time, $clobber)) {
require_once($CFG->dirroot.'/lib/statslib.php');
$return = stats_cron_daily();
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
stats_cron_weekly();
}
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
$return = $return && stats_cron_monthly();
}
if (stats_check_runtime() && $return == STATS_RUN_COMPLETE) {
stats_clean_old();
}
set_cron_lock('statsrunning',false);
if (!empty($firsttime)) {
set_cron_lock('statsfirstrunlock',false);
}
}
}
}
//Unset session variables and destroy it
@session_unset();
@session_destroy();
+2 -6
View File
@@ -3,10 +3,6 @@
require_once("../config.php");
$topframe = optional_param( 'topframe', '', PARAM_ALPHA);
$bottomframe = optional_param( 'bottomframe', '', PARAM_ALPHA);
$do = optional_param( 'do','',PARAM_ALPHA);
require_login();
if (!isadmin()) {
@@ -17,13 +13,13 @@
$stradministration = get_string("administration");
$site = get_site();
if (!empty($topframe)) {
if (isset($topframe)) {
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname",
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> Database performance");
exit;
}
if (!empty($bottomframe) or !empty($do)) {
if (isset($bottomframe) or isset($_GET['do'])) {
$perf =&NewPerfMonitor($db);
$perf->UI($pollsecs=5);
exit;
+1 -1
View File
@@ -178,7 +178,7 @@ function editor_get_dictionaries () {
$dictionaries = array();
$dicts = array();
if(!($handle = @popen(escapeshellarg($cmd) .' dump dicts', 'r'))) {
if(!($handle = @popen($cmd .' dump dicts', 'r'))) {
return $strerror = "Couldn't create handle!";
exit;
}
-79
View File
@@ -1,79 +0,0 @@
<?php // $Id$
// filter.php
// Edit text filter settings
require_once "../config.php";
require_once "$CFG->libdir/tablelib.php";
// check for allowed access
require_login();
if (!isadmin()) {
error( 'Only administrators can use the filters administration page' );
}
if (!$site = get_site()) {
error( 'Site is not defined in filters administration page' );
}
// get parameters
$params = new Object;
$param->filter = required_param( 'filter' );
// get translated strings for use on page
$txt = new Object;
$txt->managefilters = get_string( 'managefilters' );
$txt->administration = get_string( 'administration' );
$txt->configuration = get_string( 'configuration' );
//======================
// Process Actions
//======================
if ($config = data_submitted()) {
// check session key
if (!confirm_sesskey()) {
error( get_string('confirmsesskeybad', 'error' ) );
}
// run through submitted data
// reject if does not start with filter_
foreach ($config as $name => $value) {
set_config( $name,$value );
}
redirect( "$CFG->wwwroot/$CFG->admin/filters.php", get_string('changessaved'), 1);
exit;
}
//==============================
// Display logic
//==============================
$filtername = ucfirst( substr( $param->filter, strpos( $param->filter, '/' )+1 ) );
print_header( "$site->shortname: $txt->managefilters", "$site->fullname",
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
"-> <a href=\"filters.php\">$txt->managefilters</a> -> $filtername" );
print_heading( $txt->managefilters );
print_simple_box("<center>".get_string("configwarning", "admin")."</center>", "center", "50%");
echo "<br />";
print_simple_box_start("center",'');
?>
<form action="filter.php?filter=<?php echo urlencode($param->filter); ?>" method="post">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<?php include "$CFG->dirroot/$param->filter/filterconfig.html"; ?>
<center><input type="submit" value="<?php print_string('savechanges'); ?>" /></center>
</form>
<?php
print_simple_box_end();
print_simple_box_end();
print_footer();
?>
+159
View File
@@ -0,0 +1,159 @@
<?php print_simple_box_start("center"); ?>
<form name="filters" id="filters" method="post" action="filters.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table align="center" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top"><div align="right">
<br />
<input name="up" type="submit" id="up" value="&uarr;" />
<br />
<input name="down" type="submit" id="down" value="&darr;" />
<br />
</div></td>
<td valign="top">
<?php p($stractive) ?>
<br />
<select name="iselect" size="20" id="iselect"
onclick="document.filters.add.disabled=true;
document.filters.remove.disabled=false;
document.filters.uselect.selectedIndex=-1;">
<?php
$runscript = "";
foreach ($installedfilters as $filter) {
if ($selectedfilter == $filter) {
$selected = " selected ";
$runscript = "eval(\"document.filters.add.disabled=true\");
eval(\"document.filters.remove.disabled=false\");
eval(\"document.filters.uselect.selectedIndex=-1\");";
} else {
$selected = "";
}
echo "<option value=\"$filter\" $selected>".$allfilters[$filter]."</option>";
}
?>
</select></td>
<td valign="top">
<br />
<input name="add" type="submit" id="add" value="&larr;" />
<br />
<input name="remove" type="submit" id="remove" value="&rarr;" />
<br />
</td>
<td valign="top">
<?php p($strinactive) ?>
<br />
<select name="uselect" size="20" id="select"
onclick="document.filters.add.disabled=false;
document.filters.remove.disabled=true;
document.filters.iselect.selectedIndex=-1;">
<?php
foreach ($uninstalledfilters as $filter) {
if ($selectedfilter == $filter) {
$selected = " selected ";
$runscript = "eval(\"document.filters.add.disabled=false\");
eval(\"document.filters.remove.disabled=true\");
eval(\"document.filters.iselect.selectedIndex=-1\");";
} else {
$selected = "";
}
echo "<option value=\"$filter\" $selected>".$allfilters[$filter]."</option>";
}
?>
</select></td>
</tr>
</table>
</form>
<script language="Javascript">
<!--
<?php echo $runscript ?>
-->
</script>
<?php print_simple_box_end(); ?>
<br />
<br />
<?php print_simple_box_start("center"); ?>
<form name="options" id="options" method="post" action="filters.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<input type="hidden" name="options" value="1">
<table cellpadding="20">
<tr valign="top">
<td nowrap="nowrap" align="right"><?php p($strcachetext) ?>:</td>
<td>
<?php
unset($options);
$options[604800] = get_string('numdays', '', 7);
$options[86400] = get_string('numdays', '', 1);
$options[43200] = get_string('numhours', '', 12);
$options[10800] = get_string('numhours', '', 3);
$options[7200] = get_string('numhours', '', 2);
$options[3600] = get_string('numhours', '', 1);
$options[2700] = get_string('numminutes', '', 45);
$options[1800] = get_string('numminutes', '', 30);
$options[900] = get_string('numminutes', '', 15);
$options[600] = get_string('numminutes', '', 10);
$options[540] = get_string('numminutes', '', 9);
$options[480] = get_string('numminutes', '', 8);
$options[420] = get_string('numminutes', '', 7);
$options[360] = get_string('numminutes', '', 6);
$options[300] = get_string('numminutes', '', 5);
$options[240] = get_string('numminutes', '', 4);
$options[180] = get_string('numminutes', '', 3);
$options[120] = get_string('numminutes', '', 2);
$options[60] = get_string('numminutes', '', 1);
$options[30] = get_string('numseconds', '', 30);
$options[0] = get_string('no');
choose_from_menu ($options, "cachetext", $CFG->cachetext, "", "", "");
?>
</td>
<td>
<?php p($strconfigcachetext) ?>
</td>
</tr>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php p($strfilteruploadedfiles) ?>:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "filteruploadedfiles", $CFG->filteruploadedfiles, "", "", "");
?>
</td>
<td>
<?php p($strconfigfilteruploadedfiles) ?>
</td>
</tr>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php p($strfilterall) ?>:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "filterall", $CFG->filterall, "", "", "");
?>
</td>
<td>
<?php p($strconfigfilterall) ?>
</td>
</tr>
<tr valign="top">
<td>&nbsp;</td>
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
<?php print_simple_box_end(); ?>
+138 -295
View File
@@ -1,330 +1,173 @@
<?php // $Id$
// filters.php
// Edit list of available text filters
<?PHP // $Id$
// Allows the admin to create, delete and rename course categories
require_once "../config.php";
require_once "$CFG->libdir/tablelib.php";
require_once("../config.php");
// defines
define( 'FILTER_TABLE','filter_administration_table' );
optional_variable($iselect);
optional_variable($uselect);
optional_variable($add);
optional_variable($remove);
optional_variable($up);
optional_variable($down);
// check for allowed access
require_login();
if (!isadmin()) {
error( 'Only administrators can use the filters administration page' );
error("Only administrators can use this page!");
}
if (!$site = get_site()) {
error( 'Site is not defined in filters administration page' );
error("Site isn't defined!");
}
// get values from page
$params = new Object;
$params->action = optional_param( 'action','',PARAM_ALPHA );
$params->filterpath = optional_param( 'filterpath', '',PARAM_PATH );
$params->cachetext = optional_param( 'cachetext','0',PARAM_INT );
$params->filteruploadedfiles = optional_param( 'filteruploadedfiles','',PARAM_ALPHA );
$params->filterall = optional_param( 'filterall','',PARAM_ALPHA );
$params->filtermatchoneperpage = optional_param( 'filtermatchoneperpage','',PARAM_ALPHA );
$params->filtermatchonepertext = optional_param( 'filtermatchonepertext','',PARAM_ALPHA );
/// Print headings
// 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');
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strmanagefilters = get_string("managefilters");
$strversion = get_string("version");
$strsettings = get_string("settings");
$strup = get_string("up");
$strdown = get_string("down");
$stractive = get_string("active");
$strinactive = get_string("inactive");
$strcachetext = get_string("cachetext", "admin");
$strconfigcachetext = get_string("configcachetext", 'admin');
$strfilteruploadedfiles = get_string("filteruploadedfiles", "admin");
$strfilterall = get_string("filterall", "admin");
$strconfigfilteruploadedfiles = get_string("configfilteruploadedfiles", 'admin');
$strconfigfilterall = get_string("configfilterall", "admin");
// get a list of possible filters (and translate name if possible)
// note filters can be in the dedicated filters area OR in their
// associated modules
print_header("$site->shortname: $strmanagefilters", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strmanagefilters");
print_heading($strmanagefilters);
/// Make a list of all available filters and the best names for them we can find
$allfilters = array();
$filtersettings = array();
$filterlocations = array('mod','filter');
$filterlocations = array("mod", "filter");
foreach ($filterlocations as $filterlocation) {
$plugins = get_list_of_plugins( $filterlocation );
foreach ($plugins as $plugin) {
$pluginpath = "$CFG->dirroot/$filterlocation/$plugin/filter.php";
$settingspath = "$CFG->dirroot/$filterlocation/$plugin/filterconfig.html";
if (is_readable( $pluginpath )) {
$name = trim( get_string("filtername", $plugin) );
if (empty($name) or ($name == '[[filtername]]')) {
$plugins = get_list_of_plugins($filterlocation);
foreach ($plugins as $key => $plugin) {
if (is_readable("$CFG->dirroot/$filterlocation/$plugin/filter.php")) {
$name = trim(get_string("filtername", $plugin));
if (empty($name) or $name == "[[filtername]]") {
$name = $plugin;
}
$allfilters[ "$filterlocation/$plugin" ] = ucfirst( $name );
}
if (is_readable($settingspath)) {
$filtersettings[] = "$filterlocation/$plugin";
$allfilters["$filterlocation/$plugin"] = $name;
}
}
}
// get all the currently selected filters
if (!empty($CFG->textfilters)) {
$installedfilters = explode( ',', $CFG->textfilters );
}
else {
$installedfilters = array();
}
/// Make an array of all the currently installed filters
// take this opportunity to clean up filters
$oldinstalledfilters = $installedfilters;
$installedfilters = array();
foreach ($oldinstalledfilters as $key => $installedfilter ) {
if (!empty( $installedfilter ) and array_key_exists( $installedfilter, $allfilters ) ) {
$installedfilters[ $key ] = $installedfilter;
}
}
$installedfilters = array_unique($installedfilters);
set_config( 'textfilters', implode( ',', $installedfilters ) );
if (!empty($CFG->textfilters)) {
$installedfilters = explode(',',$CFG->textfilters);
//======================
// Process Actions
//======================
if (($params->action=="hide") and confirm_sesskey()) {
$key=array_search( $params->filterpath, $installedfilters );
// check filterpath is valid
if ($key===false) {
error( "Filter $params->filterpath is not a currently installed filter" );
}
// just delete it
unset( $installedfilters[ $key ] );
set_config( 'textfilters', implode( ',', $installedfilters ) );
}
if (($params->action=="show") and confirm_sesskey()) {
// check filterpath is valid
if (!array_key_exists( $params->filterpath, $allfilters ) ) {
error( "Filter $params->filterpath is not a currently installed filter" );
}
if (array_search( $params->filterpath,$installedfilters ) ) {
error( "Filter $params->filterpath is already active" );
}
// add it to installed filters
$installedfilters[] = $params->filterpath;
$installedfilters = array_unique($installedfilters);
set_config( 'textfilters', implode( ',', $installedfilters ) );
}
if (($params->action=="down") and confirm_sesskey()) {
$key=array_search( $params->filterpath, $installedfilters );
// check filterpath is valid
if ($key===false ) {
error( "Filter $params->filterpath is not a currently installed filter" );
}
if ($key>=(count($installedfilters)-1)) {
error( "Filter $params->filterpath cannot be moved any further down" );
}
// swap with $key+1
$fsave = $installedfilters[$key];
$installedfilters[$key] = $installedfilters[$key+1];
$installedfilters[$key+1] = $fsave;
set_config( 'textfilters', implode( ',', $installedfilters ) );
}
if (($params->action=="up") and confirm_sesskey()) {
$key=array_search( $params->filterpath, $installedfilters );
// check filterpath is valid
if ($key===false ) {
error( "Filter $params->filterpath is not a currently installed filter" );
}
if ($key<1) {
error( "Filter $params->filterpath cannot be moved any further up" );
}
// swap with $key-1
$fsave = $installedfilters[$key];
$installedfilters[$key] = $installedfilters[$key-1];
$installedfilters[$key-1] = $fsave;
set_config( 'textfilters', implode( ',', $installedfilters ) );
}
if (($params->action=="config") and confirm_sesskey()) {
set_config( 'cachetext', $params->cachetext );
set_config( 'filteruploadedfiles', $params->filteruploadedfiles );
set_config( 'filterall', $params->filterall );
set_config( 'filtermatchoneperpage', $params->filtermatchoneperpage );
set_config( 'filtermatchonepertext', $params->filtermatchonepertext );
}
//======================
// Build Display Objects
//======================
// construct the display array with installed filters
// at the top in the right order
$displayfilters = array();
foreach ($installedfilters as $installedfilter) {
$name = $allfilters[ $installedfilter ];
$displayfilters[ $installedfilter ] = $name;
}
foreach ($allfilters as $key => $filter) {
if (!array_key_exists( $key, $displayfilters )) {
$displayfilters[ $key ] = $filter;
}
}
// construct the flexible table ready to display
$table = new flexible_table(FILTER_TABLE);
$table->define_columns( array( 'name', 'hideshow', 'order', 'settings' ) );
$table->define_headers( array( $txt->name, $txt->hideshow, $txt->updown, $txt->settings ) );
$table->define_baseurl( "$CFG->wwwroot/admin/filters.php" );
$table->set_attribute( 'id', 'blocks' );
$table->set_attribute( 'class', 'flexible generaltable generalbox' );
$table->setup();
// some basic information
$url = strip_querystring( qualified_me() );
$myurl = "$url?sesskey=" . sesskey();
$img = "$CFG->pixpath/t";
// iterate through filters adding to display table
$updowncount = 1;
$installedfilterscount = count( $installedfilters );
foreach( $displayfilters as $path => $name ) {
$upath = urlencode( $path );
// get hide/show link
if (in_array( $path, $installedfilters )) {
$hideshow = "<a href=\"$myurl&amp;action=hide&amp;filterpath=$upath\">";
$hideshow .= "<img src=\"$img/hide.gif\" alt=\"hide\" /></a>";
$hidden = false;
$displayname = "<span>$name</span>";
}
else {
$hideshow = "<a href=\"$myurl&amp;action=show&amp;filterpath=$upath\">";
$hideshow .= "<img src=\"$img/show.gif\" 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;";
// Do a little cleanup for robustness
foreach ($installedfilters as $key => $installedfilter) {
if (empty($installedfilter)) {
unset($installedfilters[$key]);
set_config("textfilters", implode(',', $installedfilters));
}
else {
$updown .= "<img src=\"$CFG->pixpath/spacer.gif\" height=\"16\" width=\"16\" alt=\"\" />&nbsp;";
}
if ($updowncount<$installedfilterscount) {
$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
//==============================
$selectedfilter = "none";
print_header( "$site->shortname: $txt->managefilters", "$site->fullname",
"<a href=\"index.php\">$txt->administration</a> -> <a href=\"configure.php\">$txt->configuration</a> " .
"-> $txt->managefilters" );
/// If data submitted, then process and store.
print_heading_with_help( $txt->managefilters, 'filters' );
if (!empty($options)) {
if (($config = data_submitted()) && confirm_sesskey()) {
unset($config->options);
unset($config->sesskey);
foreach ($config as $name => $value) {
set_config($name, $value);
}
}
}
// print the table of all the filters
$table->print_html();
if (!empty($add) and !empty($uselect) and confirm_sesskey()) {
$selectedfilter = $uselect;
if (!in_array($selectedfilter, $installedfilters)) {
$installedfilters[] = $selectedfilter;
set_config("textfilters", implode(',', $installedfilters));
}
// print the table for the cache controls
print_heading( $txt->cachecontrols );
print_simple_box_start('center');
?>
} else if (!empty($remove) and !empty($iselect) and confirm_sesskey()) {
$selectedfilter = $iselect;
foreach ($installedfilters as $key => $installedfilter) {
if ($installedfilter == $selectedfilter) {
unset($installedfilters[$key]);
}
}
set_config("textfilters", implode(',', $installedfilters));
<form name="options" id="options" method="post" action="<?php echo $url; ?>" >
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<input type="hidden" name="action" value="config" />
<table cellpadding="20">
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->cachetext; ?></td>
<td><?php choose_from_menu( $options, "cachetext", $CFG->cachetext, "", "", "" ); ?></td>
<td><?php echo $txt->configcachetext; ?></td>
</tr>
<tr valign="top">
<td nowrap="nowrap" align="right"><?php echo $txt->filteruploadedfiles; ?></td>
<td><?php choose_from_menu( array($txt->no,$txt->yes), "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>
} else if ((!empty($up) or !empty($down)) and !empty($iselect) and confirm_sesskey()) {
if (!empty($up)) {
if ($allfilters[$iselect]) {
foreach ($installedfilters as $key => $installedfilter) {
if ($installedfilter == $iselect) {
$movefilter = $key;
break;
}
$swapfilter = $key;
}
}
}
if (!empty($down)) {
if ($allfilters[$iselect]) {
$choosenext = false;
foreach ($installedfilters as $key => $installedfilter) {
if ($choosenext) {
$swapfilter = $key;
break;
}
if ($installedfilter == $iselect) {
$movefilter = $key;
$choosenext = true;
}
}
}
}
if (isset($swapfilter) and isset($movefilter)) {
$tempfilter = $installedfilters[$swapfilter];
$installedfilters[$swapfilter] = $installedfilters[$movefilter];
$installedfilters[$movefilter] = $tempfilter;
set_config("textfilters", implode(',', $installedfilters));
}
$selectedfilter = $iselect;
}
/// Make an array of all the currently uninstalled filters
$uninstalledfilters = array();
foreach ($allfilters as $filter => $name) {
$installed = false;
foreach ($installedfilters as $installedfilter) {
if ($installedfilter == $filter) {
$installed = true;
}
}
if (!$installed) {
$uninstalledfilters[] = $filter;
}
}
/// Print the current form
include("filters.html");
<?php
print_simple_box_end();
print_footer();
?>
+2 -4
View File
@@ -7,8 +7,6 @@
define('SEVERITY_SIGNIFICANT', 'significant');
define('SEVERITY_CRITICAL', 'critical');
$resetsesserrorcounter = optional_param( 'resetsesserrorcounter' );
require_login();
if (!isadmin()) {
error('Only the admin can use this page');
@@ -500,7 +498,7 @@ class problem_000011 extends problem_base {
}
function solution() {
global $CFG;
if (!empty($resetsesserrorcounter)) {
if (isset($_GET['resetsesserrorcounter'])) {
if (get_field('config', 'name', 'name', 'session_error_counter')) {
delete_records('config', 'name', 'session_error_counter');
}
@@ -539,4 +537,4 @@ TODO:
*/
?>
?>
+64 -91
View File
@@ -5,14 +5,10 @@
header('Location: ../install.php');
die;
}
require_once("../config.php");
include_once("$CFG->dirroot/lib/adminlib.php"); // Contains various admin-only functions
$id = optional_param('id', '', PARAM_ALPHANUM);
$confirmupgrade = optional_param('confirmupgrade','');
/// Check that PHP is of a sufficient version
@@ -75,7 +71,7 @@
@set_time_limit(0);
@ob_implicit_flush(true);
@ob_end_flush();
/// Check if the main tables have been installed yet or not.
@@ -145,7 +141,7 @@
$a->newversion = "$release ($version)";
$strdatabasechecking = get_string("databasechecking", "", $a);
if (empty($confirmupgrade)) {
if (empty($_GET['confirmupgrade'])) {
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
"", "", false, "&nbsp;", "&nbsp;");
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
@@ -206,18 +202,9 @@
if (!set_config("release", $release)) {
notify("ERROR: Could not update release version in database!!");
}
if (!empty($CFG->unicodedb)) {
$defaultlang = 'en_utf8';
} else {
$defaultlang = 'en';
}
print_continue("index.php");
print_simple_box_start("CENTER");
if (file_exists("$CFG->dataroot/lang/$defaultlang/docs/release.html")) {
include("$CFG->dataroot/lang/$defaultlang/docs/release.html");
} else if (file_exists("$CFG->dirroot/lang/$defaultlang/docs/release.html")) {
include("$CFG->dirroot/lang/$defaultlang/docs/release.html");
}
include("$CFG->dirroot/lang/en/docs/release.html");
print_simple_box_end();
print_continue("index.php");
exit;
@@ -262,9 +249,6 @@
/// Check all enrolment plugins and upgrade if necessary
upgrade_enrol_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Check for local database customisations
require_once("$CFG->dirroot/lib/locallib.php");
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Set up the overall site name etc.
@@ -309,8 +293,8 @@
/// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
if (!empty($id)) {
if ($id == $CFG->siteidentifier) {
if (!empty($_GET['id'])) {
if ($_GET['id'] == $CFG->siteidentifier) {
set_config('registered', time());
}
}
@@ -328,11 +312,6 @@
print_spacer(10,10);
}
if (ini_get_bool('register_globals') && !ini_get_bool('magic_quotes_gpc')) {
print_simple_box(get_string('globalsquoteswarning', 'admin'), 'center');
}
/// If no recently cron run
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
if (time() - $lastcron > 3600 * 24) {
@@ -365,87 +344,81 @@
$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>';
$configdata = "<font size=\"+1\">&nbsp;</font><a href=\"config.php\">".get_string("configvariables", 'admin')."</a> - <font size=\"1\">".
get_string("adminhelpconfigvariables")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"site.php\">".get_string("sitesettings")."</a> - <font size=\"1\">".
get_string("adminhelpsitesettings")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"../theme/index.php\">".get_string("themes")."</a> - <font size=\"1\">".
get_string("adminhelpthemes")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"lang.php\">".get_string("language")."</a> - <font size=\"1\">".
get_string("adminhelplanguage")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"modules.php\">".get_string("managemodules")."</a> - <font size=\"1\">".
get_string("adminhelpmanagemodules")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"blocks.php\">".get_string("manageblocks")."</a> - <font size=\"1\">".
get_string("adminhelpmanageblocks")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"filters.php\">".get_string("managefilters")."</a> - <font size=\"1\">".
get_string("adminhelpmanagefilters")."</font><br />";
if (!isset($CFG->disablescheduledbackups)) {
$configdata .= '<div class="adminlink"><a href="backup.php">'.get_string('backup').
'</a> - <span class="explanation">'.get_string('adminhelpbackup').'</span></div>';
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"backup.php\">".get_string("backup")."</a> - <font size=\"1\">".
get_string("adminhelpbackup")."</font><br />";
}
$configdata .= '<div class="adminlink"><a href="editor.php">'.get_string('editorsettings').
'</a> - <span class="explanation">'.get_string('adminhelpeditorsettings').'</span></div>';
$configdata .= '<div class="adminlink"><a href="calendar.php">'.get_string('calendarsettings', 'admin').
'</a> - <span class="explanation">'.get_string('helpcalendarsettings', 'admin').'</span></div>';
$configdata .= '<div class="adminlink"><a href="maintenance.php">'.get_string('sitemaintenancemode', 'admin').
'</a> - <span class="explanation">'.get_string('helpsitemaintenance', 'admin').'</span></div>';
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"editor.php\">". get_string("editorsettings") ."</a> - <font size=\"1\">".
get_string("adminhelpeditorsettings")."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"calendar.php\">". get_string('calendarsettings', 'admin') ."</a> - <font size=\"1\">".
get_string('helpcalendarsettings', 'admin')."</font><br />";
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"maintenance.php\">". get_string('sitemaintenancemode', 'admin') ."</a> - <font size=\"1\">".
get_string('helpsitemaintenance', 'admin')."</font><br />";
$table->data[] = array('<strong><a href="configure.php">'.get_string('configuration').'</a></strong>', $configdata);
$table->data[] = array("<font size=\"+1\"><b><a href=\"configure.php\">".get_string("configuration")."</a></b></font>",
$configdata);
$userdata = '<div class="adminlink"><a href="auth.php?sesskey='.$USER->sesskey.'">'.get_string("authentication").
'</a> - <span class="explanation">'.get_string('adminhelpauthentication').'</span></div>';
$userdata .= '<div class="adminlink"><a href="user.php">'.get_string('edituser').
'</a> - <span class="explanation">'.get_string('adminhelpedituser').'</span></div>';
$userdata .= '<div class="adminlink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/user.php?newuser=true&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>';
$userdata = "<font size=\"+1\">&nbsp;</font><a href=\"auth.php?sesskey=$USER->sesskey\">".get_string("authentication")."</a> - <font size=\"1\">".
get_string("adminhelpauthentication")."</font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"user.php\">".get_string("edituser")."</a> - <font size=\"1\">".
get_string("adminhelpedituser")."</font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&amp;sesskey=$USER->sesskey\">".
get_string("addnewuser")."</a> - <font size=\"1\">".
get_string("adminhelpaddnewuser")."</font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".
get_string("uploadusers")."</a> - <font size=\"1\">".
get_string("adminhelpuploadusers")."</font><br />";
$userdata .= '<hr /><div class="adminlink"><a href="enrol.php?sesskey='.$USER->sesskey.'">'.get_string('enrolments').
'</a> - <span class="explanation">'.get_string('adminhelpenrolments').'</span></div>';
$userdata .= '<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>';
$userdata .= "<hr /><font size=\"+1\">&nbsp;</font><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolments")."</a> - <font size=\"1\">".
get_string("adminhelpenrolments")."</font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"../course/index.php?edit=off&amp;sesskey=$USER->sesskey\">".get_string("assignstudents")."</a> - <font size=\"1\">".
get_string("adminhelpassignstudents")."</font><br />";
$userdata .= '<div class="adminlink"><a href="../course/index.php?edit=on&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>';
$userdata .= '<div class="adminlink"><a href="creators.php?sesskey='.$USER->sesskey.'">'.get_string('assigncreators').
'</a> - <span class="explanation">'.get_string('adminhelpassigncreators').'</span></div>';
$userdata .= '<div class="adminlink"><a href="admin.php?sesskey='.$USER->sesskey.'">'.get_string('assignadmins').
'</a> - <span class="explanation">'.get_string('adminhelpassignadmins').'</span></div>';
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"../course/index.php?edit=on&amp;sesskey=$USER->sesskey\">".get_string("assignteachers")."</a> - <font size=\"1\">".
get_string("adminhelpassignteachers").
" <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" /></font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a> - <font size=\"1\">".
get_string("adminhelpassigncreators")."</font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a> - <font size=\"1\">".
get_string("adminhelpassignadmins")."</font><br />";
$table->data[] = array('<strong><a href="users.php">'.get_string('users').'</a></strong>', $userdata);
$table->data[] = array("<font size=\"+1\"><b><a href=\"users.php\">".get_string("users")."</a></b></font>", $userdata);
$table->data[] = array('<strong><a href="../course/index.php?edit=on&amp;sesskey='.$USER->sesskey.'">'.get_string('courses').'</a></strong>',
'<div class="explanation">'.get_string('adminhelpcourses').'</div>');
$table->data[] = array('<strong><a href="../course/log.php?id='.$site->id.'">'.get_string('logs').'</a></strong>',
'<div class="explanation">'.get_string('adminhelplogs').'</div>');
$table->data[] = array('<strong><a href="../files/index.php?id='.$site->id.'">'.get_string('sitefiles').'</a></strong>',
'<div class="explanation">'.get_string('adminhelpsitefiles').'</div>');
$table->data[] = array('<strong><a href="stickyblocks.php">'.get_string('stickyblocks','admin').'</a></strong>',
'<div class="explanation">'.get_string('adminhelpstickyblocks').'</div>');
$table->data[] = array("<font size=\"+1\"><b><a href=\"../course/index.php?edit=on&amp;sesskey=$USER->sesskey\">".get_string("courses")."</a></b></font>",
"<font size=\"+1\">&nbsp;</font>".get_string("adminhelpcourses"));
$table->data[] = array("<font size=\"+1\"><b><a href=\"../course/log.php?id=$site->id\">".get_string("logs")."</a></b></font>",
"<font size=\"+1\">&nbsp;</font>".get_string("adminhelplogs"));
$table->data[] = array("<font size=\"+1\"><b><a href=\"../files/index.php?id=$site->id\">".get_string("sitefiles")."</a></b></font>",
"<font size=\"+1\">&nbsp;</font>".get_string("adminhelpsitefiles"));
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
$table->data[] = array("<strong><a href=\"$CFG->dbtype/frame.php\">".get_string('managedatabase').'</a></strong>',
get_string('adminhelpmanagedatabase'));
$table->data[] = array("<font size=+1><b><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></b></font>",
"<font size=+1>&nbsp;</font>".get_string("adminhelpmanagedatabase"));
}
if (!empty($CFG->enablestats)) {
$table->data[] = array('<strong><a href="reports.php">'.get_string('reports').'</a></strong>',
'<div class="explanation">'.get_string('adminhelpreports').'</div>');
}
$table->data[] = array('<strong><a href="environment.php">'.get_string('environment','admin').'</a></strong>',
'<div class="explanation">'.get_string('adminhelpenvironment').'</div>');
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="../doc/?frame=release.html">'.$CFG->release.'</a> ('.$CFG->version.')<br />'.
'Copyright &copy; 1999-2006 Martin Dougiamas<br />'.
'<a href="../doc/?frame=licence.html">GNU Public License</a>';
echo '<p class="copyright">'.$copyrighttext.'</p>';
$copyrighttext = "<a href=\"http://moodle.org/\">Moodle</a> ".
"<a href=\"../doc/?frame=release.html\">$CFG->release</a> ($CFG->version)<br />".
"Copyright &copy; 1999-2005 Martin Dougiamas<br />".
"<a href=\"../doc/?frame=licence.html\">GNU Public License</a>";
echo "<center><p><font size=\"1\">$copyrighttext</font></p></center>";
//////////////////////////////////////////////////////////////////////////////////////////////////
+13 -23
View File
@@ -2,8 +2,8 @@
require_once("../config.php");
$mode = optional_param('mode', '', PARAM_ALPHA);
$currentfile = optional_param('currentfile', 'moodle.php', PARAM_FILE);
optional_variable($mode, "");
optional_variable($currentfile, "moodle.php");
require_login();
@@ -54,15 +54,6 @@
'', '', true, $button);
if (!$mode) {
print_simple_box_start('center','80%');
echo '<table align="center" width="100%"><tr><td width="50%" align="center">';
print_string('managelang','admin');
echo '</td><td align="center" width="50%">';
print_string('editlang','admin');
echo '</td></tr><tr><td>';
print_string('lang16notify','admin');
echo '<p /><a href="langimport.php">'.get_string('langimport','admin').'</a>';
echo '</td><td>';
$currlang = current_language();
$langs = get_list_of_languages();
echo "<table align=\"center\"><tr><td align=\"right\">";
@@ -71,13 +62,11 @@
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
echo '</td></tr><tr><td colspan="2">';
$options["lang"] = $currentlang;
//print_single_button("http://moodle.org/download/lang/", $options, get_string("latestlanguagepack"));
print_single_button("http://moodle.org/download/lang/", $options, get_string("latestlanguagepack"));
echo "</td></tr></table>";
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
print_heading("<a href=\"lang.php?mode=compare\">$streditstrings</a>");
print_heading("<a href=\"langdoc.php\">$stredithelpdocs</a>");
echo '</td></tr></table>';
print_simple_box_end();
print_footer();
exit;
}
@@ -101,22 +90,23 @@
// For each file, check that a counterpart exists, then check all the strings
foreach ($stringfiles as $file) {
if (!file_exists("$langdir/$file")) {
if (!touch("$langdir/$file")) {
echo "<p><font color=\"red\">".get_string("filemissing", "", "$langdir/$file")."</font></p>";
continue;
}
}
unset($string);
include("$enlangdir/$file");
$enstring = $string;
unset($string);
if (file_exists("$langdir/$file")) {
include("$langdir/$file");
} else {
notify(get_string("filemissing", "", "$langdir/$file"));
$string = array();
}
include("$langdir/$file");
$first = true;
foreach ($enstring as $key => $value) {
if (empty($string[$key])) {
if (!isset($string[$key]) or $string[$key] == "") {
$value = htmlspecialchars($value);
$value = str_replace("$"."a", "\\$"."a", $value);
$value = str_replace("%%","%",$value);
-411
View File
@@ -1,411 +0,0 @@
<?php
///This file only manages the installation of 1.6 lang packs.
///in downloads.moodle.org, they are store in separate directory /lang16
///in local server, they are stored in $CFG->dataroot/lang
///This helps to avoid confusion.
define('INSTALLATION_OF_SELECTED_LANG', 2);
define('CHANGE_SITE_LANG', 3);
define('DELETION_OF_SELECTED_LANG', 4);
define('UPDATE_ALL_LANG', 5);
include('../config.php');
$mode = optional_param('mode',0,PARAM_INT); //phase
$pack = optional_param('pack','',PARAM_NOTAGS); //pack to install
$displaylang = $pack;
$uninstalllang = optional_param('uninstalllang','',PARAM_NOTAGS);
require_login();
if (!isadmin()) {
error('You must be an admin');
}
if (!$site = get_site()) {
error("Site not defined!");
}
$strlang = get_string('langimport','admin');
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strlanguage = get_string("language");
$strthislanguage = get_string("thislanguage");
$title = $strlang;
print_header("$site->shortname: $title", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> ".
"<a href=\"lang.php\">$strlanguage</a> -> $strlang",
'', '', true, '');
print_heading('');
switch ($mode){
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
if (confirm_sesskey()) {
if (optional_param('confirm')) {
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
@mkdir ($CFG->dataroot.'/lang/');
$source = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$langpack = $CFG->dataroot.'/temp/'.$pack.'.zip';
$destination = $CFG->dataroot.'/lang/';
if ($contents = file_get_contents($source)) { // Grab whole page
if ($file = fopen($langpack, 'w')) { // Make local copy
if (!fwrite($file, $contents)) { //copy zip to temp folder..
error ('could not copy file');
}
fclose($file);
///recursively remove the whole directory since unzip does not overwrites anything
if (file_exists($destination.$pack)) {
@remove_dir($destination.$pack.'/');
}
//unpack the zip
if (unzip_file($langpack, $destination, false)) {
print_heading(get_string('langimportsuccess','admin'));
} else {
error('language installation failed');
}
//now, we update the md5key of the lang pack, this is used to check version
$md5file = $CFG->dataroot.'/lang/'.$pack.'/'.$pack.'.md5';
if ($file = fopen($md5file, 'w')) {
fwrite($file, md5($contents)); //manually generate md5 from zip
}
fclose($file);
@unlink ($langpack); //bye bye zip file, come back when you get a little better
echo '<div align="center"><form action="langimport.php" method="POST">';
echo '<input type="submit" value="'.get_string('ok').'" />';
echo '</form></div>';
}
}
} else { //print confirm box, no confirmation yet
if (confirm_sesskey()) {
print_simple_box_start('center','100%');
echo '<div align="center">';
echo '<form name="langform" action="langimport.php?mode=2" method="POST">';
echo '<input name="pack" type="hidden" value="'.$pack.'" />';
echo '<input name="displaylang" type="hidden" value="'.$displaylang.'" />';
echo '<input name="confirm" type="hidden" value="1" />';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
print_heading(get_string('confirminstall','admin',$displaylang),2);
echo '<input type="submit" value="'.get_string('ok').'"/>';
echo '&nbsp;<input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
echo '</form>';
echo '</div>';
print_simple_box_end();
}
}
}
break;
case CHANGE_SITE_LANG: //change site language
if (confirm_sesskey) {
$langconfig = get_record('config','name','lang');
$sitelang = required_param('sitelangconfig',PARAM_NOTAGS);
$langconfig->value = $sitelang;
if (update_record('config',$langconfig)){
echo '<div align="center">';
notify (get_string('sitelangchanged','admin'));
echo '<form action="langimport.php" method="POST">';
echo '<input type="submit" value="'.get_string('ok').'" />';
echo '</form></div>';
} else {
error ('can not update site language');
}
}
break;
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
if (!optional_param('confirm') && confirm_sesskey()) {
print_simple_box_start('center','100%');
echo '<div align="center">';
echo '<form name="langform" action="langimport.php?mode=4" method="POST">';
echo '<input name="uninstalllang" type="hidden" value="'.$uninstalllang.'" />';
echo '<input name="confirm" type="hidden" value="1" />';
print_heading(get_string('uninstallconfirm','admin',$uninstalllang),2);
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
echo '<input type="submit" value="'.get_string('uninstall','admin').'"/>';
echo '&nbsp;<input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
echo '</form>';
echo '</div>';
print_simple_box_end();
}
else if (confirm_sesskey()) {
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)){
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)){
$rm2 = remove_dir($dest2);
}
//delete the direcotries
if ($rm1 or $rm2) {
echo '<div align="center">';
print_string('langpackremoved','admin');
echo '<form action="langimport.php" method="POST">';
echo '<input type="submit" value="'.get_string('ok').'" />';
echo '</form></div>';
} else { //nothing deleted, possibly due to permission error
error ('An error has occurred, language pack is not completely uninstalled, please check file permission');
}
}
break;
case UPDATE_ALL_LANG: //1 click update for all updatable language packs
//0th pull a list from download.moodle.org,
//key = langname, value = md5
$source = 'http://download.moodle.org/lang16/languages.md5';
$md5array = array();
$update = 0; //any packs updated?
$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 ($fp = fopen($source, 'r')) { /// attempt to get the list from Moodle.org.
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
} else {
error('can not fopen!');
}
//and build an associative array
foreach ($availablelangs as $alang) {
$md5array[$alang[0]] = $alang[1];
}
//first build a list of all the language packs,
//filtering out non-16 packs
foreach ($alllangs as $clang) {
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$dest2 = $CFG->dirroot.'/lang/'.$clang;
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')){
$lang16[] = $clang;
}
}
//then filter out packs that have the same md5 key
foreach ($lang16 as $clang) {
if (!is_installed_lang($clang, $md5array[$clang])){
$packs[] = $clang;
}
}
@mkdir ($CFG->dataroot.'/temp/');
@mkdir ($CFG->dataroot.'/lang/');
foreach ($packs as $pack){ //for each of the remaining in the list, we
//1. delete old director(ies)
$dest1 = $CFG->dataroot.'/lang/'.$pack;
$dest2 = $CFG->dirroot.'/lang/'.$pack;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)) {
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)) {
$rm2 = remove_dir($dest2);
}
if (!($rm1 || $rm2)) {
error ('could not delete old directory, update failed');
}
//2. copy & unzip into new
$source = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$langpack = $CFG->dataroot.'/temp/'.$pack.'.zip';
$destination = $CFG->dataroot.'/lang/';
if ($contents = file_get_contents($source)) { // Grab whole page
if ($file = fopen($langpack, 'w')) { // Make local copy
if (!fwrite($file, $contents)) { //copy zip to temp folder..
error ('could not copy file');
}
fclose($file);
//unpack the zip
if (!unzip_file($langpack, $destination, false)) {
error('language installation failed - can not unzip language pack');
}
//now, we update the md5key of the lang pack, this is used to check version
$md5file = $CFG->dataroot.'/lang/'.$pack.'/'.$pack.'.md5';
if ($file = fopen($md5file, 'w')) {
fwrite($file, md5($contents));
}
fclose($file);
@unlink ($langpack); //remove the zip file
echo '<div align="center">';
notify(print_string('langpackupdated','admin',$pack));
$updated = 1;
echo '</div>';
}
}
}
echo '<div align="center"><form action="langimport.php" method="POST">';
if ($updated) {
notify(print_string('langupdatecomplete','admin'));
} else {
notify(print_string('nolangupdateneeded','admin'));
}
echo '<input type="submit" value="'.get_string('ok').'" />';
echo '</form></div>';
break;
default: //display choice mode
$source = 'http://download.moodle.org/lang16/languages.md5';
$remote = 0; //flag for reading from remote or local
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().'" />';
$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 ($remote){
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$alang[0].')</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');
echo '</td></tr>';
}
echo '</td><tr></table>'; //close available langs table
echo '<form>';
echo '</td></tr></table>';
print_simple_box_end();
break;
} //close of main switch
print_footer();
/* returns a list of available language packs from a
* local copy shipped with standard moodle distro
* this is for site that can't perform fopen
* @return array
*/
function get_local_list_of_languages() {
global $CFG;
$source = $CFG->wwwroot.'/lib/languages.md5';
$availablelangs = array();
if ($fp = fopen($source, 'r')){
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
}
return $availablelangs;
}
/* checks the md5 of the zip file, grabbed from download.moodle.org,
* against the md5 of the local language file from last update
* @param string $lang
* @param string $md5check
* @return bool
*/
function is_installed_lang($lang, $md5check) {
global $CFG;
$md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
if (file_exists($md5file)){
return (file_get_contents($md5file) == $md5check);
}
return false;
}
?>
+3 -1
View File
@@ -37,6 +37,8 @@
$moduleprefix = '';
}
print_header();
foreach ($config as $name => $value) {
set_config($moduleprefix.$name, $value);
}
@@ -46,7 +48,7 @@
/// Otherwise print the form.
$module = optional_param('module', '', PARAM_CLEANFILE);
$module = required_param('module', '', PARAM_CLEANFILE);
require_once("$CFG->dirroot/mod/$module/lib.php");
$stradmin = get_string("administration");
+4 -4
View File
@@ -4,10 +4,10 @@
require_once("../config.php");
require_once("../course/lib.php");
$disable = optional_param('disable');
$enable = optional_param('enable');
$delete = optional_param('delete');
$confirm = optional_param('confirm');
optional_variable($disable);
optional_variable($enable);
optional_variable($delete);
optional_variable($confirm);
require_login();
+2 -15
View File
@@ -29,20 +29,7 @@ function online_assignment_cleanup($output=false) {
echo '<center>';
}
/// We don't want to run this code if we are doing an upgrade from an assignment
/// version earlier than 2005041400
/// because the assignment type field will not exist
$amv = get_field('modules', 'version', 'name', 'assignment');
if ((int)$amv < 2005041400) {
if ($output) {
echo '</center>';
}
return;
}
/// get the module id for assignments from db
// get the module id for assignments from db
$arecord = get_record('modules', 'name', 'assignment');
$aid = $arecord->id;
@@ -57,7 +44,7 @@ function online_assignment_cleanup($output=false) {
if ($output) print_heading($fullname);
/// retrieve a list of sections beyond what is currently being shown
$sql = 'SELECT * FROM '.$CFG->prefix.'course_sections WHERE course='.$course->id.' AND section>'.$course->numsections.' ORDER BY section ASC';
$sql = 'SELECT * FROM '.$CFG->prefix.'course_sections WHERE `course`='.$course->id.' AND `section`>'.$course->numsections.' ORDER BY `section` ASC';
if (!($xsections = get_records_sql($sql))) {
if ($output) echo 'No extra sections<br />';
continue;
+15 -20
View File
@@ -3,37 +3,32 @@
require_once("../config.php");
$topframe = optional_param('topframe', false, PARAM_BOOL);
$bottomframe = optional_param('bottomframe', false, PARAM_BOOL);
require_login();
if (!isadmin()) {
error("Only the admin can use this page");
}
if (!$topframe && !$bottomframe) {
?>
<head>
<title>PHP info</title>
</head>
<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>
<?php
} else if ($topframe && confirm_sesskey()) {
if (isset($topframe)) {
$stradministration = get_string("administration");
$site = get_site();
print_header("$site->shortname: phpinfo", "$site->fullname",
print_header("$site->shortname: phpinfo", "$site->fullname",
"<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> PHP info");
exit;
} else if ($bottomframe && confirm_sesskey()) {
}
if (isset($bottomframe)) {
phpinfo();
exit;
}
?>
<head>
<title>PHP info</title>
</head>
<frameset rows="80,*">
<frame src="phpinfo.php?topframe=true">
<frame src="phpinfo.php?bottomframe=true">
</frameset>
-117
View File
@@ -1,117 +0,0 @@
<?php
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
$report = optional_param('report',STATS_REPORT_ACTIVE_COURSES,PARAM_INT);
$time = optional_param('time',0,PARAM_INT);
$numcourses = optional_param('numcourses',20,PARAM_INT);
if (empty($CFG->enablestats)) {
error("Stats is not enabled.");
}
require_login();
if (!isadmin()) {
error("This page is for admins only");
}
$course = get_site();
stats_check_uptodate($course->id);
$strheader = get_string('reports');
$strnav = '<a href="'.$CFG->wwwroot.'/admin/index.php">'.get_string('administration').'</a> -> '.$strheader;
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
$tableprefix = $CFG->prefix.'stats_';
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
$now = stats_get_base_daily();
$lastweekend = stats_get_base_weekly();
$lastmonthend = stats_get_base_monthly();
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
if (empty($timeoptions)) {
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
print_header($strheader,$strheader,$strnav,'','',true,'&nbsp');
echo '<form action="reports.php" method="post">'."\n";
$table->width = '*';
$table->align = array('left','left','left','left','left','left');
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
'<input type="submit" value="'.get_string('view').'" />') ;
print_table($table);
echo '</form>';
if (!empty($report) && !empty($time)) {
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= ".$param->timeafter
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby
." LIMIT ".$numcourses;
$courses = get_records_sql($sql);
if (empty($courses)) {
error(get_string('statsnodata'),$CFG->wwwroot.'/admin/reports.php');
}
echo '<center><img src="'.$CFG->wwwroot.'/admin/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[] = print_numeric_value($c->line1);
if (isset($c->line2)) {
$a[] = print_numeric_value($c->line2);
}
if (isset($c->line3)) {
$a[] = print_numeric_value($c->line3);
}
$table->data[] = $a;
}
print_table($table);
}
print_footer();
function print_numeric_value($value) {
list($whole, $decimals) = split ('[.,]', $value, 2);
if (intval($decimals) > 0)
return number_format($value,2,".",",");
else
return $value;
}
?>
-56
View File
@@ -1,56 +0,0 @@
<?php
{
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->dirroot.'/lib/graphlib.php');
$report = required_param('report',0,PARAM_INT);
$time = required_param('time',0,PARAM_INT);
$numcourses = required_param('numcourses',20,PARAM_INT);
require_login();
if (!isadmin()) {
error("You must be an admin to use this page");
}
stats_check_uptodate($course->id);
$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
$sql = "SELECT courseid,".$param->fields." FROM ".$CFG->prefix.'stats_'.$param->table
." WHERE timeend >= ".$param->timeafter
." GROUP BY courseid "
.$param->extras
." ORDER BY ".$param->orderby
." LIMIT ".$numcourses;
$courses = get_records_sql($sql);
if (empty($courses)) {
error(get_string('statsnodata'),$CFG->wwwroot.'/admin/reports.php');
}
$graph = new graph(750,400);
$graph->parameter['legend'] = 'outside-right';
$graph->parameter['legend_size'] = 10;
$graph->parameter['x_axis_angle'] = 90;
$graph->parameter['title'] = false; // moodle will do a nicer job.
if ($report != STATS_REPORT_ACTIVE_COURSES) {
$graph->parameter['y_decimal_left'] = 2;
}
foreach ($courses as $c) {
$graph->x_data[] = get_field('course','shortname','id',$c->courseid);
$graph->y_data['bar1'][] = $c->{$param->graphline};
}
$graph->y_order = array('bar1');
$graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
$graph->draw_stack();
}
?>
+5 -20
View File
@@ -29,34 +29,19 @@
</tr>
<tr valign="top">
<td align="right"><?php print_string("frontpageformat") ?>:</td>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<td>
<?php
<td><?php
$options = array(FRONTPAGENEWS => get_string("frontpagenews"),
FRONTPAGECOURSELIST => get_string("frontpagecourselist"),
FRONTPAGECATEGORYNAMES => get_string("frontpagecategorynames"),
);
$values = array(get_string('hide'), 1, 2);
$seq = array_flip(explode(',',$form->frontpage));
foreach ($seq as $k => $s) {
$seq[$k]++;
}
FRONTPAGETOPICONLY => get_string("frontpagetopiconly"));
if (count_records("course") > 200) {
unset($options[FRONTPAGECOURSELIST]);
if (isset($seq[FRONTPAGECOURSELIST])) {
unset($options[1]);
if ($form->frontpage == 1) {
$form->frontpage = 2;
}
} else {
$values[] = 3;
}
foreach ($options as $key => $option) {
echo "<td>$option<br />";
choose_from_menu ($values, "frontpage[$key]", isset($seq[$key])?$seq[$key]:0, "");
}
choose_from_menu ($options, "frontpage", "$form->frontpage", "");
?>
</tr>
</table>
</td>
</tr>
<tr valign="top">
+6 -7
View File
@@ -25,13 +25,8 @@
if (count($err) == 0) {
$form->frontpage = array_flip($form->frontpage);
unset($form->frontpage[0]);
$form->frontpage = array_flip($form->frontpage);
asort($form->frontpage);
$form->frontpage = implode(',',array_flip($form->frontpage));
set_config("frontpage", $form->frontpage);
if (!$form->frontpage) {
if ($form->frontpage == FRONTPAGETOPICONLY) {
$form->numsections = 1; // Force the topic display for this format
}
@@ -98,7 +93,11 @@
$form->frontpage = $CFG->frontpage;
} else {
$form->frontpage = FRONTPAGECOURSELIST; // Show course list by default
if ($form->newsitems > 0) {
$form->frontpage = 0;
} else {
$form->frontpage = 1;
}
set_config("frontpage", $form->frontpage);
}
-90
View File
@@ -1,90 +0,0 @@
<?
{
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->dirroot.'/my/pagelib.php');
require_once($CFG->dirroot.'/lib/pagelib.php');
require_once($CFG->dirroot.'/lib/blocklib.php');
$pt = optional_param('pt',null,PARAM_CLEAN);
$pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
'lib' => '/my/pagelib.php',
'name' => get_string('stickyblocksmymoodle','admin')),
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
'lib' => '/lib/pagelib.php',
'name' => get_string('stickyblockscourseview','admin'))
// ... more?
);
// for choose_from_menu
$options = array();
foreach ($pagetypes as $p) {
$options[$p['id']] = $p['name'];
}
require_login();
if (!isadmin()) {
error("Only the admin can use this page");
}
// first thing to do is print the dropdown menu
$strtitle = get_string('stickyblocks','admin');
$strheading = get_string('adminhelpstickyblocks');
print_header($strtitle,$strtitle,'<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/index.php">'.
get_string('admin').'</a> -> '.$strtitle);
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
echo '<tr valign="top">';
if (!empty($pt)) {
require_once($CFG->dirroot.$pagetypes[$pt]['lib']);
define('ADMIN_STICKYBLOCKS',$pt);
$PAGE = page_create_object($pt);
$blocks = blocks_setup($PAGE,BLOCKS_PINNED_TRUE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($blocks[BLOCK_POS_LEFT]), 210);
echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
blocks_print_group($PAGE, $blocks, BLOCK_POS_LEFT);
} else {
echo '<td style="vertical-align: top;" id="left-column">';
}
echo '</td>';
echo '<td valign="top" width="*" id="middle-column">';
print_simple_box_start('center');
print_heading($strheading);
echo '<form method="post" action="'.$CFG->wwwroot.'/admin/stickyblocks.php">'
.'<p align="center">'.get_string('stickyblockspagetype','admin').': ';
choose_from_menu($options,'pt',$pt,'choose','this.form.submit();');
echo '</p></form>';
echo get_string('stickyblocksduplicatenotice','admin');
print_simple_box_end();
echo '</td>';
if (!empty($pt)) {
echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
}
echo '<td style="vertical-align: top;" id="left-column">';
echo '</td>';
echo '</tr></table>';
print_footer();
}
?>
+2 -2
View File
@@ -3,7 +3,7 @@
require("../config.php");
require("$CFG->dirroot/mod/forum/lib.php");
$confirm = optional_param('confirm');
optional_variable($confirm);
require_login();
@@ -28,7 +28,7 @@
print_header("$site->shortname: $stradministration: $strupgradingdata", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> $strupgradingdata");
if (empty($confirm)) {
if (empty($_GET['confirm'])) {
notice_yesno(get_string("upgradeforumreadinfo", "admin"),
"upgradeforumread.php?confirm=true&sesskey=$USER->sesskey",
"index.php");
+2 -2
View File
@@ -2,7 +2,7 @@
require("../config.php");
$confirm = optional_param('confirm');
optional_variable($confirm);
require_login();
@@ -31,7 +31,7 @@
print_header("$site->shortname: $stradministration: $strupgradinglogs", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> $strupgradinglogs");
if (empty($confirm)) {
if (empty($_GET['confirm'])) {
notice_yesno(get_string("upgradelogsinfo", "admin"),
"upgradelogs.php?confirm=true&sesskey=$USER->sesskey",
"index.php");
+19 -131
View File
@@ -5,7 +5,7 @@
require_once("../config.php");
$numusers = optional_param('numusers', 0, PARAM_INT);
optional_variable($numusers, 0);
require_login();
@@ -31,7 +31,6 @@
$struser = get_string("user");
$strusers = get_string("users");
$strusersnew = get_string("usersnew");
$strusersupdated = get_string("usersupdated");
$struploadusers = get_string("uploadusers");
$straddnewuser = get_string("importuser");
@@ -63,15 +62,6 @@
if ($um->preprocess_files()) {
$filename = $um->files['userfile']['tmp_name'];
// Large files are likely to take their time and memory. Let PHP know
// that we'll take longer, and that the process should be recycled soon
// to free up memory.
@set_time_limit(0);
@raise_memory_limit("128M");
if (function_exists('apache_child_terminate')) {
@apache_child_terminate();
}
//Fix mac/dos newlines
$text = my_file_get_contents($filename);
$text = preg_replace('!\r\n?!',"\n",$text);
@@ -118,20 +108,6 @@
"group4" => 1,
"group5" =>1);
// form data cleanup
$frmpassword = optional_param('frmpassword', '', PARAM_ALPHA);
$updateaccounts = optional_param('updateaccounts', false, PARAM_BOOL);
$allowrenames = optional_param('allowrenames', false, PARAM_BOOL);
if ($frmpassword === 'create') {
unset($required['password']);
$optional['password'] = 1;
}
if ($allowrenames) {
$optional['oldusername'] = 1;
}
// --- get header (field names) ---
$header = split($csv_delimiter, fgets($fp,1024));
// check for valid field names
@@ -152,16 +128,6 @@
}
$linenum = 2; // since header is line 1
$usersnew = 0;
$usersupdated = 0;
$userserrors = 0;
$renames = 0;
$renameerrors = 0;
// Will use this course array a lot
// so fetch it early and keep it in memory
$courses = get_courses("all",'c.sortorder','c.id,c.shortname,c.fullname,c.sortorder');
while (!feof ($fp)) {
foreach ($optionalDefaults as $key => $value) {
$user->$key = addslashes($adminuser->$key);
@@ -175,7 +141,7 @@
}
if ($record[$header[0]]) {
// add a new user to the database
$newuser = optional_param('newuser', "", PARAM_CLEAN);
optional_variable($newuser, "");
// add fields to object $user
foreach ($record as $name => $value) {
@@ -187,7 +153,7 @@
'uploaduser.php?sesskey='.$USER->sesskey);
}
// password needs to be encrypted
else if ($name == "password" && !empty($value)) {
else if ($name == "password") {
$user->password = md5($value);
}
else if ($name == "username") {
@@ -212,7 +178,7 @@
$addgroup[2] = $user->group3;
$addgroup[3] = $user->group4;
$addgroup[4] = $user->group5;
$courses = get_courses("all",'c.sortorder','c.id,c.shortname,c.fullname,c.sortorder');
for ($i=0; $i<5; $i++) {
$courseid[$i]=0;
}
@@ -223,73 +189,20 @@
}
}
}
if ($user->username === 'changeme') {
notify(get_string('invaliduserchangeme', 'admin'));
$userserrors++;
continue;
}
// before insert/update, check whether we should be updating
// an old record instead
if ($allowrenames && !empty($user->oldusername) ) {
$user->oldusername = moodle_strtolower($user->oldusername);
if ($olduser = get_record('user','username',$user->oldusername)) {
if (set_field('user', 'username', $user->username, 'username', $user->oldusername)) {
notify(get_string('userrenamed', 'admin') . " : $user->oldusername $user->username");
$renames++;
} else {
notify(get_string('usernotrenamedexists', 'error') . " : $user->oldusername $user->username");
$renameerrors++;
continue;
}
} else {
notify(get_string('usernotrenamedmissing', 'error') . " : $user->oldusername $user->username");
$renameerrors++;
continue;
}
}
if ($olduser = get_record("user","username",$username)) {
if ($updateaccounts) {
// Record is being updated
$user->id = $olduser->id;
if (update_record('user', $user)) {
notify("$user->id , $user->username ".get_string('useraccountupdated', 'admin'));
$usersupdated++;
} else {
notify(get_string('usernotupdatederror', 'error', $username));
$userserrors++;
continue;
}
} else {
//Record not added - user is already registered
if (get_record("user","username",$username) || !($user->id = insert_record("user", $user))) {
if (!$user = get_record("user", "username", "changeme")) { // half finished user from another time
//Record not added - probably because user is already registered
//In this case, output userid from previous registration
//This can be used to obtain a list of userids for existing users
notify("$user->id ".get_string('usernotaddedregistered', 'error', $username));
$userserrors++;
continue;
}
} else { // new user
if ($user->id = insert_record("user", $user)) {
notify("$struser: $user->id = $user->username");
$usersnew++;
if (empty($user->password) && $frmpassword === 'create') {
// passwords will be created and sent out on cron
insert_record('user_preferences', array( userid => $user->id,
name => 'create_password',
value => 1));
insert_record('user_preferences', array( userid => $user->id,
name => 'auth_forcepasswordchange',
value => 1));
}
} else {
// Record not added -- possibly some other error
notify(get_string('usernotaddederror', 'error', $username));
$userserrors++;
continue;
if ($user = get_record("user","username",$username)) {
notify("$user->id ".get_string('usernotaddedregistered', 'error', $username));
} else {
notify(get_string('usernotaddederror', 'error', $username));
}
}
} else if ($user->username != "changeme") {
notify("$struser: $user->id = $user->username");
$numusers++;
}
for ($i=0; $i<5; $i++) {
if ($addcourse[$i] && !$courseid[$i]) {
@@ -345,47 +258,22 @@
}
}
fclose($fp);
notify("$strusersnew: $usersnew");
notify(get_string('usersupdated', 'admin') . ": $usersupdated");
notify(get_string('errors', 'admin') . ": $userserrors");
if ($allowrenames) {
notify(get_string('usersrenamed', 'admin') . ": $renames");
notify(get_string('renameerrors', 'admin') . ": $renameerrors");
}
notify("$strusersnew: $numusers");
echo '<hr />';
}
/// Print the form
print_heading_with_help($struploadusers, 'uploadusers');
$noyesoptions = array( get_string('no'), get_string('yes') );
$maxuploadsize = get_max_upload_file_size();
echo '<center>';
echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php">'.
$strchoose.':<input type="hidden" name="MAX_FILE_SIZE" value="'.$maxuploadsize.'">'.
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">'.
'<input type="file" name="userfile" size="30">'.
'<input type="submit" value="'.$struploadusers.'">';
print_heading(get_string('settings'));
echo '<table>';
echo '<tr><td>' . get_string('passwordhandling', 'auth') . "</td><td>";
$passwordopts = array( infile => get_string('infilefield', 'auth'),
create => get_string('createpassword', 'auth'),
);
choose_from_menu($passwordopts, 'frmpassword', 'infile');
echo "</td></tr>";
echo '<tr><td>' . get_string('updateaccounts', 'admin') . "</td><td>";
choose_from_menu($noyesoptions, 'updateaccounts', 0);
echo "</td></tr>";
echo '<tr><td>' . get_string('allowrenames', 'admin') . "</td><td>";
choose_from_menu($noyesoptions, 'allowrenames', 0);
echo "</td></tr>";
echo '</table>';
echo '</form></br>';
'<input type="submit" value="'.$struploadusers.'">'.
'</form></br>';
echo '</center>';
print_footer($course);
+22 -22
View File
@@ -2,20 +2,20 @@
require_once("../config.php");
$newuser = optional_param('newuser', "");
$delete = optional_param('delete', "");
$confirm = optional_param('confirm', "");
$confirmuser = optional_param('confirmuser', "");
$sort = optional_param('sort', "name", PARAM_ALPHA);
$dir = optional_param('dir', "ASC");
$page = optional_param('page', 0);
$search = optional_param('search', "");
optional_variable($newuser, "");
optional_variable($delete, "");
optional_variable($confirm, "");
optional_variable($confirmuser, "");
optional_variable($sort, "name");
optional_variable($dir, "ASC");
optional_variable($page, 0);
optional_variable($search, "");
if (!empty($search)) {
$search=trim($search);
}
$lastinitial = optional_param('lastinitial', ""); // only show students with this last initial
$firstinitial = optional_param('firstinitial', ""); // only show students with this first initial
$perpage = optional_param('perpage', 30, PARAM_INT); // how many per page
optional_variable($lastinitial, ""); // only show students with this last initial
optional_variable($firstinitial, ""); // only show students with this first initial
optional_variable($perpage, "30"); // how many per page
unset($user);
unset($admin);
@@ -226,7 +226,7 @@
echo "<center><p align=\"center\">";
echo get_string("firstname")." : ";
if ($firstinitial) {
echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&amp;".
echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&".
"perpage=$perpage&amp;lastinitial=$lastinitial\">$strall</a> ";
} else {
echo " <b>$strall</b> ";
@@ -235,7 +235,7 @@
if ($letter == $firstinitial) {
echo " <b>$letter</b> ";
} else {
echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&amp;".
echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&".
"perpage=$perpage&amp;lastinitial=$lastinitial&amp;firstinitial=$letter\">$letter</a> ";
}
}
@@ -245,7 +245,7 @@
echo get_string("lastname")." : ";
if ($lastinitial) {
echo " <a href=\"user.php?sort=lastname&amp;dir=ASC&amp;".
echo " <a href=\"user.php?sort=lastname&amp;dir=ASC&".
"perpage=$perpage&amp;firstinitial=$firstinitial\">$strall</a> ";
} else {
echo " <b>$strall</b> ";
@@ -254,7 +254,7 @@
if ($letter == $lastinitial) {
echo " <b>$letter</b> ";
} else {
echo " <a href=\"user.php?sort=lastname&amp;dir=ASC&amp;".
echo " <a href=\"user.php?sort=lastname&amp;dir=ASC&".
"perpage=$perpage&amp;firstinitial=$firstinitial&amp;lastinitial=$letter\">$letter</a> ";
}
}
@@ -310,7 +310,7 @@
if ($user->id == $USER->id or $user->username == "changeme") {
$deletebutton = "";
} else {
$deletebutton = "<a href=\"user.php?delete=$user->id&amp;sesskey=$USER->sesskey\">$strdelete</a>";
$deletebutton = "<a href=\"user.php?delete=$user->id&sesskey=$USER->sesskey\">$strdelete</a>";
}
if ($user->lastaccess) {
$strlastaccess = format_time(time() - $user->lastaccess);
@@ -318,7 +318,7 @@
$strlastaccess = get_string("never");
}
if ($user->confirmed == 0) {
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&amp;sesskey=$USER->sesskey\">" . get_string("confirm") . "</a>";
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&sesskey=$USER->sesskey\">" . get_string("confirm") . "</a>";
} else {
$confirmbutton = "";
}
@@ -336,21 +336,21 @@
echo "<table class=\"searchbox\" align=\"center\" cellpadding=\"10\"><tr><td>";
echo "<form action=\"user.php\" method=\"get\">";
echo "<input type=\"text\" name=\"search\" value=\"$search\" size=\"20\" />";
echo "<input type=\"submit\" value=\"$strsearch\" />";
echo "<input type=\"text\" name=\"search\" value=\"$search\" size=\"20\">";
echo "<input type=\"submit\" value=\"$strsearch\">";
if ($search) {
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\">";
}
echo "</form>";
echo "</td></tr></table>";
print_heading("<a href=\"user.php?newuser=true&amp;sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
if (!empty($table)) {
print_table($table);
print_paging_bar($usercount, $page, $perpage,
"user.php?sort=$sort&amp;dir=$dir&amp;perpage=$perpage".
"&amp;firstinitial=$firstinitial&amp;lastinitial=$lastinitial&amp;search=$search&amp;");
print_heading("<a href=\"user.php?newuser=true&amp;sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
}
-435
View File
@@ -1,435 +0,0 @@
<?
function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
//pointing to the num of records to process would be
//useful. And it won't break anything, because the
//crash system will continue the next time it was
//executed. Also, the function could return:
//0 = Some sort of error
//1 = Finished completelly!
//2 = Finished limit records
//(using constants, of course ;-))
//Then, all those errors, should be converted to
//mtrace() and return 0. (showing the current
//table/field/recordid)
global $db, $CFG;
$ignoretables = array(); //list of tables to ignore
$ignoretables[] = $CFG->prefix.'log';
$ignoretables[] = $CFG->prefix.'cache_text';
$ignoretables[] = $CFG->prefix.'cache_filters';
$textlib = textlib_get_instance(); //Eloy: I haven't measured this but perhaps
//Eloy: This lines should be uncomented in final release, isn't it? To
//avoid double processing completely.
//if unicodedb is set, migration is complete. die here;
/* if ($CFG->unicodedb) {
error ('unicode db migration has already been performed!');
}
*/
if (!$crash = get_record('config','name','dbmigration')) {
$migrationconfig = new object;
$migrationconfig->name = 'dbmigration';
$migrationconfig->value = '-1';
insert_record('config',$migrationconfig); //process initiated
} else {
$crashdata = explode('##',$crash->value);
$crash->table = $crashdata[0];
$crash->field = $crashdata[1];
$crash->record = $crashdata[2];
print_heading('Resume information :');
echo '<br>Resuming from @ table : '.$crash->table;
echo '<br>Resuming from @ field : '.$crash->field;
echo '<br>Resuming from @ record : '.$crash->record;
}
require_once($CFG->dirroot.'/lib/xmlize.php');
//one gigantic array to hold all db table information read from all the migrate2utf8.xml file.
$xmls = array();
/*****************************************************************************
* traverse order is mod->backup->block->block_plugin->enroll_plugin->global *
*****************************************************************************/
///mod
if (!$mods = get_list_of_plugins('mod')) {
error('No modules installed!');
}
foreach ($mods as $mod){
if (file_exists($CFG->dirroot.'/mod/'.$mod.'/db/migrate2utf8.xml')) {
$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/mod/'.$mod.'/db/migrate2utf8.xml'));
}
}
///Backups
//$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/backup/db/migrate2utf8.xml'));
///Blocks
//$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/blocks/db/migrate2utf8.xml'));
///Block Plugins
if (!$blocks = get_list_of_plugins('blocks')) {
//error('No blocks installed!'); //Eloy: Is this a cause to stop?
}
foreach ($blocks as $block){
if (file_exists($CFG->dirroot.'/blocks/'.$block.'/db/migrate2utf8.xml')) {
//$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/blocks/'.$block.'/db/migrate2utf8.xml'));
}
}
///Enrol
if (!$enrols = get_list_of_plugins('enrol')) {
//error('No blocks installed!'); //Eloy: enrol, not blocks :-) Is this a cause to stop?
}
foreach ($enrols as $enrol){
if (file_exists($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml')) {
//$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml'));
}
}
///Lastly, globals
//$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/lib/db/migrate2utf8.xml'));
/************************************************************************
* Now we got all our tables in order *
************************************************************************/
foreach ($xmls as $xml) { ///foreach xml file, we must get a list of tables
$dir = $xml['DBMIGRATION']['@']['type'];
$dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE']; //real db tables
foreach ($dbtables as $dbtable) {
$dbtablename = $dbtable['@']['name'];
if ($crash && ($dbtablename != $crash->table)) { //resuming from crash
continue;
}
print_heading("<br><b>Processsing db table ".$dbtablename.'...</b>');
if (!empty($dbtable['#']) && ($fields = $dbtable['#']['FIELDS'][0]['#']['FIELD']) and (!in_array($dbtablename, $ignoretables))) {
$colnames = array();
$coltypes = array(); //array to hold all column types for the table
$collengths = array(); //array to hold all column lengths for the table
$defaults = array(); //array to hold defaults, if any
//reset holders
$addindexarray = array();
$adduniqueindexarray = array();
$addprimaryarray = array();
foreach ($fields as $field){
//if in crash state, and field name is not the same as crash field name
$fieldname = $field['@']['name'];
$method = $field['@']['method'];
$type = $field['@']['type'];
$length = $field['@']['length'];
if ($crash && ($crash->field != $fieldname)) {
continue;
}
$dropindex = $field['@']['dropindex'];
$addindex = $field['@']['addindex'];
$adduniqueindex = $field['@']['adduniqueindex'];
$dropprimary = $field['@']['dropprimary'];
$addprimary = $field['@']['addprimary'];
$defaults[] = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
$colnames[] = $fieldname;
$coltypes[] = $type;
$collengths[]= $length;
echo "<br>--><b>processsing db field ".$fieldname.'</b>';
echo "<br>---><b>method ".$method.'</b>';
$patterns[]='/RECORDID/i'; //for preg_replace
$patterns[]='/\{\$CFG\-\>prefix\}/i'; //same here
if ($method == 'PLAIN_SQL_UPDATE') {
$sqldetectuser = $field['#']['SQL_DETECT_USER'][0]['#'];
$sqldetectcourse = $field['#']['SQL_DETECT_COURSE'][0]['#'];
}
else if ($method == 'PHP_FUNCTION') {
$phpfunction = 'migrate2utf8_'.$dbtablename.'_'.$fieldname;
}
///get the total number of records for this field
$totalrecords = count_records($dbtablename);
$counter = 0;
$recordsetsize = 4;
if ($crash) { //if resuming from crash
//find the number of records with id smaller than the crash id
$indexSQL = 'SELECT COUNT(*) FROM '.$CFG->prefix.$dbtablename.' WHERE id < '.$crash->record;
$counter = count_records_sql($indexSQL);
}
echo "<br>Total number of recrods is ..".$totalrecords;
while($counter < $totalrecords) { //while there is still something restore_create_logs()
$SQL = 'SELECT * FROM '.$CFG->prefix.$dbtablename.' '.sql_paging_limit($counter, $recordsetsize);
echo "<br> SQL: ".$SQL;
if ($records = get_records_sql($SQL)) {
foreach ($records as $record) {
//if we are up this far, either no crash, or crash with same table, field name.
if ($crash){
if ($crash->record != $record->id) {
continue;
} else {
$crash = 0;
print_heading('recovering from '.$dbtablename.'--'.$fieldname.'--'.$record->id);
}
}
$migrationconfig = get_record('config','name','dbmigration');
$migrationconfig->name = 'dbmigration';
$migrationconfig->value = $dbtablename.'##'.$fieldname.'##'.$record->id;
update_record('config',$migrationconfig);
$replacements = array(); //manual refresh
$replacements[] = $record->id;
$replacements[] = $CFG->prefix;
switch ($method){
case 'PLAIN_SQL_UPDATE': //use the 2 statements to update
if (!empty($record->{$fieldname})) { //only update if not empty
//$db->debug=999;
//replace $CFG->prefix, and USERID in the queries
$userid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectuser));
$courseid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectcourse));
//$db->debug=0;
///get course, user, site lang
$sitelang = $CFG->lang;
$courselang = get_course_lang($courseid->course);
$userlang = get_user_lang($userid->userid);
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
/// We are going to use textlib facilities
/// Convert the text
//$db->debug=999;
$result = $textlib->convert($record->{$fieldname}, $fromenc);
//$db->debug=0;
$newrecord = new object;
$newrecord->id = $record->id;
$newrecord->{$fieldname} = $result;
if ($dbtablename == "data_content"){
echo "<br>here we go ".$record->{$fieldname};
echo "<br>after conversion".$result;
print_object($newrecord);
}
update_record($dbtablename,$newrecord);
}
break;
case 'PHP_FUNCTION'; //use the default php function to execute
//$db->debug=999;
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
$phpfunction($record->id);
//$db->debug=0;
break;
default: //no_conv, don't do anything ;-)
break;
}
$counter++;
}
}
} //close the while loop
//change field endocing here??
if ($CFG->dbtype == 'mysql') {
if ($dropindex){ //drop index if index is varchar, text etc type
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
execute_sql($SQL);
} else if ($dropprimary) { //drop primary key
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename.' DROP PRIMARY KEY;';
execute_sql($SQL);
}
//BLOB TIME!
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename.' CHANGE '.$fieldname.' '.$fieldname.' BLOB;';
} else {
//posgresql code here
}
//$db->debug=999;
execute_sql($SQL);
//$db->debug=0;
//add index back
if ($addindex){
$addindexarray[] = $addindex;
} else if ($adduniqueindex) {
$adduniqueindexarray[] = $adduniqueindex;
} else if ($addprimary) {
$addprimaryarray[] = $addprimary;
}
}
//change table encoding here (change column encoding together here?)
if ($CFG->dbtype == 'mysql') {
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
for ($i=0;$i<sizeof($colnames);$i++) {
$thiscolname = $colnames[$i];
$thistype = $coltypes[$i];
$thislength = $collengths[$i];
$SQL.= ' CHANGE '.$thiscolname.' '.$thiscolname.' '.$thistype;
if ($thislength > 0) {
$SQL.='('.$thislength.')';
}
$SQL.=' CHARACTER SET utf8 NOT NULL DEFAULT '.array_shift($defaults).', ';
}
$SQL = rtrim($SQL, ', ');
$SQL.=';';
} else { //posgresql query here
}
//$db->debug=999; // Eloy: Silly thing, what if you save the current value and then,
echo $SQL; // after execute_sql(), restore it
execute_sql($SQL); //change charset for columns
//$db->debug=0;
/**********************************
* Add the index back *
*********************************/
$alter = 0;
if ($CFG->dbtype=='mysql'){
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
if (!empty($addindexarray)) {
foreach ($addindexarray as $aidx){
$SQL .= ' ADD INDEX '.$aidx.',';
$alter++;
}
}
if (!empty($adduniqueindexarray)) {
foreach ($adduniqueindexarray as $auidx){
$SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
$alter++;
}
}
if (!empty($addprimaryarray)) {
foreach ($addprimaryarray as $apm){
$SQL .= ' ADD PRIMARY KEY '.$apm.',';
$alter++;
}
}
$SQL = rtrim($SQL, ', ');
$SQL.=';';
} else {
///posgresql code here
}
if ($alter) {
execute_sql($SQL);
}
///Done adding indexes back!
} //if there are fields
//now we modify the table encoding
$SQL = 'ALTER TABLE '.$dbtablename.' CHARACTER SET utf8';
//$db->debug=999;
execute_sql($SQL);
//$db->debug=0;
}
}
//set config unicode db to 1
$SQL = 'ALTER DATABASE '.$CFG->dbname.' CHARACTER SET utf8';
execute_sql($SQL);
delete_records('config','name','dbmigration'); //bye bye
}
/* returns the course lang
* @param int courseid
* @return string
*/
function get_course_lang($courseid) {
if ($course = get_record('course','id',$courseid)){
return $course->lang;
}
}
/* returns the teacher's lang
* @param int courseid
* @return string
*/
function get_main_teacher_lang($courseid) {
//editting teacher > non editting teacher
global $CFG;
$SQL = 'SELECT u.lang from '.$CFG->prefix.'user_teachers ut,
'.$CFG->prefix.'course c,
'.$CFG->prefix.'user u WHERE
c.id = ut.course AND ut.course = '.$courseid.' AND u.id = ut.userid ORDER BY ut.authority ASC';
if ($teacher = get_record_sql($SQL)) {
return $teacher->lang;
}
}
function get_original_encoding($sitelang, $courselang, $userlang){
global $CFG;
$lang = '';
if ($courselang) {
$lang = $courselang;
}
else if ($userlang) {
$lang = $userlang;
}
else if ($sitelang) {
$lang = $sitelang;
}
else {
error ('no language found!');
}
$langfile = $CFG->dirroot.'/lang/'.$lang.'/moodle.php';
$result = get_string_from_file('thischarset', $langfile, "\$resultstring");
eval($result);
return $resultstring;
}
/* returns the user's lang
* @param int userid
* @return string
*/
function get_user_lang($userid) {
if ($user = get_record('user','id',$userid)){
return $user->lang;
}
}
// a placeholder for now
function log_the_problem_somewhere() { //Eloy: Nice function, perhaps we could use it, perhpas no. :-)
}
+7 -21
View File
@@ -1,27 +1,13 @@
<?php
require_once('languages.php');
// Initialize vars
if (!isset ($config->cas_hostname)) {
$config->cas_hostname = "";
}
if (!isset ($config->cas_port)) {
$config->cas_port = "";
}
if (!isset ($config->cas_version)) {
$config->cas_version = "";
}
if (!isset ($config->cas_baseuri)) {
$config->cas_baseuri = "";
}
if (!isset ($config->cas_language)) {
$config->cas_language = "";
}
if (!isset ($config->cas_use_cas)) {
$config->cas_use_cas = "";
}
if (!isset ($config->cas_create_user)) {
$config->cas_create_user = "0";
}
optional_variable($config->cas_hostname,"");
optional_variable($config->cas_port,"");
optional_variable($config->cas_version,"");
optional_variable($config->cas_baseuri,"");
optional_variable($config->cas_language,"");
optional_variable($config->cas_use_cas,"");
optional_variable($config->cas_create_user,"0");
?>
+3 -9
View File
@@ -1,16 +1,10 @@
<?php
// version $Id$
// Page for forbidden access from CAS
require("../../config.php");
if (!$site = get_site()) {
error("No site found!");
}
$loginsite = get_string("loginsite");
require_once("../../config.php");
$errormsg = get_string("auth_cas_invalidcaslogin", "auth");
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite);
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite,
$focus, "", true, "<div align=right>$langmenu</div>");
include("forbidden.html");
print_footer();
exit;
+11 -11
View File
@@ -1,5 +1,5 @@
<?PHP
// $Id$
// $Id: lib.php
// author: romuald Lorthioir
//CHANGELOG:
//16/03/2005 Use of LDAP Module
@@ -13,7 +13,6 @@ This Module is using the /auth/cas/index_form.html.
This module is using the LDAP Module so you need the /auth/ldap directory.
You can see /auth/ldap/lib.php for the other functions.
*/
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
define('AUTH_LDAP_NAME', 'cas'); // for ldap module
require_once($CFG->dirroot.'/config.php');
@@ -99,9 +98,12 @@ function cas_authenticate_user_login ($username, $password) {
global $CFG;
$cas_validate=true;
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
phpCAS::setLang($CFG->cas_language);
phpCAS::forceAuthentication();
if (!phpCAS::isAuthenticated()){
phpCAS::authenticateIfNeeded();
}
if ($CFG->cas_create_user=="0"){
if (record_exists('user', 'username', phpCAS::getUser())) {
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
@@ -133,13 +135,12 @@ function cas_automatic_authenticate ($user="") {
global $CFG;
if (!$cas_validate){
$cas_validate=true;
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
phpCAS::setLang($CFG->cas_language);
$cas_user_exist=phpCAS::checkAuthentication();
if (!$cas_user_exist && !$CFG->guestloginbutton){
$cas_user_exist=phpCAS::forceAuthentication();
if (!phpCAS::isAuthenticated() && !$CFG->guestloginbutton){
phpCAS::authenticateIfNeeded();
}
if ($cas_user_exist){
if (phpCAS::isAuthenticated()){
if ($CFG->cas_create_user=="0"){
if (record_exists('user', 'username', phpCAS::getUser())) {
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
@@ -165,5 +166,4 @@ function cas_automatic_authenticate ($user="") {
}
}
?>
?>
+2 -2
View File
@@ -1,9 +1,9 @@
<?php
// $Id$
// $Id: login.php
// author: romualdLorthioir $
//CHANGELOG:
//05.03.2005 replace /login/index.php
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
//Define variables used in page
if (!$site = get_site()) {
+6 -11
View File
@@ -1,15 +1,10 @@
<?php
// $Id$
// logout the user from CAS server (destroy the ticket)
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
// logout the user from CAS server (destroy the ticket)
global $CFG;
if ($CFG->cas_logout){
require_once($CFG->dirroot.'/config.php');
include_once($CFG->dirroot.'/lib/cas/CAS.php');
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
$backurl = $CFG->wwwroot;
phpCAS::logout($backurl);
}
require_once($CFG->dirroot.'/config.php');
include_once($CFG->dirroot.'/lib/cas/CAS.php');
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
$backurl = $CFG->wwwroot;
phpCAS::logout($backurl);
?>
-39
View File
@@ -1,39 +0,0 @@
<?php
/** auth_db_sync_users.php
*
* This script is meant to be called from a cronjob to sync moodle with the LDAP
* backend in those setups where the LDAP backend acts as 'master'.
*
* Recommended cron entry:
* # 5 minutes past 4am
* 5 4 * * * /usr/bin/php -c /etc/php4/cli/php.ini /var/www/moodle/auth/db/auth_db_sync_users.php
*
* Notes:
* - If you have a large number of users, you may want to raise the memory limits
* by passing -d memory_limit=256M
* - For debugging & better logging, you are encouraged to use in the command line:
* -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
*
* Performance notes:
* + The code is simpler, but not as optimized as its LDAP counterpart.
*
*
*/
if(!empty($_SERVER['GATEWAY_INTERFACE'])){
error_log("should not be called from apache!");
exit;
}
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/lib/blocklib.php');
require_once($CFG->dirroot.'/mod/resource/lib.php');
require_once($CFG->dirroot.'/auth/db/lib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
$CFG->debug=10;
auth_sync_users(true );
?>
-5
View File
@@ -26,10 +26,7 @@
if (!isset($config->auth_dbpasstype)) {
$config->auth_dbpasstype = "plaintext";
}
$pluginconfig = get_config('auth/db');
?>
<tr valign="top" class="required">
<td align="right">auth_dbhost:</td>
<td>
@@ -129,8 +126,6 @@
<?php
$passtype["plaintext"] = get_string("plaintext", "auth");
$passtype["md5"] = get_string("md5", "auth");
$passtype["internal"] = get_string("internal", "auth");
choose_from_menu($passtype, "auth_dbpasstype", $config->auth_dbpasstype, "");
?>
+21 -339
View File
@@ -21,59 +21,31 @@ function auth_user_login ($username, $password) {
}
// Connect to the external database
$authdb = &ADONewConnection($CFG->auth_dbtype);
$authdb = &ADONewConnection($CFG->auth_dbtype);
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
if ($CFG->auth_dbpasstype === 'internal') {
// lookup username externally, but resolve
// password locally -- to support backend that
// don't track passwords
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
WHERE $CFG->auth_dbfielduser = '$username' ");
$authdb->Close();
if (!$rs) {
notify("Could not connect to the specified authentication database...");
return false;
}
if ( $rs->RecordCount() ) {
// user exists exterally
// check username/password internally
if ($user = get_record('user', 'username', $username)) {
return ($user->password == md5($password));
}
} else {
// user does not exist externally
return false;
}
} else {
// normal case: use external db for passwords
if ($CFG->auth_dbpasstype === 'md5') { // Re-format password accordingly
switch ($CFG->auth_dbpasstype) { // Re-format password accordingly
case "md5":
$password = md5($password);
}
break;
}
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
WHERE $CFG->auth_dbfielduser = '$username'
AND $CFG->auth_dbfieldpass = '$password' ");
$authdb->Close();
$CFG->prefix = $prefix;
if (!$rs) {
notify("Could not connect to the specified authentication database...");
return false;
}
if ( $rs->RecordCount() ) {
return true;
} else {
return false;
}
$authdb->Close();
$CFG->prefix = $prefix;
if (!$rs) {
notify("Could not connect to the specified authentication database...");
return false;
}
if ( $rs->RecordCount() ) {
return true;
} else {
return false;
}
}
@@ -104,7 +76,7 @@ function auth_get_userinfo($username){
if ($rs = $authdb->Execute("SELECT ".$pcfg["field_map_$field"]." FROM $CFG->auth_dbtable
WHERE $CFG->auth_dbfielduser = '$username'")) {
if ( $rs->RecordCount() == 1 ) {
$result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0])));
$result["$field"] = $rs->fields[0];
}
}
}
@@ -113,294 +85,4 @@ function auth_get_userinfo($username){
return $result;
}
/**
* syncronizes user fron external db to moodle user table
*
* Sync shouid be done by using idnumber attribute, not username.
* You need to pass firstsync parameter to function to fill in
* idnumbers if they dont exists in moodle user table.
*
* Syncing users removes (disables) users that dont exists anymore in external db.
* Creates new users and updates coursecreator status of users.
*
* @param bool $do_updates Optional: set to true to force an update of existing accounts
*
* This implementation is simpler but less scalable than the one found in the LDAP module.
*
*/
function auth_sync_users ($do_updates=0) {
global $CFG;
$pcfg = get_config('auth/db');
///
/// list external users
///
$userlist = auth_get_userlist();
$quoteduserlist = implode("', '", $userlist);
$quoteduserlist = "'$quoteduserlist'";
///
/// delete obsolete internal users
///
// find obsolete users
if (count($userlist)) {
$sql = 'SELECT u.id, u.username
FROM ' . $CFG->prefix .'user u
WHERE u.auth=\'db\' AND u.deleted=\'0\' AND u.username NOT IN (' . $quoteduserlist . ')';
} else {
$sql = 'SELECT u.id, u.username
FROM ' . $CFG->prefix .'user u
WHERE u.auth=\'db\' AND u.deleted=\'0\' ';
}
$remove_users = get_records_sql($sql);
if (!empty($remove_users)){
print "User entries to remove: ". count($remove_users) . "\n";
begin_sql();
foreach ($remove_users as $user) {
//following is copy pasted from admin/user.php
//maybe this should moved to function in lib/datalib.php
unset($updateuser);
$updateuser->id = $user->id;
$updateuser->deleted = "1";
$updateuser->timemodified = time();
if (update_record("user", $updateuser)) {
unenrol_student($user->id); // From all courses
remove_teacher($user->id); // From all courses
remove_admin($user->id);
notify(get_string("deletedactivity", "", fullname($user, true)) );
} else {
notify(get_string("deletednot", "", fullname($user, true)));
}
//copy pasted part ends
}
commit_sql();
}
unset($remove_users); // free mem!
if (!count($userlist)) {
// exit right here
// nothing else to do
return true;
}
///
/// update existing accounts
///
if ($do_updates) {
// narrow down what fields we need to update
$all_keys = array_keys(get_object_vars($pcfg));
$updatekeys = array();
foreach ($all_keys as $key) {
if (preg_match('/^field_updatelocal_(.+)$/',$key, $match)) {
if ($pcfg->{$match[0]}) { // if it has a true value
array_push($updatekeys, $match[1]); // the actual key name
}
}
}
// print_r($all_keys); print_r($updatekeys);
unset($all_keys); unset($key);
// only go ahead if we actually
// have fields to update locally
if (!empty($updatekeys)) {
$sql = 'SELECT u.id, u.username
FROM ' . $CFG->prefix .'user u
WHERE u.auth=\'db\' AND u.deleted=\'0\' AND u.username IN (' . $quoteduserlist . ')';
$update_users = get_records_sql($sql);
foreach ($update_users as $user) {
auth_db_update_user_record($user->username, $updatekeys);
}
unset($update_users); // free memory
}
}
///
/// create missing accounts
///
// NOTE: this is very memory intensive
// and generally inefficient
$sql = 'SELECT u.id, u.username
FROM ' . $CFG->prefix .'user u
WHERE u.auth=\'db\' AND u.deleted=\'0\'';
$users = get_records_sql($sql);
// simplify down to usernames
$usernames = array();
foreach ($users as $user) {
array_push($usernames, $user->username);
}
unset($users);
$add_users = array_diff($userlist, $usernames);
unset($usernames);
if(!empty($add_users)){
print "User entries to add: ". count($add_users). "\n";
begin_sql();
foreach($add_users as $user){
$username = $user;
$user = auth_get_userinfo_asobj($user);
// prep a few params
$user->username = $username;
$user->modified = time();
$user->confirmed = 1;
$user->auth = 'db';
// insert it
$old_debug=$CFG->debug;
$CFG->debug=10;
// maybe the user has been deleted before
if ($old_user = get_record('user', 'username', $user->username, 'deleted', 1)) {
$user->id = $old_user->id;
set_field('user', 'deleted', 0, 'username', $user->username);
echo "Revived user $user->username id $user->id\n";
} elseif ($id=insert_record ('user',$user)) { // it is truly a new user
echo "inserted user $user->username id $id\n";
$user->id = $id;
// if relevant, tag for password generation
if ($CFG->auth_dbpasstype === 'internal') {
set_user_preference('auth_forcepasswordchange', 1, $id);
set_user_preference('create_password', 1, $id);
}
} else {
echo "error inserting user $user->username \n";
}
$CFG->debug=$old_debug;
}
commit_sql();
unset($add_users); // free mem
}
return true;
}
function auth_user_exists ($username) {
global $CFG;
$authdb = &ADONewConnection($CFG->auth_dbtype);
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
WHERE $CFG->auth_dbfielduser = '$username' ");
$authdb->Close();
if (!$rs) {
notify("Could not connect to the specified authentication database...");
return false;
}
if ( $rs->RecordCount() ) {
// user exists exterally
// check username/password internally
if ($user = get_record('user', 'username', $username)) {
return ($user->password == md5($password));
}
} else {
// user does not exist externally
return false;
}
}
function auth_get_userlist() {
global $CFG;
// Connect to the external database
$authdb = &ADONewConnection($CFG->auth_dbtype);
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
// fetch userlist
$rs = $authdb->Execute("SELECT $CFG->auth_dbfielduser AS username
FROM $CFG->auth_dbtable ");
$authdb->Close();
if (!$rs) {
notify("Could not connect to the specified authentication database...");
return false;
}
if ( $rs->RecordCount() ) {
$userlist = array();
while ($rec = $rs->FetchRow()) {
array_push($userlist, $rec['username']);
}
return $userlist;
} else {
return array();
}
}
/**
* reads userinformation from DB and return it in an object
*
* @param string $username username
* @return array
*/
function auth_get_userinfo_asobj($username){
$user_array = truncate_userinfo(auth_get_userinfo($username));
$user = new object;
foreach($user_array as $key=>$value){
$user->{$key} = $value;
}
return $user;
}
function auth_db_update_user_record($username, $updatekeys=false) {
/// will update a local user record from an external source.
/// is a lighter version of the one in moodlelib -- won't do
/// expensive ops such as enrolment
///
/// If you don't pass $updatekeys, there is a performance hit and
/// values removed from DB won't be removed from moodle.
global $CFG;
$pcfg = get_config('auth/db');
//just in case check text case
$username = trim(moodle_strtolower($username));
// get the current user record
$user = get_record('user', 'username', $username);
if (empty($user)) { // trouble
error_log("Cannot update non-existent user: $username");
die;
}
if (function_exists('auth_get_userinfo')) {
if ($newinfo = auth_get_userinfo($username)) {
$newinfo = truncate_userinfo($newinfo);
if (empty($updatekeys)) { // all keys? this does not support removing values
$updatekeys = array_keys($newinfo);
}
foreach ($updatekeys as $key){
unset($value);
if (isset($newinfo[$key])) {
$value = $newinfo[$key];
$value = addslashes(stripslashes($value)); // Just in case
} else {
$value = '';
}
if (!empty($pcfg->{'field_updatelocal_' . $key})) {
if ($user->{$key} != $value) { // only update if it's changed
set_field('user', $key, $value, 'username', $username);
}
}
}
}
}
return get_record_select("user", "username = '$username' AND deleted <> '1'");
}
?>
?>
+38 -75
View File
@@ -1,51 +1,28 @@
<?php
// Initialize vars
if (!isset($config->ldap_host_url))
{ $config->ldap_host_url = ''; }
if (!isset($config->ldap_contexts))
{ $config->ldap_contexts = ''; }
if (!isset($config->ldap_user_type))
{ $config->ldap_user_type = ''; }
if (!isset($config->ldap_user_attribute))
{ $config->ldap_user_attribute = ''; }
if (!isset($config->ldap_search_sub))
{ $config->ldap_search_sub = ''; }
if (!isset($config->ldap_opt_deref))
{ $config->ldap_opt_deref = ''; }
if (!isset($config->ldap_preventpassindb))
{ $config->ldap_preventpassindb = 0; }
if (!isset($config->ldap_bind_dn))
{$config->ldap_bind_dn = ''; }
if (!isset($config->ldap_bind_pw))
{$config->ldap_bind_pw = ''; }
if (!isset($config->ldap_version))
{$config->ldap_version = '2'; }
if (!isset($config->ldap_objectclass))
{$config->ldap_objectclass = ''; }
if (!isset($config->ldap_memberattribute))
{$config->ldap_memberattribute = ''; }
if (!isset($config->ldap_creators))
{$config->ldap_creators = ''; }
if (!isset($config->ldap_create_context))
{$config->ldap_create_context = ''; }
if (!isset($config->ldap_expiration))
{$config->ldap_expiration = ''; }
if (!isset($config->ldap_expiration_warning))
{$config->ldap_expiration_warning = '10'; }
if (!isset($config->ldap_expireattr))
{$config->ldap_expireattr = ''; }
if (!isset($config->ldap_gracelogins))
{$config->ldap_gracelogins = ''; }
if (!isset($config->ldap_graceattr))
{$config->ldap_graceattr = ''; }
if (!isset($config->auth_user_create))
{$config->auth_user_create = ''; }
if (!isset($config->auth_ldap_forcechangepassword))
{$config->auth_ldap_forcechangepassword = false; }
if (!isset($config->auth_ldap_stdchangepassword))
{$config->auth_ldap_stdchangepassword = false; }
$yesno = array( get_string('no'), get_string('yes') );
optional_variable($config->ldap_host_url, "");
optional_variable($config->ldap_contexts, "");
optional_variable($config->ldap_user_type, "");
optional_variable($config->ldap_user_attribute, "");
optional_variable($config->ldap_search_sub, "");
optional_variable($config->ldap_opt_deref, "");
optional_variable($config->ldap_bind_dn, "");
optional_variable($config->ldap_bind_pw, "");
optional_variable($config->ldap_version, "2");
optional_variable($config->ldap_objectclass, "");
optional_variable($config->ldap_memberattribute, "");
optional_variable($config->ldap_creators, "");
optional_variable($config->ldap_create_context, "");
optional_variable($config->ldap_expiration, "");
optional_variable($config->ldap_expiration_warning, "10");
optional_variable($config->ldap_expireattr, "");
optional_variable($config->ldap_gracelogins, "");
optional_variable($config->ldap_graceattr, "");
optional_variable($config->auth_user_create, "");
optional_variable($config->auth_user_create, "");
optional_variable($config->auth_ldap_forcechangepassword, "");
optional_variable($config->auth_ldap_stdchangepassword, false);
if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
print '<tr><td><p align="center"><font color="red"><strong>Warning:
@@ -63,7 +40,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_host_url:</td>
<td>
<input name="ldap_host_url" type="text" size="30" value="<?php echo $config->ldap_host_url?>" />
<input name="ldap_host_url" type="text" size="30" value="<?php echo $config->ldap_host_url?>">
<?php if (isset($err["ldap_host_url"])) formerr($err["ldap_host_url"]); ?>
</td>
<td>
@@ -92,24 +69,10 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_preventpassindb:</td>
<td>
<?php
$choices = array();
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "ldap_preventpassindb", $config->ldap_preventpassindb, "");
?>
</td><td>
<?php print_string("auth_ldap_preventpassindb","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_bind_dn:</td>
<td>
<input name="ldap_bind_dn" type="text" size="30" value="<?php echo $config->ldap_bind_dn?>" />
<input name="ldap_bind_dn" type="text" size="30" value="<?php echo $config->ldap_bind_dn?>">
<?php if (isset($err["ldap_bind_dn"])) formerr($err["ldap_bind_dn"]); ?>
</td><td>
<?php print_string("auth_ldap_bind_dn","auth") ?>
@@ -119,7 +82,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_bind_pw:</td>
<td>
<input name="ldap_bind_pw" type="password" size="30" value="<?php echo $config->ldap_bind_pw?>" />
<input name="ldap_bind_pw" type="password" size="30" value="<?php echo $config->ldap_bind_pw?>">
<?php if (isset($err["ldap_bind_pw"])) formerr($err["ldap_bind_pw"]); ?>
</td><td>
<?php print_string("auth_ldap_bind_pw","auth") ?>
@@ -146,7 +109,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_contexts:</td>
<td>
<input name="ldap_contexts" type="text" size="30" value="<?php echo $config->ldap_contexts?>" />
<input name="ldap_contexts" type="text" size="30" value="<?php echo $config->ldap_contexts?>">
<?php if (isset($err["ldap_contexts"])) formerr($err["ldap_contexts"]); ?>
</td>
<td>
@@ -158,7 +121,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<td align="right">ldap_search_sub:</td>
<td>
<?php
$choices = array();
$choices = array();;
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "ldap_search_sub", $config->ldap_search_sub, "");
@@ -189,7 +152,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_user_attribute:</td>
<td>
<input name="ldap_user_attribute" type="text" size="30" value="<?php echo $config->ldap_user_attribute?>" />
<input name="ldap_user_attribute" type="text" size="30" value="<?php echo $config->ldap_user_attribute?>">
<?php if (isset($err["ldap_user_attribute"])) formerr($err["ldap_user_attribute"]); ?>
</td>
<td>
@@ -200,7 +163,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_memberattribute:</td>
<td>
<input name="ldap_memberattribute" type="text" size="30" value="<?php echo $config->ldap_memberattribute?>" />
<input name="ldap_memberattribute" type="text" size="30" value="<?php echo $config->ldap_memberattribute?>">
<?php if (isset($err["ldap_memberattribute"])) formerr($err["ldap_memberattribute"]); ?>
</td><td>
<?php print_string("auth_ldap_memberattribute","auth") ?>
@@ -210,7 +173,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_objectclass:</td>
<td>
<input name="ldap_objectclass" type="text" size="30" value="<?php echo $config->ldap_objectclass?>" />
<input name="ldap_objectclass" type="text" size="30" value="<?php echo $config->ldap_objectclass?>">
<?php if (isset($err["ldap_objectclass"])) formerr($err["ldap_objectclass"]); ?>
</td>
<td>
@@ -233,7 +196,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_ldap_forcechangepassword ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br />
</select><br>
</td>
<td align="left" valign="top">
@@ -250,7 +213,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_ldap_stdchangepassword ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br />
</select><br>
</td>
<td align="left" valign="top">
@@ -284,7 +247,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_expiration_warning:</td>
<td>
<input name="ldap_expiration_warning" type="text" size="2" value="<?php echo $config->ldap_expiration_warning?>" />
<input name="ldap_expiration_warning" type="text" size="2" value="<?php echo $config->ldap_expiration_warning?>">
<?php if (isset($err["ldap_expiration_warning"])) formerr($err["ldap_expiration_warning"]);
?>
</td>
@@ -296,7 +259,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_exprireattr:</td>
<td>
<input name="ldap_expireattr" type="text" size="30" value="<?php echo $config->ldap_expireattr?>" />
<input name="ldap_expireattr" type="text" size="30" value="<?php echo $config->ldap_expireattr?>">
<?php if (isset($err["ldap_expireattr"])) formerr($err["ldap_expireattr"]);
?>
</td>
@@ -323,7 +286,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_graceattr:</td>
<td>
<input name="ldap_graceattr" type="text" size="30" value="<?php echo $config->ldap_graceattr?>" />
<input name="ldap_graceattr" type="text" size="30" value="<?php echo $config->ldap_graceattr?>">
<?php if (isset($err["ldap_graceattr"])) formerr($err["ldap_graceattr"]);
?>
</td>
@@ -344,7 +307,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_create_context:</td>
<td>
<input name="ldap_create_context" type="text" size="30" value="<?php echo $config->ldap_create_context?>" />
<input name="ldap_create_context" type="text" size="30" value="<?php echo $config->ldap_create_context?>">
<?php if (isset($err["ldap_create_context"])) formerr($err["ldap_create_context"]); ?>
</td><td>
<?php print_string("auth_ldap_create_context","auth") ?>
@@ -361,7 +324,7 @@ if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
<tr valign="top" class="required">
<td align="right">ldap_creators:</td>
<td>
<input name="ldap_creators" type="text" size="30" value="<?php echo $config->ldap_creators?>" />
<input name="ldap_creators" type="text" size="30" value="<?php echo $config->ldap_creators?>">
<?php if (isset($err["ldap_creators"])) formerr($err["ldap_creators"]); ?>
</td><td>
<?php print_string("auth_ldap_creators","auth") ?>
+45 -80
View File
@@ -68,7 +68,7 @@ function auth_user_login ($username, $password) {
}
// Try to bind with current username and password
$ldap_login = @ldap_bind($ldapconnection, $ldap_user_dn, stripslashes($password));
$ldap_login = @ldap_bind($ldapconnection, $ldap_user_dn, $password);
ldap_close($ldapconnection);
if ($ldap_login) {
return true;
@@ -124,19 +124,11 @@ function auth_get_userinfo($username){
if (!is_array($values)) {
$values = array($values);
}
$ldapval = NULL;
foreach ($values as $value) {
if(is_array($user_entry[0][strtolower($value)])) {
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
if(isset($user_entry[0][strtolower($value)][0])){
$result[$key]=addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
}
else {
$newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
}
if (!empty($newval)) { // favour ldap entries that are set
$ldapval = $newval;
}
}
$result[$key] = $ldapval;
}
}
@@ -218,14 +210,14 @@ function auth_user_create ($userobject,$plainpass) {
switch ($CFG->ldap_user_type) {
case 'edir':
$newuser['objectClass']= array("inetOrgPerson","organizationalPerson","person","top");
$newuser['uniqueId']= $userobject->username;
$newuser['logindisabled']="TRUE";
$newuser['userpassword']=$plainpass;
break;
$newuser['objectClass']= array("inetOrgPerson","organizationalPerson","person","top");
$newuser['uniqueId']= $userobject->username;
$newuser['logindisabled']="TRUE";
$newuser['userpassword']=$plainpass;
default:
error('auth: ldap auth_user_create() does not support selected usertype:"'.$CFG->ldap_user_type.'" (..yet)');
error('auth: ldap auth_user_create() does not support selected usertype (..yet)');
}
$uadd = ldap_add($ldapconnection, $CFG->ldap_user_attribute."=$userobject->username,".$CFG->ldap_create_context, $newuser);
ldap_close($ldapconnection);
@@ -387,10 +379,10 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
if(strtolower($CFG->dbtype) === 'mysql'){
// help old mysql versions cope with large temp tables
execute_sql('SET SQL_BIG_TABLES=1', false);
execute_sql('CREATE TEMPORARY TABLE ' . $CFG->prefix .'extuser (idnumber VARCHAR(64), PRIMARY KEY (idnumber)) TYPE=MyISAM',false);
execute_sql('CREATE TEMPORARY TABLE ' . $CFG->prefix .'extuser (idnumber VARCHAR(12), PRIMARY KEY (idnumber)) TYPE=MyISAM',false);
} elseif (strtolower($CFG->dbtype) === 'postgres7'){
$bulk_insert_records = 1; // no support for multiple sets of values
execute_sql('CREATE TEMPORARY TABLE '.$CFG->prefix.'extuser (idnumber VARCHAR(64), PRIMARY KEY (idnumber))',false);
execute_sql('CREATE TEMPORARY TABLE '.$CFG->prefix.'extuser (idnumber VARCHAR(12), PRIMARY KEY (idnumber))',false);
}
@@ -516,11 +508,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
$updatekeys = array();
foreach ($all_keys as $key) {
if (preg_match('/^field_updatelocal_(.+)$/',$key, $match)) {
// if we have a field to update it from
// and it must be updated 'onlogin' we
// update it on cron
if ( !empty($pcfg->{'field_map_'.$match[1]})
&& $pcfg->{$match[0]} === 'onlogin') {
if ($pcfg->{$match[0]}) { // if it has a true value
array_push($updatekeys, $match[1]); // the actual key name
}
}
@@ -612,7 +600,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
$CFG->debug=$old_debug;
$userobj = auth_ldap_update_user_record($user->username);
if(isset($CFG->{'auth_ldap_forcechangepassword'}) && $CFG->{'auth_ldap_forcechangepassword'}){
set_user_preference('auth_forcepasswordchange', 1, $userobj->id);
set_user_preference('auth_forcepasswordchange', 1, $userobj);
}
// update course creators
@@ -626,7 +614,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
}
} else {
if ( record_exists("user_coursecreators", "userid", $user->id)) {
$creator = delete_records("user_coursecreators", "userid", $user->id);
$creator = delete_records("user_coursecreators", "userid", $$user->id);
if (! $creator) {
error("Cannot remove user from course creators.");
}
@@ -715,19 +703,17 @@ function auth_ldap_bulk_insert($users){
* @return boolen result
*/
function auth_user_activate ($username) {
global $CFG;
$ldapconnection = auth_ldap_connect();
$ldapconnection = auth_ldap_connect();
$userdn = auth_ldap_find_userdn($ldapconnection, $username);
switch ($CFG->ldap_user_type) {
case 'edir':
$newinfo['loginDisabled']="FALSE";
break;
default:
error ('auth: ldap auth_user_activate() does not support selected usertype:"'.$CFG->ldap_user_type.'" (..yet)');
}
case 'edir':
$newinfo['loginDisabled']="FALSE";
default;
error ('auth: ldap auth_user_activate() does not support selected usertype (..yet)');
}
$result = ldap_modify($ldapconnection, $userdn, $newinfo);
ldap_close($ldapconnection);
return $result;
@@ -749,8 +735,7 @@ function auth_user_disable ($username) {
$userdn = auth_ldap_find_userdn($ldapconnection, $username);
switch ($CFG->ldap_user_type) {
case 'edir':
$newinfo['loginDisabled']="TRUE";
break;
$newinfo['loginDisabled']="TRUE";
default:
error ('auth: ldap auth_user_disable() does not support selected usertype (..yet)');
}
@@ -826,19 +811,10 @@ function auth_user_update($olduser, $newuser) {
if ($user_info_result){
$user_entry = auth_ldap_get_entries($ldapconnection, $user_info_result);
if (count($user_entry)) {
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
}
$user_entry = $user_entry[0];
//error_log(var_export($user_entry) . 'fpp' );
foreach ($attrmap as $key=>$ldapkeys){
// only process if the moodle field ($key) has changed and we
// are set to update LDAP with it
if ($olduser->$key !== $newuser->$key &&
!empty($pcfg->{'field_updateremote_'. $key})) {
if (!empty($pcfg->{'field_updateremote_'. $key})) {
// for ldap values that could be in more than one
// ldap key, we will do our best to match
@@ -846,42 +822,33 @@ function auth_user_update($olduser, $newuser) {
$ambiguous = true;
$changed = false;
if (!is_array($ldapkeys)) {
$ldapkeys = array($ldapkeys);
$ldapkeys = $array($ldapkeys);
}
if (count($ldapkeys) < 2) {
$ambiguous = false;
}
foreach ($ldapkeys as $ldapkey) {
$ldapkey = strtolower($ldapkey);
$ldapvalue = $user_entry[$ldapkey][0];
if (!$ambiguous) {
// skip update if the values already match
if( !($newuser->$key === $ldapvalue) ){
if( !($newuser->$key === $user_entry[0][strtolower($ldapkey)][0]) ){
ldap_modify($ldapconnection, $user_dn, array($ldapkey => $newuser->$key));
} else {
error_log("Skip updating field $key for entry $user_dn: it seems to be already same on LDAP. " .
" old moodle value: '" . $olduser->$key .
"' new value '" . $newuser->$key .
"' current value in ldap entry " . $ldapvalue);
"' current value in ldap entry " . $user_entry[0][strtolower($ldapkey)][0]);
}
} else { // ambiguous
// value empty before in Moodle (and LDAP) - use 1st ldap candidate field
// no need to guess
if (empty($olduser->$key)) { // value empty before - use 1st ldap candidate
if(ldap_modify($ldapconnection, $user_dn, array($ldapkey => $newuser->$key))){
$changed=true;
last;
} else {
error ('Error updating LDAP record. Error code: '
. ldap_errno($ldapconnection) . '; Error string : '
. ldap_err2str(ldap_errno($ldapconnection)));
}
}
// we found which ldap key to update!
if ( !empty($ldapvalue) && $olduser->$key === $ldapvalue ) {
// error_log("Matched: ". $olduser->$key . " === " . $ldapvalue);
// check the old values match
//error_log("keys $key $ldapkey");
//error_log("olduser " . $olduser->$key);
//error_log("ldapuser " . $user_entry[0][strtolower($ldapkey)][0]);
if ( !empty($olduser->$key)
&& !empty($user_entry[0][strtolower($ldapkey)][0])
&& $olduser->$key === $user_entry[0][strtolower($ldapkey)][0] ) {
// we found which value to update!
error_log("Matched: ". $olduser->$key . " === " . $user_entry[0][strtolower($ldapkey)][0]);
if(ldap_modify($ldapconnection, $user_dn, array($ldapkey => $newuser->$key))){
$changed=true;
last;
@@ -1063,15 +1030,15 @@ function auth_ldap_getdefaults(){
'rfc2307' => 'member',
'rfc2307bis' => 'member',
'samba' => 'member',
'ad' => 'member',
'ad' => 'member', //is this right?
'default' => 'member'
);
$default['ldap_memberattribute_isdn'] = array(
'edir' => '1',
'rfs2307' => '0',
'rfs2307bis' => '1',
'rfc2307' => '0',
'rfc2307bis' => '1',
'samba' => '0', //is this right?
'ad' => '1',
'ad' => '0', //is this right?
'default' => '0'
);
$default['ldap_expireattr'] = array (
@@ -1246,8 +1213,7 @@ function auth_ldap_isgroupmember ($username='', $groupdns='') {
}
//echo "Checking group $group for member $username\n";
$search = @ldap_read($ldapconnection, $group, '('.$CFG->ldap_memberattribute.'='.$username.')', array($CFG->ldap_memberattribute));
if (!empty($search) AND ldap_count_entries($ldapconnection, $search)) {$info = auth_ldap_get_entries($ldapconnection, $search);
if (ldap_count_entries($ldapconnection, $search)) {$info = auth_ldap_get_entries($ldapconnection, $search);
if (count($info) > 0 ) {
// user is member of group
@@ -1304,8 +1270,7 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
if (!empty($binddn)){
//bind with search-user
//$debuginfo .= 'Using bind user'.$binddn.'and password:'.$bindpwd;
$bindresult=ldap_bind($connresult, $binddn,$bindpwd);
$bindresult=@ldap_bind($connresult, $binddn,$bindpwd);
} else {
//bind anonymously
$bindresult=@ldap_bind($connresult);
@@ -1319,7 +1284,7 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
return $connresult;
}
$debuginfo .= "<br/>Server: '$server' <br/> Connection: '$connresult'<br/> Bind result: '$bindresult'</br>";
$debuginfo == "<br/>Server: '$server' <br/> Connection: '$connresult'<br/> Bind result: '$bindresult'</br>";
}
//If any of servers are alive we have already returned connection
@@ -1449,7 +1414,7 @@ function auth_ldap_get_userlist($filter="*") {
$filter,
array($CFG->ldap_user_attribute));
}
$users = auth_ldap_get_entries($ldapconnection, $ldap_result);
//add found users to list
@@ -1477,7 +1442,7 @@ function auth_ldap_get_entries($conn, $searchresult){
$fresult=array();
$entry = ldap_first_entry($conn, $searchresult);
do {
$attributes = @ldap_get_attributes($conn, $entry);
$attributes = ldap_get_attributes($conn, $entry);
for($j=0; $j<$attributes['count']; $j++) {
$values = ldap_get_values_len($conn, $entry,$attributes[$j]);
if (is_array($values)) {
@@ -1488,7 +1453,7 @@ function auth_ldap_get_entries($conn, $searchresult){
}
$i++;
}
while ($entry = @ldap_next_entry($conn, $entry));
while ($entry = ldap_next_entry($conn, $entry));
//were done
return ($fresult);
}
+1 -1
View File
@@ -9,7 +9,7 @@ function auth_user_login ($username, $password) {
return ($user->password == md5($password));
}
return true;
return false;
}
-61
View File
@@ -1,61 +0,0 @@
<?PHP // $Id: config.html
if ((!include_once('Auth/RADIUS.php')) or (!class_exists(Auth_RADIUS_PAP))) { // Is Auth/RADIUS really there?
print '<p align="center"><font color="red"><strong>Warning: The Auth_RADIUS module does not seem to be present. Please ensure it is installed and enabled.</strong></font></p>';
}
if (!isset($config->auth_radiushost)) {
$config->auth_radiushost = "127.0.0.1";
}
if (!isset($config->auth_radiusnasport)) {
$config->auth_radiusport = "0";
}
if (!isset($config->auth_radiussecret)) {
$config->auth_radiussecret = "";
}
?>
<tr valign="top" >
<td align="right"><P>auth_radiushost:</td>
<td>
<input name="auth_radiushost" type="text" size="30" value="<?php echo $config->auth_radiushost?>">
<?php if (isset($err["auth_radiushost"]))
formerr($err["auth_radiushost"]); ?>
</td>
<td>
<?php print_string("auth_radiushost","auth") ?>
</td>
</TR>
<TR valign="top" >
<td align="right"><P>auth_radiusnasport:</td>
<td>
<input name="auth_radiusport" type="text" size="6" value="<?php echo $config->auth_radiusport ?>">
<?php if (isset($err["auth_radiusnasport"])) formerr($err["auth_radiusnasport"]); ?>
</td>
<td>
<?php print_string("auth_radiusnasport","auth") ?>
</td>
</TR>
<TR valign="top" >
<td align="right"><P>auth_radiussecret:</td>
<td>
<input name="auth_radiussecret" type="text" size="6" value="<?php echo $config->auth_radiussecret ?>">
<?php if (isset($err["auth_radiussecret"])) formerr($err["auth_radiussecret"]); ?> </td>
<td>
<?php print_string("auth_radiussecret","auth") ?>
</td>
</TR>
<TR valign="top">
<td align="right"><P><?php print_string("instructions", "auth")
?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php
p($config->auth_instructions) ?></textarea>
</td>
<td>
<?php print_string("authinstructions","auth") ?>
<?php helpbutton("text", get_string("helptext")) ?>
</td>
</TR>
-50
View File
@@ -1,50 +0,0 @@
<?PHP // $Id$
// Authentication by looking up a RADIUS server
// Contributed by Clive Gould <clive@ce.bromley.ac.uk>
function auth_user_login ($username, $password) {
// Returns true if the username and password work
// and false if they are wrong or don't exist.
require_once 'Auth/RADIUS.php';
global $CFG;
// Added by Clive on 7th May for test purposes
// printf("Username: $username <br>");
// printf("Password: $password <br>");
// printf("auth_radiushost: $CFG->auth_radiushost <br>");
// printf("auth_radiusnasport: $CFG->auth_radiusnasport <br>");
// printf("auth_radiussecret: $CFG->auth_radiussecret <br>");
$rauth = new Auth_RADIUS_PAP($username, $password);
$rauth->addServer($CFG->auth_radiushost, $CFG->auth_radiusnasport, $CFG->auth_radiussecret);
if (!$rauth->start()) {
printf("Radius start: %s<br>\n", $rauth->getError());
exit;
}
$result = $rauth->send();
if (PEAR::isError($result)) {
printf("Radius send failed: %s<br>\n", $result->getMessage());
exit;
} else if ($result === true) {
// printf("Radius Auth succeeded<br>\n");
return true;
} else {
// printf("Radius Auth rejected<br>\n");
return false;
}
// get attributes, even if auth failed
if (!$rauth->getAttributes()) {
printf("Radius getAttributes: %s<br>\n", $rauth->getError());
} else {
$rauth->dumpAttributes();
}
$rauth->close();
}
?>
+3 -2
View File
@@ -12,7 +12,6 @@ Changes:
- 05. 2005: Various extensions and fixes by Lukas Haemmerle
- 06. 2005: Adaptions to new field locks and plugin config structures by Marting
Langhoff and Lukas Haemmerle
- 10. 2005: Added better error messages and moved text to language directories
Moodle Configuration with Dual login
-------------------------------------------------------------------------------
@@ -152,6 +151,7 @@ Example file:
// institution, street, zipcode, city and country
$address = $_SERVER[$pluginconfig->field_map_address];
list($institution, $street, $zip_city) = split('\$', $address);
ereg(' (.+)',$zip_city, $regs);
$city = $regs[1];
@@ -168,7 +168,8 @@ Example file:
Bugs
--------------------------------------------------------------------------------
Please send bug reports concerning the Shibboleth part to
The current implementation has not yet been extensively tested. So there may be
bugs. Please send bug reports concerning the Shibboleth part to
Lukas Haemmerle <haemmerle@switch.ch>
--------------------------------------------------------------------------------
+8 -11
View File
@@ -1,17 +1,14 @@
<?php
// Set default values
$pluginconfig = get_config('auth/shibboleth');
// Set default values
$pluginconfig = get_config('auth/shibboleth');
if (!isset($config->auth_instructions) or empty($pluginconfig->shib_user_attribute)) {
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/shib-protected.php');
}
if (!isset($config->auth_instructions) or empty($pluginconfig->shib_user_attribute)) {
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/shib-protected.php');
}
optional_variable($pluginconfig->user_attribute, '');
optional_variable($pluginconfig->convert_data, '');
if (!isset ($pluginconfig->user_attribute)) {
$pluginconfig->user_attribute = '';
}
if (!isset ($pluginconfig->convert_data)) {
$pluginconfig->convert_data = '';
}
?>
<tr>
<td colspan="3" align="left">
+3 -12
View File
@@ -4,7 +4,7 @@
require('../../config.php');
require('lib.php');
if (isloggedin() && $USER->username != 'guest') { // Nothing to do
if (isloggedin()) { // Nothing to do
redirect($CFG->wwwroot.'/index.php');
}
@@ -12,8 +12,8 @@
// Check whether Shibboleth is configured properly
if (empty($pluginconfig->shib_user_attribute)) {
error(get_string( 'shib_not_set_up_error', 'auth'));
}
error('Shibboleth authentication (\'shib_user_attribute\') is not set up correctly. You probably haven\'t yet configured the Shibboleth authentication. Please consult the README in moodle/auth/shibboleth for further instructions on how to set up Shibboleth authentication.');
}
/// If we can find the Shibboleth attribute, save it in session and return to main login page
if (!empty($_SERVER[$pluginconfig->shib_user_attribute])) { // Shibboleth auto-login
@@ -50,16 +50,7 @@
redirect($urltogo);
}
}
// If we can find any (user independent) Shibboleth attributes but no user
// attributes we probably didn't receive any user attributes
if ( !empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])
&& empty($_SERVER[$pluginconfig->shib_user_attribute]))
{
error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->shib_user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
}
$SESSION->shibboleth_checked = true; // This will stop us bouncing back here
+9 -7
View File
@@ -26,6 +26,7 @@ function auth_get_userinfo($username) {
// reads user information from shibboleth attributes and return it in array()
global $CFG;
$config = (array)$CFG;
$pluginconfig = get_config('auth/shibboleth');
// Check whether we have got all the essential attributes
@@ -35,7 +36,7 @@ function auth_get_userinfo($username) {
|| empty($_SERVER[$pluginconfig->field_map_lastname])
|| empty($_SERVER[$pluginconfig->field_map_email])
) {
error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$pluginconfig->shib_user_attribute."' ('".$_SERVER[$pluginconfig->shib_user_attribute]."'), '".$pluginconfig->field_map_firstname."' ('".$_SERVER[$pluginconfig->field_map_firstname]."'), '".$pluginconfig->field_map_lastname."' ('".$_SERVER[$pluginconfig->field_map_lastname]."') and '".$pluginconfig->field_map_email."' ('".$_SERVER[$pluginconfig->field_map_email]."')"));
error("Moodle needs certain Shibboleth attributes which are not present in your case. The attributes are: '".$pluginconfig->shib_user_attribute."' ('".$_SERVER[$pluginconfig->shib_user_attribute]."'), '".$pluginconfig->field_map_firstname."' ('".$_SERVER[$pluginconfig->field_map_firstname]."'), '".$pluginconfig->field_map_lastname."' ('".$_SERVER[$pluginconfig->field_map_lastname]."') and '".$pluginconfig->field_map_email."' ('".$_SERVER[$pluginconfig->field_map_email]."')<br>Please contact your Identity Service Provider.");
}
$attrmap = auth_shib_attributes();
@@ -46,18 +47,18 @@ function auth_get_userinfo($username) {
foreach ($attrmap as $key=>$value) {
$result[$key]=utf8_decode($_SERVER[$value]);
}
// Provide an API to modify the information to fit the Moodle internal
// data representation
if (
$pluginconfig->convert_data
&& $pluginconfig->convert_data != ''
&& is_readable($pluginconfig->convert_data)
$config["shib_convert_data"]
&& $config["shib_convert_data"] != ''
&& is_readable($config["shib_convert_data"])
){
// Include a custom file outside the Moodle dir to
// modify the variable $moodleattributes
include($pluginconfig->convert_data);
include($config["shib_convert_data"]);
}
return $result;
@@ -67,6 +68,7 @@ function auth_shib_attributes(){
//returns array containg attribute mappings between Moodle and shibboleth
global $CFG;
$config = (array)$CFG;
$pluginconfig = get_config('auth/shibboleth');
$pluginconfig = (array) $pluginconfig;
@@ -80,7 +82,7 @@ function auth_shib_attributes(){
$moodleattributes[$field] = $pluginconfig["field_map_$field"];
}
}
$moodleattributes['username']=$pluginconfig["shib_user_attribute"];
$moodleattributes['username']=$config["shib_user_attribute"];
return $moodleattributes;
}
+2 -15
View File
@@ -1,19 +1,6 @@
<?php
/*
This file must be Shibboleth protected with something like:
--
<Location ~ "/auth/shibboleth/shib-protected.php">
AuthType shibboleth
ShibRequireSession On
require valid-user
</Location>
--
in your web server configuration.
Consult moodle/auth/shibboleth/README.txt for further instructions.
*/
// This file must be Shibboleth protected
// Consult the README for further instructions
require_once("../../config.php");
header("Location: ".$CFG->wwwroot."/auth/shibboleth/");
+1 -1
View File
@@ -68,7 +68,7 @@ Now I show the specific detailed status of every item in the process:
41. DONE: Add support to forum_track_prefs table. Not necessary. MD. Skipped.
42. DONE: Add user->trackforums (MD did).
43. DONE: Add forum->trackingtype
44. DONE: Review SCORM module. Bug 3404 seems to break restore. Solved by Bobo.
44. TODO: Review SCORM module. Bug 3404 seems to break restore.
45. DONE: Modify QUIZ module restore for pre1.5 courses (Eloy)
46. TODO: Modify QUIZ module 1.5 <==> 1.5 backup & restore (Gustav's team)
47. DONE: Orphan categories thing in quiz module need final solution. Bug 2459 is 95% solved.
+6 -20
View File
@@ -8,10 +8,10 @@
require_once ("backuplib.php");
require_once ("$CFG->libdir/blocklib.php");
$id = optional_param( 'id' ); // course id
$to = optional_param( 'to' ); // id of course to import into afterwards.
$cancel = optional_param( 'cancel' );
$launch = optional_param( 'launch' );
optional_variable($id); // course id
optional_variable($to); // id of course to import into afterwards.
optional_variable($cancel);
optional_variable($launch);
require_login();
@@ -56,20 +56,8 @@
}
$stradministration = get_string("administration");
//If cancel has been selected, go back to course main page (bug 2817)
if ($cancel) {
if ($id) {
$redirecto = $CFG->wwwroot . '/course/view.php?id=' . $id; //Course page
} else {
$redirecto = $CFG->wwwroot;
}
redirect ($redirecto, get_string('backupcancelled')); //Site page
exit;
}
//If no course has been selected, show a list of available courses
if (!$id) {
//If no course has been selected or cancel button pressed
if (!$id or $cancel) {
print_header("$site->shortname: $strcoursebackup", $site->fullname,
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcoursebackup");
@@ -116,8 +104,6 @@
//Call the form, depending the step we are
if (!$launch) {
// if we're at the start, clear the cache of prefs
unset($SESSION->backupprefs[$course->id]);
include_once("backup_form.html");
} else if ($launch == "check") {
include_once("backup_check.html");
+128 -53
View File
@@ -20,16 +20,68 @@
}
}
$backupprefs = new StdClass;
$count = 0;
backup_fetch_prefs_from_request($backupprefs,$count,$course);
//Check site
if (!$site = get_site()) {
error("Site not found!");
}
//Checks for the required files/functions to backup every mod
//And check if there is data about it
$count = 0;
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
$modbackup = $modname."_backup_mods";
$modcheckbackup = $modname."_check_backup_mods";
if (file_exists($modfile)) {
include_once($modfile);
if (function_exists($modbackup) and function_exists($modcheckbackup)) {
$var = "exists_".$modname;
$$var = true;
$count++;
}
}
//Check data
//Check module info
$var = "backup_".$modname;
if (!isset($$var)) {
$$var = 1;
}
//Check include user info
$var = "backup_user_info_".$modname;
if (!isset($$var)) {
$$var = 1;
}
}
}
//Check other parameters
if (!isset($backup_metacourse)) {
$backup_metacourse = 1;
}
if (!isset($backup_users)) {
$backup_users = 1;
}
if (!isset($backup_logs)) {
$backup_logs = 0;
}
if (!isset($backup_user_files)) {
$backup_user_files = 1;
}
if (!isset($backup_course_files)) {
$backup_course_files = 2;
}
if (!isset($backup_messages)) {
$backup_messages = 1;
}
if ($count == 0) {
notice("No backupable modules are installed!");
}
@@ -39,6 +91,46 @@
<table cellpadding="5">
<?php
//Calculate the backup string
//Calculate the backup word
//Take off some characters in the filename !!
$takeoff = array(" ", ":", "/", "\\", "|");
$backup_word = str_replace($takeoff,"_",strtolower(get_string("backupfilename")));
//If non-translated, use "backup"
if (substr($backup_word,0,1) == "[") {
$backup_word= "backup";
}
//Calculate the date format string
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
//If non-translated, use "%Y%m%d-%H%M"
if (substr($backup_date_format,0,1) == "[") {
$backup_date_format = "%%Y%%m%%d-%%H%%M";
}
//Calculate the shortname
$backup_shortname = clean_filename($course->shortname);
if (empty($backup_shortname) or $backup_shortname == '_' ) {
$backup_shortname = $course->id;
}
//Calculate the final backup filename
//The backup word
$backup_name = $backup_word."-";
//The shortname
$backup_name .= strtolower($backup_shortname)."-";
//The date format
$backup_name .= userdate(time(),$backup_date_format,99,false);
//The extension
$backup_name .= ".zip";
//And finally, clean everything
$backup_name = clean_filename($backup_name);
//Calculate the backup unique code to allow simultaneus backups (to define
//the temp-directory name and records in backup temp tables
$backup_unique_code = time();
if (empty($to)) {
//Now print the Backup Name tr
echo "<tr>";
@@ -46,7 +138,7 @@
echo get_string("name").":";
echo "</b></td><td>";
//Add as text field
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backupprefs->backup_name."\" />";
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\" />";
echo "</td></tr>";
//Line
@@ -56,30 +148,32 @@
echo "<tr>";
echo "<td colspan=\"2\" align=\"center\"><b>";
} else {
echo '<input type="hidden" name="backup_name" value="'.$backup_name.'" /></b>';
}
//Here we check if backup_users = None. Then, we switch off every module
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
//inform the user.
if ($backupprefs->backup_users == 2) {
if ($backup_users == 2) {
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$var = "backup_user_info_".$modname;
if (isset($backupprefs->$var)) {
$backupprefs->$var = 0;
if (isset($$var)) {
$$var = 0;
}
$var = "backup_".$modname;
if (isset($backupprefs->$var)) {
if (isset($$var)) {
if ($modname == "exercise" || $modname == "workshop") {
$backupprefs->$var = 0;
$$var = 0;
}
}
}
$backupprefs->backup_user_files = 0;
$backupprefs->backup_logs = 0;
$backupprefs->backup_messages = 0;
$backup_user_files = 0;
$backup_logs = 0;
$backup_messages = 0;
}
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
echo "<hr />";
@@ -96,24 +190,21 @@
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$modfile = $CFG->dirroot.'/mod/'.$modname.'/backuplib.php';
if (!file_exists($modfile)) {
continue;
}
require_once($modfile);
$modbackup = $modname."_backup_mods";
//If exists the lib & function
$var = "exists_".$modname;
if (isset($backupprefs->$var) && $backupprefs->$var) {
if (isset($$var) && $$var) {
$var = "backup_".$modname;
//Only if selected
if ($backupprefs->$var == 1) {
if ($$var == 1) {
//Print the full tr
echo "<tr>";
echo "<td colspan=\"2\">";
//Add hidden fields
$var = "backup_".$modname;
echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\" />";
$var = "backup_user_info_".$modname;
echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\" />";
//Print the mod name
echo "<b>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
//Now look for user-data status
@@ -121,29 +212,10 @@
$backup_user_options[1] = get_string("withuserdata");
$var = "backup_user_info_".$modname;
//Print the user info
echo $backup_user_options[$backupprefs->$var]."</b>";
echo $backup_user_options[$$var]."</b>";
//Call the check function to show more info
$modcheckbackup = $modname."_check_backup_mods";
$var = $modname.'_instances';
$instancestopass = array();
if (!empty($backupprefs->$var) && is_array($backupprefs->$var) && count($backupprefs->$var)) {
$table->data = array();
$countinstances = 0;
foreach ($backupprefs->$var as $instance) {
$var1 = 'backup_'.$modname.'_instance_'.$instance->id;
$var2 = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
if (!empty($backupprefs->$var1)) {
$obj = new StdClass;
$obj->name = $instance->name;
$obj->userdata = $backupprefs->$var2;
$obj->id = $instance->id;
$instancestopass[$instance->id]= $obj;
$countinstances++;
}
}
}
$table->data = $modcheckbackup($id,$backupprefs->$var,$backupprefs->backup_unique_code,$instancestopass);
$table->data = $modcheckbackup($id,$$var,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
@@ -161,16 +233,16 @@
$user_options[0] = get_string("includeallusers");
$user_options[1] = get_string("includecourseusers");
$user_options[2] = get_string("includenoneusers");
echo $user_options[$backupprefs->backup_users].'</b>';
echo $user_options[$backup_users].'</b>';
//Print info
$table->data = user_check_backup($id,$backupprefs->backup_unique_code,$backupprefs->backup_users,$backupprefs->backup_messages);
$table->data = user_check_backup($id,$backup_unique_code,$backup_users,$backup_messages);
print_table($table);
echo "</td></tr>";
}
//Now print the Logs tr conditionally
if ($backupprefs->backup_logs && empty($to)) {
if ($backup_logs && empty($to)) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includelogentries").'</b>';
@@ -181,35 +253,38 @@
}
//Now print the User Files tr conditionally
if ($backupprefs->backup_user_files) {
if ($backup_user_files) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includeuserfiles").'</b>';
//Print info
$table->data = user_files_check_backup($id,$backupprefs->backup_unique_code);
$table->data = user_files_check_backup($id,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
//Now print the Course Files tr conditionally
if ($backupprefs->backup_course_files) {
if ($backup_course_files) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includecoursefiles").'</b>';
//Print info
$table->data = course_files_check_backup($id,$backupprefs->backup_unique_code);
$table->data = course_files_check_backup($id,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
}
// now keep it for next time.
$SESSION->backupprefs[$course->id] = $backupprefs;
?>
</table>
<br />
<center>
<input type="hidden" name="backup_unique_code" value="<?php p($backup_unique_code) ?>" />
<input type="hidden" name="backup_metacourse" value="<?php p($backup_metacourse) ?>" />
<input type="hidden" name="backup_users" value="<?php p($backup_users) ?>" />
<input type="hidden" name="backup_logs" value="<?php p($backup_logs) ?>" />
<input type="hidden" name="backup_user_files" value="<?php p($backup_user_files) ?>" />
<input type="hidden" name="backup_course_files" value="<?php p($backup_course_files) ?>" />
<input type="hidden" name="backup_messages" value="<?php p($backup_messages) ?>" />
<input type="hidden" name="to" value="<?php p($to) ?>" />
<input type="hidden" name="id" value="<?php p($id) ?>" />
<input type="hidden" name="launch" value="execute" />
+91 -10
View File
@@ -26,8 +26,92 @@
error("Site not found!");
}
$preferences = new StdClass;
backup_fetch_prefs_from_request($preferences,$count,$course);
//Checks for the required files/functions to backup every mod
//And check if there is data about it
$count = 0;
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
$modbackup = $modname."_backup_mods";
$modcheckbackup = $modname."_check_backup_mods";
if (file_exists($modfile)) {
include_once($modfile);
if (function_exists($modbackup) and function_exists($modcheckbackup)) {
$var = "exists_".$modname;
$$var = true;
$count++;
}
}
//Check data
//Check module info
$var = "backup_".$modname;
if (!isset($$var)) {
//Every undefined backup_XXXX isn't exported
$$var = 0;
}
//Now stores all the mods preferences into an array into preferences
$preferences->mods[$modname]->backup = $$var;
//Check include user info
$var = "backup_user_info_".$modname;
if (!isset($$var)) {
$$var = 1;
}
//Now stores all the mods preferences into an array into preferences
$preferences->mods[$modname]->userinfo = $$var;
//And the name of the mod
$preferences->mods[$modname]->name = $modname;
}
}
//Check other parameters
if (!isset($backup_metacourse)) {
$backup_metacourse = 1;
}
$preferences->backup_metacourse = $backup_metacourse;
if (!isset($backup_users)) {
$backup_users = 1;
}
$preferences->backup_users = $backup_users;
if (!isset($backup_logs)) {
$backup_logs = 0;
}
$preferences->backup_logs = $backup_logs;
if (!isset($backup_user_files)) {
$backup_user_files = 1;
}
$preferences->backup_user_files = $backup_user_files;
if (!isset($backup_course_files)) {
$backup_course_files = 2;
}
$preferences->backup_course_files = $backup_course_files;
if (!isset($backup_messages)) {
$backup_messages = 1;
}
$preferences->backup_messages = $backup_messages;
if (!isset($id)) {
error ("Course not specified");
}
$preferences->backup_course = $id;
if (!isset($backup_name)) {
error ("Backup name not specified");
}
//We clean it again (to prevent diacritics entered manually)
$preferences->backup_name = clean_filename($backup_name);
if (!isset($backup_unique_code)) {
error ("Backup unique code not specified");
}
$preferences->backup_unique_code = $backup_unique_code;
//Another Info
$preferences->moodle_version = $CFG->version;
$preferences->moodle_release = $CFG->release;
@@ -61,10 +145,10 @@
//Check for temp and backup and backup_unique_code directory
//Create them as needed
echo "<li>".get_string("creatingtemporarystructures").'</li>';
$status = check_and_create_backup_dir($preferences->backup_unique_code);
$status = check_and_create_backup_dir($backup_unique_code);
//Empty dir
if ($status) {
$status = clear_backup_dir($preferences->backup_unique_code);
$status = clear_backup_dir($backup_unique_code);
}
//Delete old_entries from backup tables
@@ -81,7 +165,7 @@
echo "<ul>";
echo "<li>".get_string("writingheader").'</li>';
//Obtain the xml file (create and open) and print prolog information
$backup_file = backup_open_xml($preferences->backup_unique_code);
$backup_file = backup_open_xml($backup_unique_code);
echo "<li>".get_string("writinggeneralinfo").'</li>';
//Prints general info about backup to file
if ($backup_file) {
@@ -127,7 +211,7 @@
echo "</ul></li>";
//User info
if ($status) {
if ($status && $preferences->backup_users) {
echo "<li>".get_string("writinguserinfo").'</li>';
if (!$status = backup_user_info($backup_file,$preferences)) {
notify("An error occurred while backing up user info");
@@ -147,7 +231,6 @@
//questions structure (step 1). See notes on mod/quiz/backuplib.php
if ($status and $preferences->mods['quiz']->backup) {
echo "<li>".get_string("writingcategoriesandquestions").'</li>';
require_once($CFG->dirroot.'/mod/quiz/backuplib.php');
if (!$status = quiz_backup_question_categories($backup_file,$preferences)) {
notify("An error occurred while backing up quiz categories");
}
@@ -318,8 +401,6 @@
}
error_log($filename);
$SESSION->import_preferences = $preferences;
print_continue($CFG->wwwroot.'/course/import/activities/index.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
print_continue($CFG->wwwroot.'/course/import.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
}
$SESSION->backupprefs[$course->id] = null; // unset it so we're clear next time.
?>
+52 -165
View File
@@ -33,7 +33,6 @@
$modname = $mod->name;
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
$modbackup = $modname."_backup_mods";
$modbackupone = $modname.'_backup_one_mod';
$modcheckbackup = $modname."_check_backup_mods";
if (file_exists($modfile)) {
include_once($modfile);
@@ -41,30 +40,46 @@
$var = "exists_".$modname;
$$var = true;
$count++;
// check that there are instances and we can back them up individually
if (count_records('course_modules','course',$course->id,'module',$mod->id) && function_exists($modbackupone)) {
$var = 'exists_one_'.$modname;
$$var = true;
}
}
}
//Check data
//Check module info
$var = "backup_".$modname;
$$var = optional_param( $var,1);
if (!isset($$var)) {
$$var = 1;
}
//Check include user info
$var = "backup_user_info_".$modname;
$$var = optional_param( $var,1);
if (!isset($$var)) {
$$var = 1;
}
}
}
//Check other parameters
$backup_metacourse = optional_param('backup_metacourse',1);
$backup_users = optional_param('backup_users',1);
$backup_logs = optional_param('backup_logs',0);
$backup_user_files = optional_param('backup_user_files',1);
$backup_course_files = optional_param('backup_course_files',1);
$backup_messages = optional_param('backup_messages',1);
if (!isset($backup_metacourse)) {
$backup_metacourse = 1;
}
if (!isset($backup_users)) {
$backup_users = 1;
}
if (!isset($backup_logs)) {
$backup_logs = 0;
}
if (!isset($backup_user_files)) {
$backup_user_files = 1;
}
if (!isset($backup_course_files)) {
$backup_course_files = 1;
}
if (!isset($backup_messages)) {
$backup_messages = 1;
}
if ($count == 0) {
notice("No backupable modules are installed!");
@@ -72,69 +87,10 @@
?>
<script language="JavaScript" type="text/javascript">
<!--
function selectItemInMenuByName(formId, menuName, selectIndex ) {
myForm = document.getElementById(formId)
for (i=0,n=myForm.elements.length;i<n;i++) {
myLen = menuName.length;
myName = myForm.elements[i].name;
myType = myForm.elements[i].type;
if (myName.substring(0,myLen) == menuName && myType == "select-one") {
myForm.elements[i].options[selectIndex].selected = true;
}
}
}
function selectItemInRadioByName(formId, radioName, selectIndex ) {
myForm = document.getElementById(formId)
for (i=0,n=myForm.elements.length;i<n;i++) {
myLen = radioName.length;
myName = myForm.elements[i].name;
myType = myForm.elements[i].type;
if (myName.substring(0,myLen) == radioName && myType == "radio") {
myRadioGroup = myForm.elements[myName];
myRadioGroup[selectIndex].checked = true;
}
}
}
function selectItemInCheckboxByName(formId, checkName, checked ) {
myForm = document.getElementById(formId);
for (i=0,n=myForm.elements.length;i<n;i++) {
myLen = checkName.length;
myName = myForm.elements[i].name;
myType = myForm.elements[i].type;
if (myName.substring(0,myLen) == checkName && myType == "checkbox") {
myForm.elements[i].checked = checked;
}
}
}
-->
</script>
<form name="form1" id="form1" method="post" action="backup.php">
<form name="form" method="post" action="backup.php">
<table cellpadding="5">
<?php
//Now, check modules and info and show posibilities
if ($allmods = get_records("modules") ) {
//Print option to select/deselect everything with 1 click.
echo "<tr>";
echo "<td align=\"right\">";
echo '<b>'.get_string("include").":</b>";
echo "</td><td>";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_', true);\">". get_string("all")."</a>/";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_', false);\">". get_string("none")."</a>";
echo "</td>";
echo "<td align=\"right\">";
echo '<b>&nbsp;</b>';
echo "</td><td>";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_user_info_', true);\">". get_string("all")."</a>/";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'backup_user_info_', false);\">". get_string("none")."</a>";
echo "</td>";
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
$currentrow = 0;
foreach ($allmods as $mod) {
$modname = $mod->name;
$modbackup = $modname."_backup_mods";
@@ -142,61 +98,35 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
$var = "exists_".$modname;
if (isset($$var) && $$var) {
//Print the full tr
echo "<tr class=\"r".$currentrow."\">";
echo " <td align=\"right\">&nbsp;";
echo "</td><td>\n";
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
echo "</b></td><td>";
$backup_options[0] = get_string("no");
$backup_options[1] = get_string("yes");
$var = "backup_".$modname;
//choose_from_menu($backup_options, $var, $$var, "");
//Print the checkbox
print_checkbox($var, $$var, $$var, get_string("modulenameplural",$modname),'','selectItemInCheckboxByName(\'form1\',\'backup_'.$modname.'\',this.checked)');
echo "</td><td align=\"right\">&nbsp;";
echo "</td><td>";
choose_from_menu($backup_options, $var, $$var, "");
$var = "backup_user_info_".$modname;
if (empty($to)) {
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
//choose_from_menu($backup_user_options, $var, $$var, "");
print_checkbox($var, $$var, $$var, get_string("userdata"),'','selectItemInCheckboxByName(\'form1\',\'backup_user_info_'.$modname.'\',this.checked)');
} else {
choose_from_menu($backup_user_options, $var, $$var, "");
}
else {
echo '<input type="hidden" name="'.$var.'" value="0" />';
}
echo "</td></tr>\n";
// if we have the backup_one_mod function, loop here.
$var = 'exists_one_'.$modname;
if (!empty($$var)) {
echo '<tr><td></td><td colspan="3"><table class="backup-form-instances">';
$instances = get_all_instances_in_course($modname,$course);
foreach ($instances as $instance) {
echo '<tr><td>';
$var = 'backup_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,1);
print_checkbox($var,$$var,$$var,$instance->name,$instance->name,'this.form.elements[\'backup_'.$modname.'\'].checked=1;');
echo '</td><td align="right">&nbsp;';
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,1);
if (empty($to)) {
print_checkbox($var,$$var,$$var,get_string('userdata'),'','this.form.elements[\'backup_user_info_'.$modname.'\'].checked=1;');
} else {
echo '<input type="hidden" name="'.$var.'" value="0" />';
}
echo '</td></tr>';
}
echo '</table></td></tr>';
}
echo "</td></tr>";
}
}
//Line
echo "<tr><td colspan=\"4\"><hr /></td></tr>\n";
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
if (empty($to)) {
//Now print the Metacourse tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string ("metacourse").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$meta_options[0] = get_string("no");
$meta_options[1] = get_string("yes");
choose_from_menu($meta_options, "backup_metacourse", $backup_metacourse, "");
@@ -209,9 +139,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
if (empty($to)) {
//Now print the Users tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string("users").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$user_options[0] = get_string("all");
$user_options[1] = get_string("course");
$user_options[2] = get_string("none");
@@ -225,9 +155,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
if (empty($to)) {
//Now print the Logs tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string("logs").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$log_options[0] = get_string("no");
$log_options[1] = get_string("yes");
choose_from_menu($log_options, "backup_logs", $backup_logs, "");
@@ -240,9 +170,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
if (empty($to)) {
//Now print the User Files tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string ("userfiles").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$user_file_options[0] = get_string("no");
$user_file_options[1] = get_string("yes");
choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
@@ -253,9 +183,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
}
//Now print the Course Files tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string ("coursefiles").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");
choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
@@ -264,9 +194,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
if (empty($to) && $course->id == SITEID) {
//If we are in a SITEID backup print the Messages tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string ('messages','message').":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$mess_options[0] = get_string("no");
$mess_options[1] = get_string("yes");
choose_from_menu($mess_options, "backup_messages", $backup_messages, "");
@@ -276,55 +206,12 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo '<input type="hidden" name="backup_messages" value="0" />';
}
}
$backup_unique_code = time();
//Calculate the backup string
//Calculate the backup word
//Take off some characters in the filename !!
$takeoff = array(" ", ":", "/", "\\", "|");
$backup_word = str_replace($takeoff,"_",strtolower(get_string("backupfilename")));
//If non-translated, use "backup"
if (substr($backup_word,0,1) == "[") {
$backup_word= "backup";
}
//Calculate the date format string
$backup_date_format = str_replace(" ","_",get_string("backupnameformat"));
//If non-translated, use "%Y%m%d-%H%M"
if (substr($backup_date_format,0,1) == "[") {
$backup_date_format = "%%Y%%m%%d-%%H%%M";
}
//Calculate the shortname
$backup_shortname = clean_filename($course->shortname);
if (empty($backup_shortname) or $backup_shortname == '_' ) {
$backup_shortname = $course->id;
}
//Calculate the final backup filename
//The backup word
$backup_name = $backup_word."-";
//The shortname
$backup_name .= strtolower($backup_shortname)."-";
//The date format
$backup_name .= userdate(time(),$backup_date_format,99,false);
//The extension
$backup_name .= ".zip";
//And finally, clean everything
$backup_name = clean_filename($backup_name);
//Calculate the backup unique code to allow simultaneus backups (to define
//the temp-directory name and records in backup temp tables
?>
</table>
<br />
<center>
<input type="hidden" name="id" value="<?php p($id) ?>" />
<input type="hidden" name="to" value="<?php p($to) ?>" />
<input type="hidden" name="backup_unique_code" value="<?php p($backup_unique_code); ?>" />
<input type="hidden" name="backup_name" value="<?php p($backup_name); ?>" />
<input type="hidden" name="launch" value="check" />
<input type="submit" value="<?php print_string("continue") ?>" />
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
+17 -37
View File
@@ -363,46 +363,26 @@ function schedule_backup_course_configure($course,$starttime = 0) {
$var = "exists_".$modname;
$$var = true;
$count++;
// PENNY NOTES: I have moved from here to the closing brace inside
// by two sets of ifs()
// to avoid the backup failing on a non existant backup.
// If the file/function/whatever doesn't exist, we don't want to set this
// this module in backup preferences at all.
//Check data
//Check module info
$var = "backup_".$modname;
if (!isset($$var)) {
$$var = $backup_config->backup_sche_modules;
}
//Now stores all the mods preferences into an array into preferences
$preferences->mods[$modname]->backup = $$var;
//Check include user info
$var = "backup_user_info_".$modname;
if (!isset($$var)) {
$$var = $backup_config->backup_sche_withuserdata;
}
//Now stores all the mods preferences into an array into preferences
$preferences->mods[$modname]->userinfo = $$var;
//And the name of the mod
$preferences->mods[$modname]->name = $modname;
}
}
}
}
// now set instances
if ($coursemods = get_course_mods($course->id)) {
foreach ($coursemods as $mod) {
if (array_key_exists($mod->modname,$preferences->mods)) { // we are to backup this module
if (empty($preferences->mods[$mod->modname]->instances)) {
$preferences->mods[$mod->modname]->instances = array(); // avoid warnings
}
$preferences->mods[$mod->modname]->instances[$mod->instance]->backup = $preferences->mods[$modname]->backup;
$preferences->mods[$mod->modname]->instances[$mod->instance]->userinfo = $preferences->mods[$modname]->userinfo;
// there isn't really a nice way to do this...
$preferences->mods[$mod->modname]->instances[$mod->instance]->name = get_field($mod->modname,'name','id',$mod->instance);
//Check data
//Check module info
$var = "backup_".$modname;
if (!isset($$var)) {
$$var = $backup_config->backup_sche_modules;
}
//Now stores all the mods preferences into an array into preferences
$preferences->mods[$modname]->backup = $$var;
//Check include user info
$var = "backup_user_info_".$modname;
if (!isset($$var)) {
$$var = $backup_config->backup_sche_withuserdata;
}
//Now stores all the mods preferences into an array into preferences
$preferences->mods[$modname]->userinfo = $$var;
//And the name of the mod
$preferences->mods[$modname]->name = $modname;
}
}
}
+24 -216
View File
@@ -78,7 +78,7 @@
//Insert the record id. backup_users decide it.
//When all users
$status = insert_record('backup_ids', $backupids_rec, false);
$status = insert_record("backup_ids",$backupids_rec,false,"backup_code");
$count_users++;
}
//Do some output
@@ -271,7 +271,7 @@
$status = execute_sql("INSERT INTO {$CFG->prefix}backup_files
(backup_code, file_type, path, old_id)
VALUES
('$backup_unique_code','user','".addslashes($dir)."','$userid')",false);
('$backup_unique_code','user','$dir','$userid')",false);
}
//Do some output
backup_flush(30);
@@ -315,7 +315,7 @@
$status = execute_sql("INSERT INTO {$CFG->prefix}backup_files
(backup_code, file_type, path)
VALUES
('$backup_unique_code','course','".addslashes($dir)."')",false);
('$backup_unique_code','course','$dir')",false);
}
//Do some output
backup_flush(30);
@@ -414,20 +414,13 @@
}
//Return the xml start tag
function start_tag($tag,$level=0,$endline=false,$attributes=null) {
function start_tag($tag,$level=0,$endline=false) {
if ($endline) {
$endchar = "\n";
} else {
$endchar = "";
}
$attrstring = '';
if (!empty($attributes) && is_array($attributes)) {
foreach ($attributes as $key => $value) {
$attrstring .= " ".xml_tag_safe_content($key)."=\"".
xml_tag_safe_content($value)."\"";
}
}
return str_repeat(" ",$level*2)."<".strtoupper($tag).$attrstring.">".$endchar;
return str_repeat(" ",$level*2)."<".strtoupper($tag).">".$endchar;
}
//Return the xml end tag
@@ -441,37 +434,18 @@
}
//Return the start tag, the contents and the end tag
function full_tag($tag,$level=0,$endline=true,$content,$attributes=null) {
global $CFG;
function full_tag($tag,$level=0,$endline=true,$content,$to_utf=true) {
//Here we encode absolute links
$content = backup_encode_absolute_links($content);
$st = start_tag($tag,$level,$endline,$attributes);
$co = xml_tag_safe_content($content);
$et = end_tag($tag,0,true);
return $st.$co.$et;
}
function xml_tag_safe_content($content) {
global $CFG;
//If enabled, we strip all the control chars from the text but tabs, newlines and returns
//because they are forbiden in XML 1.0 specs. The expression below seems to be
//UTF-8 safe too because it simply ignores the rest of characters.
$content = preg_replace("/(?(?=[[:cntrl:]])[^\n\r\t])/is","",$content);
if (!empty($CFG->unicodedb)) {
// Don't perform the conversion. Contents are Unicode.
$content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
$st = start_tag($tag,$level,$endline);
$co="";
if ($to_utf) {
$co = preg_replace("/\r\n|\r/", "\n", utf8_encode(htmlspecialchars($content)));
} else {
// Perform the conversion. Contents aren't Unicode.
$content = preg_replace("/\r\n|\r/", "\n", utf8_encode(htmlspecialchars($content)));
}
return $content;
$co = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
}
$et = end_tag($tag,0,true);
return $st.$co.$et;
}
//Prints General info about the course
@@ -512,39 +486,13 @@
$included = "true";
if ($element->userinfo) {
$userinfo = "true";
}
}
}
//Prints the mod start
fwrite ($bf,start_tag("MOD",3,true));
fwrite ($bf,full_tag("NAME",4,false,$element->name));
fwrite ($bf,full_tag("INCLUDED",4,false,$included));
fwrite ($bf,full_tag("USERINFO",4,false,$userinfo));
if (is_array($preferences->mods[$element->name]->instances)
&& count($preferences->mods[$element->name]->instances)) {
fwrite ($bf, start_tag("INSTANCES",4,true));
foreach ($preferences->mods[$element->name]->instances as $id => $object) {
if (!empty($object->backup)) {
//Calculate info
$included = "false";
$userinfo = "false";
if ($object->backup) {
$included = "true";
if ($object->userinfo) {
$userinfo = "true";
}
}
fwrite ($bf, start_tag("INSTANCE",5,true));
fwrite ($bf, full_tag("ID",5,false,$id));
fwrite ($bf, full_tag("NAME",5,false,$object->name));
fwrite ($bf, full_tag("INCLUDED",5,false,$included)) ;
fwrite ($bf, full_tag("USERINFO",5,false,$userinfo));
fwrite ($bf, end_tag("INSTANCE",5,true));
}
}
fwrite ($bf, end_tag("INSTANCES",4,true));
}
//Print the end
fwrite ($bf,end_tag("MOD",3,true));
@@ -649,7 +597,6 @@
fwrite ($bf,full_tag("LANG",3,false,$course->lang));
fwrite ($bf,full_tag("THEME",3,false,$course->theme));
fwrite ($bf,full_tag("COST",3,false,$course->cost));
fwrite ($bf,full_tag("CURRENCY",3,false,$course->currency));
fwrite ($bf,full_tag("MARKER",3,false,$course->marker));
fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible));
fwrite ($bf,full_tag("HIDDENSECTIONS",3,false,$course->hiddensections));
@@ -986,14 +933,6 @@
fwrite ($bf,start_tag("MODS",4,true));
$first_record = false;
}
// if we're doing selected instances, check that too.
if (is_array($preferences->mods[$moduletype]->instances)
&& count($preferences->mods[$moduletype]->instances)
&& (!array_key_exists($course_module[$tok]->instance,$preferences->mods[$moduletype]->instances)
|| empty($preferences->mods[$moduletype]->instances[$course_module[$tok]->instance]->backup))) {
$tok = strtok(",");
continue;
}
//Print mod info from course_modules
fwrite ($bf,start_tag("MOD",5,true));
//Save neccesary info to backup_ids
@@ -1660,29 +1599,14 @@
$status = true;
require_once($CFG->dirroot.'/mod/'.$module.'/backuplib.php');
if (is_array($preferences->mods[$module]->instances)) {
$onemodbackup = $module.'_backup_one_mod';
if (function_exists($onemodbackup)) {
foreach ($preferences->mods[$module]->instances as $instance => $object) {
if (!empty($object->backup)) {
$status = $onemodbackup($bf,$preferences,$instance);
}
}
} else {
$status = false;
}
} else { // whole module.
//First, re-check if necessary functions exists
$modbackup = $module."_backup_mods";
if (function_exists($modbackup)) {
//Call the function
$status = $modbackup($bf,$preferences);
} else {
//Something was wrong. Function should exist.
$status = false;
}
//First, re-check if necessary functions exists
$modbackup = $module."_backup_mods";
if (function_exists($modbackup)) {
//Call the function
$status = $modbackup($bf,$preferences);
} else {
//Something was wrong. Function should exist.
$status = false;
}
return $status;
@@ -1726,7 +1650,7 @@
}
if ($result != $content && $CFG->debug>7) { //Debug
echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />'; //Debug
echo "<br /><hr />".$content."<br />changed to<br />".$result."<hr /><br />"; //Debug
} //Debug
return $result;
@@ -1920,120 +1844,4 @@
return $status;
}
/**
* compatibility function
* with new granular backup
* we need to know
*/
function backup_userdata_selected($preferences,$modname,$modid) {
return ((empty($preferences->mods[$modname]->instances)
&& !empty($preferences->mods[$modname]->userinfo))
|| (is_array($preferences->mods[$modname]->instances)
&& array_key_exists($modid,$preferences->mods[$modname]->instances)
&& !empty($preferences->mods[$modname]->instances[$modid]->userinfo)));
}
function backup_mod_selected($preferences,$modname,$modid) {
return ((empty($preferences->mods[$modname]->instances)
&& !empty($preferences->mods[$modname]->backup))
|| (is_array($preferences->mods[$modname]->instances)
&& array_key_exists($modid,$preferences->mods[$modname]->instances)
&& !empty($preferences->mods[$modname]->instances[$modid]->backup)));
}
/*
* Checks for the required files/functions to backup every mod
* And check if there is data about it
*/
function backup_fetch_prefs_from_request(&$preferences,&$count,$course) {
global $CFG,$SESSION;
// check to see if it's in the session already
if (!empty($SESSION->backupprefs) && array_key_exists($course->id,$SESSION->backupprefs) && !empty($SESSION->backupprefs[$course->id])) {
$sprefs = $SESSION->backupprefs[$course->id];
$preferences = $sprefs;
// refetch backup_name just in case.
$bn = optional_param('backup_name','',PARAM_FILE);
if (!empty($bn)) {
$preferences->backup_name = $bn;
}
$count = 1;
return true;
}
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$modfile = "$CFG->dirroot/mod/$modname/backuplib.php";
$modbackup = $modname."_backup_mods";
$modbackupone = $modname."_backup_one_mod";
$modcheckbackup = $modname."_check_backup_mods";
if (!file_exists($modfile)) {
continue;
}
include_once($modfile);
if (!function_exists($modbackup) || !function_exists($modcheckbackup)) {
continue;
}
$var = "exists_".$modname;
$preferences->$var = true;
$count++;
// check that there are instances and we can back them up individually
if (!count_records('course_modules','course',$course->id,'module',$mod->id) || !function_exists($modbackupone)) {
continue;
}
$var = 'exists_one_'.$modname;
$preferences->$var = true;
$varname = $modname.'_instances';
$preferences->$varname = get_all_instances_in_course($modname,$course);
foreach ($preferences->$varname as $instance) {
$preferences->mods[$modname]->instances[$instance->id]->name = $instance->name;
$var = 'backup_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,0);
$preferences->$var = $$var;
$preferences->mods[$modname]->instances[$instance->id]->backup = $$var;
$var = 'backup_user_info_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,0);
$preferences->$var = $$var;
$preferences->mods[$modname]->instances[$instance->id]->userinfo = $$var;
$var = 'backup_'.$modname.'_instances';
$preferences->$var = 1; // we need this later to determine what to display in modcheckbackup.
}
//Check data
//Check module info
$preferences->mods[$modname]->name = $modname;
$var = "backup_".$modname;
$$var = optional_param( $var,0);
$preferences->$var = $$var;
$preferences->mods[$modname]->backup = $$var;
//Check include user info
$var = "backup_user_info_".$modname;
$$var = optional_param( $var,0);
$preferences->$var = $$var;
$preferences->mods[$modname]->userinfo = $$var;
}
}
//Check other parameters
$preferences->backup_metacourse = optional_param('backup_metacourse',1,PARAM_INT);
$preferences->backup_users = optional_param('backup_users',1,PARAM_INT);
$preferences->backup_logs = optional_param('backup_logs',0,PARAM_INT);
$preferences->backup_user_files = optional_param('backup_user_files',1,PARAM_INT);
$preferences->backup_course_files = optional_param('backup_course_files',1,PARAM_INT);
$preferences->backup_messages = optional_param('backup_messages',1,PARAM_INT);
$preferences->backup_course = $course->id;
$preferences->backup_name = required_param('backup_name',PARAM_FILE );
$preferences->backup_unique_code = required_param('backup_unique_code');
// put it (back) in the session
$SESSION->backupprefs[$course->id] = $preferences;
}
?>
+13 -10
View File
@@ -1,9 +1,10 @@
Ziba Scott <ziba@linuxbox.com> 06/23/05
Ziba Scott <ziba@linuxbox.com> 11/19/04
This is a utility to convert Blackboard Course export zip files into
Moodle course export zip files. It has been successfully tested with
Blackboard 5.5 and Moodle 1.4.1 and Moodle CVS. There is minimal
Blackboard 6 support. It will convert:
This is a beta demonstration of a utility to convert Blackboard
Course export zip files into Moodle course export zip files. It
has been successfully tested with Blackboard 5.5 and
Moodle 1.4.1 and Moodle CVS. There is minimal Blackboard 6 support.
It will convert:
* Course Name/Title
* Forum Topics
@@ -11,14 +12,17 @@ Blackboard 6 support. It will convert:
* Assignments
* External Links
The current status of this project is
exploration/proof-of-concept. We have successfully converted
basic Blackboard course information as well as course documents
and forum topics using the XSLT methods described above.
AUTOMATED OPERATION:
REQUIREMENTS FOR WEB INTERFACE:
*Moodle 1.4.1 or greater
*PHP 4.3 compiled with --enable-xslt --with-xslt-sablot options
*PHP compiled with --enable-xslt --with-xslt-sablot options
(Check php.net for instructions on enabling xslt for your platform)
*Alternatively, PHP 5 compiled with xml and xsl support (-with-xsl)
INSTALLATION:
*Unpack this file into the "backup" directory
@@ -32,11 +36,10 @@ MANUAL OPERATION:
*An XSLT 1.0 processor (like Sablotron)
*A zipping utility
REQUIREMENTS FOR COMMAND LINE INTERFACE:
REQUIREMENTS FOR WEB INTERFACE:
*Linux/Unix
*PHP 4 compiled with --enable-xslt --with-xslt-sablot options.
*PHP 5 compiled with -with-xsl and the default xml support left in.
*PHP compiled with --enable-xslt --with-xslt-sablot options.
*Apache with write access to /tmp
*A commandline zipping utility
+24 -91
View File
@@ -1,7 +1,6 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" />
<xsl:template match="/">
<MOODLE_BACKUP>
<INFO>
@@ -55,8 +54,8 @@
</MOD>
<MOD>
<NAME>quiz</NAME>
<INCLUDED>false</INCLUDED>
<USERINFO>false</USERINFO>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>resource</NAME>
@@ -65,18 +64,18 @@
</MOD>
<MOD>
<NAME>scorm</NAME>
<INCLUDED>false</INCLUDED>
<USERINFO>false</USERINFO>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>survey</NAME>
<INCLUDED>false</INCLUDED>
<USERINFO>false</USERINFO>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>wiki</NAME>
<INCLUDED>false</INCLUDED>
<USERINFO>false</USERINFO>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>workshop</NAME>
@@ -85,7 +84,7 @@
</MOD>
<USERS>course</USERS>
<LOGS>false</LOGS>
<USERFILES>false</USERFILES>
<USERFILES>true</USERFILES>
<COURSEFILES>true</COURSEFILES>
</DETAILS>
</INFO>
@@ -149,13 +148,7 @@
<TEACHERS>Teachers</TEACHERS>
<STUDENT>Student</STUDENT>
<STUDENTS>Students</STUDENTS>
<GUEST>
<xsl:choose>
<xsl:when test="FLAGS/ALLOWGUESTS/@value = 'true' ">1</xsl:when>
<xsl:when test="FLAGS/ALLOWGUESTS/@value = 'false' ">0</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</GUEST>
<GUEST>0</GUEST>
<STARTDATE>1094270400</STARTDATE>
<ENROLPERIOD>0</ENROLPERIOD>
<NUMSECTIONS>10</NUMSECTIONS>
@@ -166,13 +159,7 @@
<LANG></LANG>
<COST></COST>
<MARKER>0</MARKER>
<VISIBLE>
<xsl:choose>
<xsl:when test="FLAGS/ISAVAILABLE/@value = 'true' ">1</xsl:when>
<xsl:when test="FLAGS/ISAVAILABLE/@value = 'false' ">0</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</VISIBLE>
<VISIBLE>1</VISIBLE>
<HIDDENSECTIONS>0</HIDDENSECTIONS>
<TIMECREATED>1094240775</TIMECREATED>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
@@ -210,8 +197,7 @@
<VISIBLE>1</VISIBLE>
<MODS>
<xsl:choose>
<xsl:when test="$recurse = 'true'">
<xsl:if test="$recurse = 'true'">
<xsl:variable name="mod_number" select="substring-after(@identifierref,'res')"/>
<xsl:call-template name="item_recurse_files" >
<xsl:with-param name="mod_number" select="$mod_number"/>
@@ -219,11 +205,12 @@
<xsl:with-param name="recurse" select="$recurse" />
</xsl:call-template>
</xsl:when>
</xsl:if>
<xsl:when test="$recurse = 'false'">
<xsl:if test="$recurse = 'false'">
<xsl:for-each select="item">
<xsl:variable name="mod_number" select="substring-after(@identifierref,'res')"/>
<xsl:if test="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value != 'true' or document(concat(@identifierref,'.dat'))/EXTERNALLINK/DESCRIPTION/FLAGS/ISHTML/@value ='true'">
<!-- Create one section-mod -->
<xsl:for-each select="document(concat(@identifierref,'.dat'))">
<xsl:call-template name="section_mod">
@@ -232,9 +219,10 @@
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:if>
</MODS>
</SECTION>
@@ -276,6 +264,7 @@
<xsl:choose>
<!-- Detected one or more files -->
<xsl:when test="CONTENT/FILES/FILEREF/RELFILE/@value != ''">
<!-- Create a label -->
<xsl:call-template name="section_mod_generic">
<xsl:with-param name="mod_number" ><xsl:value-of select="$mod_number"/></xsl:with-param>
@@ -285,12 +274,12 @@
<!-- Create a resource for each file -->
<xsl:for-each select="CONTENT/FILES/FILEREF">
<xsl:call-template name="section_mod_generic">
<xsl:call-template name="section_mod_generic">
<xsl:with-param name="mod_number" ><xsl:value-of select="$mod_number"/>0<xsl:value-of select="position()"/></xsl:with-param>
<xsl:with-param name="indent" select="$indent + 1"/>
<xsl:with-param name="type" >resource</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
@@ -331,16 +320,6 @@
<xsl:with-param name="type" >resource</xsl:with-param>
</xsl:call-template>
</xsl:when>
<!-- Detected staffinfo -->
<xsl:when test="STAFFINFO/COURSEID/@value != '' ">
<!-- Create a resource -->
<xsl:call-template name="section_mod_generic">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
<xsl:with-param name="type" >resource</xsl:with-param>
</xsl:call-template> -->
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
@@ -409,7 +388,6 @@
<!-- Creates one module-file entry -->
<xsl:template name="module_file" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="summary"/>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>resource</MODTYPE>
@@ -423,7 +401,8 @@
<xsl:value-of select="CONTENTID/@value"/>/<xsl:value-of select="RELFILE/@value"/>
</REFERENCE>
<SUMMARY>
<xsl:value-of select="$summary"/>
summary broken
<xsl:value-of select="MAINDATA/TEXT"/>
</SUMMARY>
<ALLTEXT></ALLTEXT>
<POPUP></POPUP>
@@ -432,36 +411,6 @@
</MOD>
</xsl:template>
<!-- Creates one module-text-staffinfo entry -->
<!-- TODO staff photo -->
<xsl:template name="module_text_staffinfo" >
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>resource</MODTYPE>
<NAME>
<xsl:value-of select="CONTACT/NAME/FORMALTITLE/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/GIVEN/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/FAMILY/@value"/>
</NAME>
<TYPE>text</TYPE>
<REFERENCE></REFERENCE>
<SUMMARY>
<xsl:value-of select="CONTACT/NAME/FORMALTITLE/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/GIVEN/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/FAMILY/@value"/>
</SUMMARY>
<ALLTEXT>
Title:<xsl:value-of select="CONTACT/NAME/FORMALTITLE/@value"/>
Given Name:<xsl:value-of select="CONTACT/NAME/GIVEN/@value"/>
Family Name:<xsl:value-of select="CONTACT/NAME/FAMILY/@value"/>
Phone:<xsl:value-of select="CONTACT/PHONE"/>
Office Hours:<xsl:value-of select="CONTACT/OFFICE/HOURS"/>
Office Address:<xsl:value-of select="CONTACT/OFFICE/ADDRESS"/>
Homepage:<xsl:value-of select="HOMEPAGE/@value"/>
</ALLTEXT>
<POPUP></POPUP>
<OPTIONS></OPTIONS>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- Creates one module-text entry -->
<xsl:template name="module_text" >
<xsl:param name="mod_number">1. </xsl:param>
@@ -538,9 +487,6 @@
<xsl:apply-templates select="//EXTERNALLINK">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
<xsl:apply-templates select="//STAFFINFO">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
@@ -560,16 +506,6 @@
</xsl:template>
<!-- Create a STAFFINFO module entry -->
<xsl:template match="STAFFINFO">
<xsl:param name="mod_number">1. </xsl:param>
<!-- Every staffinfo module will have a label module describing it -->
<xsl:call-template name="module_text_staffinfo">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
</xsl:template>
<!-- Create a CONTENT module entry -->
<xsl:template match="CONTENT">
<xsl:param name="mod_number">1. </xsl:param>
@@ -583,12 +519,9 @@
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
<xsl:variable name="summary" select="MAINDATA/TEXT"/>
<xsl:for-each select="FILES/FILEREF">
<xsl:call-template name="module_file">
<xsl:with-param name="mod_number" ><xsl:value-of select="$mod_number"/>0<xsl:value-of select="position()"/></xsl:with-param>
<xsl:with-param name="summary" ><xsl:value-of select="$summary"/></xsl:with-param>
</xsl:call-template>
</xsl:for-each>
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" />
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:template match="/">
<MOODLE_BACKUP>
<INFO>
+1 -2
View File
@@ -3,7 +3,6 @@
// into a Moodle course export. It assumes an unzipped directory and makes in-place alterations.
// Ziba Scott <ziba@linuxbox.com> 10-25-04
require_once('xsl_emulate_xslt.inc');
function get_subdirs($directory){
$opendirectory = opendir( $directory );
@@ -34,7 +33,7 @@ function blackboard_convert($dir){
// Check for a Blackboard manifest file
if (is_readable($dir.'/imsmanifest.xml') && !is_readable($dir.'/moodle.xml')){
if (is_readable($dir.'/imsmanifest.xml')){
if (!function_exists('xslt_create')) { // XSLT MUST be installed for this to work
notify('You need the XSLT library installed in PHP to open this Blackboard file');
-43
View File
@@ -1,43 +0,0 @@
<?php
// This file adds xslt_xxx emulation functions.
// It is intended for systems, e.g. those running PHP 5, where:
// 1) The XSLT library is not installed.
// 2) The XSL library is installed.
//
// Note that not everything is implemented.
// In particular, only the bare minimum to support the BB conversion is here.
// This silliness is required to prevent PHP from evaluating the function() blocks before processing the return;s
if(true) {
if(function_exists('xslt_create')) return; // xslt_create() already exists, so emulation isn't needed.
if(!class_exists('XSLTProcessor')) return; // There is no XSLTProcessor class, so emulation isn't possible.
if(!class_exists('DOMDocument')) return; // There is no DOMDocument class, so emulation isn't possible.
function xslt_create() {
return new XSLTProcessor();
}
// We don't support arguments or parameters because the Bb import doesn't use them
function xslt_process($proc, $xmlfile, $xslfile, $resultfile = null, $unsupported_args = null, $unsupported_params = null) {
$doc = new DOMDocument;
$doc->load($xmlfile);
$xsl = new DOMDocument;
$xsl->load($xslfile);
$proc->importStylesheet($xsl);
// Squash warnings here because xsl complains about COURSE_ACCESS tags which really are invalid XML (multiple root elements)
if($resultfile !== null) {
$fp = fopen($resultfile, 'w');
fwrite($fp, @$proc->transformToXML($doc));
fclose($fp);
return true;
} else {
return @$proc->transformToXML($doc);
}
}
} // end if(true)
-68
View File
@@ -1,68 +0,0 @@
<?
function migrate2utf8_backup_log_info($recordid){
global $CFG;
/// Some trivial checks
if (empty($recordid)) {
log_the_problem_somewhere();
return false;
}
if (!$backuplog = get_record('backup_log', 'id', $recordid)) {
log_the_problem_somewhere();
return false;
}
$sitelang = $CFG->lang;
$courselang = get_course_lang($backuplog->courseid); //Non existing!
$userlang = get_main_teacher_lang($backuplog->courseid); //N.E.!!
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
/// We are going to use textlib facilities
$textlib = textlib_get_instance();
/// Convert the text
$result = $textlib->convert($backuplog->info, $fromenc);
$newbackuplog = new object;
$newbackuplog->id = $recordid;
$newbackuplog->info = $result;
update_record('backup_log',$newbackuplog);
/// And finally, just return the converted field
return $result;
}
function migrate2utf8_backup_ids_info($recordid){
global $CFG;
/// Some trivial checks
if (empty($recordid)) {
log_the_problem_somewhere();
return false;
}
if (!$backupids= get_record('backup_ids', 'id', $recordid)) {
log_the_problem_somewhere();
return false;
}
$sitelang = $CFG->lang;
$courselang = null;
$userlang = null; //N.E.!!
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
/// We are going to use textlib facilities
$textlib = textlib_get_instance();
/// Convert the text
$result = $textlib->convert($backupids->info, $fromenc);
$newbackupids = new object;
$newbackupids->id = $recordid;
$newbackupids->info = $result;
update_record('backup_ids',$newbackupids);
/// And finally, just return the converted field
return $result;
}
?>
-40
View File
@@ -1,40 +0,0 @@
<DBMIGRATION type="backup" VERSION="2005120100">
<TABLES>
<TABLE name="backup_config">
<FIELDS>
<FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex="name (name(255))"/>
<FIELD name="value" method="NO_CONV" type="varchar" length="255" />
</FIELDS>
</TABLE>
<TABLE name="backup_courses">
<FIELDS>
<FIELD name="laststatus" method="NO_CONV" type="char" length="1" />
</FIELDS>
</TABLE>
<TABLE name="backup_files">
<FIELDS>
<FIELD name="file_type" method="NO_CONV" type="varchar" length="10" dropprimary="true" />
<FIELD name="path" method="NO_CONV" type="varchar" length="255" addprimary="(backup_code, file_type(10), path(255))"/>
</FIELDS>
</TABLE>
<TABLE name="backup_ids">
<FIELDS>
<FIELD name="table_name" method="NO_CONV" type="varchar" length="30" dropprimary="true" addprimary="(backup_code, table_name(30), old_id)"/>
<FIELD name="info" method="PHP_FUNCTION" type="mediumtext" length="255">
<PHP_FUNCTION>
migrate2utf8_backup_ids_info(RECORDID)
</PHP_FUNCTION>
</FIELD>
</FIELDS>
</TABLE>
<TABLE name="backup_log">
<FIELDS>
<FIELD name="info" method="PHP_FUNCTION" type="varchar" length="255">
<PHP_FUNCTION>
migrate2utf8_backup_log_info(RECORDID)
</PHP_FUNCTION>
</FIELD>
</FIELDS>
</TABLE>
</TABLES>
</DBMIGRATION>
+1 -32
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//
// This file keeps track of upgrades to Moodle's
// backup/restore utility.
@@ -104,37 +104,6 @@ function backup_upgrade($oldversion=0) {
}
}
if ($oldversion < 2006011600 and $result) {
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_files");
if ($result) {
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_files` (
`id` int(10) unsigned NOT NULL auto_increment,
`backup_code` int(10) unsigned NOT NULL default '0',
`file_type` varchar(10) NOT NULL default '',
`path` varchar(255) NOT NULL default '',
`old_id` int(10) unsigned default NULL,
`new_id` int(10) unsigned default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `backup_files_uk` (`backup_code`,`file_type`,`path`)
) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.'");
}
if ($result) {
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids");
}
if ($result) {
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_ids` (
`id` int(10) unsigned NOT NULL auto_increment,
`backup_code` int(12) unsigned NOT NULL default '0',
`table_name` varchar(30) NOT NULL default '',
`old_id` int(10) unsigned NOT NULL default '0',
`new_id` int(10) unsigned default NULL,
`info` mediumtext,
PRIMARY KEY (`id`),
UNIQUE KEY `backup_ids_uk` (`backup_code` ,`table_name`,`old_id`)
) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore'");
}
}
//Finally, return result
return $result;
+2 -6
View File
@@ -3,14 +3,12 @@
#
CREATE TABLE `prefix_backup_files` (
`id` int(10) unsigned NOT NULL auto_increment,
`backup_code` int(10) unsigned NOT NULL default '0',
`file_type` varchar(10) NOT NULL default '',
`path` varchar(255) NOT NULL default '',
`old_id` int(10) unsigned default NULL,
`new_id` int(10) unsigned default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `backup_files_uk` (`backup_code`,`file_type`,`path`)
PRIMARY KEY (`backup_code`,`file_type`,`path`)
) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.';
# --------------------------------------------------------
@@ -19,14 +17,12 @@ CREATE TABLE `prefix_backup_files` (
#
CREATE TABLE `prefix_backup_ids` (
`id` int(10) unsigned NOT NULL auto_increment,
`backup_code` int(12) unsigned NOT NULL default '0',
`table_name` varchar(30) NOT NULL default '',
`old_id` int(10) unsigned NOT NULL default '0',
`new_id` int(10) unsigned default NULL,
`info` mediumtext,
PRIMARY KEY (`id`),
UNIQUE KEY `backup_ids_uk` (`backup_code` ,`table_name`,`old_id`)
PRIMARY KEY (`backup_code`,`table_name`,`old_id`)
) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore';
# --------------------------------------------------------
+4 -28
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//
// This file keeps track of upgrades to Moodle's
// backup/restore utility.
@@ -23,34 +23,10 @@ function backup_upgrade($oldversion=0) {
$result = true;
if ($oldversion < 2006011600 and $result) {
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_files");
if ($result) {
$result = execute_sql("CREATE TABLE {$CFG->prefix}backup_files (
id SERIAL PRIMARY KEY,
backup_code integer NOT NULL default '0',
file_type varchar(10) NOT NULL default '',
path varchar(255) NOT NULL default '',
old_id integer default NULL,
new_id integer default NULL,
CONSTRAINT backup_files_uk UNIQUE (backup_code, file_type, path))");
}
if ($result) {
$result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids");
}
if ($result) {
$result = execute_sql("CREATE TABLE {$CFG->prefix}backup_ids (
id SERIAL PRIMARY KEY,
backup_code integer NOT NULL default '0',
table_name varchar(30) NOT NULL default '',
old_id integer NOT NULL default '0',
new_id integer default NULL,
info text,
CONSTRAINT backup_ids_uk UNIQUE (backup_code, table_name, old_id))");
}
}
//Finally, return result
return $result;
}
+19 -19
View File
@@ -1,32 +1,35 @@
# THIS FILE IS UNTESTED!!!
# PLEASE HELP TEST/FIX IT AND CONTACT MARTIN OR ELOY!
#
# Table structure for table prefix_backup_files
#
CREATE TABLE prefix_backup_files (
id SERIAL PRIMARY KEY,
backup_code integer NOT NULL default '0',
file_type varchar(10) NOT NULL default '',
path varchar(255) NOT NULL default '',
old_id integer default NULL,
new_id integer default NULL,
CONSTRAINT backup_files_uk UNIQUE (backup_code, file_type, path)
new_id integer default NULL
);
# --------------------------------------------------------
CREATE INDEX prefix_backup_codetypepath_idx ON prefix_backup_files (backup_code,file_type,path);
#
# Table structure for table prefix_backup_ids
#
CREATE TABLE prefix_backup_ids (
id SERIAL PRIMARY KEY,
backup_code integer NOT NULL default '0',
backup_code int8 NOT NULL default '0',
table_name varchar(30) NOT NULL default '',
old_id integer NOT NULL default '0',
new_id integer default NULL,
info text,
CONSTRAINT backup_ids_uk UNIQUE (backup_code, table_name, old_id)
old_id int8 NOT NULL default '0',
new_id int8 default NULL,
info text
);
CREATE INDEX prefix_backup_codenameid_idx ON prefix_backup_ids (backup_code,table_name,old_id);
#
# Table structure for table prefix_backup_config
@@ -38,30 +41,27 @@ CREATE TABLE prefix_backup_config (
value varchar(255) NOT NULL default ''
);
#
# Table structure for table prefix_backup_courses
#
CREATE TABLE prefix_backup_courses (
id SERIAL PRIMARY KEY,
courseid integer UNIQUE NOT NULL default '0',
laststarttime integer NOT NULL default '0',
lastendtime integer NOT NULL default '0',
courseid int8 UNIQUE NOT NULL default '0',
laststarttime int8 NOT NULL default '0',
lastendtime int8 NOT NULL default '0',
laststatus varchar(1) NOT NULL default '0',
nextstarttime integer NOT NULL default '0'
nextstarttime int8 NOT NULL default '0'
);
#
# Table structure for table prefix_backup_log
#
CREATE TABLE prefix_backup_log (
id SERIAL PRIMARY KEY,
courseid integer NOT NULL default '0',
time integer NOT NULL default '0',
laststarttime integer NOT NULL default '0',
courseid int8 NOT NULL default '0',
time int8 NOT NULL default '0',
laststarttime int8 NOT NULL default '0',
info varchar(255) NOT NULL default ''
);
+7 -122
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This file contains all the general function needed (file manipulation...)
//not directly part of the backup/restore utility
@@ -280,7 +280,7 @@
//I've copied it from: http://www.php.net/manual/en/function.copy.php
//Little modifications done
function backup_copy_file ($from_file,$to_file,$log_clam=false) {
function backup_copy_file ($from_file,$to_file) {
global $CFG;
@@ -289,11 +289,8 @@
//$perms=fileperms($from_file);
//return copy($from_file,$to_file) && chmod($to_file,$perms);
umask(0000);
if (copy($from_file,$to_file)) {
chmod($to_file,$CFG->directorypermissions);
if (!empty($log_clam)) {
clam_log_upload($to_file,null,true);
}
if (copy($from_file,$to_file) && chmod($to_file,$CFG->directorypermissions)) {
clam_log_upload($to_file,null,true);
return true;
}
return false;
@@ -430,7 +427,7 @@
$rec->new_id =$new_id;
$rec->info = $info_to_save;
$status = insert_record('backup_ids', $rec, false);
$status = insert_record ("backup_ids", $rec, false,"backup_code");
}
return $status;
}
@@ -497,25 +494,17 @@
//This function is used to check that every necessary function to
//backup/restore exists in the current php installation. Thanks to
//gregb@crowncollege.edu by the idea.
function backup_required_functions($justcheck=false) {
function backup_required_functions() {
if(!function_exists('utf8_encode')) {
if (empty($justcheck)) {
error('You need to add XML support to your PHP installation');
} else {
return false;
}
error('You need to add XML support to your PHP installation');
}
return true;
}
//This function send n white characters to the browser and flush the
//output buffer. Used to avoid browser timeouts and to show the progress.
function backup_flush($n=0,$time=false) {
if (defined('RESTORE_SILENTLY_NOFLUSH')) {
return;
}
if ($time) {
$ti = strftime("%X",time());
} else {
@@ -551,108 +540,4 @@
return ($status && $status2);
}
/** this function will restore an entire backup.zip into the specified course
* using standard moodle backup/restore functions, but silently.
* @param string $pathtofile the absolute path to the backup file.
* @param int $destinationcourse the course id to restore to.
* @param boolean $emptyfirst whether to delete all coursedata first.
* @param boolean $userdata whether to include any userdata that may be in the backup file.
*/
function import_backup_file_silently($pathtofile,$destinationcourse,$emptyfirst=false,$userdata=false) {
global $CFG,$SESSION,$USER; // is there such a thing on cron? I guess so..
if (empty($USER)) {
$USER = get_admin();
$USER->admin = 1; // not sure why, but this doesn't get set
}
define('RESTORE_SILENTLY',true); // don't output all the stuff to us.
$debuginfo = 'import_backup_file_silently: ';
$cleanupafter = false;
$errorstr = ''; // passed by reference to restore_precheck to get errors from.
if (!$course = get_record('course','id',$destinationcourse)) {
mtrace($debuginfo.'Course with id $destinationcourse was not a valid course!');
return false;
}
// first check we have a valid file.
if (!file_exists($pathtofile) || !is_readable($pathtofile)) {
mtrace($debuginfo.'File '.$pathtofile.' either didn\'t exist or wasn\'t readable');
return false;
}
// now make sure it's a zip file
require_once($CFG->dirroot.'/lib/filelib.php');
$filename = substr($pathtofile,strrpos($pathtofile,'/')+1);
$mimetype = mimeinfo("type", $filename);
if ($mimetype != 'application/zip') {
mtrace($debuginfo.'File '.$pathtofile.' was of wrong mimetype ('.$mimetype.')' );
return false;
}
// restore_precheck wants this within dataroot, so lets put it there if it's not already..
if (strstr($pathtofile,$CFG->dataroot) === false) {
// first try and actually move it..
if (!check_dir_exists($CFG->dataroot.'/temp/backup/',true)) {
mtrace($debuginfo.'File '.$pathtofile.' outside of dataroot and couldn\'t move it! ');
return false;
}
if (!copy($pathtofile,$CFG->dataroot.'/temp/backup/'.$filename)) {
mtrace($debuginfo.'File '.$pathtofile.' outside of dataroot and couldn\'t move it! ');
return false;
} else {
$pathtofile = 'temp/backup/'.$filename;
$cleanupafter = true;
}
} else {
// it is within dataroot, so take it off the path for restore_precheck.
$pathtofile = substr($pathtofile,strlen($CFG->dataroot.'/'));
}
if (!backup_required_functions()) {
mtrace($debuginfo.'Required function check failed (see backup_required_functions)');
return false;
}
@ini_set("max_execution_time","3000");
raise_memory_limit("128M");
if (!$backup_unique_code = restore_precheck($destinationcourse,$pathtofile,$errorstr,true)) {
mtrace($debuginfo.'Failed restore_precheck (error was '.$errorstr.')');
return false;
}
restore_setup_for_check($SESSION->restore,$backup_unique_code);
// add on some extra stuff we need...
$SESSION->restore->restoreto = 1;
$SESSION->restore->course_id = $destinationcourse;
$SESSION->restore->deleting = $emptyfirst;
// maybe we need users (defaults to 2 in restore_setup_for_check)
if (!empty($userdata)) {
$SESSION->restore->users = 1;
}
// we also need modules...
if ($allmods = get_records("modules")) {
foreach ($allmods as $mod) {
$modname = $mod->name;
//Now check that we have that module info in the backup file
if (isset($SESSION->info->mods[$modname]) && $SESSION->info->mods[$modname]->backup == "true") {
$SESSION->restore->mods[$modname]->restore = true;
$SESSION->restore->mods[$modname]->userinfo = $userdata;
}
}
}
if (!restore_execute($SESSION->restore,$SESSION->info,$SESSION->course_header,$errorstr)) {
mtrace($debuginfo.'Failed restore_execute (error was '.$errorstr.')');
return false;
}
return true;
}
?>
+1 -1
View File
@@ -4,7 +4,7 @@
require_once("../config.php");
require_once("../backup/lib.php");
$courseid = optional_param('courseid',0,PARAM_INT);
optional_variable($courseid);
require_login();
+6 -6
View File
@@ -14,11 +14,11 @@
require_once("$CFG->libdir/wiki_to_markdown.php" );
//Optional
$id = optional_param( 'id' );
$file = optional_param( 'file' );;
$cancel = optional_param( 'cancel' );
$launch = optional_param( 'launch' );
$to = optional_param( 'to' );
optional_variable($id);
optional_variable($file);
optional_variable($cancel);
optional_variable($launch);
optional_variable($to);
//Check login
require_login();
@@ -112,7 +112,7 @@
//Adjust some php variables to the execution of this script
@ini_set("max_execution_time","3000");
raise_memory_limit("128M");
raise_memory_limit("memory_limit","128M");
//Call the form, depending the step we are
+20 -46
View File
@@ -20,10 +20,13 @@
unset($restore);
}
// check for session objects
if (empty($info) or empty($course_header)) {
error( 'important information missing from SESSION' );
}
//Check required objects from session
//info
require_variable($info);
//course_header
require_variable($course_header);
//If the restore object doesn't exist, we are going
//to check every variable individually and create it
@@ -31,40 +34,33 @@
if (!isset($restore)) {
//Check that we have all we need
//backup_unique_code
$backup_unique_code = required_param( 'backup_unique_code' );
require_variable($backup_unique_code);
//file
$file = required_param( 'file');
require_variable($file);
//Checks for the required restoremod parameters
if ($allmods = get_records("modules")) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$var = "restore_".$modname;
$$var = optional_param( $var,0);
require_variable($$var);
$var = "restore_user_info_".$modname;
$$var = optional_param( $var,0);
$instances = $info->mods[$mod->name]->instances;
foreach ($instances as $instance) {
$var = 'restore_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,0);
$var = 'restore_user_info_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,0);
}
require_variable($$var);
}
}
//restoreto
$restore_restoreto = required_param('restore_restoreto');
require_variable($restore_restoreto);
//restore_metacourse
$restore_metacourse = required_param('restore_metacourse');
require_variable($restore_metacourse);
//restore_users
$restore_users = required_param('restore_users');
require_variable($restore_users);
//restore_logs
$restore_logs = required_param('restore_logs');
require_variable($restore_logs);
//restore_user_files
$restore_user_files = required_param('restore_user_files');
require_variable($restore_user_files);
//restore_course_files
$restore_course_files = required_param('restore_course_files');
require_variable($restore_course_files);
//restore_messages
$restore_messages = required_param('restore_messages');
require_variable($restore_messages);
//Check we've selected a course
if (!isset($course_id)) {
@@ -82,14 +78,6 @@
$restore->mods[$modname]->restore=$$var;
$var = "restore_user_info_".$modname;
$restore->mods[$modname]->userinfo=$$var;
$instances = $info->mods[$mod->name]->instances;
foreach ($instances as $instance) {
$var = 'restore_'.$modname.'_instance_'.$instance->id;
$restore->mods[$modname]->instances[$instance->id]->restore = $$var;
$var = 'restore_user_info_'.$modname.'_instance_'.$instance->id;
$restore->mods[$modname]->instances[$instance->id]->userinfo = $$var;
}
}
}
$restore->restoreto=$restore_restoreto;
@@ -164,19 +152,11 @@
//Now, select the course if needed
if (($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id == 0) and (iscreator())) {
if ($courses = get_courses("all","c.fullname","c.id,c.fullname,c.shortname,c.visible")) {
if ($courses = get_courses("all","c.fullname","c.id,c.fullname,c.shortname")) {
print_heading(get_string("choosecourse"));
print_simple_box_start("center");
foreach ($courses as $course) {
if (!isteacheredit($course->id)) {
continue;
}
if (empty($course->visible)) {
$optdimmed = ' class="dimmed" ';
} else {
$optdimmed = '';
}
echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">$course->fullname ($course->shortname)</a><br />";
echo "<a href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">$course->fullname ($course->shortname)</a><br />";
}
print_simple_box_end();
} else {
@@ -185,12 +165,6 @@
}
//Checks everything and execute restore
} else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) {
//Final access control check
if ($restore->course_id == 0 and !iscreator()) {
error("You need to be a creator or admin to restore into new course!");
} else if ($restore->course_id != 0 and !isteacheredit($restore->course_id)) {
error("You need to be an edit teacher or admin to restore into selected course!");
}
$show_continue_button = true;
//Check if we've selected any mod's user info and restore->users
//is set to none. Change it to course and inform.
+344 -2
View File
@@ -41,8 +41,350 @@
if (!$site = get_site()) {
error("Site not found!");
}
$errorstr = '';
$status = restore_execute($restore,$info,$course_header,$errorstr);
//Checks for the required files/functions to restore every module
//and include them
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
$modfile = "$CFG->dirroot/mod/$modname/restorelib.php";
//If file exists and we have selected to restore that type of module
if ((file_exists($modfile)) and ($restore->mods[$modname]->restore)) {
include_once($modfile);
}
}
}
//Start the main table
echo "<table cellpadding=\"5\">";
echo "<tr><td>";
//Start the main ul
echo "<ul>";
//Init status
$status = true;
//Localtion of the xml file
$xml_file = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code."/moodle.xml";
//If we've selected to restore into new course
//create it (course)
//Saving conversion id variables into backup_tables
if ($restore->restoreto == 2) {
echo "<li>".get_string("creatingnewcourse");
$oldidnumber = $course_header->course_idnumber;
if (!$status = restore_create_new_course($restore,$course_header)) {
notify("Error while creating the new empty course.");
}
//Print course fullname and shortname and category
if ($status) {
echo "<ul>";
echo "<li>".$course_header->course_fullname." (".$course_header->course_shortname.")".'</li>';
echo "<li>".get_string("category").": ".$course_header->category->name.'</li>';
if (!empty($oldidnumber)) {
echo "<li>".get_string("nomoreidnumber","moodle",$oldidnumber)."</li>";
}
echo "</ul></li>";
//Put the destination course_id
$restore->course_id = $course_header->course_id;
}
} else {
$course = get_record("course","id",$restore->course_id);
if ($course) {
echo "<li>".get_string("usingexistingcourse");
echo "<ul>";
echo "<li>".get_string("from").": ".$course_header->course_fullname." (".$course_header->course_shortname.")".'</li>';
echo "<li>".get_string("to").": ".$course->fullname." (".$course->shortname.")".'</li>';
if (($restore->deleting)) {
echo "<li>".get_string("deletingexistingcoursedata").'</li>';
} else {
echo "<li>".get_string("addingdatatoexisting").'</li>';
}
echo "</ul></li>";
//If we have selected to restore deleting, we do it now.
if ($restore->deleting) {
echo "<li>".get_string("deletingolddata").'</li>';
$status = remove_course_contents($restore->course_id,false) and
delete_dir_contents($CFG->dataroot."/".$restore->course_id,"backupdata");
if ($status) {
//Now , this situation is equivalent to the "restore to new course" one (we
//have a course record and nothing more), so define it as "to new course"
$restore->restoreto = 2;
} else {
notify("An error occurred while deleting some of the course contents.");
}
}
} else {
notify("Error opening existing course.");
$status = false;
}
}
//Now create the course_sections and their associated course_modules
if ($status) {
//Into new course
if ($restore->restoreto == 2) {
echo "<li>".get_string("creatingsections").'</li>';
if (!$status = restore_create_sections($restore,$xml_file)) {
notify("Error creating sections in the existing course.");
}
//Into existing course
} else if ($restore->restoreto == 0 or $restore->restoreto == 1) {
echo "<li>".get_string("checkingsections").'</li>';
if (!$status = restore_create_sections($restore,$xml_file)) {
notify("Error creating sections in the existing course.");
}
//Error
} else {
notify("Neither a new course or an existing one was specified.");
$status = false;
}
}
//Now create users as needed
if ($status and ($restore->users == 0 or $restore->users == 1)) {
echo "<li>".get_string("creatingusers")."<br />";
if (!$status = restore_create_users($restore,$xml_file)) {
notify("Could not restore users.");
}
//Now print info about the work done
if ($status) {
$recs = get_records_sql("select old_id, new_id from {$CFG->prefix}backup_ids
where backup_code = '$restore->backup_unique_code' and
table_name = 'user'");
//We've records
if ($recs) {
$new_count = 0;
$exists_count = 0;
$student_count = 0;
$teacher_count = 0;
$counter = 0;
//Iterate, filling counters
foreach ($recs as $rec) {
//Get full record, using backup_getids
$record = backup_getid($restore->backup_unique_code,"user",$rec->old_id);
if (strpos($record->info,"new") !== false) {
$new_count++;
}
if (strpos($record->info,"exists") !== false) {
$exists_count++;
}
if (strpos($record->info,"student") !== false) {
$student_count++;
} else if (strpos($record->info,"teacher") !== false) {
$teacher_count++;
}
//Do some output
$counter++;
if ($counter % 10 == 0) {
echo ".";
if ($counter % 200 == 0) {
echo "<br />";
}
backup_flush(300);
}
}
//Now print information gathered
echo " (".get_string("new").": ".$new_count.", ".get_string("existing").": ".$exists_count.")";
echo "<ul>";
echo "<li>".get_string("students").": ".$student_count.'</li>';
echo "<li>".get_string("teachers").": ".$teacher_count.'</li>';
echo "</ul>";
} else {
notify("No users were found!");
}
}
}
//Now create metacourse info
if ($status and $restore->metacourse) {
//Only to new courses!
if ($restore->restoreto == 2) {
echo "</li><li>".get_string("creatingmetacoursedata");
if (!$status = restore_create_metacourse($restore,$xml_file)) {
notify("Error creating metacourse in the course.");
}
}
}
//Now create categories and questions as needed (STEP1)
if ($status and ($restore->mods['quiz']->restore)) {
echo "</li><li>".get_string("creatingcategoriesandquestions");
echo "<ul>";
if (!$status = restore_create_questions($restore,$xml_file)) {
notify("Could not restore categories and questions!");
}
echo "</ul></li>";
}
//Now create user_files as needed
if ($status and ($restore->user_files)) {
echo "<li>".get_string("copyinguserfiles");
if (!$status = restore_user_files($restore)) {
notify("Could not restore user files!");
}
//If all is ok (and we have a counter)
if ($status and ($status !== true)) {
//Inform about user dirs created from backup
echo "<ul>";
echo "<li>".get_string("userzones").": ".$status;
echo "</li></ul>";
}
}
//Now create course files as needed
if ($status and ($restore->course_files)) {
echo "</li><li>".get_string("copyingcoursefiles")."</li>";
if (!$status = restore_course_files($restore)) {
notify("Could not restore course files!");
}
//If all is ok (and we have a counter)
if ($status and ($status !== true)) {
//Inform about user dirs created from backup
echo "<ul>";
echo "<li>".get_string("filesfolders").": ".$status;
echo "</ul>";
}
}
//Now create messages as needed
if ($status and ($restore->messages)) {
echo "<li>".get_string("creatingmessagesinfo");
if (!$status = restore_create_messages($restore,$xml_file)) {
notify("Could not restore messages!");
}
echo "</li>";
}
//Now create scales as needed
if ($status) {
echo "<li>".get_string("creatingscales").'</li>';
if (!$status = restore_create_scales($restore,$xml_file)) {
notify("Could not restore custom scales!");
}
}
//Now create groups as needed
if ($status) {
echo "<li>".get_string("creatinggroups").'</li>';
if (!$status = restore_create_groups($restore,$xml_file)) {
notify("Could not restore groups!");
}
}
//Now create events as needed
if ($status) {
echo "<li>".get_string("creatingevents").'</li>';
if (!$status = restore_create_events($restore,$xml_file)) {
notify("Could not restore course events!");
}
}
//Now create course modules as needed
if ($status) {
echo "<li>".get_string("creatingcoursemodules");
if (!$status = restore_create_modules($restore,$xml_file)) {
notify("Could not restore modules!");
}
}
//Now create gradebook as needed -- AFTER modules!!!
if ($status) {
echo "<li>".get_string("creatinggradebook");
if (!$status = restore_create_gradebook($restore,$xml_file)) {
notify("Could not restore gradebook!");
}
}
//Bring back the course blocks -- do it AFTER the modules!!!
if($status) {
//If we are deleting and bringing into a course or making a new course, same situation
if($restore->restoreto == 0 || $restore->restoreto == 2) {
echo '<li>'.get_string('creatingblocks').'</li>';
if (!$status = restore_create_blocks($restore, $info->backup_block_format, $course_header->blockinfo, $xml_file)) {
notify('Error while creating the course blocks');
}
}
}
//Now create log entries as needed
if ($status and ($restore->logs)) {
echo "</li><li>".get_string("creatinglogentries");
if (!$status = restore_create_logs($restore,$xml_file)) {
notify("Could not restore logs!");
}
}
//Now, if all is OK, adjust the instance field in course_modules !!
if ($status) {
echo "</li><li>".get_string("checkinginstances").'</li>';
if (!$status = restore_check_instances($restore)) {
notify("Could not adjust instances in course_modules!");
}
}
//Now, if all is OK, adjust activity events
if ($status) {
echo "<li>".get_string("refreshingevents").'</li>';
if (!$status = restore_refresh_events($restore)) {
notify("Could not refresh events for activities!");
}
}
//Now, if all is OK, adjust inter-activity links
if ($status) {
echo "<li>".get_string("decodinginternallinks");
if (!$status = restore_decode_content_links($restore)) {
notify("Could not refresh events for activities!");
}
}
//Now, with backup files prior to version 2005041100,
//convert all the wiki texts in the course to markdown
if ($status && $restore->backup_version < 2005041100) {
echo "<li>".get_string("convertingwikitomarkdown");
if (!$status = restore_convert_wiki2markdown($restore)) {
notify("Could not convert wiki texts to markdown!");
}
}
//Now if all is OK, update:
// - course modinfo field
// - categories table
// - add user as teacher
if ($status) {
echo "</li><li>".get_string("checkingcourse").'</li>';
//modinfo field
rebuild_course_cache($restore->course_id);
//categories table
$course = get_record("course","id",$restore->course_id);
fix_course_sortorder();
//Make the user a teacher if the course hasn't teachers (bug 2381)
if (!isadmin()) {
if (!$checktea = get_records('user_teachers','course', $restore->course_id)) {
//Add the teacher to the course
$status = add_teacher($USER->id, $restore->course_id);
}
}
}
//Cleanup temps (files and db)
if ($status) {
echo "<li>".get_string("cleaningtempdata").'</li>';
if (!$status = clean_temp_data ($restore)) {
notify("Could not clean up temporary data from files and database");
}
}
//End the main ul
echo "</ul>";
//End the main table
echo "</td></tr>";
echo "</table>";
if (!$status) {
error ("An error has occurred and the restore could not be completed!");
+41 -104
View File
@@ -5,18 +5,18 @@
//capabilities.
//Get objects from session
if (!($info = $SESSION->info)) {
error( 'info object missing from session' );
}
if (!($course_header = $SESSION->course_header)) {
error( 'course_header object missing from session' );
}
$info = $SESSION->info;
$course_header = $SESSION->course_header;
//Check that we have all we need
//backup_unique_code
$backup_unique_code = required_param( 'backup_unique_code' );
require_variable($backup_unique_code);
//file
$file = required_param( 'file' );
require_variable($file);
//info
require_variable($info);
//course_header
require_variable($course_header);
//Check login
require_login();
@@ -114,35 +114,9 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
myLen = menuName.length;
myName = myForm.elements[i].name;
myType = myForm.elements[i].type;
if (myName.substring(0,myLen) == menuName && myType == "select-one") {
if (myName.substring(0,myLen) == menuName && myType == "select-one")
myForm.elements[i].options[selectIndex].selected = true;
}
}
}
function selectItemInRadioByName(formId, radioName, selectIndex ) {
myForm = document.getElementById(formId)
for (i=0,n=myForm.elements.length;i<n;i++) {
myLen = radioName.length;
myName = myForm.elements[i].name;
myType = myForm.elements[i].type;
if (myName.substring(0,myLen) == radioName && myType == "radio") {
myRadioGroup = myForm.elements[myName];
myRadioGroup[selectIndex].checked = true;
}
}
}
function selectItemInCheckboxByName(formId, checkName, checked ) {
myForm = document.getElementById(formId)
for (i=0,n=myForm.elements.length;i<n;i++) {
myLen = checkName.length;
myName = myForm.elements[i].name;
myType = myForm.elements[i].type;
if (myName.substring(0,myLen) == checkName && myType == "checkbox") {
myForm.elements[i].checked = checked;
}
}
}
-->
</script>
@@ -156,7 +130,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("restoreto").":</b>";
echo "</td><td colspan=\"3\">";
echo "</td><td>";
if (isteacheredit($id) and !iscreator()) {
$restore_restoreto_options[0] = get_string("currentcoursedeleting");
$restore_restoreto_options[1] = get_string("currentcourseadding");
@@ -169,30 +143,20 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
choose_from_menu($restore_restoreto_options, "restore_restoreto", $restore_restoreto, "");
echo "</td></tr>";
//Line
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
//Now, check modules and info and show posibilities
if ($allmods = get_records("modules") ) {
//Print option to select/deselect everything with 1 click.
//Print option to select/deselect every "with user info" popup. For Gustav, lol, Eloy :-)
echo "<tr>";
echo "<td align=\"right\">";
echo '<b>'.get_string("include").":</b>";
echo "</td><td>";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'restore_', true);\">".
echo "<td colspan=\"2\" align=\"right\"><font size=\"-1\">";
echo get_string("userdata").":";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInMenuByName('form1', 'restore_user_info_', '1');\">".
get_string("all")."</a>/";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'restore_', false);\">".
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInMenuByName('form1', 'restore_user_info_', '0');\">".
get_string("none")."</a>";
echo "</td>";
echo "<td align=\"right\">";
echo '<b>&nbsp;</b>';
echo "</td><td>";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'restore_user_info_', true);\">".
get_string("all")."</a>/";
echo "<a href=\"javascript:void(0);\" onclick=\"selectItemInCheckboxByName('form1', 'restore_user_info_', false);\">".
get_string("none")."</a>";
echo "</td>";
echo "</font></td>";
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
$currentrow = 0;
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
foreach ($allmods as $mod) {
$modname = $mod->name;
$modrestore = $modname."_restore_mods";
@@ -205,51 +169,25 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
//Now check that we have that module info in the backup file
if (isset($info->mods[$modname]) && $info->mods[$modname]->backup == "true") {
//Print the full tr
echo "<tr class=\"r".$currentrow."\">";
echo "<td align=\"right\">&nbsp;";
echo "</td><td>";
$restore_options[1] = get_string("yes");
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
echo "</b></td><td>";
$restore_options[0] = get_string("no");
//choose_from_menu($restore_options, $restore_var, $$restore_var, "");
//choose_from_radio($restore_options, $restore_var, $$restore_var);
//Print the checkbox
print_checkbox($restore_var, $$restore_var, $$restore_var, get_string("modulenameplural",$modname),'','selectItemInCheckboxByName(\'form1\',\'restore_'.$modname.'\',this.checked)');
$restore_options[1] = get_string("yes");
choose_from_menu($restore_options, $restore_var, $$restore_var, "");
//If backup contains user data, then show menu, else fix it to
//without user data
echo "</td><td align=\"right\">&nbsp;";
echo "</td><td>";
if ($info->mods[$modname]->userinfo == "true") {
$restore_user_options[1] = get_string("yes");
$restore_user_options[0] = get_string("no");
//choose_from_menu($restore_user_options, $user_info_var, $$user_info_var, "");
//choose_from_radio($restore_user_options, $user_info_var, $$user_info_var);
print_checkbox($user_info_var, $$user_info_var, $$user_info_var, get_string("userdata"),'','selectItemInCheckboxByName(\'form1\',\'restore_user_info_'.$modname.'\',this.checked)');
$restore_user_options[0] = get_string("withoutuserdata");
$restore_user_options[1] = get_string("withuserdata");
choose_from_menu($restore_user_options, $user_info_var, $$user_info_var, "");
} else {
//Module haven't userdata
echo get_string("withoutuserdata");
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
}
echo "</td></tr>";
$instances = $info->mods[$modname]->instances;
if (!empty($instances) && is_array($instances)) {
echo '<tr><td></td><td colspan="3"><table class="restore-form-instances">';
foreach ($instances as $instance) {
echo '<tr><td>';
$var = 'restore_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,1);
print_checkbox($var,$$var,$$var,$instance->name,$instance->name,'this.form.elements[\'restore_'.$modname.'\'].checked=1;');
echo '</td><td align="right">&nbsp;';
$var = 'restore_user_info_'.$modname.'_instance_'.$instance->id;
$$var = optional_param($var,1);
if ($info->mods[$modname]->instances[$instance->id]->userinfo == 'true') {
print_checkbox($var,$$var,$$var,get_string('userdata'),'','this.form.elements[\'restore_user_info_'.$modname.'\'].checked=1;');
} else {
echo '<input type="hidden" name="'.$var.'" value="0" />';
}
echo '</td></tr>';
}
echo '</table></td></tr>';
}
} else {
//Module isn't restorable
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\" />";
@@ -265,16 +203,15 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
}
$currentrow = ($currentrow + 1) % 2;
}
//Line
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
//Now print the Metacourse tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string("metacourse").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
//If metacourse are in the backup file, show menu, else fixed to no
if ($info->backup_metacourse == "true") {
$metacourse_options[0] = get_string("no");
@@ -287,9 +224,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
echo "</td></tr>";
//Now print the Users tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string("users").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
//If some user is present in the backup file
if ($info->backup_users == "all" or $info->backup_users == "course") {
//If all users are in the backup file
@@ -308,9 +245,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
//Now print the Logs tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string("logs").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
//If logs are in the backup file, show menu, else fixed to no
if ($info->backup_logs == "true") {
$log_options[0] = get_string("no");
@@ -324,9 +261,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
//Now print the User Files tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string ("userfiles").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
//If user files are in the backup file, show menu, else fixed to no
if ($info->backup_user_files == "true") {
$user_file_options[0] = get_string("no");
@@ -340,9 +277,9 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
//Now print the Course Files tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
echo get_string ("coursefiles").":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"$backup_unique_code\" />";
echo "<input type=\"hidden\" name=\"file\" value=\"$file\" />";
//If course files are in the backup file, show menu, else fixed to no
@@ -358,19 +295,19 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
//Now print the Messages tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<td align=\"right\"><b>";
//This tr is slighty different. Everything becomes hidden if
//we haven't messages is the backup, to avoid confusions to users.
//If messages are in the backup file, show menu, else fixed to no and show nothing
if ($info->backup_messages == "true") {
echo get_string ('messages','message').":";
echo "</b></td><td colspan=\"2\">";
echo "</b></td><td>";
$message_options[0] = get_string("no");
$message_options[1] = get_string("yes");
choose_from_menu($message_options, "restore_messages", $restore_messages, "");
} else {
echo "&nbsp;</b></td><td colspan=\"2\">";
echo "&nbsp;</b></td><td>";
echo "<input type=\"hidden\" name=\"restore_messages\" value=\"0\" />";
}
echo "</td></tr>";
+1 -5
View File
@@ -34,11 +34,7 @@
error("Site not found!");
}
$errorstr = '';
if (!empty($SESSION->restore->importing)) {
define('RESTORE_SILENTLY',true);
}
$status = restore_precheck($id,$file,$errorstr);
$status = restore_precheck($id,$file,!empty($SESSION->restore->importing));
if (!$status) {
error("An error occured");
+157 -915
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -5,6 +5,6 @@
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
$backup_version = 2006011600; // The current version is a date (YYYYMMDDXX)
$backup_version = 2005060300; // The current version is a date (YYYYMMDDXX)
$backup_release = "1.6dev"; // User-friendly version number
$backup_release = "1.5"; // User-friendly version number
@@ -1,25 +1,16 @@
<?php //$Id$
<?PHP //$Id$
class block_activity_modules extends block_list {
function init() {
$this->title = get_string('activities');
$this->version = 2006011300;
$this->version = 2004041000;
}
function get_content() {
global $USER, $CFG;
// TODO: FIX: HACK: (any other tags I should add? :P)
// Hacker's improvised caching scheme: avoid fetching the mod
// data from db if the course format has already fetched them
if(!isset($GLOBALS['modnamesplural']) || !isset($GLOBALS['modnamesused'])) {
require_once($CFG->dirroot.'/course/lib.php');
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
}
else {
$modnamesplural = $GLOBALS['modnamesplural'];
$modnamesused = $GLOBALS['modnamesused'];
}
// This is really NOT pretty, but let's do it simple for now...
global $modnamesused, $modnamesplural;
if($this->content !== NULL) {
return $this->content;
@@ -41,10 +32,6 @@ class block_activity_modules extends block_list {
return $this->content;
}
function applicable_formats() {
return array('all' => true, 'mod' => false, 'my' => false);
}
}
?>
+6 -22
View File
@@ -55,12 +55,6 @@ class block_admin extends block_list {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/log.php?id='.SITEID.'">'.get_string('logs').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/log.gif" height="16" width="16" alt="" />';
if (!empty($CFG->enablestats)) {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/stats.php?course='.SITEID.'">'.get_string('stats').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/stats.gif" height="16" width="16" alt="" />';
}
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/files/index.php?id='.SITEID.'">'.get_string('sitefiles').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/files.gif" height="16" width="16" alt="" />';
@@ -92,9 +86,9 @@ class block_admin extends block_list {
if ($isteacheredit) {
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/edit.gif" height="16" width="16" alt="" />';
if (isediting($this->instance->pageid)) {
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=off&amp;sesskey='.sesskey().'">'.get_string('turneditingoff').'</a>';
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=off">'.get_string('turneditingoff').'</a>';
} else {
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=on&amp;sesskey='.sesskey().'">'.get_string('turneditingon').'</a>';
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=on">'.get_string('turneditingon').'</a>';
}
$this->content->items[]='<a href="edit.php?id='.$this->instance->pageid.'">'.get_string('settings').'</a>';
@@ -126,9 +120,8 @@ class block_admin extends block_list {
$this->content->items[]='<a href="student.php?id='.$this->instance->pageid.'">'.$course->students.'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
} else {
$strchildcourses = get_string('childcourses');
$this->content->items[]='<a href="importstudents.php?id='.$this->instance->pageid.'">'.$strchildcourses.'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/course.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="importstudents.php?id='.$this->instance->pageid.'">'.$course->students.'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="">';
}
if ($course->groupmode || !$course->groupmodeforce) {
$strgroups = get_string('groups');
@@ -142,16 +135,11 @@ class block_admin extends block_list {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'&amp;wdir=/backupdata">'.get_string('restore').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/import.php?id='.$this->instance->pageid.'">'.get_string('import').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/import.php?id='.$this->instance->pageid.'">'.get_string('importdata').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="scales.php?id='.$this->instance->pageid.'">'.get_string('scales').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/scales.gif" height="16" width="16" alt="" />';
if (!empty($CFG->enablestats)) {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/stats.php?course='.$this->instance->pageid.'">'.get_string('stats').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/stats.gif" height="16" width="16" alt="" />';
}
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'</a>';
@@ -201,16 +189,12 @@ class block_admin extends block_list {
$this->content->items[]='<a href="'.$CFG->changepassword.'">'.get_string('changepassword').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
}
if ($CFG->allowunenroll && !$course->metacourse) {
if ($CFG->allowunenroll) {
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
}
}
}
function applicable_formats() {
return array('all' => true, 'mod' => false, 'my' => false);
}
}
?>
+23 -23
View File
@@ -12,8 +12,8 @@ class block_calendar_month extends block_base {
function get_content() {
global $USER, $CFG, $SESSION;
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
optional_variable($_GET['cal_m']);
optional_variable($_GET['cal_y']);
require_once($CFG->dirroot.'/calendar/lib.php');
@@ -25,24 +25,24 @@ class block_calendar_month extends block_base {
$this->content->text = '';
$this->content->footer = '';
// [pj] To me it looks like this if would never be needed, but Penny added it
// when committing the /my/ stuff. Reminder to discuss and learn what it's about.
// It definitely needs SOME comment here!
if (!empty($this->instance->pageid)) {
$courseshown = $this->instance->pageid;
}
else {
$courseshown = SITEID;
}
if (empty($this->instance)) { // Overrides: use no course at all
if($courseshown == SITEID) {
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
// the list of courses it will be grabbing events from.
$filtercourse = NULL;
}
else {
// Forcibly filter events to include only those from the particular course we are in.
$filtercourse = array($courseshown => 1);
$courseshown = false;
$filtercourse = array();
} else {
$courseshown = $this->instance->pageid;
if($courseshown == SITEID) {
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
// the list of courses it will be grabbing events from.
$filtercourse = NULL;
}
else {
// Forcibly filter events to include only those from the particular course we are in.
$filtercourse = array($courseshown => 1);
}
}
// We 'll need this later
@@ -54,15 +54,15 @@ class block_calendar_month extends block_base {
if ($courseshown == SITEID) {
// For the front page
$this->content->text .= calendar_overlib_html();
$this->content->text .= calendar_top_controls('frontpage', array('m' => $cal_m, 'y' => $cal_y));
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
$this->content->text .= calendar_top_controls('frontpage', array('m' => $_GET['cal_m'], 'y' => $_GET['cal_y']));
$this->content->text .= calendar_get_mini($courses, $group, $user, $_GET['cal_m'], $_GET['cal_y']);
// No filters for now
} elseif (!empty($courseshown)) {
// For any other course
$this->content->text .= calendar_overlib_html();
$this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
$this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $_GET['cal_m'], 'y' => $_GET['cal_y']));
$this->content->text .= calendar_get_mini($courses, $group, $user, $_GET['cal_m'], $_GET['cal_y']);
$course = get_record('course', 'id', $this->instance->pageid);
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $course).'</div>';
@@ -8,8 +8,8 @@ class block_calendar_upcoming extends block_base {
function get_content() {
global $USER, $CFG, $SESSION;
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
optional_variable($_GET['cal_m']);
optional_variable($_GET['cal_y']);
require_once($CFG->dirroot.'/calendar/lib.php');
@@ -27,12 +27,8 @@ class block_calendar_upcoming extends block_base {
$this->content->footer = '';
} else {
if (!empty($this->instance->pageid)) {
$courseshown = $this->instance->pageid;
}
else {
$courseshown = SITEID;
}
$courseshown = $this->instance->pageid;
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
'/calendar/view.php?view=upcoming&amp;course='.$courseshown.'">'.
get_string('gotocalendar', 'calendar').'</a>...';
-2
View File
@@ -1,7 +1,5 @@
<?PHP //$Id$
include_once($CFG->dirroot . '/course/lib.php');
class block_course_list extends block_list {
function init() {
$this->title = get_string('courses');
@@ -23,9 +23,6 @@ class block_course_summary extends block_base {
return '';
}
if (empty($this->instance->pageid)) {
$this->instance->pageid = SITEID;
}
$course = get_record('course', 'id', $this->instance->pageid);
$this->content = New stdClass;
-13
View File
@@ -1,13 +0,0 @@
<?
function migrate2utf8_block_instance_configdata($recordid){
global $CFG;
}
function migrate2utf8_block_pinned_configdata($recordid){
global $CFG;
}
?>
-31
View File
@@ -1,31 +0,0 @@
<DBMIGRATION type="blocks" VERSION="2005120100">
<TABLES>
<TABLE name="block">
<FIELDS>
<FIELD name="name" method="NO_CONV" type="varchar" length="40" />
</FIELDS>
</TABLE>
<TABLE name="block_instance">
<FIELDS>
<FIELD name="pagetype" method="NO_CONV" type="varchar" length="20" dropindex="pagetype" addindex="pagetype (pagetype(20))"/>
<FIELD name="position" method="NO_CONV" type="varchar" length="10" />
<FIELD name="configdata" method="PHP_FUNCTION" type="text" length="0">
<PHP_FUNCTION>
migrate2utf8_block_instance_configdata(RECORDID)
</PHP_FUNCTION>
</FIELD>
</FIELDS>
</TABLE>
<TABLE name="block_pinned">
<FIELDS>
<FIELD name="pagetype" method="NO_CONV" type="varchar" length="20" />
<FIELD name="position" method="NO_CONV" type="varchar" length="10" />
<FIELD name="configdata" method="PHP_FUNCTION" type="text" length="0">
<PHP_FUNCTION>
migrate2utf8_block_instance_configdata(RECORDID)
</PHP_FUNCTION>
</FIELD>
</FIELDS>
</TABLE>
</TABLES>
</DBMIGRATION>
+4 -22
View File
@@ -58,7 +58,7 @@ global $CFG;
if(!empty($records)) {
foreach($records as $block) {
$block->multiple = 0;
insert_record('block', $block, false);
insert_record('block', $block);
}
}
@@ -82,7 +82,7 @@ global $CFG;
return false;
}
$records = get_records('course', '','','', 'id, shortname, blockinfo');
$records = get_records('course');
if(!empty($records)) {
foreach($records as $thiscourse) {
// The @ suppresses a notice emitted if there is no : in the string
@@ -98,7 +98,7 @@ global $CFG;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
insert_record('block_instance', $instance, false);
insert_record('block_instance', $instance);
}
}
if(!empty($right)) {
@@ -112,7 +112,7 @@ global $CFG;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
insert_record('block_instance', $instance, false);
insert_record('block_instance', $instance);
}
}
}
@@ -143,24 +143,6 @@ global $CFG;
}
}
if ($oldversion < 2005081600) {
$result = $result && modify_database('',"CREATE TABLE `prefix_block_pinned` (
`id` int(10) not null auto_increment,
`blockid` int(10) not null default '0',
`pagetype` varchar(20) not null default '',
`position` varchar(10) not null default '',
`weight` tinyint(3) not null default '0',
`visible` tinyint(1) not null default '0',
`configdata` text not null default '',
PRIMARY KEY(`id`)
) TYPE=MyISAM;");
}
if ($oldversion < 2005090200) {
execute_sql("ALTER TABLE {$CFG->prefix}block_instance ADD INDEX pagetype (pagetype);",false); // do it silently, in case it's already there from 1.5
modify_database('','ALTER TABLE prefix_block_pinned ADD INDEX pagetype (pagetype);');
}
//Finally, return result
return $result;
}
+1 -16
View File
@@ -24,21 +24,6 @@ CREATE TABLE `prefix_block_instance` (
`visible` tinyint(1) not null default '0',
`configdata` text not null default '',
PRIMARY KEY(`id`),
INDEX pageid(`pageid`),
INDEX pagetype(`pagetype`)
INDEX pageid(`pageid`)
) TYPE=MyISAM;
CREATE TABLE `prefix_block_pinned` (
`id` int(10) not null auto_increment,
`blockid` int(10) not null default '0',
`pagetype` varchar(20) not null default '',
`position` varchar(10) not null default '',
`weight` tinyint(3) not null default '0',
`visible` tinyint(1) not null default '0',
`configdata` text not null default '',
PRIMARY KEY(`id`)
) TYPE=MyISAM;
# --------------------------------------------------------
+5 -30
View File
@@ -59,9 +59,9 @@ global $CFG;
if(!empty($records)) {
foreach($records as $block) {
$block->multiple = 0;
insert_record('block', $block, false);
unset($block->id);
insert_record('block', $block);
}
execute_sql("SELECT setval('{$CFG->prefix}block_id_seq', (SELECT MAX(id) FROM {$CFG->prefix}block), true)");
}
execute_sql("DROP TABLE {$CFG->prefix}blocks");
@@ -81,7 +81,7 @@ global $CFG;
return false;
}
$records = get_records('course', '','','', 'id, shortname, blockinfo');
$records = get_records('course');
if(!empty($records)) {
foreach($records as $thiscourse) {
// The @ suppresses a notice emitted if there is no : in the string
@@ -97,7 +97,7 @@ global $CFG;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
insert_record('block_instance', $instance, false);
insert_record('block_instance', $instance);
}
}
if(!empty($right)) {
@@ -111,7 +111,7 @@ global $CFG;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
insert_record('block_instance', $instance, false);
insert_record('block_instance', $instance);
}
}
}
@@ -138,31 +138,6 @@ global $CFG;
}
}
if ($oldversion < 2005022401 && $result) { // Mass cleanup of bad upgrade scripts
execute_sql("CREATE INDEX {$CFG->prefix}block_instance_pageid_idx ON {$CFG->prefix}block_instance (pageid)",false); // this one should be quiet...
modify_database('','ALTER TABLE prefix_block_instance ALTER pagetype SET DEFAULT \'\'');
modify_database('','ALTER TABLE prefix_block_instance ALTER position SET DEFAULT \'\'');
modify_database('','ALTER TABLE prefix_block_instance ALTER pagetype SET NOT NULL');
modify_database('','ALTER TABLE prefix_block_instance ALTER position SET NOT NULL');
}
if ($oldversion < 2005081600) {
$result = $result && modify_database('',"CREATE TABLE prefix_block_pinned (
id SERIAL8 PRIMARY KEY,
blockid INT8 NOT NULL default 0,
pagetype varchar(20) NOT NULL default '',
position varchar(10) NOT NULL default '',
weight INT NOT NULL default 0,
visible INT NOT NULL default 0,
configdata text NOT NULL default 0
);");
}
if ($oldversion < 2005090200) {
execute_sql("CREATE INDEX {$CFG->prefix}block_instance_pagetype_idx ON {$CFG->prefix}block_instance (pagetype);",false); // do it silently, in case it's already there from 1.5
modify_database('','CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);');
}
//Finally, return result
return $result;
}
+1 -15
View File
@@ -10,7 +10,7 @@ CREATE TABLE prefix_block (
cron INT8 NOT NULL default '0',
lastcron INT8 NOT NULL default '0',
visible int NOT NULL default '1',
multiple int NOT NULL default '0'
multiple int NOT NULL default '1'
) ;
CREATE TABLE prefix_block_instance (
@@ -23,19 +23,5 @@ CREATE TABLE prefix_block_instance (
visible int not null default '0',
configdata text not null default ''
) ;
CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid);
CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (pagetype);
CREATE TABLE prefix_block_pinned (
id SERIAL8 PRIMARY KEY,
blockid INT8 NOT NULL default 0,
pagetype varchar(20) NOT NULL default '',
position varchar(10) NOT NULL default '',
weight INT NOT NULL default 0,
visible INT NOT NULL default 0,
configdata text NOT NULL default 0
) ;
CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);
# --------------------------------------------------------
@@ -118,12 +118,9 @@ class block_glossary_random extends block_base {
// select glossaries to put in dropdown box ...
$glossaries = get_records_select_menu('glossary', 'course='.$this->course->id,'name','id,name');
//format menu texts to avoid html and to filter multilang values
if(!empty($glossaries)) {
foreach($glossaries as $key => $value) {
$glossaries[$key] = strip_tags(format_string($value,true));
}
foreach($glossaries as $key => $value) {
$glossaries[$key] = strip_tags(format_string($value,true));
}
// and select quotetypes to put in dropdown box
-206
View File
@@ -1,206 +0,0 @@
<?php
class block_loancalc extends block_base {
function init() {
$this->title = get_string('loancalc','block_loancalc');
$this->content_type = BLOCK_TYPE_TEXT;
$this->version = 2005022100;
}
function get_content() {
global $CFG;
$calc = $CFG->pixpath.'/i/calc.gif';
$this->content->text = '
<script language="JavaScript">
<!--
function Next()
{
submitScreen("Next");
document.vbankform.submit();
}
function Back()
{
submitScreen("Back");
document.vbankform.submit();
}
function num_format(x) { // format numbers with two digits
sgn = (x < 0);
x = Math.abs(x);
x = Math.floor((x * 100) + .5);
i = 3;
y = "";
while(((i--) > 0) || (x > 0)) {
y = (x % 10) + y;
x = Math.floor(x / 10);
if(i == 1) {
y = "." + y;
}
}
if(sgn) {
y = "-" + y;
}
return(y);
}
function comp(v) { // general entry point for all cases
// convert all entry fields into variables
x = document.vbankform;
pv = parseFloat(x.LOANAMOUNT.value);
lpp = parseFloat(x.LOANPAYPERIOD[x.LOANPAYPERIOD.selectedIndex].value);
if (isNaN(pv) && (v != "pv"))
{
x.LOANAMOUNT.select();
x.LOANAMOUNT.focus();
alert("Numbers only to be entered");
return;
}
fv = parseFloat("0");
yr = parseFloat(x.LOANTERM.value);
if (isNaN(yr) && (v != "np"))
{
x.LOANTERM.select();
x.LOANTERM.focus();
alert("Numbers only to be entered");
return;
}
np = lpp * yr;
pmt = -parseFloat(x.LOANREPAYMENT.value);
if (isNaN(pmt) && (v != "pmt"))
{
x.LOANREPAYMENT.select();
x.LOANREPAYMENT.focus();
alert("Numbers only to be entered");
return;
}
if(x.LOANINTRATE.value == "") {
alert("You must enter an interest rate (ir).");
}
else {
ir = parseFloat(x.LOANINTRATE.value);
if (isNaN(ir))
{
x.LOANINTRATE.select();
x.LOANINTRATE.focus();
alert("Numbers only to be entered");
return;
}
ir = ((ir / lpp) / 100);
// test and compute all cases
if (v == "pv") {
if(ir == 0) {
pv = -(fv + (pmt * np));
}
else {
q1 = Math.pow(1 + ir,-np);
q2 = Math.pow(1 + ir,np);
pv = -(q1 * (fv * ir - pmt + q2 * pmt))/ir;
}
x.LOANAMOUNT.value = num_format(pv);
}
if (v == "np") {
if(ir == 0) {
if(pmt != 0) {
np = - (fv + pv)/pmt;
}
else {
alert("Divide by zero error.");
}
}
else {
np = Math.log((-fv * ir + pmt)/(pmt + ir * pv))/ Math.log(1 + ir);
}
if(np == 0) {
alert("Can\'t compute Number of Periods for the present values.");
}
else {
np = (np / lpp)
if (isNaN(np)) {
alert("The repayment amount is less than the interest. You must increase your repayments to pay off this loan!");
} else {
x.LOANTERM.value = num_format(np);
}
}
}
if (v == "pmt") {
if(ir == 0.0) {
if(np != 0) {
pmt = (fv + pv)/np;
}
else {
alert("Divide by zero error.");
}
}
else {
q = Math.pow(1 + ir,np);
pmt = ((ir * (fv + q * pv))/(-1 + q));
}
x.LOANREPAYMENT.value = num_format(pmt);
}
}
} // function comp
//-->
</script>
<title></title>
</head>
<body>
<h1></h1>
<form method="post" id="vbankform" name="vbankform">
<table>
<tr>
<td colspan="2">'.get_string('amountofloan','block_loancalc').'</td>
</tr>
<tr>
<td><input name="LOANAMOUNT" id="LOANAMOUNT" size="17"></td>
<td><a href="JavaScript:comp(\'pv\');"><img src="'.$calc.'" alt="calculate" border="0"></a></td>
</tr>
<tr>
<td colspan="2">'.get_string('repaymentamount','block_loancalc').'</td>
</tr>
<tr>
<td><input name="LOANREPAYMENT" id="LOANREPAYMENT" size="17"></td>
<td><a href="JavaScript:comp(\'pmt\');"><img src="'.$calc.'" alt="calculate" border="0"></a></td>
</tr>
<tr>
<td colspan="2">'.get_string('loanterm','block_loancalc').'</td>
</tr>
<tr>
<td><input name="LOANTERM" id="LOANTERM" size="17"></td>
<td><a href="JavaScript:comp(\'np\');"><img src="'.$calc.'" alt="calculate" border="0"></a></td>
</tr>
<tr>
<td colspan="2">'.get_string('interestrate','block_loancalc').'</td>
</tr>
<tr>
<td><input name="LOANINTRATE" id="LOANINTRATE" size="17"></td>
<td></td>
</tr>
<tr>
<td colspan="2">'.get_string('repaymentfreq','block_loancalc').'</td>
</tr>
<td>';
$options[52] = get_string('weekly','block_loancalc');
$options[26] = get_string('fortnightly','block_loancalc');
$options[12] = get_string('monthly','block_loancalc');
$this->content->text .= choose_from_menu($options,'LOANPAYPERIOD','12',NULL,NULL,NULL,true);
$this->content->text .= '</td>
<td></td>
</tr>
</table>
</form>';
return $this->content;
}
}
?>
+6 -10
View File
@@ -27,20 +27,16 @@ class block_login extends block_base {
$wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
}
if ($CFG->auth == 'email') {
if (is_internal_auth()) {
$signup = $wwwroot . '/login/signup.php';
$forgot = $wwwroot . '/login/forgot_password.php';
} else {
if (!empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})
|| $CFG->changepassword
|| is_internal_auth() ) {
if (is_internal_auth() || !empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})) {
$forgot = $wwwroot . '/login/forgot_password.php';
}
else {
$forgot = $CFG->changepassword;
}
if (!empty($CFG->changepassword)) {
$forgot = $CFG->changepassword;
} else {
$forgot = '';
}
$signup = $wwwroot . '/login/index.php'; // to see instructions!
}
$username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
+10 -1
View File
@@ -37,7 +37,16 @@ class block_messages extends block_base {
if (!empty($users)) {
foreach ($users as $user) {
$this->content->text .= '<div style="text-align: left; font-size: 0.75em; padding-top: 5px;">';
$this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 16, true).' ';
if ($user->picture) {
if ($CFG->slasharguments) {
$imgtag = '<img src="'.$CFG->wwwroot.'/user/pix.php/'.$user->id.'/f2.jpg" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
} else {
$imgtag = '<img src="'.$CFG->wwwroot.'/user/pix.php?file=/'.$user->id.'/f2.jpg" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
}
$this->content->text .= $imgtag;
} else {
$this->content->text .= '<img src="'.$CFG->pixpath.'/i/user.gif" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
}
$timeago = format_time(time() - $user->lastaccess);
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->instance->pageid.'" title="'.$timeago.'">'.fullname($user).'</a>';
$this->content->text .= '&nbsp;<a target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img height="11" width="11" src="'.$CFG->pixpath.'/t/message.gif" alt="" />&nbsp;'.$user->count.'</a>';
+11 -58
View File
@@ -279,16 +279,13 @@ class block_base {
$title = $this->str->show;
}
if (empty($this->instance->pageid)) {
$this->instance->pageid = 0;
}
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey));
$movebuttons .= '<a class="icon hide" title="'. $title .'" href="'.$script.'&amp;blockaction=toggle">' .
'<img src="'. $CFG->pixpath.$icon .'" alt="'.$title.'" /></a>';
if ($options & BLOCK_CONFIGURE && $this->user_can_edit()) {
if ($options & BLOCK_CONFIGURE) {
$movebuttons .= '<a class="icon edit" title="'. $this->str->configure .'" href="'.$script.'&amp;blockaction=config">' .
'<img src="'. $CFG->pixpath .'/t/edit.gif" alt="'. $this->str->configure .'" /></a>';
}
@@ -399,6 +396,8 @@ class block_base {
* @return boolean
*/
function config_save($data) {
// Default behavior: save all variables as $CFG properties
// You don't need to override this if you 're satisfied with the above
foreach ($data as $name => $value) {
set_config($name, $value);
}
@@ -421,6 +420,7 @@ class block_base {
* @return int
*/
function preferred_width() {
// Default case: the block wants to be 180 pixels wide
return 180;
}
@@ -429,15 +429,17 @@ class block_base {
* @return boolean
*/
function hide_header() {
//Default, false--> the header is shown
return false;
}
/**
* Default case: an id with the instance and a class with our name in it
* Default case: just an id for the block, with our name in it
* @return array
* @todo finish documenting this function
*/
function html_attributes() {
// Default case: an id with the instance and a class with our name in it
return array('id' => 'inst'.$this->instance->id, 'class' => 'block_'. $this->name());
}
@@ -527,14 +529,10 @@ class block_base {
* @return boolean
* @todo finish documenting this function
*/
function instance_config_save($data,$pinned=false) {
function instance_config_save($data) {
$data = stripslashes_recursive($data);
$this->config = $data;
$table = 'block_instance';
if (!empty($pinned)) {
$table = 'block_pinned';
}
return set_field($table, 'configdata', base64_encode(serialize($data)), 'id', $this->instance->id);
return set_field('block_instance', 'configdata', base64_encode(serialize($data)), 'id', $this->instance->id);
}
/**
@@ -542,53 +540,8 @@ class block_base {
* @return boolean
* @todo finish documenting this function
*/
function instance_config_commit($pinned=false) {
$table = 'block_instance';
if (!empty($pinned)) {
$table = 'block_pinned';
}
return set_field($table, 'configdata', base64_encode(serialize($this->config)), 'id', $this->instance->id);
}
/**
* Do any additional initialization you may need at the time a new block instance is created
* @return boolean
* @todo finish documenting this function
*/
function instance_create() {
return true;
}
/**
* Delete everything related to this instance if you have been using persistent storage other than the configdata field.
* @return boolean
* @todo finish documenting this function
*/
function instance_delete() {
return true;
}
/**
* Allows the block class to have a say in the user's ability to edit (i.e., configure) blocks of this type.
* The framework has first say in whether this will be allowed (e.g., no editing allowed unless in edit mode)
* but if the framework does allow it, the block can still decide to refuse.
* @return boolean
* @todo finish documenting this function
*/
function user_can_edit() {
return true;
}
/**
* Allows the block class to have a say in the user's ability to create new instances of this block.
* The framework has first say in whether this will be allowed (e.g., no adding allowed unless in edit mode)
* but if the framework does allow it, the block can still decide to refuse.
* This function has access to the complete page object, the creation related to which is being determined.
* @return boolean
* @todo finish documenting this function
*/
function user_can_addto(&$page) {
return true;
function instance_config_commit() {
return set_field('block_instance', 'configdata', base64_encode(serialize($this->config)), 'id', $this->instance->id);
}
}
-3
View File
@@ -22,9 +22,6 @@ class block_news_items extends block_base {
}
if ($this->instance->pageid == 0) {
$this->instance->pageid = SITEID;
}
$course = get_record('course', 'id', $this->instance->pageid);
if ($course->newsitems) { // Create a nice listing of recent postings
+14 -6
View File
@@ -61,8 +61,7 @@ class block_online_users extends block_base {
{$CFG->prefix}user_students s
$groupmembers
WHERE u.id = s.userid $courseselect $groupselect $timeselect
ORDER BY s.timeaccess DESC ".sql_paging_limit(0,20))) {
ORDER BY s.timeaccess DESC")) {
foreach ($students as $student) {
$student->fullname = fullname($student);
$users[$student->id] = $student;
@@ -73,7 +72,7 @@ class block_online_users extends block_base {
if ($siteusers = get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess
FROM {$CFG->prefix}user u
WHERE u.lastaccess > $timefrom AND u.username <> 'guest'
ORDER BY u.lastaccess DESC ".sql_paging_limit(0,20))) {
ORDER BY u.lastaccess DESC")) {
foreach ($siteusers as $siteuser) {
$siteuser->fullname = fullname($siteuser);
$siteuser->timeaccess = $siteuser->lastaccess;
@@ -98,7 +97,7 @@ class block_online_users extends block_base {
//Calculate minutes
$minutes = floor($timetoshowusers/60);
$this->content->text = "<div class=\"message\">(".get_string("periodnminutes","block_online_users",$minutes).")</div>";
$this->content->text = "<center><font size=\"-2\">(".get_string("periodnminutes","block_online_users",$minutes).")</font></center>";
//Now, we have in users, the list of users to show
//Because they are online
@@ -106,7 +105,16 @@ class block_online_users extends block_base {
foreach ($users as $user) {
$this->content->text .= '<div class="listentry">';
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
$this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 16, true).' ';
if ($user->picture) {
if ($CFG->slasharguments) {
$imgtag = '<img src="'.$CFG->wwwroot.'/user/pix.php/'.$user->id.'/f2.jpg" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
} else {
$imgtag = '<img src="'.$CFG->wwwroot.'/user/pix.php?file=/'.$user->id.'/f2.jpg" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
}
$this->content->text .= $imgtag;
} else {
$this->content->text .= '<img src="'.$CFG->pixpath.'/i/user.gif" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
}
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->instance->pageid.'" title="'.$timeago.'">'.$user->fullname.'</a>';
if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging) and !isguest()) { // Only when logged in
$this->content->text .= '&nbsp;<a target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img height="11" width="11" src="'.$CFG->pixpath.'/t/message.gif" alt="" /></a>';
@@ -114,7 +122,7 @@ class block_online_users extends block_base {
$this->content->text .= '</div>';
}
} else {
$this->content->text .= "<div class=\"message\">".get_string("none")."</div>";
$this->content->text .= "<center><font size=\"-1\">".get_string("none")."</font></center>";
}
return $this->content;
+12 -22
View File
@@ -1,7 +1,5 @@
<?php // $Id$
die; //must be fixed before enabling again, see SC#971
// All of this is standard Moodle fixtures
require_once('../config.php');
@@ -121,18 +119,10 @@
// minor tweaks to display the page layout!
// Calculate the preferred width for left, right and center (both center positions will use the same)
if (empty($preferred_width_left)) {
$preferred_width_left = blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]);
}
if (empty($preferred_width_right)) {
$preferred_width_right = blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]);
}
if (empty($preferred_width_centerup)) {
$preferred_width_centerup = blocks_preferred_width($pageblocks[BLOCK_POS_CENTERUP]);
}
if (empty($preferred_width_centerdown)) {
$preferred_width_centerdown = blocks_preferred_width($pageblocks[BLOCK_POS_CENTERDOWN]);
}
optional_variable($preferred_width_left, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]));
optional_variable($preferred_width_right, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]));
optional_variable($preferred_width_centerup, blocks_preferred_width($pageblocks[BLOCK_POS_CENTERUP]));
optional_variable($preferred_width_centerdown, blocks_preferred_width($pageblocks[BLOCK_POS_CENTERDOWN]));
$preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
$preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
$preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
@@ -163,15 +153,15 @@
// The actual display logic is here
echo '<table style="width: 100%;"><tr>';
if(blocks_have_content($pageblocks,BLOCK_POS_LEFT) || $editing) {
if(blocks_have_content($pageblocks[BLOCK_POS_LEFT]) || $editing) {
echo '<td style="vertical-align: top; width: '.$preferred_width_left.'px;">';
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_LEFT);
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_LEFT]);
echo '</td>';
}
echo '<td style="border: 1px black solid; width: '.$preferred_width_center.'px;"><p style="text-align: center; padding: 10px; background: black; color: white;">Center-up position:</p>';
if(blocks_have_content($pageblocks,BLOCK_POS_CENTERUP) || $editing) {
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_CENTERUP);
if(blocks_have_content($pageblocks[BLOCK_POS_CENTERUP]) || $editing) {
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_CENTERUP]);
}
echo '<div style="padding: 10px; background: gold; text-align: center;">Content Here';
@@ -181,14 +171,14 @@
echo '</div>';
echo '<p style="text-align: center; padding: 10px; background: black; color: white;">Center-down position:</p>';
if(blocks_have_content($pageblocks,BLOCK_POS_CENTERDOWN) || $editing) {
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_CENTERDOWN);
if(blocks_have_content($pageblocks[BLOCK_POS_CENTERDOWN]) || $editing) {
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_CENTERDOWN]);
}
echo '</td>';
if(blocks_have_content($pageblocks,BLOCK_POS_RIGHT) || $editing) {
if(blocks_have_content($pageblocks[BLOCK_POS_RIGHT]) || $editing) {
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;">';
blocks_print_group($PAGE, $pageblocks,BLOCK_POS_RIGHT);
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_RIGHT]);
if ($editing) {
blocks_print_adminblock($PAGE, $pageblocks);
}
@@ -23,10 +23,6 @@ class block_participants extends block_list {
$this->content->footer = '';
if (empty($this->instance->pageid)) {
$this->instance->pageid = SITEID;
}
if ($this->instance->pageid != SITEID ||
$CFG->showsiteparticipantslist > 1 ||
($CFG->showsiteparticipantslist == 1 && isteacherinanycourse()) ||
@@ -36,25 +32,11 @@ class block_participants extends block_list {
$CFG->wwwroot.'/user/index.php?id='.$this->instance->pageid.'">'.get_string('participants').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
if (isteacher($this->instance->pageid)) {
$strparticipation = get_string('participationreport');
$this->content->items[] = '<a title="'.$strparticipation.'" href="'.
$CFG->wwwroot.'/course/participation.php?id='.$this->instance->pageid.'">'.$strparticipation.'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
}
}
return $this->content;
}
// my moodle can only have SITEID and it's redundant here, so take it away
function applicable_formats() {
return array('all' => true, 'my' => false);
}
}
?>
+28 -82
View File
@@ -1,16 +1,13 @@
<?php //$Id$
define('B_QUIZRESULTS_NAME_FORMAT_FULL', 1);
define('B_QUIZRESULTS_NAME_FORMAT_ID', 2);
define('B_QUIZRESULTS_NAME_FORMAT_ANON', 3);
define('B_QUIZRESULTS_GRADE_FORMAT_PCT', 1);
define('B_QUIZRESULTS_GRADE_FORMAT_FRA', 2);
define('B_QUIZRESULTS_GRADE_FORMAT_ABS', 3);
define('GRADE_FORMAT_PCT', 1);
define('GRADE_FORMAT_FRA', 2);
define('GRADE_FORMAT_ABS', 3);
class block_quiz_results extends block_base {
function init() {
$this->title = get_string('formaltitle', 'block_quiz_results');
$this->version = 2005082300;
$this->version = 2005012600;
}
function applicable_formats() {
@@ -23,15 +20,15 @@ class block_quiz_results extends block_base {
if ($this->content !== NULL) {
return $this->content;
}
if (empty($this->instance)) {
$this->content = '';
return $this->content;
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
if (empty($this->instance)) {
return $this->content;
}
if($this->instance->pagetype == 'course-view') {
// We need to see if we are monitoring a quiz
$quizid = empty($this->config->quizid) ? 0 : $this->config->quizid;
@@ -81,16 +78,9 @@ class block_quiz_results extends block_base {
$best = array();
$worst = array();
$nameformat = intval(empty($this->config->nameformat) ? B_QUIZRESULTS_NAME_FORMAT_FULL : $this->config->nameformat);
// If the block is configured to operate in group mode, or if the name display format
// is other than "fullname", then we need to retrieve the full course record
if(!empty($this->config->usegroups) || $nameformat != B_QUIZRESULTS_NAME_FORMAT_FULL) {
$course = get_record_select('course', 'id = '.$courseid, 'groupmode, groupmodeforce, student');
}
if(!empty($this->config->usegroups)) {
// The block was configured to operate in group mode
$course = get_record_select('course', 'id = '.$courseid, 'groupmode, groupmodeforce');
if($course->groupmodeforce) {
$groupmode = $course->groupmode;
}
@@ -173,7 +163,7 @@ class block_quiz_results extends block_base {
}
// Ready for output!
$gradeformat = intval(empty($this->config->gradeformat) ? B_QUIZRESULTS_GRADE_FORMAT_PCT : $this->config->gradeformat);
$gradeformat = intval(empty($this->config->gradeformat) ? GRADE_FORMAT_PCT : $this->config->gradeformat);
if($this->instance->pagetype != 'mod-quiz-view') {
// Don't show header and link to the quiz if we ARE at the quiz...
@@ -186,26 +176,16 @@ class block_quiz_results extends block_base {
$this->content->text .= ($numbest == 1?get_string('bestgroupgrade', 'block_quiz_results'):get_string('bestgroupgrades', 'block_quiz_results', $numbest));
$this->content->text .= '</caption><colgroup class="number" /><colgroup class="name" /><colgroup class="grade" /><tbody>';
foreach($best as $groupid => $averagegrade) {
switch($nameformat) {
case B_QUIZRESULTS_NAME_FORMAT_ANON:
case B_QUIZRESULTS_NAME_FORMAT_ID:
$thisname = get_string('group');
break;
default:
case B_QUIZRESULTS_NAME_FORMAT_FULL:
$thisname = '<a href="'.$CFG->wwwroot.'/course/group.php?group='.$groupid.'&amp;id='.$courseid.'">'.$groupgrades[$groupid]['group'].'</a>';
break;
}
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td>'.$thisname.'</td><td>';
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td><a href="'.$CFG->wwwroot.'/course/group.php?group='.$groupid.'&amp;id='.$courseid.'">'.$groupgrades[$groupid]['group'].'</a></td><td>';
switch($gradeformat) {
case B_QUIZRESULTS_GRADE_FORMAT_FRA:
case GRADE_FORMAT_FRA:
$this->content->text .= (format_float($averagegrade,$quiz->decimalpoints).'/'.$quiz->grade);
break;
case B_QUIZRESULTS_GRADE_FORMAT_ABS:
case GRADE_FORMAT_ABS:
$this->content->text .= format_float($averagegrade,$quiz->decimalpoints);
break;
default:
case B_QUIZRESULTS_GRADE_FORMAT_PCT:
case GRADE_FORMAT_PCT:
$this->content->text .= round((float)$averagegrade / (float)$quiz->grade * 100).'%';
break;
}
@@ -221,26 +201,16 @@ class block_quiz_results extends block_base {
$this->content->text .= ($numworst == 1?get_string('worstgroupgrade', 'block_quiz_results'):get_string('worstgroupgrades', 'block_quiz_results', $numworst));
$this->content->text .= '</caption><colgroup class="number" /><colgroup class="name" /><colgroup class="grade" /><tbody>';
foreach($worst as $groupid => $averagegrade) {
switch($nameformat) {
case B_QUIZRESULTS_NAME_FORMAT_ANON:
case B_QUIZRESULTS_NAME_FORMAT_ID:
$thisname = get_string('group');
break;
default:
case B_QUIZRESULTS_NAME_FORMAT_FULL:
$thisname = '<a href="'.$CFG->wwwroot.'/course/group.php?group='.$groupid.'&amp;id='.$courseid.'">'.$groupgrades[$groupid]['group'].'</a>';
break;
}
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td>'.$thisname.'</td><td>';
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td><a href="'.$CFG->wwwroot.'/course/group.php?group='.$groupid.'&amp;id='.$courseid.'">'.$groupgrades[$groupid]['group'].'</a></td><td>';
switch($gradeformat) {
case B_QUIZRESULTS_GRADE_FORMAT_FRA:
case GRADE_FORMAT_FRA:
$this->content->text .= (format_float($averagegrade,$quiz->decimalpoints).'/'.$quiz->grade);
break;
case B_QUIZRESULTS_GRADE_FORMAT_ABS:
case GRADE_FORMAT_ABS:
$this->content->text .= format_float($averagegrade,$quiz->decimalpoints);
break;
default:
case B_QUIZRESULTS_GRADE_FORMAT_PCT:
case GRADE_FORMAT_PCT:
$this->content->text .= round((float)$averagegrade / (float)$quiz->grade * 100).'%';
break;
}
@@ -301,11 +271,11 @@ class block_quiz_results extends block_base {
// Now grab all the users from the database
$userids = array_merge(array_keys($best), array_keys($worst));
$users = get_records_list('user', 'id', implode(',',$userids), '', 'id, firstname, lastname, idnumber');
$users = get_records_list('user', 'id', implode(',',$userids), '', 'id, firstname, lastname');
// Ready for output!
$gradeformat = intval(empty($this->config->gradeformat) ? B_QUIZRESULTS_GRADE_FORMAT_PCT : $this->config->gradeformat);
$gradeformat = intval(empty($this->config->gradeformat) ? GRADE_FORMAT_PCT : $this->config->gradeformat);
if($this->instance->pagetype != 'mod-quiz-view') {
// Don't show header and link to the quiz if we ARE at the quiz...
@@ -318,28 +288,16 @@ class block_quiz_results extends block_base {
$this->content->text .= ($numbest == 1?get_string('bestgrade', 'block_quiz_results'):get_string('bestgrades', 'block_quiz_results', $numbest));
$this->content->text .= '</caption><colgroup class="number" /><colgroup class="name" /><colgroup class="grade" /><tbody>';
foreach($best as $userid => $gradeid) {
switch($nameformat) {
case B_QUIZRESULTS_NAME_FORMAT_ID:
$thisname = $course->student.' '.intval($users[$userid]->idnumber);
break;
case B_QUIZRESULTS_NAME_FORMAT_ANON:
$thisname = $course->student;
break;
default:
case B_QUIZRESULTS_NAME_FORMAT_FULL:
$thisname = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$userid.'&amp;course='.$courseid.'">'.fullname($users[$userid]).'</a>';
break;
}
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td>'.$thisname.'</td><td>';
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td><a href="'.$CFG->wwwroot.'/user/view.php?id='.$userid.'&amp;course='.$courseid.'">'.fullname($users[$userid]).'</a></td><td>';
switch($gradeformat) {
case B_QUIZRESULTS_GRADE_FORMAT_FRA:
case GRADE_FORMAT_FRA:
$this->content->text .= (format_float($grades[$gradeid]->grade,$quiz->decimalpoints).'/'.$quiz->grade);
break;
case B_QUIZRESULTS_GRADE_FORMAT_ABS:
case GRADE_FORMAT_ABS:
$this->content->text .= format_float($grades[$gradeid]->grade,$quiz->decimalpoints);
break;
default:
case B_QUIZRESULTS_GRADE_FORMAT_PCT:
case GRADE_FORMAT_PCT:
if ($quiz->grade) {
$this->content->text .= round((float)$grades[$gradeid]->grade / (float)$quiz->grade * 100).'%';
} else {
@@ -359,28 +317,16 @@ class block_quiz_results extends block_base {
$this->content->text .= ($numworst == 1?get_string('worstgrade', 'block_quiz_results'):get_string('worstgrades', 'block_quiz_results', $numworst));
$this->content->text .= '</caption><colgroup class="number" /><colgroup class="name" /><colgroup class="grade" /><tbody>';
foreach($worst as $userid => $gradeid) {
switch($nameformat) {
case B_QUIZRESULTS_NAME_FORMAT_ID:
$thisname = $course->student.' '.intval($users[$userid]->idnumber);
break;
case B_QUIZRESULTS_NAME_FORMAT_ANON:
$thisname = $course->student;
break;
default:
case B_QUIZRESULTS_NAME_FORMAT_FULL:
$thisname = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$userid.'&amp;course='.$courseid.'">'.fullname($users[$userid]).'</a>';
break;
}
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td>'.$thisname.'</td><td>';
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td><a href="'.$CFG->wwwroot.'/user/view.php?id='.$userid.'&amp;course='.$courseid.'">'.fullname($users[$userid]).'</a></td><td>';
switch($gradeformat) {
case B_QUIZRESULTS_GRADE_FORMAT_FRA:
case GRADE_FORMAT_FRA:
$this->content->text .= (format_float($grades[$gradeid]->grade,$quiz->decimalpoints).'/'.$quiz->grade);
break;
case B_QUIZRESULTS_GRADE_FORMAT_ABS:
case GRADE_FORMAT_ABS:
$this->content->text .= format_float($grades[$gradeid]->grade,$quiz->decimalpoints);
break;
default:
case B_QUIZRESULTS_GRADE_FORMAT_PCT:
case GRADE_FORMAT_PCT:
$this->content->text .= round((float)$grades[$gradeid]->grade / (float)$quiz->grade * 100).'%';
break;
}
+1 -12
View File
@@ -51,24 +51,13 @@
<input name="usegroups" type="radio" id="usegroups_no" <?php if(empty($this->config->usegroups)) echo 'checked="checked"'; ?> value="0" /> <label for="usegroups_no"><?php print_string('no'); ?></label>
</td>
</tr>
<tr valign="top">
<td align="right">
<?php print_string('config_name_format', 'block_quiz_results') ?>
</td>
<td>
<?php
$usenames = array(B_QUIZRESULTS_NAME_FORMAT_FULL => get_string('config_names_full', 'block_quiz_results'), B_QUIZRESULTS_NAME_FORMAT_ID => get_string('config_names_id', 'block_quiz_results'), B_QUIZRESULTS_NAME_FORMAT_ANON => get_string('config_names_anon', 'block_quiz_results'));
choose_from_menu($usenames, 'nameformat', empty($this->config->nameformat) ? B_QUIZRESULTS_NAME_FORMAT_FULL : $this->config->nameformat, '');
?>
</td>
</tr>
<tr valign="top">
<td align="right">
<?php print_string('config_grade_format', 'block_quiz_results') ?>
</td>
<td>
<?php
$formats = array(B_QUIZRESULTS_GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_quiz_results'), B_QUIZRESULTS_GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_quiz_results'), B_QUIZRESULTS_GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_quiz_results'));
$formats = array(GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_quiz_results'), GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_quiz_results'), GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_quiz_results'));
choose_from_menu($formats, 'gradeformat', empty($this->config->gradeformat) ? 0 : $this->config->gradeformat, '');
?>
</td>

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