Compare commits

...

651 Commits

Author SHA1 Message Date
moodler c3155c06af OK, let's call this 1.4.3 2004-12-17 01:40:06 +00:00
mjollnir_ 13f26d69a7 Merged Jon's fixes from HEAD for change password in debug mode. Changes in user/edit.html not present in stable so not patched 2004-12-16 21:32:14 +00:00
bobopinna b8be93026c Delete attribute title from navigation bar link 2004-12-16 17:26:31 +00:00
stronk7 391d1268bd Changes to RSS. SC#23.
Retrofitted from HEAD
2004-12-16 08:45:55 +00:00
stronk7 bbb34b78a6 Added send_file() here. SC#23.
Retrofitted from HEAD
2004-12-16 08:39:15 +00:00
martinlanghoff ff9a78aa55 Several fixes in ipatlas and new param type for clean_param().
- clean_param() now handles PARAM_HOST, which will only let through stuff that looks like a valid IPv4 dotted quad or a FQDN
- SC#10 - Several issues in ipatlas fixed -- though not with elegance :(
- Some short tags expanded

This code needs some love and care.
2004-12-16 05:08:55 +00:00
moodler 0b8d3275d8 Logins and logouts are now logged 2004-12-16 02:10:41 +00:00
defacer 440d3cd360 Merging fix for bug 2285 from HEAD, it works as it should. 2004-12-16 00:41:50 +00:00
skodak 8eca7e454f improved directory handling and PDF compatibility SC#5 2004-12-15 22:18:48 +00:00
skodak 92a89ca210 updated zipping code - see bug #2228 2004-12-15 21:57:13 +00:00
stronk7 01dced7e99 small typo! 2004-12-15 19:59:28 +00:00
moodler 5a5d8c7cf5 Fixed a fairly major problem where none of the guest or key icons
were being shown in abbreviated course listings!  Some fields were
a little over-optimised.  ;-)
2004-12-15 13:31:31 +00:00
bobopinna 50484cd220 Fixed a UTF8-ISO problem 2004-12-15 13:22:46 +00:00
moodler fb97c774fc Fixed a PHP5 notice 2004-12-15 13:20:15 +00:00
moodler a97e45be56 Better check for bad resource name - Found by skodak SC#32 2004-12-15 13:02:48 +00:00
stronk7 01988ca33f Some checks are now done. SC#18. 2004-12-15 09:01:12 +00:00
skodak 4a01c21c53 preparation for new handling of uploaded files (to simplify testing of new code from 1.5dev) 2004-12-14 19:07:16 +00:00
moodler fff09b40c9 Wow, ow, stupid old man!!!
Wrong function name - I changed one site and accidentally tested another!
2004-12-14 11:07:07 +00:00
moodler 41edb82bcd Updated parameter checking to help with bug 2286 2004-12-14 08:51:37 +00:00
moodler 7cf96542da Removed the debug block and turned on the caching since everyone seems happy with it. 2004-12-14 06:36:39 +00:00
martinlanghoff 2c09cb2e12 Fixes bug #2147 http://moodle.org/bugs/bug.php?op=show&bugid=2147
The config.php generated by install.php was missing $CFG->admin -- credit goes to serge.laot@wanadoo.fr for the report and patch.
2004-12-13 07:36:37 +00:00
martinlanghoff 2da759e7cd Post SC#30 fix - SCORM now requires a correct clean_param() - credits go to skodak 2004-12-13 06:41:30 +00:00
martinlanghoff cd8beea5d9 Fixed SC#30 - credits go to skodak 2004-12-13 06:37:57 +00:00
stronk7 da8648b4b5 Some dyslexic problem solved! :-D 2004-12-13 01:30:34 +00:00
stronk7 d1f9ad57d5 Now activity names are sorted by name length to avoid Bug 2282
(http://moodle.org/bugs/bug.php?op=show&bugid=2282)
2004-12-13 01:23:22 +00:00
mjollnir_ 7e334604be Added addslashes back in to username field after splitting it out for lowercasing 2004-12-12 20:43:05 +00:00
stronk7 ec3a195f56 Check added. SC#23 2004-12-12 12:52:55 +00:00
stronk7 651a50567a Some checks added. SC#34. 2004-12-12 12:31:24 +00:00
moodler 86fb3c83db Added fix from SC22 to check arguments better. 2004-12-12 07:08:09 +00:00
moodler 8fcd89c3ab Better checking of arguments (SC28) 2004-12-12 07:00:29 +00:00
moodler 7839870f41 Better error logging in mail when cron is run from command line
(use $FULLME instead of REQUEST_URI)
2004-12-12 06:46:49 +00:00
moodler 4893ee397c Check for a define FULLME instead of global $FULLME SC29 2004-12-12 06:45:44 +00:00
moodler 80ebbb7c08 Change $FULLME to a define, see SC29 2004-12-12 06:45:03 +00:00
moodler b86e528be4 Added a new defined constant to moodlelib.php, to be used by scripts with
php extensions that should not be called directly.  See SC19

Constant:   MOODLE_INTERNAL
2004-12-12 04:30:57 +00:00
stronk7 470dda0aa9 Now search function look into aliases too.
Bug 2242
(http://moodle.org/bugs/bug.php?op=show&bugid=2242)
2004-12-11 00:52:19 +00:00
stronk7 4d1aead12e Skipping empty categories in restore. They shouldn't exist but
I've received some examples of this these days.
2004-12-10 18:25:45 +00:00
moodler c492f5fe27 Adding new caching code here (still disabled) to make testing easier 2004-12-10 17:29:27 +00:00
mjollnir_ 5aeaa64aee Upload users should lowercase username field just as user/edit.php does 2004-12-10 04:15:37 +00:00
bobopinna bdebf9a5ae Fixed an incompatibility with scandir 2004-12-09 14:28:59 +00:00
mchurch 5e36a8315a Modified to ouput proper XHTML - especially if it already was XHTML.
See bug #2230.
2004-12-08 21:58:00 +00:00
moodler 97152c1b88 If the first chat session was a real one with more than one person, then
the logs for it are now displayed in the list of sessions.
2004-12-08 13:45:54 +00:00
moodler 0970dd6a48 Added a temporary hack to disable caching completely again until we can
understand the problem better.

This new line must be removed before 1.4.3.
2004-12-08 03:30:26 +00:00
martinlanghoff 9c21bcd89b Merged from HEAD (originally by gustav_delius)
course.guest was not loaded from database but used in code.
2004-12-07 19:41:55 +00:00
bobopinna 4abde0607d Fixed a missunderstanding coding. Thanks, Mustali 2004-12-06 08:52:00 +00:00
defacer a9615e79cc Merging fix from HEAD for the recently introduced regression
(incorrent usage of optional_parameter())
2004-12-02 19:51:29 +00:00
bobopinna 48da6c3c0c Close all the non implemented datamodel error 2004-12-02 18:17:47 +00:00
bobopinna c8b59fc944 fixed some undefined variables 2004-12-02 17:24:36 +00:00
bobopinna 45f15b5c94 Fixed a problem when were deleted many files or a BIG directory 2004-12-02 13:22:59 +00:00
bobopinna 6ec5d2c298 Forgot two debug printing lines. 2004-12-02 11:07:36 +00:00
bobopinna 04c39c8ded Fixed a problem with packages validation and PHP5 2004-12-02 10:41:43 +00:00
stronk7 9fba045d1a New rss_geterrorxmlfile() function added
and some optional data checked.
2004-12-01 19:49:58 +00:00
skodak 53eddb7b6e Preparation for new file.php, new function get_file_argument() SC#5 2004-11-30 19:37:47 +00:00
stronk7 d5c9d4bac8 Updated to 2.4RC1. This should terminate
some know incompatibilities.
Bug 2234
(http://moodle.org/bugs/bug.php?op=show&bugid=2234)
2004-11-30 17:52:07 +00:00
moodler ab606712ec Wow, bad bug in language editing ... every file had those translator
messages added ... :-/  How did this escape detection for so long?
2004-11-30 03:47:13 +00:00
moodler 7a4df581bf More robust finding of last postid that doesn't depend on order of POST variables 2004-11-30 02:51:56 +00:00
moodler ae5eca6313 FIxed strange bug when returning from a rating to a discussion 2004-11-30 01:41:52 +00:00
stronk7 98e83c1517 Changed some parameters. SC#33. 2004-11-28 23:51:49 +00:00
stronk7 54669cd376 Calculate NEXT course->sortorder in restore to avoid
sortorder grown always (by fix_course_sortorder()).
2004-11-27 23:29:18 +00:00
moodler 3fa6dd59e3 Tiny hack to make $course work OK in file resources (print_header)
Should be replaced with proper global $COURSE in 1.5
2004-11-27 16:03:37 +00:00
moodler 18826234c3 SCORM reports now actually show user pictures 2004-11-26 15:27:29 +00:00
stronk7 02eb71379e Solve some visualisation issues in encyclopedia format. I think that now
it will be correct!
2004-11-26 01:16:16 +00:00
martinlanghoff d9399f4caf Fix for bug 2227 "bug in pclzip.php causing scorm errors"
http://moodle.org/bugs/bug.php?op=show&bugid=2227

Credits go to skodak
2004-11-26 00:54:36 +00:00
mjollnir_ 9430b5a322 In get logs don't join on the user table for just counting the records 2004-11-25 21:56:05 +00:00
martinlanghoff d5cbabd831 Fixed an issue with postgres database upgrade code -- drop either index or constraint if they exist
Merge of patchset arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-430
2004-11-25 00:01:52 +00:00
mjollnir_ 8b34bee9c6 Fixed bug in dialogue where plain text email notification had no break between the url and the ---- that was causing GET requests like mod/dialogue/view.php?id=foo--------- and subsequent invalid sql 2004-11-24 23:50:43 +00:00
stronk7 b9734b5d15 New paging system for glosaries.
100% compatible with Moodle's one.
Supports more options. Perhaps we could use it
sitewide.
2004-11-24 23:27:43 +00:00
mjollnir_ a961a2b851 Fix for postgres-invalid-sql (must have AS between field and alias) 2004-11-24 23:23:09 +00:00
martinlanghoff 6f454ff99a SQL fix:Much better performance in listing and counting all users of courses with groups, plus warnings cleanup
Patchsets
   arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-374 (partial)
   arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-375
2004-11-24 23:11:59 +00:00
martinlanghoff 778f416bd7 Additional fixes for indexes in postgres. A few unique indexes may have been created non-unique. Still deferring the version bump -- please review the patch!
Merge of patchsets
 arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-423
 arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-425
2004-11-24 22:48:16 +00:00
mjollnir_ b9ebeecd11 Removing duplicate index for workshop_grades assessmentid 2004-11-24 21:21:59 +00:00
mjollnir_ a925263bd3 Fixing typo in mysql.sql for unique key for user_teachers on course userid 2004-11-24 18:58:15 +00:00
moodler 38a7def0f0 FIxes to make cache parameter behave more as expected
see: http://moodle.org/mod/forum/discuss.php?d=14818#73912
2004-11-24 07:14:06 +00:00
martinlanghoff 55f21d31e2 raise_memory() now uses get_real_size(), duplicate function return_bytes() removed.
Issue discussed in 2202 (http://moodle.org/bugs/bug.php?op=show&bugid=2202).
Also seen as arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-424
2004-11-24 03:56:09 +00:00
martinlanghoff 7a2596f854 Student and teacher enrolments now unique
Made student and teacher enrolments unique, enforced at the database level. This patch also removes a cleanup job in moodle's cron that removed duplicate enrolments.
The database changes are rolled as part of a version bump that we are *deferring* on MOODLE_14_STABLE.

Merge of patchset  arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-422
2004-11-24 02:20:46 +00:00
mjollnir_ 1a0c7e470b Forum: Do not trust userid from hidden form field, use $USER->id instead for db inserts 2004-11-23 23:34:14 +00:00
mjollnir_ b442f81966 Fix for invalid sql in postgres - don't query log table for what was in log display if log->info is not set 2004-11-23 23:26:49 +00:00
mjollnir_ e74d8b7fbc Requires bump for glossary for last patch - needs db_lowercase and db_uppercase 2004-11-23 23:15:28 +00:00
mjollnir_ 3a4b285549 Bug fix for forum rating redirects - manifested itself in invalid sql in postgres 2004-11-23 23:12:45 +00:00
mjollnir_ c12ab13b7f Fixing use of UCASE and LCASE in glossary which are not postgres friendly - two new functions in datalib, db_uppercase and db_lowercase which return the database-correct functions to use 2004-11-23 22:58:35 +00:00
mjollnir_ c110bf9c4a Attempt to fix bad constraint name in wiki and version bump (honoring partial freeze) and requires bump (needs changes in execute_sql to not show adodb feedback) 2004-11-23 22:40:27 +00:00
moodler c69232269c Robustness in function with empty input 2004-11-23 10:25:35 +00:00
mjollnir_ 0df93edd14 Attempt to fix the unique index on quiz_attemptonlast_datasets for postgres (requires version bump in quiz AND requires bump in quiz for the getting rid of adodb feedback in execute_sql 2004-11-23 04:59:16 +00:00
mjollnir_ 61d5adce1e Backported Martin D's patch to get rid of adodb debug if feedback off in execute_sql to help with trying to fix up the bad constraint in quiz module for postgres 2004-11-23 04:31:47 +00:00
mjollnir_ 7435a34081 Update log_display to use postgres friendly concat functions for firstname lastname (holding off version bump for a day or two for more db changes) 2004-11-23 03:52:51 +00:00
moodler 86fad6838a Fixed HTML code in post.html (ported from HEAD) and some slightly
better checking of 'course' parameter to post.php.

None of this should really make a difference but it MAY help bug 2212
2004-11-23 03:40:32 +00:00
mjollnir_ 0e2d8f7d99 Fixing weird forum bug to do with forum ratings (manifested itself in invalid postgres sql) 2004-11-23 02:49:22 +00:00
moodler 3a42ca4bf7 Updated version with bug fixes (see bug 2179) 2004-11-23 02:46:15 +00:00
mjollnir_ 68d69eb096 More small sql tweaks to avoid invalid postgres sql 2004-11-23 01:58:55 +00:00
mjollnir_ 4eebe5eb59 Fix for invalid sql (for postgres) in cron cleanup of duplicate enrolments. Possibly soon to be overridden by a unique index 2004-11-23 01:04:45 +00:00
martinlanghoff fab2f0b23a Committing backported patch from Pavel (paolo@psychpan.waw.pl). See http://moodle.org/bugs/bug.php?op=show&bugid=2168 2004-11-23 00:02:30 +00:00
martinlanghoff 3729ab341e Fixed extra quote -- html typo -- reported in http://moodle.org/bugs/bug.php?op=show&bugid=2170.
The bug is not present in HEAD.
2004-11-22 23:29:17 +00:00
martinlanghoff b2a07f418c Fixed support in LDAP for apostrophes, quotes and backslashes in LDAP data. This is a backport of a fix already in HEAD.
Discussed in: http://moodle.org/mod/forum/discuss.php?d=15403
2004-11-22 21:51:09 +00:00
mjollnir_ 1cc1fdcd6f Fix for bug #2207 - sortorder now honored in front page listing 2004-11-22 21:29:41 +00:00
moodler eaeafbce15 Fixed bug 2210 - some sesskey variables were missed in this block making
moving of activities in here non-functional - doh!
2004-11-22 14:41:19 +00:00
mjollnir_ a80a5921ca Don't need to select course.* in rebuild course cache 2004-11-22 05:45:58 +00:00
mjollnir_ fdbadd57eb Changes to calls to get_courses to not get all fields 2004-11-22 05:40:45 +00:00
mjollnir_ f8731332d5 Commented out calls for functions that aren't necessary in scale popup display 2004-11-22 05:18:54 +00:00
mjollnir_ 7e8c56795a No need to sort the courses when counting the number of courses using a scale 2004-11-22 05:16:31 +00:00
mjollnir_ 9e903136b6 Optimisation for scales page - cache array of courses for site_scale_used -- Fixed 2004-11-22 05:12:10 +00:00
mjollnir_ 3644b6dca1 Optimisation for scales page - cache array of courses for site_scale_used 2004-11-22 05:05:30 +00:00
mjollnir_ 61f779597d Another fix for getting all fields for all courses - in blocks_get_courses_using_block_by_id 2004-11-22 04:44:14 +00:00
mjollnir_ d13e627af5 Fixes in datalib and backuplib for postgres invalid sql 2004-11-22 04:24:05 +00:00
mjollnir_ 1e47ecd5d9 modify_database function change - if no ; in single line sql strings, add it 2004-11-22 04:10:05 +00:00
martinlanghoff e3da2769b8 Fixed bug in external auth.
Added truncate_userinfo() which ensures data from external auth fits in moodle database fields. Before, user records that did not fit would be dropped silently.

This is a merge from arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-172
2004-11-22 03:43:08 +00:00
mjollnir_ ea77aa0617 Fixed another instance of getting all fields from all courses (in log selector) 2004-11-22 03:34:49 +00:00
mjollnir_ d44af20f37 Fix for calendar set filters to not query the database for groups of a course if it doesn't use groups 2004-11-22 03:15:31 +00:00
mjollnir_ 461a4afe83 Bugfix for search courses in postgres 2004-11-21 22:30:22 +00:00
mjollnir_ 9958e237c3 Indexes for workshop and version bump (honoring partial freeze) 2004-11-21 21:39:56 +00:00
mjollnir_ c26fdb80fb Indexes for wiki and version bump (honoring partial freeze) 2004-11-21 21:07:54 +00:00
mjollnir_ a1c0899be1 Indexes for survey and version bump (honoring partial freeze) 2004-11-21 20:37:31 +00:00
moodler 8a07a15029 Excess sections that are not shown (because the course numsections
are set to less) are now also not shown on the navmenu.
2004-11-21 06:27:01 +00:00
defacer d32ae936e4 Merged DST-related fixes from HEAD. 2004-11-20 20:14:18 +00:00
defacer cd47b250c2 Merging notice removal from HEAD 2004-11-20 19:08:20 +00:00
moodler d94c70cc7b COmbined fix for bug 2199 (course teacher roles) and bug 2200 (course
sortorder)
2004-11-20 17:47:30 +00:00
martinlanghoff 4b8980fc83 Fixing handling of empty memory_limit for PHP without memory_limit (mostly Windows binaries)- fixed typo 2004-11-20 10:37:03 +00:00
mjollnir_ 609cba70d2 Fixing bug # 2199 - missing some teacher roles in course/category.php 2004-11-20 10:36:58 +00:00
skodak 175885e3ff updated parameter cleaning, preparation for new file.php SC#5 2004-11-19 21:23:07 +00:00
mjollnir_ 37ac5dfdb1 Indexes for scorm and version bump (honoring partial freeze) 2004-11-19 05:21:06 +00:00
mjollnir_ a4f2ce6946 Indexes for resource and version bump (honoring partial freeze) 2004-11-19 04:52:34 +00:00
mjollnir_ 6ddc682c3c Indexes for quiz and version bump (honoring partial freeze) 2004-11-19 03:23:58 +00:00
defacer bce32e1373 Merging patch from HEAD: addressing SC#20 and updating parameter handling code. 2004-11-19 03:18:41 +00:00
mjollnir_ 0d3a8fa280 Indexes for lesson and version bump (honoring partial freeze) 2004-11-19 03:00:17 +00:00
martinlanghoff b55be229e9 moodle--eduforge--1.3.3--patch-159 get_courses checks to see if sort is not empty before putting it in the query + removal of redundant (and costly) SQL SELECT 2004-11-19 02:13:44 +00:00
mjollnir_ 96522de058 Indexes for label and version bump (honoring partial freeze) 2004-11-19 02:12:58 +00:00
mjollnir_ 51cf993598 Indexes for journal and version bump (honoring partial freeze) 2004-11-18 22:40:29 +00:00
moodler 93f14c02ac Upgrade all the defective module version numbers in the database 2004-11-18 19:22:08 +00:00
moodler 18d30cd1d2 Downgrading versions to fix recent mistake in upgrading them 2004-11-18 19:15:49 +00:00
stronk7 00878c64d5 2004111000 downto 2004060401
(version never changes in STABLE branches)
2004-11-18 19:14:35 +00:00
moodler db6efd66bd Downgrading versions to fix recent mistake in upgrading 2004-11-18 19:14:02 +00:00
stronk7 ac8d60eae0 2004111200 downto 2004070103
(version never changes in STABLE branches)
2004-11-18 19:12:32 +00:00
moodler acc1bff289 Downgrading / repairing large version numbers 2004-11-18 19:11:58 +00:00
stronk7 4f854e3830 2004121100 downto 2004060401
(version never changes in STABLE branches)
2004-11-18 19:08:56 +00:00
stronk7 cd3565a13c 2004111200 downto 2004060401
(version never changes in STABLE branches)
2004-11-18 19:01:47 +00:00
skodak c7b29ed094 fixed encoding of html entities in tex expressions - SC#7 2004-11-18 10:06:46 +00:00
moodler d4b57dfe19 First quiz edit in a new course now always has a default category defined 2004-11-18 07:31:02 +00:00
mjollnir_ 8fcb9ebb39 Indexes for glossary and version bump 2004-11-18 04:38:16 +00:00
mjollnir_ e8f491f249 Indexes on forum and version bump 2004-11-18 04:10:19 +00:00
martinlanghoff 726f4ca317 moodle--eduforge--1.3.3--patch-335 Now memory_limit can be overriden by higher config settings from php.ini, commandline, httpd.conf, .htaccess 2004-11-18 02:54:35 +00:00
martinlanghoff ff75e0fe8a moodle--eduforge--1.3.3--patch-321 Fixed bug in user search: now we trim() the search string 2004-11-18 02:46:30 +00:00
martinlanghoff 7380fc552a moodle--eduforge--1.3.3--patch-305 - Postgres SQL bugfix for instance_is_visible() 2004-11-18 02:37:13 +00:00
martinlanghoff ea9d7e8815 moodle--eduforge--1.3.3--patch-222 - SQL improvements\n Better SQL performance for get_courses() and get_courses_page() calls, specially from the categories page. This gives much better performance when browsing existing courses 2004-11-18 02:31:11 +00:00
mjollnir_ ee99d4dd14 Indexes for exercise and version bump 2004-11-18 01:54:56 +00:00
mjollnir_ a12772c292 Indexes and version bump for dialogue 2004-11-18 01:33:17 +00:00
mjollnir_ b53f6cbec4 Indexes and version bump for choice 2004-11-17 23:03:46 +00:00
mjollnir_ 7bf8395be7 Indexes for chat and version bump 2004-11-17 22:53:07 +00:00
mjollnir_ eca64410fa Indexes and version bump for attendance 2004-11-17 22:11:28 +00:00
mjollnir_ f3f9ab2a5e Indexes and version bump for assignment 2004-11-17 21:49:12 +00:00
mjollnir_ 602c1506e4 Version bump for new indexes 2004-11-17 07:48:45 +00:00
mjollnir_ 3ebf865805 Add a unique key to guarantee that course,sortorder is unique. Allows fix_course_sortorder and ordering operations to be much faster. (martinlanghoff)
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-231
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-236
2004-11-17 07:42:36 +00:00
mjollnir_ bd2c2596c2 Indexes on faux foreign keys and often used fields, one more set and version bump to come. 2004-11-17 07:06:18 +00:00
mjollnir_ 0ee95ca7c3 Fixes to fix_course_sortorder() and course/category.php pages. (martinlanghoff)
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-160
  Minor fix: moodle would crash on high number of courses when doing course creation -- should be more scalable now

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-164
Fix a bug I have introduced in fix_course_sortorder() - v2

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-210
  Fixed nested transaction in fix_course_sortorder()

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-215
  Performance and memory usage fixes for re-sort courses function

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-268
  Major performance and correctness improvements in the functions that move courses up and down, reorder by name, and in fix_course_sortorder(). All now assume course-sortorder is unique (this is enforced at the DB)

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-332
  fix_coursesortorder() bugfixes and logic simplification

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-333
  courses listing enhancements: bugfix on re-ordering, keep the right page on actions
2004-11-17 06:56:46 +00:00
mjollnir_ ad16b64f1a moodle--eduforge--1.3.3--patch-207(partial) + moodle--eduforge--1.3.3--patch-408 - added begin_sql() and commit_sql() (martinlanghoff) 2004-11-17 05:28:24 +00:00
mjollnir_ dcb043ddd3 moodle--eduforge--1.3.3--patch-201 - optimized calls to get_courses() to retrieve only required fields (martinlanghoff) 2004-11-17 05:03:51 +00:00
stronk7 b0e5543a31 Just changing some parameters stuff to new functions...
See SC and Bug 1837
2004-11-17 00:06:36 +00:00
stronk7 d5e739bc92 Print view isn't accesible if the activity is hidden.
Bug 1837
(http://moodle.org/bugs/bug.php?op=show&bugid=1837)
2004-11-16 23:34:29 +00:00
stronk7 7ba2b3a7f4 Header is out and "Site:" is in.
Partially solved Bug 1837
(http://moodle.org/bugs/bug.php?op=show&bugid=1837)
2004-11-16 23:09:23 +00:00
stronk7 21b674db66 Now hidden sections are hidden completely from student view if
"invisible sections" are configured in course settings.
Patch sent by Geoff Wilbert. Thanks!
See Bug 2185
(http://moodle.org/bugs/bug.php?op=show&bugid=2185)
2004-11-16 17:03:03 +00:00
moodler 76cea3d68f Update all references to obsolete ma_nt language pack to mi_nt 2004-11-15 09:31:18 +00:00
moodler a95fb63fbe Maori renamed to proper code 2004-11-15 09:21:29 +00:00
moodler 7f9da8a112 Missing files 2004-11-11 08:56:48 +00:00
moodler d9e747e909 Latest new files from HEAD 2004-11-11 08:56:01 +00:00
moodler b81285be22 Stub file to overwrite formerly buggy script 2004-11-11 08:04:43 +00:00
moodler a5b75f54ca Replaced buggy old script with a script 2004-11-11 08:03:05 +00:00
moodler edd61be0e7 Stub to overwrite formerly buggy script. 2004-11-11 08:00:45 +00:00
moodler a86b324790 Fixed typo when accepting payment amount from paypal
See: http://moodle.org/mod/forum/discuss.php?d=14770
2004-11-11 06:50:39 +00:00
moodler ecc1076a06 Allow teachers to always try quizzes, even when it's not open yet 2004-11-11 02:21:06 +00:00
moodler edf8528f96 FIxed uploading limit confusion
Fixed loss of choose mode when uploading a file
2004-11-10 15:47:31 +00:00
moodler f1d7b1301c Hide a notice 2004-11-10 14:18:49 +00:00
moodler 645ed2b688 A robustness check when dealing with unexpected question data.
Shouldn't ever be needed, but I can't yet see what is causing the
situation I'm seeing on a couple of sites where a question doesn't
have a type, and this solves it neatly.
2004-11-10 14:05:01 +00:00
moodler 6f6109d4ef Fixed a variable that had been accidentally lowercased ($CFG) 2004-11-10 13:55:22 +00:00
moodler e46a0bc728 Bumping version as we move on. I'm also testing the new syncmail script 2004-11-10 02:10:48 +00:00
stronk7 ffe79bd906 Old-awaiting for 1.4.2 release changes in the glossary.
Now, print view is different for each format (consistent with it).
New, custom formats can, optionally, define their print view. Else
the default one will be used.
With this, 1.4.x glossary developments are finished and we can start
solving some pending things in 1.5...
2004-11-09 18:37:02 +00:00
stronk7 f94c9601f0 New release of the multilang filter:
- 100% compatible with previous "Multilang" filter.
    - Supports a new "short" syntax to make things easier. Simply use:
        <lang lang="XX">
    - It needs less resources and executes faster.
    - It Allows any type of content to be used. No restrictions at all!
2004-11-07 17:03:56 +00:00
moodler 742960a9c2 Don't post out assignment notifications older than a day 2004-11-07 15:24:49 +00:00
stronk7 cc67fc0b5d Updated to 1.4.2 release (from HEAD) 2004-11-05 08:30:50 +00:00
moodler 79a661bd2a MIssing files 2004-11-05 06:34:44 +00:00
moodler d6067b0c43 Fix sesskey from calendar entries 2004-11-05 06:28:16 +00:00
moodler 579961aba4 FIxed missing string 2004-11-05 06:24:55 +00:00
moodler c51ffe5107 Drawing a line in the sand at this point. 2004-11-05 03:22:11 +00:00
moodler b60003a832 Updated release notes a little 2004-11-05 03:20:40 +00:00
moodler 7fc51d17c3 New file 2004-11-05 03:02:06 +00:00
moodler 9bd37fa711 New files 2004-11-05 03:01:44 +00:00
moodler 9e74ddd633 Copied over language files from HEAD 2004-11-05 02:52:14 +00:00
moodler 0551474e63 Fixed up some XHTML and also sesskey links on link dialog 2004-11-04 16:56:29 +00:00
moodler c562717acb Added sesskey etc to HTML editor file browser 2004-11-04 16:23:13 +00:00
skodak d52e13002e initialized $image and moved filemtime after file_exists 2004-11-04 09:31:33 +00:00
skodak d8d356d4c7 initialized variables - the same as algebra/pix.php 2004-11-04 07:58:41 +00:00
moodler 57af827e39 Trim search string of spaces 2004-11-04 07:14:16 +00:00
moodler 8ba0912440 Patch for postgresql happiness 2004-11-04 07:05:10 +00:00
moodler 54b5310062 Addslashes to pathinfo to prevent SQL injections 2004-11-04 06:28:17 +00:00
stronk7 f4f27c0675 Ready BUMP! 2004-11-04 00:11:34 +00:00
stronk7 796d3c880a Now courses are deleted from backup_courses when they have been
deleted from Moodle. See:
http://moodle.org/mod/forum/discuss.php?d=13633
2004-11-04 00:08:28 +00:00
moodler d6f6091a4b Initialise some variables $cmd and $status - thanks Petr 2004-11-03 16:01:32 +00:00
moodler fa1c36fb99 Hidden teachers should not be shown in separate groups mode 2004-11-03 14:11:52 +00:00
moodler 5ff5caa58d Bump 2004-11-03 12:53:05 +00:00
moodler 34990da46d Merged changes from HEAD to STABLE 2004-11-03 08:49:44 +00:00
moodler e41871f1fb Whoops, missing uploadfile.php! 2004-11-03 08:41:39 +00:00
moodler af0145e39d Removed use of PHP_SELF 2004-11-03 02:01:22 +00:00
moodler 40dcb53fc6 Nullified courseimages.php, and made some of the security improvements
to lib/editor.php ... not quite completed yet with that though.
2004-11-02 16:57:10 +00:00
moodler fbc914dafe files/index.php now allows choosing and it makes the coursefiles.php
scripts unnecessary.

Wiki, Resource and Scorm now use the new method, so their versions
have been bumped.
2004-11-02 12:02:00 +00:00
stronk7 412e0bb881 Bug 2140 solved partially. Now categories are
deleted properly.

Delete of orphan categories will be done later...
2004-11-01 20:47:48 +00:00
moodler c5505d8071 Initialise $parent variable to avoid Norton bug 2004-11-01 12:47:38 +00:00
moodler 153bd6ec63 Fixed the bug introduced in 1.4 (part of the site-level module changes)
that caused assignment notifications to not be mailed out
2004-10-31 04:09:05 +00:00
gustav_delius ebd32e3e38 Fixed a bug that allowed teachers to upload images of arbitrary size 2004-10-30 22:40:22 +00:00
defacer d907cdad93 Importing fix for bug #2004 (Bug of the Year! :D) from HEAD:
Events in each day are now displayed ordered by starting time, and not by
eventid as before. Thanks to Gustav for pointing this out!
2004-10-29 17:29:29 +00:00
moodler 7747441767 I have removed the <style> tag from the list of allowed tags in forum
posts and other places students can write.

It allows too many possibilities like this:

<style>
div {
   position:absolute;
   width:100%;
   height:100%;
   background:black;
   top:0;
   left:0;
}
</style>
<div>test</div>

styles within tags don't allow this for some reason.

Thanks to Andrea Giardina for the alert.

Note that the HTML editor strips this tag anyway so it's not a big deal.
2004-10-29 07:28:32 +00:00
skodak f349337d7e removed incorrect global $USER 2004-10-28 14:17:19 +00:00
moodler 00980197b8 FIxed bug with displaying user access time on site level 2004-10-27 05:57:34 +00:00
skodak da11cdfbe4 updated htmleditor invocation (from files/index.php) 2004-10-26 19:53:26 +00:00
skodak 5dcda7b86f changes:
* sesskey;
* only editing teachers can use it;
* time modified - used filemtime (consistency with files/index.php, better for Win32);
* directory sizes shown;
* removed unused "torte" action;
* updated breadcrums (active folder not linked and &raquo;);
* updated comments;
* some other fixes from files/index.php.

Please test, test, test.
2004-10-26 18:55:47 +00:00
moodler 1a8b9564c4 Add slashes to wiki names when creating new entries. 2004-10-26 07:40:48 +00:00
gustav_delius e8715b0d9b added missing print_footer() 2004-10-25 20:33:27 +00:00
stronk7 7092220f99 Added sesskey to more actions + bug fix when detecting directory traversals.
From skodak!
2004-10-24 23:51:51 +00:00
skodak aeb0e7ee1e fixed warning in Activity report/Outline - oops, wrong line 2004-10-24 21:00:48 +00:00
stronk7 e674aa8ba8 Now everything in files/index.php is using sesskey.
Patch submmited by skodak.
2004-10-24 00:04:56 +00:00
skodak 20f961f1e2 fixed warning in Activity report/Outline 2004-10-23 19:07:31 +00:00
moodler ed95139596 Fix for bug 2114 that was losing track of the Real user when loginas
was used by a logged-in user
2004-10-21 15:49:59 +00:00
stronk7 4cc9465bc7 Solved one annoying bug where label texts in sections != first
was being always cleared, preventing some tags to be there!
2004-10-20 23:22:16 +00:00
moodler 91bbe51649 Moved the new additions from the display() function into the constructor 2004-10-19 09:41:01 +00:00
moodler 4fe3740b36 Centralised some of the display stuff in the display function in the base class
Added better checking for students accessing hidden resources
2004-10-19 09:28:18 +00:00
moodler 64f689e0d0 No need for DISTINCT when getting courses any more (only one table) 2004-10-18 05:58:12 +00:00
moodler b0cbbc56c2 More efficient querying of courses (from Martin Langhoff) 2004-10-18 05:57:09 +00:00
stronk7 4a69819405 Strip control chars when unzipping. 2004-10-17 23:42:48 +00:00
stronk7 dcf2a27a32 Now Wiki's FileManager is using central zip & unzip functions. 2004-10-17 23:14:40 +00:00
stronk7 83b640f957 Now Editor's FileManager is using central zip and unzip functions.
NOTE: What is the courseimages.php file, I haven't tested it because
I didn't find how to do it!!
2004-10-17 23:08:59 +00:00
stronk7 07d0fff0f3 Now Scorm's FileManager is using central zip and unzip functions. 2004-10-17 22:46:31 +00:00
stronk7 e5e3f219dd Small change in condition... 2004-10-17 22:34:49 +00:00
stronk7 6ee3b260cb Included some filename transformations to work like info-zip.
Directory traversal protection added.

Working under Win32, MacOS X and BSD (and rest of Unix, I hope).

Patch file from Petr. Thanks!
2004-10-17 22:26:45 +00:00
stronk7 35a510d8b6 Now resource's FileManager is using central zip & unzip functions. 2004-10-17 19:33:46 +00:00
stronk7 1a9911452e Now pclzip generated files are compatible with info-zip
(linux, macos x, win32, bsd...) based extractors. This
include command-line flavours, stuffit and so on...

Thanks to Petr!!

We have to remember to apply this patch when we update the
pclzip in th future (if their authors don't include it).
2004-10-17 13:34:26 +00:00
stronk7 736db01dc4 ZIP_METHOD included in backup for future tests at restore time. 2004-10-16 17:47:26 +00:00
stronk7 1e55f8cfce Not mandatory but I prefer to initialise it. 2004-10-16 17:36:37 +00:00
stronk7 3eb92f112c Now backup and restore are using central zip & unzip functions. 2004-10-16 17:09:49 +00:00
stronk7 20b53a7ba2 Added the optional showstatus parameter to unzip_file() to avoid
sending any output if desired.
2004-10-16 16:29:57 +00:00
stronk7 4bc418dc6d Bump to 1.4.2 2004-10-16 16:10:04 +00:00
stronk7 27974c8587 Latest patches from skodak included in param functions.
Simple and double quotes are out now.
Full paths in unzip are now hidden too.

Please test it. It could have some pending changes yet!
2004-10-16 11:30:14 +00:00
moodler 882a125790 Added some robustness 2004-10-16 10:15:26 +00:00
moodler ee4fe14631 Implemented Eloy's suggestion from Bug 2073 2004-10-15 09:52:16 +00:00
moodler c56d16bb4e Prettier error message when Moodle can't connect to database,
but also the database info is no longer printed (bug 2074)
2004-10-15 08:46:13 +00:00
moodler f7375fe1c3 Bumping for ID purposes 2004-10-15 06:41:40 +00:00
paca70 a67dd90008 Prevent auth_iscreator from overriding users course creation status 2004-10-13 07:27:34 +00:00
skodak 00c6364cbb added sesskey to update_module_button(), error reported in moodle forum d=13835
I made a quick fix - it seemed critical to me
2004-10-12 18:37:56 +00:00
stronk7 176d456ed9 Under Win32, we need backslashes in paths. Now it works!! 2004-10-10 23:24:15 +00:00
stronk7 4f64ed9405 Added some nedded strings 2004-10-10 22:45:00 +00:00
stronk7 27ed82e82f Deleted some unused strings 2004-10-10 22:44:37 +00:00
stronk7 54ce5e46c8 Delete some debug output... 2004-10-10 21:57:58 +00:00
stronk7 a748a0f84d Now we are using the new, central, unzip_file() function here...
Please TEST, TEST, TEST!!
2004-10-10 21:54:11 +00:00
stronk7 ed124087d7 vim is in again... :-) 2004-10-10 21:47:29 +00:00
stronk7 0954d514b8 Central unzip_file() function included:
- Supports both internal and external zip execution.
    - Displays the results of the execution.
    - All Petr's patched added.
    - External zip execution in Win32 supported.
Please TEST, TEST, TEST.
2004-10-10 21:33:46 +00:00
skodak 2d9a666670 one more cleaned 2004-10-10 20:21:40 +00:00
stronk7 291fd04602 Order logs by creation order (id) 2004-10-10 18:46:25 +00:00
skodak 2c9f5a3a00 cleaned text from forms 2004-10-10 17:26:34 +00:00
stronk7 f54d5ea5fb Now FileManager is using the new, central zip_files() function.
Only tested under MacOS X. It should support all the new
features of that function (Win32 external zip, imporved security...).

TODO: Create the unzip_file() function and use it here too!!
      Apply this changes to the rest of filemanagers (coursefiles.php...)
      TEST, TEST, TEST...!!
2004-10-10 01:17:20 +00:00
stronk7 2b26825cb2 Now the zip_files() function is working better:
- More checks are done
- Non existing files are out
- Both internal an external are supported and protected
- All Petr's patchs applied
- Included support to Win32 external zip.

TODO: Create a paralel unzip_file() function
      Use this functions in all the FileManager scripts

THOUGHT: External zip seems to work always adding files to
      zip file if it exists, where PclZip resets the file.
      Perhaps a rm (or delete) should be included in the
      command chain. Analyse it!!
2004-10-10 01:01:02 +00:00
stronk7 d5640b844b Use of cleardoubleslashes() added to the backup and restore functions.
They will be changed to calls to new, central zip and unzip functions.
(coming soon)
2004-10-09 23:00:51 +00:00
stronk7 3099dc3e6f course/view.php is using sesskey
(changes in blocks done, please check them)
2004-10-09 20:04:45 +00:00
stronk7 1824077052 course/unenrol.php is using sesskey. 2004-10-09 19:06:51 +00:00
stronk7 672610e605 course/teacher.php is using sesskey.
(in POST form too)
2004-10-09 19:01:02 +00:00
stronk7 473d3495a5 course/student.php is using sesskey. 2004-10-09 18:43:32 +00:00
stronk7 dfcbccbbef course/scales.php is using sesskey. 2004-10-09 18:30:11 +00:00
stronk7 55b55d08f9 course/mod.php is using sesskey. 2004-10-09 17:02:28 +00:00
stronk7 952d9baf58 course/index.php is using sesskey. 2004-10-09 13:11:49 +00:00
stronk7 bccdea508c course/groups.php is using sesskey. 2004-10-09 12:01:34 +00:00
stronk7 ecea1540da course/group.php is using sesskey. 2004-10-09 11:45:48 +00:00
stronk7 2e989420c9 course/grades.php is using sesskey. 2004-10-09 11:36:10 +00:00
moodler 08bae16463 Removed a notice 2004-10-09 04:38:01 +00:00
stronk7 ac63a3f445 course/editsection.php is using sesskey. 2004-10-08 18:29:02 +00:00
stronk7 58b9565184 edit.php is using sesskey 2004-10-08 18:10:37 +00:00
stronk7 4a25390975 course/delete.php is now using sesskey 2004-10-08 17:55:16 +00:00
stronk7 d177dd7713 course/category.php is using sesskey 2004-10-08 16:41:04 +00:00
moodler c30dd54457 Slightly changed the shortcut method of disabling email so that it's
less potentially confusing for students.  The status is now written
in full (not just an icon) and only for re-enabling an email.
2004-10-08 07:01:52 +00:00
moodler 229ee13480 Merged into stable 2004-10-08 04:02:58 +00:00
defacer 4d54248710 Smallish refinement. 2004-10-08 00:19:20 +00:00
defacer 9dc9d6b0a8 Updated the translation in a place it was so badly behind that it actually
caused the admins to turn to the programmers for help... sad.
2004-10-08 00:15:05 +00:00
moodler fdce874a70 Send welcome email even when there is no course password 2004-10-07 15:21:49 +00:00
stronk7 3db6b58aa4 PclZip library upgraded to 2.1 2004-10-07 14:05:33 +00:00
stronk7 913f744325 Changes to the zip, unzip, listzip and restore sections of the file:
- Added a new function in lib/moodlelib.php
- Uses the new version of pclzip.php library.
- Petr patches applied.
- Some minor changes to hide full paths under Win32.
- Tested in MacOS X and Win32 (not linux).
- New function zip_files() in moodlelib.php. Not used, but a good start.

Please test it!!
2004-10-07 14:04:37 +00:00
stronk7 c5544714a8 Changed some conditions against the $USER variable
to work fine under PHP5.

Bug 2053
(http://moodle.org/bugs/bug.php?op=show&bugid=2053)
2004-10-06 16:47:27 +00:00
moodler dcbe5864f6 Damn, typo 2004-10-06 14:19:06 +00:00
moodler 028f222c2a Changed the error logging format in error_log to make it
- more standard
   - better for multi-site servers
2004-10-06 13:53:55 +00:00
moodler 8b559dc502 Slight fix for logic of USER 2004-10-06 13:42:57 +00:00
stronk7 2c13dbe497 Now sesskey is working fine at installation time.
Bug 2049
(http://moodle.org/bugs/bug.php?op=show&bugid=2049)
2004-10-06 00:03:32 +00:00
stronk7 92ff33eee8 Small typo closing tr... 2004-10-05 23:12:25 +00:00
stronk7 7c957e6052 Now RSS links ae showed properly in SITE course when
user isn't logged.

Solve a problem with if($USER) under PHP5.
2004-10-05 22:51:48 +00:00
stronk7 2a8d898ae0 Now RSS links are displayed ok in SITEID course.
Bug 2048.
(http://moodle.org/bugs/bug.php?op=show&bugid=2048)
2004-10-04 22:05:36 +00:00
moodler d7fef4ea06 Just to help avoid confusion ... it messes up the nice round number
but oh well.  :-)
2004-10-04 17:28:06 +00:00
moodler d7b9ae5984 Send first "change password" mail even if mail was stopped. 2004-10-04 15:47:28 +00:00
moodler 853fdc2076 Added sesskey checking for confirmuser variable 2004-10-04 13:40:32 +00:00
moodler eb1f864d0a Added sesskey checking 2004-10-04 13:38:53 +00:00
moodler 9935789477 Added session key checking to timezone.php 2004-10-04 13:14:50 +00:00
moodler 3d3b104b1b Added sesskey checking to site settings page 2004-10-04 13:08:16 +00:00
moodler ddc2560146 Added sesskey checks to variables page 2004-10-04 12:54:22 +00:00
moodler 87e1fb0e31 Fixes to check arguments better for file manager 2004-10-04 12:04:22 +00:00
moodler 95bd142e85 One more divide-by-zero 2004-10-04 11:49:08 +00:00
moodler c7d5bd00b8 Prevented two divide-by-zero errors (bug 2043) 2004-10-04 11:47:26 +00:00
stronk7 b0fbbd20f6 admin/user.php is now using sesskey. 2004-10-03 17:04:56 +00:00
stronk7 c6ad74fad4 admin/uploaduser.php is now using sesskey. 2004-10-03 16:03:44 +00:00
stronk7 37a192beca admin/register.php is now using sesskey.
Solved a minor bug with the use of one incorrect string.
2004-10-03 15:24:51 +00:00
stronk7 13a2015285 admin/modules.php is now using sesskey. 2004-10-03 15:05:11 +00:00
stronk7 215241b0f0 admin/module.php is now using sesskey. 2004-10-03 09:44:59 +00:00
stronk7 e85705799e admin/lang.php is now using sesskey. 2004-10-03 09:11:11 +00:00
moodler e1f2e71b60 Use a permanent "siteidentifier" code for Moodle.org registrations 2004-10-03 03:45:21 +00:00
stronk7 5657bcafcd admin/filters.php is now using sesskey. 2004-10-03 00:28:22 +00:00
stronk7 0f8c7865b1 admin/enrol.php is now using sesskey. 2004-10-03 00:17:55 +00:00
stronk7 a959544c5b admin/editor.php is now using sesskey. 2004-10-03 00:01:58 +00:00
stronk7 09b1a30d72 admin/creators.php is now using sesskey. 2004-10-02 23:49:22 +00:00
stronk7 9b464d9fb2 admin/blocks.php is now using sesskey. 2004-10-02 23:29:44 +00:00
stronk7 a8b50ee01e admin/block.php is now using sesskey. 2004-10-02 23:09:36 +00:00
stronk7 36b1e811e4 admin/block.php is now using sesskey.
And solved bug when trying to unset config['block']. It isn't
an array but an object.
2004-10-02 23:07:22 +00:00
stronk7 719593e839 admin/backup.php is now using sesskey. 2004-10-02 22:44:25 +00:00
stronk7 249c36eaa0 admin/auth.php is now using sesskey. 2004-10-02 19:43:17 +00:00
stronk7 05c2036b1f admin/admin.php is now using sesskey. 2004-10-02 19:16:16 +00:00
skodak 833b9fd8d5 missing htmlSpecialChars() in INPUT's value 2004-10-02 18:50:25 +00:00
moodler 1721518730 More options for parameter handling ... 2004-10-02 16:11:46 +00:00
moodler bb89f07c23 Don't show hidden activities in activity reports 2004-10-02 15:29:02 +00:00
moodler 27b93cf8e5 Set the sesskey for new admins 2004-10-02 15:21:17 +00:00
ikawhero 10604909ea Changes for language strings 2004-10-02 13:03:59 +00:00
gustav_delius 42cc44d560 provisional fix for bug reported by Timothy Allen in http://moodle.org/mod/forum/discuss.php?d=13388. Provisional because I am not sure I am using the new parameter functions correctly. 2004-10-02 11:09:17 +00:00
ikawhero 7b94708be9 Fixing some bugs in the class 2004-10-01 23:40:34 +00:00
moodler b93635e369 Not ready yet 2004-10-01 15:23:21 +00:00
moodler 22bb7196b0 Don't allow any dots in the subdirectory string for directory resources Thanks Petr! 2004-10-01 15:18:24 +00:00
moodler 98cda81fcf Better check for integer when cleaning parameter 2004-10-01 15:04:21 +00:00
moodler edfa37ae27 Added a new sesskey variable to perform better checks of identity
for some scripts.

Thanks to Petr for finding the exploit!
2004-10-01 14:09:30 +00:00
stronk7 9d90abb900 Included one more translation of links from
assignments to resources. Required in bug 2027.
Easy and not risky.
2004-10-01 11:31:12 +00:00
stronk7 2a135a5f64 More format_text() calls... 2004-10-01 10:26:11 +00:00
stronk7 f85e2d3767 Clean text for category->name 2004-10-01 09:49:06 +00:00
stronk7 b430433c2e clean_text() from entry->concept and aliases!! 2004-10-01 09:46:08 +00:00
stronk7 8259642b1b Changed to new 'point release' schema in STABLE. 2004-10-01 09:23:29 +00:00
moodler ed6804bf75 New functions to check parameters:
required_param()
   optional_param()

Putting them in stable to aid backward compatibility later
2004-10-01 08:40:41 +00:00
stronk7 af796dc774 New version syntax. 2004-10-01 08:36:36 +00:00
ikawhero e39d41ec6b Bug in path for language strings fixed 2004-10-01 04:31:25 +00:00
papita 62b9331113 Latest updates 2004-10-01 04:12:09 +00:00
moodler 9cc29c562c Parameters to common error and notice functions are now always cleaned 2004-10-01 02:38:39 +00:00
moodler 21ba61c3cf Clean error messages just in case scripts have been injected 2004-10-01 02:23:44 +00:00
moodler 9022e87436 Clean action so it isn't shown raw in error messages 2004-10-01 02:18:33 +00:00
moodler 36e62734ec Clean pathname before showing an error 2004-10-01 02:15:03 +00:00
stronk7 d683df8086 Up to 1.4.2 !! 2004-10-01 01:32:10 +00:00
moodler 30a5ea69f5 Latest release notes 2004-09-30 18:15:36 +00:00
moodler 0ed0f0298d Ready for tomorrow 2004-09-30 18:13:58 +00:00
moodler a410c12d23 Fixed bug 2020 in stable 2004-09-30 08:38:20 +00:00
julmis f4df4e9a26 Bug fix for Bug #1999 2004-09-29 22:09:11 +00:00
moodler 73197ea200 Full tags 2004-09-29 16:01:28 +00:00
stronk7 8d3b392d7d More use of SITEID 2004-09-29 15:18:32 +00:00
moodler 1b1779d677 Fixed SQL for PostgreSQL (always use AS). Thanks to Miles Metcalfe from the UK! 2004-09-29 07:54:09 +00:00
moodler ec9111371f Fixed SQL for PostgreSQL (need to always use AS) 2004-09-29 07:52:34 +00:00
moodler e30102faed Checkig pathnames for security 2004-09-29 07:01:33 +00:00
moodler e40bd2e541 Safer processing of pathnames 2004-09-29 06:56:55 +00:00
moodler 2dcadca9a6 Check filenames before including files 2004-09-29 06:51:35 +00:00
moodler b77f5e7a06 Fixes to check path names properly 2004-09-29 05:33:00 +00:00
moodler c99c3dac32 Check resource->type more carefully 2004-09-29 03:11:28 +00:00
stronk7 685a07e8ab Quoted some parameters as they must be. Thanks skodak! 2004-09-28 23:14:31 +00:00
moodler 357df17cb8 Clean modulename before calling include. Thanks again Petr! 2004-09-28 15:54:05 +00:00
moodler 1129e06081 Use the new parameter() function to check parameters better 2004-09-28 15:48:16 +00:00
moodler be35eacfb3 Added new function parameter(). Eventually this will replace all the
optional_variable and require_variable calls anyway, but it's needed
in STABLE to fix some security issues.

See bug 1865.
2004-09-28 15:27:08 +00:00
moodler 74845319b5 Added rtsp to protocols, and moved protocols out to top of the file 2004-09-28 08:25:26 +00:00
moodler ff377eb66b Copy of the change from files/index.php to clean $oldname during rename 2004-09-28 08:02:19 +00:00
moodler 018d7c657a Clean old name as well - thanks, Petr! 2004-09-28 07:59:17 +00:00
moodler c24313bc8c Little typo 2004-09-27 13:51:33 +00:00
moodler 802766d303 Looking at releasing a 1.4.2 within days to include all the recent fixes.
Also, I'm going to change the numbering convention slightly for stable
releases and start using both characters after the date
2004-09-27 13:47:25 +00:00
moodler db5bf3f55a 1) If user or course aren't specified, then assume current user and site course.
2) Closed possible security hole when using userid from form-sunmitted data

   (Thanks again Chief Security Officer Petr!)
2004-09-27 13:24:58 +00:00
moodler 69a791b831 Do safety check on $auth pathname before doing include. Thanks, Petr Skoda! 2004-09-27 12:50:23 +00:00
moodler 2003a0d463 Closed potential security problem (thanks, Petr!) 2004-09-27 01:46:42 +00:00
moodler 62592b861c Moving redirect back again - my fault! bug 2000 2004-09-26 02:41:45 +00:00
stronk7 5fd78134a4 Updated xmilze to official new 1.0.1 version
(it's 'our' version with some comments).
2004-09-25 16:20:35 +00:00
moodler b986e3b007 Upgraded to phpmailer 1.72 - none of the old hacks necessary any more! 2004-09-25 16:01:32 +00:00
moodler 8fcccd5ba8 Restore $CFG->prefix just in case 2004-09-25 15:31:37 +00:00
moodler e335cc7193 EVeryone can login to the site all the time 2004-09-25 15:21:31 +00:00
moodler dc9999208b Daryl Hawes found this fix for bug 1991 2004-09-25 15:17:58 +00:00
moodler 823940bcb3 Only break up subject lines for recent activity bug 1995 2004-09-25 13:10:23 +00:00
stronk7 303eaa286e Added backup & restore to SITE page.
Some changes from hardcoded '1' to SITEID.

See Bug 1928
(http://moodle.org/bugs/bug.php?op=show&bugid=1928)
2004-09-25 11:33:12 +00:00
stronk7 f258f45e31 Scheduled backup improvements:
- Old (>4 hour) directories are deleted at the beginning of the
  execution, so the disk full problem should be out!
- There are 2 types of errors:
    - Controlled errors: The backup process finish although something
        has been wrong.
    - Uncontrolled errors: The backup process dies (memory fault, apache
        problem, electric problem...:-)).
- Now scheduled backup is able to detect previous uncontrolled errors to
  avoid repeating the same course always. It'll be deferred to the next
  execution.
- Every time that a backup cycle has finished, admins will receive an email
  with the summary of the execution.
- The 'ERROR' text will be present in email subjects if something was wrong.

With this, all should be ok (I hope).
2004-09-24 19:01:11 +00:00
stronk7 6d5f3867e9 3 new strings for scheduled backups. 2004-09-24 18:37:03 +00:00
stronk7 e62064ad43 The get_directory_list() function was being executed with
directories excluded so backup_delete_old_dirs() was no
working fine! This should delete REALLY old dirs in sites
with problems in their scheduled backup.
2004-09-24 11:47:03 +00:00
paca70 78a0c06ae6 DB-authentication fix for postgres7.
Fix bud id 1740
2004-09-24 08:41:03 +00:00
paca70 8c589739b6 Fixes for new postgresql database creation 2004-09-24 08:20:42 +00:00
moodler 8a9d7a93af Added two strings for PAM authentication 2004-09-24 04:46:38 +00:00
moodler dd26a66841 Added PAM module for authentication 2004-09-24 04:42:46 +00:00
moodler 8a91a43fae Completely improved database enrolment that actually works this time ;-) 2004-09-23 17:00:20 +00:00
moodler 7b8ebd2771 Redirect to site page earlier if we know it's a site 2004-09-23 16:59:29 +00:00
moodler 146296b733 Allow course creators to restore to new or existing courses too 2004-09-23 11:25:44 +00:00
moodler 95c129edfb Fixed bug in forum ratings with PHP 5 2004-09-23 07:36:20 +00:00
moodler f5650a9675 Highlight was stripping backslashes but I can't see why! 2004-09-23 07:19:57 +00:00
paca70 6b9d8ab22b Added utf8_decode when reading info from ldap.
Thanks to stronk7 pointing this out.
2004-09-22 18:45:05 +00:00
moodler c4b8c0c709 New versions of get_courses and get_courses_page that don't require
a big JOIN between 'course' and 'user_teachers'.

Normally it works fine, but on one server with big tables I saw
a terrible delay that could not be fixed with indexes or by
upgrading MySQL ...

These new versions just avoid the issue.
2004-09-22 15:44:41 +00:00
bobopinna f6c70cf3bf Fixed a problem with onbeforeunload 2004-09-20 14:33:44 +00:00
bobopinna ebd62fdd86 Fixed a typo 2004-09-20 14:32:08 +00:00
moodler 6cce9458a5 Should always use p() function when printing variables 2004-09-20 12:47:56 +00:00
defacer 2c241d2a9d Fix for bug 1957:
Now the calendar behaves correctly even if you "log as" someone else.
2004-09-19 22:18:33 +00:00
moodler 8a70716abf Strip tags from heading before calling print_heading_with_help 2004-09-19 14:00:00 +00:00
moodler 1defa4e7be Pass formatoptions when formatting text so that it's not cleaned 2004-09-19 04:30:58 +00:00
skodak 7b3019e3e6 short php tags - Bug #1956 2004-09-18 22:31:11 +00:00
moodler 1cca75d257 On the front page, if the user is logged in then the calendar blocks
now only show events from their own courses.   bug 1957.
2004-09-18 13:16:01 +00:00
moodler f8ab1daa7c Merged forum post headers feature from HEAD into 1.4.x so that we
can use this on moodle.org posts (among other sites ;-)).
2004-09-18 08:18:02 +00:00
rkingdon 5e56f16030 One more workshop help file... 2004-09-17 17:58:22 +00:00
rkingdon 9b30b693ad Adding the five help files needed by the 1.4 STABLE 2004-09-17 17:39:38 +00:00
moodler 50e752d018 Moved spellcheck button a little :-) 2004-09-17 03:53:37 +00:00
moodler a187eda73f Fix for PHP5 new object referencing ... :-/
http://moodle.org/mod/forum/discuss.php?d=12541
2004-09-17 02:58:16 +00:00
defacer 0afc847f80 Small fixes: change site-detection code to use SITEID and some XHTML stuff
(I 'm going to merge this over to HEAD).
2004-09-16 10:52:00 +00:00
defacer 198f0fb09b Changed all references to hard-coded "1"s to SITEID. Made the logical expressions
in those lines a bit more clear. Removed one obsolete function. Thanks Eloy! :-)
2004-09-16 10:25:08 +00:00
moodler 203469c660 Implemented fix to use draw_rand_array instead of shuffle
(From Bernard Boucher, see bug 1889)

This could use some better testing!
2004-09-16 05:42:18 +00:00
mchurch 5ec9237d2b Fixed remove_teacher, so that a removed teacher is also removed from any
groups they belong to.
2004-09-14 23:41:27 +00:00
mchurch 908b8b9a4f Fixed strip_pages bug. 2004-09-13 23:09:33 +00:00
stronk7 855faed103 Release 1.4.1 info merged from HEAD.
(perhaps anybody forgot to do this before 1.4.1 release?) :-D
2004-09-13 19:31:09 +00:00
moodler 69f1e0a3cf This should make the charset detection automatic ... 2004-09-13 08:20:30 +00:00
moodler b8a6ed644b Checking in fixes to xml_parser_create to specify an encoding (UTF-8)
See Eloy's bug 1927 for details.

After this checkin I'll be immediately testing some backup/restores on PHP 4.
2004-09-13 07:42:13 +00:00
moodler 41e783c3cc Moving on ... 2004-09-12 16:24:11 +00:00
moodler ed6913a320 Merged more stuff from HEAD 2004-09-12 08:21:57 +00:00
moodler 854e0622c3 Merged changes from Trunk 2004-09-11 15:51:37 +00:00
moodler 7d5e12061e Seems very stable, I'll add the email protection filter to stable 2004-09-11 13:29:29 +00:00
moodler 0e468cfc54 FIxed some HTML 2004-09-11 08:35:37 +00:00
mchurch 7dc26ba47b Fixed a bug to export caused by removal of the email filters. 2004-09-10 18:34:52 +00:00
moodler a03a098f63 Looking at a point-release soon to get some of the issues fixed recently out there. 2004-09-10 07:00:04 +00:00
moodler 24fac39fce Default field value for get_course_users should be '', not * 2004-09-10 04:46:26 +00:00
moodler ce31ac9abd Added some instructions for translators on some important strings 2004-09-10 02:21:23 +00:00
stronk7 d7d8758184 Important changes about how view.php (and print.php) retrieve records
from BD to be displayed. Some SQL statements have been modified to
get target records, avoiding a lot of post-processing causing some
bugs like Bug 1912
(http://moodle.org/bugs/bug.php?op=show&bugid=1912)
2004-09-09 18:25:06 +00:00
moodler bef692c32e Undoing the commenting-out I did earlier, since the problem was something else. 2004-09-09 15:57:17 +00:00
mchurch 8d0a452321 Fixed potential undefined variable warning. 2004-09-09 12:47:44 +00:00
fiedorow f80964c99b Do not redeclare auth_user_login upon failed login 2004-09-09 12:26:59 +00:00
defacer 969da74d8b Fix for bug 1921:
I had forgotten to globalize $USER...
2004-09-09 11:53:42 +00:00
defacer a10b3ade4d addslashes() on messages from users before inserting into db. 2004-09-09 10:56:57 +00:00
moodler 06dc71e4e5 Use timestart and timeend when enrolling (or re-enrolling) 2004-09-09 09:28:21 +00:00
moodler 7d8e444763 Improved enrol_student so it can update older records 2004-09-09 09:26:29 +00:00
moodler 33cfeeb2a5 Better check of upcoming enrolment 2004-09-09 09:25:49 +00:00
stronk7 34f5efca4b Solved an small issue when "not clasified" was selected and
we tried to edit categories.
2004-09-09 08:39:16 +00:00
stronk7 c16e25ca1d Simply reformated before solving some bugs to have
ideas clearer.
2004-09-09 08:35:22 +00:00
moodler 14b03b3507 SITEID is more flexible 2004-09-09 06:59:12 +00:00
moodler 5efca069cc Prevent changes in future. :-) 2004-09-09 06:51:31 +00:00
moodler 1b0feaf88a Undoing botched version number - We can't update these like the HEAD version 2004-09-09 06:34:41 +00:00
moodler 010e8ea172 For some reason this include_once doesn't work ... I can't see why though!?
It's only included once and mentioned once throughout the all the wiki code,
but I have a site which errors-out with a redeclaration error ...

This plugin doesn't seem to be needed for highlighting of search  anyway
so I'll uncomment it for now.
2004-09-09 04:49:45 +00:00
fiedorow 1ec72ac59b Updating version date on MOODLE_14_STABLE 2004-09-09 01:55:36 +00:00
stronk7 fe20798cb6 Increase memory_limit to 128 in backups & restore. 2004-09-08 22:44:42 +00:00
stronk7 ba9b14e1e8 Changed to plural (directorypath-->directorypaths) 2004-09-08 18:03:15 +00:00
julmis cf0b27037b Few minor bug fixes, so en_us can be indentified. 2004-09-08 16:50:37 +00:00
stronk7 8915662a32 Added a help button about directory paths... 2004-09-08 16:47:57 +00:00
moodler 2b9011efdc Smilies are now rendered for Markdown format texts 2004-09-08 16:15:19 +00:00
moodler 00067b0836 Made some fixes to get_course_users to make it use particular fields passed
to it as before the recent changes.  This was causing blowout in memory
in the logs for large sites.

http://moodle.org/mod/forum/discuss.php?d=12236

I've done light testing of this only on a small site, I'm about to test it on
some bigger sites.
2004-09-08 15:38:00 +00:00
moodler 527ef6b490 Increase memory limit to cover some sites with too many modules etc ...
We should never hit this limit ...
2004-09-08 07:10:34 +00:00
moodler a2b8c47446 Moved these functions from locallib.php to lib.php so that Workshops
work under recent activity

   workshop_get_recent_mod_activity()
   workshop_print_recent_mod_activity()

Also fixed a problem with mimeinfo being called from locallib.php
without having included the mimetypes.php library
2004-09-08 06:40:28 +00:00
moodler 91e81b7fa4 crikey I really should have checked that last checkin before checking it in 2004-09-07 14:14:30 +00:00
moodler b988c62844 CourseID is now mandatory on file.php 2004-09-07 14:11:59 +00:00
moodler b2e0d6b6a2 Full paths on includes, to help some machines
http://moodle.org/mod/forum/discuss.php?d=11792&parent=58802
2004-09-07 13:38:52 +00:00
defacer 75c45044bb Improving the behavior of the two calendar blocks when they are displayed
at the site front page. See http://moodle.org/mod/forum/discuss.php?d=12149
2004-09-07 10:16:33 +00:00
ikawhero 472b9e478e Updated flash 2004-09-07 06:24:43 +00:00
ikawhero fdcec8bb0c Missing image 2004-09-07 06:24:27 +00:00
moodler e51980345c No round corners needed 2004-09-07 03:05:12 +00:00
moodler a50ded84ea Adding this (optional) feature to 1.4 stable because it seems quite
a few people really need it.
2004-09-07 02:50:03 +00:00
moodler 7c2e85f1bd dbhost may have quotes in it (needs slashes) 2004-09-06 15:50:00 +00:00
defacer ae18de992f Avoid debug mode notice. 2004-09-06 07:54:04 +00:00
stronk7 cda01a6052 Now entries are showed correctly in categories view if they belong
to multiple categories.

Bug 1903
(http://moodle.org/bugs/bug.php?op=show&bugid=1903)
2004-09-06 07:43:07 +00:00
defacer c1d0f7d584 Removed leftovers I got with my last update. 2004-09-06 07:20:38 +00:00
stronk7 b495ed2b48 Changed the way to determine the site course... 2004-09-05 09:20:27 +00:00
moodler 78cb48c712 Updated name of language from "English" to "Chinese" 2004-09-05 07:29:37 +00:00
moodler 6154173f51 Updated files, merged from HEAD 2004-09-05 06:43:57 +00:00
moodler 6472c54bea Merged new files from HEAD 2004-09-05 05:21:09 +00:00
moodler 671daf6e07 Merged new changes from HEAD 2004-09-05 05:19:40 +00:00
moodler d5238eaf23 New release docs merged from HEAD 2004-09-05 05:18:23 +00:00
moodler e56802dacd Removed duplicate fonts 2004-09-05 05:13:33 +00:00
moodler c62346d190 Fix display of "correct answers" during quiz review (for students and teachers) 2004-09-04 08:10:02 +00:00
mchurch 91202daa84 Added <tt> and <code> tags to valid tags. 2004-09-03 18:02:21 +00:00
stronk7 353a72e0a9 Simplify things a bit. I'm no really sure why I was using get_recods()
instead of get_record(). Perhaps it was in my PHP learning process...
2004-09-03 16:29:28 +00:00
moodler f2670b1325 Bump to post 1.4 2004-09-03 12:47:42 +00:00
moodler 9af5afa62c When formatting text, don't need to clean section summaries and
labels of all Javascript
2004-09-03 12:42:56 +00:00
moodler 91b0c4f3e1 FIxed a notice bug 1875 2004-09-03 07:23:21 +00:00
moodler 2f128ef194 Allow uncleaned text in the course (and site) summaries 2004-09-03 03:36:42 +00:00
moodler 4cde340d52 Fixed a bad function call! 2004-09-03 03:16:55 +00:00
mchurch 92b57640a4 Fixed some problems affecting wiki ** and ## formatting tags. 2004-09-02 19:20:29 +00:00
moodler aa3d9221e2 FIxed a bug that was affecting one customer site using Novell LDAP 2004-09-02 17:46:02 +00:00
moodler e0f27e8191 Whoops - forgot a few styles. Not too crucial though 2004-09-02 10:09:21 +00:00
moodler 93e6edcc16 Merged from HEAD 2004-09-02 04:14:53 +00:00
moodler 42e249983d When secure forms is on, allow forms to come from the home page
Primarily this is for the login block but could work for other
blocks too.
2004-09-01 11:23:33 +00:00
martignoni c788cafae7 Little tweak 2004-09-01 10:10:58 +00:00
bobopinna 507af9944b Created this new module intro 2004-08-31 16:08:00 +00:00
bobopinna a57089b02e Updated to new resource format 2004-08-31 15:59:15 +00:00
moodler 0644bc9e12 Merged files that have changed recently since the last merge 2004-08-31 15:40:12 +00:00
bobopinna 387496c8a6 Updated to Moodle 1.4 Stable 2004-08-31 15:08:04 +00:00
moodler b5cfd0e85f Like some horror movie, the second hand on the clock ticks over
in slow motion to the next mark
2004-08-31 13:43:44 +00:00
moodler fd772c442e More robust with bad themes 2004-08-31 13:36:47 +00:00
defacer 2ebaaa5e68 Mike noticed that PHP_SELF was being used here. Replaced all instances with $ME. 2004-08-31 13:31:00 +00:00
moodler e5bd075113 Fixing my recent typo 2004-08-31 12:56:11 +00:00
moodler 88289032b6 FIx install.php for PostgreSQL. I *think* ... this is untested 2004-08-31 12:48:36 +00:00
defacer 9c0458b046 One typo and a glitch
The developer fixes
Lo! Bug-free Moodle!
2004-08-31 12:45:05 +00:00
defacer 4ea496519e Fix for bug 1800:
Adding this harmless column makes the get_recent_enrolments() query legal
in Postgres. Patch submitted by Petri.
2004-08-31 12:26:04 +00:00
moodler 36d0082229 FIxed up recent problems with external authentication
http://moodle.org/mod/forum/discuss.php?d=11723#57001
2004-08-31 12:23:24 +00:00
moodler e0a456a3b3 SLightly reworded the enrollfirst string ... no difference to translators probably 2004-08-31 10:16:56 +00:00
moodler 88a70c8436 FIxed the link in the change I just made 2004-08-31 10:03:54 +00:00
moodler a5b9e4d94e Prevent restricted users from using "login as" 2004-08-31 09:59:59 +00:00
moodler 8913dce495 Fixed some english errors 2004-08-31 09:17:49 +00:00
moodler de3e4de88d Some extra safety when using variables - doesn't appear to be an exploit
in the general case but thanks, Fernando Quintero
2004-08-31 08:52:12 +00:00
moodler d0d1008498 Moved loginhttps into main config screen. Some security has been built
in to prevent accidental enabling on sites without https.
2004-08-31 08:39:22 +00:00
moodler 46808f4afc Added shortcut button to edit course settings (bug 1850) 2004-08-31 07:24:33 +00:00
defacer 7eda7f6cbd Another one bites the dust, this one wasn't needed and noone had any
objections about the array-based notation. RIP.
2004-08-31 06:56:44 +00:00
gustav_delius 21c500f755 my second attempt at getting this block right. 2004-08-30 23:24:03 +00:00
stronk7 dfb203cad6 Release info for 1.4. 2004-08-30 22:57:38 +00:00
gustav_delius 8ec882c22f Access to site participants list is now controlled through $CFG->showsiteparticipantslist 2004-08-30 20:57:26 +00:00
gustav_delius d31cdc0ee9 isteacher() with no arguments now does the expected 2004-08-30 20:54:42 +00:00
moodler f547ee52e7 Merged latest language files from HEAD to STABLE 2004-08-30 19:36:07 +00:00
gustav_delius 129af65665 fixed the isstudent function 2004-08-30 19:09:36 +00:00
moodler b2794b6554 removed junk 2004-08-30 18:48:48 +00:00
gustav_delius 04fd313892 Site participants list now shows correct list of site students 2004-08-30 18:43:13 +00:00
moodler be037b8039 Updated index 2004-08-30 18:19:57 +00:00
moodler f01c72ee73 Added help buttons to the new help file for window settings 2004-08-30 18:17:52 +00:00
moodler 2eebac9129 New help file, based on one from Marc Dastous - thanks Marc! 2004-08-30 18:16:36 +00:00
moodler a8db8bdc3e Fixed an unquoted string 2004-08-30 17:45:51 +00:00
gustav_delius bee864c912 Just tidying up. 2004-08-30 17:28:47 +00:00
moodler 4a51bb7cca No need to put MS up there :-) 2004-08-30 16:57:01 +00:00
moodler 4cbb5d6b4b Default editor fonts now match default Moodle themes 2004-08-30 16:53:21 +00:00
gustav_delius 30bc2fa671 This now implements the new rule on who is a site student, see http://moodle.org/mod/forum/discuss.php?d=8452#56743 2004-08-30 16:42:32 +00:00
moodler 4e65d23fd1 OK, this should finally fix the block upgrading problem.
The problem was that site_admin_menu had not been added to the
database yet when we tried to update the blockinfo for the site.
2004-08-30 15:57:09 +00:00
moodler 327f0cdf22 Er, this will work better ;-) 2004-08-30 14:58:13 +00:00
moodler 5e1eaab52f Checking in a fix for the blocks upgrade on the home page so I can test
it on upgrading a real site.
2004-08-30 14:53:43 +00:00
stronk7 431c81eefa Bug 1831
(http://moodle.org/bugs/bug.php?op=show&bugid=1831)
2004-08-30 14:40:23 +00:00
moodler 6908074777 New configuration variable allusersaresitestudents for Gustav to use
in modules ...
2004-08-30 13:21:16 +00:00
moodler 7f446f68b6 Colored text now works.
Allow CSS "color" styles (which look like a protocol to the security system)
to get through the net.  Luckily anything with a hyphen is let through by
default to everything else the editor produces is OK.
2004-08-30 12:09:14 +00:00
bobopinna 6de08a7a4d Updated to Moodle 1.4 stable 2004-08-30 12:06:43 +00:00
defacer 4172b51f81 Some improvements to the code that assigns sideblocks to new courses.
Moved all "magic strings" to nice and tidy constants.
2004-08-30 11:55:36 +00:00
defacer 52f42b41fc Bug 1848:
As per Gustav's recommendation, event names in Upcoming Events are now hyperlinked.
This required an internal API change, but as far as I can see only block_upcoming
used it the relevant functions so it's ok.
Also, substituded SITEID for the magic number 1 in calendar/lib.php as an aside.
2004-08-30 11:42:07 +00:00
bobopinna 63d9ac4893 Fixed a bug in mounth view 2004-08-30 11:38:09 +00:00
gustav_delius cc4a7edf6f course teachers are also site students. This implements the rule described in http://moodle.org/mod/forum/discuss.php?d=8452#56678.
This commit is probably pointless because the rules are likely to change again soon. I won't merge it onto HEAD.
2004-08-30 08:49:01 +00:00
moodler 1afe51e630 Disabled HTML editor when editing HTML files, for now. See bug 1815 2004-08-30 08:42:21 +00:00
gustav_delius eb4f1a380a course teachers are also site students. 2004-08-30 08:13:14 +00:00
moodler 3977f41672 MOved the Editor on/off to the editor settings page, and tidied up a bit 2004-08-30 07:45:03 +00:00
moodler bce227c2bd Fixed some notices ... bug 1846 .. Thanks Bruno! 2004-08-30 06:28:41 +00:00
moodler 862d076232 Fix from Bruno for 1843 2004-08-30 04:31:45 +00:00
moodler 7ac53b8334 Added chooseparamter ... bug 1824 2004-08-30 04:21:56 +00:00
moodler b42451d5c7 "Choose parameter" is now translatable. 2004-08-30 04:21:24 +00:00
stronk7 e706e6bf35 Check that glossary is correct before edit categories.
Bug 1838
(http://moodle.org/bugs/bug.php?op=show&bugid=1838)
2004-08-29 23:26:04 +00:00
stronk7 4e3cfbb4d8 strip_tags() to some parameters. Thanks skodak.
Bug 1836
(http://moodle.org/bugs/bug.php?op=show&bugid=1836)
2004-08-29 22:46:31 +00:00
stronk7 7f322bf4f0 Typo. Thanks to skodak.
Bug 1839
(http://moodle.org/bugs/bug.php?op=show&bugid=1839)
2004-08-29 22:03:01 +00:00
moodler be50231d4a Upgraded to Markdown 1.0 release 2004-08-29 15:45:22 +00:00
gustav_delius 19425053af added constant SITEID=1 2004-08-29 14:00:49 +00:00
moodler c0c2ae7637 Some small changes .. nothing new just re-phrasing 2004-08-29 13:11:43 +00:00
gustav_delius aef7d2ef0b replacing get_site() in add_to_log() for efficiency. Moodle 1.5 will have this done more thoroughly. 2004-08-29 12:54:39 +00:00
moodler f4fbd4d664 Fixed some uninitialised variables bug 1830 2004-08-29 11:59:19 +00:00
gustav_delius d5fe509f44 add_to_log now updates lastaccess if used on site. See bug 1821 2004-08-29 11:35:08 +00:00
stronk7 420b3d092c Backup is ready for 1.4! Bump. 2004-08-29 10:14:56 +00:00
moodler 19625783b5 By default turn off validation for Moodle 1.4 to make things a bit easier
for some packages.  It can be enabled manually in the SCORM module settings.
2004-08-29 09:03:22 +00:00
moodler c5e704f41b FIxed heading and helpbutton link 2004-08-29 07:37:52 +00:00
moodler fda51b8d69 Fixes to authentication logic to help upgraders (ie admin and guest accounts) 2004-08-29 05:42:11 +00:00
moodler 79424afeb2 Slight rewording, not enough to warrant a new file but translators may
want to make similar changes.
2004-08-29 04:46:02 +00:00
moodler bcabc1aac6 Merged change from HEAD (Display -> Window) 2004-08-29 04:34:46 +00:00
moodler ad13b33c01 Added some stripping of data when displaying logs to help prevent some
possible XSS.  Thanks for highlighting this, Petr Skoda!
2004-08-29 03:54:51 +00:00
stronk7 b50ab1c6ac Define a bit better the 'automatic link' feature at glossary and entry levels.
Bug 1745
(http://moodle.org/bugs/bug.php?op=show&bugid=1745)
2004-08-29 00:06:28 +00:00
stronk7 486e156924 translated to es 2004-08-28 23:44:25 +00:00
stronk7 62368bd2a2 Slighty change
Merged from HEAD
2004-08-28 23:41:26 +00:00
stronk7 bbbfb3193b If we are updating an entry, compare current session user with
existing entry user to avoid some potential problems if secureforms=off
Perhaps too much security? Anyway thanks to skodak

(Bug 1823)
(http://moodle.org/bugs/bug.php?op=show&bugid=1823)
2004-08-28 23:20:39 +00:00
stronk7 c2716331a4 Avoid one notice 2004-08-28 19:58:55 +00:00
stronk7 a2ce999684 HTML editor (format popup) display wrong in glossary comments
Bug 1826
(http://moodle.org/bugs/bug.php?op=show&bugid=1826)
2004-08-28 19:45:35 +00:00
gustav_delius 8c8be6622e added explanation about non-editing teachers to help file 2004-08-28 19:27:46 +00:00
stronk7 ac75511c40 Now students cannot add/edit/delete entries if glossary->studentcanpost = 0
using manual URLs.
2004-08-28 19:10:47 +00:00
stronk7 c14abb9990 - students cannot add/edit/delete comments if it isn't allowed
- students can view comments if they exist
- teachers bypass the commentsallowed field always (this can be useful to create glossaries with public comments from the teacher).
- buttons are showed correctly.

Bug 1814
(http://moodle.org/bugs/bug.php?op=show&bugid=1814)
2004-08-28 18:30:39 +00:00
gustav_delius d97903b9ca improvement of online_users block on front page, suggested by Bruno, see bug # 1821 2004-08-28 18:29:55 +00:00
stronk7 356f6d69d2 Added compatibility in user->auth from 1.3 backups...$CFG->auth is used 2004-08-28 17:28:18 +00:00
gustav_delius d0437b3eab fixed name order in headings on log.php 2004-08-28 17:17:25 +00:00
moodler 799ce03dff Fixed a rarely-occurring problem when deleting a module sometimes. 2004-08-28 16:30:01 +00:00
moodler b4ad8b3d24 Added two new site-wide settings for the resource module so that the
admin can deternine the default state of the collapsible panes on the
resource creation screen.
2004-08-28 16:29:20 +00:00
moodler e8ef939008 Aded user preferences to the collapsing resources. Panel settings are
now remembered per user from one edit to the next.
2004-08-28 15:56:29 +00:00
mchurch ebea2dd039 Fixed some SQL statements so they work with PostGreSQL as well as MySQL.
Fix provided by paca.
2004-08-28 15:10:16 +00:00
defacer be37cf962d Candidate fix for bug 1808:
When upgrading from versions < 1.4, put blocks in the site front page by
default. This was already taken care of when doing a fresh install.

Please check the validity of the fix, if possible. It needs to be extended
to Postgres, Oracle and also merged to HEAD if everything's OK.
2004-08-28 12:33:25 +00:00
stronk7 c75a34409f changed timemodified to timecreated 2004-08-28 11:23:25 +00:00
stronk7 eb4409277e Now action is checked and defaults to edit.
Thanks skodak!

Bug 1813
(http://moodle.org/bugs/bug.php?op=show&bugid=1813)
2004-08-28 11:11:27 +00:00
stronk7 f7311bbe14 Now maxeditingtime for entries work againt timecreated instead of timemodified.
Thanks skodak!

Bug 1822
(http://moodle.org/bugs/bug.php?op=show&bugid=1822)
2004-08-28 10:52:54 +00:00
stronk7 04f1308619 Now user->auth is in backup & restore
Bug 1789
(http://moodle.org/bugs/bug.php?op=show&bugid=1789)
2004-08-28 10:19:34 +00:00
moodler 48143e5a51 Fix from a while back 2004-08-28 08:04:10 +00:00
moodler 223b5ee619 Merged changes from trunk 2004-08-28 07:57:57 +00:00
moodler 56fdffcfeb Fixed bug 1787 - clean_text doesn't work as expected on text with added slashes 2004-08-28 07:55:22 +00:00
moodler eb363f4d99 Added ellipses to buttons "Show settings..." 2004-08-28 05:15:57 +00:00
stronk7 1a625fd590 Some important changes arrive:
- 'editalways' applied to comments.
   - some minor notices out.
   - security bug solved:
      + users cannot edit any comment now.
      + users cannot delete any comment now.
      + users cannot edit any entry now.
      + users cannot delete any antry now.

Thanks to skodak, discovering the bug!!!
2004-08-28 00:23:09 +00:00
stronk7 7e71e010a7 Init 2 arrays 2004-08-27 17:20:02 +00:00
stronk7 bc213d6e8a Now, terms being defined in URLs aren't broken by the <nolink> tag.
Bug 1790
(http://moodle.org/bugs/bug.php?op=show&bugid=1790)
2004-08-27 16:46:22 +00:00
moodler 19dd3171b1 Merged Howard's changes from HEAD 2004-08-27 15:50:18 +00:00
moodler aff55f17a2 It's quick but it will do for now. 2004-08-27 11:47:15 +00:00
moodler 42f291c945 Tidied up form sections with javascript 2004-08-27 09:44:13 +00:00
stronk7 64c548ef7a Error when sending a delete-entry action to logs... 2004-08-27 09:12:03 +00:00
moodler 1404a13a33 Merged from trunk. Changes to file resource. 2004-08-27 09:06:36 +00:00
bobopinna 3e93cbe128 Updated to Moodle 1.4 Stable 2004-08-27 08:06:45 +00:00
julmis dafecdb3d9 Fixing Bug #1792 in Student view :-) 2004-08-27 06:37:54 +00:00
moodler 56e55d22ec Merged from HEAD 2004-08-27 04:42:30 +00:00
moodler ae2b896821 Merged Penny's fix from HEAD 2004-08-27 03:39:47 +00:00
stronk7 68467fbf94 Another duplicated tag....now it's really well-formed :-) 2004-08-27 00:57:35 +00:00
stronk7 b9f5885b4d Found it!!!!
A missing </select> was the cause to the wrong display under Safari!!!
2004-08-27 00:50:22 +00:00
stronk7 9f46966132 Solved some inconsistencies when using the HTML editor and the
format menu!!

One Curiosity: I've discovered a bug in Safari Browser. Edit any
multi-line definition entry and you will see it without line
breaks (not using the HTML editor). I've tried moving that textarea
to other positions in the page and then it works.
2004-08-27 00:00:28 +00:00
julmis 6d388d8e29 Added string editorresettodefaults. 2004-08-26 23:06:36 +00:00
stronk7 b6162f17e2 Strange typo.
Bug 1804
(http://moodle.org/bugs/bug.php?op=show&bugid=1804)
2004-08-26 22:36:17 +00:00
gustav_delius 9b1f47c6bd fixed my own typo, bug 1798 2004-08-26 22:17:07 +00:00
stronk7 ba1b26a543 One notice 2004-08-26 21:37:44 +00:00
julmis 53542fb830 Fixing Bug #1791 for real this time ;-) 2004-08-26 19:58:48 +00:00
julmis d390acad28 Added reset to defaults 2004-08-26 18:30:56 +00:00
julmis c27e555d40 Fix for Bug #1793 2004-08-26 17:27:33 +00:00
julmis 1fed924a16 Spell-button added to images directory 2004-08-26 17:24:58 +00:00
julmis 8009ff257a Spell-button to second row 2004-08-26 17:18:41 +00:00
julmis b7eccbf37f Spell-button to second row
Bug #1791 fix
Better debug mode compatibility
2004-08-26 17:10:36 +00:00
moodler 8428897528 OK, I've been having bad luck with this one. NOW it's fixed properly! 2004-08-26 15:08:11 +00:00
moodler 3a5cc3936d Dammit, I accidentally deleted a line. 2004-08-26 14:46:53 +00:00
bobopinna c0ee89d2dc Updated to Moodle 1.4 stable 2004-08-26 14:41:35 +00:00
moodler 6365268b3b 1. Delete is no longer shown on posts after maxeditingtime has expired
2.  Prune strings are cached (my that's an odd sentence)
3.  Last post links from discussion listing now work when there are no replies
2004-08-26 14:19:50 +00:00
moodler 1e27382ed1 Added Password and Phone 2
Frame is now default again
2004-08-26 12:58:59 +00:00
moodler e75647df91 FIxed bug 1799 - thanks Eloy! 2004-08-26 12:24:20 +00:00
stronk7 19b1bd0bc8 Recode page->userid at restore time. 2004-08-26 10:56:02 +00:00
defacer 72d8255f7e Fix for WHERE clauses in Postgres, submitted by Petri Asikainen.
Apparently, Postgres doesn't like "SELECT * FROM table WHERE 0"
2004-08-26 10:48:51 +00:00
defacer ca27c7f734 Small fixes and improvements. 2004-08-26 09:57:59 +00:00
defacer ebc9be85c7 1. Code restructuring
2. Small logic fixes (e.g. only delete chat_user records WHERE type='sockets')
3. More informative messages when rejecting connections for some reason
4. Better handling of updating chat_user records (lastping updated correctly)
5. Custom error handling, so that PHP errors show up in the trace()s
2004-08-26 08:48:15 +00:00
gustav_delius d1dec2d112 fixed bug in online user list, see http://moodle.org/mod/forum/discuss.php?d=11554 2004-08-26 04:11:46 +00:00
stronk7 f54e807d59 Notice out 2004-08-26 00:10:51 +00:00
mchurch ab37ddd5d2 Updated diff functions to handle HTML formatting a little better. 2004-08-25 20:31:30 +00:00
moodler 6e2c52bad7 This hack doesn't work, and it doesn't matter, but I'm leaving it in
in case someone can fix it later
2004-08-25 16:03:39 +00:00
moodler 7b4bb520ba Course passed properly to messages
Old chat_users all deleted on startup
2004-08-25 14:20:54 +00:00
mchurch ab55cb4107 Reorganized the attachment details page a bit, and added author info. 2004-08-25 13:39:18 +00:00
moodler 785d24f0f6 FIx for recent activity when sockets being used 2004-08-25 13:37:38 +00:00
mchurch 5d2f527449 Changed attachment section on content page to only display if there are
attachments, and then only as a link to the attachments control page.
2004-08-25 13:18:46 +00:00
mchurch b36a469ffc Changed title for attachments on content page. 2004-08-25 13:17:45 +00:00
moodler 1820e4e3f2 Fixed a style, just for Przemyslaw 2004-08-25 12:37:37 +00:00
defacer e55474005b *** TRANSLATOR ALERT ***
This commit contains changes and additions to the chat language file.

Better display and explanations for the chat config screen. Final tweaks to
chatd now that we know which settings we 'll be using and how.
2004-08-25 12:13:06 +00:00
defacer 6e82cd4cd3 Second part of changes. Doing this slowly to keep integrity between this branch and HEAD. 2004-08-25 10:57:43 +00:00
defacer 0b0d2241e3 Lots and lots of improvements! Foremost changes are:
1. The users window is now provided with BOTH JavaScript and HTTP refresh mechanisms
2. The daemon now reliably detects disconnected users even in the absence of chat
   activity. Coupled with the fact that the "users in chats" lists are now manipulated
   only by chatd, they have reached 100% accuracy. Even better than the "normal"
   version, since you can leave your chat open (and idle) for as long as you want
   _without_ being disconnected.
3. Better OOP.
2004-08-25 10:45:13 +00:00
moodler 7d9137d05a Merged fixes from HEAD 2004-08-25 09:21:44 +00:00
moodler 97a8cdafd6 FIxed international display of timezones using string 'strftimedaytime'
http://moodle.org/mod/forum/discuss.php?d=11510
2004-08-25 08:27:53 +00:00
moodler cc876bc667 I was trying to make the glossary link open in the parent window, but
I could not get it to work all the time.
2004-08-25 08:15:15 +00:00
moodler 5b5302faa8 Fixed tabs links when glossary called without id 2004-08-25 07:39:26 +00:00
moodler afa051933d Fixed showentry for POstgreSQLo
Moved SQL to its own function in lib.php
Added links to glossary for each entry
2004-08-25 07:36:29 +00:00
moodler 1281b0a7df Redundant cleaning removed 2004-08-25 05:09:31 +00:00
moodler 092f22eb7f Removing some cleaning see bug 1787 2004-08-25 05:07:30 +00:00
moodler e0f0b7bc2d Added USERID field to restore/backup bug 1788 2004-08-25 04:48:19 +00:00
mchurch e8df6a8946 Restoring summary view to attachments view. 2004-08-25 04:19:48 +00:00
moodler d00f113675 Info page -> History 2004-08-25 03:22:15 +00:00
moodler efe91196f3 Hiding attachment listing altogether 2004-08-25 03:19:50 +00:00
moodler b4d9eecbd0 Fixed my bug with the missing Attachments tab 2004-08-25 03:00:36 +00:00
mchurch d2049a8b7b Cleaned up attachment section of view page. 2004-08-25 02:51:15 +00:00
stronk7 cbac49ac50 Don't clean posted text on input (will be cleaned on output). 2004-08-24 22:56:24 +00:00
stronk7 ea4dec3080 Bump to beta!
I suppose that I cannot update the version number because I'm in a branch,
isn't it?
2004-08-24 22:34:06 +00:00
stronk7 e73ae3f14e Deleted to use the English version until it can be updated. 2004-08-24 21:44:56 +00:00
stronk7 4ec1c2a0bd Release info updated to 1.3.4 2004-08-24 21:42:13 +00:00
stronk7 834fc9fd91 one more warning out 2004-08-24 20:55:40 +00:00
stronk7 f3d2d06518 Avoid some warnings
Bug 1729
(http://moodle.org/bugs/bug.php?op=show&bugid=1729)
2004-08-24 20:35:43 +00:00
gustav_delius 2e32990a63 reduced $module->requires to 052505 after Martin put my new functions into that version. 2004-08-24 15:14:32 +00:00
defacer 4b31fcf608 Still better handling of console output, and starting to experiment with the
new idea of "externally" refreshing the users window for reliability.
2004-08-24 14:29:00 +00:00
moodler dd23e499f3 A default I never checked in auth_pop3mailbox => 'INBOX' 2004-08-24 14:24:14 +00:00
moodler 72fe9309f3 Fixed an echo -> mtrace 2004-08-24 14:23:01 +00:00
defacer 3b905f1aab Adding ID attributes to the frames. Better than NAMEs, for one, and also I
have a devious idea to vanquish user window dropouts once and for all...
2004-08-24 14:02:40 +00:00
defacer f11d5ccb4f Improvements in the way that STDOUT output is handled (turns out the constant
exists in PHP >= 4.3 and it's not defined() at all).

Don't let delete_old_users() kill sockets-type clients, we can do that on
our own, thank you.

Comment some trace()s.
2004-08-24 13:58:01 +00:00
mchurch 75c180d2e3 Set Moodle filtering for wiki text only. 2004-08-24 13:39:03 +00:00
gustav_delius ae7fb33a55 disabled email_protect plugin, see Bug #1775 2004-08-24 12:50:57 +00:00
defacer 7a89b30fac I may not be as productive a translator as Koen, but the ? lines in my CVS
updates were approaching the third page boundary! ;-)
2004-08-24 12:27:20 +00:00
defacer d9bdf8cb96 Brand new spiffy shining bright!
1. REAL support for command-line parameters! Pretty good too!
   (actually don't tell Jon, it gets to his head)
2. Can you show the "users in chat" normally now? Please?
2004-08-24 12:22:13 +00:00
stronk7 1a2e6cfb12 Now some CFG->glossary_XXXX are checked in lib.php.
Bug 1764
(http://moodle.org/bugs/bug.php?op=show&bugid=1764)
2004-08-24 11:20:01 +00:00
gustav_delius df85e55750 All the modules in which I made changes require the latest version of datalib.php. 2004-08-24 10:13:41 +00:00
moodler dba8c2802e Merged some changes from HEAD 2004-08-24 06:48:42 +00:00
moodler 67f2fae171 FIxed Upgrade feedback from SQL 2004-08-24 04:57:00 +00:00
gustav_delius bc1ed83f43 fixed small typo 2004-08-23 21:27:52 +00:00
gustav_delius 2559db73e6 fixed bug 1748 2004-08-23 21:26:03 +00:00
gustav_delius 956ad3b8a8 removed ancient german release notes 2004-08-23 20:46:01 +00:00
gustav_delius 0420e8715d removed empty bullet point 2004-08-23 20:34:52 +00:00
5379 changed files with 112074 additions and 232077 deletions
+34 -18
View File
@@ -1,8 +1,25 @@
README $Id$
------
QUICK INSTALL
=============
If you are installing the first time, then you
should read the installation guide which is
part of the Moodle documentation (along with
information about upgrading etc):
http://moodle.com/doc/
There is a copy of all this documentation as part of
this Moodle distribution. You can access your local
copy of the installation guide here:
lang/en/docs/install.html
Once Moodle is installed on your machine, then
you can also access a local copy of all this
documentation (localised to your language) at:
http://yourmoodlesite.com/doc/
For the impatient, here is a basic outline of the
installation process, which normally takes me only
@@ -10,26 +27,25 @@ a few minutes:
1) Move the Moodle files into your web directory.
2) Create a single database for Moodle to store all
2) Create an empty directory somewhere to store
uploaded files (NOT accessible via the web).
This directory must be writeable by the web server
process.
3) Create a single database for Moodle to store all
it's tables in (or choose an existing database).
3) Visit your Moodle site with a browser, you should
be taken to the install.php script, which will lead
you through creating a config.php file and then
setting up Moodle, creating an admin account etc.
4) Copy the file config-dist.php to config.php, and
edit it with all your own settings.
4) Set up a cron task to call the file admin/cron.php
5) Visit your new home page with a web browser. Moodle
will lead you through the rest of the setup,
creating an admin account and so on.
6) Set up a cron task to call the file admin/cron.php
every five minutes or so.
For more information, see the INSTALL DOCUMENTATION:
http://moodle.org/doc
If you have real trouble, please visit the Moodle course
"Using Moodle" on moodle.org.
Good luck and have fun!
Martin Dougiamas, Lead Developer
Cheers!
Martin Dougiamas
+38 -60
View File
@@ -51,19 +51,16 @@
$options[$module] = get_string("auth_$module"."title", "auth");
}
asort($options);
if (isset($_GET['auth'])) {
$auth = $_GET['auth'];
} else {
if (isset($_GET['auth'])) {
$auth = $_GET['auth'];
} else {
$auth = $config->auth;
}
}
$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)) {
$config->guestloginbutton = 1;
}
if (! isset($config->alternateloginurl)) {
$config->alternateloginurl = '';
}
if (! isset($config->auth_instructions)) {
$config->auth_instructions = "";
}
@@ -96,42 +93,39 @@
$strusers = get_string("users");
print_header("$site->shortname: $strauthenticationoptions", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $strauthenticationoptions", "$focus");
"<A HREF=\"index.php\">$stradministration</A> -> <a href=\"users.php\">$strusers</a> -> $strauthenticationoptions", "$focus");
echo "<center><b>";
echo "<form target=\"{$CFG->framename}\" name=\"authmenu\" method=\"post\" action=\"auth.php\">";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
echo "<CENTER><P><B>";
echo "<form TARGET=\"{$CFG->framename}\" NAME=\"authmenu\" method=\"post\" action=\"auth.php\">";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">";
print_string("chooseauthmethod","auth");
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?sesskey=$USER->sesskey&auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
choose_from_menu ($options, "auth", $auth, "","document.location='auth.php?sesskey=$USER->sesskey&auth='+document.authmenu.auth.options[document.authmenu.auth.selectedIndex].value", "");
echo "</b></center>";
print_simple_box_start("center", "100%");
echo "</B></P></CENTER>";
print_simple_box_start("center", "100%", "$THEME->cellheading");
print_heading($options[$auth]);
print_simple_box_start("center", "60%", '', 5, 'informationbox');
print_simple_box_start("center", "60%", "$THEME->cellcontent");
print_string("auth_$auth"."description", "auth");
print_simple_box_end();
echo "<hr />";
echo "<hr>";
print_heading($strsettings);
echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\">";
require_once("$CFG->dirroot/auth/$auth/config.html");
echo '<tr><td colspan="3">';
print_heading(get_string('auth_common_settings', 'auth'));
echo '<td/></tr>';
if ($auth != "email" and $auth != "none" and $auth != "manual") {
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
echo "<td align=right nowrap><p>";
print_string("changepassword", "auth");
echo ":</td>";
echo "<td>";
echo "<input type=\"text\" name=\"changepassword\" size=\"40\" value=\"$config->changepassword\" />";
echo ":</p></td>";
echo "<td>";
echo "<input type=\"text\" name=\"changepassword\" size=40 value=\"$config->changepassword\">";
echo "</td>";
echo "<td>";
print_string("changepasswordhelp","auth");
@@ -140,53 +134,37 @@
}
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
echo "<td align=right nowrap><p>";
print_string("guestloginbutton", "auth");
echo ":</td>";
echo "<td>";
echo ":</p></td>";
echo "<td>";
choose_from_menu($guestoptions, "guestloginbutton", $config->guestloginbutton, "");
echo "</td>";
echo "<td>";
print_string("showguestlogin","auth");
echo "</td></tr>";
if (function_exists('auth_user_create')){
echo "<tr valign=\"top\">";
echo "<td align=\"right\" nowrap=\"nowrap\">";
print_string("auth_user_create", "auth");
echo ":</td>";
echo "<td>";
choose_from_menu($createoptions, "auth_user_create", $config->auth_user_create, "");
echo "</td>";
echo "<td>";
print_string("auth_user_creation","auth");
echo "</td></tr>";
}
if (function_exists('auth_user_create')){
echo "<tr valign=\"top\">";
echo "<td align=right nowrap><p>";
print_string("auth_user_create", "auth");
echo ":</p></td>";
echo "<td>";
choose_from_menu($createoptions, "auth_user_create", $config->auth_user_create, "");
echo "</td>";
echo "<td>";
print_string("auth_user_creation","auth");
echo "</td></tr>";
}
echo "</table><center><p><input type=\"submit\" value=\"";
print_string("savechanges");
echo "\"></p></center></form>";
/// An alternate url for the login form. It means we can use login forms that are integrated
/// into non-moodle pages
echo '<tr valign="top">';
echo '<td algin="right" nowrap="nowrap">';
print_string('alternateloginurl', 'auth');
echo '</td>';
echo '<td>';
echo '<input type="text" size="40" name="alternateloginurl" alt="'.get_string('alternateloginurl', 'auth').'" value="'.$config->alternateloginurl.'" />';
echo '</td>';
echo '<td>';
print_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php'));
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<p align="center"><input type="submit" value="'.get_string('savechanges').'"></p>';
echo '</form>';
print_simple_box_end();
print_simple_box_end();
print_footer();
exit;
exit;
/// Functions /////////////////////////////////////////////////////////////////
+10 -6
View File
@@ -15,13 +15,17 @@
error("Site isn't defined!");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
//Initialise error variables
$error = false;
$sche_destination_error = "";
/// If data submitted, then process and store.
if (($config = data_submitted()) && confirm_sesskey()) {
if ($config = data_submitted()) {
//First of all we check that everything is correct
//Check for trailing slash and backslash in backup_sche_destination
@@ -73,7 +77,7 @@
}
if ($status) {
//get courses
if ($courses = get_records('course', '', '', '', 'id,shortname')) {
if ($courses = get_records("course")) {
//For each course, we check (insert, update) the backup_course table
//with needed data
foreach ($courses as $course) {
@@ -111,18 +115,18 @@
"<a href=\"configure.php\">$strconfiguration</a> -> ".
$strbackup);
echo "<p align=\"right\"><a href=\"../backup/log.php\">".get_string("logs")."</a></p>";
echo "<p align=right><a href=\"../backup/log.php\">".get_string("logs")."</a></p>";
print_heading($strbackup);
print_simple_box("<center>".get_string("adminhelpbackup")."</center>", "center", "50%");
echo "<br />";
print_simple_box_start("center");
print_simple_box_start("center", "", "$THEME->cellheading");
//Check for required functions...
if (!function_exists('utf8_encode')) {
notify("You need to add XML support to your PHP installation");
if(!function_exists('utf8_encode')) {
print_simple_box("<font color=\"red\">You need to add XML support to your PHP installation</font>", "center", "70%", "$THEME->cellheading", "20", "noticebox");
}
include ("$CFG->dirroot/backup/config.html");
+14 -33
View File
@@ -14,46 +14,33 @@
error("Site isn't defined!");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
require_variable($_REQUEST['block']);
$blockid = intval($_REQUEST['block']);
if(($blockrecord = blocks_get_record($blockid)) === false) {
if(($blockrecord = get_record('blocks', 'id', $blockid)) === false) {
error('This block does not exist');
}
$block = block_instance($blockrecord->name);
$block = block_instance($blockrecord->name, NULL);
if($block === false) {
error('Problem in instantiating block object');
}
// Define the data we're going to silently include in the instance config form here,
// so we can strip them from the submitted data BEFORE handling it.
$hiddendata = array(
'block' => $blockid,
'sesskey' => $USER->sesskey
);
/// If data submitted, then process and store.
/// If data submitted, then process and store.
if ($config = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if(!$block->has_config()) {
error('This block does not support global configuration');
}
$remove = array_keys($hiddendata);
foreach($remove as $item) {
unset($config->$item);
}
$block->config_save($config);
unset($config->block); // This will always be set if we have reached this point
$block->handle_config($config);
print_header();
redirect("$CFG->wwwroot/$CFG->admin/blocks.php", get_string("changessaved"), 1);
exit;
}
/// Otherwise print the form.
/// Otherwise print the form.
$stradmin = get_string('administration');
$strconfiguration = get_string('configuration');
@@ -67,17 +54,11 @@
print_heading($strblockname);
print_simple_box('<center>'.get_string('configwarning', 'admin').'</center>', 'center', '50%');
print_simple_box('<center>'.get_string('configwarning').'</center>', 'center', '50%');
echo '<br />';
echo '<form method="post" action="block.php">';
echo '<p>';
foreach($hiddendata as $name => $val) {
echo '<input type="hidden" name="'. $name .'" value="'. $val .'" />';
}
echo '</p>';
$block->config_print();
echo '</form>';
$block->print_config();
print_footer();
?>
+42 -63
View File
@@ -5,11 +5,11 @@
require_once('../config.php');
require_once($CFG->libdir.'/blocklib.php');
optional_variable($_GET['hide']);
optional_variable($_GET['show']);
optional_variable($_GET['delete']);
optional_variable($_GET['confirm'], 0);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_INT);
$multiple = optional_param('multiple', 0, PARAM_INT);
$delete = $_GET['delete']; // Dependency remover
require_login();
@@ -32,9 +32,8 @@
$strhide = get_string('hide');
$strshow = get_string('show');
$strsettings = get_string('settings');
$strcourses = get_string('blockinstances', 'admin');
$strcourses = get_string('courses');
$strname = get_string('name');
$strmultiple = get_string('blockmultiple', 'admin');
print_header("$site->shortname: $strmanageblocks", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
@@ -45,35 +44,27 @@
/// If data submitted, then process and store.
if (!empty($hide) && confirm_sesskey()) {
if (!$block = get_record('block', 'id', $hide)) {
if (!empty($_GET['hide']) and confirm_sesskey()) {
if (!$block = get_record('blocks', 'id', $_GET['hide'])) {
error("Block doesn't exist!");
}
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
set_field('blocks', 'visible', '0', 'id', $block->id); // Hide block
}
if (!empty($show) && confirm_sesskey() ) {
if (!$block = get_record('block', 'id', $show)) {
if (!empty($_GET['show']) and confirm_sesskey() ) {
if (!$block = get_record('blocks', 'id', $_GET['show'])) {
error("Block doesn't exist!");
}
set_field('block', 'visible', '1', 'id', $block->id); // Show block
set_field('blocks', 'visible', '1', 'id', $block->id); // Show block
}
if (!empty($multiple) && confirm_sesskey()) {
if (!$block = blocks_get_record($multiple)) {
error("Block doesn't exist!");
}
$block->multiple = !$block->multiple;
update_record('block', $block);
}
if (!empty($delete) and confirm_sesskey()) {
if (!empty($delete) && confirm_sesskey()) {
if (!$block = blocks_get_record($delete)) {
if (!$block = get_record('blocks', 'id', $delete)) {
error("Block doesn't exist!");
}
$blockobject = block_instance($block->name);
$blockobject = block_instance($block->name, $site);
$strblockname = $blockobject->get_title();
if (!$_GET['confirm']) {
@@ -85,16 +76,11 @@
} else {
// Delete block
if (!delete_records('block', 'id', $block->id)) {
if (!delete_records('blocks', 'id', $block->id)) {
notify("Error occurred while deleting the $strblockname record from blocks table");
}
$instances = get_records('block_instance', 'blockid', $block->id);
if(!empty($instances)) {
foreach($instances as $instance) {
blocks_delete_instance($instance);
}
}
blocks_update_every_block_by_id($block->id, 'delete'); // Delete blocks in all courses by id
// Then the tables themselves
@@ -119,12 +105,12 @@
/// Get and sort the existing blocks
if (false === ($blocks = get_records('block'))) {
if (false === ($blocks = get_records('blocks'))) {
error('No blocks found!'); // Should never happen
}
foreach ($blocks as $block) {
if(($blockobject = block_instance($block->name)) === false) {
if(($blockobject = block_instance($block->name, NULL)) === false) {
// Failed to load
continue;
}
@@ -140,59 +126,52 @@
/// Print the table of all blocks
$table->head = array ($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strmultiple, $strdelete, $strsettings);
$table->align = array ('left', 'right', 'left', 'center', 'center', 'center', 'center');
$table->wrap = array ('nowrap', '', '', '', '', '', '');
$table->size = array ('100%', '10', '10', '10', '10','12');
$table->width = '100';
if (empty($THEME->custompix)) {
$pixpath = '../pix';
// [pj] This is not used anywhere, but I'm leaving it in for the future
//$modpixpath = '../mod';
} else {
$pixpath = '../theme/'.$CFG->theme.'/pix';
// [pj] This is not used anywhere, but I'm leaving it in for the future
//$modpixpath = '../theme/'.$CFG->theme.'/pix/mod';
}
$table->head = array ($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strdelete, $strsettings);
$table->align = array ('LEFT', 'RIGHT', 'LEFT', 'CENTER', 'CENTER', 'CENTER');
$table->wrap = array ("NOWRAP", "", "", "", "","");
$table->size = array ("100%", "10", "10", "10", "10","12");
$table->width = "100";
foreach ($blockbyname as $blockname => $blockid) {
// [pj] This is not used anywhere, but I'm leaving it in for the future
//$icon = "<img src=\"$modpixpath/$block->name/icon.gif\" hspace=10 height=16 width=16 border=0>";
$blockobject = $blockobjects[$blockid];
$delete = '<a href="blocks.php?delete='.$blockid.'&sesskey='.$USER->sesskey.'">'.$strdelete.'</a>';
$settings = ''; // By default, no configuration
if($blockobject->has_config()) {
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
$settings = '<a href="block.php?block='.$blockid.'&sesskey='.$USER->sesskey.'">'.$strsettings.'</a>';
}
$count = count_records('block_instance', 'blockid', $blockid);
$count = blocks_get_courses_using_block_by_id($blockid);
$class = ''; // Nothing fancy, by default
if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&sesskey='.$USER->sesskey.'" title="'.$strhide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" height="16" width="16" alt="" /></a>';
'<img src="'.$pixpath.'/i/hide.gif" style="height: 16px; width: 16px;" /></a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&sesskey='.$USER->sesskey.'" title="'.$strshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" height="16" width="16" alt="" /></a>';
'<img src="'.$pixpath.'/i/show.gif" style="height: 16px; width: 16px;" /></a>';
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($blockobject->instance_allow_multiple()) {
if($blocks[$blockid]->multiple) {
$multiple = '<nobr>'.get_string('yes').' (<a href="blocks.php?multiple='.$blockid.'&sesskey='.$USER->sesskey.'">'.get_string('change', 'admin').'</a>)</nobr>';
}
else {
$multiple = '<nobr>'.get_string('no').' (<a href="blocks.php?multiple='.$blockid.'&sesskey='.$USER->sesskey.'">'.get_string('change', 'admin').'</a>)</nobr>';
}
}
else {
$multiple = '';
}
$table->data[] = array(
'<span'.$class.'>'.$blockobject->get_title().'</span>',
$count,
$blockobject->get_version(),
$visible,
$multiple,
$delete,
$settings
);
$table->data[] = array ('<p'.$class.'>'.$blockobject->get_title().'</p>', $count, $blockobject->get_version(), $visible, $delete, $settings);
}
echo '<p>';
print_table($table);
echo '</p>';
print_footer();
?>
-67
View File
@@ -1,67 +0,0 @@
<form method="post" action="calendar.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table class="formtable">
<tr>
<th>adminseesall:</th>
<td>
<div><?php print_string('helpadminseesall', 'admin'); ?></div>
<p>
<select name="adminseesallcourses">
<option value="0" <?php if(empty($CFG->calendar_adminseesall)) echo "selected='selected'"; ?>><?php print_string('adminseesownevents', 'admin'); ?></option>
<option value="1" <?php if(!empty($CFG->calendar_adminseesall)) echo "selected='selected'"; ?>><?php print_string('adminseesallevents', 'admin'); ?></option>
</select>
</p>
</td>
</tr>
<tr>
<th>startwday:</th>
<td>
<div><?php print_string('helpstartofweek', 'admin'); ?></div>
<p><?php choose_from_menu($weekdays, 'startwday', empty($CFG->calendar_startwday) ? 0 : $CFG->calendar_startwday, ''); ?></p>
</td>
</tr>
<tr>
<th>weekenddays:</th>
<td>
<div><?php print_string('helpweekenddays', 'admin'); ?></div>
<p>
<input type="checkbox" name="weekend[]" value="1" id="weekend1" <?php if(CALENDAR_WEEKEND & 2) echo 'checked="checked"'; ?> /> <label for="weekend1"><?php print_string('monday', 'calendar'); ?></label>
<input type="checkbox" name="weekend[]" value="2" id="weekend2" <?php if(CALENDAR_WEEKEND & 4) echo 'checked="checked"'; ?> /> <label for="weekend2"><?php print_string('tuesday', 'calendar'); ?></label>
<input type="checkbox" name="weekend[]" value="3" id="weekend3" <?php if(CALENDAR_WEEKEND & 8) echo 'checked="checked"'; ?> /> <label for="weekend3"><?php print_string('wednesday', 'calendar'); ?></label>
<input type="checkbox" name="weekend[]" value="4" id="weekend4" <?php if(CALENDAR_WEEKEND & 16) echo 'checked="checked"'; ?> /> <label for="weekend4"><?php print_string('thursday', 'calendar'); ?></label>
<input type="checkbox" name="weekend[]" value="5" id="weekend5" <?php if(CALENDAR_WEEKEND & 32) echo 'checked="checked"'; ?> /> <label for="weekend5"><?php print_string('friday', 'calendar'); ?></label>
<input type="checkbox" name="weekend[]" value="6" id="weekend6" <?php if(CALENDAR_WEEKEND & 64) echo 'checked="checked"'; ?> /> <label for="weekend6"><?php print_string('saturday', 'calendar'); ?></label>
<input type="checkbox" name="weekend[]" value="0" id="weekend0" <?php if(CALENDAR_WEEKEND & 1) echo 'checked="checked"'; ?> /> <label for="weekend0"><?php print_string('sunday', 'calendar'); ?></label>
</p>
</td>
</tr>
<tr>
<th>upcoming_lookahead:</th>
<td>
<div><?php print_string('helpupcominglookahead', 'admin'); ?></div>
<p><input type="text" name="lookahead" size="3" value="<?php echo CALENDAR_UPCOMING_DAYS; ?>" /></p>
</td>
</tr>
<tr>
<th>upcoming_maxevents:</th>
<td>
<div><?php print_string('helpupcomingmaxevents', 'admin'); ?></div>
<p><input type="text" name="maxevents" size="3" value="<?php echo CALENDAR_UPCOMING_MAXEVENTS; ?>" /></p>
</td>
</tr>
<tr>
<th>timezones:</th>
<td>
<div><?php print_string('helpforcetimezone', 'admin'); ?></div>
<p><?php choose_from_menu($timezones, 'forcetimezone', $CFG->forcetimezone, get_string('timezonenotforced', 'admin'), '', '99'); ?></p>
<p><a href="timezoneimport.php"><?php print_string('importtimezones', 'admin'); ?>...</a></p>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="<?php print_string('savechanges'); ?>" />
</td>
</tr>
</table>
</form>
-99
View File
@@ -1,99 +0,0 @@
<?PHP // $Id$
// Allows the admin to configure calendar and date/time stuff
require_once('../config.php');
require_login();
if (!isadmin()) {
error('Only administrators can use this page!');
}
if (!$site = get_site()) {
error('Site isn\'t defined!');
}
/// Print headings
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strcalendarsettings = get_string('calendarsettings', 'admin');
print_header("$site->shortname: $strcalendarsettings", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strcalendarsettings");
print_heading($strcalendarsettings);
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
if(isset($form->adminseesallcourses)) {
set_config('calendar_adminseesall', intval($form->adminseesallcourses) != 0);
unset($SESSION->cal_courses_shown);
}
if(isset($form->forcetimezone)) {
// To protect from SQL injections ...
$form->forcetimezone = str_replace(';', '', $form->forcetimezone);
$form->forcetimezone = str_replace('\'', '', $form->forcetimezone);
set_config('forcetimezone', $form->forcetimezone);
}
if(isset($form->startwday)) {
$startwday = intval($form->startwday);
if($startwday >= 0 && $startwday <= 6) {
set_config('calendar_startwday', $startwday);
}
}
if(isset($form->weekend)) {
if(is_array($form->weekend)) {
// Creating a packed bitfield; look at /calendar/lib.php if you can't figure it out
$bitfield = 0;
foreach($form->weekend as $day) {
$bitfield |= (1 << (intval($day) % 7));
}
if($bitfield > 0) {
set_config('calendar_weekend', $bitfield);
}
}
}
if(isset($form->lookahead)) {
$lookahead = intval($form->lookahead);
if($lookahead > 0) {
set_config('calendar_lookahead', $lookahead);
}
}
if(isset($form->maxevents)) {
$maxevents = intval($form->maxevents);
if($maxevents > 0) {
set_config('calendar_maxevents', $maxevents);
}
}
redirect('index.php');
}
// Include the calendar library AFTER modifying the data, so we read the latest values
require_once($CFG->dirroot.'/calendar/lib.php');
// Populate some variables we 're going to need in calendar.html
$timezones = get_list_of_timezones();
$weekdays = array(
0 => get_string('sunday', 'calendar'),
1 => get_string('monday', 'calendar'),
2 => get_string('tuesday', 'calendar'),
3 => get_string('wednesday', 'calendar'),
4 => get_string('thursday', 'calendar'),
5 => get_string('friday', 'calendar'),
6 => get_string('saturday', 'calendar')
);
// Main display starts here
print_simple_box_start("center", "80%");
include('./calendar.html');
print_simple_box_end();
print_footer();
?>
+619
View File
@@ -0,0 +1,619 @@
<form method="post" action="config.php" name="form">
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td align=right><p>lang:</td>
<td>
<?php choose_from_menu (get_list_of_languages(), "lang", $config->lang, "", "", ""); ?>
</td>
<td>
<?php print_string("configlang") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>langmenu:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "langmenu", $config->langmenu, "", "", "");
?>
</td>
<td>
<?php print_string("configlangmenu") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>langlist:</td>
<td>
<input name=langlist type=text size=40 value="<?php p($config->langlist) ?>">
</td>
<td>
<?php print_string("configlanglist") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>locale:</td>
<td>
<input name=locale type=text size=10 value="<?php p($config->locale) ?>">
</td>
<td>
<?php print_string("configlocale") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>timezone:</td>
<td><?php
if (abs($config->timezone) > 13) {
$config->timezone = 99;
}
$timenow = time();
$timeformat = get_string('strftimedaytime');
for ($tz = -26; $tz <= 26; $tz++) {
$zone = (float)$tz/2.0;
$usertime = $timenow + ($tz * 1800);
if ($tz == 0) {
$timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT)";
} else if ($tz < 0) {
$timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT$zone)";
} else {
$timezones["$zone"] = gmstrftime($timeformat, $usertime)." (GMT+$zone)";
}
}
choose_from_menu ($timezones, "timezone", $config->timezone, get_string("serverlocaltime"), "", "99");
?>
</td>
<td>
<?php print_string("configtimezone") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>country:</td>
<td><?php choose_from_menu (get_list_of_countries(), "country", $config->country, get_string("selectacountry"), "") ?>
</td>
<td>
<?php print_string("configcountry") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>smtphosts:</td>
<td>
<input name=smtphosts type=text size=30 value="<?php p($config->smtphosts)?>">
</td>
<td>
<?php print_string("configsmtphosts") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>smtpuser:</td>
<td>
<input name=smtpuser type=text size=10 value="<?php p($config->smtpuser)?>">
</td>
<td rowspan=2>
<?php print_string("configsmtpuser") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>smtppass:</td>
<td>
<input name=smtppass type=text size=10 value="<?php p($config->smtppass)?>">
</td>
</tr>
<tr valign=top>
<td align=right><p>noreplyaddress:</td>
<td>
<input name=noreplyaddress type=text size=30 value="<?php p($config->noreplyaddress)?>">
</td>
<td>
<?php print_string("confignoreplyaddress") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>gdversion:</td>
<td>
<?php
unset($options);
$options[0] = get_string("gdnot");
$options[1] = get_string("gd1");
$options[2] = get_string("gd2");
$installed = check_gd_version();
choose_from_menu ($options, "gdversion", $installed, "", "", "");
?>
</td>
<td>
<?php print_string("configgdversion") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>maxeditingtime:</td>
<td>
<?php
unset($options);
$options[3600] = get_string("numminutes", "", 60);
$options[2700] = get_string("numminutes", "", 45);
$options[1800] = get_string("numminutes", "", 30);
$options[900] = get_string("numminutes", "", 15);
$options[300] = get_string("numminutes", "", 5);
$options[60] = get_string("numminutes", "", 1);
choose_from_menu ($options, "maxeditingtime", $config->maxeditingtime, "", "", "");
?>
</td>
<td>
<?php print_string("configmaxeditingtime") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>longtimenosee:</td>
<td>
<?php
unset($options);
$options[1000] = get_string("numdays", "", 1000);
$options[365] = get_string("numdays", "", 365);
$options[180] = get_string("numdays", "", 180);
$options[150] = get_string("numdays", "", 150);
$options[120] = get_string("numdays", "", 120);
$options[90] = get_string("numdays", "", 90);
$options[60] = get_string("numdays", "", 60);
$options[30] = get_string("numdays", "", 30);
$options[21] = get_string("numdays", "", 21);
$options[14] = get_string("numdays", "", 14);
$options[7] = get_string("numdays", "", 7);
choose_from_menu ($options, "longtimenosee", $config->longtimenosee, "", "", "");
?>
</td>
<td>
<?php print_string("configlongtimenosee") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>deleteunconfirmed:</td>
<td>
<?php
unset($options);
$options[0] = get_string("never");
$options[168] = get_string("numdays", "", 7);
$options[144] = get_string("numdays", "", 6);
$options[120] = get_string("numdays", "", 5);
$options[96] = get_string("numdays", "", 4);
$options[72] = get_string("numdays", "", 3);
$options[48] = get_string("numdays", "", 2);
$options[24] = get_string("numdays", "", 1);
$options[12] = get_string("numhours", "", 12);
$options[6] = get_string("numhours", "", 6);
$options[1] = get_string("numhours", "", 1);
choose_from_menu ($options, "deleteunconfirmed", $config->deleteunconfirmed, "", "", "");
?>
</td>
<td>
<?php print_string("configdeleteunconfirmed") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>loglifetime:</td>
<td>
<?php
unset($options);
$options[0] = get_string("neverdeletelogs");
$options[1000] = get_string("numdays", "", 1000);
$options[365] = get_string("numdays", "", 365);
$options[180] = get_string("numdays", "", 180);
$options[150] = get_string("numdays", "", 150);
$options[120] = get_string("numdays", "", 120);
$options[90] = get_string("numdays", "", 90);
$options[60] = get_string("numdays", "", 60);
$options[30] = get_string("numdays", "", 30);
choose_from_menu ($options, "loglifetime", $config->loglifetime, "", "", "");
?>
</td>
<td>
<?php print_string("configloglifetime") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><p>displayloginfailures:</p></td>
<td>
<?php
unset($options);
$options[''] = get_string('nobody');
$options['admin'] = get_string('administrators');
$options['teacher'] = get_string('administratorsandteachers');
$options['everybody'] = get_string('everybody');
choose_from_menu($options, "displayloginfailures",$config->displayloginfailures,"","","");
?>
</td>
<td>
<?php print_string("configdisplayloginfailures") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><p>notifyloginfailures:</p></td>
<td>
<?php
unset($options);
$options[''] = get_string('nobody');
$options['mainadmin'] = get_string('administrator');
$options['alladmins'] = get_string('administratorsall');
choose_from_menu($options,"notifyloginfailures",$config->notifyloginfailures,"","","");
?>
</td>
<td>
<?php print_string('confignotifyloginfailures') ?>
</td>
</tr>
<tr valign="top">
<td align="right"><p>notifyloginthreshold:</p></td>
<td>
<?php
unset($options);
for ($i=1; $i<=100; $i++) {
$options[$i] = "$i";
}
choose_from_menu($options,"notifyloginthreshold",$config->notifyloginthreshold,"","","");
?>
</td>
<td>
<?php print_string('confignotifyloginthreshold') ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>sessiontimeout:</td>
<td>
<?php
unset($options);
$options[14400] = get_string("numhours", "", 4);
$options[10800] = get_string("numhours", "", 3);
$options[7200] = get_string("numhours", "", 2);
$options[5400] = get_string("numhours", "", "1.5");
$options[3600] = get_string("numminutes", "", 60);
$options[2700] = get_string("numminutes", "", 45);
$options[1800] = get_string("numminutes", "", 30);
$options[900] = get_string("numminutes", "", 15);
$options[300] = get_string("numminutes", "", 5);
choose_from_menu ($options, "sessiontimeout", $config->sessiontimeout, "", "", "");
?>
</td>
<td>
<?php print_string("configsessiontimeout") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>sessioncookie:</td>
<td>
<input name=sessioncookie type=text size=10 value="<?php p($config->sessioncookie)?>">
</td>
<td>
<?php print_string("configsessioncookie") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>zip:</td>
<td>
<input name=zip type=text size=30 value="<?php p($config->zip) ?>">
</td>
<td>
<?php print_string("configzip") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>unzip:</td>
<td>
<input name=unzip type=text size=30 value="<?php p($config->unzip) ?>">
</td>
<td>
<?php print_string("configunzip") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>slasharguments:</td>
<td>
<?php unset($options);
$options[0] = "file.php?file=/pic.jpg";
$options[1] = "file.php/pic.jpg";
choose_from_menu ($options, "slasharguments", $config->slasharguments, "", "", "");
?>
</td>
<td>
<?php print_string("configslasharguments") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>proxyhost:</td>
<td>
<input name=proxyhost type=text size=30 value="<?php p($config->proxyhost) ?>">
</td>
<td rowspan=2>
<?php print_string("configproxyhost") ?>
</td>
</TR>
<tr valign=top>
<td align=right><p>proxyport:</td>
<td>
<input name=proxyport type=text size=5 value="<?php p($config->proxyport) ?>">
</td>
</tr>
<tr valign=top>
<td align=right><p>debug:</td>
<td>
<?php
unset($options);
$options[7] = get_string("no");
$options[15] = get_string("yes");
choose_from_menu ($options, "debug", $config->debug, "", "", "");
?>
</td>
<td>
<?php print_string("configdebug") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>framename:</td>
<td>
<?php
if (empty($config->framename)) {
$config->framename = "_top";
}
?>
<input name=framename type=text size=15 value="<?php p($config->framename)?>">
</td>
<td>
<?php print_string("configframename") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>secureforms:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "secureforms", $config->secureforms, "", "", "");
?>
</td>
<td>
<?php print_string("configsecureforms") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>loginhttps:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "loginhttps", $config->loginhttps, "", "", "");
?>
</td>
<td>
<?php print_string("configloginhttps") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>teacherassignteachers:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "teacherassignteachers", $config->teacherassignteachers, "", "", "");
?>
</td>
<td>
<?php print_string("configteacherassignteachers") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>allusersaresitestudents:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "allusersaresitestudents", $config->allusersaresitestudents, "", "", "");
?>
</td>
<td>
<?php print_string("configallusersaresitestudents") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>showsiteparticipantslist:</td>
<td>
<?php
unset($options);
$options[0] = get_string("siteteachers");
$options[1] = get_string("allteachers");
$options[2] = get_string("studentsandteachers");
choose_from_menu ($options, "showsiteparticipantslist", $config->showsiteparticipantslist, "", "", "");
?>
</td>
<td>
<?php print_string("configshowsiteparticipantslist") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>allowunenroll:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "allowunenroll", $config->allowunenroll, "", "", "");
?>
</td>
<td>
<?php print_string("configallowunenroll") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>maxbytes:</td>
<td>
<?php
$options = get_max_upload_sizes();
choose_from_menu ($options, "maxbytes", $config->maxbytes, "");
?>
</td>
<td>
<?php print_string("configmaxbytes") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>fullnamedisplay:</td>
<td>
<?php
unset($options);
$options['language'] = get_string('language');
$options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname');
$options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname');
$options['firstname'] = get_string('firstname');
choose_from_menu ($options, "fullnamedisplay", $config->fullnamedisplay, "", "", "");
?>
</td>
<td>
<?php print_string("configfullnamedisplay") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>extendedusernamechars:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "extendedusernamechars", $config->extendedusernamechars, "", "", "");
?>
</td>
<td>
<?php print_string("configextendedusernamechars") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>autologinguests:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "autologinguests", $config->autologinguests, "", "", "");
?>
</td>
<td>
<?php print_string("configautologinguests") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>forcelogin:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "forcelogin", $config->forcelogin, "", "", "");
?>
</td>
<td>
<?php print_string("configforcelogin") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>forceloginforprofiles:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "forceloginforprofiles", $config->forceloginforprofiles, "", "", "");
?>
</td>
<td>
<?php print_string("configforceloginforprofiles") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>opentogoogle:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "opentogoogle", $config->opentogoogle, "", "", "");
?>
</td>
<td>
<?php print_string("configopentogoogle") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>enablerssfeeds:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "enablerssfeeds", $config->enablerssfeeds, "", "", "");
?>
</td>
<td>
<?php
print_string("configenablerssfeeds");
//Check for required functions...
if(!function_exists('utf8_encode')) {
echo "<font color=\"red\"> You need to add XML support to your PHP installation.</font>";
}
?>
</td>
</tr>
<tr valign=top>
<td align=right><p>digestmailtime:</td>
<td>
<?php
$hours = array();
for ($i=0; $i<=23; $i++) {
$hours[$i] = sprintf("%02d",$i);
}
choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, "");
?>
</td>
<td>
<?php
print_string('configdigestmailtime');
?>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="hidden" name="sesskey" value="<?php p($sesskey) ?>">
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
</tr>
</table>
</form>
+28 -82
View File
@@ -1,25 +1,25 @@
<?php // $Id$
<?PHP // $Id$
// config.php - allows admin to edit all configuration variables
require_once('../config.php');
require_once("../config.php");
if ($site = get_site()) { // If false then this is a new installation
require_login();
if (!isadmin()) {
error('Only the admin can use this page');
error("Only the admin can use this page");
}
}
/// This is to overcome the "insecure forms paradox"
if (isset($secureforms) and $secureforms == 0) {
$match = 'nomatch';
$match = "nomatch";
} else {
$match = '';
$match = "";
}
/// If data submitted, then process and store.
if ($config = data_submitted($match)) {
if ($config = data_submitted($match)) {
if (!empty($USER->id)) { // Additional identity check
if (!confirm_sesskey()) {
@@ -38,18 +38,18 @@
unset($conf);
$conf->name = $name;
$conf->value = $value;
if ($current = get_record('config', 'name', $name)) {
if ($current = get_record("config", "name", $name)) {
$conf->id = $current->id;
if (! update_record('config', $conf)) {
if (! update_record("config", $conf)) {
notify("Could not update $name to $value");
}
} else {
if (! insert_record('config', $conf)) {
if (! insert_record("config", $conf)) {
notify("Error: could not add new variable $name !");
}
}
}
redirect('index.php', get_string('changessaved'), 1);
redirect("index.php", get_string("changessaved"), 1);
exit;
} else {
@@ -57,26 +57,23 @@
$focus = "form.$key";
}
}
}
}
/// Otherwise fill and print the form.
if (empty($config)) {
$config = $CFG;
if (!$config->locale = get_field('config', 'value', 'name', 'locale')) {
if (!$config->locale = get_field("config", "value", "name", "locale")) {
$config->locale = $CFG->lang;
}
}
if (empty($focus)) {
$focus = '';
$focus = "";
}
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
$stradmin = get_string('administration');
$strconfiguration = get_string('configuration');
$strconfigvariables = get_string('configvariables', 'admin');
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
$strconfigvariables = get_string("configvariables");
if ($site) {
print_header("$site->shortname: $strconfigvariables", $site->fullname,
@@ -86,78 +83,26 @@
} else {
print_header();
print_heading($strconfigvariables);
print_simple_box(get_string('configintro', 'admin'), 'center', "50%");
echo '<br />';
print_simple_box(get_string("configintro"), "center", "50%");
echo "<br />";
}
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
/// Get all the configuration fields and helptext
include('configvars.php');
/// Cycle through the sections to get the sectionnames
$linktext = '';
foreach($configvars as $sectionname=>$section) {
if ($linktext !== '') {
$linktext .= ' | ';
}
$linktext .= '<a href="#configsection'.$sectionname.'">'.get_string('configsection'.$sectionname, 'admin').'</a>';
}
echo "<center>$linktext</center>\n";
print_simple_box_start('center');
echo '<form method="post" action="config.php" name="form">';
/// Cycle through each section of the configuration
foreach ($configvars as $sectionname=>$section) {
print_heading('<a name="configsection'.$sectionname.'"></a>'.get_string('configsection'.$sectionname, 'admin'));
$table = NULL;
$table->data = array();
foreach ($section as $configvariable=>$configobject) {
$table->data[] = array ( $configvariable.': ',
$configobject->field
);
if ($configobject->display_warning()) {
$table->data[] = array ( '&nbsp;',
'<span class="configwarning">'.$configobject->warning.'</span>'
);
}
$table->data[] = array ( '&nbsp;',
'<span class="confighelp">'.$configobject->help.'</span>'
);
$table->align = array ('right', 'left');
}
print_table($table);
}
echo '<center>';
echo '<input type="hidden" name="sesskey" value="'.$sesskey.'" />';
echo '<input type="submit" value="'.get_string('savechanges').'" />';
echo '</center>';
echo '</form>';
print_simple_box_start("center", "", "$THEME->cellheading");
include("config.html");
print_simple_box_end();
/// Lock some options
$httpsurl = str_replace('http://', 'https://', $CFG->wwwroot);
if ($httpsurl != $CFG->wwwroot) {
if (ini_get('allow_url_fopen')) {
if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
echo '<script type="text/javascript">'."\n";
echo '<!--'."\n";
echo "eval('document.form.loginhttps.disabled=true');\n";
echo '-->'."\n";
echo '</script>'."\n";
}
if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
echo '<script>'."\n";
echo '<!--'."\n";
echo "eval('document.form.loginhttps.disabled=true');\n";
echo '-->'."\n";
echo '</script>'."\n";
}
}
@@ -177,4 +122,5 @@ function validate_form(&$form, &$err) {
return true;
}
?>
+27 -30
View File
@@ -1,52 +1,49 @@
<?php // $Id$
<?PHP // $Id$
require_once('../config.php');
require_once("../config.php");
require_login();
if (!isadmin()) {
error('Only admins can access this page');
error("Only admins can access this page");
}
if (!$site = get_site()) {
redirect('index.php');
redirect("index.php");
}
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
print_header("$site->shortname: $stradministration: $strconfiguration", "$site->fullname",
'<a href="index.php">'. "$stradministration</a> -> $strconfiguration");
"<a href=\"index.php\">$stradministration</a> -> $strconfiguration");
print_heading($strconfiguration);
$table->align = array ('right', 'left');
$table->align = array ("right", "left");
$table->data[] = array("<strong><a href=\"config.php\">". get_string('configvariables', 'admin') .'</a></strong>',
get_string('adminhelpconfigvariables'));
$table->data[] = array("<strong><a href=\"site.php\">". get_string('sitesettings') .'</a></strong>',
get_string('adminhelpsitesettings'));
$table->data[] = array("<strong><a href=\"../theme/index.php\">". get_string('themes') .'</a></strong>',
get_string('adminhelpthemes'));
$table->data[] = array("<strong><a href=\"lang.php\">". get_string('language') .'</a></strong>',
get_string('adminhelplanguage'));
$table->data[] = array("<strong><a href=\"modules.php\">".get_string('managemodules'). ' </a></strong>',
get_string('adminhelpmanagemodules'));
$table->data[] = array("<strong><a href=\"blocks.php\">". get_string('manageblocks') .'</a></strong>',
get_string('adminhelpmanageblocks'));
$table->data[] = array("<strong><a href=\"filters.php\">". get_string('managefilters') .'</a></strong>',
get_string('adminhelpmanagefilters'));
$table->data[] = array("<b><a href=\"config.php\">".get_string("configvariables")."</a></b>",
get_string("adminhelpconfigvariables"));
$table->data[] = array("<b><a href=\"site.php\">".get_string("sitesettings")."</a></b>",
get_string("adminhelpsitesettings"));
$table->data[] = array("<b><a href=\"../theme/index.php\">".get_string("themes")."</a></b>",
get_string("adminhelpthemes"));
$table->data[] = array("<b><a href=\"lang.php\">".get_string("language")."</a></b>",
get_string("adminhelplanguage"));
$table->data[] = array("<b><a href=\"modules.php\">".get_string("managemodules")."</a></b>",
get_string("adminhelpmanagemodules"));
$table->data[] = array("<b><a href=\"blocks.php\">".get_string("manageblocks")."</a></b>",
get_string("adminhelpmanageblocks"));
$table->data[] = array("<b><a href=\"filters.php?sesskey=$USER->sesskey\">".get_string("managefilters")."</a></b>",
get_string("adminhelpmanagefilters"));
if (!isset($CFG->disablescheduledbackups)) {
$table->data[] = array("<strong><a href=\"backup.php\">".get_string("backup")."</a></strong>",
get_string('adminhelpbackup'));
$table->data[] = array("<b><a href=\"backup.php?sesskey=$USER->sesskey\">".get_string("backup")."</a></b>",
get_string("adminhelpbackup"));
}
$table->data[]= array("<strong><a href=\"editor.php\">". get_string('editorsettings') ."</a></strong>",
get_string('adminhelpeditorsettings'));
$table->data[]= array("<strong><a href=\"calendar.php\">". get_string('calendarsettings', 'admin') ."</a></strong>",
get_string('helpcalendarsettings', 'admin'));
$table->data[]= array("<strong><a href=\"maintenance.php\">". get_string('sitemaintenancemode', 'admin') ."</a></strong>",
get_string('helpsitemaintenance', 'admin'));
$table->data[]= array("<b><a href=\"editor.php?sesskey=$USER->sesskey\">". get_string("editorsettings") ."</a></b>",
get_string("adminhelpeditorsettings"));
print_table($table);
print_footer($site);
-477
View File
@@ -1,477 +0,0 @@
<?php // $Id$
// Shane Elliott
/// Add new sitewide configuration variables to this file.
/// $configvars is parsed by config.php
/// It is an array of arrays of objects
/// $configvars[sectionname][configvariablename] = configvar object
$configvars = array();
/// no, yes strings and menu options are used in a number of places
/// so we define them here to save time on repeatedly calling
/// get_string()
$stryes = get_string('yes');
$strno = get_string('no');
$noyesoptions[0] = $strno;
$noyesoptions[1] = $stryes;
/// A class to hold the configurable information
/// $field - the html code for the form field
/// $help - help text for the field
/// $warning - optional warning text to be displayed
/// method display_warning() - a generic function that can be used in an extended class
/// e.g. enablerssfeeds
class configvar {
var $field;
var $help;
var $warning;
function configvar($help, $field, $warning='') {
$this->help = $help;
$this->field = $field;
$this->warning = $warning;
}
function display_warning() {
return false;
}
}
////////////////////////////////////////////////////////////////////
/// Miscellaneous config variables
////////////////////////////////////////////////////////////////////
$misc = array();
/// maxeditingtime
unset($options);
$options[3600] = get_string('numminutes', '', 60);
$options[2700] = get_string('numminutes', '', 45);
$options[1800] = get_string('numminutes', '', 30);
$options[900] = get_string('numminutes', '', 15);
$options[300] = get_string('numminutes', '', 5);
$options[60] = get_string('numminutes', '', 1);
$misc['maxeditingtime'] = new configvar (get_string('configmaxeditingtime', 'admin'),
choose_from_menu ($options, 'maxeditingtime', $config->maxeditingtime, '', '', '', true) );
/// debug
unset($options);
$options[7] = $strno;
$options[15] = $stryes;
$misc['debug'] = new configvar (get_string('configdebug', 'admin'),
choose_from_menu ($options, 'debug', $config->debug, '', '', '', true) );
/// enablerssfeeds
class configvarrss extends configvar {
function display_warning() {
return (!function_exists('utf8_encode'));
}
}
$misc['enablerssfeeds'] = new configvarrss (get_string('configenablerssfeeds', 'admin'),
choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
'<font color="red"> You need to add XML support to your PHP installation.</font>' );
////////////////////////////////////////////////////////////////////
/// OPERATING SYSTEM config variables
////////////////////////////////////////////////////////////////////
$operatingsystem = array();
/// gdversion
unset($options);
$options[0] = get_string('gdnot');
$options[1] = get_string('gd1');
$options[2] = get_string('gd2');
$installed = check_gd_version();
$operatingsystem['gdversion'] = new configvar (get_string('configgdversion', 'admin'),
choose_from_menu ($options, 'gdversion', $installed, '', '', '', true) );
/// dbsessions
$operatingsystem['dbsessions'] = new configvar (get_string('configdbsessions', 'admin'),
choose_from_menu ($noyesoptions, 'dbsessions', $config->dbsessions, '', '', '', true) );
/// sessiontimeout
unset($options);
$options[14400] = get_string('numhours', '', 4);
$options[10800] = get_string('numhours', '', 3);
$options[7200] = get_string('numhours', '', 2);
$options[5400] = get_string('numhours', '', '1.5');
$options[3600] = get_string('numminutes', '', 60);
$options[2700] = get_string('numminutes', '', 45);
$options[1800] = get_string('numminutes', '', 30);
$options[900] = get_string('numminutes', '', 15);
$options[300] = get_string('numminutes', '', 5);
$operatingsystem['sessiontimeout'] = new configvar (get_string('configsessiontimeout', 'admin'),
choose_from_menu ($options, 'sessiontimeout', $config->sessiontimeout, '', '', '', true) );
/// sessioncookie
$operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'),
'<input name="sessioncookie" type="text" size="10" value="'.s($config->sessioncookie).'" alt="sessioncookie" />' );
/// zip
$operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'),
'<input name="zip" type="text" size="30" value="'.s($config->zip).'" alt="zip" />' );
/// unzip
$operatingsystem['unzip'] = new configvar (get_string('configunzip', 'admin'),
'<input name="unzip" type="text" size="30" value="'.s($config->unzip).'" alt="unzip" />' );
/// slasharguments
unset($options);
$options[0] = "file.php?file=/pic.jpg";
$options[1] = "file.php/pic.jpg";
$operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'),
choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) );
/// proxyhost
$operatingsystem['proxyhost'] = new configvar (get_string('configproxyhost', 'admin'),
'<input name="proxyhost" type="text" size="30" value="'.s($config->proxyhost).'" alt="proxyhost" />' );
/// proxyport
$operatingsystem['proxyport'] = new configvar ('',
'<input name="proxyport" type="text" size="5" value="'.s($config->proxyport).'" alt="proxyport" />' );
////////////////////////////////////////////////////////////////////
/// PERMISSIONS config variables
////////////////////////////////////////////////////////////////////
$permissions = array();
/// teacherassignteachers
$permissions['teacherassignteachers'] = new configvar (get_string('configteacherassignteachers', 'admin'),
choose_from_menu ($noyesoptions, 'teacherassignteachers', $config->teacherassignteachers, '', '', '', true) );
/// allowunenroll
$permissions['allowunenroll'] = new configvar (get_string('configallowunenroll', 'admin'),
choose_from_menu ($noyesoptions, 'allowunenroll', $config->allowunenroll, '', '', '', true) );
/// allusersaresitestudents
$permissions['allusersaresitestudents'] = new configvar (get_string('configallusersaresitestudents', 'admin'),
choose_from_menu ($noyesoptions, 'allusersaresitestudents', $config->allusersaresitestudents, '', '', '', true) );
/// showsiteparticipantslist
unset($options);
$options[0] = get_string('siteteachers');
$options[1] = get_string('allteachers');
$options[2] = get_string('studentsandteachers');
$permissions['showsiteparticipantslist'] = new configvar (get_string('configshowsiteparticipantslist', 'admin'),
choose_from_menu ($options, 'showsiteparticipantslist', $config->showsiteparticipantslist, '', '', '', true) );
/// forcelogin
$permissions['forcelogin'] = new configvar (get_string('configforcelogin', 'admin'),
choose_from_menu ($noyesoptions, 'forcelogin', $config->forcelogin, '', '', '', true) );
/// forceloginforprofiles
$permissions['forceloginforprofiles'] = new configvar (get_string('configforceloginforprofiles', 'admin'),
choose_from_menu ($noyesoptions, 'forceloginforprofiles', $config->forceloginforprofiles, '', '', '', true) );
/// opentogoogle
$permissions['opentogoogle'] = new configvar (get_string('configopentogoogle', 'admin'),
choose_from_menu ($noyesoptions, 'opentogoogle', $config->opentogoogle, '', '', '', true) );
/// maxbytes
$options = get_max_upload_sizes();
$permissions['maxbytes'] = new configvar (get_string('configmaxbytes', 'admin'),
choose_from_menu ($options, 'maxbytes', $config->maxbytes, '', '', 0, true) );
/// messaging
$permissions['messaging'] = new configvar (get_string('configmessaging', 'admin'),
choose_from_menu ($noyesoptions, 'messaging', $config->messaging, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// INTERFACE config variables
////////////////////////////////////////////////////////////////////
$interface = array();
/// language settings
$interface['lang'] = new configvar ( get_string('configlang', 'admin'),
choose_from_menu(get_list_of_languages(), 'lang', $config->lang, '', '', '', true) );
/// language menu
$interface['langmenu'] = new configvar ( get_string('configlangmenu', 'admin'),
choose_from_menu($noyesoptions, 'langmenu', $config->langmenu, '', '', '', true) );
/// language list
$interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'),
'<input name="langlist" type="text" size="60" value="'.s($config->langlist).'" alt="langlist" />' );
/// locale
$interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
'<input name="locale" type="text" size="10" value="'.s($config->locale).'" alt="locale" />' );
/// timezone
$interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
/// country
$interface['country'] = new configvar ( get_string('configcountry', 'admin'),
choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) );
/// framename
if (empty($config->framename)) {
$config->framename = "_top";
}
$interface['framename'] = new configvar (get_string('configframename', 'admin'),
'<input name="framename" type="text" size="15" value="'.s($config->framename).'" alt="framename" />' );
/// language list
$interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'),
'<input name="themelist" type="text" size="60" value="'.s($config->themelist).'" alt="themelist" />' );
/// user themes
$interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'),
choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) );
/// course themes
$interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'),
choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) );
/// allowuserblockhiding
$interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'),
choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) );
/// showblocksonmodpages
$interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'),
choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) );
/// tabselectedtofront
$interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'),
choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// USER config variables
////////////////////////////////////////////////////////////////////
$user = array();
/// sitepolicy
$user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'),
'<input type="text" name="sitepolicy" size="60" value="'.$config->sitepolicy.'" alt="sitepolicy" />' );
/// fullnamedisplay
unset($options);
$options['language'] = get_string('language');
$options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname');
$options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname');
$options['firstname'] = get_string('firstname');
$user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'),
choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) );
/// extendedusernamechars
$user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'),
choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) );
/// autologinguests
$user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// SECURITY config variables
////////////////////////////////////////////////////////////////////
$security = array();
/// displayloginfailures
unset($options);
$options[''] = get_string('nobody');
$options['admin'] = get_string('administrators');
$options['teacher'] = get_string('administratorsandteachers');
$options['everybody'] = get_string('everybody');
$security['displayloginfailures'] = new configvar (get_string('configdisplayloginfailures', 'admin'),
choose_from_menu($options, 'displayloginfailures', $config->displayloginfailures, '', '', '', true) );
/// notifyloginfailures
unset($options);
$options[''] = get_string('nobody');
$options['mainadmin'] = get_string('administrator');
$options['alladmins'] = get_string('administratorsall');
$security['notifyloginfailures'] = new configvar (get_string('confignotifyloginfailures', 'admin'),
choose_from_menu($options, 'notifyloginfailures', $config->notifyloginfailures, '', '', '', true) );
/// notifyloginthreshold
unset($options);
for ($i=1; $i<=100; $i++) {
$options[$i] = "$i";
}
$security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
/// secureforms
$security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
/// loginhttps
$security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
/// runclamonupload
$security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
/// pathtoclam
$security['pathtoclam'] = new configvar (get_string('configpathtoclam', 'admin'),
'<input type="text" name="pathtoclam" size="30" value="'.$config->pathtoclam.'" alt="pathtoclam" />' );
/// quarantinedir
$security['quarantinedir'] = new configvar (get_string('configquarantinedir', 'admin'),
'<input type="text" name="quarantinedir" size="30" value="'.$config->quarantinedir.'" alt="quarantinedir" />' );
/// clamfailureonupload
unset($options);
$options['donothing'] = get_string('configclamdonothing', 'admin');
$options['actlikevirus'] = get_string('configclamactlikevirus', 'admin');
$security['clamfailureonupload'] = new configvar (get_string('configclamfailureonupload', 'admin'),
choose_from_menu($options, 'clamfailureonupload', $config->clamfailureonupload, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// MAINTENANCE config variables
////////////////////////////////////////////////////////////////////
$maintenance = array();
/// longtimenosee
unset($options);
$options[0] = get_string('never');
$options[1000] = get_string('numdays', '', 1000);
$options[365] = get_string('numdays', '', 365);
$options[180] = get_string('numdays', '', 180);
$options[150] = get_string('numdays', '', 150);
$options[120] = get_string('numdays', '', 120);
$options[90] = get_string('numdays', '', 90);
$options[60] = get_string('numdays', '', 60);
$options[30] = get_string('numdays', '', 30);
$options[21] = get_string('numdays', '', 21);
$options[14] = get_string('numdays', '', 14);
$options[7] = get_string('numdays', '', 7);
$maintenance['longtimenosee'] = new configvar (get_string('configlongtimenosee', 'admin'),
choose_from_menu ($options, 'longtimenosee', $config->longtimenosee, '', '', '', true) );
/// deleteunconfirmed
unset($options);
$options[0] = get_string('never');
$options[168] = get_string('numdays', '', 7);
$options[144] = get_string('numdays', '', 6);
$options[120] = get_string('numdays', '', 5);
$options[96] = get_string('numdays', '', 4);
$options[72] = get_string('numdays', '', 3);
$options[48] = get_string('numdays', '', 2);
$options[24] = get_string('numdays', '', 1);
$options[12] = get_string('numhours', '', 12);
$options[6] = get_string('numhours', '', 6);
$options[1] = get_string('numhours', '', 1);
$maintenance['deleteunconfirmed'] = new configvar (get_string('configdeleteunconfirmed', 'admin'),
choose_from_menu ($options, 'deleteunconfirmed', $config->deleteunconfirmed, '', '', '', true) );
/// loglifetime
unset($options);
$options[0] = get_string('neverdeletelogs');
$options[1000] = get_string('numdays', '', 1000);
$options[365] = get_string('numdays', '', 365);
$options[180] = get_string('numdays', '', 180);
$options[150] = get_string('numdays', '', 150);
$options[120] = get_string('numdays', '', 120);
$options[90] = get_string('numdays', '', 90);
$options[60] = get_string('numdays', '', 60);
$options[30] = get_string('numdays', '', 30);
$maintenance['loglifetime'] = new configvar (get_string('configloglifetime', 'admin'),
choose_from_menu ($options, 'loglifetime', $config->loglifetime, '', '', '', true) );
////////////////////////////////////////////////////////////////////
/// MAIL config variables
////////////////////////////////////////////////////////////////////
$mail = array();
/// smtphosts
$mail['smtphosts'] = new configvar (get_string('configsmtphosts', 'admin'),
'<input name="smtphosts" type="text" size="30" value="'.s($config->smtphosts).'" alt="smtphosts" />' );
/// smtpuser
$mail['smtpuser'] = new configvar (get_string('configsmtpuser', 'admin'),
'<input name="smtpuser" type="text" size="10" value="'.s($config->smtpuser).'" alt="smtpuser" />' );
/// smtppass
$mail['smtppass'] = new configvar ('',
'<input name="smtppass" type="password" size="10" value="'.s($config->smtppass).'" alt="smtppass" />' );
/// noreplyaddress
$mail['noreplyaddress'] = new configvar (get_string('confignoreplyaddress', 'admin'),
'<input name="noreplyaddress" type="text" size="30" value="'.s($config->noreplyaddress).'" alt="noreplyaddress" />' );
/// digestmailtime
$hours = array();
for ($i=0; $i<=23; $i++) {
$hours[$i] = sprintf("%02d",$i);
}
$mail['digestmailtime'] = new configvar (get_string('configdigestmailtime', 'admin'),
choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, '', '', 0, true) );
/// allowemailaddresses
$mail['allowemailaddresses'] = new configvar (get_string('configallowemailaddresses', 'admin'),
'<input name="allowemailaddresses" type="text" size="60" value="'.s($config->allowemailaddresses).'" alt="allowemailaddresses" />' );
/// denyemailaddresses
$mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
'<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
////////////////////////////////////////////////////////////////////
$configvars['interface'] = $interface;
$configvars['security'] = $security;
$configvars['operatingsystem'] = $operatingsystem;
$configvars['maintenance'] = $maintenance;
$configvars['mail'] = $mail;
$configvars['user'] = $user;
$configvars['permissions'] = $permissions;
$configvars['misc'] = $misc;
?>
+1 -1
View File
@@ -56,7 +56,7 @@
?>
</select>
<br />
<script type="text/javascript">
<script>
function
</script>
<input type="text" name="searchtext" size="30" value="<?php echo $searchtext ?>"
+8 -13
View File
@@ -118,18 +118,11 @@
}
flush();
if (!empty($CFG->langcache)) {
get_list_of_languages();
}
flush();
if (!empty($CFG->notifyloginfailures)) {
notify_login_failures();
}
flush();
sync_metacourses();
} // End of occasional clean-up tasks
if (file_exists("$CFG->dataroot/cronextra.php")) {
@@ -161,13 +154,15 @@
}
if (!empty($CFG->enablerssfeeds)) { //Defined in admin/variables page
include_once("$CFG->libdir/rsslib.php");
mtrace("Running rssfeeds if required...");
if (file_exists("$CFG->dirroot/rss/rsslib.php")) {
include_once("$CFG->dirroot/rss/rsslib.php");
mtrace("Running rssfeeds if required...");
if ( ! cron_rss_feeds()) {
mtrace("Something went wrong while generating rssfeeds!!!");
} else {
mtrace("Rssfeeds finished");
if ( ! cron_rss_feeds()) {
mtrace("Something went wrong while generating rssfeeds!!!");
} else {
mtrace("Rssfeeds finished");
}
}
}
+16 -16
View File
@@ -3,23 +3,23 @@
// Deletes the moodledata directory, COMPLETELY!!
// BE VERY CAREFUL USING THIS!
require_once('../config.php');
require_once("../config.php");
require_login();
if (!isadmin()) {
error('You must be admin to use this script!');
error("You must be admin to use this script!");
}
$deletedir = $CFG->dataroot; // The directory to delete!
if (!$sure) {
notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', 'delete.php?sure=yes', 'index.php');
notice_yesno ("Are you completely sure you want to delete everything inside the directory $deletedir ?", "delete.php?sure=yes", "index.php");
exit;
}
if (!$reallysure) {
notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?', 'delete.php?sure=yes&amp;reallysure=yes', 'index.php');
notice_yesno ("Are you REALLY REALLY completely sure you want to delete everything inside the directory $deletedir (this includes all user images, and any other course files that have been created) ?", "delete.php?sure=yes&reallysure=yes", "index.php");
exit;
}
@@ -27,7 +27,7 @@
delete_subdirectories($deletedir);
echo '<h1 align="center">Done!</h1>';
echo "<H1 align=center>Done!</H1>";
print_continue($CFG->wwwroot);
exit;
@@ -37,22 +37,22 @@ function delete_subdirectories($rootdir) {
$dir = opendir($rootdir);
while ($file = readdir($dir)) {
if ($file != '.' and $file != '..') {
$fullfile = $rootdir .'/'. $file;
if (filetype($fullfile) == 'dir') {
if ($file != "." and $file != "..") {
$fullfile = "$rootdir/$file";
if (filetype($fullfile) == "dir") {
delete_subdirectories($fullfile);
echo 'Deleting '. $fullfile .' ... ';
echo "Deleting $fullfile ... ";
if (rmdir($fullfile)) {
echo 'Done.<br />';
echo "Done.<BR>";
} else {
echo 'FAILED.<br />';
echo "FAILED.<BR>";
}
} else {
echo 'Deleting '. $fullfile .' ... ';
if (unlink($fullfile)) {
echo 'Done.<br />';
echo "Deleting $fullfile ... ";
if (unlink("$fullfile")) {
echo "Done.<BR>";
} else {
echo 'FAILED.<br />';
echo "FAILED.<BR>";
}
}
}
@@ -60,4 +60,4 @@ function delete_subdirectories($rootdir) {
closedir($dir);
}
?>
?>
+16 -168
View File
@@ -1,9 +1,9 @@
<form method="post" action="editor.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<form method="post" action="<?php print($GLOBALS['ME']);?>">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table border="0" cellpadding="4" cellspacing="2">
<tr>
<td align="right" valign="top">htmleditor:</td>
<td valign="top">
<tr valign=top>
<td align=right><p>htmleditor:</td>
<td>
<?php
unset($options);
$options[0] = get_string("allownot");
@@ -12,22 +12,22 @@
?>
</td>
<td>
<?php print_string('confightmleditor', 'admin') ?>
<?php print_string("confightmleditor") ?>
</td>
</tr>
<tr>
<td align="right" valign="top">editorbackgroundcolor:</td>
<td valign="top"><input type="text" name="backgroundcolor" size="10" value="<?php print($CFG->editorbackgroundcolor);?>" /></td>
<td valign="top"><input type="text" name="backgroundcolor" size="10" value="<?php print($CFG->editorbackgroundcolor);?>"></td>
<td valign="top"><?php print_string("edhelpbgcolor");?></td>
</tr>
<tr>
<td align="right" valign="top">editorfontfamily:</td>
<td valign="top"><input type="text" name="fontfamily" size="30" value="<?php print($CFG->editorfontfamily);?>" /></td>
<td valign="top"><input type="text" name="fontfamily" size="30" value="<?php print($CFG->editorfontfamily);?>"></td>
<td valign="top"><?php print_string("edhelpfontfamily");?></td>
</tr>
<tr>
<td align="right" valign="top">editorfontsize:</td>
<td valign="top"><input type="text" name="fontsize" size="10" value="<?php print($CFG->editorfontsize);?>" /></td>
<td valign="top"><input type="text" name="fontsize" size="10" value="<?php print($CFG->editorfontsize);?>"></td>
<td valign="top"><?php print_string("edhelpfontsize");?></td>
</tr>
<tr>
@@ -38,14 +38,9 @@
</select></td>
<td valign="top"><?php print_string("edhelpcleanword");?></td>
</tr>
<tr>
<td align="right" valign="top">aspellpath:</td>
<td valign="top"><input onchange="change_state()" id="aspellpath" type="text" name="aspellpath" size="25" value="<?php print($CFG->aspellpath);?>" /></td>
<td valign="top"><?php print_string("edhelpaspellpath");?></td>
</tr>
<tr>
<td align="right" valign="top">editorspelling:</td>
<td valign="top"><select onchange="change_state()" id="spelling" name="spelling"<?php
<td valign="top"><select name="spelling"<?php
if (empty($CFG->aspellpath)) {
echo " disabled=\"disabled\"";
$CFG->editorspelling = false;
@@ -53,28 +48,7 @@
?>>
<option value="1"<?php print(!$CFG->editorspelling)?"":" selected=\"selected\"";?>><?php print_string("yes");?></option>
<option value="0"<?php print(!$CFG->editorspelling)?" selected=\"selected\"":"";?>><?php print_string("no");?></option>
</select>
<select id="dictionary" name="dictionary"<?php
if (empty($CFG->aspellpath)) {
echo " disabled=\"disabled\"";
$CFG->editordictionary = false;
}
?>>
<?php
if (is_array($dicts)) {
foreach ($dicts as $dict) {
echo "<option value=\"$dict\"";
if (!empty($CFG->editordictionary)) {
print ($CFG->editordictionary != $dict) ? "" : " selected=\"selected\"";
}
echo ">$dict</option>\n";
}
} else if (is_string($dicts)) {
echo '<option value="">'. $dicts .'</option>' . "\n";
}
?>
</select>
</td>
</select></td>
<td valign="top"><?php print_string("edhelpenablespelling");?></td>
</tr>
<tr><td colspan="3"><br /><?php print_string("edhelpfontlist");?></td></tr>
@@ -85,7 +59,7 @@
<tr>
<td>&nbsp;</td>
<td colspan="2"><input type="text" name="fontname[]" size="15" value="<?php print($fontkey);?>">
<input type="text" name="fontnamevalue[]" size="30" value="<?php print($fontvalue);?>" /></td>
<input type="text" name="fontnamevalue[]" size="30" value="<?php print($fontvalue);?>"></td>
</tr>
<?php
}
@@ -93,145 +67,19 @@
?>
<tr>
<td>&nbsp;</td>
<td colspan="2"><input type="text" name="fontname[]" size="15" value="" />
<input type="text" name="fontnamevalue[]" size="30" value="" /></td>
<td colspan="2"><input type="text" name="fontname[]" size="15" value="">
<input type="text" name="fontnamevalue[]" size="30" value=""></td>
</tr>
<tr>
<td valign="top" align="right">editorhidebuttons:</td>
<td colspan="2">
<?php
$buttons = array();
if (!empty($CFG->editorhidebuttons)) {
$buttons = explode(chr(32), $CFG->editorhidebuttons);
}
?>
<table border="0" cellpadding="2" cellspacing="1">
<tr>
<td colspan="12"><input type="checkbox" name="buttons[fontname]"<?php print(in_array("fontname", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("fontname","editor");?>
<input type="checkbox" name="buttons[fontsize]"<?php print(in_array("fontsize", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("fontsize","editor");?>
<input type="checkbox" name="buttons[formatblock]"<?php print(in_array("formatblock", $buttons)) ? " checked=\"checked\"": "";?> /> <?php print_string("formatblock","editor");?></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_bold.gif" width="18" height="18" alt="<?php print_string("bold","editor");?>" title="<?php print_string("bold","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_italic.gif" width="18" height="18" alt="<?php print_string("italic","editor");?>" title="<?php print_string("italic","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_underline.gif" width="18" height="18" alt="<?php print_string("underline","editor");?>" title="<?php print_string("underline","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_strike.gif" width="18" height="18" alt="<?php print_string("strikethrough","editor");?>" title="<?php print_string("strikethrough","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_sub.gif" width="18" height="18" alt="<?php print_string("subscript","editor");?>" title="<?php print_string("subscript","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_format_sup.gif" width="18" height="18" alt="<?php print_string("superscript","editor");?>" title="<?php print_string("superscript","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_copy.gif" width="18" height="18" alt="<?php print_string("copy","editor");?>" title="<?php print_string("copy","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_cut.gif" width="18" height="18" alt="<?php print_string("cut","editor");?>" title="<?php print_string("cut","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_paste.gif" width="18" height="18" alt="<?php print_string("paste","editor");?>" title="<?php print_string("paste","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_wordclean.gif" width="18" height="18" alt="<?php print_string("wordclean","editor");?>" title="<?php print_string("wordclean","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_undo.gif" width="18" height="18" alt="<?php print_string("undo","editor");?>" title="<?php print_string("undo","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_redo.gif" width="18" height="18" alt="<?php print_string("redo","editor");?>" title="<?php print_string("redo","editor");?>" /></td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[bold]"<?php print(in_array("bold", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[italic]"<?php print(in_array("italic", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[underline]"<?php print(in_array("underline", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[strikethrough]"<?php print(in_array("strikethrough", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[subscript]"<?php print(in_array("subscript", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[superscript]"<?php print(in_array("superscript", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[copy]"<?php print(in_array("copy", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[cut]"<?php print(in_array("cut", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[paste]"<?php print(in_array("paste", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[clean]"<?php print(in_array("clean", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[undo]"<?php print(in_array("undo", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[redo]"<?php print(in_array("redo", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_left.gif" width="18" height="18" alt="<?php print_string("justifyleft","editor");?>" title="<?php print_string("justifyleft","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_center.gif" width="18" height="18" alt="<?php print_string("justifycenter","editor");?>" title="<?php print_string("justifycenter","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_right.gif" width="18" height="18" alt="<?php print_string("justifyright","editor");?>" title="<?php print_string("justifyright","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_align_justify.gif" width="18" height="18" alt="<?php print_string("justifyfull","editor");?>" title="<?php print_string("justifyfull","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_left_to_right.gif" width="18" height="18" alt="<?php print_string("lefttoright","editor");?>" title="<?php print_string("lefttoright","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_right_to_left.gif" width="18" height="18" alt="<?php print_string("righttoleft","editor");?>" title="<?php print_string("righttoleft","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_list_num.gif" width="18" height="18" alt="<?php print_string("orderedlist","editor");?>" title="<?php print_string("orderedlist","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_list_bullet.gif" width="18" height="18" alt="<?php print_string("unorderedlist","editor");?>" title="<?php print_string("unorderedlist","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_indent_less.gif" width="18" height="18" alt="<?php print_string("outdent","editor");?>" title="<?php print_string("outdent","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_indent_more.gif" width="18" height="18" alt="<?php print_string("indent","editor");?>" title="<?php print_string("indent","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_color_fg.gif" width="18" height="18" alt="<?php print_string("forecolor","editor");?>" title="<?php print_string("forecolor","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_color_bg.gif" width="18" height="18" alt="<?php print_string("hilitecolor","editor");?>" title="<?php print_string("hilitecolor","editor");?>" /></td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[justifyleft]"<?php print(in_array("justifyleft", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[justifycenter]"<?php print(in_array("justifycenter", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[justifyright]"<?php print(in_array("justifyright", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[justifyfull]"<?php print(in_array("justifyfull", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[lefttoright]"<?php print(in_array("lefttoright", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[righttoleft]"<?php print(in_array("righttoleft", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertorderedlist]"<?php print(in_array("insertorderedlist", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertunorderedlist]"<?php print(in_array("insertunorderedlist", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[outdent]"<?php print(in_array("outdent", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[indent]"<?php print(in_array("indent", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[forecolor]"<?php print(in_array("forecolor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[hilitecolor]"<?php print(in_array("hilitecolor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
</tr>
<tr>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_hr.gif" width="18" height="18" alt="<?php print_string("horizontalrule","editor");?>" title="<?php print_string("horizontalrule","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_anchor.gif" width="18" height="18" alt="<?php print_string("createanchor","editor");?>" title="<?php print_string("createanchor","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_link.gif" width="18" height="18" alt="<?php print_string("insertlink","editor");?>" title="<?php print_string("insertlink","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_unlink.gif" width="18" height="18" alt="<?php print_string("removelink","editor");?>" title="<?php print_string("removelink","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_image.gif" width="18" height="18" alt="<?php print_string("insertimage","editor");?>" title="<?php print_string("insertimage","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/insert_table.gif" width="18" height="18" alt="<?php print_string("inserttable","editor");?>" title="<?php print_string("inserttable","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/em.icon.smile.gif" width="18" height="18" alt="<?php print_string("insertsmile","editor");?>" title="<?php print_string("insertsmile","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/icon_ins_char.gif" width="18" height="18" alt="<?php print_string("insertchar","editor");?>" title="<?php print_string("insertchar","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/spell-check.gif" width="18" height="18" alt="<?php print_string("spellcheck","editor");?>" title="<?php print_string("spellcheck","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/ed_html.gif" width="18" height="18" alt="<?php print_string("htmlmode","editor");?>" title="<?php print_string("htmlmode","editor");?>" /></td>
<td><img src="<?php echo $CFG->wwwroot ?>/lib/editor/images/fullscreen_maximize.gif" width="18" height="18" alt="<?php print_string("popupeditor","editor");?>" title="<?php print_string("popupeditor","editor");?>" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><input type="checkbox" name="buttons[inserthorizontalrule]"<?php print(in_array("inserthorizontalrule", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[createanchor]"<?php print(in_array("createanchor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[createlink]"<?php print(in_array("createlink", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[unlink]"<?php print(in_array("unlink", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertimage]"<?php print(in_array("insertimage", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[inserttable]"<?php print(in_array("inserttable", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertsmile]"<?php print(in_array("insertsmile", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[insertchar]"<?php print(in_array("insertchar", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[spellcheck]"<?php print(in_array("spellcheck", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[htmlmode]"<?php print(in_array("htmlmode", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td><input type="checkbox" name="buttons[popupeditor]"<?php print(in_array("popupeditor", $buttons)) ? " checked=\"checked\"" : "" ;?> /></td>
<td>&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" value="<?php print_string("savechanges");?>" /></td>
<td colspan="3" align="center"><input type="submit" value="<?php print_string("savechanges");?>"></td>
</tr>
</table>
</form>
<form method="post" action="<?php print($GLOBALS['ME']);?>">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<center>
<input type="submit" name="resettodefaults" value="<?php print_string('editorresettodefaults') ?>" />
</center>
</form>
<script language="javascript" type="text/javascript">
<!--
function change_state () {
var choice = document.forms[0].spelling;
var speller = choice.options[choice.selectedIndex].value;
var spellpath = document.forms[0].aspellpath.value;
if (spellpath == '') {
document.forms[0].spelling.disabled = true;
} else {
document.forms[0].spelling.disabled = false;
}
if (speller != 1) {
document.forms[0].dictionary.disabled = true;
} else {
document.forms[0].dictionary.disabled = false;
}
}
document.onload = change_state();
-->
</script>
+21 -95
View File
@@ -8,26 +8,29 @@
error("Only admins can access this page");
}
if (($data = data_submitted()) && confirm_sesskey()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if ($data = data_submitted()) {
// do we want default values?
if (isset($data->resettodefaults)) {
if (!(reset_to_defaults())) {
if(!(reset_to_defaults())) {
error("Editor settings could not be restored!");
}
} else {
if (!(editor_update_config($data))) {
if(!(editor_update_config($data))) {
error("Editor settings could not be updated!");
}
}
redirect("$CFG->wwwroot/$CFG->admin/editor.php", get_string("changessaved"), 1);
redirect("$CFG->wwwroot/$CFG->admin/editor.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
} else {
// Generate edit form
$fontlist = editor_convert_to_array($CFG->editorfontlist);
$dicts = editor_get_dictionaries();
$stradmin = get_string("administration");
$strconfiguration = get_string("configuration");
@@ -39,7 +42,7 @@
print_heading($streditorsettings);
print_simple_box("<center>$streditorsettingshelp</center>","center","50%");
print("<br />\n");
print_simple_box_start("center");
print_simple_box_start("center", "", "$THEME->cellheading");
include("editor.html");
print_simple_box_end();
print_footer();
@@ -51,14 +54,14 @@
function editor_convert_to_array ($string) {
/// Converts $CFG->editorfontlist to array
if (empty($string) || !is_string($string)) {
if(empty($string) || !is_string($string)) {
return false;
}
$fonts = array();
$lines = explode(";", $string);
foreach ($lines as $line) {
if (!empty($line)) {
foreach($lines as $line) {
if(!empty($line)) {
list($fontkey, $fontvalue) = explode(":", $line);
$fonts[$fontkey] = $fontvalue;
}
@@ -68,10 +71,9 @@ function editor_convert_to_array ($string) {
}
function editor_update_config ($data) {
/// Updates the editor config values.
if (!is_object($data)) {
if(!is_object($data)) {
return false;
}
@@ -86,9 +88,8 @@ function editor_update_config ($data) {
$fontlist = '';
// make font string
$cnt = count($data->fontname);
for ($i = 0; $i < $cnt; $i++) {
if (!empty($data->fontname[$i])) {
for($i = 0; $i < count($data->fontname); $i++) {
if(!empty($data->fontname[$i])) {
$fontlist .= str_replace($nochars, "", $data->fontname[$i]) .":";
$fontlist .= str_replace($nochars, "", $data->fontnamevalue[$i]) .";";
}
@@ -98,26 +99,16 @@ function editor_update_config ($data) {
// make array of values to update
$updatedata = array();
$updatedata['htmleditor'] = !empty($data->htmleditor) ? $data->htmleditor : 0;
$updatedata['htmleditor'] = $data->htmleditor;
$updatedata['editorbackgroundcolor'] = !empty($data->backgroundcolor) ? $data->backgroundcolor : "#ffffff";
$updatedata['editorfontfamily'] = !empty($data->fontfamily) ? str_replace($nochars,"",$data->fontfamily) : "Times New Roman, Times";
$updatedata['editorfontsize'] = !empty($data->fontsize) ? $data->fontsize : "";
$updatedata['editorkillword'] = !empty($data->killword) ? $data->killword : "true";
$updatedata['editorspelling'] = !empty($data->spelling) ? $data->spelling : 0;
$updatedata['editorfontlist'] = $fontlist;
$updatedata['editordictionary'] = !empty($data->dictionary) ? $data->dictionary : '';
$updatedata['aspellpath'] = !empty($data->aspellpath) ? $data->aspellpath : '';
$hidebuttons = '';
if (!empty($data->buttons) && is_array($data->buttons)) {
foreach ($data->buttons as $key => $value) {
$hidebuttons .= $key . " ";
}
}
$updatedata['editorhidebuttons'] = trim($hidebuttons);
foreach ($updatedata as $name => $value) {
if (!(set_config($name, $value))) {
foreach($updatedata as $name => $value) {
if(!(set_config($name, $value))) {
return false;
}
}
@@ -126,89 +117,24 @@ function editor_update_config ($data) {
}
function reset_to_defaults () {
/// Reset the values to default
global $CFG;
include_once($CFG->dirroot .'/lib/defaults.php');
$updatedata = array();
$updatedata['htmleditor'] = $defaults['htmleditor'];
$updatedata['editorbackgroundcolor'] = $defaults['editorbackgroundcolor'];
$updatedata['editorfontfamily'] = $defaults['editorfontfamily'];
$updatedata['editorfontsize'] = $defaults['editorfontsize'];
$updatedata['editorkillword'] = $defaults['editorkillword'];
$updatedata['editorspelling'] = $defaults['editorspelling'];
$updatedata['editorfontlist'] = $defaults['editorfontlist'];
$updatedata['editorhidebuttons'] = $defaults['editorhidebuttons'];
$updatedata['editordictionary'] = '';
foreach ($updatedata as $name => $value) {
if (!(set_config($name, $value))) {
foreach($updatedata as $name => $value) {
if(!(set_config($name, $value))) {
return false;
}
}
return true;
}
function editor_get_dictionaries () {
/// Get all installed dictionaries in the system
global $CFG;
error_reporting(E_ALL); // for debug, final version shouldn't have this...
clearstatcache();
$strerror = '';
// If aspellpath isn't set don't even bother ;-)
if (empty($CFG->aspellpath)) {
return $strerror = 'Empty aspell path!';
}
// Do we have access to popen function?
if (!function_exists('popen')) {
return $strerror = "Popen function disabled!";
exit;
}
global $CFG;
$cmd = $CFG->aspellpath;
$output = '';
$dictionaries = array();
$dicts = array();
if(!($handle = @popen($cmd .' dump dicts', 'r'))) {
return $strerror = "Couldn't create handle!";
exit;
}
while(!feof($handle)) {
$output .= fread($handle, 1024);
}
@pclose($handle);
$dictionaries = explode(chr(10), $output);
// Get rid of possible empty values
if (is_array($dictionaries)) {
$cnt = count($dictionaries);
for ($i = 0; $i < $cnt; $i++) {
if (!empty($dictionaries[$i])) {
$dicts[] = $dictionaries[$i];
}
}
}
if (count($dicts) >= 1) {
return $dicts;
}
$strerror = "Error! Check your aspell installation!";
return $strerror;
}
?>
+5 -4
View File
@@ -4,7 +4,7 @@
include("../config.php");
$enrol = optional_param('enrol', $CFG->enrol, PARAM_ALPHA);
$enrol = optional_param('enrol', $CFG->enrol);
require_login();
@@ -20,6 +20,7 @@
error(get_string('confirmsesskeybad', 'error'));
}
$enrol = clean_filename($enrol);
require_once("$CFG->dirroot/enrol/$enrol/enrol.php"); /// Open the class
$enrolment = new enrolment_plugin();
@@ -65,14 +66,14 @@
echo "</b></p></div>";
/// Print current enrolment type description
print_simple_box_start("center", "80%");
print_simple_box_start("center", "80%", "$THEME->cellheading");
print_heading($options[$enrol]);
print_simple_box_start("center", "60%", '', 5, 'informationbox');
print_simple_box_start("center", "60%", "$THEME->cellcontent");
print_string("description", "enrol_$enrol");
print_simple_box_end();
echo "<hr />";
echo "<hr>";
// print_heading($str->settings);
$enrolment->config_form($frm);
+5 -23
View File
@@ -1,4 +1,4 @@
<?php print_simple_box_start("center"); ?>
<?php print_simple_box_start("center", "", "$THEME->cellheading"); ?>
<form name="filters" id="filters" method="post" action="filters.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
@@ -78,20 +78,17 @@
<br />
<?php print_simple_box_start("center"); ?>
<?php print_simple_box_start("center", "", "$THEME->cellheading"); ?>
<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">
<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);
@@ -118,7 +115,7 @@
<?php p($strconfigcachetext) ?>
</td>
</tr>
<tr valign="top">
<tr valign=top>
<td nowrap="nowrap" align="right"><?php p($strfilteruploadedfiles) ?>:</td>
<td>
<?php
@@ -133,22 +130,7 @@
<?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">
<tr valign=top>
<td>&nbsp;</td>
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
<td>&nbsp;</td>
+10 -9
View File
@@ -16,6 +16,10 @@
error("Only administrators can use this page!");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if (!$site = get_site()) {
error("Site isn't defined!");
}
@@ -32,11 +36,9 @@
$stractive = get_string("active");
$strinactive = get_string("inactive");
$strcachetext = get_string("cachetext", "admin");
$strconfigcachetext = get_string("configcachetext", 'admin');
$strconfigcachetext = get_string("configcachetext");
$strfilteruploadedfiles = get_string("filteruploadedfiles", "admin");
$strfilterall = get_string("filterall", "admin");
$strconfigfilteruploadedfiles = get_string("configfilteruploadedfiles", 'admin');
$strconfigfilterall = get_string("configfilterall", "admin");
$strconfigfilteruploadedfiles = get_string("configfilteruploadedfiles");
print_header("$site->shortname: $strmanagefilters", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
@@ -84,23 +86,22 @@
/// If data submitted, then process and store.
if (!empty($options)) {
if (($config = data_submitted()) && confirm_sesskey()) {
if ($config = data_submitted()) {
unset($config->options);
unset($config->sesskey);
foreach ($config as $name => $value) {
set_config($name, $value);
}
}
}
if (!empty($add) and !empty($uselect) and confirm_sesskey()) {
if (!empty($add) and !empty($uselect)) {
$selectedfilter = $uselect;
if (!in_array($selectedfilter, $installedfilters)) {
$installedfilters[] = $selectedfilter;
set_config("textfilters", implode(',', $installedfilters));
}
} else if (!empty($remove) and !empty($iselect) and confirm_sesskey()) {
} else if (!empty($remove) and !empty($iselect)) {
$selectedfilter = $iselect;
foreach ($installedfilters as $key => $installedfilter) {
if ($installedfilter == $selectedfilter) {
@@ -109,7 +110,7 @@
}
set_config("textfilters", implode(',', $installedfilters));
} else if ((!empty($up) or !empty($down)) and !empty($iselect) and confirm_sesskey()) {
} else if ((!empty($up) or !empty($down)) and !empty($iselect)) {
if (!empty($up)) {
if ($allfilters[$iselect]) {
-117
View File
@@ -1,117 +0,0 @@
<?
/** This expects the output from a command like
* clamscan -r --infected --no-summary <files> 2>&1 | php -d error_log=/path/to/log thisfile.php
* also it's important that the output of clamscan prints the FULL PATH to each infected file, so use absolute paths for area to scan
* also it should be run as root, or whatever the webserver runs as so that it has the right permissions in the quarantine dir etc.
* php -d error_log=/path/to/log thisfile.php will override the default error log for php cli, which is stderr, so if you want this script to just print stuff out, use php thisfile.php instead.
*/
$fd = fopen('php://stdin','r');
if (!$fd) {
exit();
}
$FULLME='cron';
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->dirroot.'/lib/uploadlib.php'); // contains virus handling stuff.
$site = get_site();
while(!feof($fd)) {
$entry = fgets($fd);
if (strlen(trim($entry)) == 0) {
continue;
}
if (!$file = validate_line($entry)) {
continue;
}
$bits = explode('/',$file);
$a->filename = $bits[count($bits)-1];
if (!$log = get_record("log","module","upload","info",$file,"action","upload")) {
$a->action = clam_handle_infected_file($file,0,false);
clam_replace_infected_file($file);
notify_admins_unknown($file,$a);
continue;
}
$action = clam_handle_infected_file($file,$log->userid,true);
clam_replace_infected_file($file);
$user = get_record("user","id",$log->userid);
$course = get_record("course","id",$log->course);
$subject = get_string('virusfoundsubject','moodle',$site->fullname);
$a->date = userdate($log->time);
$a->action = $action;
$a->course = $course->fullname;
$a->user = fullname($user);
notify_user($user,$subject,$a);
notify_admins($user,$subject,$a);
}
fclose($fd);
function notify_user($user,$subject,$a) {
if (!$user) {
return false;
}
$body = get_string('virusfoundlater','moodle',$a);
email_to_user($user,get_admin(),$subject,$body);
}
function notify_admins($user,$subject,$a) {
$admins = get_admins();
$body = get_string('virusfoundlateradmin','moodle',$a);
foreach ($admins as $admin) {
email_to_user($admin,$admin,$subject,$body);
}
}
function notify_admins_unknown($file,$a) {
global $site;
$admins = get_admins();
$subject = get_string('virusfoundsubject','moodle',$site->fullname);
$body = get_string('virusfoundlateradminnolog','moodle',$a);
foreach ($admins as $admin) {
email_to_user($admin,$admin,$subject,$body);
}
}
function validate_line($line) {
global $CFG;
if (strpos($line,"FOUND") === false) {
return false;
}
$index = strpos($line,":");
$file = substr($line,0,$index);
if (!(strpos($file,$CFG->dataroot) === false)) {
if (!file_exists($file)) {
return false;
}
}
else {
if ($file{0} == "/") {
$file = $CFG->dataroot.$file;
}
else {
$file = $CFG->dataroot."/".$file;
}
if (!file_exists($file)) {
return false;
}
}
// clean up
$file = preg_replace('/\.\//','/',$file);
$file = preg_replace('/\/\//','/',$file);
return $file;
}
?>
-508
View File
@@ -1,508 +0,0 @@
<?php // $Id$
require_once('../config.php');
define('SEVERITY_NOTICE', 'notice');
define('SEVERITY_ANNOYANCE', 'annoyance');
define('SEVERITY_SIGNIFICANT', 'significant');
define('SEVERITY_CRITICAL', 'critical');
require_login();
if (!isadmin()) {
error('Only the admin can use this page');
}
$site = get_site();
$stradmin = get_string('administration');
$strhealthcenter = get_string('healthcenter');
print_header($site->shortname.': '.$strhealthcenter, $site->fullname,
'<a href="index.php">'.$stradmin.'</a> -> '.$strhealthcenter);
echo <<<STYLES
<style type="text/css">
div#healthnoproblemsfound {
width: 60%;
margin: auto;
padding: 1em;
border: 1px black solid;
-moz-border-radius: 6px;
}
dl.healthissues {
width: 60%;
margin: auto;
}
dl.critical dt, dl.critical dd {
background-color: #a71501;
}
dl.significant dt, dl.significant dd {
background-color: #d36707;
}
dl.annoyance dt, dl.annoyance dd {
background-color: #dba707;
}
dl.notice dt, dl.notice dd {
background-color: #e5db36;
}
dt.solution, dd.solution, div#healthnoproblemsfound {
background-color: #5BB83E !important;
}
dl.healthissues dt, dl.healthissues dd {
margin: 0px;
padding: 1em;
border: 1px black solid;
}
dl.healthissues dt {
font-weight: bold;
border-bottom: none;
padding-bottom: 0.5em;
}
dl.healthissues dd {
border-top: none;
padding-top: 0.5em;
margin-bottom: 10px;
}
dl.healthissues dd form {
margin-top: 0.5em;
text-align: right;
}
form#healthformreturn {
text-align: center;
margin: 2em;
}
dd.solution p {
padding: 0px;
margin: 1em 0px;
}
dd.solution li {
margin-top: 1em;
}
</style>
STYLES;
$solution = optional_param('solution', NULL);
if(!empty($solution) && class_exists($solution)) {
health_print_solution($solution);
}
else {
health_find_problems();
}
print_footer();
function health_find_problems() {
print_heading(get_string('healthcenter'));
$issues = array(
SEVERITY_CRITICAL => array(),
SEVERITY_SIGNIFICANT => array(),
SEVERITY_ANNOYANCE => array(),
SEVERITY_NOTICE => array(),
);
$problems = 0;
for($i = 1; $i < 1000000; ++$i) {
$classname = sprintf('problem_%06d', $i);
if(!class_exists($classname)) {
break;
}
$problem = new $classname;
if($problem->exists()) {
$severity = $problem->severity();
$issues[$severity][$classname] = array(
'severity' => $severity,
'description' => $problem->description(),
'title' => $problem->title()
);
++$problems;
}
unset($problem);
}
if($problems == 0) {
echo '<div id="healthnoproblemsfound">';
echo get_string('healthnoproblemsfound');
echo '</div>';
}
else {
print_heading(get_string('healthproblemsdetected'));
$severities = array(SEVERITY_CRITICAL, SEVERITY_SIGNIFICANT, SEVERITY_ANNOYANCE, SEVERITY_NOTICE);
foreach($severities as $severity) {
if(!empty($issues[$severity])) {
echo '<dl class="healthissues '.$severity.'">';
foreach($issues[$severity] as $classname => $data) {
echo '<dt id="'.$classname.'">'.$data['title'].'</dt>';
echo '<dd>'.$data['description'];
echo '<form action="health.php#solution" method="get">';
echo '<input type="hidden" name="solution" value="'.$classname.'" /><input type="submit" value="'.get_string('viewsolution').'" />';
echo '</form></dd>';
}
echo '</dl>';
}
}
}
}
function health_print_solution($classname) {
$problem = new $classname;
$data = array(
'title' => $problem->title(),
'severity' => $problem->severity(),
'description' => $problem->description(),
'solution' => $problem->solution()
);
print_heading(get_string('healthcenter'));
print_heading(get_string('healthproblemsolution'));
echo '<dl class="healthissues '.$data['severity'].'">';
echo '<dt>'.$data['title'].'</dt>';
echo '<dd>'.$data['description'].'</dd>';
echo '<dt id="solution" class="solution">'.get_string('healthsolution').'</dt>';
echo '<dd class="solution">'.$data['solution'].'</dd></dl>';
echo '<form id="healthformreturn" action="health.php#'.$classname.'" method="get">';
echo '<input type="submit" value="'.get_string('healthreturntomain').'" />';
echo '</form>';
}
class problem_base {
function exists() {
return false;
}
function title() {
return '???';
}
function severity() {
return SEVERITY_NOTICE;
}
function description() {
return '';
}
function solution() {
return '';
}
}
class problem_000001 extends problem_base {
function title() {
return 'Invalid value for $CFG->dirroot';
}
function exists() {
global $CFG;
$dirroot = dirname(realpath('../index.php'));
if (!empty($dirroot) && $dirroot != $CFG->dirroot) {
return true;
}
return false;
}
function severity() {
return SEVERITY_CRITICAL;
}
function description() {
global $CFG;
return 'Your <strong>config.php</strong> file contains the setting <strong>$CFG-&gt;dirroot = "'.$CFG->dirroot.'"</strong>, which is incorrect. Unless you correct this problem, Moodle will not function correctly, if at all.';
}
function solution() {
global $CFG;
$dirroot = dirname(realpath('../index.php'));
return 'You need to edit your <strong>config.php</strong> file. Find the line which reads <pre>$CFG->dirroot = \''.$CFG->dirroot.'\';</pre> and change it to read <pre>$CFG->dirroot = \''.$dirroot.'\'</pre>';
}
}
class problem_000002 extends problem_base {
function title() {
return 'Extra characters at the end of config.php';
}
function exists() {
// [pj] When the requirements are raised to PHP 4.3.0 this will be file_get_contents()
if($fp = @fopen('../config.php', 'r')) {
$contents = fread($fp, 16384); // 16K should be enough
$ending = substr($contents, -2);
unset($contents);
if($ending == '?>') {
return false;
}
fclose($fp);
}
return true;
}
function severity() {
return SEVERITY_SIGNIFICANT;
}
function description() {
return 'Your Moodle configuration file, config.php, contains some characters after the closing PHP tag (?>). This could cause Moodle to exhibit several kinds of problems and should be fixed.';
}
function solution() {
global $CFG;
return 'You need to edit <strong>'.$CFG->dirroot.'/config.php</strong> and remove all characters (including spaces and returns) after the ending ?> tag. These two characters should be the very last in that file.';
}
}
class problem_000003 extends problem_base {
function title() {
return '$CFG->dataroot does not exist or does not have write permissions';
}
function exists() {
global $CFG;
if(!is_dir($CFG->dataroot) || !is_writable($CFG->dataroot)) {
return true;
}
return false;
}
function severity() {
return SEVERITY_SIGNIFICANT;
}
function description() {
global $CFG;
return 'Your <strong>config.php</strong> says that your "data root" directory is <strong>'.$CFG->dataroot.'</strong>. However, this directory either does not exist or cannot be written to by Moodle. This means that a variety of problems will be present, such as users not being able to log in and not being able to upload any files. It is imperative that you address this problem for Moodle to work correctly.';
}
function solution() {
global $CFG;
return 'First of all, make sure that the directory <strong>'.$CFG->dataroot.'</strong> exists. If the directory does exist, then you must make sure that Moodle is able to write to it. Contact your web server administrator and request that he gives write permissions for that directory to the user that the web server process is running as.';
}
}
class problem_000004 extends problem_base {
function title() {
return 'cron.php is not set up to run automatically';
}
function exists() {
global $CFG;
$lastcron = get_field_sql('SELECT max(lastcron) FROM '.$CFG->prefix.'modules');
return (time() - $lastcron > 3600 * 24);
}
function severity() {
return SEVERITY_SIGNIFICANT;
}
function description() {
return 'The cron.php mainenance script has not been run in the past 24 hours. This probably means that your server is not configured to automatically run this script in regular time intervals. If this is the case, then Moodle will mostly work as it should but some operations (notably sending email to users) will not be carried out at all.';
}
function solution() {
global $CFG;
return 'For detailed instructions on how to enable cron, see <a href="'.$CFG->wwwroot.'/doc/?file=install.html#cron">this section</a> of the installation manual.';
}
}
class problem_000005 extends problem_base {
function title() {
return 'PHP: session.auto_start is enabled';
}
function exists() {
return ini_get_bool('session.auto_start');
}
function severity() {
return SEVERITY_CRITICAL;
}
function description() {
return 'Your PHP configuration includes an enabled setting, session.auto_start, that <strong>must be disabled</strong> in order for Moodle to work correctly. Notable symptoms arising from this misconfiguration include fatal errors and/or blank pages when trying to log in.';
}
function solution() {
global $CFG;
return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>session.auto_start = 1</pre> and change it to <pre>session.auto_start = 0</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot.'/.htaccess</strong> to contain this line: <pre>php_value session.auto_start "0"</pre></li></ol>';
}
}
class problem_000006 extends problem_base {
function title() {
return 'PHP: magic_quotes_runtime is enabled';
}
function exists() {
return (ini_get_bool('magic_quotes_runtime'));
}
function severity() {
return SEVERITY_SIGNIFICANT;
}
function description() {
return 'Your PHP configuration includes an enabled setting, magic_quotes_runtime, that <strong>must be disabled</strong> in order for Moodle to work correctly. Notable symptoms arising from this misconfiguration include strange display errors whenever a text field that includes single or double quotes is processed.';
}
function solution() {
global $CFG;
return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>magic_quotes_runtime = On</pre> and change it to <pre>magic_quotes_runtime = Off</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot.'/.htaccess</strong> to contain this line: <pre>php_value magic_quotes_runtime "Off"</pre></li></ol>';
}
}
class problem_000007 extends problem_base {
function title() {
return 'PHP: file_uploads is disabled';
}
function exists() {
return !ini_get_bool('file_uploads');
}
function severity() {
return SEVERITY_SIGNIFICANT;
}
function description() {
return 'Your PHP configuration includes a disabled setting, file_uploads, that <strong>must be enabled</strong> to let Moodle offer its full functionality. Until this setting is enabled, it will not be possible to upload any files into Moodle. This includes, for example, course content and user pictures.';
}
function solution() {
global $CFG;
return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>file_uploads = Off</pre> and change it to <pre>file_uploads = On</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot.'/.htaccess</strong> to contain this line: <pre>php_value file_uploads "On"</pre></li></ol>';
}
}
class problem_000008 extends problem_base {
function title() {
return 'PHP: memory_limit cannot be controlled by Moodle';
}
function exists() {
$memlimit = @ini_get('memory_limit');
if(empty($memlimit)) {
// PHP not compiled with memory limits, this means that it's
// probably limited to 8M so we have a problem...
return true;
}
// Otherwise, raise_memory_limit in setup.php will do the trick
return false;
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
return 'The settings for PHP on your server do not allow a script to request more memory during its execution. This means that most likely there is a hard limit of 8MB for each script. It is possible that certain operations within Moodle will require more than this amount in order to complete successfully, especially if there are lots of data to be processed. Therefore, it is recommended that you contact your server administrator to address this issue.';
}
function solution() {
global $CFG;
return 'We need a good solution here. Enabling memory limit control means recompiling PHP... maybe this should be SEVERITY_NOTICE instead of SEVERITY_ANNOYANCE?';
}
}
class problem_000009 extends problem_base {
function title() {
return 'SQL: using account without password';
}
function exists() {
global $CFG;
return empty($CFG->dbpass);
}
function severity() {
return SEVERITY_CRITICAL;
}
function description() {
global $CFG;
return 'The user account your are connecting to the database server with is set up without a password. This is a very big security risk and is only somewhat lessened if your database is configured to not accept connections from any hosts other than the server Moodle is running on. Unless you use a strong password to connect to the database, you risk unauthorized access to and manipulation of your data.'.($CFG->dbuser != 'root'?'':' <strong>This is especially alarming because such access to the database would be as the superuser (root)!</strong>');
}
function solution() {
global $CFG;
return 'You should change the password of the user <strong>'.$CFG->dbuser.'</strong> both in your database and in your Moodle <strong>config.php</strong> immediately!'.($CFG->dbuser != 'root'?'':' It would also be a good idea to change the user account from root to something else, because this would lessen the impact in the event that your database is compromised anyway.');
}
}
class problem_000010 extends problem_base {
function title() {
return 'Uploaded files: slasharguments disabled or not working';
}
function exists() {
if (!$this->is_enabled()) {
return true;
}
if ($this->status() < 1) {
return true;
}
return false;
}
function severity() {
if ($this->is_enabled() and $this->status() == 0) {
return SEVERITY_SIGNIFICANT;
} else {
return SEVERITY_ANNOYANCE;
}
}
function description() {
global $CFG;
$desc = 'Slasharguments are needed for relative linking in uploaded resources:<ul>';
if (!$this->is_enabled()) {
$desc .= '<li>slasharguments are <strong>disabled</strong> in Moodle configuration</li>';
} else {
$desc .= '<li>slasharguments are enabled in Moodle configuration</li>';
}
if ($this->status() == -1) {
$desc .= '<li>can not run automatic test, you can verify it <a href="'.$CFG->wwwroot.'/file.php/testslasharguments" target="_blank">here</a></li>';
} else if ($this->status() == 0) {
$desc .= '<li>slashargument test <strong>failed</strong>, please check server configuration</li>';
} else {
$desc .= '<li>slashargument test passed</li>';
}
$desc .= '</ul>';
return $desc;
}
function solution() {
global $CFG;
$enabled = $this->is_enabled();
$status = $this->status();
$solution = '';
if ($enabled and ($status == 0)) {
$solution .= 'Slasharguments are enabled, but the test failed. Please disable slasharguments in Moodle configuration or fix the server configuration.<hr />';
} else if ((!$enabled) and ($status == 0)) {
$solution .= 'Slasharguments are disabled and the test failed. You may try to fix the server configuration.<hr />';
} else if ($enabled and ($status == -1)) {
$solution .= 'Slasharguments are enabled, <a href="'.$CFG->wwwroot.'/file.php/testslasharguments">automatic testing</a> not possible.<hr />';
} else if ((!$enabled) and ($status == -1)) {
$solution .= 'Slasharguments are disabled, <a href="'.$CFG->wwwroot.'/file.php/testslasharguments">automatic testing</a> not possible.<hr />';
} else if ((!$enabled) and ($status > 0)) {
$solution .= 'Slasharguments are disabled though the iternal test is OK. You should enable slasharguments in Moodle configuration.';
} else if ($enabled and ($status > 0)) {
$solution .= 'Congratulations - everything seems OK now :-D';
}
if ($status < 1) {
$solution .= '<p>IIS:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li><li>do NOT enable AllowPathInfoForScriptMappings !!!</li><li>slasharguments may not work when using ISAPI and PHP 4.3.10 and older</li></ul></p>';
$solution .= '<p>Apache 1:<ul><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
$solution .= '<p>Apache 2:<ul><li>you must add <code>AcceptPathInfo on</code> to php.ini or .htaccess</li><li>try to add <code>cgi.fix_pathinfo=1</code> to php.ini</li></ul></p>';
}
return $solution;
}
function is_enabled() {
global $CFG;
return !empty($CFG->slasharguments);
}
function status() {
global $CFG;
$handle = @fopen($CFG->wwwroot.'/file.php?file=/testslasharguments', "r");
$contents = trim(@fread($handle, 7));
@fclose($handle);
if ($contents != 'test -1') {
return -1;
}
$handle = @fopen($CFG->wwwroot.'/file.php/testslasharguments', "r");
$contents = trim(@fread($handle, 6));
@fclose($handle);
switch ($contents) {
case 'test 1': return 1;
case 'test 2': return 2;
default: return 0;
}
}
}
class problem_00000x extends problem_base {
function title() {
return '';
}
function exists() {
return false;
}
function severity() {
return SEVERITY_SIGNIFICANT;
}
function description() {
return '';
}
function solution() {
global $CFG;
return '';
}
}
/*
TODO:
session.save_path -- it doesn't really matter because we are already IN a session, right?
*/
?>
+124 -176
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
/// Check that config.php exists, if not then call the install script
if (!file_exists("../config.php")) {
@@ -21,7 +21,7 @@
/// Check some PHP server settings
$documentationlink = "please read the <a href=\"../doc/?frame=install.html&amp;sub=webserver\">install documentation</a>";
$documentationlink = "please read the <A HREF=\"../doc/?frame=install.html&sub=webserver\">install documentation</A>";
if (ini_get_bool('session.auto_start')) {
error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
@@ -39,7 +39,7 @@
/// Check that config.php has been edited
if ($CFG->wwwroot == "http://example.com/moodle") {
error("Moodle has not been configured yet. You need to edit config.php first.");
error("Moodle has not been configured yet. You need to to edit config.php first.");
}
@@ -48,10 +48,10 @@
$dirroot = dirname(realpath("../index.php"));
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
error("Please fix your settings in config.php:
<p>You have:
<p>\$CFG->dirroot = \"".addslashes($CFG->dirroot)."\";
<p>but it should be:
<p>\$CFG->dirroot = \"".addslashes($dirroot)."\";",
<P>You have:
<P>\$CFG->dirroot = \"".addslashes($CFG->dirroot)."\";
<P>but it should be:
<P>\$CFG->dirroot = \"".addslashes($dirroot)."\";",
"./");
}
@@ -77,11 +77,11 @@
} else { // Check for missing main tables
$maintables = true;
$mtables = array("config", "course", "course_categories", "course_modules",
"course_sections", "log", "log_display", "modules",
$mtables = array("config", "course", "course_categories", "course_modules",
"course_sections", "log", "log_display", "modules",
"user", "user_admins", "user_students", "user_teachers");
foreach ($mtables as $mtable) {
if (!in_array($CFG->prefix.$mtable, $tables)) {
if (!in_array($CFG->prefix.$mtable, $tables)) {
$maintables = false;
break;
}
@@ -92,13 +92,13 @@
if (empty($agreelicence)) {
$strlicense = get_string("license");
print_header($strlicense, $strlicense, $strlicense, "", "", false, "&nbsp;", "&nbsp;");
print_heading("<a href=\"http://moodle.org\">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment");
print_heading("<A HREF=\"http://moodle.org\">Moodle</A> - Modular Object-Oriented Dynamic Learning Environment");
print_heading(get_string("copyrightnotice"));
print_simple_box_start("center");
echo text_to_html(get_string("gpl"));
print_simple_box_end();
echo "<br />";
notice_yesno(get_string("doyouagree"), "index.php?agreelicence=true",
notice_yesno(get_string("doyouagree"), "index.php?agreelicence=true",
"http://moodle.org/doc/?frame=licence.html");
exit;
}
@@ -123,91 +123,6 @@
}
/// Check version of Moodle code on disk compared with database
/// and upgrade if possible.
include_once("$CFG->dirroot/version.php"); # defines $version
include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines upgrades
$stradministration = get_string("administration");
if ($CFG->version) {
if ($version > $CFG->version) { // upgrade
$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";
$strdatabasechecking = get_string("databasechecking", "", $a);
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');
exit;
} else {
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
"", "", false, "&nbsp;", "&nbsp;");
print_heading($strdatabasechecking);
$db->debug=true;
if (main_upgrade($CFG->version)) {
$db->debug=false;
if (set_config("version", $version)) {
notify($strdatabasesuccess, "green");
print_continue("index.php");
exit;
} else {
notify("Upgrade failed! (Could not update version in config table)");
}
} else {
$db->debug=false;
notify("Upgrade failed! See /version.php");
}
}
} else if ($version < $CFG->version) {
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
}
} else {
$strcurrentversion = get_string("currentversion");
print_header($strcurrentversion, $stradministration, $strcurrentversion,
"", "", false, "&nbsp;", "&nbsp;");
if (set_config("version", $version)) {
print_heading("Moodle $release ($version)");
print_continue("index.php");
die;
} else {
$db->debug=true;
if (main_upgrade(0)) {
print_continue("index.php");
} else {
error("A problem occurred inserting current version into databases");
}
$db->debug=false;
}
}
/// Updated human-readable release version if necessary
if ($release <> $CFG->release) { // Update the release version
$strcurrentrelease = get_string("currentrelease");
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
if (!set_config("release", $release)) {
notify("ERROR: Could not update release version in database!!");
}
print_continue("index.php");
print_simple_box_start("CENTER");
include("$CFG->dirroot/lang/en/docs/release.html");
print_simple_box_end();
print_continue("index.php");
exit;
}
/// Insert default values for any important configuration variables
include_once("$CFG->dirroot/lib/defaults.php");
@@ -227,9 +142,76 @@
}
/// Check version of Moodle code on disk compared with database
/// and upgrade if possible.
include_once("$CFG->dirroot/version.php"); # defines $version
include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines upgrades
if ($CFG->version) {
if ($version > $CFG->version) { // upgrade
$a->oldversion = $CFG->version;
$a->newversion = $version;
$strdatabasechecking = get_string("databasechecking", "", $a);
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasechecking, $strdatabasechecking, $strdatabasechecking,
"", "", false, "&nbsp;", "&nbsp;");
print_heading($strdatabasechecking);
$db->debug=true;
if (main_upgrade($CFG->version)) {
$db->debug=false;
if (set_config("version", $version)) {
notify($strdatabasesuccess, "green");
print_continue("index.php");
die;
} else {
notify("Upgrade failed! (Could not update version in config table)");
}
} else {
$db->debug=false;
notify("Upgrade failed! See /version.php");
}
} else if ($version < $CFG->version) {
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
}
} else {
$strcurrentversion = get_string("currentversion");
print_header($strcurrentversion, $strcurrentversion, $strcurrentversion,
"", "", false, "&nbsp;", "&nbsp;");
if (set_config("version", $version)) {
print_heading("You are currently using Moodle version $version (Release $release)");
print_continue("index.php");
die;
} else {
$db->debug=true;
if (main_upgrade(0)) {
print_continue("index.php");
} else {
error("A problem occurred inserting current version into databases");
}
$db->debug=false;
}
}
/// Updated human-readable release version if necessary
if ($release <> $CFG->release) { // Update the release version
$strcurrentrelease = get_string("currentrelease");
print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, "&nbsp;", "&nbsp;");
print_heading("Moodle $release");
if (!set_config("release", $release)) {
notify("ERROR: Could not update release version in database!!");
}
print_continue("index.php");
print_simple_box_start("CENTER");
include("$CFG->dirroot/lang/en/docs/release.html");
print_simple_box_end();
print_continue("index.php");
exit;
}
/// Find and check all main modules and load them up or upgrade them if necessary
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Upgrade backup/restore system if necessary
require_once("$CFG->dirroot/backup/lib.php");
@@ -244,6 +226,9 @@
/// Check all enrolment plugins and upgrade if necessary
upgrade_enrol_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
/// Find and check all main modules and load them up or upgrade them if necessary
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
@@ -252,29 +237,6 @@
redirect("site.php");
}
/// Define the unique site ID code if it isn't already
if (empty($CFG->siteidentifier)) { // Unique site identification code
set_config('siteidentifier', random_string(32));
}
/// Check if the guest user exists. If not, create one.
if (! record_exists("user", "username", "guest")) {
$guest->auth = "manual";
$guest->username = "guest";
$guest->password = md5("guest");
$guest->firstname = addslashes(get_string("guestuser"));
$guest->lastname = " ";
$guest->email = "root@localhost";
$guest->description = addslashes(get_string("guestuserinfo"));
$guest->confirmed = 1;
$guest->lang = $CFG->lang;
$guest->timemodified= time();
if (! $guest->id = insert_record("user", $guest)) {
notify("Could not create guest user record !!!");
}
}
/// Set up the admin user
if (! record_exists("user_admins")) { // No admin user yet
redirect("user.php");
@@ -287,30 +249,20 @@
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
/// At this point everything is set up and the user is an admin, so print menu
$stradministration = get_string("administration");
print_header("$site->shortname: $stradministration","$site->fullname", "$stradministration");
print_simple_box_start('center', '100%', '', 20);
print_simple_box_start("center", "100%", "$THEME->cellcontent2", 20);
print_heading($stradministration);
if (!empty($CFG->upgrade)) { // Print notice about extra upgrading that needs to be done
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
print_simple_box(get_string("upgrade$CFG->upgrade", "admin",
"$CFG->wwwroot/$CFG->admin/upgrade$CFG->upgrade.php"), "center");
print_spacer(10,10);
}
/// If no recently cron run
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
if (time() - $lastcron > 3600 * 24) {
print_simple_box(get_string('cronwarning', 'admin') , 'center');
}
/// Alert if we are currently in maintenance mode
if (file_exists($CFG->dataroot.'/1/maintenance.html')) {
print_simple_box(get_string('sitemaintenancewarning', 'admin') , 'center');
}
$table->tablealign = "right";
$table->align = array ("right", "left");
$table->wrap = array ("nowrap", "nowrap");
@@ -318,94 +270,90 @@
$table->cellspacing = 3;
$table->width = "40%";
$configdata = "<font size=\"+1\">&nbsp;</font><a href=\"config.php\">".get_string("configvariables", 'admin')."</a> - <font size=\"1\">".
$configdata = "<font size=+1>&nbsp;</font><a href=\"config.php\">".get_string("configvariables")."</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\">".
$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\">".
$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\">".
$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\">".
$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\">".
$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\">".
$configdata .= "<font size=+1>&nbsp;</font><a href=\"filters.php?sesskey=$USER->sesskey\">".get_string("managefilters")."</a> - <font size=1>".
get_string("adminhelpmanagefilters")."</font><br />";
if (!isset($CFG->disablescheduledbackups)) {
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"backup.php\">".get_string("backup")."</a> - <font size=\"1\">".
$configdata .= "<font size=+1>&nbsp;</font><a href=\"backup.php?sesskey=$USER->sesskey\">".get_string("backup")."</a> - <font size=1>".
get_string("adminhelpbackup")."</font><br />";
}
$configdata .= "<font size=\"+1\">&nbsp;</font><a href=\"editor.php\">". get_string("editorsettings") ."</a> - <font size=\"1\">".
$configdata .= "<font size=+1>&nbsp;</font><a href=\"editor.php?sesskey=$USER->sesskey\">". 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("<font size=\"+1\"><b><a href=\"configure.php\">".get_string("configuration")."</a></b></font>",
$table->data[] = array("<font size=+1><b><a href=\"configure.php\">".get_string("configuration")."</a></b>",
$configdata);
$userdata = "<font size=\"+1\">&nbsp;</font><a href=\"auth.php?sesskey=$USER->sesskey\">".get_string("authentication")."</a> - <font size=\"1\">".
$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\">".
$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\">".
$userdata .= "<font size=+1>&nbsp;</font><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&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\">".
$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 /><font size=\"+1\">&nbsp;</font><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolments")."</a> - <font size=\"1\">".
$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\">".
$userdata .= "<font size=+1>&nbsp;</font><a href=\"../course/index.php?edit=off&sesskey=$USER->sesskey\">".get_string("assignstudents")."</a> - <font size=1>".
get_string("adminhelpassignstudents")."</font><br />";
$userdata .= "<font size=\"+1\">&nbsp;</font><a href=\"../course/index.php?edit=on&amp;sesskey=$USER->sesskey\">".get_string("assignteachers")."</a> - <font size=\"1\">".
$userdata .= "<font size=+1>&nbsp;</font><a href=\"../course/index.php?edit=on&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\">".
" <img src=\"../pix/t/user.gif\" height=11 width=11></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\">".
$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("<font size=\"+1\"><b><a href=\"users.php\">".get_string("users")."</a></b></font>", $userdata);
$table->data[] = array("<font size=+1><b><a href=\"users.php\">".get_string("users")."</a></b>", $userdata);
$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"));
$table->data[] = array("<font size=+1><b><a href=\"../course/index.php?edit=on&sesskey=$USER->sesskey\">".get_string("courses")."</a></b>",
"<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 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 size=+1>&nbsp;</font>".get_string("adminhelpsitefiles"));
if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
$table->data[] = array("<font size=+1><b><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></b></font>",
$table->data[] = array("<font size=+1><b><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></b>",
"<font size=+1>&nbsp;</font>".get_string("adminhelpmanagedatabase"));
}
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-2005 Martin Dougiamas<br />".
"Copyright &copy; 1999-2004 Martin Dougiamas<br />".
"<a href=\"../doc/?frame=licence.html\">GNU Public License</a>";
echo "<center><p><font size=\"1\">$copyrighttext</font></p></center>";
echo "<center><p><font size=1>$copyrighttext</font></p></center>";
//////////////////////////////////////////////////////////////////////////////////////////////////
echo "<table border=\"0\" align=\"center\" width=\"100%\"><tr>";
echo "<td align=\"center\" width=\"33%\">";
echo "<table border=0 align=center width=100%><tr>";
echo "<td align=center width=33%>";
print_single_button("$CFG->wwwroot/doc", NULL, get_string("documentation"));
echo "</td>";
echo "<td align=\"center\" width=\"33%\">";
echo "<td align=center width=33%>";
print_single_button("phpinfo.php", NULL, get_string("phpinfo"));
echo "</td>";
echo "<td align=\"center\" width=\"33%\">";
echo "<td align=center width=33%>";
$options['sesskey'] = $USER->sesskey;
print_single_button("register.php", $options, get_string("registration"));
echo "</td>";
-30
View File
@@ -1,30 +0,0 @@
<?php
include('../config.php');
require_login();
if (!isadmin()) {
error('Admin only');
}
print_header("Convert all tables from MYISAM to InnoDB", "Convert all tables from MYISAM to InnoDB",
"Convert all tables from MYISAM to InnoDB");
if (!empty($confirm) and confirm_sesskey()) {
print_heading("Please be patient and wait for this to complete...");
if ($tables = $db->MetaTables()) {
$db->debug = true;
foreach ($tables as $table) {
execute_sql("ALTER TABLE $table TYPE=INNODB; ");
}
}
} else {
notice_yesno("Are you sure you want convert all your tables to the InnoDB format?",
"innodb.php?confirm=yes&sesskey=".sesskey(), "index.php");
}
?>
+45 -47
View File
@@ -20,23 +20,24 @@
$strlanguage = get_string("language");
$strcurrentlanguage = get_string("currentlanguage");
$strmissingstrings = get_string("missingstrings");
$streditstrings = get_string("editstrings", 'admin');
$stredithelpdocs = get_string("edithelpdocs", 'admin');
$strcomparelanguage = get_string("comparelanguage");
$strthislanguage = get_string("thislanguage");
switch ($mode) {
case "missing":
$navigation = "<a href=\"lang.php\">$strlanguage</a> -> $strmissingstrings";
$navigation = "<A HREF=\"lang.php\">$strlanguage</A> -> $strmissingstrings";
$title = $strmissingstrings;
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/admin/lang.php">'.
'<input type="hidden" name="mode" value="compare" />'.
'<input type="submit" value="'.$streditstrings.'" /></form>';
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />'.
'<input type="submit" value="'.$strcomparelanguage.'" /></form>';
break;
case "compare":
$navigation = "<a href=\"lang.php\">$strlanguage</a> -> $streditstrings";
$title = $streditstrings;
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
$navigation = "<A HREF=\"lang.php\">$strlanguage</A> -> $strcomparelanguage";
$title = $strcomparelanguage;
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/admin/lang.php">'.
'<input type="hidden" name="mode" value="missing" />'.
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />'.
'<input type="submit" value="'.$strmissingstrings.'" /></form>';
break;
default:
@@ -56,17 +57,17 @@
if (!$mode) {
$currlang = current_language();
$langs = get_list_of_languages();
echo "<table align=\"center\"><tr><td align=\"right\">";
echo "<table align=center><tr><td align=\"right\">";
echo "<b>$strcurrentlanguage:</b>";
echo "</td><td>";
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
echo '</td></tr><tr><td colspan="2">';
echo popup_form ("$CFG->wwwroot/admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
echo "</td></tr></table>";
print_heading("<a href=\"lang.php?mode=missing&sesskey=$USER->sesskey\">$strmissingstrings</a>");
print_heading("<a href=\"lang.php?mode=compare&sesskey=$USER->sesskey\">$strcomparelanguage</a>");
echo "<center><hr noshade size=1>";
$options["lang"] = $currentlang;
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 "</center>";
print_footer();
exit;
}
@@ -86,13 +87,13 @@
}
}
if ($mode == "missing") {
if ($mode == "missing" and confirm_sesskey()) {
// 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>";
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/$file")."</font></p>";
continue;
}
}
@@ -129,7 +130,7 @@
foreach ($files as $filekey => $file) { // check all the help files.
if (!file_exists("$langdir/help/$file")) {
echo "<p><font color=\"red\">".get_string("filemissing", "", "$langdir/help/$file")."</font></p>";
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/help/$file")."</font></p>";
$somethingfound = true;
continue;
}
@@ -140,7 +141,7 @@
}
foreach ($files as $filekey => $file) { // check all the docs files.
if (!file_exists("$langdir/docs/$file")) {
echo "<p><font color=\"red\">".get_string("filemissing", "", "$langdir/docs/$file")."</font></p>";
echo "<P><FONT COLOR=red>".get_string("filemissing", "", "$langdir/docs/$file")."</FONT></P>";
$somethingfound = true;
continue;
}
@@ -152,22 +153,19 @@
notice(get_string("languagegood"), "lang.php");
}
} else if ($mode == "compare") {
} else if ($mode == "compare" and confirm_sesskey()) {
if (isset($_POST['currentfile'])){ // Save a file
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
$newstrings = $_POST;
unset($newstrings['currentfile']);
if (lang_save_file($langdir, $currentfile, $newstrings)) {
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
} else {
error("Could not save the file '$currentfile'!", "lang.php?mode=compare&amp;currentfile=$currentfile");
error("Could not save the file '$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile&sesskey=$USER->sesskey");
}
}
print_heading_with_help($streditstrings, "langedit");
print_heading_with_help($strcomparelanguage, "langedit");
print_simple_box_start("center", "80%");
echo '<center><font size="2">';
@@ -175,7 +173,7 @@
if ($file == $currentfile) {
echo "<b>$file</b> &nbsp; ";
} else {
echo "<a href=\"lang.php?mode=compare&amp;currentfile=$file\">$file</a> &nbsp; ";
echo "<a href=\"lang.php?mode=compare&currentfile=$file&sesskey=$USER->sesskey\">$file</a> &nbsp; ";
}
}
echo '</font></center>';
@@ -186,7 +184,7 @@
if (!file_exists("$langdir/$currentfile")) {
if (!touch("$langdir/$currentfile")) {
echo "<p><font color=\"red\">".get_string("filemissing", "", "$langdir/$currentfile")."</font></p>";
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/$currentfile")."</font></p>";
continue;
}
}
@@ -197,7 +195,7 @@
fclose($f);
} else {
$editable = false;
echo "<p><font size=\"1\">".get_string("makeeditable", "", "$langdir/$currentfile")."</font></p>";
echo "<p><font size=1>".get_string("makeeditable", "", "$langdir/$currentfile")."</font></p>";
}
error_reporting(7);
@@ -218,17 +216,18 @@
if ($editable) {
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
}
echo "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"3\" border=\"0\" class=\"generalbox\">";
echo "<table width=\"100%\" cellpadding=2 cellspacing=3 border=0>";
foreach ($enstring as $key => $envalue) {
$envalue = nl2br(htmlspecialchars($envalue));
$envalue = preg_replace('/(\$a\-\&gt;[a-zA-Z0-9]*|\$a)/', '<b>$0</b>', $envalue); // Make variables bold.
$envalue = str_replace("%%","%",$envalue);
$envalue = str_replace("\\","",$envalue); // Delete all slashes
echo "\n\n".'<tr>';
echo '<td dir="ltr" lang="en" width="20%" nowrap="nowrap" valign="top">'.$key.'</td>'."\n";
echo '<td dir="ltr" lang="en" width="40%" valign="top">'.$envalue.'</td>'."\n";
echo "\n\n<tr>";
echo "<td dir=ltr lang=en width=20% bgcolor=\"$THEME->cellheading\" nowrap valign=top>$key</td>\n";
echo "<td dir=ltr lang=en width=40% bgcolor=\"$THEME->cellheading\" valign=top>$envalue</td>\n";
$value = $string[$key];
$value = str_replace("\r","",$value); // Bad character caused by Windows
@@ -240,10 +239,10 @@
$value = str_replace(">","&gt;",$value);
$value = str_replace('"',"&quot;",$value);
$cellcolour = $value ? '': 'class="highlight"';
$cellcolour = $value ? $THEME->cellcontent: $THEME->highlight;
if ($editable) {
echo '<td width="40%" '.$cellcolour.' valign="top">'."\n";
echo "<td width=40% bgcolor=\"$cellcolour\" valign=top>\n";
if (isset($string[$key])) {
$valuelen = strlen($value);
} else {
@@ -252,29 +251,28 @@
$cols=50;
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
$rows = ceil($valuelen / $cols);
echo '<textarea name="stringXXX'.$key.'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
echo "<textarea name=\"string-$key\" cols=\"$cols\" rows=\"$rows\">$value</textarea>\n";
} else {
if ($valuelen) {
$cols = $valuelen + 2;
}
echo '<input type="text" name="stringXXX'.$key.'" value="'.$value.'" size="'.$cols.'" />';
echo "<input type=\"text\" name=\"string-$key\" value=\"$value\" size=\"$cols\"></td>";
}
echo '</td>';
echo "</TD>\n";
} else {
echo '<td width="40%" bgcolor="'.$cellcolour.'" valign="top">'.$value.'</td>';
echo "<td width=40% bgcolor=\"$cellcolour\" valign=top>$value</td>\n";
}
}
if ($editable) {
echo '<tr><td colspan="2">&nbsp;<td><br />';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo ' <input type="hidden" name="currentfile" value="'.$currentfile.'" />';
echo ' <input type="hidden" name="mode" value="compare" />';
echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
echo '</td></tr>';
echo "<tr><td colspan=2>&nbsp;<td><br />";
echo " <input type=\"hidden\" name=\"currentfile\" value=\"$currentfile\">";
echo " <input type=\"hidden\" name=\"mode\" value=\"compare\">";
echo " <input type=\"submit\" name=\"update\" value=\"".get_string("savechanges").": $currentfile\">";
echo "</td></tr>";
}
echo '</table>';
echo '</form>';
echo "</table>";
echo "</form>";
}
@@ -305,7 +303,7 @@ function lang_save_file($path, $file, $strings) {
ksort($strings);
foreach ($strings as $key => $value) {
list($id, $stringname) = explode('XXX',$key);
list($id, $stringname) = explode("-",$key);
if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") { // Some MB languages include backslash bytes
$value = str_replace("\\","",$value); // Delete all slashes
}
-236
View File
@@ -1,236 +0,0 @@
<?php // $Id$
/**
This script enables Moodle translators to edit /docs and /help language
files directly via WWW interface.
Author: mudrd8mz@it.pedf.cuni.cz (http://moodle.cz)
Based on: lang.php in 1.4.3+ release
*/
//
// Some local configuration
//
$fileeditorrows = 12; // number of textareas' rows
$fileeditorcols = 100; // dtto cols
$fileeditorinline = 1; // shall be textareas put in one row?
$filemissingmark = ' (***)'; // mark to add to non-existing filenames in selection form
$fileoldmark = ' (old?)'; // mark to add to filenames in selection form id english version is newer
// or to filenames with filesize() == 0
$filetemplate = ''; // template for new files, i.e. '$Id$';
require_once("../config.php");
$currentfile = optional_param('currentfile', 'docs/README.txt', PARAM_PATH);
require_login();
if (!isadmin()) {
error("You need to be admin to edit this page");
}
if (! $site = get_site()) {
error("Site not defined!");
}
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strlanguage = get_string("language");
$strcurrentlanguage = get_string("currentlanguage");
$strthislanguage = get_string("thislanguage");
$stredithelpdocs = get_string('edithelpdocs', 'admin');
print_header("$site->shortname: $stredithelpdocs: $currentfile", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> ->
<a href=\"lang.php\">$strlanguage</a> -> $stredithelpdocs",
'choosefile.popup', '', true);
$currentlang = current_language();
$langdir = "$CFG->dirroot/lang/$currentlang";
$enlangdir = "$CFG->dirroot/lang/en";
// Shall I save POSTed data?
if (isset($_POST['currentfile'])) {
if (confirm_sesskey()) {
if (langdoc_save_file($langdir, $currentfile, $_POST['filedata'])) {
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
} else {
error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey");
}
}
}
error_reporting(0); // Error reporting turned off due to non-existing files
// Generate selection for all help and documentation files
// Get all files from /docs directory
if (! $files = get_directory_list("$CFG->dirroot/lang/en/docs", "CVS")) {
error("Could not find English language docs files!");
}
$options = array();
foreach ($files as $filekey => $file) { // check all the docs files.
$options["docs/$file"] = "docs/$file";
// add mark if file doesn't exist or is empty
if (( !file_exists("$langdir/docs/$file")) || (filesize("$langdir/docs/$file") == 0)) {
$options["docs/$file"] .= "$filemissingmark";
} else {
if (filemtime("$langdir/docs/$file") < filemtime("$CFG->dirroot/lang/en/docs/$file")) {
$options["docs/$file"] .= "$fileoldmark";
}
}
}
// Get all files from /help directory
if (! $files = get_directory_list("$CFG->dirroot/lang/en/help", "CVS")) {
error("Could not find English language help files!");
}
foreach ($files as $filekey => $file) { // check all the help files.
$options["help/$file"] = "help/$file";
if (( !file_exists("$langdir/help/$file")) || (filesize("$CFG->dirroot/lang/en/help/$file") == 0)) {
$options["help/$file"] .= "$filemissingmark";
} else {
if (filemtime("$langdir/help/$file") < filemtime("$langdir/help/$file")) {
$options["help/$file"] .= "$fileoldmark";
}
}
}
echo "<table align=\"center\"><tr><td align=\"center\">";
echo popup_form ("$CFG->wwwroot/$CFG->admin/langdoc.php?sesskey=$USER->sesskey&amp;currentfile=", $options, "choosefile", $currentfile, "", "", "", true);
echo "</td></tr></table>";
// Generate textareas
if (!empty($currentfile)) {
if (!file_exists("$langdir/$currentfile")) {
//check if directory exist
$pathparts = explode('/',$currentfile);
$checkpath = $langdir;
for ($a=0; $a < count($pathparts)-1 ; $a++) {
$checkpath .= "/".$pathparts[$a];
if(!file_exists($checkpath)){
if(!mkdir($checkpath)){
echo ("Cannot create directory: $checkpath");
}
}
}
//
// file doesn't exist - let's check webserver's permission to create it
//
if (!touch("$langdir/$currentfile")) {
//
// webserver is unable to create new file
//
echo "<p align=\"center\"><font color=red>".get_string("filemissing", "", "
$langdir/$currentfile")."</font></p>";
$editable = false;
} else {
//
// webserver can create new file - we can delete it now and let
// the langdoc_save_file() create it again if its filesize() > 0
//
$editable = true;
unlink("$langdir/$currentfile");
}
} elseif ($f = fopen("$langdir/$currentfile","r+")) {
//
// file exists and is writeable - good for you, translator ;-)
//
$editable = true;
fclose($f);
} else {
//
// file exists but it is not writeable by web server process :-(
//
$editable = false;
echo "<p><font size=1>".get_string("makeeditable", "", "$langdir/$currentfile")
."</font></p>";
}
echo "<table align=\"center\"><tr valign=\"center\"><td align=\"center\">\n";
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">\n";
include("$enlangdir/$currentfile");
echo "</textarea>\n";
link_to_popup_window("/lang/en/$currentfile", "popup", get_string("preview"));
echo "</td>\n";
if ($fileeditorinline == 1) {
echo "</tr>\n<tr valign=\"center\">\n";
}
echo "<td align=\"center\">\n";
if ($editable) {
echo "<form name=\"$currentfile\" action=\"langdoc.php\" method=\"post\">";
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo '<input type="hidden" name="currentfile" value="'.$currentfile.'" />';
}
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
if (file_exists("$langdir/$currentfile")) {
include("$langdir/$currentfile");
} else {
echo ($filetemplate);
}
echo "</textarea>\n";
link_to_popup_window("/lang/$currentlang/$currentfile", "popup", get_string("preview"));
echo "</td>\n</tr>\n</table>";
if ($editable) {
echo '<div align="center"><input type="submit" value="'.get_string('savechanges').': lang/'.$currentlang.'/'.$currentfile.'" /></div>';
echo '</form>';
}
error_reporting($CFG->debug);
}
print_footer();
//////////////////////////////////////////////////////////////////////
function langdoc_save_file($path, $file, $content) {
// $path is a full pathname to the file
// $file is the file to overwrite.
// $content are data to write
global $CFG, $USER;
error_reporting(0);
if (!$f = fopen("$path/$file","w")) {
error_reporting($CFG->debug);
return false;
}
error_reporting($CFG->debug);
$content = str_replace("\r", "",$content); // Remove linefeed characters
$content = preg_replace("/\n{3,}/", "\n\n", $content); // Collapse runs of blank lines
$content = str_replace("\\","",$content); // Delete all slashes
$content = str_replace("%%","%",$content);
$content = trim($content); // Delete leading/trailing whitespace
fwrite($f, $content);
fclose($f);
// Remove file if its empty
if (filesize("$path/$file") == 0) {
unlink("$path/$file");
}
return true;
}
?>
-79
View File
@@ -1,79 +0,0 @@
<?php // $Id$
// Enables/disables maintenance mode
require('../config.php');
$action = optional_param('action', '', PARAM_ALPHA);
$sesskey = optional_param('sesskey');
require_login();
if (!isadmin()) {
error('You need to be admin to use this page');
}
//Check folder exists
if (! make_upload_directory(SITEID)) { // Site folder
error("Could not create site folder. The site administrator needs to fix the file permissions");
}
$filename = $CFG->dataroot.'/1/maintenance.html';
if ($form = data_submitted()) {
if (confirm_sesskey()) {
if ($form->action == "disable") {
unlink($filename);
redirect('index.php', get_string('sitemaintenanceoff','admin'));
} else {
$file = fopen($filename, 'w');
fwrite($file, $form->text);
fclose($file);
redirect('index.php', get_string('sitemaintenanceon', 'admin'));
}
}
}
/// Print the header stuff
$strmaintenance = get_string('sitemaintenancemode', 'admin');
$stradmin = get_string('administration');
$strconfiguration = get_string('configuration');
print_header("$SITE->shortname: $strmaintenance", $SITE->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> $strmaintenance");
print_heading($strmaintenance);
/// Print the appropriate form
if (file_exists($filename)) { // We are in maintenance mode
echo '<center>';
echo '<form action="maintenance.php" method="post">';
echo '<input type="hidden" name="action" value="disable">';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'">';
echo '<p><input type="submit" value="'.get_string('disable').'"></p>';
echo '</form>';
echo '</center>';
} else { // We are not in maintenance mode
$usehtmleditor = can_use_html_editor();
echo '<center>';
echo '<form action="maintenance.php" method="post">';
echo '<input type="hidden" name="action" value="enable">';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'">';
echo '<p><input type="submit" value="'.get_string('enable').'"></p>';
echo '<p>'.get_string('optionalmaintenancemessage', 'admin').':</p>';
echo '<table><tr><td>';
print_textarea($usehtmleditor, 20, 50, 600, 400, "text");
echo '</td></tr></table>';
echo '</form>';
echo '</center>';
if ($usehtmleditor) {
use_html_editor();
}
}
print_footer();
?>
+7 -7
View File
@@ -13,13 +13,13 @@
error("Site isn't defined!");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
/// If data submitted, then process and store.
if ($config = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if ($config = data_submitted()) {
print_header();
foreach ($config as $name => $value) {
set_config($name, $value);
@@ -48,10 +48,10 @@
print_heading($strmodulename);
print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "50%");
print_simple_box("<center>".get_string("configwarning")."</center>", "center", "50%");
echo "<br />";
print_simple_box_start("center", "");
print_simple_box_start("center", "", "$THEME->cellheading");
include("$CFG->dirroot/mod/$module/config.html");
print_simple_box_end();
+20 -12
View File
@@ -64,7 +64,7 @@
if (empty($confirm)) {
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=$delete&amp;sesskey=$USER->sesskey",
"modules.php?delete=$delete&confirm=$delete&sesskey=$USER->sesskey",
"modules.php");
print_footer();
exit;
@@ -144,20 +144,28 @@
/// Print the table of all modules
if (empty($THEME->custompix)) {
$pixpath = "../pix";
$modpixpath = "../mod";
} else {
$pixpath = "../theme/$CFG->theme/pix";
$modpixpath = "../theme/$CFG->theme/pix/mod";
}
$table->head = array ($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings);
$table->align = array ("left", "right", "left", "center", "center", "center");
$table->wrap = array ("nowrap", "", "", "", "","");
$table->size = array ("100%", "10", "10", "10", "10","12");
$table->align = array ("LEFT", "RIGHT", "LEFT", "CENTER", "CENTER", "CENTER");
$table->wrap = array ("NOWRAP", "", "", "", "","");
$table->size = array ("100%", "10", "10", "10", "10","12");
$table->width = "100";
foreach ($modulebyname as $modulename => $module) {
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" hspace=\"10\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" />";
$icon = "<img src=\"$modpixpath/$module->name/icon.gif\" hspace=10 height=16 width=16 border=0>";
$delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=$USER->sesskey\">$strdelete</a>";
$delete = "<a href=\"modules.php?delete=$module->name&sesskey=$USER->sesskey\">$strdelete</a>";
if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
$settings = "<a href=\"module.php?module=$module->name\">$strsettings</a>";
$settings = "<a href=\"module.php?module=$module->name&sesskey=$USER->sesskey\">$strsettings</a>";
} else {
$settings = "";
}
@@ -165,12 +173,12 @@
$count = count_records("$module->name");
if ($module->visible) {
$visible = "<a href=\"modules.php?hide=$module->name&amp;sesskey=$USER->sesskey\" title=\"$strhide\">".
"<img src=\"$CFG->pixpath/i/hide.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
$visible = "<a href=\"modules.php?hide=$module->name&sesskey=$USER->sesskey\" title=\"$strhide\">".
"<img src=\"$pixpath/i/hide.gif\" align=\"absmiddle\" height=16 width=16 border=0></a>";
$class = "";
} else {
$visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=$USER->sesskey\" title=\"$strshow\">".
"<img src=\"$CFG->pixpath/i/show.gif\" align=\"middle\" height=\"16\" width=\"16\" border=\"0\" alt=\"\" /></a>";
$visible = "<a href=\"modules.php?show=$module->name&sesskey=$USER->sesskey\" title=\"$strshow\">".
"<img src=\"$pixpath/i/show.gif\" align=\"absmiddle\" height=16 width=16 border=0></a>";
$class = "class=\"dimmed_text\"";
}
if ($module->name == "forum") {
@@ -178,7 +186,7 @@
$visible = "";
$class = "";
}
$table->data[] = array ("<span $class>$icon $modulename</span>", $count, $module->version, $visible, $delete, $settings);
$table->data[] = array ("<p $class>$icon $modulename</p>", $count, $module->version, $visible, $delete, $settings);
}
print_table($table);
-79
View File
@@ -1,79 +0,0 @@
#!/usr/bin/php -f
<?
define('FULLME','cron'); // prevent warnings
//error_reporting(0);
//ini_set('display_errors',0);
require_once(dirname(dirname(__FILE__)).'/config.php');
$tmp = explode('@',$_ENV['RECIPIENT']);
$address = $tmp[0];
// BOUNCE EMAILS TO NOREPLY
if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
$user->email = $_ENV['SENDER'];
if (!validate_email($user->email)) {
die();
}
$site = get_site();
$subject = get_string('noreplybouncesubject','moodle',$site->fullname);
$body = get_string('noreplybouncemessage','moodle',$site->fullname)."\n\n";
$fd = fopen('php://stdin','r');
if ($fd) {
while(!feof($fd)) {
$body .= fgets($fd);
}
fclose($fd);
}
$user->id = 0; // to prevent anything annoying happening
$from->firstname = null;
$from->lastname = null;
$from->email = '<>';
$from->maildisplay = true;
email_to_user($user,$from,$subject,$body);
die ();
}
/// ALL OTHER PROCESSING
// we need to split up the address
$prefix = substr($address,0,4);
$mod = substr($address,4,2);
$modargs = substr($address,6,-16);
$hash = substr($address,-16);
if (substr(md5($prefix.$mod.$modargs.$CFG->siteidentifier),0,16) != $hash) {
die("HASH DIDN'T MATCH!\n");
}
list(,$modid) = unpack('C',base64_decode($mod.'=='));
if ($modid == '0') { // special
$modname = 'moodle';
}
else {
$modname = get_field("modules","name","id",$modid);
require_once('mod/'.$modname.'/lib.php');
}
$function = $modname.'_process_email';
if (!function_exists($function)) {
die();
}
$fd = fopen('php://stdin','r');
if (!$fd) {
exit();
}
while(!feof($fd)) {
$body .= fgets($fd);
}
$function($modargs,$body);
fclose($handle);
?>
+33 -90
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// register.php - allows admin to register their site on moodle.org
include("../config.php");
@@ -47,17 +47,14 @@
/// Print the form
print_simple_box_start("center", "");
print_simple_box_start("center", "", "$THEME->cellheading");
echo "<form name=\"form\" action=\"http://moodle.org/register/\" method=\"post\">\n";
echo "<table cellpadding=\"9\" border=\"0\">\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"center\" colspan=\"2\">".get_string("location")."</td>\n";
echo "</tr>\n";
echo "<form name=\"form\" action=\"http://moodle.org/register/\" method=post>\n";
echo "<table cellpadding=9 border=0>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">Moodle URL:</td>\n";
echo "<td>$CFG->wwwroot</td>\n";
echo "<tr valign=top>\n";
echo "<td align=right><p>Moodle URL:</td>\n";
echo "<td><p>$CFG->wwwroot</td>\n";
echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
@@ -68,28 +65,28 @@
echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\">\n";
echo "</td></tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("currentversion").":</td>\n";
echo "<td>$CFG->release ($CFG->version)</td>\n";
echo "<tr valign=top>\n";
echo "<td align=right><p>".get_string("currentversion").":</td>\n";
echo "<td><p>$CFG->release ($CFG->version)</td>\n";
echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\">\n";
echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\">\n";
echo "</td></tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("fullsitename").":</td>\n";
echo "<td><input size=\"50\" type=\"text\" name=\"sitename\" value=\"$site->fullname\"></td>\n";
echo "<tr valign=top>\n";
echo "<td align=right><p>".get_string("fullsitename").":</td>\n";
echo "<td><p><input size=50 type=\"text\" name=\"sitename\" value=\"$site->fullname\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("country").":</td>\n";
echo "<td>";
echo "<tr valign=top>\n";
echo "<td align=right><p>".get_string("country").":</td>\n";
echo "<td><p>";
choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
echo "</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\"><a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"See the current list of sites\" target=_blank>".get_string("publicdirectory")."</a>:</td>\n";
echo "<td>";
echo "<tr valign=top>\n";
echo "<td align=right><p><a href=\"http://moodle.org/sites\" title=\"See the current list of sites\" target=_blank>".get_string("publicdirectory")."</a>:</td>\n";
echo "<td><p>";
$options[0] = get_string("publicdirectory0");
$options[1] = get_string("publicdirectory1");
$options[2] = get_string("publicdirectory2");
@@ -98,77 +95,23 @@
echo "</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("registrationcontact")."</a>:</td>\n";
echo "<td>\n";
$options[0] = get_string("registrationcontactno");
$options[1] = get_string("registrationcontactyes");
choose_from_menu ($options, "contact", "1", "", "", "");
unset($options);
echo "</td>\n";
echo "<tr valign=top>\n";
echo "<td colspan=2><hr size=1 noshade>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("statistics").":";
echo "<br />(".get_string("notpublic").')';
echo "</td>\n";
echo "<td>";
$count = count_records('course')-1;
echo get_string("courses").": ".$count;
echo "<input type=\"hidden\" name=\"courses\" value=\"$count\">\n";
echo '<br />';
$count = count_records('user')-1;
echo get_string("users").": ".$count;
echo "<input type=\"hidden\" name=\"users\" value=\"$count\">\n";
echo '<br />';
$count = count_records('user_students');
echo get_string("enrolments").": ".$count;
echo "<input type=\"hidden\" name=\"enrolments\" value=\"$count\">\n";
echo '<br />';
$count = count_records('user_teachers');
echo get_string("teachers").": ".$count;
echo "<input type=\"hidden\" name=\"teachers\" value=\"$count\">\n";
echo '<br />';
$count = count_records('forum_posts');
echo get_string("posts", 'forum').": ".$count;
echo "<input type=\"hidden\" name=\"posts\" value=\"$count\">\n";
echo '<br />';
$count = count_records('quiz_questions');
echo get_string("questions", 'quiz').": ".$count;
echo "<input type=\"hidden\" name=\"questions\" value=\"$count\">\n";
echo '<br />';
$count = count_records('resource');
echo get_string("modulenameplural", "resource").": ".$count;
echo "<input type=\"hidden\" name=\"resources\" value=\"$count\">\n";
echo '<br />';
echo "</td>\n";
echo "<tr valign=top>\n";
echo "<td align=right><p>".get_string("administrator").":</td>\n";
echo "<td><p><input size=50 type=\"text\" name=\"adminname\" value=\"".fullname($admin, true)."\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"center\" colspan=\"2\"><hr size=\"1\" noshade>".get_string("administrator")."</td>\n";
echo "<tr valign=top>\n";
echo "<td align=right><p>".get_string("email").":</td>\n";
echo "<td><p><input size=50 type=\"text\" name=\"adminemail\" value=\"$admin->email\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("administrator").":</td>\n";
echo "<td><input size=\"50\" type=\"text\" name=\"adminname\" value=\"".fullname($admin, true)."\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("email").":</td>\n";
echo "<td><input size=\"50\" type=\"text\" name=\"adminemail\" value=\"$admin->email\"></td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">".get_string("registrationemail")."</a>:</td>\n";
echo "<td>\n";
echo "<tr valign=top>\n";
echo "<td align=right><p>".get_string("registrationemail")."</a>:</td>\n";
echo "<td><p>\n";
$options[0] = get_string("registrationno");
$options[1] = get_string("registrationyes");
choose_from_menu ($options, "mailme", "1", "", "", "");
@@ -176,9 +119,9 @@
echo "</td>\n";
echo "</tr>\n";
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\">&nbsp;</td>\n";
echo "<td><input type=\"submit\" value=\"".get_string("registrationsend")."\"></td>\n";
echo "<tr valign=top>\n";
echo "<td align=right>&nbsp;</td>\n";
echo "<td><p><input type=\"submit\" value=\"".get_string("registrationsend")."\"></td>\n";
echo "</tr>\n";
-58
View File
@@ -1,58 +0,0 @@
<?php /// $Id$
/// Search and replace strings throughout all texts in the whole database
require('../config.php');
$search = optional_param('search', '');
$replace = optional_param('replace', '');
require_login();
if (!isadmin()) {
error("Admins only");
}
###################################################################
print_header('Search and replace throughout the whole database', 'Replace text within the whole database');
if (!$search or !$replace or !confirm_sesskey()) { /// Print a form
print_simple_box_start('center');
echo '<div align="center">';
echo '<form action="replace.php">';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'">';
echo 'Search whole database for: <input type="text" name="search"><br />';
echo 'Replace with this string: <input type="text" name="replace"><br /></br />';
echo '<input type="submit" value="Yes, do it now"><br />';
echo '</form>';
echo '</div>';
print_simple_box_end();
die;
}
if (!$tables = $db->Metatables() ) { // No tables yet at all.
error("no tables");
}
print_simple_box_start('center');
foreach ($tables as $table) {
if (in_array($table, array($CFG->prefix.'config'))) { // Don't process these
continue;
}
if ($columns = $db->MetaColumns($table, false)) {
foreach ($columns as $column => $data) {
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
$db->debug = true;
execute_sql("UPDATE {$CFG->prefix}$table SET $column = REPLACE($column, '$search', '$replace');");
$db->debug = false;
}
}
}
}
print_simple_box_end();
print_continue('index.php');
?>
+50 -51
View File
@@ -1,20 +1,20 @@
<form method="post" action="site.php" name="form">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td align="right"><?php print_string("fullsitename") ?>:</td>
<td><input type="text" name="fullname" size="50" maxlength="254" value="<?php p($form->fullname) ?>" alt="<?php print_string("fullsitename") ?>" />
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td align=right><P><?php print_string("fullsitename") ?>:</td>
<td><input type="text" name="fullname" size="50" maxlength="254" value="<?php p($form->fullname) ?>">
<?php if (isset($err["fullname"])) formerr($err["fullname"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("shortsitename") ?>:</td>
<td><input type="text" name="shortname" size="15" maxlength="15" value="<?php p($form->shortname) ?>" alt="<?php print_string("shortsitename") ?>" />
<tr valign=top>
<td align=right><P><?php print_string("shortsitename") ?>:</td>
<td><input type="text" name="shortname" size="15" maxlength="15" value="<?php p($form->shortname) ?>">
<?php if (isset($err["shortname"])) formerr($err["shortname"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("frontpagedescription") ?>:<br />
<font size="1">
<tr valign=top>
<td align=right><P><?php print_string("frontpagedescription") ?>:</P><br />
<font size=1>
<?PHP
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
@@ -22,20 +22,19 @@
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
helpbutton("html", get_string("helphtml"), "moodle", true, true);
}
}
?>
<br />
</font>
</td>
<td><?php print_textarea($usehtmleditor, 20, 50, 600, 400, "summary", $form->summary); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("frontpageformat") ?>:</td>
<td><?php
$options = array(FRONTPAGENEWS => get_string("frontpagenews"),
FRONTPAGECOURSELIST => get_string("frontpagecourselist"),
FRONTPAGECATEGORYNAMES => get_string("frontpagecategorynames"),
FRONTPAGETOPICONLY => get_string("frontpagetopiconly"));
<tr valign=top>
<td align=right><P><?php print_string("frontpageformat") ?>:</td>
<td><?php
$options = array("0" => get_string("frontpagenews"),
"1" => get_string("frontpagecourselist"),
"2" => get_string("frontpagecategorynames"));
if (count_records("course") > 200) {
unset($options[1]);
if ($form->frontpage == 1) {
@@ -46,19 +45,9 @@
?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("sitesection") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "numsections", $form->numsections, "");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("newsitemsnumber") ?>:</td>
<td><?php
<tr valign=top>
<td align=right><p><?php print_string("newsitemsnumber") ?>:</td>
<td><?php
$newsitem = get_string("newsitem");
$newsitems = get_string("newsitems");
$options = array("0" => "0 $newsitems",
@@ -76,41 +65,51 @@
?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("wordforteacher") ?>:</td>
<td><input type="text" name="teacher" maxlength="100" size="25" value="<?php p($form->teacher) ?>" alt="<?php print_string("wordforteacher") ?>" />
(<?php print_string("wordforteachereg") ?>)
<tr valign=top>
<td align="right"><P><?php print_string("sitesection") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "numsections", $form->numsections, "");
?>
</td>
</tr>
<tr valign=top>
<td align=right><p><?php print_string("wordforteacher") ?>:</td>
<td><input type="text" name="teacher" maxlength="100" size="25" value="<?php p($form->teacher) ?>">
(<?php print_string("wordforteachereg") ?>)
<?php if (isset($err["teacher"])) formerr($err["teacher"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("wordforteachers") ?>:</td>
<td><input type="text" name="teachers" maxlength="100" size="25" value="<?php p($form->teachers) ?>" alt="<?php print_string("wordforteachers") ?>" />
<tr valign=top>
<td align=right><p><?php print_string("wordforteachers") ?>:</td>
<td><input type="text" name="teachers" maxlength="100" size="25" value="<?php p($form->teachers) ?>">
(<?php print_string("wordforteacherseg") ?>)
<?php if (isset($err["teachers"])) formerr($err["teachers"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("wordforstudent") ?>:</td>
<td><input type="text" name="student" maxlength="100" size="25" value="<?php p($form->student) ?>" alt="<?php print_string("wordforstudent") ?>" />
(<?php print_string("wordforstudenteg") ?>)
<tr valign=top>
<td align=right><p><?php print_string("wordforstudent") ?>:</td>
<td><input type="text" name="student" maxlength="100" size="25" value="<?php p($form->student) ?>">
(<?php print_string("wordforstudenteg") ?>)
<?php if (isset($err["student"])) formerr($err["student"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("wordforstudents") ?>:</td>
<td><input type="text" name="students" maxlength="100" size="25" value="<?php p($form->students) ?>" alt="<?php print_string("wordforstudents") ?>" />
(<?php print_string("wordforstudentseg") ?>)
<tr valign=top>
<td align=right><p><?php print_string("wordforstudents") ?>:</td>
<td><input type="text" name="students" maxlength="100" size="25" value="<?php p($form->students) ?>">
(<?php print_string("wordforstudentseg") ?>)
<?php if (isset($err["students"])) formerr($err["students"]); ?>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
</tr>
</table>
<input type="hidden" name="id" value="<?php p($form->id) ?>" />
<input type="hidden" name="category" value="<?php p($form->category) ?>" />
<input type="hidden" name="format" value="<?php p($form->format) ?>" />
<input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" />
<input type="hidden" name="id" value="<?php p($form->id) ?>">
<input type="hidden" name="category" value="<?php p($form->category) ?>">
<input type="hidden" name="format" value="<?php p($form->format) ?>">
<input type="hidden" name="sesskey" value="<?php p($sesskey) ?>">
</form>
+11 -18
View File
@@ -1,7 +1,6 @@
<?php // $Id$
<?PHP // $Id$
require_once("../config.php");
require_once("../course/lib.php");
if ($site = get_site()) {
require_login();
@@ -13,7 +12,7 @@
/// If data submitted, then process and store.
if ($form = data_submitted()) {
if ($form = data_submitted()) {
if (!empty($USER->id)) { // Additional identity check
if (!confirm_sesskey()) {
@@ -26,9 +25,6 @@
if (count($err) == 0) {
set_config("frontpage", $form->frontpage);
if ($form->frontpage = FRONTPAGETOPICONLY) {
$form->numsections = 1; // Force the topic display for this format
}
$form->timemodified = time();
@@ -39,17 +35,14 @@
error("Serious Error! Could not update the site record! (id = $form->id)");
}
} else {
// We are about to create the site "course"
// [pj] We are about to create the site, so let's add some blocks...
// calendar_month is included as a Moodle feature advertisement ;-)
require_once($CFG->dirroot.'/lib/blocklib.php');
$form->blockinfo = blocks_get_default_blocks(NULL, BLOCKS_DEFAULT_SITE);
if ($newid = insert_record('course', $form)) {
// Site created, add blocks for it
$page = page_create_object(PAGE_COURSE_VIEW, $newid);
blocks_repopulate_page($page); // Return value not checked because you can always edit later
$cat->name = get_string('miscellaneous');
if (insert_record('course_categories', $cat)) {
if ($newid = insert_record("course", $form)) {
$cat->name = get_string("miscellaneous");
if (insert_record("course_categories", $cat)) {
redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1);
} else {
error("Serious Error! Could not set up a default course category!");
@@ -81,7 +74,7 @@
$form->numsections = 0;
$form->id = "";
$form->category = 0;
$form->format = 'site'; // Only for this course
$form->format = "social";
$form->teacher = get_string("defaultcourseteacher");
$form->teachers = get_string("defaultcourseteachers");
$form->student = get_string("defaultcoursestudent");
@@ -112,7 +105,7 @@
if ($firsttime) {
print_header();
print_heading($strsitesettings);
print_simple_box(get_string("configintrosite", 'admin'), "center", "50%");
print_simple_box(get_string("configintrosite"), "center", "50%");
echo "<br />";
} else {
print_header("$site->shortname: $strsitesettings", "$site->fullname",
@@ -130,7 +123,7 @@
$usehtmleditor = can_use_html_editor();
$defaultformat = FORMAT_HTML;
print_simple_box_start("center", "");
print_simple_box_start("center", "", "$THEME->cellheading");
include("site.html");
print_simple_box_end();
-139
View File
@@ -1,139 +0,0 @@
<?php // $Id$
// Automatic update of Timezones from a new source
require_once('../config.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/olson.php');
$ok = optional_param('ok');
require_login();
if (!isadmin()) {
error('Only administrators can use this page!');
}
if (!$site = get_site()) {
error('Site isn\'t defined!');
}
/// Print headings
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strcalendarsettings = get_string('calendarsettings', 'admin');
$strimporttimezones = get_string('importtimezones', 'admin');
print_header("$site->shortname: $strcalendarsettings", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"configure.php\">$strconfiguration</a> -> ".
"<a href=\"calendar.php\">$strcalendarsettings</a> -> $strimporttimezones");
print_heading($strimporttimezones);
if (!$ok or !confirm_sesskey()) {
$message = '<p>';
$message .= $CFG->dataroot.'/temp/olson.txt<br />';
$message .= $CFG->dataroot.'/temp/timezones.txt<br />';
$message .= '<a href="http://download.moodle.org/timezones/">http://download.moodle.org/timezones/</a><br />';
$message .= '<a href="'.$CFG->wwwroot.'/lib/timezones.txt">'.$CFG->dirroot.'/lib/timezones.txt</a><br />';
$message .= '</p>';
$message = get_string("configintrotimezones", 'admin', $message);
notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'calendar.php');
print_footer();
exit;
}
/// Try to find a source of timezones to import from
$importdone = false;
/// First, look for an Olson file locally
$source = $CFG->dataroot.'/temp/olson.txt';
if (!$importdone and is_readable($source)) {
if ($timezones = olson_to_timezones($source)) {
update_timezone_records($timezones);
$importdone = $source;
}
}
/// Next, look for a CSV file locally
$source = $CFG->dataroot.'/temp/timezones.txt';
if (!$importdone and is_readable($source)) {
if ($timezones = get_records_csv($source, 'timezone')) {
update_timezone_records($timezones);
$importdone = $source;
}
}
/// Otherwise, let's try moodle.org's copy
$source = 'http://download.moodle.org/timezones/';
if (!$importdone and ini_get('allow_url_fopen')) {
if (is_readable($source) && $contents = file_get_contents($source)) { // Grab whole page
if ($file = fopen($CFG->dataroot.'/temp/timezones.txt', 'w')) { // Make local copy
fwrite($file, $contents);
fclose($file);
if ($timezones = get_records_csv($CFG->dataroot.'/temp/timezones.txt', 'timezone')) { // Parse it
update_timezone_records($timezones);
$importdone = $source;
}
unlink($CFG->dataroot.'/temp/timezones.txt');
}
}
}
/// Final resort, use the copy included in Moodle
$source = $CFG->dirroot.'/lib/timezones.txt';
if (!$importdone and is_readable($source)) { // Distribution file
if ($timezones = get_records_csv($source, 'timezone')) {
update_timezone_records($timezones);
$importdone = $source;
}
}
/// That's it!
if ($importdone) {
$a = null;
$a->count = count($timezones);
$a->source = $importdone;
print_heading(get_string('importtimezonescount', 'admin', $a), '', 3);
print_continue('calendar.php');
$timezonelist = array();
foreach ($timezones as $timezone) {
if (isset($timezonelist[$timezone->name])) {
$timezonelist[$timezone->name]++;
} else {
$timezonelist[$timezone->name] = 1;
}
}
ksort($timezonelist);
echo "<br />";
print_simple_box_start('center');
foreach ($timezonelist as $name => $count) {
echo "$name ($count)<br />";
}
print_simple_box_end();
} else {
print_heading(get_string('importtimezonesfailed', 'admin'), '', 3);
print_continue('calendar.php');
}
print_footer();
?>
+7 -12
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
/// Bulk user registration script from a comma separated file
/// Returns list of users with their user ids
@@ -56,11 +56,7 @@
/// If a file has been uploaded, then process it
require_once($CFG->dirroot.'/lib/uploadlib.php');
$um = new upload_manager('userfile',false,false,null,false,0);
if ($um->preprocess_files()) {
$filename = $um->files['userfile']['tmp_name'];
if ($filename = valid_uploaded_file($_FILES['userfile'])) {
//Fix mac/dos newlines
$text = my_file_get_contents($filename);
@@ -81,8 +77,7 @@
"department" => 1,
"city" => 1,
"country" => 1,
"lang" => 1,
"auth" => 1,
"lang" => 1,
"timezone" => 1);
$optional = array("idnumber" => 1,
"icq" => 1,
@@ -148,8 +143,7 @@
// check for required values
if ($required[$name] and !$value) {
error(get_string('missingfield', 'error', $name). " ".
get_string('erroronline', 'error', $linenum) .". ".
get_string('processingstops', 'error'),
get_string('erroronline', 'error', $linenum),
'uploaduser.php?sesskey='.$USER->sesskey);
}
// password needs to be encrypted
@@ -164,6 +158,7 @@
$user->{$name} = addslashes($value);
}
}
$user->auth = 'manual';
$user->confirmed = 1;
$user->timemodified = time();
$linenum++;
@@ -189,7 +184,7 @@
}
}
}
if (get_record("user","username",$username) || !($user->id = insert_record("user", $user))) {
if (! $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
@@ -271,7 +266,7 @@
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="file" name="userfile" size=30>'.
'<input type="submit" value="'.$struploadusers.'">'.
'</form></br>';
echo '</center>';
+40 -39
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
require_once("../config.php");
@@ -62,14 +62,13 @@
$USER = $user;
$USER->loggedin = true;
$USER->sessionIP = md5(getremoteaddr()); // Store the current IP in the session
$USER->sesskey = random_string(10); // for added security, used to check script parameters
$USER->site = $CFG->wwwroot;
$USER->admin = true;
$USER->teacher["$site->id"] = true;
$USER->newadminuser = true;
sesskey(); // for added security, used to check script parameters
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&amp;course=$site->id");
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id");
exit;
} else {
@@ -101,8 +100,8 @@
}
}
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&amp;course=$site->id");
redirect("$CFG->wwwroot/user/edit.php?id=$user->id&course=$site->id");
} else { // List all users for editing
$stredituser = get_string("edituser");
@@ -115,12 +114,12 @@
$strshowallusers = get_string("showallusers");
if ($firstinitial or $lastinitial or $search or $page) {
print_header("$site->shortname: $stredituser", $site->fullname,
print_header("$site->shortname: $stredituser", $site->fullname,
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"users.php\">$strusers</a> -> ".
"<a href=\"user.php\">$stredituser</a>");
} else {
print_header("$site->shortname: $stredituser", $site->fullname,
print_header("$site->shortname: $stredituser", $site->fullname,
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"users.php\">$strusers</a> -> $stredituser");
}
@@ -154,7 +153,7 @@
if ($confirm != md5($delete)) {
$fullname = fullname($user, true);
notice_yesno(get_string("deletecheckfull", "", "'$fullname'"),
"user.php?delete=$delete&amp;confirm=".md5($delete)."&amp;sesskey=$USER->sesskey", "user.php");
"user.php?delete=$delete&confirm=".md5($delete)."&sesskey=$USER->sesskey", "user.php");
exit;
} else if (!$user->deleted) {
@@ -195,10 +194,10 @@
} else {
$columnicon = $dir == "ASC" ? "down":"up";
}
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" />";
}
$$column = "<a href=\"user.php?sort=$column&amp;dir=$columndir&amp;search=$search&amp;firstinitial=$firstinitial&amp;lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
$$column = "<a href=\"user.php?sort=$column&dir=$columndir&search=$search&firstinitial=$firstinitial&lastinitial=$lastinitial\">".$string[$column]."</a>$columnicon";
}
if ($sort == "name") {
@@ -225,8 +224,8 @@
echo "<center><p align=\"center\">";
echo get_string("firstname")." : ";
if ($firstinitial) {
echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&".
"perpage=$perpage&amp;lastinitial=$lastinitial\">$strall</a> ";
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
"perpage=$perpage&lastinitial=$lastinitial\">$strall</a> ";
} else {
echo " <b>$strall</b> ";
}
@@ -234,8 +233,8 @@
if ($letter == $firstinitial) {
echo " <b>$letter</b> ";
} else {
echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&".
"perpage=$perpage&amp;lastinitial=$lastinitial&amp;firstinitial=$letter\">$letter</a> ";
echo " <a href=\"user.php?sort=firstname&dir=ASC&".
"perpage=$perpage&lastinitial=$lastinitial&firstinitial=$letter\">$letter</a> ";
}
}
echo "<br />";
@@ -244,8 +243,8 @@
echo get_string("lastname")." : ";
if ($lastinitial) {
echo " <a href=\"user.php?sort=lastname&amp;dir=ASC&".
"perpage=$perpage&amp;firstinitial=$firstinitial\">$strall</a> ";
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
"perpage=$perpage&firstinitial=$firstinitial\">$strall</a> ";
} else {
echo " <b>$strall</b> ";
}
@@ -253,15 +252,15 @@
if ($letter == $lastinitial) {
echo " <b>$letter</b> ";
} else {
echo " <a href=\"user.php?sort=lastname&amp;dir=ASC&".
"perpage=$perpage&amp;firstinitial=$firstinitial&amp;lastinitial=$letter\">$letter</a> ";
echo " <a href=\"user.php?sort=lastname&dir=ASC&".
"perpage=$perpage&firstinitial=$firstinitial&lastinitial=$letter\">$letter</a> ";
}
}
echo "</p>";
echo "</center>";
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;");
"user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&");
flush();
@@ -280,8 +279,6 @@
$matchstring = implode(", ", $match);
print_heading(get_string("nousersmatching", "", $matchstring));
$table = NULL;
} else {
$countries = get_list_of_countries();
@@ -322,37 +319,41 @@
$confirmbutton = "";
}
$fullname = fullname($user, true);
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&amp;course=$site->id\">$fullname</a>",
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
"$user->email",
"$user->city",
"$user->country",
$strlastaccess,
"<a href=\"../user/edit.php?id=$user->id&amp;course=$site->id\">$stredit</a>",
"<a href=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</a>",
$deletebutton,
$confirmbutton);
}
}
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\">";
if ($search) {
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&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
echo "<table align=center cellpadding=10><tr><td>";
echo "<form action=user.php method=post>";
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 "</form>";
echo "</td></tr></table>";
if (is_internal_auth()){
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;");
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&");
}
if (is_internal_auth()){
print_heading("<a href=\"user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
}
print_footer();
}
+5 -5
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
require_once("../config.php");
@@ -28,7 +28,7 @@
$table->data[] = array("<b><a href=\"user.php\">".get_string("edituser")."</a></b>",
get_string("adminhelpedituser"));
if (is_internal_auth()) {
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&amp;sesskey=$USER->sesskey\">".get_string("addnewuser")."</a></b>",
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&sesskey=$USER->sesskey\">".get_string("addnewuser")."</a></b>",
get_string("adminhelpaddnewuser"));
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".get_string("uploadusers")."</a></b>",
get_string("adminhelpuploadusers"));
@@ -36,10 +36,10 @@
$table->data[] = array('', '<hr />');
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolments")."</a></b>",
get_string("adminhelpenrolments"));
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&amp;sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
get_string("adminhelpassignstudents"));
$table->data[] = array("<b><a href=\"../course/index.php?edit=on&amp;sesskey=$USER->sesskey\">".get_string("assignteachers")."</a></b>",
get_string("adminhelpassignteachers")." <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" />");
$table->data[] = array("<b><a href=\"../course/index.php?edit=on&sesskey=$USER->sesskey\">".get_string("assignteachers")."</a></b>",
get_string("adminhelpassignteachers")." <img src=\"../pix/t/user.gif\" height=11 width=11>");
$table->data[] = array("<b><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a></b>",
get_string("adminhelpassigncreators"));
$table->data[] = array("<b><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a></b>",
-106
View File
@@ -82,109 +82,3 @@ db - Uses an external database to check username/password
- if correct, user is logged in
- if the username doesn't already exist then
a new Moodle account is created
------------------------------------------------------------------------------------
Authentication API
This file describes Moodle interface functions to authentication modules.
Most of functions are from ldap-authentication module and are not implemented (yet?)
on other modules. Please feel free to extend other modules to support same features
or roll your own module.
Some of new function are still tested and are not documented here yet.
AUTHENTICATION
Basic fuctions to authenticate users with external db
Mandatory:
auth_user_login ($username, $password)
Authenticate username, password with userdatabase.
Returns:
true if the username and password work
and false if they don't
Optional:
auth_get_userinfo($username)
Query other userinformation from database.
Returns:
Userinformation in array ( name => value, ....
or false in case of error
COURSE CREATING
auth_iscreator($username)
should user have rights to create courses
Returns:
True if user have rights to crete cources otherwise false
USER CREATION
Functions that enable usercreation, activation and deactivation
from moodle to external database
auth_user_exists ($username)
Checks if given username exist on external db
Returns:
true if given usernname exist or false
auth_user_create ($userobject,$plainpass)
Creates new user to external db. User should be created
in inactive stage until confirmed by email.
Returns:
True on success otherwise false
auth_user_activate ($username)
activate new user after email-address is confirmed
Returns:
True on success otherwise false
auth_user_disable ($username) {
deactivate user in external db.
Returns:
True on success otherwise false
USER INFORMATION AND SYNCRONIZATION
auth_get_userlist ()
Get list of usernames in external db.
Returns:
All usernames in array or false on error.
auth_get_users($filter='*')
Get ALL USEROBJECTS FROM EXTERNAL DB.
Returns:
Array of all users as objects from external db
-7
View File
@@ -1,7 +0,0 @@
CAS-module README
Please read comments from lib.php for auth/cas module
The auth/cas module is using part of the /auth/ldap module. The /auth/ldap directory should exist.
The auth/cas use the PHPCAS project from http://esup-phpcas.sourceforge.net
-40
View File
@@ -1,40 +0,0 @@
<?php
/** auth_ldap_sync_users.php
* Modified for cas Module
*
* 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/ldap/auth_ldap_sync_users.php
*
* Notes:
* - If you have a large number of users, you may want to raise the memory limits
* by passing -d momory_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:
* We have optimized it as best as we could for Postgres and mySQL, with 27K students
* we have seen this take 10 minutes.
*
*/
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/cas/lib.php'); //cas specific
require_once($CFG->dirroot.'/mod/forum/lib.php');
$CFG->debug=10;
auth_sync_users(1000, true );
?>
-104
View File
@@ -1,104 +0,0 @@
<?php
require_once('languages.php');
// Initialize vars
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");
?>
<tr>
<td colspan="2">
<h4><?php print_string("auth_cas_server_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_enabled:</td>
<td>
<?php
unset($options);
$options[1] = get_string("yes");
choose_from_menu ($options, "cas_enabled", $config->cas_enabled, get_string("no"),"","");?>
</td><td>
<?php print_string("auth_cas_enabled","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_hostname:</td>
<td>
<input name="cas_hostname" type="text" size="30" value="<?php echo $config->cas_hostname?>" />
<?php if (isset($err["cas_hostname"])) formerr($err["cas_hostname"]); ?>
</td>
<td>
<?php print_string("auth_cas_hostname","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_baseuri:</td>
<td>
<input name="cas_baseuri" type="text" size="30" value="<?php echo $config->cas_baseuri?>" />
<?php if (isset($err["cas_baseuri"])) formerr($err["cas_baseuri"]); ?>
</td>
<td>
<?php print_string("auth_cas_baseuri","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_port:</td>
<td>
<input name="cas_port" type="text" size="30" value="<?php echo $config->cas_port?>" />
<?php if (isset($err["cas_port"])) formerr($err["cas_port"]); ?>
</td>
<td>
<?php print_string("auth_cas_port","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_version:</td>
<td>
<input name="cas_version" type="text" size="30" value="<?php echo $config->cas_version?>" />
<?php if (isset($err["cas_version"])) formerr($err["cas_version"]); ?>
</td>
<td>
<?php print_string("auth_cas_version","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_language:</td>
<td>
<?php choose_from_menu ($caslanguages, "cas_language", $config->cas_language, "");?>
</td>
<td>
<?php print_string("auth_cas_language","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">cas_create_user:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "cas_create_user", $config->cas_create_user, "");?>
</td><td>
<?php print_string("auth_cas_create_user","auth") ?>
</td>
</tr>
<?php
include($CFG->dirroot.'/auth/ldap/config.html');
?>
-8
View File
@@ -1,8 +0,0 @@
<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center" style="font-size: small">
<tr>
<td width="50%" class="required" class="headingblock">
<p align="center"><b><font size="3"><?php formerr($errormsg) ?></font></b></p>
</td>
</tr>
</table>
-12
View File
@@ -1,12 +0,0 @@
<?php
// version $Id$
// Page for forbidden access from CAS
require_once("../../config.php");
$errormsg = get_string("auth_cas_invalidcaslogin", "auth");
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite,
$focus, "", true, "<div align=right>$langmenu</div>");
include("forbidden.html");
print_footer();
exit;
?>
-1
View File
@@ -1 +0,0 @@
<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center">
-10
View File
@@ -1,10 +0,0 @@
<?PHP
// version $Id$
// List of CAS langages.
// You can add langages in /CAS/langage.
// Please send them to http://esup-phpcas.sourceforge.net
$CASLANGUAGES = array (
"greek" => "Modern Greek",
"english" => "English",
"french" => "French");
?>
-169
View File
@@ -1,169 +0,0 @@
<?PHP
// $Id: lib.php
// author: romuald Lorthioir
//CHANGELOG:
//16/03/2005 Use of LDAP Module
//05.02.2005 Added CAS module
/* README!
CAS Module
This Module can be turn ON/OFF on admin screen.
The /login/index.php module is intercepted and replace with the login.php.
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.
*/
define('AUTH_LDAP_NAME', 'cas'); // for ldap module
require_once($CFG->dirroot.'/config.php');
require_once($CFG->dirroot.'/auth/ldap/lib.php');
require_once($CFG->dirroot.'/lib/cas/CAS.php');
$cas_validate=false;
/**
* replace the ldap auth_user_login function
* authenticates user againt CAS with ldap
* Returns true if the username and password work
* and false if they don't
*
* @param string $username
* @param string $password
*
*/
function cas_ldap_auth_user_login ($username, $password) {
/// Returns true if the username and password work
/// and false if they don't
global $CFG;
if (!$username or !$password) { // Don't allow blank usernames or passwords
return false;
}
if ($CFG->auth == "cas" && !empty($CFG->cas_enabled)){ //cas specific
if ($CFG->cas_create_user=="0"){
if (get_user_info_from_db("username", $username)){
return true;
}else{
return false;
}
}else{
return true;
}
}
$ldap_connection = auth_ldap_connect();
if ($ldap_connection) {
$ldap_user_dn = auth_ldap_find_userdn($ldap_connection, $username);
//if ldap_user_dn is empty, user does not exist
if(!$ldap_user_dn){
ldap_close($ldap_connection);
return false;
}
// Try to bind with current username and password
$ldap_login = ldap_bind($ldap_connection, $ldap_user_dn, $password);
ldap_close($ldap_connection);
if ($ldap_login) {
if ($CFG->cas_create_user=="0"){ //cas specific
if (get_user_info_from_db("username", $username)){
return true;
}else{
return false;
}
}else{
return true;
}
}
} else {
ldap_close($ldap_connection);
error("LDAP part of CAS-module cannot connect to server: $CFG->ldap_host_url");
}
return false;
}
/**
* authenticates user against CAS from screen login
* the user doesn't have a CAS Ticket yet.
*
* Returns an object user if the username and password work
* and nothing if they don't
*
* @param string $username
* @param string $password
*
*/
function cas_authenticate_user_login ($username, $password) {
global $CFG;
$cas_validate=true;
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
phpCAS::setLang($CFG->cas_language);
if (!phpCAS::isAuthenticated()){
phpCAS::authenticateIfNeeded();
}
if ($CFG->cas_create_user=="0"){
if (get_user_info_from_db("username", phpCAS::getUser())){
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
}else{
//login as guest if CAS but not Moodle and not automatic creation
if ($CFG->guestloginbutton){
$user = authenticate_user_login('guest', 'guest');
}else{
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
}
}
}else{
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
}
return $user;
}
/**
* authenticates user against CAS when first call of Moodle
* if already in CAS (cookie with the CAS ticket), don't have to log again (SSO)
*
* Returns an object user if the username and password work
* and nothing if they don't
*
* @param object $user
*
*/
function cas_automatic_authenticate ($user="") {
global $CFG;
if (!$cas_validate){
$cas_validate=true;
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(Integer)$CFG->cas_port,$CFG->cas_baseuri);
phpCAS::setLang($CFG->cas_language);
if (!phpCAS::isAuthenticated() && !$CFG->guestloginbutton){
phpCAS::authenticateIfNeeded();
}
if (phpCAS::isAuthenticated()){
if ($CFG->cas_create_user=="0"){
if (get_user_info_from_db("username", phpCAS::getUser())){
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
}else{
//login as guest if CAS but not Moodle and not automatic creation
if ($CFG->guestloginbutton){
$user = authenticate_user_login('guest', 'guest');
}else{
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
}
}
}else{
$user = authenticate_user_login(phpCAS::getUser(), 'cas');
}
return $user;
}else{
return;
}
}else{
return $user;
}
}
?>
-321
View File
@@ -1,321 +0,0 @@
<?php
// $Id: login.php
// author: romualdLorthioir $
//CHANGELOG:
//05.03.2005 replace /login/index.php
require_once($CFG->dirroot.'/auth/cas/lib.php');
//Define variables used in page
if (!$site = get_site()) {
error("No site found!");
}
if (empty($CFG->langmenu)) {
$langmenu = "";
} else {
$currlang = current_language();
$langs = get_list_of_languages();
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
}
$langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
$loginsite = get_string("loginsite");
$frm = false;
$user = false;
if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,'username=guest')) or $loginguest) {
/// Log in as guest automatically (idea from Zbigniew Fiedorowicz)
$frm->username = 'guest';
$frm->password = 'guest';
} else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot.'/login/weblinkauth.php')) {
// Handles the case of another Moodle site linking into a page on this site
include($CFG->dirroot.'/login/weblinkauth.php');
if (function_exists(weblink_auth)) {
$user = weblink_auth($SESSION->wantsurl);
}
if ($user) {
$frm->username = $user->username;
} else {
$frm = data_submitted();
}
} else {
$frm = data_submitted();
}
if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
$errormsg = get_string("cookiesnotenabled");
} else if ($frm) { // Login WITH cookies
$frm->username = trim(moodle_strtolower($frm->username));
if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) {
$user = false; /// Can't log in as guest if guest button is disabled
$frm = false;
} else if (!$user) {
if ($CFG->auth == "cas" && $frm->username != 'guest'){ /// Cas SSO case
$user = cas_authenticate_user_login($frm->username, $frm->password);
}else{
$user = authenticate_user_login($frm->username, $frm->password);
}
}
update_login_count();
if ($user) {
if (! $user->confirmed ) { // they never confirmed via email
print_header(get_string("mustconfirm"), get_string("mustconfirm") );
print_heading(get_string("mustconfirm"));
print_simple_box(get_string("emailconfirmsent", "", $user->email), "center");
print_footer();
die;
}
$USER = $user;
if (!empty($USER->description)) {
$USER->description = true; // No need to cart all of it around
}
$USER->loggedin = true;
$USER->site = $CFG->wwwroot; // for added security, store the site in the session
sesskey(); // for added security, used to check script parameters
if ($USER->username == "guest") {
$USER->lang = $CFG->lang; // Guest language always same as site
$USER->firstname = get_string("guestuser"); // Name always in current language
$USER->lastname = " ";
}
if (!update_user_login_times()) {
error("Wierd error: could not update login records");
}
set_moodle_cookie($USER->username);
unset($SESSION->lang);
$SESSION->justloggedin = true;
// Restore the calendar filters, if saved
if(intval(get_user_preferences('calendar_persistflt', 0))) {
include_once($CFG->dirroot.'/calendar/lib.php');
calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff));
}
//Select password change url
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
} elseif($CFG->changepassword) {
$passwordchangeurl=$CFG->changepassword;
}
// check whether the user should be changing password
if (get_user_preferences('auth_forcepasswordchange', false)){
if (isset($passwordchangeurl)) {
redirect($passwordchangeurl);
} else {
error("You cannot proceed without changing your password.
However there is no available page for changing it.
Please contact your Moodle Administrator.");
}
}
add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
if (user_not_fully_set_up($USER)) {
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.SITEID;
// We don't delete $SESSION->wantsurl yet, so we get there later
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
unset($SESSION->wantsurl);
} else {
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
unset($SESSION->wantsurl); /// Just in case
}
// check if user password has expired
// Currently supported only for ldap-authentication module
if (isset($CFG->ldap_expiration) && $CFG->ldap_expiration == 1 ) {
if (function_exists('auth_password_expire')){
$days2expire = auth_password_expire($USER->username);
if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
print_footer();
exit;
} elseif (intval($days2expire) < 0 ) {
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
print_footer();
exit;
}
}
}
reset_login_count();
redirect($urltogo);
exit;
} else {
if ($CFG->auth == "cas" ){ /// CAS error login
$errormsg = get_string("invalidcaslogin");
phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php");
}else{
$errormsg = get_string("invalidlogin");
}
}
}
$user=cas_automatic_authenticate($user);
if ($user) {
if (! $user->confirmed ) { // they never confirmed via email
print_header(get_string("mustconfirm"), get_string("mustconfirm") );
print_heading(get_string("mustconfirm"));
print_simple_box(get_string("emailconfirmsent", "", $user->email), "center");
print_footer();
die;
}
$USER = $user;
if (!empty($USER->description)) {
$USER->description = true; // No need to cart all of it around
}
$USER->loggedin = true;
$USER->site = $CFG->wwwroot; // for added security, store the site in the session
sesskey(); // for added security, used to check script parameters
if ($USER->username == "guest") {
$USER->lang = $CFG->lang; // Guest language always same as site
$USER->firstname = get_string("guestuser"); // Name always in current language
$USER->lastname = " ";
}
if (!update_user_login_times()) {
error("Wierd error: could not update login records");
}
set_moodle_cookie($USER->username);
unset($SESSION->lang);
$SESSION->justloggedin = true;
// Restore the calendar filters, if saved
if(intval(get_user_preferences('calendar_persistflt', 0))) {
include_once($CFG->dirroot.'/calendar/lib.php');
calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff));
}
//Select password change url
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
} elseif($CFG->changepassword) {
$passwordchangeurl=$CFG->changepassword;
}
// check whether the user should be changing password
if (get_user_preferences('auth_forcepasswordchange', false)){
if (isset($passwordchangeurl)) {
redirect($passwordchangeurl);
} else {
error("You cannot proceed without changing your password.
However there is no available page for changing it.
Please contact your Moodle Administrator.");
}
}
add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
if (user_not_fully_set_up($USER)) {
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.SITEID;
// We don't delete $SESSION->wantsurl yet, so we get there later
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
unset($SESSION->wantsurl);
} else {
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
unset($SESSION->wantsurl); /// Just in case
}
// check if user password has expired
// Currently supported only for ldap-authentication module
if (isset($CFG->ldap_expiration) && $CFG->ldap_expiration == 1 ) {
if (function_exists('auth_password_expire')){
$days2expire = auth_password_expire($USER->username);
if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
print_footer();
exit;
} elseif (intval($days2expire) < 0 ) {
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
print_footer();
exit;
}
}
}
reset_login_count();
redirect($urltogo);
exit;
} else {
if(!$CFG->guestloginbutton){
$errormsg = get_string("invalidcaslogin");
phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php");
}
}
if (empty($errormsg)) {
$errormsg = "";
}
if (empty($SESSION->wantsurl)) {
$SESSION->wantsurl = array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER["HTTP_REFERER"] : $CFG->wwwroot;
}
if (get_moodle_cookie() == '') {
set_moodle_cookie('nobody'); // To help search for cookies
}
if (empty($frm->username)) {
$frm->username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
$frm->password = "";
}
if (!empty($frm->username)) {
$focus = "login.password";
} else {
$focus = "login.username";
}
if ($CFG->auth == "email" or $CFG->auth == "none" or chop($CFG->auth_instructions) <> "" ) {
$show_instructions = true;
} else {
$show_instructions = false;
}
print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
include($CFG->dirroot.'/auth/cas/index_form.html');
print_footer();
exit;
// No footer on this page
?>
-10
View File
@@ -1,10 +0,0 @@
<?php
// logout the user from CAS server (destroy the ticket)
global $CFG;
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);
?>
+154 -155
View File
@@ -1,4 +1,4 @@
<?php
<?PHP
if (!isset($config->auth_dbhost)) {
$config->auth_dbhost = "localhost";
}
@@ -27,20 +27,20 @@
$config->auth_dbpasstype = "plaintext";
}
?>
<tr valign="top" class="required">
<td align="right">auth_dbhost:</td>
<td>
<input name="auth_dbhost" type="text" size="30" value="<?php echo $config->auth_dbhost?>" />
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbhost:</TD>
<TD>
<INPUT name=auth_dbhost TYPE=text SIZE=30 VALUE="<?php echo $config->auth_dbhost?>">
<?php if (isset($err["auth_dbhost"])) formerr($err["auth_dbhost"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbhost","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbtype:</td>
<td>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbtype:</TD>
<TD>
<?php $dbtypes = array("access","ado_access", "ado", "ado_mssql", "borland_ibase", "csv", "db2", "fbsql", "firebird", "ibase", "informix72", "informix", "mssql", "mysql", "mysqlt", "oci805", "oci8", "oci8po", "odbc", "odbc_mssql", "odbc_oracle", "oracle", "postgres64", "postgres7", "postgres", "proxy", "sqlanywhere", "sybase", "vfp");
foreach ($dbtypes as $dbtype) {
$dboptions[$dbtype] = $dbtype;
@@ -48,189 +48,188 @@
choose_from_menu($dboptions, "auth_dbtype", $config->auth_dbtype, "");
?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbtype","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbname:</td>
<td>
<input name="auth_dbname" type="text" size="30" value="<?php echo $config->auth_dbname?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbname:</TD>
<TD>
<INPUT name=auth_dbname TYPE=text SIZE=30 VALUE="<?php echo $config->auth_dbname?>">
<?php if (isset($err["auth_dbname"]))formerr($err["auth_dbname"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbname","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbuser:</td>
<td>
<input name="auth_dbuser" type="text" size="30" value="<?php echo $config->auth_dbuser?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbuser:</TD>
<TD>
<INPUT name=auth_dbuser TYPE=text SIZE=30 VALUE="<?php echo $config->auth_dbuser?>">
<?php if (isset($err["auth_dbuser"])) formerr($err["auth_dbuser"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbuser","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbpass:</td>
<td>
<input name="auth_dbpass" type="text" size="30" value="<?php echo $config->auth_dbpass?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbpass:</TD>
<TD>
<INPUT name="auth_dbpass" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_dbpass?>">
<?php if (isset($err["auth_dbpass"])) formerr($err["auth_dbpass"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbpass","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbtable:</td>
<td>
<input name="auth_dbtable" type="text" size="30" value="<?php echo $config->auth_dbtable?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbtable:</TD>
<TD>
<INPUT name="auth_dbtable" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_dbtable?>">
<?php if (isset($err["auth_dbtable"])) formerr($err["auth_dbtable"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbtable","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbfielduser:</td>
<td>
<input name="auth_dbfielduser" type="text" size="30" value="<?php echo $config->auth_dbfielduser?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbfielduser:</TD>
<TD>
<INPUT name="auth_dbfielduser" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_dbfielduser?>">
<?php if (isset($err["auth_dbfielduser"])) formerr($err["auth_dbfielduser"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbfielduser","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbfieldpass:</td>
<td>
<input name="auth_dbfieldpass" type="text" size="30" value="<?php echo $config->auth_dbfieldpass?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbfieldpass:</TD>
<TD>
<INPUT name="auth_dbfieldpass" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_dbfieldpass?>">
<?php if (isset($err["auth_dbfieldpass"])) formerr($err["auth_dbfieldpass"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbfieldpass","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_dbpasstype:</td>
<td>
<?php
$passtype["plaintext"] = get_string("plaintext", "auth");
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_dbpasstype:</TD>
<TD>
<?php $passtype["plaintext"] = get_string("plaintext", "auth");
$passtype["md5"] = get_string("md5", "auth");
choose_from_menu($passtype, "auth_dbpasstype", $config->auth_dbpasstype, "");
?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_dbpasstype","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr>
<td align="right"><?php print_string("firstname") ?>:</td>
<td>
<input name="auth_user_firstname" type="text" size="30" value="<?php echo $config->auth_user_firstname?>" />
</td>
<td rowspan="12" valign="middle">
<TR>
<TD ALIGN=RIGHT><P><?php print_string("firstname") ?>:</TD>
<TD>
<INPUT name="auth_user_firstname" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_firstname?>">
</TD>
<TD rowspan=12 VALIGN=CENTER>
<?php print_string("auth_dbextrafields","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("lastname") ?>:</td>
<td>
<input name="auth_user_lastname" type="text" size="30" value="<?php echo $config->auth_user_lastname?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("lastname") ?>:</TD>
<TD>
<INPUT name="auth_user_lastname" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_lastname?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("email") ?>:</td>
<td>
<input name="auth_user_email" type="text" size="30" value="<?php echo $config->auth_user_email?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("email") ?>:</TD>
<TD>
<INPUT name="auth_user_email" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_email?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("phone") ?> 1:</td>
<td>
<input name="auth_user_phone1" type="text" size="30" value="<?php echo $config->auth_user_phone1?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("phone") ?> 1:</TD>
<TD>
<INPUT name="auth_user_phone1" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_phone1?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("phone") ?> 2:</td>
<td>
<input name="auth_user_phone2" type="text" size="30" value="<?php echo $config->auth_user_phone2?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("phone") ?> 2:</TD>
<TD>
<INPUT name="auth_user_phone2" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_phone2?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("department") ?>:</td>
<td>
<input name="auth_user_department" type="text" size="30" value="<?php echo $config->auth_user_department?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("department") ?>:</TD>
<TD>
<INPUT name="auth_user_department" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_department?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("address") ?>:</td>
<td>
<input name="auth_user_address" type="text" size="30" value="<?php echo $config->auth_user_address?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("address") ?>:</TD>
<TD>
<INPUT name="auth_user_address" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_address?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("city") ?>:</td>
<td>
<input name="auth_user_city" type="text" size="30" value="<?php echo $config->auth_user_city?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("city") ?>:</TD>
<TD>
<INPUT name="auth_user_city" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_city?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("country") ?>:</td>
<td>
<input name="auth_user_country" type="text" size="30" value="<?php echo $config->auth_user_country?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("country") ?>:</TD>
<TD>
<INPUT name="auth_user_country" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_country?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("description") ?>:</td>
<td>
<input name="auth_user_description" type="text" size="30" value="<?php echo $config->auth_user_description?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("description") ?>:</TD>
<TD>
<INPUT name="auth_user_description" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_description?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("idnumber") ?>:</td>
<td>
<input name="auth_user_idnumber" type="text" size="30" value="<?php echo $config->auth_user_idnumber?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("idnumber") ?>:</TD>
<TD>
<INPUT name="auth_user_idnumber" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_idnumber?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("language") ?>:</td>
<td>
<input name="auth_user_lang" type="text" size="30" value="<?php echo $config->auth_user_lang?>" />
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("language") ?>:</TD>
<TD>
<INPUT name="auth_user_lang" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_lang?>">
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<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>
</TD>
</TR>
+4 -5
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// Authentication by looking up an external database table
@@ -12,10 +12,9 @@ function auth_user_login ($username, $password) {
// two databases of the same kind ... it seems to get confused when trying to access
// the first database again, after having accessed the second.
// The following hack will make the database explicit which keeps it happy
// This seems to broke postgesql so ..
if ($CFG->dbtype != 'postgres7') {
$CFG->prefix = "$CFG->dbname.$CFG->prefix";
}
$CFG->prefix = "$CFG->dbname.$CFG->prefix";
}
// Connect to the external database
$authdb = &ADONewConnection($CFG->auth_dbtype);
@@ -68,7 +67,7 @@ function auth_get_userinfo($username){
if ($rs = $authdb->Execute("SELECT ".$config["auth_user_$field"]." FROM $CFG->auth_dbtable
WHERE $CFG->auth_dbfielduser = '$username'")) {
if ( $rs->RecordCount() == 1 ) {
$result["$field"] = $rs->fields[0];
$result["$field"] = $rs->fields[$config["auth_user_$field"]];
}
}
}
-1
View File
@@ -1,2 +1 @@
<!-- No config needed -->
<div align="center"><?php print_string('none'); ?></div>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// Standard authentication function
function auth_user_login ($username, $password) {
+84 -168
View File
@@ -1,168 +1,84 @@
<?php
if (!isset($config->auth_fchost)) {
$config->auth_fchost = "127.0.0.1";
}
if (!isset($config->auth_fcfppport)) {
$config->auth_fcfppport = "3333";
}
if (!isset($config->auth_fcuserid)) {
$config->auth_fcuserid = "fcMoodle";
}
if (!isset($config->auth_fcpasswd)) {
$config->auth_fcpasswd = "";
}
if (!isset($config->auth_fccreators)) {
$config->auth_fccreators = "";
}
?>
<tr valign="top" class="required">
<td align="right">auth_fchost:</td>
<td>
<input name="auth_fchost" type="text" size="30" value="<?php echo $config->auth_fchost?>" />
<?php if (isset($err["auth_fchost"])) formerr($err["auth_fchost"]); ?>
</td>
<td>
<?php print_string("auth_fchost","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">auth_fcfppport:</td>
<td>
<input name="auth_fcfppport" type="text" size="30" value="<?php echo $config->auth_fcfppport?>" />
<?php if (isset($err["auth_fcfppport"])) formerr($err["auth_fchost"]); ?>
</td>
<td>
<?php print_string("auth_fcfppport","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">auth_fcuserid:</td>
<td>
<input name="auth_fcuserid" type="text" size="30" maxlength="15" value="<?php echo $config->auth_fcuserid?>" />
<?php if (isset($err["auth_fcuserid"])) formerr($err["auth_fcuserid"]); ?>
</td>
<td>
<?php print_string("auth_fcuserid","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">auth_fcpasswd:</td>
<td>
<input name="auth_fcpasswd" type="password" size="30" maxlength="12" value="<?php echo $config->auth_fcpasswd?>" />
<?php if (isset($err["auth_fcpasswd"])) formerr($err["auth_fcpasswd"]); ?>
</td>
<td>
<?php print_string("auth_fcpasswd","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">auth_fccreators:</td>
<td>
<input name="auth_fccreators" type="text" size="30" value="<?php echo $config->auth_fccreators?>" />
<?php if (isset($err["auth_fccreators"])) formerr($err["auth_fccreators"]); ?>
</td>
<td>
<?php print_string("auth_fccreators","auth") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<?php print_string("authinstructions","auth") ?>
<?php helpbutton("text", get_string("helptext")) ?>
</td>
</tr>
<?PHP
if (!isset($config->auth_fchost)) {
$config->auth_fchost = "127.0.0.1";
}
if (!isset($config->auth_fcfppport)) {
$config->auth_fcfppport = "3333";
}
if (!isset($config->auth_fcuserid)) {
$config->auth_fcuserid = "fcMoodle";
}
if (!isset($config->auth_fcpasswd)) {
$config->auth_fcpasswd = "";
}
if (!isset($config->auth_fccreators)) {
$config->auth_fccreators = "";
}
?>
<TR valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_fchost:</TD>
<TD>
<INPUT name=auth_fchost TYPE=text SIZE=30 VALUE="<?php echo $config->auth_fchost?>">
<?php if (isset($err["auth_fchost"])) formerr($err["auth_fchost"]); ?>
</TD>
<TD>
<?php print_string("auth_fchost","auth") ?>
</TD>
</TR>
<TR valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_fcfppport:</TD>
<TD>
<INPUT name=auth_fcfppport TYPE=text SIZE=30 VALUE="<?php echo $config->auth_fcfppport?>">
<?php if (isset($err["auth_fcfppport"])) formerr($err["auth_fchost"]); ?>
</TD>
<TD>
<?php print_string("auth_fcfppport","auth") ?>
</TD>
</TR>
<TR valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_fcuserid:</TD>
<TD>
<INPUT name=auth_fcuserid TYPE=text SIZE=30 MAXLENGTH=15 VALUE="<?php echo $config->auth_fcuserid?>">
<?php if (isset($err["auth_fcuserid"])) formerr($err["auth_fcuserid"]); ?>
</TD>
<TD>
<?php print_string("auth_fcuserid","auth") ?>
</TD>
</TR>
<TR valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_fcpasswd:</TD>
<TD>
<INPUT name=auth_fcpasswd TYPE=password SIZE=30 MAXLENGTH=12 VALUE="<?php echo $config->auth_fcpasswd?>">
<?php if (isset($err["auth_fcpasswd"])) formerr($err["auth_fcpasswd"]); ?>
</TD>
<TD>
<?php print_string("auth_fcpasswd","auth") ?>
</TD>
</TR>
<TR valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_fccreators:</TD>
<TD>
<INPUT name=auth_fccreators TYPE=text SIZE=30 VALUE="<?php echo $config->auth_fccreators?>">
<?php if (isset($err["auth_fccreators"])) formerr($err["auth_fccreators"]); ?>
</TD>
<TD>
<?php print_string("auth_fccreators","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>
+32 -32
View File
@@ -1,4 +1,4 @@
<?php
<?PHP
if (!isset($config->auth_imaphost)) {
$config->auth_imaphost = "127.0.0.1";
}
@@ -9,51 +9,51 @@
$config->auth_imapport = "143";
}
?>
<tr valign="top" class="required">
<td align="right">auth_imaphost:</td>
<td>
<input name="auth_imaphost" type="text" size="30" value="<?php echo $config->auth_imaphost?>" />
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_imaphost:</TD>
<TD>
<INPUT name=auth_imaphost TYPE=text SIZE=30 VALUE="<?php echo $config->auth_imaphost?>">
<?php if (isset($err["auth_imaphost"])) formerr($err["auth_imaphost"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_imaphost","auth") ?>
<?php print_string("auth_multiplehosts","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_imaptype:</td>
<td>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_imaptype:</TD>
<TD>
<?php $imaptypes = array("imap","imapssl", "imapcert", "imaptls");
foreach($imaptypes as $imaptype) {
$imapoptions[$imaptype] = $imaptype;
}
choose_from_menu($imapoptions, "auth_imaptype", $config->auth_imaptype, "");
?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_imaptype","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_imapport:</td>
<td>
<input name="auth_imapport" type="text" size="6" value="<?php echo $config->auth_imapport?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_imapport:</TD>
<TD>
<INPUT name=auth_imapport TYPE=text SIZE=6 VALUE="<?php echo $config->auth_imapport?>">
<?php if (isset($err["auth_imapport"])) formerr($err["auth_imapport"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_imapport","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<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>
</TD>
</TR>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// Authentication by looking up an IMAP server
function auth_user_login ($username, $password) {
-39
View File
@@ -1,39 +0,0 @@
<?php
/** auth_ldap_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/ldap/auth_ldap_sync_users.php
*
* Notes:
* - If you have a large number of users, you may want to raise the memory limits
* by passing -d momory_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:
* We have optimized it as best as we could for Postgres and mySQL, with 27K students
* we have seen this take 10 minutes.
*
*/
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/ldap/lib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
$CFG->debug=10;
auth_sync_users(1000, true );
?>
+219 -705
View File
@@ -1,754 +1,268 @@
<?PHP
// Initialize vars
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_forcepasswordchange, "");
optional_variable($config->auth_user_firstname_updatelocal, "1");
optional_variable($config->auth_user_firstname_editlock, "1");
optional_variable($config->auth_user_firstname_updateremote, "");
optional_variable($config->auth_user_lastname_updatelocal, "1");
optional_variable($config->auth_user_lastname_editlock, "1");
optional_variable($config->auth_user_lastname_updateremote, "");
optional_variable($config->auth_user_email_updatelocal, "1");
optional_variable($config->auth_user_email_editlock, "1");
optional_variable($config->auth_user_email_updateremote, "");
optional_variable($config->auth_user_phone1_updatelocal, "");
optional_variable($config->auth_user_phone1_editlock, "");
optional_variable($config->auth_user_phone1_updateremote, "");
optional_variable($config->auth_user_phone2_updatelocal, "");
optional_variable($config->auth_user_phone2_editlock, "");
optional_variable($config->auth_user_phone2_updateremote, "");
optional_variable($config->auth_user_department_updatelocal, "");
optional_variable($config->auth_user_department_editlock, "");
optional_variable($config->auth_user_department_updateremote, "");
optional_variable($config->auth_user_address_updatelocal, "");
optional_variable($config->auth_user_address_editlock, "");
optional_variable($config->auth_user_address_updateremote, "");
optional_variable($config->auth_user_city_updatelocal, "");
optional_variable($config->auth_user_city_editlock, "");
optional_variable($config->auth_user_city_updateremote, "");
optional_variable($config->auth_user_country_updatelocal, "");
optional_variable($config->auth_user_country_editlock, "");
optional_variable($config->auth_user_country_updateremote, "");
optional_variable($config->auth_user_description_updatelocal, "");
optional_variable($config->auth_user_description_editlock, "");
optional_variable($config->auth_user_description_updateremote, "");
optional_variable($config->auth_user_lang_updatelocal, "");
optional_variable($config->auth_user_lang_editlock, "");
optional_variable($config->auth_user_lang_updateremote, "");
optional_variable($config->auth_user_idnumber_updatelocal, "");
optional_variable($config->auth_user_idnumber_editlock, "");
optional_variable($config->auth_user_idnumber_updateremote, "");
if (!isset($config->ldap_host_url)) {
$config->ldap_host_url = "";
}
if (!isset($config->ldap_contexts)) {
$config->ldap_contexts = "";
}
if (!isset($config->ldap_user_attribute)) {
$config->ldap_user_attribute = "";
}
if (!isset($config->ldap_search_sub)) {
$config->ldap_search_sub = "";
}
if (!isset($config->ldap_bind_dn)) {
$config->ldap_bind_dn = "";
}
if (!isset($config->ldap_bind_pw)) {
$config->ldap_bind_pw = "";
}
if (empty($config->ldap_version)) {
$config->ldap_version = "2";
}
if (empty($config->ldap_memberattribute)) {
$config->ldap_memberattribute = "";
}
if (empty($config->ldap_creators)) {
$config->ldap_creators = "";
}
if (empty($config->ldap_create_context)) {
$config->ldap_create_context = "";
}
if (empty($config->ldap_objectclass)) {
$config->ldap_objectclass = "";
}
if (empty($config->auth_user_guid)) {
$config->auth_user_guid = "";
}
optional_variable($config->auth_ldap_stdchangepassword, false);
if (!function_exists('ldap_connect')){ // Is php4-ldap really there?
print '<p align="center"><font color="red"><strong>Warning:
The PHP LDAP module does not seem to be present.
Please ensure it is installed and enabled.</strong></font></p>';
}
?>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_server_settings", "auth") ?> </h4>
</td>
</tr>
<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?>">
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_host_url:</TD>
<TD>
<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>
</TD>
<TD>
<?php print_string("auth_ldap_host_url","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">ldap_version:</td>
<td>
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_version:</TD>
<TD>
<?php
$versions[2] = "2";
$versions[3] = "3";
choose_from_menu($versions, "ldap_version", $config->ldap_version, "");
if (isset($err["ldap_version"])) formerr($err["ldap_version"]);
?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_ldap_version","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_bind_settings", "auth") ?> </h4>
</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?>">
<?php if (isset($err["ldap_bind_dn"])) formerr($err["ldap_bind_dn"]); ?>
</td><td>
<?php print_string("auth_ldap_bind_dn","auth") ?>
</td>
</tr>
<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?>">
<?php if (isset($err["ldap_bind_pw"])) formerr($err["ldap_bind_pw"]); ?>
</td><td>
<?php print_string("auth_ldap_bind_pw","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_user_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_user_type:</td>
<td>
<?php choose_from_menu(auth_ldap_suppported_usertypes(), "ldap_user_type", $config->ldap_user_type, ""); ?>
<?php if (isset($err["ldap_user_type"])) formerr($err["ldap_user_type"]); ?>
</td>
<td>
<?php print_string("auth_ldap_user_type","auth") ?>
</td>
</tr>
<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?>">
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_contexts:</TD>
<TD>
<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>
</TD>
<TD>
<?php print_string("auth_ldap_contexts","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">ldap_search_sub:</td>
<td>
<input name="ldap_search_sub" type="text" size="1" value="<?php echo $config->ldap_search_sub?>">
<?php if (isset($err["ldap_search_sub"])) formerr($err["ldap_search_sub"]); ?>
</td>
<td>
<?php print_string("auth_ldap_search_sub","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_opt_deref:</td>
<td>
<?php
$opt_deref[LDAP_DEREF_NEVER] = get_string("no");
$opt_deref[LDAP_DEREF_ALWAYS] = get_string("yes");
choose_from_menu($opt_deref, "ldap_opt_deref", $config->ldap_opt_deref, LDAP_DEREF_NEVER);
if (isset($err["ldap_opt_deref"])) formerr($err["ldap_opt_deref"]);
?>
</td>
<td>
<?php print_string("auth_ldap_opt_deref","auth") ?>
</td>
</tr>
<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?>">
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_user_attribute:</TD>
<TD>
<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>
</TD>
<TD>
<?php print_string("auth_ldap_user_attribute","auth") ?>
</td>
</tr>
</TD>
</TR>
<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?>">
<?php if (isset($err["ldap_memberattribute"])) formerr($err["ldap_memberattribute"]); ?>
</td><td>
<?php print_string("auth_ldap_memberattribute","auth") ?>
</td>
</tr>
<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?>">
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_objectclass:</TD>
<TD>
<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>
</TD>
<TD>
<?php print_string("auth_ldap_objectclass","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr>
<td colspan="2">
<h4><?php print_string("forcechangepassword", "auth") ?> </h4>
</td>
</tr>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_search_sub:</TD>
<TD>
<INPUT name=ldap_search_sub TYPE=text SIZE=1 VALUE="<?php echo $config->ldap_search_sub?>">
<?php if (isset($err["ldap_search_sub"])) formerr($err["ldap_search_sub"]); ?>
</TD>
<TD>
<?php print_string("auth_ldap_search_sub","auth") ?>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string('forcechangepassword', 'auth') ?>:</td>
<td>
<select name="auth_ldap_forcechangepassword">
<option value="0" <?php echo ($config->auth_ldap_forcechangepassword ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_ldap_forcechangepassword ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</td>
<td align="left" valign="top">
<p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
</td>
</tr>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_bind_dn:</TD>
<TD>
<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") ?>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right" valign="top"><?php print_string('stdchangepassword', 'auth') ?>:</td>
<td>
<select name="auth_ldap_stdchangepassword">
<option value="0" <?php echo ($config->auth_ldap_stdchangepassword ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_ldap_stdchangepassword ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_bind_pw:</TD>
<TD>
<INPUT name=ldap_bind_pw TYPE=text 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") ?>
</TD>
</TR>
</td>
<td align="left" valign="top">
<p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
<p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
</td>
</tr>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_memberattribute:</TD>
<TD>
<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") ?>
</TD>
</TR>
<tr>
<td colspan="2">
<h4><?php print_string("auth_ldap_passwdexpire_settings", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_expiration:</td>
<td>
<?php
$expiration['0'] = "No";
$expiration['1'] = "LDAP";
choose_from_menu($expiration, "ldap_expiration", $config->ldap_expiration, "");
if (isset($err["ldap_expiration"])) formerr($err["ldap_expiration"]);
?>
</td>
<td>
<?php print_string("auth_ldap_expiration_desc","auth") ?>
</td>
</tr>
<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?>">
<?php if (isset($err["ldap_expiration_warning"])) formerr($err["ldap_expiration_warning"]);
?>
</td>
<td>
<?php print_string("auth_ldap_expiration_warning_desc","auth") ?>
</td>
</tr>
<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?>">
<?php if (isset($err["ldap_expireattr"])) formerr($err["ldap_expireattr"]);
?>
</td>
<td>
<?php print_string("auth_ldap_expireattr_desc","auth") ?>
</td>
</tr>
<tr valign="top" class="required">
<td align="right">ldap_gracelogins:</td>
<td>
<?php
$grace['0'] = get_string("no");
$grace['1'] = get_string("yes");
choose_from_menu($grace, "ldap_gracelogins", $config->ldap_gracelogins, "");
if (isset($err["ldap_expiration"])) formerr($err["ldap_expiration"]);
?>
</td>
<td>
<?php print_string("auth_ldap_gracelogins_desc","auth") ?>
</td>
</tr>
<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?>">
<?php if (isset($err["ldap_graceattr"])) formerr($err["ldap_graceattr"]);
?>
</td>
<td>
<?php print_string("auth_ldap_graceattr_desc","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("auth_user_create", "auth") ?> </h4>
</td>
</tr>
</tr>
<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?>">
<?php if (isset($err["ldap_create_context"])) formerr($err["ldap_create_context"]); ?>
</td><td>
<?php print_string("auth_ldap_create_context","auth") ?>
</td>
</tr>
<tr>
<td colspan="2">
<h4><?php print_string("coursecreators") ?> </h4>
</td>
</tr>
<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?>">
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_creators:</TD>
<TD>
<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>
</TD><TD>
<?php print_string("auth_ldap_creators","auth") ?>
</td>
</tr>
</TD>
</TR>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_create_context:</TD>
<TD>
<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") ?>
</TD>
</TR>
<tr>
<td colspan="2">
<h4><?php print_string("auth_data_mapping", "auth") ?> </h4>
</td>
</tr>
<tr valign="top" class="required">
<td align="right"><?php print_string("firstname") ?>:</td>
<td>
<input name="auth_user_firstname" type="text" size="30" value="<?php echo $config->auth_user_firstname?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_firstname_updatelocal">
<option value="0" <?php echo ($config->auth_user_firstname_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_firstname_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_firstname_editlock">
<option value="0" <?php echo ($config->auth_user_firstname_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_firstname_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_firstname_updateremote">
<option value="0" <?php echo ($config->auth_user_firstname_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_firstname_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
<td rowspan=12 valign="top">
<TR>
<TD ALIGN=RIGHT><P><?php print_string("firstname") ?>:</TD>
<TD>
<INPUT name="auth_user_firstname" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_firstname?>">
</TD>
<TD rowspan=12 VALIGN=CENTER>
<?php print_string("auth_ldapextrafields","auth") ?>
<?php print_string("auth_updatelocal_expl","auth") ?>
<?php print_string("auth_editlock_expl","auth") ?>
<?php print_string("auth_updateremote_expl","auth") ?>
<hr>
<?php print_string("auth_updateremote_ldap","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("lastname") ?>:</td>
<td>
<input name="auth_user_lastname" type="text" size="30" value="<?php echo $config->auth_user_lastname?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_lastname_updatelocal">
<option value="0" <?php echo ($config->auth_user_lastname_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lastname_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock","auth") ?>
<select name="auth_user_lastname_editlock">
<option value="0" <?php echo ($config->auth_user_lastname_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lastname_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_lastname_updateremote">
<option value="0" <?php echo ($config->auth_user_lastname_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lastname_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("lastname") ?>:</TD>
<TD>
<INPUT name="auth_user_lastname" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_lastname?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("email") ?>:</td>
<td>
<input name="auth_user_email" type="text" size="30" value="<?php echo $config->auth_user_email?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_email_updatelocal">
<option value="0" <?php echo ($config->auth_user_email_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_email_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_email_editlock">
<option value="0" <?php echo ($config->auth_user_email_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_email_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_email_updateremote">
<option value="0" <?php echo ($config->auth_user_email_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_email_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("email") ?>:</TD>
<TD>
<INPUT name="auth_user_email" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_email?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("phone") ?> 1:</td>
<td>
<input name="auth_user_phone1" type="text" size="30" value="<?php echo $config->auth_user_phone1?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_phone1_updatelocal">
<option value="0" <?php echo ($config->auth_user_phone1_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone1_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_phone1_editlock">
<option value="0" <?php echo ($config->auth_user_phone1_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone1_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_phone1_updateremote">
<option value="0" <?php echo ($config->auth_user_phone1_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone1_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("phone") ?> 1:</TD>
<TD>
<INPUT name="auth_user_phone1" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_phone1?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("phone") ?> 2:</td>
<td>
<input name="auth_user_phone2" type="text" size="30" value="<?php echo $config->auth_user_phone2?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_phone2_updatelocal">
<option value="0" <?php echo ($config->auth_user_phone2_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone2_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_phone2_editlock">
<option value="0" <?php echo ($config->auth_user_phone2_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone2_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_phone2_updateremote">
<option value="0" <?php echo ($config->auth_user_phone2_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_phone2_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("phone") ?> 2:</TD>
<TD>
<INPUT name="auth_user_phone2" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_phone2?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("department") ?>:</td>
<td>
<input name="auth_user_department" type="text" size="30" value="<?php echo $config->auth_user_department?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_department_updatelocal">
<option value="0" <?php echo ($config->auth_user_department_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_department_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_department_editlock">
<option value="0" <?php echo ($config->auth_user_department_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_department_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_department_updateremote">
<option value="0" <?php echo ($config->auth_user_department_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_department_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("department") ?>:</TD>
<TD>
<INPUT name="auth_user_department" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_department?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("address") ?>:</td>
<td>
<input name="auth_user_address" type="text" size="30" value="<?php echo $config->auth_user_address?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_address_updatelocal">
<option value="0" <?php echo ($config->auth_user_address_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_address_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_address_editlock">
<option value="0" <?php echo ($config->auth_user_address_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_address_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_address_updateremote">
<option value="0" <?php echo ($config->auth_user_address_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_address_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("address") ?>:</TD>
<TD>
<INPUT name="auth_user_address" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_address?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("city") ?>:</td>
<td>
<input name="auth_user_city" type="text" size="30" value="<?php echo $config->auth_user_city?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_city_updatelocal">
<option value="0" <?php echo ($config->auth_user_city_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_city_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_city_editlock">
<option value="0" <?php echo ($config->auth_user_city_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_city_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_city_updateremote">
<option value="0" <?php echo ($config->auth_user_city_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_city_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("city") ?>:</TD>
<TD>
<INPUT name="auth_user_city" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_city?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("country") ?>:</td>
<td>
<input name="auth_user_country" type="text" size="30" value="<?php echo $config->auth_user_country?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_country_updatelocal">
<option value="0" <?php echo ($config->auth_user_country_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_country_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_country_editlock">
<option value="0" <?php echo ($config->auth_user_country_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_country_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_country_updateremote">
<option value="0" <?php echo ($config->auth_user_country_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_country_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("country") ?>:</TD>
<TD>
<INPUT name="auth_user_country" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_country?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("description") ?>:</td>
<td>
<input name="auth_user_description" type="text" size="30" value="<?php echo $config->auth_user_description?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_description_updatelocal">
<option value="0" <?php echo ($config->auth_user_description_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_description_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_description_editlock">
<option value="0" <?php echo ($config->auth_user_description_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_description_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_description_updateremote">
<option value="0" <?php echo ($config->auth_user_description_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_description_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("description") ?>:</TD>
<TD>
<INPUT name="auth_user_description" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_description?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("idnumber") ?>:</td>
<td>
<input name="auth_user_idnumber" type="text" size="30" value="<?php echo $config->auth_user_idnumber?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_idnumber_updatelocal">
<option value="0" <?php echo ($config->auth_user_idnumber_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_idnumber_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_idnumber_editlock">
<option value="0" <?php echo ($config->auth_user_idnumber_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_idnumber_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_idnumber_updateremote">
<option value="0" <?php echo ($config->auth_user_idnumber_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_idnumber_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("idnumber") ?>:</TD>
<TD>
<INPUT name="auth_user_idnumber" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_idnumber?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("language") ?>:</td>
<td>
<input name="auth_user_lang" type="text" size="30" value="<?php echo $config->auth_user_lang?>">
<div align="right">
<?php print_string("auth_updatelocal", "auth") ?>
<select name="auth_user_lang_updatelocal">
<option value="0" <?php echo ($config->auth_user_lang_updatelocal ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lang_updatelocal ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_editlock", "auth") ?>
<select name="auth_user_lang_editlock">
<option value="0" <?php echo ($config->auth_user_lang_editlock ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lang_editlock ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
<?php print_string("auth_updateremote", "auth") ?>
<select name="auth_user_lang_updateremote">
<option value="0" <?php echo ($config->auth_user_lang_updateremote ? '' : 'selected="yes"') ?> >
<?php print_string("no") ?></option>
<option value="1" <?php echo ($config->auth_user_lang_updateremote ? 'selected="yes"' : '') ?> >
<?php print_string("yes") ?></option>
</select><br>
</div>
</td>
</tr>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("language") ?>:</TD>
<TD>
<INPUT name="auth_user_lang" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_lang?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("guid") ?>:</TD>
<TD>
<INPUT name="auth_user_guid" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_guid?>">
</TD>
</TR>
<tr valign="top" class="required">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<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>
</TD>
</TR>
+261 -1132
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -1,11 +1,11 @@
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<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>
</TD>
</TR>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// manual method - Just does a simple check against the database
function auth_user_login ($username, $password) {
+25 -25
View File
@@ -1,4 +1,4 @@
<?php
<?PHP
if (!isset($config->auth_nntphost)) {
$config->auth_nntphost = "127.0.0.1";
}
@@ -7,36 +7,36 @@
}
?>
<tr valign="top" class="required">
<td align="right">auth_nntphost:</td>
<td>
<input name="auth_nntphost" type="text" size="30" value="<?php echo $config->auth_nntphost?>" />
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_nntphost:</TD>
<TD>
<INPUT name="auth_nntphost" TYPE="text" SIZE=30 VALUE="<?php echo $config->auth_nntphost?>">
<?php if (isset($err["auth_nntphost"])) formerr($err["auth_nntphost"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_nntphost","auth") ?>
<?php print_string("auth_multiplehosts","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_nntpport:</td>
<td>
<input name="auth_nntpport" type="text" size="6" value="<?php echo $config->auth_nntpport?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_nntpport:</TD>
<TD>
<INPUT name=auth_nntpport TYPE=text SIZE=6 VALUE="<?php echo $config->auth_nntpport?>">
<?php if (isset($err["auth_nntpport"])) formerr($err["auth_nntpport"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_nntpport","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<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>
</TD>
</TR>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// Authentication by looking up an NNTP server
-1
View File
@@ -1,2 +1 @@
<!-- No config needed -->
<div align="center"><?php print_string('none'); ?></div>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// No authentication at all. This method approves everything!
function auth_user_login ($username, $password) {
+40 -40
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
if (!isset($config->auth_pop3host)) {
$config->auth_pop3host = "127.0.0.1";
}
@@ -12,62 +12,62 @@
$config->auth_pop3mailbox = "INBOX";
}
?>
<tr valign="top" class="required">
<td align="right">auth_pop3host:</td>
<td>
<input name="auth_pop3host" type="text" size="30" value="<?php echo $config->auth_pop3host?>" />
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_pop3host:</TD>
<TD>
<INPUT name=auth_pop3host TYPE=text SIZE=30 VALUE="<?php echo $config->auth_pop3host?>">
<?php if (isset($err["auth_pop3host"])) formerr($err["auth_pop3host"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_pop3host","auth") ?>
<?php print_string("auth_multiplehosts","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_pop3type:</td>
<td>
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_pop3type:</TD>
<TD>
<?php $pop3types = array("pop3","pop3cert", "pop3notls");
foreach($pop3types as $pop3type) {
$pop3options[$pop3type] = $pop3type;
}
choose_from_menu($pop3options, "auth_pop3type", $config->auth_pop3type, "");
?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_pop3type","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_pop3port:</td>
<td>
<input name="auth_pop3port" type="text" size="6" value="<?php echo $config->auth_pop3port?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_pop3port:</TD>
<TD>
<INPUT name=auth_pop3port TYPE=text SIZE=6 VALUE="<?php echo $config->auth_pop3port?>">
<?php if (isset($err["auth_pop3port"])) formerr($err["auth_pop3port"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_pop3port","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top" class="required">
<td align="right">auth_pop3mailbox:</td>
<td>
<input name="auth_pop3mailbox" type="text" size="6" value="<?php echo $config->auth_pop3mailbox?>" />
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>auth_pop3mailbox:</TD>
<TD>
<INPUT name=auth_pop3mailbox TYPE=text SIZE=6 VALUE="<?php echo $config->auth_pop3mailbox?>">
<?php if (isset($err["auth_pop3mailbox"])) formerr($err["auth_pop3mailbox"]); ?>
</td>
<td>
</TD>
<TD>
<?php print_string("auth_pop3mailbox","auth") ?>
</td>
</tr>
</TD>
</TR>
<tr valign="top">
<td align="right"><?php print_string("instructions", "auth") ?>:</td>
<td>
<textarea name="auth_instructions" cols="30" rows="10" wrap="virtual"><?php p($config->auth_instructions) ?></textarea>
</td>
<td>
<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>
</TD>
</TR>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// Authentication by looking up a POP3 server
function auth_user_login ($username, $password) {
-76
View File
@@ -1,76 +0,0 @@
Shibboleth authentication for Moodle
-------------------------------------------------------------------------------
Requirements
- Shibboleth target 1.1 or later
SHIBBOLET Target configuration
-------------------------------------------------------------------------------
#### 1. Only shibboleth users are allowed use this Moodle
Just add shibboleth protection against Moodle directory.
#### 2. Shibboleth and manually added users are able to use Moodle
You need to use lazy sessions for Moodle directory. Lazy session can be
turned on by adding lines below to your .htaccess file in Moodle directory:
## Shibboleth lazy session
AuthType shibboleth
ShibRequireSession Off
require shibboleth
Lazy session allows users to access Moodle directory without having to
authenticate against shibboleth. When user authenticates against Shibboleth
the attributes which shibboleth provide get accessible ($_SERVER). These
attributes are used by Moodle to determine users identity.
For envoking shibboleth session:
1. make a directory for example moodle-proxy (in place where it's accessible
from web)
2. create index.php and add lines below (redirect to your moodle):
<?
header("Location:https://my.domain.com/moodle/login/index.php");
exit;
?>
3. Add .htaccess file in this directory which contains:
## Shibboleth authentication required
AuthType shibboleth
ShibRequireSession On
require valid-user
NEW! Modifications to login/index.php
-------------------------------------------------------------------------------
Moodle checks if user theres a shibboleth authenticated session alive. If
username attribute is found, user is considered authenticated.
Add code after line 31:
if ($_SERVER[$CFG->shib_user_attribute]) {
/// Log in automatically if user is has been shibboleth authenticated
$frm->username = $_SERVER[$CFG->shib_user_attribute];
$frm->password = "guest";
} else {
$frm = data_submitted();
}
MOODLE Authentication options
-------------------------------------------------------------------------------
Shibboleth origin url:
This is were you put the Shibboleth WAYF url address or the Shibboleth Origin
login url if WAYF is not used. If user selects shibboleth authentication
method he/she is redirected there to authenticate.
Username, First name, Surname, Email address:
The fields in authentication options are filled with the names of the
shibboleth attributes that your server provides for example:
$_SERVER['HTTP_SHIB_PNAME'] is the defined attribute in shibboleth target
configuration for username use HTTP_SHIB_PNAME in Username field at
authentication options
-127
View File
@@ -1,127 +0,0 @@
<?PHP
?>
<tr valign="top">
<TD ALIGN=RIGHT><P>Shibboleth origin url:</TD>
<TD>
<INPUT name=shib_wayf_url TYPE=text SIZE=30 VALUE="<?php echo $config->shib_wayf_url?>">
<?php if (isset($err["shib_wayf_url"])) formerr($err["shib_wayf_url"]); ?>
</TD>
<TD>
</TD>
</TR>
<!--
<TR>
<TD ALIGN=RIGHT><P>Shibboleth logout url ():</TD>
<TD>
<INPUT name="shib_logout_url" TYPE="text" SIZE="30" VALUE="<?php echo $config->shib_logout_url?>">
</TD>
<TD rowspan=12 VALIGN=CENTER> </TD>
</TR>-->
<TR>
<TD ALIGN=RIGHT><P><?php print_string("username") ?>:</TD>
<TD>
<INPUT name="shib_user_attribute" TYPE="text" SIZE="30" VALUE="<?php echo $config->shib_user_attribute?>">
</TD>
<TD rowspan=12 VALIGN=CENTER>
</TD>
</TR>
<TR>
<TD ALIGN=RIGHT><P><?php print_string("firstname") ?>:</TD>
<TD>
<INPUT name="auth_user_firstname" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_firstname?>">
</TD>
<TD rowspan=12 VALIGN=CENTER>
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("lastname") ?>:</TD>
<TD>
<INPUT name="auth_user_lastname" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_lastname?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("email") ?>:</TD>
<TD>
<INPUT name="auth_user_email" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_email?>">
</TD>
</TR>
<!--
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("phone") ?> 1:</TD>
<TD>
<INPUT name="auth_user_phone1" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_phone1?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("phone") ?> 2:</TD>
<TD>
<INPUT name="auth_user_phone2" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_phone2?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("department") ?>:</TD>
<TD>
<INPUT name="auth_user_department" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_department?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("address") ?>:</TD>
<TD>
<INPUT name="auth_user_address" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_address?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("city") ?>:</TD>
<TD>
<INPUT name="auth_user_city" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_city?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("country") ?>:</TD>
<TD>
<INPUT name="auth_user_country" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_country?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("description") ?>:</TD>
<TD>
<INPUT name="auth_user_description" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_description?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("idnumber") ?>:</TD>
<TD>
<INPUT name="auth_user_idnumber" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_idnumber?>">
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P><?php print_string("language") ?>:</TD>
<TD>
<INPUT name="auth_user_lang" TYPE="text" SIZE="30" VALUE="<?php echo $config->auth_user_lang?>">
</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>
-60
View File
@@ -1,60 +0,0 @@
<?PHP // $Id$
//CHANGELOG:
//28.10.2004 SHIBBOLETH Authentication functions v.0.1
//Distributed under GPL (c)Markus Hagman 2004-
function auth_user_login ($username, $password) {
global $CFG;
if($_SERVER[$CFG->shib_user_attribute] == $username) {
return true;
}
// Returns false if the username doesn't exist yet
// Returns true if the username and password work
if ($user = get_user_info_from_db("username", $username)) {
if($user->auth == "shibboleth") {
return false;
exit;
} else {
return ($user->password == md5($password));
exit;
}
}
return false;
}
function auth_get_userinfo($username) {
// reads user information from shibboleth attributes and return it in array()
global $CFG;
$config = (array)$CFG;
$attrmap = auth_shib_attributes();
$result = array();
$search_attribs = array();
foreach ($attrmap as $key=>$value) {
$result[$key]=$_SERVER[$value];
}
return $result;
}
function auth_shib_attributes (){
//returns array containg attribute mappings between Moodle and shibboleth
global $CFG;
$config = (array)$CFG;
$fields = array("firstname", "lastname", "email", "phone1", "phone2",
"department", "address", "city", "country", "description",
"idnumber", "lang", "guid");
$moodleattributes = array();
foreach ($fields as $field) {
if ($config["auth_user_$field"]) {
$moodleattributes[$field] = $config["auth_user_$field"];
}
}
$moodleattributes['username']=$config["shib_user_attribute"];
return $moodleattributes;
}
?>
-66
View File
@@ -1,66 +0,0 @@
CHANGES_14_15 $Id$
----------
This document shows changes between 1.4 and 1.5 and their current
status in backup/restore code.
========== ========== ========== ========== ========== ==========
Now I show the specific detailed status of every item in the process:
1. DONE: check user->idnumber
2. DONE: check user->lang (at restore set mi_nt where ma_nt).
3. DONE: check course->lang (at restore set mi_nt where ma_nt).
4. DONE: user_students->enrol (analyse and proceed).
5. DONE: user_teachers->enrol (analyse and proceed).
6. DONE: user->policyagreed (analyse and proceed).
7. DONE: groups->password
8. DONE: assignment->emailteachers
9. DONE: exercise->usepassword and exercise->password
10. DONE: exercise_assessments->generalcomment and teachercomment
11. DONE: glossary->allowprintview
12. DONE: quiz_responses->answer (analyse).
13. DONE: quiz_calculated->correctaswerformat.
14. DONE: quiz->questionsperpage.
15. DONE: quiz_categories->parent and sortorder.
16. DONE: Message subsystem (MIM). Available in SITE backups!
17. DONE: Detect questions without categories and create a category for them
(in backup process). See bug 2380. fix_orphaned_questions() function.
18. DONE: If the course hasn't users and the importer is a teacher, make him
teacher in the restored course. See bug 2381.
19. DONE: Move blocks code to libraries and use it in a standard way. Now new
blocks are supported by scheduled backup.
20. PROG: Review the lesson module completely! Check the upgrade process to
mimic it. Pending to decide if the grade field must go to the score
one when restoring old files!! (sent to Michael, Mark and Martin).
21. DONE: Review the workshop module completely! Check the upgrade process to
mimic it.
22. PROG: Review the wiki module fully. Now the wiki backup & restore seems to
be working fine. About binary contents loaded directly to DB, I
haven't found HOW TO LOAD them. I've opened Bug 2634 to see if
somebody can tell me how to reproduce it!
23. DONE: Add support for metacourses in backup and restore. Show a new option
to decide what to do (ignore, process).
24. DONE: Take out THEME from backup directory.
25. DONE: Add support for forum_read table in backup and restore.
26. DONE: chat_users->course and chat_users->lang. No changes required!
27. PROG: Make the backup/restore/config/logs/index.php XHTML 1.0 Transitional.
Done in manual backups, config, logs and restore.
28. DONE: Add course->theme, groups->them and user->theme. If no present,
default blank.
29. DONE: Add support for block instances in modules. Bug 2517. By Jon.
30. DELAY:Add support for user->dstpreset. After talking with Jon, delayed
because there isn't possible to recode it to destination server. But
sometime we should think in a solution (STAMPS or CHECKSUMS of DSTs).
31. DONE: Change mail's priority (bug 2647) if something goes wrong in scheduled backups.
32. DONE: quiz_questions->hidden and quiz_responses->originalquestion
33. DONE: quiz_question_version
34. DONE: Group images aren't included at all in backup/restore. Bug 2674.
35. DONE: New glossary log action: "view_entry".
36. PROG: Add support for quiz log action: "editquestions". Bug 2778 pending!
37. DONE: Convert module ids in every Wiki reference to other activities.
38. DONE: Convert every wiki formatted text to markdown. Bye, wikies! ;-)
39. TODO: Add backup/restore of new grade tables.
Eloy (stronk7)
23-01-2004
+8 -20
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This script is used to configure and execute the backup proccess.
//Define some globals for all the script
@@ -9,7 +9,6 @@
require_once ("$CFG->libdir/blocklib.php");
optional_variable($id); // course id
optional_variable($to); // id of course to import into afterwards.
optional_variable($cancel);
optional_variable($launch);
@@ -17,13 +16,7 @@
if (!empty($id)) {
if (!isteacheredit($id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -41,31 +34,26 @@
//Check backup_version
if ($id) {
$linkto = "backup.php?id=".$id.((!empty($to)) ? '&to='.$to : '');
$linkto = "backup.php?id=".$id;
} else {
$linkto = "backup.php";
}
upgrade_backup_db($linkto);
//Get strings
if (empty($to)) {
$strcoursebackup = get_string("coursebackup");
}
else {
$strcoursebackup = get_string('importdata');
}
$strcoursebackup = get_string("coursebackup");
$stradministration = get_string("administration");
//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");
"<A HREF=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</A> -> $strcoursebackup");
if ($courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname')) {
print_heading(get_string("choosecourse"));
print_simple_box_start("center");
print_simple_box_start("CENTER");
foreach ($courses as $course) {
echo "<a href=\"backup.php?id=$course->id\">$course->fullname ($course->shortname)</a><br />";
echo "<A HREF=\"backup.php?id=$course->id\">$course->fullname ($course->shortname)</A><BR>";
}
print_simple_box_end();
} else {
@@ -96,7 +84,7 @@
//Print form
print_heading("$strcoursebackup: $course->fullname ($course->shortname)");
print_simple_box_start("center");
print_simple_box_start("center", "", "$THEME->cellheading");
//Adjust some php variables to the execution of this script
@ini_set("max_execution_time","3000");
+70 -98
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This page prints the backup todo list to see everything
//Check login
@@ -6,13 +6,7 @@
if (!empty($course->id)) {
if (!isteacheredit($course->id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -58,10 +52,6 @@
}
//Check other parameters
if (!isset($backup_metacourse)) {
$backup_metacourse = 1;
}
if (!isset($backup_users)) {
$backup_users = 1;
}
@@ -76,10 +66,6 @@
if (!isset($backup_course_files)) {
$backup_course_files = 2;
}
if (!isset($backup_messages)) {
$backup_messages = 1;
}
if ($count == 0) {
@@ -87,10 +73,15 @@
}
?>
<form name="form" method="post" action="backup.php">
<table cellpadding="5">
<form name="form" method="post" action="<?php echo $ME ?>">
<table cellpadding=5>
<?php
//Now print the Backup Name tr
echo "<tr>";
echo "<td align=\"right\"><P><B>";
echo get_string("name").":";
echo "</B></td><td>";
//Calculate the backup string
//Calculate the backup word
@@ -124,37 +115,26 @@
$backup_name .= userdate(time(),$backup_date_format,99,false);
//The extension
$backup_name .= ".zip";
//And finally, clean everything
$backup_name = clean_filename($backup_name);
//Add as text field
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\">";
echo "</td></tr>";
//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>";
echo "<td align=\"right\"><b>";
echo get_string("name").":";
echo "</b></td><td>";
//Add as text field
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\" />";
echo "</td></tr>";
//Add as hidden name
echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"".$backup_unique_code."\">";
//Line
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
//Now print the To Do list
echo "<tr>";
echo "<td colspan=\"2\" align=\"center\"><b>";
} else {
echo '<input type="hidden" name="backup_name" value="'.$backup_name.'" /></b>';
}
//Line
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
//Now print the To Do list
echo "<tr>";
echo "<td colspan=\"2\" align=\"center\"><P><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
//user info, user_files, logs and exercises and workshop backups. A Warning is showed to
//inform the user.
if ($backup_users == 2) {
if ($allmods = get_records("modules") ) {
@@ -173,19 +153,16 @@
}
$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 />";
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", "$THEME->cellheading", "20", "noticebox");
echo "<hr noshade size=\"1\">";
}
if (empty($to)) {
echo get_string("backupdetails").":";
echo "</b></td></tr>";
}
echo get_string("backupdetails").":";
echo "</td></tr>";
//This is tha align to every ingo table
$table->align = array ("left","right");
$table->align = array ("LEFT","RIGHT");
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
@@ -194,25 +171,25 @@
//If exists the lib & function
$var = "exists_".$modname;
if (isset($$var) && $$var) {
//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."\">";
$var = "backup_".$modname;
//Only if selected
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."\" />";
echo "<td colspan=\"2\"><P><B>";
//Print the mod name
echo "<b>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
echo "<li>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
//Now look for user-data status
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
$var = "backup_user_info_".$modname;
//Print the user info
echo $backup_user_options[$$var]."</b>";
echo $backup_user_options[$$var]."<P>";
//Call the check function to show more info
$modcheckbackup = $modname."_check_backup_mods";
$table->data = $modcheckbackup($id,$$var,$backup_unique_code);
@@ -221,74 +198,69 @@
}
}
}
//Line
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
if (empty($to)) {
//Line
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
//Now print the Users tr
echo "<tr>";
echo "<td colspan=\"2\"><P><B>";
$user_options[0] = get_string("includeallusers");
$user_options[1] = get_string("includecourseusers");
$user_options[2] = get_string("includenoneusers");
echo "<li>".$user_options[$backup_users]."<P>";
//Add as hidden name
echo "<input type=\"hidden\" name=\"backup_users\" value=\"".$backup_users."\">";
//Print info
$table->data = user_check_backup($id,$backup_unique_code,$backup_users);
print_table($table);
echo "</td></tr>";
//Now print the Users tr
echo "<tr>";
echo "<td colspan=\"2\"><b>";
$user_options[0] = get_string("includeallusers");
$user_options[1] = get_string("includecourseusers");
$user_options[2] = get_string("includenoneusers");
echo $user_options[$backup_users].'</b>';
//Print info
$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 ($backup_logs && empty($to)) {
if ($backup_logs) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includelogentries").'</b>';
echo "<td colspan=\"2\"><P><B>";
echo "<li>".get_string("includelogentries")."<P>";
//Print info
$table->data = log_check_backup($id);
print_table($table);
echo "</td></tr>";
}
//Add as hidden name
echo "<input type=\"hidden\" name=\"backup_logs\" value=\"".$backup_logs."\">";
//Now print the User Files tr conditionally
if ($backup_user_files) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includeuserfiles").'</b>';
echo "<td colspan=\"2\"><P><B>";
echo "<li>".get_string("includeuserfiles")."<P>";
//Print info
$table->data = user_files_check_backup($id,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
//Add as hidden name
echo "<input type=\"hidden\" name=\"backup_user_files\" value=\"".$backup_user_files."\">";
//Now print the Course Files tr conditionally
if ($backup_course_files) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includecoursefiles").'</b>';
echo "<td colspan=\"2\"><P><B>";
echo "<li>".get_string("includecoursefiles")."<P>";
//Print info
$table->data = course_files_check_backup($id,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
//Add as hidden name
echo "<input type=\"hidden\" name=\"backup_course_files\" value=\"".$backup_course_files."\">";
}
?>
</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" />
<input type="submit" value="<?php print_string("continue") ?>" />
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
</center>
</form>
<BR>
<CENTER>
<input type="hidden" name=id value="<?php p($id) ?>">
<input type="hidden" name=launch value="execute">
<input type="submit" value="<?php print_string("continue") ?>">
<input type="submit" name=cancel value="<?php print_string("cancel") ?>">
</CENTER>
</FORM>
+46 -99
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This page prints the backup todo list to see everything
//Check login
@@ -6,13 +6,7 @@
if (!empty($course->id)) {
if (!isteacheredit($course->id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -66,11 +60,6 @@
}
//Check other parameters
if (!isset($backup_metacourse)) {
$backup_metacourse = 1;
}
$preferences->backup_metacourse = $backup_metacourse;
if (!isset($backup_users)) {
$backup_users = 1;
}
@@ -91,11 +80,6 @@
}
$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");
}
@@ -104,8 +88,7 @@
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);
$preferences->backup_name = $backup_name;
if (!isset($backup_unique_code)) {
error ("Backup unique code not specified");
@@ -122,29 +105,27 @@
notice("No backupable modules are installed!");
}
//Start the main table
echo "<table cellpadding=5>";
//Now print the Backup Name tr
echo "<tr>";
echo "<td align=\"right\"><P><B>";
echo get_string("name").":";
echo "</B></td><td>";
echo $backup_name;
echo "</td></tr>";
//Start the main tr, where all the backup progress is done
echo "<tr>";
echo "<td colspan=\"2\">";
//Start the main ul
echo "<ul>";
if (empty($to)) {
//Start the main table
echo "<table cellpadding=\"5\">";
//Now print the Backup Name tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("name").":";
echo "</b></td><td>";
echo $preferences->backup_name;
echo "</td></tr>";
//Start the main tr, where all the backup progress is done
echo "<tr>";
echo "<td colspan=\"2\">";
//Start the main ul
echo "<ul>";
}
//Check for temp and backup and backup_unique_code directory
//Create them as needed
echo "<li>".get_string("creatingtemporarystructures").'</li>';
echo "<li>".get_string("creatingtemporarystructures");
$status = check_and_create_backup_dir($backup_unique_code);
//Empty dir
if ($status) {
@@ -152,7 +133,7 @@
}
//Delete old_entries from backup tables
echo "<li>".get_string("deletingolddata").'</li>';
echo "<li>".get_string("deletingolddata");
$status = backup_delete_old_data();
if (!$status) {
error ("An error occurred deleting old backup data");
@@ -163,10 +144,10 @@
echo "<li>".get_string("creatingxmlfile");
//Begin a new list to xml contents
echo "<ul>";
echo "<li>".get_string("writingheader").'</li>';
echo "<li>".get_string("writingheader");
//Obtain the xml file (create and open) and print prolog information
$backup_file = backup_open_xml($backup_unique_code);
echo "<li>".get_string("writinggeneralinfo").'</li>';
echo "<li>".get_string("writinggeneralinfo");;
//Prints general info about backup to file
if ($backup_file) {
if (!$status = backup_general_info($backup_file,$preferences)) {
@@ -178,28 +159,14 @@
//Start new ul (for course)
echo "<ul>";
echo "<li>".get_string("courseinfo").'</li>';
echo "<li>".get_string("courseinfo");
//Prints course start (tag and general info)
if ($status) {
if (!$status = backup_course_start($backup_file,$preferences)) {
notify("An error occurred while backing up course start");
}
}
//Metacourse information
if ($status && $preferences->backup_metacourse) {
echo "<li>".get_string("metacourse").'</li>';
if (!$status = backup_course_metacourse($backup_file,$preferences)) {
notify("An error occurred while backing up metacourse info");
}
}
echo "<li>".get_string("blocks").'</li>';
//Blocks information
if ($status) {
if (!$status = backup_course_blocks($backup_file,$preferences)) {
notify("An error occurred while backing up course blocks");
}
}
echo "<li>".get_string("sections").'</li>';
echo "<li>".get_string("sections");
//Section info
if ($status) {
if (!$status = backup_course_sections($backup_file,$preferences)) {
@@ -208,29 +175,20 @@
}
//End course contents (close ul)
echo "</ul></li>";
echo "</ul>";
echo "<li>".get_string("writinguserinfo");
//User info
if ($status && $preferences->backup_users) {
echo "<li>".get_string("writinguserinfo").'</li>';
if ($status) {
if (!$status = backup_user_info($backup_file,$preferences)) {
notify("An error occurred while backing up user info");
}
}
//If we have selected to backup messages and we are
//doing a SITE backup, let's do it
if ($status && $preferences->backup_messages && $preferences->backup_course == SITEID) {
echo "<li>".get_string("writingmessagesinfo").'</li>';
if (!$status = backup_messages($backup_file,$preferences)) {
notify("An error occurred while backing up messages");
}
}
//If we have selected to backup quizzes, backup categories and
//questions structure (step 1). See notes on mod/quiz/backuplib.php
if ($status and $preferences->mods['quiz']->backup) {
echo "<li>".get_string("writingcategoriesandquestions").'</li>';
echo "<li>".get_string("writingcategoriesandquestions");
if (!$status = quiz_backup_question_categories($backup_file,$preferences)) {
notify("An error occurred while backing up quiz categories");
}
@@ -239,7 +197,7 @@
//Print logs if selected
if ($status) {
if ($preferences->backup_logs) {
echo "<li>".get_string("writingloginfo").'</li>';
echo "<li>".get_string("writingloginfo");
if (!$status = backup_log_info($backup_file,$preferences)) {
notify("An error occurred while backing up log info");
}
@@ -248,7 +206,7 @@
//Print scales info
if ($status) {
echo "<li>".get_string("writingscalesinfo").'</li>';
echo "<li>".get_string("writingscalesinfo");
if (!$status = backup_scales_info($backup_file,$preferences)) {
notify("An error occurred while backing up scales");
}
@@ -256,7 +214,7 @@
//Print groups info
if ($status) {
echo "<li>".get_string("writinggroupsinfo").'</li>';
echo "<li>".get_string("writinggroupsinfo");
if (!$status = backup_groups_info($backup_file,$preferences)) {
notify("An error occurred while backing up groups");
}
@@ -264,7 +222,7 @@
//Print events info
if ($status) {
echo "<li>".get_string("writingeventsinfo").'</li>';
echo "<li>".get_string("writingeventsinfo");
if (!$status = backup_events_info($backup_file,$preferences)) {
notify("An error occurred while backing up events");
}
@@ -292,14 +250,14 @@
//Iterate over modules and call backup
foreach ($preferences->mods as $module) {
if ($module->backup and $status) {
echo "<li>".get_string("modulenameplural",$module->name).'</li>';
echo "<li>".get_string("modulenameplural",$module->name);
if (!$status = backup_module($backup_file,$preferences,$module->name)) {
notify("An error occurred while backing up '$module->name'");
}
}
}
//Close ul for module list
echo "</ul></li>";
echo "</ul>";
//Close modules tag
if (!$status = backup_modules_end ($backup_file,$preferences)) {
notify("An error occurred while finishing the module backups");
@@ -319,13 +277,13 @@
}
//End xml contents (close ul)
echo "</ul></li>";
echo "</ul>";
}
//Now, if selected, copy user files
if ($status) {
if ($preferences->backup_user_files) {
echo "<li>".get_string("copyinguserfiles").'</li>';
echo "<li>".get_string("copyinguserfiles");
if (!$status = backup_copy_user_files ($preferences)) {
notify("An error occurred while copying user files");
}
@@ -335,7 +293,7 @@
//Now, if selected, copy course files
if ($status) {
if ($preferences->backup_course_files) {
echo "<li>".get_string("copyingcoursefiles").'</li>';
echo "<li>".get_string("copyingcoursefiles");
if (!$status = backup_copy_course_files ($preferences)) {
notify("An error occurred while copying course files");
}
@@ -344,7 +302,7 @@
//Now, zip all the backup directory contents
if ($status) {
echo "<li>".get_string("zippingbackup").'</li>';
echo "<li>".get_string("zippingbackup");
if (!$status = backup_zip ($preferences)) {
notify("An error occurred while zipping the backup");
}
@@ -352,7 +310,7 @@
//Now, copy the zip file to course directory
if ($status) {
echo "<li>".get_string("copyingzipfile").'</li>';
echo "<li>".get_string("copyingzipfile");
if (!$status = copy_zip_to_course_dir ($preferences)) {
notify("An error occurred while copying the zip file to the course directory");
}
@@ -360,7 +318,7 @@
//Now, clean temporary data (db and filesystem)
if ($status) {
echo "<li>".get_string("cleaningtempdata").'</li>';
echo "<li>".get_string("cleaningtempdata");
if (!$status = clean_temp_data ($preferences)) {
notify("An error occurred while cleaning up temporary data");
}
@@ -380,19 +338,8 @@
"$CFG->wwwroot/course/view.php?id=$course->id");
}
if (empty($to)) {
//Print final message
print_simple_box(get_string("backupfinished"),"center");
print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&amp;wdir=/backupdata");
} else {
print_simple_box(get_string('importdataexported'),"CENTER");
if (!empty($preferences->backup_destination)) {
$filename = $preferences->backup_destination."/".$preferences->backup_name;
} else {
$filename = $preferences->backup_course."/backupdata/".$preferences->backup_name;
}
error_log($filename);
$SESSION->import_preferences = $preferences;
print_continue($CFG->wwwroot.'/course/import.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
}
//Print final message
print_simple_box(get_string("backupfinished"),"CENTER");
print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&wdir=/backupdata");
?>
+52 -116
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This page prints the backup form to select everything
//Check login
@@ -6,13 +6,7 @@
if (!empty($course->id)) {
if (!isteacheredit($course->id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -57,10 +51,6 @@
}
//Check other parameters
if (!isset($backup_metacourse)) {
$backup_metacourse = 1;
}
if (!isset($backup_users)) {
$backup_users = 1;
}
@@ -77,18 +67,14 @@
$backup_course_files = 1;
}
if (!isset($backup_messages)) {
$backup_messages = 1;
}
if ($count == 0) {
notice("No backupable modules are installed!");
}
?>
<form name="form" method="post" action="backup.php">
<table cellpadding="5">
<form name="form" method="post" action="<?php echo $ME ?>">
<table cellpadding=5>
<?php
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
@@ -99,121 +85,71 @@
if (isset($$var) && $$var) {
//Print the full tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
echo "</b></td><td>";
echo "</td><td>";
$backup_options[0] = get_string("no");
$backup_options[1] = get_string("yes");
$var = "backup_".$modname;
choose_from_menu($backup_options, $var, $$var, "");
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
$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, "");
}
else {
echo '<input type="hidden" name="'.$var.'" value="0" />';
}
echo "</td></tr>";
choose_from_menu($backup_user_options, $var, $$var, "");
echo "</td></tr>";
}
}
//Line
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
if (empty($to)) {
//Now print the Metacourse tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string ("metacourse").":";
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, "");
echo "</td></tr>";
}
else {
echo '<input type="hidden" name="backup_metacourse" value="0" />';
}
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
//Now print the Users tr
echo "<tr>";
echo "<td align=\"right\"><P><B>";
echo get_string("users").":";
echo "</td><td>";
$user_options[0] = get_string("all");
$user_options[1] = get_string("course");
$user_options[2] = get_string("none");
choose_from_menu($user_options, "backup_users", $backup_users, "");
echo "</td></tr>";
//Now print the Logs tr
echo "<tr>";
echo "<td align=\"right\"><P><B>";
echo get_string("logs").":";
echo "</td><td>";
$log_options[0] = get_string("no");
$log_options[1] = get_string("yes");
choose_from_menu($log_options, "backup_logs", $backup_logs, "");
echo "</td></tr>";
//Now print the User Files tr
echo "<tr>";
echo "<td align=\"right\"><P><B>";
echo get_string ("userfiles").":";
echo "</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, "");
echo "</td></tr>";
if (empty($to)) {
//Now print the Users tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("users").":";
echo "</b></td><td>";
$user_options[0] = get_string("all");
$user_options[1] = get_string("course");
$user_options[2] = get_string("none");
choose_from_menu($user_options, "backup_users", $backup_users, "");
echo "</td></tr>";
}
else {
echo '<input type="hidden" name="backup_users" value="0" />';
}
if (empty($to)) {
//Now print the Logs tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("logs").":";
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, "");
echo "</td></tr>";
}
else {
echo '<input type="hidden" name="backup_logs" value="0" />';
}
if (empty($to)) {
//Now print the User Files tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string ("userfiles").":";
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, "");
echo "</td></tr>";
}
else {
echo '<input type="hidden" name="backup_user_files" value="0" />';
}
//Now print the Course Files tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string ("coursefiles").":";
echo "</b></td><td>";
echo "</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, "");
echo "</td></tr>";
if (empty($to) && $course->id == SITEID) {
//If we are in a SITEID backup print the Messages tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string ('messages','message').":";
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, "");
echo "</td></tr>";
}
else {
echo '<input type="hidden" name="backup_messages" value="0" />';
}
}
?>
</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="launch" value="check" />
<input type="submit" value="<?php print_string("continue") ?>" />
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
</center>
</form>
<BR>
<CENTER>
<input type="hidden" name=id value="<?php p($id) ?>">
<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") ?>">
</CENTER>
</FORM>
+3 -38
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This file contains all the code needed to execute scheduled backups
//This function is executed via moodle cron
@@ -169,8 +169,6 @@ function schedule_backup_cron() {
$message .= " ".get_string('backupfailed')."\n\n";
$dest_url = $CFG->wwwroot.'/backup/log.php';
$message .= " ".get_string('backuptakealook','',$dest_url)."\n\n";
//Set message priority
$admin->priority = 1;
//Reset unfinished to error
set_field('backup_courses','laststatus','0','laststatus','2');
} else {
@@ -240,7 +238,7 @@ function schedule_backup_log($starttime,$courseid,$message) {
$log->courseid = $courseid;
$log->time = time();
$log->laststarttime = $starttime;
$log->info = addslashes($message);
$log->info = $message;
insert_record ("backup_log",$log);
}
@@ -309,9 +307,6 @@ function schedule_backup_course_configure($course,$starttime = 0) {
if (!isset($backup_config->backup_sche_withuserdata)) {
$backup_config->backup_sche_withuserdata = 1;
}
if (!isset($backup_config->backup_sche_metacourse)) {
$backup_config->backup_sche_metacourse = 1;
}
if (!isset($backup_config->backup_sche_users)) {
$backup_config->backup_sche_users = 1;
}
@@ -324,9 +319,6 @@ function schedule_backup_course_configure($course,$starttime = 0) {
if (!isset($backup_config->backup_sche_coursefiles)) {
$backup_config->backup_sche_coursefiles = 1;
}
if (!isset($backup_config->backup_sche_messages)) {
$backup_config->backup_sche_messages = 1;
}
if (!isset($backup_config->backup_sche_active)) {
$backup_config->backup_sche_active = 0;
}
@@ -389,12 +381,10 @@ function schedule_backup_course_configure($course,$starttime = 0) {
//Convert other parameters
if ($status) {
$preferences->backup_metacourse = $backup_config->backup_sche_metacourse;
$preferences->backup_users = $backup_config->backup_sche_users;
$preferences->backup_logs = $backup_config->backup_sche_logs;
$preferences->backup_user_files = $backup_config->backup_sche_userfiles;
$preferences->backup_course_files = $backup_config->backup_sche_coursefiles;
$preferences->backup_messages = $backup_config->backup_sche_messages;
$preferences->backup_course = $course->id;
$preferences->backup_destination = $backup_config->backup_sche_destination;
$preferences->backup_keep = $backup_config->backup_sche_keep;
@@ -435,15 +425,11 @@ function schedule_backup_course_configure($course,$starttime = 0) {
$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 string to match the keep preference
$keep_name = $backup_word."-";
//The shortname
$keep_name .= strtolower($backup_shortname)."-";
//And finally, clean everything
$keep_name = clean_filename($keep_name);
$preferences->backup_name = $backup_name;
$preferences->keep_name = $keep_name;
@@ -484,7 +470,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
//Now calculate the users
if ($status) {
schedule_backup_log($starttime,$course->id," calculating users");
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$preferences->backup_messages);
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users);
}
//Now calculate the logs
@@ -568,18 +554,6 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
$status = backup_course_start($backup_file,$preferences);
}
//Metacourse information
if ($status && $preferences->backup_metacourse) {
schedule_backup_log($starttime,$preferences->backup_course," metacourse info");
$status = backup_course_metacourse($backup_file,$preferences);
}
//Block info
if ($status) {
schedule_backup_log($starttime,$preferences->backup_course," blocks info");
$status = backup_course_blocks($backup_file,$preferences);
}
//Section info
if ($status) {
schedule_backup_log($starttime,$preferences->backup_course," sections info");
@@ -592,15 +566,6 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
$status = backup_user_info($backup_file,$preferences);
}
//If we have selected to backup messages and we are
//doing a SITE backup, let's do it
if ($status && $preferences->backup_messages && $preferences->backup_course == SITEID) {
schedule_backup_log($starttime,$preferences->backup_course," messages");
if (!$status = backup_messages($backup_file,$preferences)) {
notify("An error occurred while backing up messages");
}
}
//If we have selected to backup quizzes, backup categories and
//questions structure (step 1). See notes on mod/quiz/backuplib.php
if ($status and $preferences->mods['quiz']->backup) {
+20 -436
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This file contains all the function needed in the backup utility
//except the mod-related funtions that are into every backuplib.php inside
//every mod directory
@@ -6,11 +6,7 @@
//Insert necessary category ids to backup_ids table
function insert_category_ids ($course,$backup_unique_code) {
global $CFG;
//Create missing categories and reasign orphaned questions
fix_orphaned_questions($course);
//Detect used categories (by category in questions)
$status = true;
$status = execute_sql("INSERT INTO {$CFG->prefix}backup_ids
(backup_code, table_name, old_id)
SELECT DISTINCT $backup_unique_code,'quiz_categories',t.category
@@ -20,77 +16,8 @@
WHERE q.course = '$course' AND
g.quiz = q.id AND
g.question = t.id",false);
//Now, foreach detected category, we look for their parents upto 0 (top category)
$categories = get_records_sql("SELECT old_id, old_id
FROM {$CFG->prefix}backup_ids
WHERE backup_code = $backup_unique_code AND
table_name = 'quiz_categories'");
if ($categories) {
foreach ($categories as $category) {
if ($dbcat = get_record('quiz_categories','id',$category->old_id)) {
//echo $dbcat->name; //Debug
//Go up to 0
while ($dbcat->parent != 0) {
//echo '->'; //Debug
$current = $dbcat->id;
if ($dbcat = get_record('quiz_categories','id',$dbcat->parent)) {
//Found parent, add it to backup_ids (by using backup_putid
//we ensure no duplicates!)
$status = backup_putid($backup_unique_code,'quiz_categories',$dbcat->id,0);
//echo $dbcat->name; //Debug
} else {
//Parent not found, fix it (set its parent to 0)
set_field ('quiz_categories','parent',0,'id',$current);
//echo 'assigned to top!'; //Debug
}
}
//echo '<br />'; //Debug
}
}
}
return $status;
}
//This function is used to detect orphaned questions (pointing to a
//non existing category) and to recreate such category. This function
//is used by the backup process, to ensure consistency and should be
//executed in the upgrade process and, perhaps in the health center.
function fix_orphaned_questions ($course) {
global $CFG;
$categories = get_records_sql("SELECT DISTINCT t.category, t.category
FROM {$CFG->prefix}quiz_questions t,
{$CFG->prefix}quiz_question_grades g,
{$CFG->prefix}quiz q
WHERE q.course = '$course' AND
g.quiz = q.id AND
g.question = t.id",false);
if ($categories) {
foreach ($categories as $key => $category) {
$exist = get_record('quiz_categories','id', $key);
//If the category doesn't exist
if (!$exist) {
//Build a new category
$db_cat->course = $course;
$db_cat->name = get_string('recreatedcategory','',$key);
$db_cat->info = get_string('recreatedcategory','',$key);
$db_cat->publish = 1;
$db_cat->stamp = make_unique_id_code();
//Insert the new category
$catid = insert_record('quiz_categories',$db_cat);
unset ($db_cat);
if ($catid) {
//Reasign orphaned questions to their new category
set_field ('quiz_questions','category',$catid,'category',$key);
}
}
}
}
}
//Delete category ids from backup_ids table
function delete_category_ids ($backup_unique_code) {
@@ -103,7 +30,7 @@
//Calculate the number of users to backup and put their ids in backup_ids
//Return an array of info (name,value)
function user_check_backup($course,$backup_unique_code,$backup_users,$backup_messages) {
function user_check_backup($course,$backup_unique_code,$backup_users) {
//$backup_users=0-->all
// 1-->course (needed + enrolled)
// 2-->none
@@ -117,7 +44,7 @@
if ($backup_users == 0 or $backup_users == 1) {
//Calculate needed users (calling every xxxx_get_participants function + scales users)
$needed_users = backup_get_needed_users($course, $backup_messages);
$needed_users = backup_get_needed_users($course);
//Calculate enrolled users (students + teachers)
$enrolled_users = backup_get_enrolled_users($course);
@@ -199,9 +126,9 @@
// every student and teacher in the course, so it
//must be merged with backup_get_enrrolled_users !!
function backup_get_needed_users ($courseid, $includemessages=false) {
function backup_get_needed_users ($courseid) {
global $CFG;
global $CFG, $THEME;
$result = false;
@@ -231,7 +158,7 @@
}
}
//Now, add scale users (from site and course scales)
//Now, add scales users (from site and course scales)
//Get users
$scaleusers = get_records_sql("SELECT DISTINCT userid,userid
FROM {$CFG->prefix}scale
@@ -245,22 +172,6 @@
}
}
}
//Now, add message users if necessary
if ($includemessages) {
include_once("$CFG->dirroot/message/lib.php");
//Get users
$messageusers = message_get_participants();
//Add message users to results
if ($messageusers) {
foreach ($messageusers as $messageuser) {
//If id != 0
if ($messageuser->id !=0) {
$result[$messageuser->id]->id = $messageuser->id;
}
}
}
}
return $result;
@@ -460,17 +371,6 @@
return $status;
}
//Function to check and create the "group_files" dir to
//save all the user files we need from "groups" dir
function check_and_create_group_files_dir($backup_unique_code) {
global $CFG;
$status = check_dir_exists($CFG->dataroot."/temp/backup/".$backup_unique_code."/group_files",true);
return $status;
}
//Function to check and create the "course_files" dir to
//save all the course files we need from "CFG->datadir/course" dir
function check_and_create_course_files_dir($backup_unique_code) {
@@ -595,12 +495,6 @@
//Print the end
fwrite ($bf,end_tag("MOD",3,true));
}
//The metacourse in backup
if ($preferences->backup_metacourse == 1) {
fwrite ($bf,full_tag("METACOURSE",3,false,"true"));
} else {
fwrite ($bf,full_tag("METACOURSE",3,false,"false"));
}
//The user in backup
if ($preferences->backup_users == 1) {
fwrite ($bf,full_tag("USERS",3,false,"course"));
@@ -627,14 +521,6 @@
} else {
fwrite ($bf,full_tag("COURSEFILES",3,false,"false"));
}
//The messages in backup
if ($preferences->backup_messages == 1 && $preferences->backup_course == SITEID) {
fwrite ($bf,full_tag("MESSAGES",3,false,"true"));
} else {
fwrite ($bf,full_tag("MESSAGES",3,false,"false"));
}
//The mode of writing the block data
fwrite ($bf,full_tag('BLOCKFORMAT',3,false,'instances'));
fwrite ($bf,end_tag("DETAILS",2,true));
@@ -678,6 +564,7 @@
fwrite ($bf,full_tag("SUMMARY",3,false,$course->summary));
fwrite ($bf,full_tag("FORMAT",3,false,$course->format));
fwrite ($bf,full_tag("SHOWGRADES",3,false,$course->showgrades));
fwrite ($bf,full_tag("BLOCKINFO",3,false,blocks_get_block_names($course->blockinfo)));
fwrite ($bf,full_tag("NEWSITEMS",3,false,$course->newsitems));
fwrite ($bf,full_tag("TEACHER",3,false,$course->teacher));
fwrite ($bf,full_tag("TEACHERS",3,false,$course->teachers));
@@ -693,20 +580,12 @@
fwrite ($bf,full_tag("GROUPMODE",3,false,$course->groupmode));
fwrite ($bf,full_tag("GROUPMODEFORCE",3,false,$course->groupmodeforce));
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("MARKER",3,false,$course->marker));
fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible));
fwrite ($bf,full_tag("HIDDENSECTIONS",3,false,$course->hiddensections));
fwrite ($bf,full_tag("TIMECREATED",3,false,$course->timecreated));
fwrite ($bf,full_tag("TIMEMODIFIED",3,false,$course->timemodified));
//If not selected, force metacourse to 0
if (!$preferences->backup_metacourse) {
$status = fwrite ($bf,full_tag("METACOURSE",3,false,'0'));
//else, export the field as is in DB
} else {
$status = fwrite ($bf,full_tag("METACOURSE",3,false,$course->metacourse));
}
$status = fwrite ($bf,full_tag("TIMEMODIFIED",3,false,$course->timemodified));
//Print header end
fwrite ($bf,end_tag("HEADER",2,true));
} else {
@@ -726,246 +605,6 @@
}
//Prints course's metacourse info (table course_meta)
function backup_course_metacourse ($bf,$preferences) {
global $CFG;
$status = true;
//Get info from meta
$parents = get_records_sql ("SELECT m.*, c.idnumber, c.shortname
FROM {$CFG->prefix}course_meta m,
{$CFG->prefix}course c
WHERE m.child_course = '$preferences->backup_course' AND
m.parent_course = c.id");
$childs = get_records_sql ("SELECT m.*, c.idnumber, c.shortname
FROM {$CFG->prefix}course_meta m,
{$CFG->prefix}course c
WHERE m.parent_course = '$preferences->backup_course' AND
m.child_course = c.id");
if ($parents || $childs) {
//metacourse open tag
fwrite ($bf,start_tag("METACOURSE",2,true));
if ($parents) {
fwrite($bf, start_tag("PARENTS",3,true));
//Iterate over every parent
foreach ($parents as $parent) {
//Begin parent
fwrite ($bf,start_tag("PARENT",4,true));
fwrite ($bf,full_tag("ID",5,false,$parent->parent_course));
fwrite ($bf,full_tag("IDNUMBER",5,false,$parent->idnumber));
fwrite ($bf,full_tag("SHORTNAME",5,false,$parent->shortname));
//End parent
fwrite ($bf,end_tag("PARENT",4,true));
}
fwrite ($bf,end_tag("PARENTS",3,true));
}
if ($childs) {
fwrite($bf, start_tag("CHILDS",3,true));
//Iterate over every child
foreach ($childs as $child) {
//Begin parent
fwrite ($bf,start_tag("CHILD",4,true));
fwrite ($bf,full_tag("ID",5,false,$child->child_course));
fwrite ($bf,full_tag("IDNUMBER",5,false,$child->idnumber));
fwrite ($bf,full_tag("SHORTNAME",5,false,$child->shortname));
//End parent
fwrite ($bf,end_tag("CHILD",4,true));
}
fwrite ($bf,end_tag("CHILDS",3,true));
}
//metacourse close tag
$status = fwrite ($bf,end_tag("METACOURSE",3,true));
}
return $status;
}
//Prints course's messages info (tables message, message_read and message_contacts)
function backup_messages ($bf,$preferences) {
global $CFG;
$status = true;
//Get info from messages
$unreads = get_records ('message');
$reads = get_records ('message_read');
$contacts= get_records ('message_contacts');
if ($unreads || $reads || $contacts) {
$counter = 0;
//message open tag
fwrite ($bf,start_tag("MESSAGES",2,true));
if ($unreads) {
//Iterate over every unread
foreach ($unreads as $unread) {
//start message
fwrite($bf, start_tag("MESSAGE",3,true));
fwrite ($bf,full_tag("ID",4,false,$unread->id));
fwrite ($bf,full_tag("STATUS",4,false,"UNREAD"));
fwrite ($bf,full_tag("USERIDFROM",4,false,$unread->useridfrom));
fwrite ($bf,full_tag("USERIDTO",4,false,$unread->useridto));
fwrite ($bf,full_tag("MESSAGE",4,false,$unread->message));
fwrite ($bf,full_tag("FORMAT",4,false,$unread->format));
fwrite ($bf,full_tag("TIMECREATED",4,false,$unread->timecreated));
fwrite ($bf,full_tag("MESSAGETYPE",4,false,$unread->messagetype));
//end message
fwrite ($bf,end_tag("MESSAGE",3,true));
//Do some output
$counter++;
if ($counter % 20 == 0) {
echo ".";
if ($counter % 400 == 0) {
echo "<br />";
}
backup_flush(300);
}
}
}
if ($reads) {
//Iterate over every read
foreach ($reads as $read) {
//start message
fwrite($bf, start_tag("MESSAGE",3,true));
fwrite ($bf,full_tag("ID",4,false,$read->id));
fwrite ($bf,full_tag("STATUS",4,false,"READ"));
fwrite ($bf,full_tag("USERIDFROM",4,false,$read->useridfrom));
fwrite ($bf,full_tag("USERIDTO",4,false,$read->useridto));
fwrite ($bf,full_tag("MESSAGE",4,false,$read->message));
fwrite ($bf,full_tag("FORMAT",4,false,$read->format));
fwrite ($bf,full_tag("TIMECREATED",4,false,$read->timecreated));
fwrite ($bf,full_tag("MESSAGETYPE",4,false,$read->messagetype));
fwrite ($bf,full_tag("TIMEREAD",4,false,$read->timeread));
fwrite ($bf,full_tag("MAILED",4,false,$read->mailed));
//end message
fwrite ($bf,end_tag("MESSAGE",3,true));
//Do some output
$counter++;
if ($counter % 20 == 0) {
echo ".";
if ($counter % 400 == 0) {
echo "<br />";
}
backup_flush(300);
}
}
}
if ($contacts) {
fwrite($bf, start_tag("CONTACTS",3,true));
//Iterate over every contact
foreach ($contacts as $contact) {
//start contact
fwrite($bf, start_tag("CONTACT",4,true));
fwrite ($bf,full_tag("ID",5,false,$contact->id));
fwrite ($bf,full_tag("USERID",5,false,$contact->userid));
fwrite ($bf,full_tag("CONTACTID",5,false,$contact->contactid));
fwrite ($bf,full_tag("BLOCKED",5,false,$contact->blocked));
//end contact
fwrite ($bf,end_tag("CONTACT",4,true));
//Do some output
$counter++;
if ($counter % 20 == 0) {
echo ".";
if ($counter % 400 == 0) {
echo "<br />";
}
backup_flush(300);
}
}
fwrite($bf, end_tag("CONTACTS",3,true));
}
//messages close tag
$status = fwrite ($bf,end_tag("MESSAGES",2,true));
}
return $status;
}
//Prints course's blocks info (table block_instance)
function backup_course_blocks ($bf,$preferences) {
global $CFG;
$status = true;
// Read all of the block table
$blocks = blocks_get_record();
$pages = array();
$pages[] = page_create_object(PAGE_COURSE_VIEW, $preferences->backup_course);
// Let's see if we have to backup blocks from modules
$modulerecords = get_records_sql('SELECT name, id FROM '.$CFG->prefix.'modules');
foreach($preferences->mods as $module) {
if(!$module->backup) {
continue;
}
$cmods = get_records_select('course_modules', 'course = '.$preferences->backup_course.' AND module = '.$modulerecords[$module->name]->id);
if(empty($cmods)) {
continue;
}
$pagetypes = page_import_types('mod/'.$module->name.'/');
if(empty($pagetypes)) {
continue;
}
foreach($pagetypes as $pagetype) {
foreach($cmods as $cmod) {
$pages[] = page_create_object($pagetype, $cmod->instance);
}
}
}
//Blocks open tag
fwrite ($bf,start_tag('BLOCKS',2,true));
while($page = array_pop($pages)) {
if ($instances = blocks_get_by_page($page)) {
//Iterate over every block
foreach ($instances as $position) {
foreach ($position as $instance) {
//If we somehow have a block with an invalid id, skip it
if(empty($blocks[$instance->blockid]->name)) {
continue;
}
//Begin Block
fwrite ($bf,start_tag('BLOCK',3,true));
fwrite ($bf,full_tag('NAME',4,false,$blocks[$instance->blockid]->name));
fwrite ($bf,full_tag('PAGEID',4,false,$instance->pageid));
fwrite ($bf,full_tag('PAGETYPE',4,false,$instance->pagetype));
fwrite ($bf,full_tag('POSITION',4,false,$instance->position));
fwrite ($bf,full_tag('WEIGHT',4,false,$instance->weight));
fwrite ($bf,full_tag('VISIBLE',4,false,$instance->visible));
fwrite ($bf,full_tag('CONFIGDATA',4,false,$instance->configdata));
//End Block
fwrite ($bf,end_tag('BLOCK',3,true));
}
}
}
}
//Blocks close tag
$status = fwrite ($bf,end_tag('BLOCKS',2,true));
return $status;
}
//Prints course's sections info (table course_sections)
function backup_course_sections ($bf,$preferences) {
@@ -1085,9 +724,7 @@
//Output all user data
fwrite ($bf,full_tag("ID",4,false,$user_data->id));
fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
fwrite ($bf,full_tag("GUID",4,false,$user_data->guid));
fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
fwrite ($bf,full_tag("POLICYAGREED",4,false,$user_data->policyagreed));
fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
fwrite ($bf,full_tag("USERNAME",4,false,$user_data->username));
fwrite ($bf,full_tag("PASSWORD",4,false,$user_data->password));
@@ -1097,10 +734,6 @@
fwrite ($bf,full_tag("EMAIL",4,false,$user_data->email));
fwrite ($bf,full_tag("EMAILSTOP",4,false,$user_data->emailstop));
fwrite ($bf,full_tag("ICQ",4,false,$user_data->icq));
fwrite ($bf,full_tag("SKYPE",4,false,$user_data->skype));
fwrite ($bf,full_tag("YAHOO",4,false,$user_data->yahoo));
fwrite ($bf,full_tag("AIM",4,false,$user_data->aim));
fwrite ($bf,full_tag("MSN",4,false,$user_data->msn));
fwrite ($bf,full_tag("PHONE1",4,false,$user_data->phone1));
fwrite ($bf,full_tag("PHONE2",4,false,$user_data->phone2));
fwrite ($bf,full_tag("INSTITUTION",4,false,$user_data->institution));
@@ -1109,7 +742,6 @@
fwrite ($bf,full_tag("CITY",4,false,$user_data->city));
fwrite ($bf,full_tag("COUNTRY",4,false,$user_data->country));
fwrite ($bf,full_tag("LANG",4,false,$user_data->lang));
fwrite ($bf,full_tag("THEME",4,false,$user_data->theme));
fwrite ($bf,full_tag("TIMEZONE",4,false,$user_data->timezone));
fwrite ($bf,full_tag("FIRSTACCESS",4,false,$user_data->firstaccess));
fwrite ($bf,full_tag("LASTACCESS",4,false,$user_data->lastaccess));
@@ -1174,7 +806,6 @@
fwrite ($bf,full_tag("TIMEEND",6,false,$tea->timeend));
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$tea->timemodified));
fwrite ($bf,full_tag("TIMEACCESS",6,false,$tea->timeaccess));
fwrite ($bf,full_tag("ENROL",6,false,$tea->enrol));
//Print ROLE end
fwrite ($bf,end_tag("ROLE",5,true));
}
@@ -1190,7 +821,6 @@
fwrite ($bf,full_tag("TIMEEND",6,false,$stu->timeend));
fwrite ($bf,full_tag("TIME",6,false,$stu->time));
fwrite ($bf,full_tag("TIMEACCESS",6,false,$stu->timeaccess));
fwrite ($bf,full_tag("ENROL",6,false,$stu->enrol));
//Print ROLE end
fwrite ($bf,end_tag("ROLE",5,true));
}
@@ -1230,7 +860,7 @@
if ($counter % 10 == 0) {
echo ".";
if ($counter % 200 == 0) {
echo "<br />";
echo "<br>";
}
backup_flush(300);
}
@@ -1296,10 +926,10 @@
}
//Do some output
$counter++;
if ($counter % 20 == 0) {
if ($counter % 10 == 0) {
echo ".";
if ($counter % 400 == 0) {
echo "<br />";
if ($counter % 200 == 0) {
echo "<br>";
}
backup_flush(300);
}
@@ -1430,29 +1060,20 @@
fwrite ($bf,full_tag("COURSEID",4,false,$group->courseid));
fwrite ($bf,full_tag("NAME",4,false,$group->name));
fwrite ($bf,full_tag("DESCRIPTION",4,false,$group->description));
fwrite ($bf,full_tag("PASSWORD",4,false,$group->password));
fwrite ($bf,full_tag("LANG",4,false,$group->lang));
fwrite ($bf,full_tag("THEME",4,false,$group->theme));
fwrite ($bf,full_tag("PICTURE",4,false,$group->picture));
fwrite ($bf,full_tag("HIDEPICTURE",4,false,$group->hidepicture));
fwrite ($bf,full_tag("TIMECREATED",4,false,$group->timecreated));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$group->timemodified));
//Now, backup groups_members, only if users are included
if ($preferences->backup_users != 2) {
$status2 = backup_groups_members_info($bf,$preferences,$group->id);
}
//Now, backup groups_members
$status2 = backup_groups_members_info($bf,$preferences,$group->id);
//End group tag
fwrite ($bf,end_tag("GROUP",3,true));
}
//End groups tag
$status = fwrite ($bf,end_tag("GROUPS",2,true));
//Now save group_files
if ($status && $status2) {
$status2 = backup_copy_group_files($preferences);
}
}
return ($status && $status2);
}
@@ -1558,7 +1179,7 @@
}
if ($result != $content && $CFG->debug>7) { //Debug
echo "<br /><hr />".$content."<br />changed to<br />".$result."<hr /><br />"; //Debug
echo "<br><hr>".$content."<br>changed to<br>".$result."<hr><br>"; //Debug
} //Debug
return $result;
@@ -1598,43 +1219,6 @@
}
}
}
return $status;
}
//This function copies all the needed files under the "groups" directory to the "group_files"
//directory under temp/backup
function backup_copy_group_files ($preferences) {
global $CFG;
$status = true;
//First we check if "group_files" exists and create it as necessary
//in temp/backup/$backup_code dir
$status = check_and_create_group_files_dir($preferences->backup_unique_code);
//Now iterate over directories under "groups" to check if that user must be
//copied to backup
$rootdir = $CFG->dataroot.'/groups';
//Check if directory exists
if (is_dir($rootdir)) {
$list = list_directories ($rootdir);
if ($list) {
//Iterate
foreach ($list as $dir) {
//Look for dir like group in groups table
$data = get_record ('groups', 'courseid', $preferences->backup_course,
'id',$dir);
//If exists, copy it
if ($data) {
$status = backup_copy_file($rootdir."/".$dir,
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/group_files/".$dir);
}
}
}
}
return $status;
}
@@ -1724,9 +1308,9 @@
//Define zip destination (course dir)
$to_zip_file = $CFG->dataroot."/".$preferences->backup_course;
//echo "<p>From: ".$from_zip_file."<br />"; //Debug
//echo "<p>From: ".$from_zip_file."<br>"; //Debug
//echo "<p>Checking: ".$to_zip_file."<br />"; //Debug
//echo "<p>Checking: ".$to_zip_file."<br>"; //Debug
//Checks course dir exists
$status = check_dir_exists($to_zip_file,true);
@@ -1734,7 +1318,7 @@
//Define zip destination (backup dir)
$to_zip_file = $to_zip_file."/backupdata";
//echo "<p>Checking: ".$to_zip_file."<br />"; //Debug
//echo "<p>Checking: ".$to_zip_file."<br>"; //Debug
//Checks backup dir exists
$status = check_dir_exists($to_zip_file,true);
@@ -1743,7 +1327,7 @@
$to_zip_file = $to_zip_file."/".$preferences->backup_name;
}
//echo "<p>To: ".$to_zip_file."<br />"; //Debug
//echo "<p>To: ".$to_zip_file."<br>"; //Debug
//Copy zip file
if ($status) {
-73
View File
@@ -1,73 +0,0 @@
Ziba Scott <ziba@linuxbox.com> 11/19/04
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
* Course Documents
* 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 compiled with --enable-xslt --with-xslt-sablot options
(Check php.net for instructions on enabling xslt for your platform)
INSTALLATION:
*Unpack this file into the "backup" directory
MANUAL OPERATION:
REQUIREMENTS:
*An XSLT 1.0 processor (like Sablotron)
*A zipping utility
REQUIREMENTS FOR WEB INTERFACE:
*Linux/Unix
*PHP compiled with --enable-xslt --with-xslt-sablot options.
*Apache with write access to /tmp
*A commandline zipping utility
COMMAND LINE INSTRUCTIONS:
1) Download and uncompress the Blackboard export into a directory.
2) Copy bb2moodle.xslt into the Blackboard course directory.
3) Run your XSLT processor on imsmanifest.xml with bb2moodle.xslt
as the input and moodle.xml as the output. If you are using
Sablotron on linux, this command will look like this:
sabcmd bb2moodle.xslt imsmanifest.xml > moodle.xml
4) Create a moodle zip file with this structure:
moodle.xml
user_files/
course_files/
5) Copy every subdirectory and its contents from the Blackboard
export directory into the course_files directory. This does
not include the Blackboard XML files, only the course
documents. Your moodle zip file will now look similar to
this:
moodle.xml
user_files/
course_files/res0009/myfile.doc
course_files/res0010/myotherfile.doc
course_files/res0010/mypicture.jpg
6) Upload and restore your moodle zip file
-737
View File
@@ -1,737 +0,0 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<MOODLE_BACKUP>
<INFO>
<NAME>backup-from-blackboard.zip</NAME>
<MOODLE_VERSION>2004083100</MOODLE_VERSION>
<MOODLE_RELEASE>1.4</MOODLE_RELEASE>
<BACKUP_VERSION>2004083100</BACKUP_VERSION>
<BACKUP_RELEASE>1.4</BACKUP_RELEASE>
<DATE>1094240862</DATE>
<ORIGINAL_WWWROOT>INSERT URL HERE</ORIGINAL_WWWROOT>
<DETAILS>
<MOD>
<NAME>assignment</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>chat</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>choice</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>forum</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>glossary</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>journal</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>label</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>lesson</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>quiz</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>resource</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>scorm</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>survey</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>wiki</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>workshop</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<USERS>course</USERS>
<LOGS>false</LOGS>
<USERFILES>true</USERFILES>
<COURSEFILES>true</COURSEFILES>
</DETAILS>
</INFO>
<COURSE>
<!-- Get course specific information -->
<xsl:apply-templates select="document('res00001.dat')//COURSE"/>
<SECTIONS>
<!-- Create a title section -->
<xsl:for-each select="document('res00001.dat')" >
<xsl:call-template name="title_section" />
</xsl:for-each>
<!-- Create a topic for each top level Bb item and add section modules ONE folder deep -->
<xsl:for-each select="manifest/organizations/tableofcontents/item">
<xsl:variable name="section_number" select="position()"/>
<xsl:call-template name="sections">
<xsl:with-param name="section_number" select="$section_number"/>
<xsl:with-param name="recurse" >false</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<!-- Create a topic for each second level Bb item which is a folder, recursively make section modules -->
<xsl:for-each select="manifest/organizations/tableofcontents/item/item">
<xsl:sort order="descending" select="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value"/>
<xsl:if test="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value = 'true'">
<xsl:variable name="prev_sections" select="count(/manifest/organizations/tableofcontents/item)"/>
<xsl:variable name="section_number" select="position()+$prev_sections"/>
<xsl:call-template name="sections">
<xsl:with-param name="section_number" select="$section_number"/>
<xsl:with-param name="recurse" >true</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</SECTIONS>
<MODULES>
<xsl:call-template name="modules" />
</MODULES>
</COURSE>
</MOODLE_BACKUP>
</xsl:template>
<xsl:template match="COURSE">
<HEADER>
<ID>2</ID>
<CATEGORY>
<ID></ID>
<NAME><xsl:value-of select="CATEGORIES/CATEGORY/@value"/></NAME>
</CATEGORY>
<PASSWORD></PASSWORD>
<IDNUMBER>4</IDNUMBER>
<FORMAT>topics</FORMAT>
<SHOWGRADES>1</SHOWGRADES>
<BLOCKINFO>participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity</BLOCKINFO>
<NEWSITEMS>5</NEWSITEMS>
<TEACHER>Teacher</TEACHER>
<TEACHERS>Teachers</TEACHERS>
<STUDENT>Student</STUDENT>
<STUDENTS>Students</STUDENTS>
<GUEST>0</GUEST>
<STARTDATE>1094270400</STARTDATE>
<ENROLPERIOD>0</ENROLPERIOD>
<NUMSECTIONS>10</NUMSECTIONS>
<MAXBYTES>2097152</MAXBYTES>
<SHOWREPORTS>0</SHOWREPORTS>
<GROUPMODE>0</GROUPMODE>
<GROUPMODEFORCE>0</GROUPMODEFORCE>
<LANG></LANG>
<COST></COST>
<MARKER>0</MARKER>
<VISIBLE>1</VISIBLE>
<HIDDENSECTIONS>0</HIDDENSECTIONS>
<TIMECREATED>1094240775</TIMECREATED>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
<SUMMARY><xsl:value-of select="DESCRIPTION"/></SUMMARY>
<SHORTNAME><xsl:value-of select="COURSEID/@value"/></SHORTNAME>
<FULLNAME><xsl:value-of select="TITLE/@value"/></FULLNAME>
</HEADER>
</xsl:template>
<!-- ############# Sections ############# -->
<xsl:template name="title_section" match="resource">
<SECTION>
<ID>0</ID>
<NUMBER>0</NUMBER>
<SUMMARY>&lt;div style="text-align: center;"&gt;&lt;font size="5" style="font-family: arial,helvetica,sans-serif;"&gt;<xsl:value-of select="COURSE/TITLE/@value"/>&lt;/font&gt;&lt;/div&gt;
<xsl:value-of select="COURSE/DESCRIPTION"/>
</SUMMARY>
<VISIBLE>1</VISIBLE>
<MODS>
<xsl:call-template name="news_forum_section_mod" >
<xsl:with-param name="mod_number">1</xsl:with-param>
</xsl:call-template>
</MODS>
</SECTION>
</xsl:template>
<xsl:template name="sections" match="resource">
<xsl:param name="section_number">1. </xsl:param>
<xsl:param name="recurse"/>
<SECTION>
<ID><xsl:value-of select="$section_number"/></ID>
<NUMBER><xsl:value-of select="$section_number"/></NUMBER>
<SUMMARY>&lt;span style="font-weight: bold;"&gt;<xsl:value-of select="@title"/>&lt;/span&gt;</SUMMARY>
<VISIBLE>1</VISIBLE>
<MODS>
<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"/>
<xsl:with-param name="indent" >0</xsl:with-param>
<xsl:with-param name="recurse" select="$recurse" />
</xsl:call-template>
</xsl:if>
<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">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="0"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:if>
</MODS>
</SECTION>
</xsl:template>
<xsl:template name="item_recurse_files">
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<xsl:param name="recurse"/>
<!-- Create one section-mod -->
<xsl:for-each select="document(concat(@identifierref,'.dat'))">
<xsl:call-template name="section_mod">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:for-each>
<!-- Depth first recursion to preserve order -->
<xsl:for-each select="item">
<xsl:variable name="m_number" select="substring-after(@identifierref,'res')"/>
<xsl:call-template name="item_recurse_files" >
<xsl:with-param name="mod_number" select="$m_number"/>
<xsl:with-param name="indent" select="$indent + 1"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Determines the type of section mod entry and calls the appropriate creation template -->
<xsl:template name="section_mod" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="contenttype" />
<xsl:param name="indent">1. </xsl:param>
<!-- Every file will have a label module describing it -->
<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>
<xsl:with-param name="indent" ><xsl:value-of select="$indent"/></xsl:with-param>
<xsl:with-param name="type" >label</xsl:with-param>
</xsl:call-template>
<!-- Create a resource for each file -->
<xsl:for-each select="CONTENT/FILES/FILEREF">
<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:when>
<!-- Detected a folder -->
<xsl:when test="CONTENT/FLAGS/ISFOLDER/@value = 'true'">
<!-- Create a label -->
<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" >label</xsl:with-param>
</xsl:call-template>
</xsl:when>
<!-- Detected text -->
<xsl:when test="CONTENT/MAINDATA/FLAGS/ISHTML/@value = 'true'">
<!-- 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>
<!-- Detected external link -->
<xsl:when test="EXTERNALLINK/TITLE/@value != '' ">
<!-- Create a label -->
<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" >label</xsl:with-param>
</xsl:call-template>
<!-- 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>
</xsl:choose>
</xsl:template>
<!-- ############# Section Modules ############# -->
<!-- Creates one section module entry.
Works for types: label, resource (text), resource (externallink)
-->
<xsl:template name="section_mod_generic" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<xsl:param name="type"/>
<MOD>
<ID><xsl:if test="$type = 'label'">1</xsl:if><xsl:value-of select="$mod_number"/>0</ID>
<ZIBA_NAME>
<xsl:value-of select="CONTENT/TITLE"/>
<xsl:value-of select="EXTERNALLINK/TITLE/@value"/>
</ZIBA_NAME>
<TYPE><xsl:value-of select="$type"/></TYPE>
<INSTANCE><xsl:value-of select="$mod_number"/></INSTANCE>
<ADDED>1094240775</ADDED>
<DELETED>0</DELETED>
<SCORE>0</SCORE>
<INDENT><xsl:value-of select="$indent"/></INDENT>
<VISIBLE>1</VISIBLE>
<GROUPMODE>0</GROUPMODE>
</MOD>
</xsl:template>
<!-- ############# Modules ############# -->
<!-- Creates a module-label entry -->
<xsl:template name="module_label" >
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<LABELFOUND></LABELFOUND>
<MODTYPE>label</MODTYPE>
<NAME>
<!-- for CONTENT text -->
<xsl:value-of select="TITLE"/>
<!-- for EXTERNALLINK text -->
<xsl:value-of select="TITLE/@value"/>
</NAME>
<CONTENT>
&lt;span style="font-style: italic;"&gt;
<!-- for CONTENT text -->
<xsl:value-of select="TITLE"/>
<!-- for EXTERNALLINK text -->
<xsl:value-of select="TITLE/@value"/>
:&lt;/span&gt;
<!-- for CONTENT text -->
<xsl:value-of select="MAINDATA/TEXT"/>
<!-- for EXTERNALLINK text -->
<xsl:value-of select="DESCRIPTION/TEXT"/>
</CONTENT>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- Creates one module-file entry -->
<xsl:template name="module_file" >
<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="FILES/FILEREF/RELFILE/@value"/> -->
<xsl:value-of select="RELFILE/@value"/>
</NAME>
<TYPE>file</TYPE>
<REFERENCE>
<!-- <xsl:value-of select="FILES/FILEREF/CONTENTID/@value"/>/<xsl:value-of select="FILES/FILEREF/RELFILE/@value"/> -->
<xsl:value-of select="CONTENTID/@value"/>/<xsl:value-of select="RELFILE/@value"/>
</REFERENCE>
<SUMMARY>
summary broken
<xsl:value-of select="MAINDATA/TEXT"/>
</SUMMARY>
<ALLTEXT></ALLTEXT>
<POPUP></POPUP>
<OPTIONS>frame</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>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>resource</MODTYPE>
<NAME>
<xsl:value-of select="TITLE"/>
<!-- For announcements -->
<xsl:value-of select="TITLE/@value"/>
</NAME>
<TYPE>text</TYPE>
<REFERENCE></REFERENCE>
<SUMMARY>
<xsl:value-of select="TITLE"/>
<!-- For announcements -->
<xsl:value-of select="TITLE/@value"/>
</SUMMARY>
<ALLTEXT>
<xsl:value-of select="MAINDATA/TEXT"/>
<!-- For announcements -->
<xsl:value-of select="DESCRIPTION/TEXT"/>
</ALLTEXT>
<POPUP></POPUP>
<OPTIONS></OPTIONS>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- Creates one module-link entry -->
<xsl:template name="module_link" >
<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="URL/@value"/>
</NAME>
<TYPE>file</TYPE>
<REFERENCE>
<xsl:value-of select="URL/@value"/>
</REFERENCE>
<SUMMARY>
<xsl:value-of select="TITLE/@value"/>&lt;br/&gt;
<xsl:value-of select="URL/@value"/>
</SUMMARY>
<ALLTEXT>
<xsl:value-of select="DESCRIPTION/TEXT"/>
</ALLTEXT>
<POPUP></POPUP>
<OPTIONS>frame</OPTIONS>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- ############# Modules Decisions ############# -->
<!-- Creates all module entries -->
<xsl:template name="modules" match="resource">
<!-- Create the News Forum Module -->
<xsl:call-template name="news_forum_mod">
<xsl:with-param name="mod_number" >1</xsl:with-param>
</xsl:call-template>
<!-- Create all other modules -->
<xsl:for-each select="//resource">
<xsl:variable name="mod_number" select="substring-after(@identifier,'res')"/>
<xsl:for-each select="document(concat('',@file))">
<xsl:apply-templates select="//FORUM">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
<xsl:apply-templates select="//CONTENT">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
<xsl:apply-templates select="//EXTERNALLINK">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<!-- Create an EXTERNALLINK module entry -->
<xsl:template match="EXTERNALLINK">
<xsl:param name="mod_number">1. </xsl:param>
<!-- Every link module will have a label module describing it -->
<xsl:call-template name="module_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
<xsl:call-template name="module_link">
<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>
<xsl:choose>
<!-- Detected a file -->
<xsl:when test="FILES/FILEREF/RELFILE/@value != ''">
<!-- Every file module will have a label module describing it -->
<xsl:call-template name="module_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
<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:call-template>
</xsl:for-each>
</xsl:when>
<!-- Detected a folder -->
<xsl:when test="FLAGS/ISFOLDER/@value = 'true'">
<xsl:call-template name="module_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
</xsl:when>
<!-- Detected text -->
<xsl:when test="MAINDATA/FLAGS/ISHTML/@value = 'true'">
<xsl:call-template name="module_text">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<UNKNOWN>
<xsl:value-of select="TITLE"/>
</UNKNOWN>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ############# Forum conversion ################# -->
<xsl:template match="FORUM">
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>forum</MODTYPE>
<TYPE>general</TYPE>
<NAME>
<xsl:value-of select="TITLE/@value"/>
</NAME>
<INTRO>
<xsl:value-of select="DESCRIPTION/TEXT"/>
</INTRO>
<OPEN>2</OPEN>
<ASSESSED>0</ASSESSED>
<ASSESSPUBLIC>0</ASSESSPUBLIC>
<ASSESSTIMESTART>0</ASSESSTIMESTART>
<ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
<MAXBYTES>0</MAXBYTES>
<SCALE>0</SCALE>
<FORCESUBSCRIBE>0</FORCESUBSCRIBE>
<RSSTYPE>0</RSSTYPE>
<RSSARTICLES>0</RSSARTICLES>
<TIMEMODIFIED></TIMEMODIFIED>
<!--
<DISCUSSIONS>
<xsl:for-each select="MESSAGETHREADS/MSG">
<xsl:variable name="discussion_id" select="position()"/>
<DISCUSSION>
<ID>
<xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>
</ID>
<NAME>
<xsl:value-of select="TITLE/@value"/>
</NAME>
<FIRSTPOST>2</FIRSTPOST>
<USERID>1</USERID>
<GROUPID>-1</GROUPID>
<ASSESSED>1</ASSESSED>
<TIMEMODIFIED>1094748430</TIMEMODIFIED>
<USERMODIFIED>1</USERMODIFIED>
<POSTS>
<xsl:call-template name="MSG">
<xsl:with-param name="parent" select="0"/>
<xsl:with-param name="post_id">
<xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>0<xsl:value-of select="position()"/>
</xsl:with-param>
</xsl:call-template>
</POSTS>
</DISCUSSION>
</xsl:for-each>
</DISCUSSIONS>
-->
</MOD>
</xsl:template>
<xsl:template name="MSG" match="MSG">
<xsl:param name="parent" select="1"/>
<xsl:param name="post_id" select="1"/>
<POST>
<ID><xsl:value-of select="$post_id"/></ID>
<PARENT> <xsl:value-of select="$parent"/></PARENT>
<USERID>1</USERID>
<CREATED>1094748430</CREATED>
<MODIFIED>1094748430</MODIFIED>
<MAILED>1</MAILED>
<SUBJECT><xsl:value-of select="TITLE/@value"/></SUBJECT>
<MESSAGE><xsl:value-of select="MESSAGETEXT"/></MESSAGE>
<FORMAT>1</FORMAT>
<ATTACHMENT></ATTACHMENT>
<TOTALSCORE>0</TOTALSCORE>
</POST>
<xsl:for-each select="MSG">
<xsl:call-template name="MSG">
<xsl:with-param name="parent" select="$post_id"/>
<xsl:with-param name="post_id">
<xsl:value-of select="$post_id"/>0<xsl:value-of select="position()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="news_forum_section_mod" >
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID>1</ID>
<ZIBA_NAME>
News forum
</ZIBA_NAME>
<TYPE>news</TYPE>
<INSTANCE>1</INSTANCE>
<ADDED>1094240775</ADDED>
<DELETED>0</DELETED>
<SCORE>0</SCORE>
<INDENT>0</INDENT>
<VISIBLE>1</VISIBLE>
<GROUPMODE>0</GROUPMODE>
</MOD>
</xsl:template>
<xsl:template name="news_forum_mod" >
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>forum</MODTYPE>
<TYPE>news</TYPE>
<NAME>News forum</NAME>
<INTRO>General news and announcements</INTRO>
<OPEN>2</OPEN>
<ASSESSED>0</ASSESSED>
<ASSESSPUBLIC>0</ASSESSPUBLIC>
<ASSESSTIMESTART>0</ASSESSTIMESTART>
<ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
<MAXBYTES>0</MAXBYTES>
<SCALE>0</SCALE>
<FORCESUBSCRIBE>0</FORCESUBSCRIBE>
<RSSTYPE>0</RSSTYPE>
<RSSARTICLES>0</RSSARTICLES>
<TIMEMODIFIED></TIMEMODIFIED>
<DISCUSSIONS>
<xsl:for-each select="//resource">
<xsl:variable name="m_number" select="substring-after(@identifier,'res')"/>
<xsl:variable name="discussion_id" select="position()"/>
<xsl:for-each select="document(concat('',@file))">
<xsl:if test="//ANNOUNCEMENT/TITLE/@value != ''">
<xsl:call-template name="ANNOUNCEMENT">
<xsl:with-param name="discussion_id" select="$discussion_id"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</DISCUSSIONS>
</MOD>
</xsl:template>
<!-- Create an ANNOUNCEMENT forum entry -->
<xsl:template name="ANNOUNCEMENT" >
<xsl:param name="discussion_id">1. </xsl:param>
<DISCUSSION>
<ID>
<xsl:value-of select="$discussion_id"/>
</ID>
<NAME><xsl:value-of select="//ANNOUNCEMENT/TITLE/@value"/></NAME>
<FIRSTPOST><xsl:value-of select="$discussion_id"/></FIRSTPOST>
<USERID>1</USERID>
<GROUPID>-1</GROUPID>
<ASSESSED>1</ASSESSED>
<TIMEMODIFIED>1094748430</TIMEMODIFIED>
<USERMODIFIED>1</USERMODIFIED>
<POSTS>
<POST>
<ID><xsl:value-of select="$discussion_id"/></ID>
<PARENT>0</PARENT>
<USERID>1</USERID>
<CREATED>1094748430</CREATED>
<MODIFIED>1094748430</MODIFIED>
<MAILED>1</MAILED>
<SUBJECT><xsl:value-of select="//ANNOUNCEMENT/TITLE/@value"/></SUBJECT>
<MESSAGE><xsl:value-of select="//ANNOUNCEMENT/DESCRIPTION/TEXT"/></MESSAGE>
<FORMAT>1</FORMAT>
<ATTACHMENT></ATTACHMENT>
<TOTALSCORE>0</TOTALSCORE>
</POST>
</POSTS>
</DISCUSSION>
<!--
<xsl:call-template name="MSG">
<xsl:with-param name="parent" select="0"/>
<xsl:with-param name="post_id">
<xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>0<xsl:value-of select="position()"/>
</xsl:with-param>
</xsl:call-template>
-->
</xsl:template>
</xsl:stylesheet>
-690
View File
@@ -1,690 +0,0 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:template match="/">
<MOODLE_BACKUP>
<INFO>
<NAME>backup-from-blackboard.zip</NAME>
<MOODLE_VERSION>2004083100</MOODLE_VERSION>
<MOODLE_RELEASE>1.4</MOODLE_RELEASE>
<BACKUP_VERSION>2004083100</BACKUP_VERSION>
<BACKUP_RELEASE>1.4</BACKUP_RELEASE>
<DATE>1094240862</DATE>
<ORIGINAL_WWWROOT>INSERT URL HERE</ORIGINAL_WWWROOT>
<DETAILS>
<MOD>
<NAME>assignment</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>chat</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>choice</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>forum</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>glossary</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>journal</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>label</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>lesson</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>quiz</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>resource</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>scorm</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>survey</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>wiki</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<MOD>
<NAME>workshop</NAME>
<INCLUDED>true</INCLUDED>
<USERINFO>true</USERINFO>
</MOD>
<USERS>course</USERS>
<LOGS>false</LOGS>
<USERFILES>true</USERFILES>
<COURSEFILES>true</COURSEFILES>
</DETAILS>
</INFO>
<COURSE>
<!-- Get course specific information -->
<xsl:apply-templates select="document('res00001.dat')//COURSE"/>
<xsl:call-template name="modules" />
<SECTIONS>
<!-- Create a title section -->
<xsl:for-each select="document('res00001.dat')" >
<xsl:call-template name="title_section" />
</xsl:for-each>
<!-- Create a topic for each top level Bb item and add section modules ONE folder deep -->
<xsl:for-each select="manifest/organizations/organization/item">
<xsl:variable name="section_number" select="position()"/>
<xsl:call-template name="sections">
<xsl:with-param name="section_number" select="$section_number"/>
<xsl:with-param name="recurse" >false</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<!-- Create a topic for each second level Bb item which is a folder, recursively make section modules -->
<xsl:for-each select="manifest/organizations/organization/item/item">
<xsl:sort order="descending" select="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value"/>
<xsl:if test="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value = 'true'">
<xsl:variable name="prev_sections" select="count(/manifest/organizations/tableofcontents/item)"/>
<xsl:variable name="section_number" select="position()+$prev_sections"/>
<xsl:call-template name="sections">
<xsl:with-param name="section_number" select="$section_number"/>
<xsl:with-param name="recurse" >true</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</SECTIONS>
</COURSE>
</MOODLE_BACKUP>
</xsl:template>
<xsl:template match="COURSE">
<HEADER>
<ID>2</ID>
<CATEGORY>
<ID></ID>
<NAME><xsl:value-of select="CATEGORIES/CATEGORY/@value"/></NAME>
</CATEGORY>
<PASSWORD></PASSWORD>
<IDNUMBER>4</IDNUMBER>
<FORMAT>topics</FORMAT>
<SHOWGRADES>1</SHOWGRADES>
<BLOCKINFO>participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity</BLOCKINFO>
<NEWSITEMS>5</NEWSITEMS>
<TEACHER>Teacher</TEACHER>
<TEACHERS>Teachers</TEACHERS>
<STUDENT>Student</STUDENT>
<STUDENTS>Students</STUDENTS>
<GUEST>0</GUEST>
<STARTDATE>1094270400</STARTDATE>
<ENROLPERIOD>0</ENROLPERIOD>
<NUMSECTIONS>10</NUMSECTIONS>
<MAXBYTES>2097152</MAXBYTES>
<SHOWREPORTS>0</SHOWREPORTS>
<GROUPMODE>0</GROUPMODE>
<GROUPMODEFORCE>0</GROUPMODEFORCE>
<LANG></LANG>
<COST></COST>
<MARKER>0</MARKER>
<VISIBLE>1</VISIBLE>
<HIDDENSECTIONS>0</HIDDENSECTIONS>
<TIMECREATED>1094240775</TIMECREATED>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
<SUMMARY><xsl:value-of select="DESCRIPTION"/></SUMMARY>
<SHORTNAME><xsl:value-of select="COURSEID/@value"/></SHORTNAME>
<FULLNAME><xsl:value-of select="TITLE/@value"/></FULLNAME>
</HEADER>
</xsl:template>
<xsl:template name="title_section" match="resource">
<SECTION>
<ID>0</ID>
<NUMBER>0</NUMBER>
<SUMMARY>&lt;div style="text-align: center;"&gt;&lt;font size="5" style="font-family: arial,helvetica,sans-serif;"&gt;<xsl:value-of select="COURSE/TITLE/@value"/>&lt;/font&gt;&lt;/div&gt;
<xsl:value-of select="COURSE/DESCRIPTION"/>
</SUMMARY>
<VISIBLE>1</VISIBLE>
<MODS>
</MODS>
</SECTION>
</xsl:template>
<xsl:template name="sections" match="resource">
<xsl:param name="section_number">1. </xsl:param>
<xsl:param name="recurse"/>
<SECTION>
<ID><xsl:value-of select="$section_number"/></ID>
<NUMBER><xsl:value-of select="$section_number"/></NUMBER>
<SUMMARY>&lt;span style="font-weight: bold;"&gt;<xsl:value-of select="title"/>&lt;/span&gt;</SUMMARY>
<VISIBLE>1</VISIBLE>
<MODS>
<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"/>
<xsl:with-param name="indent" >0</xsl:with-param>
<xsl:with-param name="recurse" select="$recurse" />
</xsl:call-template>
</xsl:if>
<xsl:if test="$recurse = 'false'">
<xsl:for-each select="item">
<xsl:variable name="mod_number" select="substring-after(@identifierref,'res')"/>
<xsl:call-template name="item" >
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" >0</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</MODS>
</SECTION>
</xsl:template>
<xsl:template name="item_recurse_files">
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<xsl:param name="recurse"/>
<!-- Create one section-mod -->
<xsl:for-each select="document(concat(@identifierref,'.dat'))">
<xsl:call-template name="section_mod">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:for-each>
<!-- Depth first recursion to preserve order -->
<xsl:for-each select="item">
<xsl:variable name="m_number" select="substring-after(@identifierref,'res')"/>
<xsl:call-template name="item_recurse_files" >
<xsl:with-param name="mod_number" select="$m_number"/>
<xsl:with-param name="indent" select="$indent + 1"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="item">
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<GETHERE></GETHERE>
<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">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:template>
<!-- Determines the type of section mod entry and calls the appropriate creation template -->
<xsl:template name="section_mod" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="contenttype" />
<xsl:param name="indent">1. </xsl:param>
<!-- Every file will have a label module describing it -->
<xsl:choose>
<!-- Detected a file -->
<xsl:when test="CONTENT/FILE/@id != '' or CONTENT/FILES/FILE/NAME != ''">
<!-- Create a label -->
<xsl:call-template name="section_mod_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
<!-- Create a resource -->
<xsl:call-template name="section_mod_resource">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:when>
<!-- Detected a folder -->
<xsl:when test="CONTENT/FLAGS/ISFOLDER/@value = 'true'">
<MAKINGLABEL></MAKINGLABEL>
<!-- Create a label -->
<xsl:call-template name="section_mod_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:when>
<!-- Detected text -->
<xsl:when test="CONTENT/MAINDATA/FLAGS/ISHTML/@value = 'true' or CONTENT/BODY/TYPE/@value = 'H' ">
<MAKINGTEXT></MAKINGTEXT>
<!-- Create a resource -->
<xsl:call-template name="section_mod_resource">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:when>
<!-- Detected external link -->
<xsl:when test="EXTERNALLINK/TITLE/@value != '' ">
<!-- Create a label -->
<xsl:call-template name="section_mod_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
<!-- Create a resource -->
<xsl:call-template name="section_mod_externallink">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="indent" select="$indent"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<UNKNOWN>
</UNKNOWN>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Creates one section-mod-label -->
<xsl:template name="section_mod_label" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<MOD>
<ID>1<xsl:value-of select="$mod_number"/>0</ID>
<ZIBA_NAME>
<!-- BB5.5 -->
<xsl:value-of select="CONTENT/TITLE"/>
<!-- BB6 -->
<xsl:value-of select="CONTENT/TITLE/@value"/>
</ZIBA_NAME>
<TYPE>label</TYPE>
<INSTANCE><xsl:value-of select="$mod_number"/></INSTANCE>
<ADDED>1094240775</ADDED>
<DELETED>0</DELETED>
<SCORE>0</SCORE>
<INDENT><xsl:value-of select="$indent"/></INDENT>
<VISIBLE>1</VISIBLE>
<GROUPMODE>0</GROUPMODE>
</MOD>
</xsl:template>
<!-- Creates one section-mod-resource -->
<xsl:template name="section_mod_resource" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/>0</ID>
<ZIBA_NAME>
<!-- BB5.5 -->
<xsl:value-of select="CONTENT/TITLE"/>
<!-- BB6 -->
<xsl:value-of select="CONTENT/TITLE/@value"/>
</ZIBA_NAME>
<TYPE>resource</TYPE>
<INSTANCE><xsl:value-of select="$mod_number"/></INSTANCE>
<ADDED>1094240775</ADDED>
<DELETED>0</DELETED>
<SCORE>0</SCORE>
<INDENT><xsl:value-of select="$indent"/></INDENT>
<VISIBLE>1</VISIBLE>
<GROUPMODE>0</GROUPMODE>
</MOD>
</xsl:template>
<!-- Creates one section-mod-externallink -->
<xsl:template name="section_mod_externallink" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="indent">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/>0</ID>
<ZIBA_NAME>
<xsl:value-of select="EXTERNALLINK/TITLE/@value"/>
</ZIBA_NAME>
<TYPE>resource</TYPE>
<INSTANCE><xsl:value-of select="$mod_number"/></INSTANCE>
<ADDED>1094240775</ADDED>
<DELETED>0</DELETED>
<SCORE>0</SCORE>
<INDENT><xsl:value-of select="$indent"/></INDENT>
<VISIBLE>1</VISIBLE>
<GROUPMODE>0</GROUPMODE>
</MOD>
</xsl:template>
<!-- Creates a module-label entry -->
<xsl:template name="module_label" >
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>label</MODTYPE>
<NAME>
<!-- for CONTENT text -->
<xsl:value-of select="TITLE"/>
<!-- for EXTERNALLINK text -->
<xsl:value-of select="TITLE/@value"/>
</NAME>
<CONTENT>
&lt;span style="font-style: italic;"&gt;
<!-- for CONTENT text -->
<xsl:value-of select="TITLE"/>
<!-- for EXTERNALLINK text -->
<xsl:value-of select="TITLE/@value"/>
:&lt;/span&gt;
<!-- for CONTENT text -->
<xsl:value-of select="MAINDATA/TEXT"/>
<!-- for EXTERNALLINK text -->
<xsl:value-of select="DESCRIPTION/TEXT"/>
<!-- for BB6 text -->
<xsl:value-of select="BODY/TEXT"/>
</CONTENT>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- Creates one module-file entry -->
<xsl:template name="module_file" >
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="identifier"/>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>resource</MODTYPE>
<NAME>
<!-- BB5 -->
<xsl:value-of select="FILES/FILEREF/RELFILE/@value"/>
<!-- BB6 -->
<xsl:value-of select="FILES/FILE/NAME"/>
</NAME>
<TYPE>file</TYPE>
<REFERENCE><!-- BB5 --><xsl:value-of select="FILES/FILEREF/CONTENTID/@value"/><!-- BB6 --><xsl:value-of select="$identifier"/>/<!-- BB5 --><xsl:value-of select="FILES/FILEREF/RELFILE/@value"/><!-- BB6 --><xsl:value-of select="FILES/FILE/NAME"/></REFERENCE>
<SUMMARY>
<xsl:value-of select="MAINDATA/TEXT"/>
</SUMMARY>
<ALLTEXT></ALLTEXT>
<POPUP></POPUP>
<OPTIONS>frame</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>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>resource</MODTYPE>
<NAME>
<!-- BB5.5 -->
<xsl:value-of select="TITLE"/>
<!-- BB6 -->
<xsl:value-of select="TITLE/@value"/>
</NAME>
<TYPE>text</TYPE>
<REFERENCE></REFERENCE>
<SUMMARY>
<!-- BB5.5 -->
<xsl:value-of select="TITLE"/>
<!-- BB6 -->
<xsl:value-of select="TITLE/@value"/>
</SUMMARY>
<ALLTEXT>
<!-- BB5.5 -->
<xsl:value-of select="MAINDATA/TEXT"/>
<!-- BB6 -->
<xsl:value-of select="BODY/TEXT"/>
</ALLTEXT>
<POPUP></POPUP>
<OPTIONS></OPTIONS>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- Creates one module-link entry -->
<xsl:template name="module_link" >
<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="URL/@value"/>
</NAME>
<TYPE>file</TYPE>
<REFERENCE>
<xsl:value-of select="URL/@value"/>
</REFERENCE>
<SUMMARY>
<xsl:value-of select="TITLE/@value"/>&lt;br/&gt;
<xsl:value-of select="URL/@value"/>
</SUMMARY>
<ALLTEXT>
<xsl:value-of select="DESCRIPTION/TEXT"/>
</ALLTEXT>
<POPUP></POPUP>
<OPTIONS>frame</OPTIONS>
<TIMEMODIFIED>1094240775</TIMEMODIFIED>
</MOD>
</xsl:template>
<!-- Create a CONTENT module entries -->
<xsl:template match="EXTERNALLINK">
<xsl:param name="mod_number">1. </xsl:param>
<!-- Every link module will have a label module describing it -->
<xsl:call-template name="module_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
<xsl:call-template name="module_link">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
</xsl:template>
<!-- Create a CONTENT module entries -->
<xsl:template match="CONTENT">
<xsl:param name="mod_number">1. </xsl:param>
<xsl:param name="identifier"/>
<xsl:choose>
<!-- Detected a file
<FILEFOUND></FILEFOUND>
-->
<xsl:when test="FILES/FILE/@id != ''">
<!-- Every file module will have a label module describing it -->
<xsl:call-template name="module_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
<xsl:call-template name="module_file">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="identifier" select="$identifier"/>
</xsl:call-template>
</xsl:when>
<!-- Detected a folder
<FOLDERFOUND></FOLDERFOUND>
-->
<xsl:when test="FLAGS/ISFOLDER/@value = 'true'">
<xsl:call-template name="module_label">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
</xsl:when>
<!-- Detected text
<TEXTFOUND></TEXTFOUND>
-->
<xsl:when test="MAINDATA/FLAGS/ISHTML/@value = 'true' or BODY/TYPE/@value = 'H' ">
<xsl:call-template name="module_text">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<UNKNOWN>
<xsl:value-of select="TITLE"/>
</UNKNOWN>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Creates all module entries -->
<xsl:template name="modules" match="resource">
<MODULES>
<xsl:for-each select="//resource">
<xsl:variable name="mod_number" select="substring-after(@identifier,'res')"/>
<xsl:variable name="identifier" select="@identifier"/>
<xsl:for-each select="document(concat(@identifier,'.dat'))">
<xsl:apply-templates select="//FORUM">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
<xsl:apply-templates select="//CONTENT">
<xsl:with-param name="mod_number" select="$mod_number"/>
<xsl:with-param name="identifier" select="$identifier"/>
</xsl:apply-templates>
<xsl:apply-templates select="//EXTERNALLINK">
<xsl:with-param name="mod_number" select="$mod_number"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:for-each>
</MODULES>
</xsl:template>
<!-- ############# Forum conversion ################# -->
<xsl:template match="FORUM">
<xsl:param name="mod_number">1. </xsl:param>
<MOD>
<ID><xsl:value-of select="$mod_number"/></ID>
<MODTYPE>forum</MODTYPE>
<TYPE>general</TYPE>
<NAME>
<xsl:value-of select="TITLE/@value"/>
</NAME>
<INTRO>
<xsl:value-of select="DESCRIPTION/TEXT"/>
</INTRO>
<OPEN>2</OPEN>
<ASSESSED>0</ASSESSED>
<ASSESSPUBLIC>0</ASSESSPUBLIC>
<ASSESSTIMESTART>0</ASSESSTIMESTART>
<ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
<MAXBYTES>0</MAXBYTES>
<SCALE>0</SCALE>
<FORCESUBSCRIBE>0</FORCESUBSCRIBE>
<RSSTYPE>0</RSSTYPE>
<RSSARTICLES>0</RSSARTICLES>
<TIMEMODIFIED></TIMEMODIFIED>
<!--
<DISCUSSIONS>
<xsl:for-each select="MESSAGETHREADS/MSG">
<xsl:variable name="discussion_id" select="position()"/>
<DISCUSSION>
<ID>
<xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>
</ID>
<NAME>
<xsl:value-of select="TITLE/@value"/>
</NAME>
<FIRSTPOST>2</FIRSTPOST>
<USERID>1</USERID>
<GROUPID>-1</GROUPID>
<ASSESSED>1</ASSESSED>
<TIMEMODIFIED>1094748430</TIMEMODIFIED>
<USERMODIFIED>1</USERMODIFIED>
<POSTS>
<xsl:call-template name="MSG">
<xsl:with-param name="parent" select="0"/>
<xsl:with-param name="post_id">
<xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>0<xsl:value-of select="position()"/>
</xsl:with-param>
</xsl:call-template>
</POSTS>
</DISCUSSION>
</xsl:for-each>
</DISCUSSIONS>
-->
</MOD>
</xsl:template>
<xsl:template name="MSG" match="MSG">
<xsl:param name="parent" select="1"/>
<xsl:param name="post_id" select="1"/>
<POST>
<ID><xsl:value-of select="$post_id"/></ID>
<PARENT> <xsl:value-of select="$parent"/></PARENT>
<USERID>1</USERID>
<CREATED>1094748430</CREATED>
<MODIFIED>1094748430</MODIFIED>
<MAILED>1</MAILED>
<SUBJECT><xsl:value-of select="TITLE/@value"/></SUBJECT>
<MESSAGE><xsl:value-of select="MESSAGETEXT"/></MESSAGE>
<FORMAT>1</FORMAT>
<ATTACHMENT></ATTACHMENT>
<TOTALSCORE>0</TOTALSCORE>
</POST>
<xsl:for-each select="MSG">
<xsl:call-template name="MSG">
<xsl:with-param name="parent" select="$post_id"/>
<xsl:with-param name="post_id">
<xsl:value-of select="$post_id"/>0<xsl:value-of select="position()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-89
View File
@@ -1,89 +0,0 @@
<?php
// This file facilitates the conversion of a Blackboard course export
// into a Moodle course export. It assumes an unzipped directory and makes in-place alterations.
// Ziba Scott <ziba@linuxbox.com> 10-25-04
function get_subdirs($directory){
$opendirectory = opendir( $directory );
while($filename = readdir($opendirectory)) {
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
$subdirs[] = $filename;
}
}
closedir($opendirectory);
return $subdirs;
}
function choose_bb_xsl($manifest){
$f = fopen($manifest,"r");
$buffer = fgets($f, 400);
$buffer = fgets($f, 400);
fclose($f);
if (strstr($buffer,"xmlns:bb=\"http://www.blackboard.com/content-packaging/\"")){
return "bb6_to_moodle.xsl";
}
return "bb5.5_to_moodle.xsl";
}
function blackboard_convert($dir){
global $CFG;
// Check for a Blackboard manifest file
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');
return false;
}
//Select the proper XSL file
$xslt_file = choose_bb_xsl($dir.'/imsmanifest.xml');
//TODO: Use the get_string function for this
echo "<li>Converting Blackboard export</li>";
// The XSL file must be in the same directory as the Blackboard files when it is processed
if (!copy($CFG->dirroot."/backup/bb/$xslt_file", "$dir/$xslt_file")) {
notify('Could not copy the XSLT file to '."$dir/$xslt_file");
return false;
}
// Change to that directory
$startdir = getcwd();
chdir($dir);
// Process the Blackboard XML files with the chosen XSL file.
// The imsmanifest contains all the XML files and their relationships.
// The XSL processor will open them as needed.
$xsltproc = xslt_create();
if (!xslt_process($xsltproc, 'imsmanifest.xml', "$dir/$xslt_file", "$dir/moodle.xml")) {
notify('Failed writing xml file');
chdir($startdir);
return false;
}
// Copy the Blackboard course files into the moodle course_files structure
$subdirs = get_subdirs($dir."/");
mkdir("$dir/course_files");
foreach ($subdirs as $subdir){
rename($subdir, "course_files/$subdir");
}
chdir($startdir);
// Blackboard export successfully converted
return true;
}
// This is not a Blackboard export
return true;
}
?>
+31 -55
View File
@@ -20,9 +20,6 @@
if (!isset($backup_config->backup_sche_withuserdata)) {
$backup_config->backup_sche_withuserdata = 1;
}
if (!isset($backup_config->backup_sche_metacourse)) {
$backup_config->backup_sche_metacourse = 1;
}
if (!isset($backup_config->backup_sche_users)) {
$backup_config->backup_sche_users = 1;
}
@@ -35,9 +32,6 @@
if (!isset($backup_config->backup_sche_coursefiles)) {
$backup_config->backup_sche_coursefiles = 1;
}
if (!isset($backup_config->backup_sche_messages)) {
$backup_config->backup_sche_messages = 0;
}
if (!isset($backup_config->backup_sche_active)) {
$backup_config->backup_sche_active = 0;
}
@@ -88,15 +82,15 @@
$keep_array[500] = "500";
?>
<form method="post" action="backup.php" name="form">
<?php echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\"/>"; ?>
<?php echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">"; ?>
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan ="3" align="center"><strong><?php print_string("settings") ?></strong></td>
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td colspan = 3 align=center><strong><?php print_string("settings") ?></strong></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("includemodules") ?>:</td>
<td nowrap="nowrap">
<tr valign=top>
<td align=right><p><?php print_string("includemodules") ?>:</td>
<td nowrap>
<?php choose_from_menu($yesno_array, "backup_sche_modules", $backup_config->backup_sche_modules, "") ?>
<?php choose_from_menu($withwithout_array, "backup_sche_withuserdata", $backup_config->backup_sche_withuserdata, "") ?>
</td>
@@ -104,17 +98,8 @@
<?php print_string("backupincludemoduleshelp") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("metacourse") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_metacourse", $backup_config->backup_sche_metacourse, "") ?>
</td>
<td>
<?php print_string("backupmetacoursehelp") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("users") ?>:</td>
<tr valign=top>
<td align=right><p><?php print_string("users") ?>:</td>
<td>
<?php choose_from_menu($courseall_array, "backup_sche_users", $backup_config->backup_sche_users, "") ?>
</td>
@@ -122,8 +107,8 @@
<?php print_string("backupusershelp") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("logs") ?>:</td>
<tr valign=top>
<td align=right><p><?php print_string("logs") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_logs", $backup_config->backup_sche_logs, "") ?>
</td>
@@ -131,8 +116,8 @@
<?php print_string("backuplogshelp") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("userfiles") ?>:</td>
<tr valign=top>
<td align=right><p><?php print_string("userfiles") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_userfiles", $backup_config->backup_sche_userfiles, "") ?>
</td>
@@ -140,8 +125,8 @@
<?php print_string("backupuserfileshelp") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("coursefiles") ?>:</td>
<tr valign=top>
<td align=right><p><?php print_string("coursefiles") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_coursefiles", $backup_config->backup_sche_coursefiles, "") ?>
</td>
@@ -149,17 +134,8 @@
<?php print_string("backupcoursefileshelp") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("messages","message") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_messages", $backup_config->backup_sche_messages, "") ?>
</td>
<td>
<?php print_string("backupmessageshelp","message") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("keep") ?>:</td>
<tr valign=top>
<td align=right><p><?php print_string("keep") ?>:</td>
<td>
<?php
choose_from_menu($keep_array, "backup_sche_keep", $backup_config->backup_sche_keep, "");
@@ -170,16 +146,16 @@
<?php print_string("backupkeephelp") ?>
</td>
</tr>
<tr valign="top">
<td colspan="3" align="center"><strong><?php print_string("schedule") ?></strong></td>
<tr valign=top>
<td colspan = 3 align=center><strong><?php print_string("schedule") ?></strong></td>
</tr>
<tr valign="top">
<td colspan="3" align="center">
<tr valign=top>
<td colspan = 3 align=center>
<?php print_string("active") ?>: <?php choose_from_menu($yesno_array, "backup_sche_active", $backup_config->backup_sche_active, "") ?>
</td>
</tr>
<tr>
<td colspan="3" align="center">
<td colspan=3 align=center>
<?php
//Get first day of week from languaje files
//after searching the web I haven't find a sytem to retrieve it in php from locale info
@@ -200,11 +176,11 @@
$stddayofweek = ($i+$firstdayofweek) % 7;
//Calculate the status of the checkbox
if (substr($backup_config->backup_sche_weekdays,$stddayofweek,1) == "1") {
$strchecked = " checked=\"checked\"";
$strchecked = " checked";
} else {
$strchecked = "";
}
$check_names[] = "<input type=\"checkbox\" name=\"dayofweek_$stddayofweek\" value=\"1\"$strchecked />";
$check_names[] = "<input type=\"checkbox\" name=\"dayofweek_$stddayofweek\" value=\"1\"$strchecked>";
$i++;
}
$table->align = array("center","center","center","center","center","center","center");
@@ -214,19 +190,19 @@
?>
</td>
</tr>
<tr valign="top">
<td colspan ="3" align="center">
<tr valign=top>
<td colspan = 3 align=center>
<?php print_string("executeat") ?>: <?php print_time_selector("backup_sche_hour","backup_sche_minute",make_timestamp(2000,1,1,$backup_config->backup_sche_hour,$backup_config->backup_sche_minute)) ?>
</td>
</tr>
<tr valign="top">
<td colspan ="3" align="center">
<?php print_string("saveto") ?>: <input name="backup_sche_destination" type="text" size="40" value="<?php p($backup_config->backup_sche_destination) ?>" /><?php helpbutton("directorypaths", strip_tags(get_string("directorypaths"))) ?><br /><?php if (!empty($sche_destination_error)) { formerr($sche_destination_error); echo "<br />"; } ?><?php print_string("backupsavetohelp") ?>
<tr valign=top>
<td colspan = 3 align=center>
<?php print_string("saveto") ?>: <input name="backup_sche_destination" type="text" size="40" value="<?php p($backup_config->backup_sche_destination) ?>"><?php helpbutton("directorypaths", strip_tags(get_string("directorypaths"))) ?><br><?php if (!empty($sche_destination_error)) { formerr($sche_destination_error); echo "<br>"; } ?><?php print_string("backupsavetohelp") ?>
</td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" value="<?php print_string("savechanges") ?>" /></td>
<td colspan=3 align=center>
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
</tr>
</table>
+1 -1
View File
@@ -67,7 +67,7 @@ function backup_upgrade($oldversion=0) {
}
if ($oldversion < 2003082600 and $result) {
print_simple_box("This is the first non-alpha release of the Backup/Restore module.<p>Thanks for upgrading!","center", "50%", '', "20", "noticebox");
print_simple_box("This is the first non-alpha release of the Backup/Restore module.<p>Thanks for upgrading!","center", "50%", "$THEME->cellheading", "20", "noticebox");
}
if ($oldversion < 2003112700 and $result) {
+4 -10
View File
@@ -2,8 +2,6 @@
//This file contains all the general function needed (file manipulation...)
//not directly part of the backup/restore utility
require_once($CFG->dirroot.'/lib/uploadlib.php');
//Sets a name/value pair in backup_config table
function backup_set_config($name, $value) {
if (get_field("backup_config", "name", "name", $name)) {
@@ -285,21 +283,17 @@
global $CFG;
if (is_file($from_file)) {
//echo "<br />Copying ".$from_file." to ".$to_file; //Debug
//echo "<br>Copying ".$from_file." to ".$to_file; //Debug
//$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)) {
clam_log_upload($to_file,null,true);
return true;
}
return false;
return copy($from_file,$to_file) && chmod($to_file,$CFG->directorypermissions);
}
else if (is_dir($from_file)) {
return backup_copy_dir($from_file,$to_file);
}
else{
//echo "<br />Error: not file or dir ".$from_file; //Debug
//echo "<br>Error: not file or dir ".$from_file; //Debug
return false;
}
}
@@ -309,7 +303,7 @@
global $CFG;
if (!is_dir($to_file)) {
//echo "<br />Creating ".$to_file; //Debug
//echo "<br>Creating ".$to_file; //Debug
umask(0000);
$status = mkdir($to_file,$CFG->directorypermissions);
}
+26 -26
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
// backup.php - allows admin to edit all configuration variables for scheduled backups
require_once("../config.php");
@@ -44,37 +44,37 @@
$strlogs);
print_heading($backuploglaststatus);
print_simple_box_start('center');
print_simple_box_start("center", "", "$THEME->cellheading");
//Now, get every record from backup_courses
$courses = get_records("backup_courses");
if (!$courses) {
notify("No logs found!");
} else {
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
echo "<table border=0 align=center cellpadding=3 cellspacing=3>";
//Print table header
echo "<tr>";
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strcourse</font></td>";
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\"><font size=\"3\">$strtimetaken</font></td>";
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strstatus</font></td>";
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
echo "<tr nowrap>";
echo "<td nowrap align=center><font size=3>$strcourse</font></td>";
echo "<td nowrap align=center colspan=3><font size=3>$strtimetaken</font></td>";
echo "<td nowrap align=center><font size=3>$strstatus</font></td>";
echo "<td nowrap align=center><font size=3>$strnext</font></td>";
foreach ($courses as $course) {
//Get the course shortname
$coursename = get_field ("course","fullname","id",$course->courseid);
if ($coursename) {
echo "<tr>";
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"log.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->laststarttime,$strftimedatetime)."</font></td>";
echo "<td nowrap=\"nowrap\"><font size=\"2\"> - </font></td>";
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->lastendtime,$strftimedatetime)."</font></td>";
echo "<tr nowrap>";
echo "<td nowrap><font size=2><a href=\"log.php?courseid=$course->courseid\">".$coursename."</a></td>";
echo "<td nowrap><font size=2>".userdate($course->laststarttime,$strftimedatetime)."</td>";
echo "<td nowrap><font size=2> - </td>";
echo "<td nowrap><font size=2>".userdate($course->lastendtime,$strftimedatetime)."</td>";
if ($course->laststatus == 1) {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
echo "<td nowrap align=center><font size=2 color=green>".$strok."</td>";
} else if ($course->laststatus == 2) {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
echo "<td nowrap align=center><font size=2 color=red>".$strunfinished."</td>";
} else {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
echo "<td nowrap align=center><font size=2 color=red>".$strerror."</td>";
}
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($course->nextstarttime,$strftimedatetime)."</font></td>";
echo "<td nowrap><font size=2>".userdate($course->nextstarttime,$strftimedatetime)."</td>";
echo "</tr>";
}
}
@@ -95,7 +95,7 @@
$coursename = get_field("course","fullname","id","$courseid");
print_heading("$strcourse: $coursename");
print_simple_box_start('center');
print_simple_box_start("center", "", "$THEME->cellheading");
//First, me get all the distinct backups for that course in backup_log
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
@@ -107,10 +107,10 @@
if (!$executions) {
notify("No logs found!");
} else {
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
echo "<table border=0 align=center cellpadding=3 cellspacing=3>";
foreach($executions as $execution) {
echo "<tr>";
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
echo "<tr nowrap>";
echo "<td nowrap align=center colspan=3>";
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
echo "</td>";
echo "</tr>";
@@ -121,11 +121,11 @@
ORDER BY id");
if ($logs) {
foreach ($logs as $log) {
echo "<tr>";
echo "<td nowrap=\"nowrap\"><font size=\"2\">".userdate($log->time,$strftimetime)."</font></td>";
$log->info = str_replace("- ERROR!!","- <font color=\"red\">ERROR!!</font>",$log->info);
$log->info = str_replace("- OK","- <font color=\"green\">OK</font>",$log->info);
echo "<td nowrap=\"nowrap\"><font size=\"2\">".str_replace(" ","&nbsp;&nbsp;&nbsp;&nbsp;",$log->info)."</font></td>";
echo "<tr nowrap>";
echo "<td nowrap><font size=2>".userdate($log->time,$strftimetime)."</font></td>";
$log->info = str_replace("- ERROR!!","- <font color=red>ERROR!!</font>",$log->info);
$log->info = str_replace("- OK","- <font color=green>OK</font>",$log->info);
echo "<td nowrap><font size=2>".str_replace(" ","&nbsp;&nbsp;&nbsp;&nbsp;",$log->info)."</font></td>";
echo "</tr>";
}
}
+9 -34
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This script is used to configure and execute the restore proccess.
//Define some globals for all the script
@@ -9,33 +9,20 @@
require_once ("../course/lib.php");
require_once ("lib.php");
require_once ("restorelib.php");
require_once ("bb/restore_bb.php");
require_once("$CFG->libdir/blocklib.php");
require_once("$CFG->libdir/wiki_to_markdown.php" );
//Optional
optional_variable($id);
optional_variable($file);
optional_variable($cancel);
optional_variable($launch);
optional_variable($to);
//Check login
require_login();
if (!$to && isset($SESSION->restore->restoreto) && isset($SESSION->restore->importing) && isset($SESSION->restore->course_id)) {
$to = $SESSION->restore->course_id;
}
if (!empty($id)) {
if (!isteacheredit($id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -53,24 +40,20 @@
//Check backup_version
if ($file) {
$linkto = "restore.php?id=".$id."&amp;file=".$file;
$linkto = "restore.php?id=".$id."&file=".$file;
} else {
$linkto = "restore.php";
}
upgrade_backup_db($linkto);
//Get strings
if (empty($to)) {
$strcourserestore = get_string("courserestore");
} else {
$strcourserestore = get_string("importdata");
}
$strcourserestore = get_string("courserestore");
$stradministration = get_string("administration");
//If no file has been selected from the FileManager, inform and end
if (!$file) {
print_header("$site->shortname: $strcourserestore", $site->fullname,
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcourserestore");
"<A HREF=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</A> -> $strcourserestore");
print_heading(get_string("nofilesselected"));
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
print_footer();
@@ -80,7 +63,7 @@
//If cancel has been selected, inform and end
if ($cancel) {
print_header("$site->shortname: $strcourserestore", $site->fullname,
"<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> $strcourserestore");
"<A HREF=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</A> -> $strcourserestore");
print_heading(get_string("restorecancelled"));
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
print_footer();
@@ -107,26 +90,18 @@
$strcourserestore");
}
//Print form
print_heading("$strcourserestore".((empty($to) ? ': '.basename($file) : '')));
print_simple_box_start('center');
print_heading("$strcourserestore: ".basename($file));
print_simple_box_start("center", "", "$THEME->cellheading");
//Adjust some php variables to the execution of this script
@ini_set("max_execution_time","3000");
raise_memory_limit("memory_limit","128M");
//Call the form, depending the step we are
if (!$launch) {
include_once("restore_precheck.html");
} else if ($launch == "form") {
if ($SESSION->restore->importing) {
// set up all the config stuff and skip asking the user about it.
restore_setup_for_check($SESSION->restore,$backup_unique_code);
include_once("restore_execute.html");
} else {
include_once("restore_form.html");
}
include_once("restore_form.html");
} else if ($launch == "check") {
include_once("restore_check.html");
} else if ($launch == "execute") {
+8 -16
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This page receive all the restore_form data. Then, if existing course
//has been selected, shows a list of courses to select one.
//It cheks that the parammeter from restore_form are coherent.
@@ -49,8 +49,6 @@
}
//restoreto
require_variable($restore_restoreto);
//restore_metacourse
require_variable($restore_metacourse);
//restore_users
require_variable($restore_users);
//restore_logs
@@ -59,8 +57,8 @@
require_variable($restore_user_files);
//restore_course_files
require_variable($restore_course_files);
//restore_messages
require_variable($restore_messages);
//restore_course_files
require_variable($restore_course_files);
//Check we've selected a course
if (!isset($course_id)) {
@@ -81,12 +79,10 @@
}
}
$restore->restoreto=$restore_restoreto;
$restore->metacourse=$restore_metacourse;
$restore->users=$restore_users;
$restore->logs=$restore_logs;
$restore->user_files=$restore_user_files;
$restore->course_files=$restore_course_files;
$restore->messages=$restore_messages;
$restore->course_id=$course_id;
} else {
//We have the object, so check if we have a new course_id
@@ -98,7 +94,7 @@
//We have the object with data, put it in the session
$SESSION->restore = $restore;
//From here to the end of the script, only use the $restore object
//From here to the wnd of the script, only use the $restore object
//Check login
require_login();
@@ -154,9 +150,9 @@
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")) {
print_heading(get_string("choosecourse"));
print_simple_box_start("center");
print_simple_box_start("CENTER");
foreach ($courses as $course) {
echo "<a 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 {
@@ -176,10 +172,6 @@
$changed = true;
}
}
//If we have selected user files or messages, then users must be restored too
if ($restore->user_files || $restore->messages) {
$changed = 1;
}
if ($changed) {
echo get_string ("noteuserschangednonetocourse");
echo "<hr noshade size=\"1\">";
@@ -191,12 +183,12 @@
if ($show_continue_button) {
//Print the continue button to execute the restore NOW !!!!
//All is prepared !!!
echo "<center>";
echo "<CENTER>";
$hidden["launch"] = "execute";
$hidden["file"] = $file;
$hidden["id"] = $id;
print_single_button("restore.php", $hidden, get_string("restorecoursenow"),"post");
echo "</center>";
echo "</CENTER>";
} else {
//Show error
error ("Something was wrong checking restore preferences");
+37 -106
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This page receives the required info and executes the restore
//with the parameters suplied. Whe finished, delete temporary
//data from backup_tables and temp directory
@@ -13,9 +13,6 @@
//Add info->original_wwwroot to $restore to be able to use it in all the restore process
//(mainly when decoding internal links)
$restore->original_wwwroot = $info->original_wwwroot;
//Add info->backup_version to $restore to be able to detect versions in the restore process
//(to decide when to convert wiki texts to markdown...)
$restore->backup_version = $info->backup_backup_version;
//Check login
require_login();
@@ -23,13 +20,7 @@
//Check admin
if (!empty($id)) {
if (!isteacheredit($id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -56,7 +47,7 @@
}
//Start the main table
echo "<table cellpadding=\"5\">";
echo "<table cellpadding=5>";
echo "<tr><td>";
//Start the main ul
@@ -73,19 +64,15 @@
//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>";
echo "<li>".$course_header->course_fullname." (".$course_header->course_shortname.")";
echo "<li>".get_string("category").": ".$course_header->category->name;
echo "</ul>";
//Put the destination course_id
$restore->course_id = $course_header->course_id;
}
@@ -94,17 +81,17 @@
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>';
echo "<li>".get_string("from").": ".$course_header->course_fullname." (".$course_header->course_shortname.")";
echo "<li>".get_string("to").": ".$course->fullname." (".$course->shortname.")";
if (($restore->deleting)) {
echo "<li>".get_string("deletingexistingcoursedata").'</li>';
echo "<li>".get_string("deletingexistingcoursedata");
} else {
echo "<li>".get_string("addingdatatoexisting").'</li>';
echo "<li>".get_string("addingdatatoexisting");
}
echo "</ul></li>";
echo "</ul>";
//If we have selected to restore deleting, we do it now.
if ($restore->deleting) {
echo "<li>".get_string("deletingolddata").'</li>';
echo "<li>".get_string("deletingolddata");
$status = remove_course_contents($restore->course_id,false) and
delete_dir_contents($CFG->dataroot."/".$restore->course_id,"backupdata");
if ($status) {
@@ -125,13 +112,13 @@
if ($status) {
//Into new course
if ($restore->restoreto == 2) {
echo "<li>".get_string("creatingsections").'</li>';
echo "<li>".get_string("creatingsections");
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>';
echo "<li>".get_string("checkingsections");
if (!$status = restore_create_sections($restore,$xml_file)) {
notify("Error creating sections in the existing course.");
}
@@ -142,9 +129,10 @@
}
}
//Now create users as needed
if ($status and ($restore->users == 0 or $restore->users == 1)) {
echo "<li>".get_string("creatingusers")."<br />";
echo "<li>".get_string("creatingusers")."<br>";
if (!$status = restore_create_users($restore,$xml_file)) {
notify("Could not restore users.");
}
@@ -180,7 +168,7 @@
if ($counter % 10 == 0) {
echo ".";
if ($counter % 200 == 0) {
echo "<br />";
echo "<br>";
}
backup_flush(300);
}
@@ -188,8 +176,8 @@
//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 "<li>".get_string("students").": ".$student_count;
echo "<li>".get_string("teachers").": ".$teacher_count;
echo "</ul>";
} else {
notify("No users were found!");
@@ -197,31 +185,17 @@
}
}
//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>";
echo "<li>".get_string("creatingcategoriesandquestions")."<br>";
if (!$status = restore_create_questions($restore,$xml_file)) {
notify("Could not restore categories and questions!");
}
}
//Now create user_files as needed
if ($status and ($restore->user_files)) {
echo "<li>".get_string("copyinguserfiles");
echo "<li>".get_string("copyinguserfiles")."<br>";
if (!$status = restore_user_files($restore)) {
notify("Could not restore user files!");
}
@@ -230,13 +204,13 @@
//Inform about user dirs created from backup
echo "<ul>";
echo "<li>".get_string("userzones").": ".$status;
echo "</li></ul>";
echo "</ul>";
}
}
//Now create course files as needed
if ($status and ($restore->course_files)) {
echo "</li><li>".get_string("copyingcoursefiles")."</li>";
echo "<li>".get_string("copyingcoursefiles")."<br>";
if (!$status = restore_course_files($restore)) {
notify("Could not restore course files!");
}
@@ -249,18 +223,9 @@
}
}
//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>';
echo "<li>".get_string("creatingscales");
if (!$status = restore_create_scales($restore,$xml_file)) {
notify("Could not restore custom scales!");
}
@@ -268,7 +233,7 @@
//Now create groups as needed
if ($status) {
echo "<li>".get_string("creatinggroups").'</li>';
echo "<li>".get_string("creatinggroups");
if (!$status = restore_create_groups($restore,$xml_file)) {
notify("Could not restore groups!");
}
@@ -276,7 +241,7 @@
//Now create events as needed
if ($status) {
echo "<li>".get_string("creatingevents").'</li>';
echo "<li>".get_string("creatingevents");
if (!$status = restore_create_events($restore,$xml_file)) {
notify("Could not restore course events!");
}
@@ -290,20 +255,9 @@
}
}
//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");
echo "<li>".get_string("creatinglogentries");
if (!$status = restore_create_logs($restore,$xml_file)) {
notify("Could not restore logs!");
}
@@ -311,7 +265,7 @@
//Now, if all is OK, adjust the instance field in course_modules !!
if ($status) {
echo "</li><li>".get_string("checkinginstances").'</li>';
echo "<li>".get_string("checkinginstances");
if (!$status = restore_check_instances($restore)) {
notify("Could not adjust instances in course_modules!");
}
@@ -319,7 +273,7 @@
//Now, if all is OK, adjust activity events
if ($status) {
echo "<li>".get_string("refreshingevents").'</li>';
echo "<li>".get_string("refreshingevents");
if (!$status = restore_refresh_events($restore)) {
notify("Could not refresh events for activities!");
}
@@ -333,38 +287,21 @@
}
}
//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>';
echo "<li>".get_string("checkingcourse");
//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>';
echo "<li>".get_string("cleaningtempdata");
if (!$status = clean_temp_data ($restore)) {
notify("Could not clean up temporary data from files and database");
}
@@ -375,21 +312,15 @@
//End the main table
echo "</td></tr>";
echo "</tr></td>";
echo "</table>";
if (!$status) {
error ("An error has occurred and the restore could not be completed!");
}
if (!$restore->importing) {
echo $output;
//Print final message
print_simple_box(get_string("restorefinished"),"center");
} else {
print_simple_box(get_string("importdatafinished"),"center");
unset($SESSION->restore);
}
//Print final message
print_simple_box(get_string("restorefinished"),"CENTER");
print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id);
?>
+39 -81
View File
@@ -1,4 +1,4 @@
<?php //$Id$
<?PHP //$Id$
//This page prints the restore form to select everything yo want
//to restore. Form is dinamically buid, depending of "info" object
//that contains the backup contents and depending of every mod
@@ -67,10 +67,6 @@
}
//Check other parameters
if (!isset($restore_metacourse)) {
$restore_metacourse = 1;
}
if (!isset($restore_users)) {
$restore_users = 1;
}
@@ -87,10 +83,6 @@
$restore_course_files = 1;
}
if (!isset($restore_messages)) {
$restore_messages = 1;
}
if (!isset($restore_restoreto)) {
if (isteacheredit($id) and !isadmin()) {
$restore_restoreto = 1;
@@ -106,7 +98,7 @@
?>
<script language="JavaScript" type="text/javascript">
<SCRIPT LANGUAGE="JavaScript">
<!--
function selectItemInMenuByName(formId, menuName, selectIndex ) {
myForm = document.getElementById(formId)
@@ -121,14 +113,14 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
-->
</script>
<form name="form1" id="form1" method="post" action="restore.php">
<table cellpadding="5">
<form name="form1" id="form1" method="post" action="<?php echo $ME ?>">
<table cellpadding=5>
<?php
//First, course destination
//Print the full tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><b>";
echo get_string("restoreto").":</b>";
echo "</td><td>";
if (isteacheredit($id) and !iscreator()) {
@@ -143,7 +135,7 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
choose_from_menu($restore_restoreto_options, "restore_restoreto", $restore_restoreto, "");
echo "</td></tr>";
//Line
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
//Now, check modules and info and show posibilities
if ($allmods = get_records("modules") ) {
//Print option to select/deselect every "with user info" popup. For Gustav, lol, Eloy :-)
@@ -156,7 +148,7 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
get_string("none")."</a>";
echo "</font></td>";
echo "</tr>";
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
foreach ($allmods as $mod) {
$modname = $mod->name;
$modrestore = $modname."_restore_mods";
@@ -170,9 +162,9 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
if (isset($info->mods[$modname]) && $info->mods[$modname]->backup == "true") {
//Print the full tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
echo "</b></td><td>";
echo "</td><td>";
$restore_options[0] = get_string("no");
$restore_options[1] = get_string("yes");
choose_from_menu($restore_options, $restore_var, $$restore_var, "");
@@ -185,48 +177,33 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
} else {
//Module haven't userdata
echo get_string("withoutuserdata");
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
}
echo "</td></tr>";
} else {
//Module isn't restorable
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
}
} else {
//Module isn't restorable
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
}
} else {
//Module isn't restorable
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"$restore_var\" value=\"0\">";
echo "<input type=\"hidden\" name=\"$user_info_var\" value=\"0\">";
}
}
//Line
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
//Now print the Metacourse tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo get_string("metacourse").":";
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");
$metacourse_options[1] = get_string("yes");
choose_from_menu($metacourse_options, "restore_metacourse", $restore_metacourse, "");
} else {
echo get_string("no");
echo "<input type=\"hidden\" name=\"restore_metacourse\" value=\"0\" />";
}
echo "</td></tr>";
//Now print the Users tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string("users").":";
echo "</b></td><td>";
echo "</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
@@ -238,16 +215,16 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
choose_from_menu($user_options, "restore_users", $restore_users, "");
} else {
echo get_string("none");
echo "<input type=\"hidden\" name=\"restore_users\" value=\"2\" />";
echo "<input type=\"hidden\" name=\"restore_users\" value=\"2\">";
}
echo "</td></tr>";
//Now print the Logs tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string("logs").":";
echo "</b></td><td>";
echo "</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");
@@ -255,15 +232,15 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
choose_from_menu($log_options, "restore_logs", $restore_logs, "");
} else {
echo get_string("no");
echo "<input type=\"hidden\" name=\"restore_logs\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"restore_logs\" value=\"0\">";
}
echo "</td></tr>";
//Now print the User Files tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string ("userfiles").":";
echo "</b></td><td>";
echo "</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");
@@ -271,17 +248,15 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
choose_from_menu($user_file_options, "restore_user_files", $restore_user_files, "");
} else {
echo get_string("no");
echo "<input type=\"hidden\" name=\"restore_user_files\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"restore_user_files\" value=\"0\">";
}
echo "</td></tr>";
//Now print the Course Files tr
echo "<tr>";
echo "<td align=\"right\"><b>";
echo "<td align=\"right\"><P><B>";
echo get_string ("coursefiles").":";
echo "</b></td><td>";
echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"$backup_unique_code\" />";
echo "<input type=\"hidden\" name=\"file\" value=\"$file\" />";
echo "</td><td>";
//If course files are in the backup file, show menu, else fixed to no
if ($info->backup_course_files == "true") {
$course_file_options[0] = get_string("no");
@@ -289,36 +264,19 @@ function selectItemInMenuByName(formId, menuName, selectIndex ) {
choose_from_menu($course_file_options, "restore_course_files", $restore_course_files, "");
} else {
echo get_string("no");
echo "<input type=\"hidden\" name=\"restore_course_files\" value=\"0\" />";
}
echo "</td></tr>";
//Now print the Messages tr
echo "<tr>";
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>";
$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>";
echo "<input type=\"hidden\" name=\"restore_messages\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"restore_course_files\" value=\"0\">";
}
echo "</td></tr>";
echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"$backup_unique_code\">";
echo "<input type=\"hidden\" name=\"file\" value=\"$file\">";
}
?>
</table>
<br />
<center>
<input type="hidden" name="id" value="<?php p($id) ?>" />
<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") ?>" />
</center>
</form>
<BR>
<CENTER>
<input type="hidden" name=id value="<?php p($id) ?>">
<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") ?>">
</CENTER>
</FORM>
+122 -11
View File
@@ -1,4 +1,4 @@
<?php // $Id$
<?PHP // $Id$
//This page copies th zip to the temp directory,
//unzip it, check that it is a valid backup file
//inform about its contents and fill all the necesary
@@ -15,13 +15,7 @@
//Check admin
if (!empty($id)) {
if (!isteacheredit($id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
} else {
if (!isadmin()) {
@@ -34,10 +28,127 @@
error("Site not found!");
}
$status = restore_precheck($id,$file,!empty($SESSION->restore->importing));
//Prepend dataroot to variable to have the absolute path
$file = $CFG->dataroot."/".$file;
//Start the main table
echo "<table cellpadding=5>";
echo "<tr><td>";
//Start the mail ul
echo "<ul>";
//Check the file exists
if (!is_file($file)) {
error ("File not exists ($file)");
}
//Check the file name ends with .zip
if (!substr($file,-4) == ".zip") {
error ("File has an incorrect extension");
}
//Now calculate the unique_code for this restore
$backup_unique_code = time();
//Now check and create the backup dir (if it doesn't exist)
echo "<li>".get_string("creatingtemporarystructures");
$status = check_and_create_backup_dir($backup_unique_code);
//Empty dir
if ($status) {
$status = clear_backup_dir($backup_unique_code);
}
//Now delete old data and directories under dataroot/temp/backup
if ($status) {
echo "<li>".get_string("deletingolddata");
$status = backup_delete_old_data();
}
//Now copy he zip file to dataroot/temp/backup/backup_unique_code
if ($status) {
echo "<li>".get_string("copyingzipfile");
if (! $status = backup_copy_file($file,$CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) {
notify("Error copying backup file. Invalid name or bad perms.");
}
}
//Now unzip the file
if ($status) {
echo "<li>".get_string("unzippingbackup");
if (! $status = restore_unzip ($CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) {
notify("Error unzipping backup file. Invalid zip file.");
}
}
//Now check for the moodle.xml file
if ($status) {
$xml_file = $CFG->dataroot."/temp/backup/".$backup_unique_code."/moodle.xml";
echo "<li>".get_string("checkingbackup");
if (! $status = restore_check_moodle_file ($xml_file)) {
notify("Error checking backup file. Invalid or corrupted.");
}
}
$info = "";
$course_header = "";
//Now read the info tag (all)
if ($status) {
echo "<li>".get_string("readinginfofrombackup");
//Reading info from file
$info = restore_read_xml_info ($xml_file);
//Reading course_header from file
$course_header = restore_read_xml_course_header ($xml_file);
}
//End the main ul
echo "</ul>";
//End the main table
echo "</tr></td>";
echo "</table>";
//We compare Moodle's versions
if ($CFG->version < $info->backup_moodle_version && $status) {
$message->serverversion = $CFG->version;
$message->serverrelease = $CFG->release;
$message->backupversion = $info->backup_moodle_version;
$message->backuprelease = $info->backup_moodle_release;
print_simple_box(get_string('noticenewerbackup','',$message), "center", "70%", "$THEME->cellheading2", "20", "noticebox");
}
//Now we print in other table, the backup and the course it contains info
if ($info and $course_header and $status) {
//First, the course info
$status = restore_print_course_header($course_header);
//Now, the backup info
if ($status) {
$status = restore_print_info($info);
}
}
//Save course header and info into php session
if ($status) {
$SESSION->info = $info;
$SESSION->course_header = $course_header;
}
//Finally, a little form to continue
//with some hidden fields
if ($status) {
echo "<br><CENTER>";
$hidden["backup_unique_code"] = $backup_unique_code;
$hidden["launch"] = "form";
$hidden["file"] = $file;
$hidden["id"] = $id;
print_single_button("restore.php", $hidden, get_string("continue"),"post");
echo "</CENTER>";
}
if (!$status) {
error("An error occured");
error ("An error has ocurred");
}
?>
+188 -1260
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -5,6 +5,8 @@
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
$backup_version = 2005041100; // The current version is a date (YYYYMMDDXX)
$backup_version = 2004083124; // YYYYMMDD = date of first major branch release 1.4
// X = point release version 1,2,3 etc
// Y = increments between point releases
$backup_release = "1.5 development"; // User-friendly version number
$backup_release = "1.4.2"; // User-friendly version number
-1221
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
-------------------------------------------------------------------------------
CREATING NEW BLOCKS
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
WARNING - PRELIMINARY DOCUMENTATION
This is designed to point new block developers in the right direction. At times
it may NOT be fully up-to-date with the source, or it may even contain some
tiny bit of misinformation that has slipped our notice. If you encounter such a
case, please:
1. Use the existing block code as reference
2. Come to the moodle.org forums and tell the world! :) We 'll help you!
-------------------------------------------------------------------------------
You have to derive a class that extends MoodleBlock.
The derived class MUST:
* Implement a constructor that:
1. Sets $this->content_type (BLOCK_TYPE_LIST or BLOCK_TYPE_TEXT)
3. Sets $this->title
4. Sets $this->version
5. Sets $this->course equal to its only argument
The derived class MAY:
* Declare that the block has a configuration interface.
To do so:
1. Define a method has_config() {return true;}
2. Define a method print_config() that prints whatever
configuration interface you want to have.
3. Define a method handle_config($data) that does what
is needed. $data comes straight from data_submitted().
* Limit the course formats it can be displayed in.
To do so:
1. Define a method applicable_formats() which returns a bitwise
OR of one or more COURSE_FORMAT_XXX defined constants. These
are defined in lib/blocklib.php.
* Select a "preferred" width which the course format will try to honor.
To do so:
1. Define a method preferred_width() which returns an integer.
This is the block's preferred width in pixels.
* Declare that the block is going to hide its header. This will result
in a more lightweight appearance. Ideal for announcements/notices.
To do so:
1. Define a method hide_header() {return true;}
@@ -1,8 +1,10 @@
<?PHP //$Id$
class block_activity_modules extends block_list {
function init() {
class CourseBlock_activity_modules extends MoodleBlock {
function CourseBlock_activity_modules($course) {
$this->title = get_string('activities');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2004041000;
}
@@ -16,7 +18,7 @@ class block_activity_modules extends block_list {
return $this->content;
}
$this->content = new stdClass;
$this->content = New object;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
@@ -24,8 +26,8 @@ class block_activity_modules extends block_list {
if ($modnamesused) {
foreach ($modnamesused as $modname => $modfullname) {
if ($modname != 'label') {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->instance->pageid.'">'.$modnamesplural[$modname].'</a>';
$this->content->icons[] = '<img src="'.$CFG->modpixpath.'/'.$modname.'/icon.gif" height="16" width="16" alt="" />';
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->course->id.'">'.$modnamesplural[$modname].'</a>';
$this->content->icons[] = '<img src="'.$CFG->modpixpath.'/'.$modname.'/icon.gif" height="16" width="16" alt="">';
}
}
}
+55 -65
View File
@@ -1,8 +1,10 @@
<?php //$Id$
<?PHP //$Id$
class block_admin extends block_list {
function init() {
class CourseBlock_admin extends MoodleBlock {
function CourseBlock_admin($course) {
$this->title = get_string('administration');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2004081200;
}
@@ -12,14 +14,14 @@ class block_admin extends block_list {
return $this->content;
}
$this->content = new stdClass;
$this->content = New object;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (empty($this->instance)) {
if (empty($this->course)) {
$this->content = '';
} else if ($this->instance->pageid == SITEID) {
} else if ($this->course->id == SITEID) {
$this->load_content_for_site();
} else {
$this->load_content_for_course();
@@ -40,14 +42,14 @@ class block_admin extends block_list {
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.SITEID.'">'.get_string('backup').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" height="16" width="16" alt="" />';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" height="16" width="16" alt="">';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.SITEID.'&amp;wdir=/backupdata">'.get_string('restore').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="" />';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="">';
}
if (iscreator()) {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/index.php?edit=on&amp;sesskey='.sesskey().'">'.get_string('courses').'</a>';
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.get_string('courses').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/course.gif" height="16" width="16" alt="" />';
}
@@ -75,94 +77,82 @@ class block_admin extends block_list {
return $this->content;
}
$course = get_record('course', 'id', $this->instance->pageid);
if (isteacher($this->course->id)) {
if (isteacher($this->instance->pageid)) {
$isteacheredit = isteacheredit($this->instance->pageid);
$isteacheredit = isteacheredit($this->course->id);
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">'.get_string('turneditingoff').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/edit.gif" height="16" width="16" alt="">';
if (isediting($this->course->id)) {
$this->content->items[]='<a href="view.php?id='.$this->course->id.'&amp;edit=off">'.get_string('turneditingoff').'</a>';
} else {
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=on">'.get_string('turneditingon').'</a>';
$this->content->items[]='<a href="view.php?id='.$this->course->id.'&amp;edit=on">'.get_string('turneditingon').'</a>';
}
$this->content->items[]='<a href="edit.php?id='.$this->instance->pageid.'">'.get_string('settings').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/settings.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="edit.php?id='.$this->course->id.'">'.get_string('settings').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/settings.gif" height="16" width="16" alt="">';
if (iscreator() || !empty($CFG->teacherassignteachers)) {
if (!$course->teachers) {
$course->teachers = get_string('defaultcourseteachers');
if (iscreator() or !empty($CFG->teacherassignteachers)) {
if (!$this->course->teachers) {
$this->course->teachers = get_string('defaultcourseteachers');
}
$this->content->items[]='<a href="teacher.php?id='.$this->instance->pageid.'">'.$course->teachers.'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
}
if (!$course->students) {
$course->students = get_string('defaultcoursestudents');
}
if (!$course->metacourse) {
$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 {
$this->content->items[]='<a href="importstudents.php?id='.$this->instance->pageid.'">'.$course->students.'...</a>';
$this->content->items[]='<a href="teacher.php?id='.$this->course->id.'">'.$this->course->teachers.'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="">';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$this->instance->pageid.'">'.get_string('backup').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" height="16" width="16" alt="" />';
$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="" />';
if (!$this->course->students) {
$this->course->students = get_string('defaultcoursestudents');
}
$this->content->items[]='<a href="student.php?id='.$this->course->id.'">'.$this->course->students.'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="">';
$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="'.$CFG->wwwroot.'/backup/backup.php?id='.$this->course->id.'">'.get_string('backup').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.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="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->course->id.'&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="scales.php?id='.$this->course->id.'">'.get_string('scales').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/scales.gif" height="16" width="16" alt="">';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="grades.php?id='.$this->course->id.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="">';
$this->content->items[]='<a href="log.php?id='.$this->instance->pageid.'">'.get_string('logs').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/log.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="log.php?id='.$this->course->id.'">'.get_string('logs').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/log.gif" height="16" width="16" alt="">';
if ($isteacheredit) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'">'.get_string('files').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/files.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->course->id.'">'.get_string('files').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/files.gif" height="16" width="16" alt="">';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/doc/view.php?id='.$this->instance->pageid.'&amp;file=teacher.html">'.get_string('help').'...</a>';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/resource/icon.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/doc/view.php?id='.$this->course->id.'&amp;file=teacher.html">'.get_string('help').'...</a>';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/resource/icon.gif" height="16" width="16" alt="">';
if ($teacherforum = forum_get_course_forum($this->instance->pageid, 'teacher')) {
if ($teacherforum = forum_get_course_forum($this->course->id, 'teacher')) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$teacherforum->id.'">'.get_string('nameteacher', 'forum').'</a>';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/forum/icon.gif" height="16" width="16" alt="" />';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/forum/icon.gif" height="16" width="16" alt="">';
}
} else if (!isguest()) { // Students menu
if ($course->showgrades) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="" />';
if ($this->course->showgrades) {
$this->content->items[]='<a href="grade.php?id='.$this->course->id.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="">';
}
if ($course->showreports) {
$this->content->items[]='<a href="user.php?id='.$this->instance->pageid.'&amp;user='.$USER->id.'">'.get_string('activityreport').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" height="16" width="16" alt="" />';
if ($this->course->showreports) {
$this->content->items[]='<a href="user.php?id='.$this->course->id.'&amp;user='.$USER->id.'">'.get_string('activityreport').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" height="16" width="16" alt="">';
}
if (is_internal_auth()) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/login/change_password.php?id='.$this->course->id.'">'.get_string('changepassword').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="">';
} else if ($CFG->changepassword) {
$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="" />';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="">';
}
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="" />';
$this->content->items[]='<a href="unenrol.php?id='.$this->course->id.'">'.get_string('unenrolme', '', $this->course->shortname).'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="">';
}
}
}
-4
View File
@@ -1,4 +0,0 @@
.block_adminblock .content {
text-align: center;
padding: 10px;
}
+14 -16
View File
@@ -1,40 +1,38 @@
<?PHP //$Id$
class block_calendar_month extends block_base {
function init() {
class CourseBlock_calendar_month extends MoodleBlock {
function CourseBlock_calendar_month($course) {
$this->title = get_string('calendar', 'calendar');
$this->content_type = BLOCK_TYPE_TEXT;
$this->course = $course;
$this->version = 2004081200;
}
function preferred_width() {
return 200;
}
function get_content() {
global $USER, $CFG, $SESSION;
optional_variable($_GET['cal_m']);
optional_variable($_GET['cal_y']);
require_once($CFG->dirroot.'/calendar/lib.php');
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content = New object;
$this->content->text = '';
$this->content->footer = '';
if (empty($this->instance)) { // Overrides: use no course at all
if (empty($this->course)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
} else {
$courseshown = $this->instance->pageid;
$courseshown = $this->course->id;
if($courseshown == SITEID) {
if($this->course->id == 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;
@@ -50,22 +48,22 @@ class block_calendar_month extends block_base {
// Be VERY careful with the format for default courses arguments!
// Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse);
if ($courseshown == SITEID) {
if ($courseshown == 1) {
// For the front page
$this->content->text .= calendar_overlib_html();
$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)) {
} else {
// For any other course
$this->content->text .= calendar_overlib_html();
$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>';
$this->content->text .= calendar_filter_controls('course', '', $this->course);
}
return $this->content;
-23
View File
@@ -1,23 +0,0 @@
.block_calendar_month .cal_popup_caption,
.block_calendar_month .cal_popup_fg div {
font-size: 0.85em !important;
}
.block_calendar_month .filters {
font-size:0.75em;
padding: 5px;
}
.block_calendar_month .filters table {
border-collapse:separate;
border-spacing: 2px;
padding: 2px;
}
.block_calendar_month .event_global,
.block_calendar_month .event_course,
.block_calendar_month .event_group,
.block_calendar_month .event_user {
border-width: 2px;
border-style: solid;
}
@@ -1,8 +1,10 @@
<?PHP //$Id$
class block_calendar_upcoming extends block_base {
function init() {
class CourseBlock_calendar_upcoming extends MoodleBlock {
function CourseBlock_calendar_upcoming ($course) {
$this->title = get_string('upcomingevents', 'calendar');
$this->content_type = BLOCK_TYPE_TEXT;
$this->course = $course;
$this->version = 2004052600;
}
@@ -17,10 +19,10 @@ class block_calendar_upcoming extends block_base {
return $this->content;
}
$this->content = new stdClass;
$this->content = New object;
$this->content->text = '';
if (empty($this->instance)) { // Overrides: use no course at all
if (empty($this->course)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
@@ -28,15 +30,15 @@ class block_calendar_upcoming extends block_base {
} else {
$courseshown = $this->instance->pageid;
$courseshown = $this->course->id;
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
'/calendar/view.php?view=upcoming&amp;course='.$courseshown.'">'.
'/calendar/view.php?view=upcoming&amp;course='.$this->course->id.'">'.
get_string('gotocalendar', 'calendar').'</a>...';
$this->content->footer .= '<br /><a href="'.$CFG->wwwroot.
'/calendar/event.php?action=new&amp;course='.$courseshown.'">'.
'/calendar/event.php?action=new&amp;course='.$this->course->id.'">'.
get_string('newevent', 'calendar').'</a>...';
if ($courseshown == SITEID) {
if ($this->course->id == 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;
@@ -57,9 +59,9 @@ class block_calendar_upcoming extends block_base {
get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS),
get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
if (!empty($this->instance)) {
if (!empty($this->course)) {
$this->content->text = calendar_get_sideblock_upcoming($events,
'view.php?view=day&amp;course='.$courseshown.'&amp;');
'view.php?view=day&amp;course='.$this->course->id.'&amp;');
}
if (empty($this->content->text)) {
-4
View File
@@ -1,4 +0,0 @@
.block_calendar_upcoming .event .date {
text-align:right;
font-size:0.8em;
}

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