Compare commits

..

1569 Commits

Author SHA1 Message Date
moodler 585b76a0e8 Bumping the version to Moodle 1.9 in preparation for release. 2008-03-03 07:06:31 +00:00
moodler 15e6b71bc0 MDL-13754 Avoid joining to lastaccess unless we really wanted it
Plus some other cosmetic tidying and comments
2008-03-03 06:19:31 +00:00
moodler 94c265fe95 MDL-11484 Added some colors for overridden grades 2008-03-03 05:54:43 +00:00
moodler 9f3c4120f9 Fixed a notice 2008-03-03 05:27:36 +00:00
moodler 734b4d4dd1 MDL-13478 Cleaned up some variables 2008-03-03 05:24:29 +00:00
moodler 94cf182211 MDL-13753 Show percentages under numbers for result columns 2008-03-03 05:11:39 +00:00
moodler 2c7def765e MDL-13478 use count() function to count arrays 2008-03-03 04:38:36 +00:00
moodler 63ae91cc6d MDL-13478 - massive performance fixes
- general tidying up

           This patch is a mix of Dan Marsden's fairly extensive tidying up
           plus my fixes which bring db calls down to a constant value (from something
           like 6 calls per user response).  Thanks Dan!
2008-03-03 04:26:59 +00:00
moodler f7c44f3873 MDL-13722 Preview now works when when idnumbers might be empty 2008-03-02 15:15:07 +00:00
moodler 58331043d0 MDL-13475 Fixed some character lengths for course->shortname and role->shortname (100char) 2008-03-02 15:02:25 +00:00
moodler 08dc6e642a MDL-13717 Applied hack from Nicklas to fix sitemp etc. It worked for me in a quick test. 2008-03-02 01:20:23 +00:00
nicolasconnault 6a22b20efd MDL-13663 More lang string updates. 2008-03-01 16:56:41 +00:00
skodak ccb472e7b9 fixed groups property typo 2008-03-01 16:19:48 +00:00
skodak eccbfc92ae MDL-13705 2008-03-01 13:10:39 +00:00
nicolasconnault d4e9a98087 MDL-13663 Last lang string change. 2008-02-29 22:17:43 +00:00
nicolasconnault 1b44161802 MDL-13564 Deduced the missing strings from similar strings found in auth.php 2008-02-29 22:11:09 +00:00
nicolasconnault 66fd7a7612 MDL-13736 Wrapped the link in a div and fixed the style. 2008-02-29 21:44:08 +00:00
stronk7 60a18dc226 rebuild_course_cache() to calculate modinfo before role assignments. MDL-13740 2008-02-29 19:53:40 +00:00
nicolasconnault 7209121b5d MDL-11484 Changed the display of overridden and locked grades 2008-02-29 17:05:40 +00:00
tjhunt f154315266 MDL-13738 - Invalid context developer debug notice in manual grading. 2008-02-29 16:22:13 +00:00
moodler 189bb2de50 MDL-10990 Reverting patch for (5) for forum display for guests (from 27 Feb)
We really need this feature, there must be another way to still gain performance here.
2008-02-29 15:18:13 +00:00
stronk7 35cff7a641 Deletin the grader->get_numusers() method. I was doing some not
needed checks (I guess copied from load_users(), where they have
sense). Fallback to grade_report->get_numusers(), that looks ok. MDL-13403
2008-02-29 15:10:16 +00:00
danmarsden f0e4cbcabd MDL-13478 performance fixes. 2008-02-29 11:58:32 +00:00
nicolasconnault 464b3d80fa Notices on empty array index. 2008-02-29 10:06:43 +00:00
scyrma 08450fe007 MDL-13728 - No need for tag:changetype after all 2008-02-29 09:32:57 +00:00
scyrma 6387e05acd MDL-13728 - Tag form editing now provides a checkbox to set the tag type (official or not) 2008-02-29 09:31:58 +00:00
moodler fd21a93e5f MDL-13676 Fixed some mistakes 2008-02-29 08:55:42 +00:00
scyrma 548a5a4ae3 MDL-13728 - Removing old capabilities and creating a new one for tag type modifications. 2008-02-29 08:43:22 +00:00
moodler f45aff70d9 MDL-13676 Changed a field so that Oracle can cope with a COALESCE statement. :-(
I hate doing this at this late stage, but without it Oracle fails.

           On the way I also fixed the profile page so it displays role aliases if they exist
2008-02-29 08:40:39 +00:00
moodler 63b33f502d New tags file for 1.9 2008-02-29 07:49:53 +00:00
moodler 8f79558997 MDL-13568 Only show full profiles if capability allows it (FERPA) 2008-02-29 07:10:06 +00:00
scyrma 31820054f2 MDL-13728 - Removing old code, this is now in the tag management interface. 2008-02-29 07:08:23 +00:00
moodler 536273ae99 MDL-11960 DIsable rss block on tags pages :-( 2008-02-29 07:04:27 +00:00
moodler e331f94902 MDL-13727 Added a cpability check when showing blog entries 2008-02-29 06:51:02 +00:00
moodler 8a53bb7c91 Added error string for MDL-13725 2008-02-29 06:36:27 +00:00
moodler 97634109b7 MDL-13725 Fixed errorcode typo 2008-02-29 06:32:42 +00:00
moodler c7aebb6755 MDL-13725 Remove tag_get_tag_by_id completely
I also re-ordered tag/lib.php a bit
2008-02-29 06:25:22 +00:00
moodlerobot e8b45d3e1d Automatic installer.php lang files by installer_builder (20080229) 2008-02-29 03:36:24 +00:00
stronk7 9059cb4550 Raising to 1.9 final 2008-02-29 01:43:04 +00:00
tjhunt 078c8b402b MDL-12776 - Quiz email notification and separate groups mode - student not in group -> all teachers get email I have changed it so that if the quiz is set to groups mode, and if the student is not in a group, then only teachers with 'accessallgroups' get emailed. 2008-02-28 22:44:10 +00:00
tjhunt 0a22085fdb MDL-13723 - Unbalanced brackets in get_users_by_capability in the groups bit. 2008-02-28 22:39:15 +00:00
tjhunt 14942a2508 MDL-12815 - Quiz uses inconsistent class attribute for the paging bar. I have added the standard .paging class, but I have left the old class there too, so as not to break existing themes. 2008-02-28 21:43:47 +00:00
skodak 0abc6db872 MDL-13705 2008-02-28 21:16:56 +00:00
skodak 0771778fff MDL-13705 2008-02-28 21:00:13 +00:00
nicolasconnault cbca4dbf6c Changing "overall average" to "Course average" in the outcomes report. 2008-02-28 15:51:25 +00:00
nicolasconnault 0e55fb3512 MDL-13718 New icon for "locked" state icon, for grades whose grade item is locked. 2008-02-28 15:40:42 +00:00
tjhunt 3747744140 MDL-13189 - replace the $QTYPE_MENU global with a function call, so that we can set up the language strings later, after $COURSE is initialised. This ensures that the quesion names appear in the right language. 2008-02-28 12:52:59 +00:00
nicolasconnault 0b0bfed7f3 MDL-13712 Fixed 2008-02-28 12:40:38 +00:00
nicolasconnault 2a1245108c Corrected a few US spellings (z in categorized for example). 2008-02-28 08:57:21 +00:00
urs_hunkler 591f3a61ab added new icon 2008-02-28 08:14:24 +00:00
scyrma b893b91a47 MDL-12726 - Making the htmlarea width default to 598 if it's null, don't touch it otherwise 2008-02-28 08:13:08 +00:00
moodlerobot e018b8db42 Automatic installer.php lang files by installer_builder (20080228) 2008-02-28 03:41:27 +00:00
moodler 0e8422bf22 MDL-13659 Change display of groupings on course page 2008-02-28 03:37:03 +00:00
martinlanghoff 551f60bd3b MDL-90: Remove System.php until we have sorted licensing issues. 2008-02-28 03:16:18 +00:00
scyrma dec87682bf MDL-11242 - Setting the width back to it's 1.8 value. This makes it a bit too large for the message window, but is necessary for IE7/Vista 2008-02-28 03:11:37 +00:00
nicolasconnault 38e533a43c MDL-13663 Docs updated. 2008-02-27 19:04:03 +00:00
skodak 0ed613096c MDL-13681 fixed forum search 2008-02-27 18:49:08 +00:00
nicolasconnault 6778021371 MDL-13699 Followed Helen's instructions. 2008-02-27 18:43:07 +00:00
urs_hunkler d3228e8238 MDL-13700 :: added fontsizes for tag clouds 2008-02-27 18:40:06 +00:00
andreabix b17ce9a429 Fixed MDL-12564 2008-02-27 17:36:53 +00:00
nicolasconnault 2758b9a780 MDL-11924 Changed setting quickfeedback to showquickfeedback and added the toggle accordingly. 2008-02-27 17:03:46 +00:00
andreabix 3fb558da2f Updates and fix for Moodle 1.9 2008-02-27 13:41:08 +00:00
nicolasconnault 5c32a46383 MDL-13674 Course category fullname field is no longer required. If set to empty it will be recorded in the DB as ?, and the course name will be used instead wherever the category name is displayed. 2008-02-27 12:45:10 +00:00
urs_hunkler 4b76cb6fc0 MDL-13648 :: removed the chameleon settings 2008-02-27 12:06:49 +00:00
skodak 7c6e10fe39 MDL-90 fixed quickforms pear include regression 2008-02-27 11:08:01 +00:00
urs_hunkler 68d6a45263 MDL-13648 :: several enhancements/changes due to the discussion in the Moodle tracker:
_ changed the README - Custom corners is now experimental
_ styles_colors from standard included - all the usabilty work using colors will automatically show up in Custom corners too
_ optimized the JavaScript which adds the necessary layouttable classes to the body tag
_ Chameleon engine removed - developers throw in CSS at the end without caring if the Chameleon engine can handle it
2008-02-27 10:31:28 +00:00
nicolasconnault 517e069dec /MDL-13578 New links implemented. 2008-02-27 10:11:50 +00:00
skodak ed1b0d012c MDL-13690 activity outcome items do not support calculation - remove calc icon 2008-02-27 10:10:23 +00:00
skodak cb8faf0f12 MDL-90 fixed install.xml 2008-02-27 10:07:10 +00:00
skodak 0854d3f00e MDL-13695 precreating grades in grade calculation if needed 2008-02-27 10:00:47 +00:00
scyrma d3b68faff0 MDL-13404 - print cloud in the box 2008-02-27 09:44:55 +00:00
scyrma 7684e6314d MDL-13691 - make the tag description edition work again. 2008-02-27 09:33:24 +00:00
nicolasconnault a6b6baf25e MDL-13647 Added new icon. 2008-02-27 09:15:59 +00:00
skodak 7551972d69 MDL-12497 fixed regressionwhen saving site letters, fixed redirect 2008-02-27 08:57:54 +00:00
scyrma 6f5fd34644 MDL-13404 - misc fixes 2008-02-27 08:54:26 +00:00
moodler 4e2d942e71 Fixed the renaming and added a new tag_get() function.
Some of the other tag_get functions should be removed and we can use this for many things
2008-02-27 08:53:03 +00:00
nicolasconnault 8ea0f9c792 MDL-13579 Corrected a bug in default value selection for the grader report preferences form. 2008-02-27 07:50:12 +00:00
scyrma 70adc76b61 MDL-13404 - make tag_rename able to make a change in case, and prevent numerous possible missing addslashes problems. 2008-02-27 07:29:15 +00:00
nicolasconnault ca45180f23 MDL-13579 Reduced the setting to 3 locations. 2008-02-27 07:27:13 +00:00
moodler 9b80ac3538 MDL-13635 FIxed logic here a bit: Mat is fixing tag_rename next 2008-02-27 07:12:28 +00:00
scyrma bb6010edaa MDL-13404 - Minor performance improvement and code cleanup 2008-02-27 06:31:28 +00:00
moodler 2c1868ca6b Protect the directory a bit 2008-02-27 06:11:39 +00:00
scyrma 0a08be2397 MDL-13633 - Now sorting correctly 2008-02-27 06:02:44 +00:00
scyrma 6a4bd1e861 MDL-13633 - (OOPS) Completed incomplete changes - simplified tag_print_cloud. 2008-02-27 05:54:16 +00:00
moodler 524c0c8fab MDL-13685 Make custom_corners use colours properly on plugin page 2008-02-27 05:39:14 +00:00
moodler 6468df8aca MDL-6591 Simplified some wording and fixed the help file name for emailnotification 2008-02-27 05:05:01 +00:00
scyrma fb10b05479 MDL-10639 - Missing string 2008-02-27 04:46:43 +00:00
scyrma 86def10b64 MDL-13633 - This is a first step toward integrating all "tag blocks" together. 2008-02-27 04:46:15 +00:00
moodler 9e1889cdae MDL-90 Adding webdav_locks table to make Martin Langhoff's WebDAV patches simpler to apply later
From: http://git.catalyst.net.nz/gitweb?p=moodle-r2.git;a=commitdiff_plain;h=e27f04c42ba05ee224eafa03549b4b5252ca07f5
2008-02-27 04:33:20 +00:00
moodlerobot 08bae0231a Automatic installer.php lang files by installer_builder (20080227) 2008-02-27 03:44:00 +00:00
martinlanghoff 351b7cd179 MDL-90 PEAR/HTTP/WebDAV: fix file name encoding ... for real this time?
Cherry picked from upstream.
2008-02-27 03:02:05 +00:00
martinlanghoff ed997a6b9c MDL-90 moodlelib: Introducing get_cache_flag() - gets a row from cache_flags table
Useful if you intend to use cache_flags as a session
table. (Oops! Did I reveal my cunning plans?)
2008-02-27 02:57:44 +00:00
martinlanghoff 94ff81261d MDL-90 authenticate_user_login() - don't accidentally return a bogus $user
While I don't quite understand why we need that $user->id=0, at
_least_ make double sure we don't return it! Callers assume
that if we return an object===success and a user acct that just does
not exist will return an dummy object.
2008-02-27 02:56:59 +00:00
martinlanghoff 58bf9beea3 MDL-90 lib/setup: extend include_path to cover the PEAR libs we distribute
Almost no cost - most of our require/include calls are with
absolute paths, which will skip the include_path. The few
that are not absolute are usually to include PEAR libs -
so this is appropriate and avoids having to change the
PEAR libs themselves when they make references to other
PEAR libs.

Using the include path does mean that OS-installed PEAR libs
will override ours. There's a small compat risk here - if you
need to ensure a particular version, use an absolute path.
2008-02-27 02:56:06 +00:00
martinlanghoff 0844c5d93b MDL-90 weblib: Introducing mdie() - close sibling of Perl's die()
So that commandline scripts can die with a message and
a nonzero errorcode
2008-02-27 02:52:39 +00:00
martinlanghoff 26e8984b51 MDL-90 Introducing MOODLE_SANE_INPUT and MOODLE_SANE_OUTPUT to setup.php
These two constants indicate that the Moodle core should not mangle
input (magic quotes of any kind verboten!) and should not spit odd stuff
in the output (displaydebug verboten!). Both are needed for WebDAV
support.

MOODLE_SANE_INPUT is tricky - it means that the codepaths _must_ use
$db->qstr() (or addslashes() - but that has its own problems).
2008-02-27 02:51:59 +00:00
martinlanghoff 2f599e1732 MDL-90 lib/pear: Included System.php - used by WebDAV libs
We need to resolve the dual-licensing of this if we are going to
distribute it with Moodle - see MDL-6693
2008-02-27 02:51:18 +00:00
martinlanghoff c67c987c80 file System.php was added on branch MOODLE_19_STABLE on 2008-02-27 02:51:18 +0000 2008-02-27 02:50:59 +00:00
martinlanghoff b1f3971caf MDL-90 Imported PEAR's HTTP_WebDAV_Server from HEAD @ 28-01-2008
This is a very strict import - did not include any of the
sample files (which are quite dangerous!). See the
README_MOODLE.txt for details.
2008-02-27 02:50:20 +00:00
martinlanghoff dfaa493161 file _parse_proppatch.php was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:21 +0000 2008-02-27 02:49:21 +00:00
martinlanghoff 3e02d264ab file _parse_propfind.php was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:21 +0000 2008-02-27 02:49:21 +00:00
martinlanghoff 670fd620d8 file _parse_lockinfo.php was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:21 +0000 2008-02-27 02:49:21 +00:00
martinlanghoff d47d910b13 file Server.php was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:21 +0000 2008-02-27 02:49:21 +00:00
martinlanghoff 5874bee4d1 file README_MOODLE.txt was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:21 +0000 2008-02-27 02:49:21 +00:00
martinlanghoff e74d5d31af file LICENSE was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:21 +0000 2008-02-27 02:49:20 +00:00
martinlanghoff 9913f77ed1 file COPYING was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:20 +0000 2008-02-27 02:49:20 +00:00
martinlanghoff ef201b4775 file AUTHORS was added on branch MOODLE_19_STABLE on 2008-02-27 02:50:20 +0000 2008-02-27 02:49:20 +00:00
skodak 36d07602b7 MDL-13158 choice/index.php only return values for choices in the current course. 2008-02-26 23:19:05 +00:00
skodak 2a154e890e MDL-10990 2) added event table index for calendar block/view 2008-02-26 22:46:32 +00:00
skodak 2bef07cd85 MDL-10990 4) added missing indexes into data module 2008-02-26 22:02:59 +00:00
martinlanghoff 5ab05fb15f MDL-11180 datalib: get_courses() - grab the course context as part of the select
This speeds up course & category listing enormously - cutting 2500 DB queries
for a site with 2500 courses. It's the power of the JOIN...
2008-02-26 21:51:16 +00:00
skodak 3236902cdd MDL-10990 5) eliminated reply related cap queries for guests and not-logged-in users because they can not post anyway, removed reply link for guests from news posts, they did not see Add discussion link already 2008-02-26 21:35:54 +00:00
skodak c1d1f1679e fixed occurred spelling; backport from HEAD 2008-02-26 21:25:03 +00:00
skodak 871836deb7 fixed broken lang string with incorrect " 2008-02-26 21:21:46 +00:00
skodak d242777c73 MDL-10990 1) fixed slow guest query with no mnethostid 2008-02-26 20:00:25 +00:00
skodak ea80372129 MDL-12927 installer should detect the magic quotes settings and undo the slashes if necessary 2008-02-26 19:50:06 +00:00
skodak ce896718cf MDL-6591 inverted checkbox for email notification; MDL-9657 - fixed date issues in drafts 2008-02-26 19:26:42 +00:00
skodak 13db6cc1e4 MDL-13623 proper version detection 2008-02-26 18:33:22 +00:00
nicolasconnault 997dc05600 MDL-13663 Docs updated. 2008-02-26 16:25:48 +00:00
nicolasconnault e588753478 Missing string 2008-02-26 13:02:00 +00:00
moodler 52ffec20aa MDL-13672 tag name function was not updated when tag/lib.php changed 2008-02-26 12:45:32 +00:00
sam_marshall c254ed8511 MDL-13660: Allow admin reports to have db tables, cron 2008-02-26 10:32:40 +00:00
nicolasconnault 8900fdf11d MDL-13663 Docs updated. 2008-02-26 09:56:30 +00:00
moodler 4dc9acd3db MDL-13569 Mark N patch for notice 2008-02-26 09:05:04 +00:00
moodler 2d08c94d20 MDL-12634 Fixed returning to index page 2008-02-26 08:42:21 +00:00
moodler 3bbc889109 MDL-12294 Fixed some strings 2008-02-26 08:34:04 +00:00
moodler eecbfe6e80 MDL-12294 Fixed some assignment strings 2008-02-26 08:26:23 +00:00
moodler 65be953852 MDL-12294 FIxed some wrong string 2008-02-26 08:06:56 +00:00
moodler c8842694e2 MDL-12294 Fixed a bunch of missing or wrong strings 2008-02-26 08:00:09 +00:00
scyrma 207828729e MDL-10639 - Removed "Export" column - export all available outcomes 2008-02-26 07:28:01 +00:00
moodler e5f7002f2f MDL-12294 fixed parentlang string 2008-02-26 07:27:23 +00:00
moodler 00f60cd1cb MDL-12248 custom_corners people can now use roles ;-) 2008-02-26 07:15:34 +00:00
moodler 659cae579e MDL-11809 Fixed broken headline 2008-02-26 07:01:23 +00:00
scyrma 8d0aa2442d MDL-13669 - Editing now only lists the manually added tags 2008-02-26 06:53:51 +00:00
scyrma 8389c869ee MDL-13404 - Missing part of previous commit : args to tag_get_related_tags have changed 2008-02-26 06:48:58 +00:00
scyrma 7bbd75dc6e MDL-13404 - Modification to all tag_get_tags_* calls needing an array & other improvements 2008-02-26 06:39:10 +00:00
skodak 186fa912d9 MDL-13623 fixed regression in PHP < 5.2.0 2008-02-26 06:25:23 +00:00
moodler 30c56fe4dc MDL-9367 Fix doc links for auth pages 2008-02-26 05:49:32 +00:00
scyrma 21c24eb64f MDL-13642 - re-added the proper query limits 2008-02-26 05:07:49 +00:00
scyrma a55d206ce7 MDL-13404 - Fix to a few queries, to prevent problems, as suggested by Eloy 2008-02-26 02:23:10 +00:00
skodak 578629dabe MDL-13626 fixed mssql compatibility issue in stats upgrade 2008-02-25 21:54:54 +00:00
skodak f362682471 MDL-13665 HTML editor is loaded as non-secure on the secure "Add new user" form, patch by Steve Bond 2008-02-25 20:38:52 +00:00
skodak 3dd102788f MDL-13661 - fixing incorrect use of array_shift 2008-02-25 20:21:18 +00:00
skodak a4166d5966 MDL-13237, MDL-13661 - fixing rcache regression, sorry :-( 2008-02-25 15:14:35 +00:00
skodak d7f64fa590 MDL-13483 adding noemailever info 2008-02-25 14:29:50 +00:00
skodak c5b4af2e5d MDL-13483 found two more native php mail() commands 2008-02-25 14:03:53 +00:00
skodak 3fa7bee5ce MDL-9657 advanced upload assignment draft tracking now available as activity setting 2008-02-25 13:33:26 +00:00
skodak e7bbc17fa2 MDL-9657 better dealing with drafts in assignment 2008-02-25 12:38:26 +00:00
skodak 2dc8d0e158 MDL-13653 droplow not ignoring ungraded items un sum aggregation 2008-02-25 12:16:56 +00:00
poltawski e9e0641372 MDL-9667 - convert_tree_to_html doesn't set css class properly if
$tab->linkedwhenselected is set

Patch from Jeff Graham
2008-02-25 11:56:43 +00:00
scyrma 6343168321 MDL-13624 - Use bigint(10), not bigint(11). This update doesn't change the schema on a site that's already installed. 2008-02-25 08:25:51 +00:00
scyrma 3c5591c51c MDL-13643 - Missing constant definition 2008-02-25 08:10:22 +00:00
scyrma 7afc1d07f4 MDL-13404 - Final fix to make it possible, for an tag-managing user, to rename a tag on the tag editing page. 2008-02-25 08:02:41 +00:00
skodak 137a439ac6 MDL-13644 permanent typos 2008-02-25 07:43:48 +00:00
moodler 4984973b93 MDL-13643 Use PARAM_TAGLIST 2008-02-25 07:16:14 +00:00
moodler 3ded4d989d Restoring type PARAM_TAGLIST MDL-13643 2008-02-25 07:15:33 +00:00
scyrma e9a0e86e70 MDL-13636 - Modification to the YUI autocomplete call, to show and use the right strings 2008-02-25 07:05:46 +00:00
moodler 10487fa6da MDL-13635 Managers can now edit tag name on the edit tag interface 2008-02-25 06:26:47 +00:00
moodler 58ea1ced21 Just moved a line of code 2008-02-25 06:25:54 +00:00
scyrma d6f8bc5b15 MDL-13639 - use tag_find_tags, MDL-13404 - improve documentation in the file, MDL-13636 - partial fix 2008-02-25 05:47:03 +00:00
moodler 4d6eee8d65 MDL-13632 Make sure official tags are in the right case. 2008-02-25 05:30:44 +00:00
moodler 6652a915eb MDL-13640 Manage tags link is now consistent on search and tag page 2008-02-25 05:02:25 +00:00
moodler 72876267d2 MDL-13638 Added a link to remove from interests, moved user/tag.php to tag/user.php and removed manage link from that list of links about the one tag 2008-02-25 04:56:18 +00:00
moodler 391cd0eb8e MDL-13637 Changed the check for siteadmin to a capability check (managetags) 2008-02-25 03:49:19 +00:00
scyrma dc62cb9ecc MDL-13404 - A site admin should always be able to edit a tag 2008-02-25 03:32:13 +00:00
scyrma f55102c501 MDL-13632 - Keep tag name case by default 2008-02-25 03:26:13 +00:00
scyrma f866f7be99 MDL-13404 - fix in tag_get_related_tags_csv 2008-02-25 03:23:03 +00:00
moodler 91e727f9ae Make blog_tags block get name and rawname MDL-13632 2008-02-25 03:20:35 +00:00
scyrma 1afe433c80 MDL-13634 - wrong _param type. Fixed 2008-02-25 03:15:59 +00:00
moodler f0f4244474 Latest tags 2008-02-25 03:15:51 +00:00
scyrma e278eb4830 MDL-13632 - keeptagnamecase needs to be "On", and with this change, it will work as expected. 2008-02-25 03:08:59 +00:00
scyrma dde95d41ec MDL-13630 - fix and improvement of the documentation. 2008-02-25 02:49:11 +00:00
scyrma 3310c48044 MDL-13404 - Several improvements to tag system (re-commit, with locallib.php). 2008-02-25 01:25:42 +00:00
scyrma 13ced7fb17 file locallib.php was added on branch MOODLE_19_STABLE on 2008-02-25 01:25:44 +0000 2008-02-25 01:16:46 +00:00
urs_hunkler 2bfb2f1f05 MDL-13418, MDL-13422, MDL 13597 :: corrected CSS issues 2008-02-24 21:15:05 +00:00
skodak 2ec2175f1e MDL-13625 improve perf and fixed groups code on forum index page 2008-02-24 20:14:30 +00:00
skodak 1f7448fc9d MDL-13303 fixed regression in forum recent activity 2008-02-24 20:04:52 +00:00
urs_hunkler da693b58b8 MDL-13453 :: corrected typo 2008-02-24 19:27:30 +00:00
skodak 4ba7849b64 MDL-13605 use userdate() instead of date() when printing next cron execution time 2008-02-24 13:29:10 +00:00
skodak 01911fa4b2 MDL-11494 MDL-13623 - support for secure and httponly cookies 2008-02-24 12:45:49 +00:00
skodak 7545ecdb86 MDL-13565 Tracking forum fixes 2008-02-24 10:52:40 +00:00
skodak 0ed6f1fc6b MDL-13274 label grouping identification 2008-02-24 10:32:13 +00:00
skodak 11274206e0 MDL-13520, MDL-13604, MDL-13620 stats - better simplified parent context join, administrator now counted too, optimised processing when no day logs present 2008-02-23 22:54:30 +00:00
arborrow f543e2acf7 added missing migratinggrades string (called from /backup/restorelib.php) 2008-02-23 20:20:30 +00:00
skodak 794fc9a9a3 MDL-13399, MDL-13614 fixed regression caused by last commit 2008-02-23 19:28:33 +00:00
skodak 1bd430af60 MDL-13615 course edit settings - improved metacourse compatible detection 2008-02-23 19:21:32 +00:00
skodak 910fa9c611 MDL-13613 added better detection for outdated course modinfo 2008-02-23 18:41:14 +00:00
skodak 11f95c99ad MDL-13525 role name aliases used in stat reports 2008-02-23 12:25:21 +00:00
skodak 17178a4ec3 MDL-13192 minor cleanup 2008-02-23 12:16:52 +00:00
skodak 54a252ba51 MDL-13603 fixed course_setup() minor problem with $course in $SITE 2008-02-23 12:12:47 +00:00
skodak 2771076cab MDL-13526 fixed site stats report language 2008-02-23 12:09:43 +00:00
skodak 80eb2b104b MDL-13532 removed incorrect coalesce+count combination 2008-02-23 11:54:34 +00:00
moodlerobot 11925184b7 Automatic installer.php lang files by installer_builder (20080223) 2008-02-23 03:27:48 +00:00
scyrma 4c264c7ff8 MDL-13594 - sorry again, didn't realize Petr had reverted the patch. This reverts the last commit..
i'll fix the mess on Monday.
2008-02-23 03:18:57 +00:00
scyrma a5725844ff MDL-13590 - commited the wrong file, sorry everybody. Here's the good one. 2008-02-23 03:12:52 +00:00
skodak 458544ed1d MDL-13404 reverted - missing file and other minor problems; backported from HEAD 2008-02-22 19:55:11 +00:00
skodak 6b1b51c095 MDL-13590 fixed fatal incorrect require 2008-02-22 14:53:46 +00:00
wildgirl 7541ac282a MDL-12759 help file grammar fix 2008-02-22 11:47:00 +00:00
scyrma 65c75c3ca7 MDL-13404 - Several improvements to the tag sub-system. 2008-02-22 10:17:56 +00:00
wildgirl 20dd99627c MDL-13116 lang string typo fix 2008-02-22 09:27:29 +00:00
wildgirl c070c4021e MDL-13013 lang string typo fixes 2008-02-22 09:02:30 +00:00
moodlerobot 48ab51a5ff Automatic installer.php lang files by installer_builder (20080222) 2008-02-22 03:39:22 +00:00
moodler 58dcf7ad08 Add a shortcut to assign roles page from the participants listing 2008-02-22 02:43:09 +00:00
moodler bda3445de9 MDL-13567 Some fixes to the updating of course settings for restricted modules 2008-02-21 15:15:49 +00:00
skodak 5ed1079984 MDL-13274, MDL-13215 - improved modedit shared forms, label supports groupmembersonly, removed extra button for labels 2008-02-21 14:11:18 +00:00
nicolasconnault 321fcad3ae MDL-11282 Implemented fix 2008-02-21 12:21:44 +00:00
skodak e731779d7a MDL-13559 discussion moving 2008-02-21 10:30:26 +00:00
skodak 9688dc4e27 MDL-13549 related these changes 2008-02-21 09:38:57 +00:00
skodak b8d4faed6b MDL-13549 major bugfixing and improvements in outline report 2008-02-21 09:35:31 +00:00
skodak 570d5b907d MDL-13549 major bugfixing and improvements in participation report 2008-02-21 09:32:15 +00:00
skodak e98a1b9ef3 MDL-13550 deprecated primary role concept 2008-02-21 09:28:59 +00:00
skodak e5a33e0082 MDL-13561 add cmid index to log table to speedup reports that deal with individual activities 2008-02-21 09:25:03 +00:00
nicolasconnault a919ee17b3 MDL-13465 Implemented Martin's solution. Merging from MOODLE_18_STABLE 2008-02-21 09:17:01 +00:00
skodak 20d03127ad MDL-13560 simplify deating with role name course aliases 2008-02-21 09:16:34 +00:00
skodak 2e14f03a63 MDL-13555 fixed typo - thanks Mitsuhiro Yoshida 2008-02-21 08:50:04 +00:00
skodak 1e095f1636 MDL-6591 moving the disable notification from fg prefs 2008-02-21 08:13:58 +00:00
moodler 7a67c58424 Initialise a variable to avoid a notice $displaypage 2008-02-21 06:13:05 +00:00
moodler fdc61d3e9f Latest tags file 2008-02-21 06:09:03 +00:00
moodler 246eb27d88 Avoided a notice for users not logged in 2008-02-21 06:08:30 +00:00
moodler 83ad6e2213 Just some robustness in checking for a variable 2008-02-21 06:01:31 +00:00
moodler 71ebb06911 Some better error checking to help us pick bad lang files 2008-02-21 05:59:50 +00:00
moodler 0746cf3e40 Reverted bad lang file MDLSITE-359 2008-02-21 05:51:48 +00:00
moodler c98be5a96f MDL-13554 Fix from Mark Nielsen for bad block backups 2008-02-21 05:34:10 +00:00
moodler d20c043713 MDL-11752 Upload user pictures (from Anthony and Inaki)
Verified with just major code formatting changes
2008-02-21 05:23:24 +00:00
moodlerobot 4f353aadf5 Automatic installer.php lang files by installer_builder (20080221) 2008-02-21 03:41:22 +00:00
scyrma 16b963e777 MDL-13553 - one more time : it's 'post' not 'blog' 2008-02-21 01:49:06 +00:00
scyrma d970b5a0b2 MDL-13553 - now correctly saving tags with itemtype 'post' 2008-02-21 01:39:31 +00:00
scyrma 6d643c9d6d MDL-13553 - upgrade path to correctly identify the type of each tag_instance 2008-02-21 00:49:59 +00:00
skodak 2c4bd0a648 MDL-6591 changing label to Disable notification in order to prevent confusion 2008-02-20 21:48:25 +00:00
stronk7 645beec03b Adding one new string, preparing for blogs backup. 2008-02-20 19:06:13 +00:00
skodak 0db6d34e6d MDL-12909 do not included users without idnumber in xml grade export preview 2008-02-20 18:28:50 +00:00
skodak 6b465e1867 MDL-6591 Optional assignment graded email notification - based on patch by Gary Anderson 2008-02-20 17:49:58 +00:00
pichetp 5420407e1e Merging from HEAD MDL-13457 Validation when moving to another category 2008-02-20 13:00:36 +00:00
skodak 9660a6ddf2 MDL-4667, MDL-4112 switching order of columns in course-userid log table index in order to please mysql 2008-02-20 09:52:46 +00:00
skodak 8ae9a7dffc MDL-4667, MDL-4112 switching order of columns in course-userid log table index in order to please mysql 2008-02-20 09:31:44 +00:00
skodak f499bdf505 MDL-13546 fixed table name typo - patch by Samuli Karevaara 2008-02-20 08:40:04 +00:00
moodler d0c276727d Prevent a notice with bad rss feeds 2008-02-20 08:10:38 +00:00
moodler 3eb9c93999 MDL-13544 Removed logging of cleanremoteaddr from logs 2008-02-20 07:01:18 +00:00
moodler 86e44df6b0 SMall notice fix for $showing 2008-02-20 06:51:45 +00:00
moodler d30f1d1ad9 Fixing a trivial notice 2008-02-20 06:18:52 +00:00
moodler f3aac02c26 MDL-13542 More return value checking 2008-02-20 06:15:16 +00:00
moodler 2116a8a428 FIxed some notices MDL-13542 2008-02-20 06:12:09 +00:00
moodler f8471a1a96 MDL-13541 Error checking on parameters 2008-02-20 06:07:18 +00:00
moodlerobot bebd1968b2 Automatic installer.php lang files by installer_builder (20080220) 2008-02-20 03:38:26 +00:00
moodler ed3b8f3d0c MDL-12277 Merged from 1.8 - fix for message sending in other languages 2008-02-20 02:32:03 +00:00
tjhunt 978af5c28b Fix dangerous comment. (MDL-13536) 2008-02-19 17:14:10 +00:00
tjhunt 1cc44fbf90 MDL-13448 - missing the global $db statement. Fix thanks to Samuli Karevaara. 2008-02-19 16:21:35 +00:00
tjhunt 17e4bb1533 MDL-13390 - Wrong links in quiz notification emails 2008-02-19 16:19:56 +00:00
tjhunt aede0ebcc0 MDL-13530 - Improve words used in the gradebook plugin selector dropdown menu 2008-02-19 15:00:00 +00:00
skodak 5f65bc5b94 MDL-12538 skip to main does not work if page div contains other attributes 2008-02-19 13:33:21 +00:00
skodak 4a906d7333 MDL-9931 adding go button to delete 2008-02-19 13:12:55 +00:00
skodak 281ec00e8f MDL-11586 rewritten file name collision handling in upload manager - files without extension, fixed increments if file name contains _123 already 2008-02-19 13:03:01 +00:00
stronk7 d685fe5705 Added one new string to installer files. MDL-13489 2008-02-19 11:47:35 +00:00
skodak c26f59b6fc MDL-11816 fixed wiki export with quick hack 2008-02-19 11:04:48 +00:00
skodak 9e931faa98 MDL-11816 fixed wiki export with quick hack 2008-02-19 10:59:21 +00:00
skodak f6dde04372 MDL-11843 deleting of activities directly from calendar is dangerous/confusing 2008-02-19 10:45:14 +00:00
skodak e4fd076246 MDL-12862 ewiki source code converted to utf8, patch by Tatsuya Shirai 2008-02-19 10:04:08 +00:00
urs_hunkler 5407ff018b Merged from 1.8 :: Added h1 - h4 fontsizes. Disabled the Chameleon engine by default. Wrote a short hint about the intearactive editing in the README. 2008-02-19 07:52:37 +00:00
moodler 6fd30e78c7 MDL-13489 Fixed wording 2008-02-19 06:57:10 +00:00
moodler d33eb04648 MDL-13489 Applied patches from Anthony with minor changes 2008-02-19 06:49:41 +00:00
scyrma a81b97bf9b MDL-13404 correct typo 2008-02-19 05:13:41 +00:00
scyrma a5cf0536aa MDL-13404 - cleanup code style 2008-02-19 05:12:25 +00:00
skodak 827ea538e5 MDL-12382 allow admins to access any course - including courses where they have guest role and course does not allow guests 2008-02-18 23:39:28 +00:00
skodak adb4cdc5a8 MDL-12382 allow admins to access any course - including courses where they have guest role and course does not allow guests 2008-02-18 23:33:35 +00:00
skodak ff90e9be5f MDL-13302 gradebook data deleted now in remove_course_contents() - it makes better sense to have it there 2008-02-18 23:09:43 +00:00
skodak acb05e1d85 MDL-13302 gradebook data deleted now in remove_course_contents() - it makes better sense to have it there 2008-02-18 23:07:44 +00:00
pichetp a19e31a1d6 cleaning // 2008-02-18 20:40:41 +00:00
pichetp a1b3e19dd4 merging MDL-13419 removing space before input html element and cleaning of diagnostic
message
2008-02-18 20:35:52 +00:00
skodak 8905e7b645 MDL-13399 prevent ambiguous column names in get_my_courses 2008-02-18 20:13:02 +00:00
danmarsden b28a21b88b MDL-13478 choice results using too much memory. - improves performance when not showing the unanswered column. - also tidies up a few checks which aren't needed. Merged from HEAD 2008-02-18 19:53:06 +00:00
skodak 35e8af0edf MDL-12942 extra credit implemented in sum aggregation type; fixed sum aggregation; fixed division by zero in item grade min==max 2008-02-18 19:10:15 +00:00
moodler a607365fc8 Swapped the two save buttons MDL-6826 2008-02-18 14:22:30 +00:00
skodak ce07f4dc34 big big sorry, forgotten old debug code that sends all mails to null 2008-02-18 12:34:16 +00:00
stronk7 48c52be77a Add support to specify text sizes via formats. MDL-13505 2008-02-18 10:52:32 +00:00
moodlerobot c4e643d335 Automatic installer.php lang files by installer_builder (20080218) 2008-02-18 03:37:00 +00:00
moodler 1ba4c3e132 Add some information about the next stats run to the cron output 2008-02-18 03:12:57 +00:00
moodler eed0327fd9 MDL-13498 Removed path from display of plugins. 2008-02-18 02:10:14 +00:00
moodler e8f4d7e395 Removed some required files that are not needed 2008-02-18 02:08:04 +00:00
skodak 9159c64a7d MDL-11811 OpenDocument is correct name for file format 2008-02-17 19:47:48 +00:00
skodak 1f30b89fd8 MDL-11811 OpenDocument is correct name for file format 2008-02-17 19:47:25 +00:00
skodak 985ea691ac MDL-13445 linked activity deleting improvements 2008-02-17 19:11:29 +00:00
skodak 205e71d01a MDL-12934 temporary fix for grade items of activities without proper course module record 2008-02-17 19:03:15 +00:00
skodak 55534cfdd2 MDL-12934 temporary fix for grade items of activities without proper course module record 2008-02-17 18:37:54 +00:00
skodak 832ca9bd1b MDL-13026 improved sql for course totals on grader report 2008-02-17 17:17:48 +00:00
skodak c2f2f33541 MDL-13231 outcomes aggregation off by default now 2008-02-17 16:05:16 +00:00
skodak d29877ac8c MDL-13269 fixed regrading of activity raw grades 2008-02-17 15:59:44 +00:00
skodak 44ceee90e9 MDL-13437 Grader report: Showing idnumber column shifts controls into wrong columns 2008-02-17 14:55:40 +00:00
skodak bd9a7b89a7 MDL-13477 main version bumped to .02 - three decimal points did not work for Eloy :-( 2008-02-16 22:26:54 +00:00
skodak 1b268daa33 MDL-13192 major stats cleanup patch - see tracker for more details 2008-02-16 18:32:23 +00:00
skodak 490c14fe8a MDL-13459 fixed hardcoded mdl_ prefix 2008-02-16 11:35:54 +00:00
skodak 53726ba409 MDL-13241 adding forgotten table scale_history into upgrade code 2008-02-16 11:20:15 +00:00
nicolasconnault ee6689b003 MDL-13459 Didn't use the patch, which puts its finger in too many pies. Instead just implemented a quick-fix, a temporary get_assignable_for_switchrole() function. It only affects the switchroles menu 2008-02-15 16:35:19 +00:00
nicolasconnault 29252268ca MDL-13459 Didn't use the patch, which puts its finger in too many pies. Instead just implemented a quick-fix, a temporary get_assignable_for_switchrole() function. It only affects the switchroles menu 2008-02-15 16:35:19 +00:00
skodak bd09b95b81 undefined discussion timestart on frontpage 2008-02-15 15:27:17 +00:00
skodak 3db9b3c2b1 MDL-13484 peak memory used perf info added 2008-02-15 11:31:38 +00:00
skodak 30914826c9 MDL-13483 new hidden $CFG->noemailever setting to block sending of all emails - for dev sites only, set in config.php if needed 2008-02-15 10:45:36 +00:00
skodak 32d746f1d7 fixed warning when module code missing 2008-02-15 10:38:37 +00:00
skodak 02bb190c1d MDL-13482 fixed pg issue with group by 2008-02-15 10:30:38 +00:00
mudrd8mz 11a30670cb MDL-13480 swapped strings in help 2008-02-15 09:36:43 +00:00
skodak fc98a031c3 $cours typo fixed 2008-02-15 08:32:48 +00:00
donal 5afa13193d MDL-12492: Thanks to Nigel McNie, this addresses a problem which prevents hosts from re-keying when their keys expire. 2008-02-15 08:32:24 +00:00
donal 14715db3ee Write to the log when the SSL key is created 2008-02-15 08:10:52 +00:00
donal 28febd2534 Remove unneeded mnet_host2service records 2008-02-15 08:04:22 +00:00
moodler 282e599572 UPdated readme to be consistent with new version
Languages all seem to be fixed upstream
2008-02-15 06:49:30 +00:00
moodler 626b76b38f Added back some forced conversion in _adodb_column_sql() (not the same patch as before)
Related to SC#259
2008-02-15 06:44:22 +00:00
moodler 4dd6dd7155 Reapply MDL-12378 to current version for XHTML compliance 2008-02-15 06:34:16 +00:00
moodler a41ba92752 Upgrading to 4.98 as per MDL-13474. Works for me! 2008-02-15 06:03:58 +00:00
moodlerobot c9d4eba186 Automatic installer.php lang files by installer_builder (20080215) 2008-02-15 03:39:23 +00:00
moodler 9988024f6e Just tidying up source 2008-02-15 02:42:56 +00:00
moodler 1fe0ed0b7d Fixed MDL-13476
- discussions can now be moved
 - URL for return is now correct (discuss.php not discussion.php)
2008-02-15 00:50:10 +00:00
stronk7 3ecc34b2d5 Messages backup improvement. MDL-13473 2008-02-14 23:32:43 +00:00
skodak 186c4de5ac MDL-13303 fixing missing group icons in forum 2008-02-14 16:36:12 +00:00
skodak 7a26b64a13 MDL-12945 fixed sql purity to make pg happy, fixed bug in user list of active chats 2008-02-14 16:11:58 +00:00
nicolasconnault 43a4458850 MDL-13430 I can only see this issue in the assignment submissions page. Merging from MOODLE_18_STABLE 2008-02-14 07:25:11 +00:00
moodler 6fcb1a4e2d MDL-13152 from Dariem Garces
Groups that don't exist will be created on the fly
2008-02-14 03:12:00 +00:00
skodak 66714f7c98 MDL-13303 - forgot to change warnings to developer mode only MFC 2008-02-13 17:17:26 +00:00
skodak 5623276da8 MDL-13450 and MDL-13303 - sorry for changing forum API so late, but it was needed; major perf improvement for forum; fixed printing of user pictures 2008-02-13 17:01:41 +00:00
skodak af9ce11eec this function should work for all modules but forgot to remove 'quiz' from sql. - backporting from HEAD, I hope that is ok ;-) 2008-02-13 16:30:12 +00:00
skodak f34dfc143f MDL-13375 fix for duplicate itemnumbers in outcome items 2008-02-13 09:47:22 +00:00
skodak 8a881c78de MDL-13375 reverting, the bug is somewhere else 2008-02-13 09:22:26 +00:00
nicolasconnault 4618409cfd MDL-13375 Applied Dan's patch, and patched up assignment/lib.php accordingly. Multiple outcome grading from assignment is now possible. 2008-02-13 08:49:52 +00:00
nicolasconnault 6644a4f4e5 MDL-13375 Fixed the bug in modedit.php 2008-02-13 08:14:40 +00:00
donal 916071c464 Ensure that the wwwroot has been supplied with a http:// or https:// prefix 2008-02-13 03:06:56 +00:00
pichetp a01d104cdf merging MDL-12421 rounding 2008-02-13 02:09:14 +00:00
pichetp 5710f8575c merging MDL-12388 return url and MDL-12421 rounding problem 2008-02-13 01:30:13 +00:00
donal 0962e21070 MDL-12492: This patch addresses a problem which prevents hosts from re-keying when their keys expire. 2008-02-12 22:27:51 +00:00
urs_hunkler 0594a0aaee MDL-13421 :: corrected left padding in admin block - second approach 2008-02-12 21:26:49 +00:00
poltawski 624c7abf1a MDL-13337 - Add confirmation before deleting outcomes (and POST for action..) 2008-02-12 21:13:25 +00:00
urs_hunkler 0871252e6b MDL-13444 :: removed the jQuery library and use direct JavaScript instead. That's much faster.
MDL-12078 :: Changed them calles from themewww to httpsthemwww (MDL-12078). MDL-13421 :: corrected left padding in admin block
2008-02-12 21:12:46 +00:00
nicolasconnault 311ea49f58 MDL-13397 Implemented the requiredentries parameter (previously not implemented). This includes a warning message and an SQL restriction on entries fetched for view.php 2008-02-12 15:55:34 +00:00
nicolasconnault 111c351849 MDL-13397 Implemented the requiredentries parameter (previously not implemented). This includes a warning message and an SQL restriction on entries fetched for view.php 2008-02-12 15:06:52 +00:00
nicolasconnault aebdc0bdb3 MDL-13440 fixed typo 2008-02-12 13:45:15 +00:00
thepurpleblob 91fa457ea2 Added check for <text> fields that contain markup (an error!) 2008-02-12 11:55:33 +00:00
skodak c2d04f05a0 MDL-9657 assignment submission finalisation now independent from grade 2008-02-12 10:50:35 +00:00
skodak a63215000d MDL-11920 prevent db traffic caused by user images 2008-02-12 08:19:50 +00:00
scyrma 6fec177f09 MDL-10639 - fix problem with buttons when there are no outcomes. 2008-02-12 07:59:24 +00:00
ethem a1cc49c6b1 Merged from MOODLE_18_STABLE 2008-02-11 15:39:13 +00:00
scyrma fa868b8a3d MDL-10639 - now using moodleforms 2008-02-11 02:19:37 +00:00
moodlerobot 78298a17dd Automatic installer.php lang files by installer_builder (20080209) 2008-02-09 03:35:43 +00:00
poltawski 4890c92d15 MDL-13262 - role related user filters were assuming roleids because array_merge
was stomping on keys. Patch by Dennis Rochford
2008-02-08 12:14:39 +00:00
poltawski a3b2abed80 MDL-13354 - wrong capability checked for view report link 2008-02-08 09:57:07 +00:00
moodler e26612356b Fixed context in has_capability call MDL-13378 2008-02-08 03:58:45 +00:00
moodlerobot 40a15c546e Automatic installer.php lang files by installer_builder (20080208) 2008-02-08 03:30:27 +00:00
poltawski f8cfb1230f MDL-13339 - ensure we don't continue the restore process if there is
no course header in the backup file. This bug was causing blank course
records to be created when users tried to restore a non-moodle backup file
such as a scorm file.
2008-02-07 18:48:53 +00:00
ethem f461eacc8e Cron handles all expired unenrolments. It is time to use own enrolment method when calling funcs enrol_into_course, role_assign.
Zend Studio Warning: Assignment in condition (line XX), Solved, one more ()

Merged from MOODLE_18_STABLE
2008-02-07 16:27:50 +00:00
moodler 67574a93c5 Fix subject lines and corrupted emails from messages MDL-13364 2008-02-07 05:19:01 +00:00
gbateson a6a781458e MDL-13328 correct the counting of attempts when clickreporting has been enabled 2008-02-07 04:14:21 +00:00
moodlerobot 32e854e51f iAdded lang 2008-02-07 03:32:09 +00:00
moodlerobot 713f0c63dd file installer.php was added on branch MOODLE_19_STABLE on 2008-02-07 03:32:09 +0000 2008-02-07 03:29:58 +00:00
moodlerobot ab147736c1 Automatic installer.php lang files by installer_builder (20080207) 2008-02-07 03:27:24 +00:00
nicolasconnault 2a5e3d244b MDL-6826 Removed the optional_param lines at the top, and set the submit buttons to PARAM_RAW. Also changed !empty() to isset(); Merging from 1.8 2008-02-06 10:24:40 +00:00
ethem d8347a0ab7 MDL-10181 User Management Improvements: Cron unenrolment of manual should takes place in the main cron.
It is time to use own enrolment method when calling funcs enrol_into_course, role_assign, role_unassign.

Zend Studio Warning: Assignment in condition (line XX), Solved, one more ()
Assignments in a conditional statement are sometimes the result of a typo.
In many cases, instead of the assignment operator =, the equality operator ==
should be used. When comparing a variable and a non-variable expression,
it is common practice to put the variable on the right-hand side of the equality
operator, so that if the equality operator is erroneously replaced with the
assignment operator, PHP will report a parse error immediately.
This helps you avoid a big subset of this class of bugs.
2008-02-06 08:07:03 +00:00
scyrma c9c2c21b84 MDL-13348 - fix to get the right order for countries with names starting with unicode characters 2008-02-06 06:17:10 +00:00
moodler 4f8ac26792 Fixed some apostrophes 2008-02-06 05:55:21 +00:00
scyrma 8f5ef63f5d Fix for MDLSITE-345 and correction to MDL-12565. This doesn't solve it all
though : there will still be "orphans" tags in table tag.
2008-02-06 03:34:14 +00:00
skodak 9e10147777 MDL-10132 improved random glossary blocks - now uses modinfo too + fixed some notices 2008-02-05 23:33:44 +00:00
skodak 58da996994 MDL-11282, MDL-11643 - removing notice() from grade_update() - we can not stop execution there! 2008-02-05 23:10:27 +00:00
skodak 9c76f3b45e MDL-13345 disabled module not present on backup form anymore 2008-02-05 22:55:26 +00:00
skodak ffd15ec8f6 MDL-13155 once more - reverting mod/xx/index.php to use get_all_instances_in_courses() again, should be now nearly the same as in 1.8.x ;-) 2008-02-05 21:39:52 +00:00
skodak f1bd9b5ecf MDL-13155 reworked get_all_instances_in_course() and get_all_instances_in_courses(), based on patch by Tim 2008-02-05 21:34:08 +00:00
stronk7 d916897125 Some old backups can contain empties in user->picture, fix them before insert. 2008-02-05 20:28:29 +00:00
skodak ef7b0cc319 MDL-13292 <Vspan> tag on the bottom of the wiki HTML Editor fixed 2008-02-05 19:51:49 +00:00
andreabix 03daf74013 Added missing classes
.rolecap .inherit.capdefault, .rolecap .allow.capdefault {
  background-color:#E3DFD4;
}

#admin-roles-override .capcurrent {
  background-color:#E3DFD4;
}
2008-02-05 18:53:54 +00:00
skodak 1eff062408 MDL-10796 fixed wiki deprecated passing by reference 2008-02-05 18:41:43 +00:00
poltawski c472c4bb50 MDL-13314 count_role_users was showing different count to those returned from
get_role_users(), based on patch from Patrick Pollett
2008-02-05 17:18:10 +00:00
poltawski f296008fe5 MDL-13235 - bulk user action removing users etc was buggy 2008-02-05 15:22:07 +00:00
skodak 782532955d MDL-12518 fixed restore of grade calculations 2008-02-05 13:11:09 +00:00
skodak f6ea800797 MDL-12938, MDL-12937 - unenrol fixes - can not unenrol if can not unassign all users roles in course, do not show self unenrol if enrolment comes from parent context, fixed rturn value from get_user_roles; based on patch by Eric Merrill 2008-02-05 12:58:59 +00:00
jamiesensei 1fe2c24de3 MDL-13298 "Question bank displays always page 1 after adding new question" this was caused because the question creation page was redirecting back to the question back edit page and telling it to change to the category of the question that was just saved. This was causing the edit page to go back to page 0 of the new category. Now we only go back to page 0 if the category has actually changed. 2008-02-05 12:08:38 +00:00
skodak 0e47869e99 MDL-3942 fixed warnings 2008-02-05 11:48:45 +00:00
skodak 6708fa8b98 MDL-12795 length specification in configtext constructor instead of css 2008-02-05 11:42:51 +00:00
jamiesensei c6a4075609 MDL-13005 When trying to restore a course when you have more then one quiz and you choose only one quiz, the restore fails when trying to create categories and questions. Fixed this by ignoring module context level q categories in backup when the course module has not already been restored. 2008-02-05 11:24:19 +00:00
skodak 9430296726 MDL-3942 - various forum scoring types - patch by Anthony Borrow 2008-02-05 11:21:36 +00:00
skodak ddc33af359 MDL-13335 rewritten caching in forum cron 2008-02-05 10:51:20 +00:00
skodak 907a481674 MDL-13334 get_role_access() static cache in cron only 2008-02-05 10:39:59 +00:00
nicolasconnault 7021c8441d MDL-12158 Applied Matt's patch, merging from 1.8 2008-02-05 10:39:29 +00:00
nicolasconnault 50d0bb2e24 MDL-12888 Removing redundant form 2008-02-05 10:29:31 +00:00
nicolasconnault 56352ac96f MDL-12497 Disabled the "override site defaults" checkbox for admin page, and removed redundant help buttons 2008-02-05 10:26:13 +00:00
jamiesensei 4811aacb5a MDL-13034 fixes "insertion of question / category ids at the CONTEXT_MODULE level does not respect whether the instance of the module has been selected for backup" and cleans up code a little. The last commit for this issue did not include any changes. 2008-02-05 10:16:40 +00:00
nicolasconnault 2008bbe5de MDL-10451 Fixed HTML errors, merging from 1.8 2008-02-05 09:53:07 +00:00
scyrma 816219141b MDL-10639. Initial commit of an import/export system for outcomes (and associated scales). 2008-02-05 08:38:44 +00:00
gbateson aad4873cc6 MDL-10451 remove extraneous closing </b> tag from lang/en_utf8/help/hotpot/outputformat.html 2008-02-05 04:24:24 +00:00
gbateson 369865830c MDL-13048 fix undefined course id when importing a Hot Potatoes quiz into the Lesson module 2008-02-05 04:09:58 +00:00
moodler ea5a1c3bf6 Merged logic fix for MDL-6826 2008-02-05 03:17:42 +00:00
skodak ecf7fad11a MDL-13038 update_record now works with boolean false 2008-02-04 23:51:40 +00:00
urs_hunkler f3c789cd94 merged from 1.8 :: MDL-13329 :: Buttons in the sidblocks looked quite different in the different browsers. Changed several CSS aspects to make them look more similar, specially added IE "hacks". 2008-02-04 20:59:20 +00:00
nicolasconnault 63fc9bd4fd MDL-13087 Adding a page break before the first user report 2008-02-04 14:29:11 +00:00
nicolasconnault 74f7fe1b30 MDL-13050 Now showing a link to the gradebook for the hotpot, assignment, quiz and lesson module grading pages, with the right capabilities etc. 2008-02-04 13:52:49 +00:00
nicolasconnault ad619206e1 MDL-6826 Implementing Tatsuya's patch 2008-02-04 12:59:53 +00:00
nicolasconnault d7df0a5d84 MDL-6826 Removed the word "changes" from the two buttons 2008-02-04 12:17:49 +00:00
nicolasconnault 1ee448b935 MDL-13101 Added the Reload button; inserted the 3 tables into one large table so they appear side-by-side; Reduced the font size 2008-02-04 10:58:24 +00:00
nicolasconnault 62556bfefa MDL-13101 Moved the "unattended upgrade" checkbox to the plugin check page 2008-02-04 10:06:49 +00:00
scyrma 087f51bde0 doc & typo fixes 2008-02-04 06:44:49 +00:00
scyrma 7677bef81e MDL-13060 - removing old entries fro VA and CD 2008-02-04 00:48:09 +00:00
stronk7 cebf5d77a3 Save one extra query per user being restored. $newid contains the user id along all the iteration. 2008-02-04 00:04:02 +00:00
stronk7 1b053c41a4 Now custom profile fields and user tags are restored. MDL-6856
.CVS: ----------------------------------------------------------------------
2008-02-03 23:51:20 +00:00
stronk7 4512e31e51 Only insert outcome_course if it doesn't exist. MDL-13308 2008-02-03 18:42:48 +00:00
stronk7 d6ab69f11b Add some outcomes missing strings. MDL-13318 2008-02-03 18:31:57 +00:00
stronk7 0088748449 Oops, commenting some debug lines I left in my previous commit. 2008-02-03 18:24:56 +00:00
stronk7 71b750ed86 Fix restore of outcomes, resusing them when possible. MDL-13309 2008-02-03 18:20:36 +00:00
skodak b632c1b6c9 MDL-13320 typo in lang/en_utf8/forum.php, found by Mitsuhiro Yoshida 2008-02-03 17:56:59 +00:00
skodak 022747163e MDL-13319 skip disabled modules and blocks in cron 2008-02-03 17:27:32 +00:00
urs_hunkler 038b5bd550 Chameleon restrictions info added. 2008-02-03 17:07:05 +00:00
urs_hunkler 270c2f9a0d MDL-13268 :: CSS cleanup and moved from the end of the file to the other admin CSS definitions 2008-02-03 16:57:25 +00:00
urs_hunkler c1abb7586f Merged from 1.8 :: MDL-13268 :: CSS added 2008-02-03 16:54:53 +00:00
stronk7 e2f8d8a212 Detect used scales in course outcomes too. MDL-13307 2008-02-03 16:39:21 +00:00
skodak a3b9814156 MDL-13317 use cached system context in get_user_access_sitewide and when rebuilding paths 2008-02-03 16:21:35 +00:00
skodak b79595db64 MDL-13316 added static cache for time zone info 2008-02-03 16:00:27 +00:00
urs_hunkler 38d6367287 removed trailing space 2008-02-03 15:59:18 +00:00
urs_hunkler 936eeefdcb MDL-13181 :: added to handle changed xhtml
.glossarypost div.concept h3,
.glossarypost.continuous .concept {
  display: inline;
}
2008-02-03 15:55:29 +00:00
skodak ea3c67c5cb MDL-13312 fixed notices caused by previous commit, patch by Gary Anderson 2008-02-03 12:52:29 +00:00
skodak 27ea59826f MDL-13310 added static cron cache into format_text() to prevent some db access 2008-02-03 10:55:24 +00:00
skodak c0207b1ba7 MDL-13306 option to skip logging of blocked emails in forum cron 2008-02-03 10:35:23 +00:00
stronk7 e0acc94f9f Add missing description to grade_outcomes backup. 2008-02-03 10:32:10 +00:00
skodak fc637ec2c1 MDL-13305 , MDL-13304 - fixed memory leak in forum cron and saved 10% of queries when printing user pictures in mails 2008-02-03 10:20:31 +00:00
moodler 04d79b7a0e Automatic installer.php lang files by installer_builder (20080203) 2008-02-03 03:37:11 +00:00
stronk7 9ddb243f13 Add some browser output when restoring a lot of users 2008-02-03 00:46:32 +00:00
stronk7 8f92c1f78b Now we are reading user_profile_fields and user_tags + some small fixes on roles. MDL-6856 2008-02-02 23:58:09 +00:00
skodak 01eaffcf75 MDL-12901 undo weird IE6 hack on bulk and manage users filter form 2008-02-02 22:59:33 +00:00
skodak f995637ed3 MDL-12710 no wrapping of user selection columns in user bulk form 2008-02-02 21:52:43 +00:00
skodak 14f79d5a2f MDL-12900 prevent fatal errors when incorrect scale id specified in grade_item 2008-02-02 21:33:20 +00:00
skodak ccd48da98d MDL-13147 fixing undefined ungraded array and its indexes 2008-02-02 21:23:02 +00:00
stronk7 82ecf200b7 Respect $showfeedback when deleting groups and groupings. 2008-02-02 20:41:55 +00:00
skodak 0e87d49e09 MDL-13257 fixed problems when section 0 does not exist yet 2008-02-02 18:55:35 +00:00
skodak 98cb031e96 MDL-13239 improved smtp bulk setting based on feedback from Gary 2008-02-02 16:22:15 +00:00
moodler 7e49db8100 Automatic installer.php lang files by installer_builder (20080202) 2008-02-02 03:46:03 +00:00
stronk7 fe5f3d08ac Change some conditions to properly check if the custom-profile-field really is using a duplicate shortname. MDL-13288 2008-02-01 17:17:51 +00:00
skodak ede88ab3be MDL-12945 changing get_fast_modinfo() section property to sectionnum to prevent conflicts with real cm->section; full recent activity speedup when printing user pictures in forum 2008-02-01 14:09:27 +00:00
exe-cutor 3d4646688f Corrected some typos and improved instructions 2008-02-01 13:36:54 +00:00
exe-cutor 59780d2e8f Added Shibboleth integrated WAYF service (forgot to add these files) 2008-02-01 12:58:08 +00:00
skodak 38f3f5f1a1 MDL-12945 modfullnames typo 2008-02-01 09:11:52 +00:00
skodak c2508a1608 MDL-12945 fixing mod indexes broken by previous commit 2008-02-01 09:08:40 +00:00
exe-cutor 0bc5c5f8c6 Added new text strings for integrated Shibboleth WAYF service 2008-02-01 08:34:08 +00:00
exe-cutor f32f73c0a6 file login.php was added on branch MOODLE_19_STABLE on 2008-02-01 12:58:08 +0000 2008-02-01 08:30:17 +00:00
exe-cutor 765235a121 file index_form.html was added on branch MOODLE_19_STABLE on 2008-02-01 12:58:08 +0000 2008-02-01 08:30:17 +00:00
exe-cutor 0975cc6e50 Added integrated Shibboleth WAYF service on alternative login page
Updated README
2008-02-01 08:30:16 +00:00
skodak ab3f9fc74e MDL-13220 rebuild course cache after ajax edits - patch by Myles Carrick 2008-02-01 08:22:25 +00:00
skodak c102e3aade MDL-7547 yet more speed improvements in rebuild_course_cache() 2008-02-01 08:15:06 +00:00
skodak 8d8105fdf7 MDL-13214 rebuild_course_cache fixes and speed improvements 2008-02-01 07:47:47 +00:00
skodak 4ce19d978c MDL-12945 disabled mods are not returned from get_course_mods() anymore, the results are used in scheduled backup and other parts that do not expect disabled mods 2008-02-01 07:32:34 +00:00
skodak ab62d48e88 MDL-13239 smtp bulk sending 2008-02-01 07:04:25 +00:00
moodler 6242b7c12b Some cleanups on the error page
- avoid spammers
 - emit proper 404 response
 - use support address if configured
2008-02-01 05:48:43 +00:00
moodler e629fc4ed0 Fixed a notice when a feed dies 2008-02-01 03:05:34 +00:00
fmarier bb4bab500b MDL-13244 - weblib - Add 'summary' attribute to print_table() 2008-01-31 22:21:52 +00:00
mjollnir_ 34f06f743b MDL-12440: take out auth title and description into base class, plugins can override. updated places that use get_string to call these methods. Credit: Luke Hudson <luke@catalyst.net.nz> 2008-01-31 22:01:38 +00:00
gbateson cfce2efbf3 fix for MDL-13174 : replace calls to html_entity_decode() with hotpot_charcode_to_utf8() because html_entity_decode is broken in PHP 4 2008-01-31 07:26:08 +00:00
moodler 1659924e8d MDL-13260 Fixing misplaced variable (notice) 2008-01-31 07:03:33 +00:00
moodler 88e2f1c4bc MDL-13263 2008-01-31 05:49:46 +00:00
moodler e21d53b06b Automatic installer.php lang files by installer_builder (20080131) 2008-01-31 03:46:40 +00:00
moodler 42e9c00f18 MDL-13245 Add a check for viewall 2008-01-31 01:28:29 +00:00
scyrma 08576b0d0a MDL-11594 - Changes in image location broke chameleon 2008-01-31 00:37:06 +00:00
scyrma 740e1c8bd7 file open.gif was added on branch MOODLE_19_STABLE on 2008-01-31 00:37:06 +0000 2008-01-31 00:35:27 +00:00
scyrma 7f5e32ce55 file item.gif was added on branch MOODLE_19_STABLE on 2008-01-31 00:37:06 +0000 2008-01-31 00:35:27 +00:00
scyrma a227d4c0d9 file closed.gif was added on branch MOODLE_19_STABLE on 2008-01-31 00:37:06 +0000 2008-01-31 00:35:27 +00:00
stronk7 013df172c0 Quick fix for not working glossary index. Related to MDL-12949 that needs more improvements. 2008-01-31 00:19:04 +00:00
poltawski 9724b07ebc MDL-13255 - hidden activity capability check was wrong 2008-01-30 21:00:00 +00:00
poltawski 53938064c5 MDL-13255 - hidden activity capability check was wrong, but require_login()
handles it for us when passsed $cm
2008-01-30 20:57:37 +00:00
poltawski 0a3158d669 MDL-13221 - doing wrong capability check for hidden activites. But we
don't need it at all as require_login() with the $cm argument does the
check for us
2008-01-30 20:41:52 +00:00
tjhunt 9e1a55242f MDL-13110 - Manually grading random questions does not work. Fix thanks to Ken Burres. 2008-01-30 18:18:34 +00:00
mchurch f98f1a922e MDL-13252 Fix context to always use course context, rather than instance->page. 2008-01-30 16:42:22 +00:00
tjhunt 4334697e9e MDL-13253 - Should use separate language strings for user and module idnumber. 2008-01-30 16:33:41 +00:00
tjhunt 000b78f3f0 MDL-13238 - Optionally show the user's idnumber in the grader report. 2008-01-30 15:57:56 +00:00
scyrma ea4e7a0226 converted file from dos encoding to unix encoding 2008-01-30 07:27:15 +00:00
moodler 30b646c765 Don't show grades link when $course->showgrades is off MDL-13245 2008-01-30 06:55:55 +00:00
scyrma bcdb377366 MDL-13060 - upgrade path for users (re)created from backup files 2008-01-30 05:23:39 +00:00
stronk7 06e22959d1 Now user profile fileds and user tags are included in backups. Part of MDL-6856 2008-01-30 01:09:40 +00:00
moodler d9ab63d7e9 Applied patch from Yazel Hernandez to fix XHTML strict MDL-13230 2008-01-30 00:34:33 +00:00
danmarsden 3b32b74f43 MDL-3721 Wiki adds lots of invalid tags to the top of the page in every edit. patch from Grigory Rubstov 2008-01-29 20:51:36 +00:00
skodak b8a2e4a095 MDL-13237 rceche limiting through intcachemax finally implemented - this should prevent major memory leaks 2008-01-29 17:29:39 +00:00
poltawski 6f36f19a62 MDL-13226 - allow user digest settings to be set with bulk user actions 2008-01-29 16:20:14 +00:00
scyrma 4d4938c15e Upgrade path for MDL-13060. 2008-01-29 05:47:01 +00:00
moodler 296c5450fd Automatic installer.php lang files by installer_builder (20080129) 2008-01-29 03:39:22 +00:00
scyrma d74e9bf395 No changes - only recoded to utf8. (MDL-13060) 2008-01-29 03:34:14 +00:00
scyrma e783513693 oops : problem with apostrophes. 2008-01-28 08:32:43 +00:00
scyrma 50d3025947 Imported and replaced country list to fix MDL-13060. The new list is the exact ISO list. Note that an official list also exists in French, but we will need to
do translations to other languages.
2008-01-28 08:30:05 +00:00
moodler d2f18a8694 Merged pdf php5 fix from MDL-13207 2008-01-28 05:27:13 +00:00
moodler c15c851c3b Automatic installer.php lang files by installer_builder (20080128) 2008-01-28 03:42:10 +00:00
moodler d53e1e9535 Fixed missing context argument MDL-13206 2008-01-28 03:21:42 +00:00
moodler dd0070851d Latest 1.9 tags 2008-01-28 03:18:13 +00:00
pichetp 339726d0d0 Mergging from head MDL-12255 Adding questiontext decoding and subquestions validation 2008-01-28 00:42:42 +00:00
pichetp 5c90d8094c MDL-12255 Adding questiontext decoding and subquestions validation when editing 2008-01-28 00:39:13 +00:00
gbateson 04d1cad3bf Fix Undefined property: stdClass::$displaynext in mod\hotpot\lib.php on line 356 2008-01-27 23:55:29 +00:00
gbateson b09b58f052 fix Undefined index: studentfeedbackurl in mod\hotpot\mod_form.php on line 305 2008-01-27 23:47:17 +00:00
mjollnir_ 357eefcdbe MDL-13161 - auth/db - suppress php warning when there are no users using db auth 2008-01-27 20:05:29 +00:00
poltawski 66d4805a81 MDL-13149 - use correct capability checks to decide which forum subscribe
links to display
2008-01-27 16:59:29 +00:00
stronk7 5e41141993 Rename lesson usegrademax to usemaxgrade because some old sites can be using the wrong one. MDL-13177 2008-01-27 15:34:29 +00:00
stronk7 03901b0c62 sql_isnull() not used anymore. Deleting. MDL-12970 2008-01-27 01:37:41 +00:00
stronk7 b8f671b379 Deleting core uses of sql_isnull(). MDL-12970 2008-01-27 01:26:47 +00:00
stronk7 59a745a6ad Adding some missing log actions when restoring forums. MDL-13184 2008-01-27 00:34:41 +00:00
stronk7 3f134ab610 Fix notice with edit enabled in site page. 2008-01-26 23:12:09 +00:00
stronk7 5cfbedea89 Added some helper functions, cleanup a bit and add missing parts. MDL-10721 2008-01-26 21:52:20 +00:00
poltawski df599bc11f MDL-13180 - prevent return of duplicate rows 2008-01-26 17:35:22 +00:00
poltawski 8b722fe0b0 MDL-13179 - avoid calling get_admin() when unecessary.
It uses a relatively complex query and its not needed except
for a minority of users so we may as well avoid it..
2008-01-26 16:56:23 +00:00
poltawski 278ecb2567 MDL-13180 - stop returning duplicate rows 2008-01-26 16:02:30 +00:00
nicolasconnault c86003482a MDL-13101 Correcting the display of non-standard plugins missing from disk 2008-01-26 09:58:08 +00:00
moodler d7b02b694e Automatic installer.php lang files by installer_builder (20080126) 2008-01-26 03:33:54 +00:00
poltawski 53bdf7e60a MDL-13068 - fix typo causing course delete to fail 2008-01-25 21:07:49 +00:00
poltawski 6b18f14151 MDL-13117 - course info was unavailable to students. There was broken logic...
course_parent_visible() always returns true if $CFG->allowvisiblecoursesinhiddencategories
is true,
2008-01-25 20:42:57 +00:00
nicolasconnault be664f9a44 MDL-13101 Now showing installed plugins missing from disk 2008-01-25 16:27:34 +00:00
skodak 2b5db7a39f MDL-12945 minor modinfo improvement- fixed typos (thanks Nicolas) 2008-01-25 12:06:39 +00:00
skodak fecac81cac MDL-12945 minor modinfo improvement 2008-01-25 09:38:16 +00:00
nicolasconnault db9f04b35d MDL-13101 Now showing standard plugins missing from disk. Refactored get_plugin_name() method 2008-01-25 08:36:17 +00:00
scyrma e3a08c6eaa Start on MDL-12730 .. fixes some E_STRICT messages for 1.9 (removing __construct in
this branch only, to stay compatible with PHP4)
2008-01-25 08:34:37 +00:00
jamiesensei ed3a874632 MDL-13156 "insert_category_and_question_ids() function name can cause name conflicts" 2008-01-25 07:06:34 +00:00
moodler a2b4c8cb94 Avoid a notice about $current for guests 2008-01-25 06:26:26 +00:00
scyrma 9f7d599561 MDL-12565 : use the right table 2008-01-25 02:43:10 +00:00
scyrma 4175366743 MDL-12565 - add AS to prevent problem with pgsql 2008-01-25 02:31:22 +00:00
scyrma 080ed4ba60 Fixes MDL-13124 and chooses more relevant tags to display 2008-01-25 01:31:40 +00:00
martinlanghoff b227269e56 accesslib: Fix get_context_users_bycap() when no roles grant the cap
When no roles mention the capability, get_context_users_bycap() breaks
badly. This trivial patch does a sanity check before jumping into the
SQL shark-pool...

MDL-13160
2008-01-25 00:54:35 +00:00
stronk7 d8898325db Merge + General cleanup of backup users. Part of MDL-10721 ; merged from 18_STABLE 2008-01-25 00:46:55 +00:00
skodak 94cbbdbd2e MDL-12945 a slightly bigger patch for performance in recent activity and various group related issues + some other fixes - see list of subtasks in tracker 2008-01-24 20:29:31 +00:00
poltawski f954aeaecd MDL-12627 - when visiting the gradebook for the first time, we don't sort
by anything sensible. Default to surname
2008-01-24 20:11:21 +00:00
stronk7 f0421951ed Prevent grade_grades and grade_grades_history to be exported for non-target users. MDL-13115 2008-01-24 20:02:56 +00:00
nicolasconnault 405350262e MDL-13103 It wasn't a missing !, it was $grade_item spelled as $item... 2008-01-24 19:55:25 +00:00
nicolasconnault c92941d7a4 MDL-13103 Added missing exclamation mark in front of empty() 2008-01-24 19:46:17 +00:00
poltawski 3a8093f895 MDL-13088 - database presets weren't escaping bad chars, causing presets
to break with a rogue <
2008-01-24 19:39:59 +00:00
skodak 293a2545b1 mod/quiz: fixed fatal error in quiz_print_recent_mod_activity(); Author: Matt Clarkson <mattc@catalyst.net.nz>
backported from HEAD
2008-01-24 19:11:59 +00:00
stronk7 98e13c2eea Reworked a bit to prevent non-target user role assignments to be exported. MDL-13115 2008-01-24 19:07:43 +00:00
nicolasconnault 227323aecf Backporting small changes from Head 2008-01-24 19:05:00 +00:00
tjhunt adea20f6dc MDL-12933 - Bug in mod/quiz/lib.php break MyMoodle - Fix thanks to Eric Merrill. 2008-01-24 17:13:29 +00:00
tjhunt 0c1d63a43e MDL-13102 - quiz_results block links to the old URL of the groups editing interface, and it links there for everyone, even if they don't have the capability to go there. Make it link to the participants page instead, if possible. 2008-01-24 16:33:37 +00:00
poltawski e30a701156 MDL-13148 - adding help popup for course module idnumber 2008-01-24 16:09:12 +00:00
nicolasconnault 95a7a2b866 Correcting unicode characters 2008-01-24 15:34:39 +00:00
tjhunt 369f3834ca MDL-13150 - Remove extra <br /> tag for XHTML strict validation - Thanks to Joseph R?zeau 2008-01-24 15:06:48 +00:00
nicolasconnault be5709b7fb Fixing $Id: tag 2008-01-24 14:45:49 +00:00
nicolasconnault b1c418839e Backporting phpdocs from Head 2008-01-24 14:33:43 +00:00
nicolasconnault 300ce0c64d Backporting comment from Head 2008-01-24 14:32:02 +00:00
nicolasconnault 1b5d15ba9d Backporting view.php link in navigation from Head 2008-01-24 14:10:45 +00:00
poltawski 5c5d465c97 MDL-13146 - prevent debug message about missing helpbutton title 2008-01-24 10:59:28 +00:00
nicolasconnault 8ab96578ab MDL-13101
1. Showing full path
2. Showing plugins to be installed
3. Lang strings properly used
4. Table headers
2008-01-24 08:40:31 +00:00
scyrma ccbbdc7319 MDL-13124 : simplify and fix the tag correlation logic. 2008-01-24 08:38:27 +00:00
moodler 0c89fe886d Automatic installer.php lang files by installer_builder (20080124) 2008-01-24 04:08:27 +00:00
scyrma 9bd0d5f805 MDL-8810: changing require_once to include_once when looking for mod/.../lib.php 2008-01-24 02:17:17 +00:00
stronk7 182ac1d6d8 Readding one line missed in last commit 2008-01-24 00:49:50 +00:00
stronk7 8ba998c60e Now the backup->users = none setting is properly populated to all
modules / instances, saving a lot of info to be always written. MDL-13115

Merged from 18_STABLE
2008-01-24 00:47:40 +00:00
nicolasconnault f547727478 MDL-13101 Renamed the print_modules_table() function to print_plugin_tables() 2008-01-23 22:48:48 +00:00
nicolasconnault f5f4cc3fe7 MDL-13101 New section of the upgrade process: plugins check 2008-01-23 22:43:11 +00:00
skodak 3e6a1aa58e MDL-13026 rewritten sql for calculation of averages on grader report, I hope it will be a bit faster now 2008-01-23 19:04:45 +00:00
skodak 690b1d1324 MDL-11920 prevent db traffic caused by user images 2008-01-23 17:40:45 +00:00
poltawski d6ad2b61f1 MDL-13112 - order my courses block alphabetically when only displaying a users
individual courses.
2008-01-23 15:39:48 +00:00
poltawski af1a463811 MDL-13107 - clean up data cvs import capability checks
Removed bad check 'mod/data:uploadentries' (which doesn't exist),
replaced it with mod/data:manageentries which is what is used to display
the form for this page.

Also removed the empty database redirect and editing entries checks
as there no way to get to this point in the UI and capability check
is covered by the manageentries requirecap (+ later sesskey check).
2008-01-23 13:26:46 +00:00
nicolasconnault b55b207c27 MDL-6826 New button added! 2008-01-23 12:54:30 +00:00
scyrma 7bff26bed6 MDL-8123 and MDL-11594 : make admin icons themeable. 2008-01-23 05:41:56 +00:00
moodler 173ac66759 Automatic installer.php lang files by installer_builder (20080123) 2008-01-23 03:47:51 +00:00
moodler 7604731552 Disable Workshop by default in 1.9 MDL-13100 2008-01-23 02:52:12 +00:00
skodak 75ec296d45 MDL-12144 new catgory on modedit available only when outcomes used in course 2008-01-22 12:11:53 +00:00
skodak 14a3c9f3bc MDL-12144 fixed creation of course category 2008-01-22 11:58:43 +00:00
skodak fa2d7d3201 MDL-13091 Aggregate including subcategories off by default, adding default values info into grade cat combo setting 2008-01-22 08:25:32 +00:00
moodler 6be5bdfb8e Automatic installer.php lang files by installer_builder (20080122) 2008-01-22 03:40:16 +00:00
moodler d6b6304fc3 Fixed a typo in the styles 2008-01-22 01:20:47 +00:00
skodak 5db97707d3 MDL-13085 delete grades and items when uninstalling module 2008-01-21 23:35:11 +00:00
danmarsden 9d6bdd5874 Fix for MDL-12998 and MDL-13079 Ldap not unenrolling users correctly merged from HEAD 2008-01-21 23:22:49 +00:00
skodak d4e4739aed MDL-12620 When a student receives feedback on an an assignment, they should be able to see how many points it is worth 2008-01-21 18:45:43 +00:00
skodak 5dd81daaed MDL-12773, MDL-12144 grade category selection on modedit page 2008-01-21 18:41:32 +00:00
skodak 29ad04a314 MDL-13084 SORT_LOCALE_STRING not defined < PHP 4.4.0; fixed typo 2008-01-21 18:16:59 +00:00
skodak 4516dce1a3 MDL-13084 SORT_LOCALE_STRING not defined < PHP 4.4.0 2008-01-21 18:15:44 +00:00
nicolasconnault 0fbc5579fb MDL-13050 Reverting, it's not working out as well as planned 2008-01-21 13:39:51 +00:00
gbateson 9455d7c920 fix Undefined property: stdClass::$studentfeedbackurl (line 282) and Undefined property: stdClass::$cellcontent2 (line 1081) in mod/hotpot/lib.php 2008-01-21 07:33:33 +00:00
skodak bfaa2a61dc MDL-13081 add "long grade" formatted string "score / maxscore" into grade_get_grades() and friends 2008-01-21 07:17:47 +00:00
skodak 46203368b5 MDL-13080 delete calendar events when uninstalling modules 2008-01-21 07:07:51 +00:00
gbateson 5fffec5d49 fix for MDL-13047 where no attempts were found for a particular HotPot 2008-01-21 07:00:21 +00:00
gbateson 9275a2bae5 fix for: Error in call to helpbutton function: at least one of $title and $linktext is required 2008-01-21 06:42:40 +00:00
moodler 9051fd4e30 Automatic installer.php lang files by installer_builder (20080121) 2008-01-21 03:40:04 +00:00
stronk7 949e8de8e7 Adding missing string to installer. MDL-12914 2008-01-20 20:39:18 +00:00
danmarsden 69329d504a Fix for MDL-12979 forum sends out notification to users not in course - due to call to deprec function get_course_users - This also fixes MDL-10163 2008-01-20 20:04:17 +00:00
skodak cb2bf96fe9 MDL-12983 Installation stops after trying to download Language-Pack - patch by Dan Poltawski 2008-01-20 17:58:06 +00:00
moodler ec5e30a4e9 Automatic installer.php lang files by installer_builder (20080120) 2008-01-20 03:37:39 +00:00
mudrd8mz 39477c96a9 MDL-12291 help.php is now able to skip _local langpacks 2008-01-19 21:57:13 +00:00
skodak a746e49818 MDL-13063 fixed comments and changeme password reset; fixed prev commit 2008-01-19 20:04:23 +00:00
skodak 6c9aa9b38b MDL-13063 fixed comments and changeme password reset 2008-01-19 20:02:28 +00:00
nicolasconnault 890204da8c MDL-13050 Oops... fixing syntax error 2008-01-18 22:40:05 +00:00
skodak 49aa2ee116 MDL-13052 edit/user.php typo 2008-01-18 17:13:23 +00:00
jamiesensei acfc18d8e8 MDL-13034 fixes "insertion of question / category ids at the CONTEXT_MODULE level does not respect whether the instance of the module has been selected for backup" and cleans up code a little. merged from HEAD 2008-01-18 15:09:55 +00:00
nicolasconnault 82a6cc3f44 MDL-13050 reverting a debugging comment 2008-01-18 14:37:29 +00:00
nicolasconnault 7bb1b32039 MDL-13050 Modules were updated, and grades.php files were added to the lesson and hotpot modules 2008-01-18 14:31:15 +00:00
skodak 996177940e MDL-11165 [[writinggroupingsgroupsinfo]] - it was already in head 2008-01-18 11:06:58 +00:00
skodak a948673c75 MDL-11165 [[writinggroupingsgroupsinfo]] 2008-01-18 11:05:13 +00:00
sam_marshall 85caf1b299 MDL-13045: Made groups UI use role name aliases 2008-01-18 11:03:01 +00:00
skodak 047e7670aa MDL-11072 sort groupings alphabetically 2008-01-18 10:49:24 +00:00
skodak 3824b03f06 MDL-11759 group edit cleanup; merged from MOODLE_18_STABLE 2008-01-18 10:15:40 +00:00
skodak 4b4d9ef4fa MDL-11759 group edit cleanup; merged from MOODLE_18_STABLE 2008-01-18 10:08:10 +00:00
moodler 654a2dae51 FIxed some typos in the popup names 2008-01-18 05:17:12 +00:00
moodler 66b3a7bcec Automatic installer.php lang files by installer_builder (20080118) 2008-01-18 03:41:08 +00:00
danmarsden e7504c319b fix for MDL-7128 lang file. 2008-01-18 00:39:01 +00:00
danmarsden c562b0f504 fix for MDL-7128 - hide save button when options are all full. and tidy up of old is_guest call 2008-01-18 00:31:37 +00:00
danmarsden bab754c727 MDL-12331 prevent hidden role assignments from being shown in the unanswered column of the choice, but still allow them to be shown if they have selected a choice. 2008-01-17 23:01:02 +00:00
nicolasconnault 7300023df8 MDL-12122 Applied Petr's suggested capability fix 2008-01-17 16:25:40 +00:00
nicolasconnault 3983345254 MDL-12122 Changed userid to PARAM_INT, and changed 'all' to 0 2008-01-17 16:07:11 +00:00
nicolasconnault 047901cbd0 MDL-12122 Completed the change to a more useful user report for the admin, with a few extra bits. 2008-01-17 15:03:35 +00:00
nicolasconnault e0ade9dbe7 MDL-12122 Completed the change to a more useful user report for the admin, with a few extra bits. 2008-01-17 14:54:50 +00:00
sam_marshall 6d07659acf MDL-12991 Updated groups UI so that it categorises members and potential members into roles (Teacher, Student, etc) 2008-01-17 11:28:56 +00:00
moodler f35daade0d Automatic installer.php lang files by installer_builder (20080117) 2008-01-17 03:42:39 +00:00
urs_hunkler e9a903a539 some CSS cleaning up 2008-01-16 20:04:06 +00:00
danmarsden 5a60b8a69a MDL-12890 - patch that allows doanything users to submit a choice, but not shown in the unanswered column. 2008-01-16 18:49:42 +00:00
skodak 91cb9645d4 tweak has_capability() debug mode to add only one query per page for cap name verification 2008-01-16 17:23:07 +00:00
urs_hunkler c9262623e7 new faster jQuery version 2008-01-16 17:21:28 +00:00
urs_hunkler 6489172657 MDL-12536 :: changed customtheme call to fixed custom_corners call. 2008-01-16 17:19:03 +00:00
poltawski 64ca832445 MDL-13003 - dont initialise params twice 2008-01-16 15:05:11 +00:00
scyrma f9348b84bc MDL-13020 : deprecates make_table 2008-01-16 08:24:27 +00:00
nicolasconnault d994fe68bc Reverting MDL-12974 and MDL-12941 (Urs simple wrapper changes) 2008-01-16 08:05:01 +00:00
nicolasconnault a28baeb99c MDL-12941 Added clear:none; to div.user-box css. Also fixed a couple of & with &amp; 2008-01-16 07:33:24 +00:00
scyrma e52c8d89f6 Fix for MDL-9669 : make it possible to specify 0 as cellpadding and cellspacing 2008-01-16 06:29:03 +00:00
moodler f845a2fba9 Small fix for the new SQL ... it works now for me on moodle.org MDL-12990 2008-01-16 06:12:10 +00:00
moodler 3475eeac11 Automatic installer.php lang files by installer_builder (20080116) 2008-01-16 03:38:52 +00:00
moodler 7a15af7d90 Move the inclusion of upgradelib.php to the top MDL-13017 2008-01-16 01:48:53 +00:00
poltawski b972485c21 MDL-12990 - save more needless db queries 2008-01-15 22:07:36 +00:00
poltawski 1c9a35efa2 MDL-12990 - use our user object and we save 2dbq for free on message history page 2008-01-15 21:33:15 +00:00
poltawski 3e5f98212d MDL-12990 - Significantly reduce database queries for messaging
search by getting info required by in search sql.

On a site with 1500 users:
Before: 850 dbq
After:  8   dbq
2008-01-15 16:09:50 +00:00
tjhunt ae1a7e05a6 MDL-13011 - Improve import form layout. 2008-01-15 15:25:03 +00:00
thepurpleblob 3ed692737c MDL-12016:
Read xml structure correctly to get category path
2008-01-15 14:50:24 +00:00
thepurpleblob be1448f47b Reverting Mike C's change in MDL-12016 2008-01-15 14:34:08 +00:00
poltawski 86f404fa52 MDL-12990 - clean up message_print_contacts() a lot to:
* Use less DB queries and avoid getting lots of needless data
 * Dont do a big php array rearranging loop - database does the work for us instead
 * split all the duplicated display code into a single function
2008-01-15 13:47:45 +00:00
ethem 8c4ca06f88 Tidy up 2008-01-15 10:54:18 +00:00
mjollnir_ 33c34c5705 MDL-13000 Adding support for developers to add their own capabilities to local/db/access.php
This relies on a local/ language pack as well for the capability names.
Notes on implementation are in lib/locallib.php
2008-01-15 04:20:02 +00:00
mjollnir_ 0972aa2291 MDL-13001 - adding support for language files in local/ directory. 2008-01-15 01:39:55 +00:00
mjollnir_ 8b2a37e7b1 More on MDL-11561 - fixed up path to local/ settings file to be more consistent,
added documentation in lib/locallib.php on how to create new local admin tree items
2008-01-15 01:09:54 +00:00
mjollnir_ c1139b492e MDL-11561 - added support for local/localsettings.php 2008-01-14 23:32:19 +00:00
skodak 94000d7320 MDL-12822 readding grade_get_course_grade(), alternative to grade_get_course_grades() 2008-01-14 23:28:06 +00:00
skodak aaf8bbd470 MDL-12912 module idnumber course unique only 2008-01-14 22:45:22 +00:00
ethem c8db08b82e MDL-12958 In the Authorize enrol plug-in when a credit card expiry date (year) is entered, a validate error is generated blocking credit card usage 2008-01-14 17:55:43 +00:00
poltawski b81e38ec0b MDL-12990 Ensure that displaying message contact list pictures doesn't take a
dbq per contact. Could do with a rewrite, but this saves us dbqs for now
2008-01-14 16:58:07 +00:00
moodler 2a5bbf81ca Automatic installer.php lang files by installer_builder (20080114) 2008-01-14 03:53:09 +00:00
urs_hunkler 3f710c6be5 MDL-12974 :: We urgently need a simple wrapper function to avoid the advanced containers when only a wrapper div is needed. Pages like for example the tags page look awful in custom_corners with all those unesessarily overlapping boxes.
I created the function print_simplewrapper_start($classes='generalbox', $idname='', $return=false) { ... } and used it in tag/indec.php and tag/lib.php.

The pages look much better now in custom_corners.
2008-01-13 20:02:53 +00:00
poltawski 3416e63f61 MDL-8269 - stats wasn't paying attention to run time settings as the strtotime
arguments were the wrong way round. Thanks to Mark Nielsen
2008-01-13 18:45:55 +00:00
urs_hunkler f86a5be206 merged from 1.8 :: MDL-12564 :: added font-family to the arrow properties. 2008-01-13 17:52:48 +00:00
poltawski 8ac075addf MDL-12560 - layout fixes for tag blocks 2008-01-13 16:34:18 +00:00
poltawski d15518f149 MDL-12560 - layout fixes for tag blocks 2008-01-13 16:28:55 +00:00
poltawski 9c8bcc6562 further refinement.. 2008-01-13 12:30:17 +00:00
poltawski 2cf92c01fb Improving wording 2008-01-13 12:28:14 +00:00
poltawski 4575e76e98 MDL-7846 - use translatable strings for bulk messaging 2008-01-13 12:20:59 +00:00
poltawski 5d53aa0544 MDL-12943 - remove old dialogue unused dialogue language files 2008-01-13 11:44:44 +00:00
poltawski 22c2af60e8 MDL-12742 - remove duplicated lang files 2008-01-13 11:36:14 +00:00
jamiesensei 4a6a7074ce MDL-12695 Symantec Norton internet security pop up blocker seems to be stopping user starting a quiz attempt - fixed this by using print_single_button which uses an onclick event to trigger a confirm dialogue, should work better even with popup blockers. 2008-01-13 08:54:56 +00:00
jamiesensei f92b08d9e1 whitespace clean up, removed all indentation with tabs and trailing white space 2008-01-13 08:35:38 +00:00
jamiesensei d42e5b0034 MDL-12906 add an optional parameter $jsconfirmmessage parameter to print_single_button 2008-01-13 08:09:09 +00:00
stronk7 c279331f64 Minor changes to custom check definition. MDL-12914 2008-01-12 18:50:33 +00:00
stronk7 be176082f4 Function changed to check for register_globals. MDL-12914 2008-01-12 18:49:38 +00:00
urs_hunkler 2c30fce4a2 MDL-11154 :: added the missing code and the config line and explanation in config.php for flexible columns. 2008-01-12 17:52:03 +00:00
urs_hunkler 17be8562d7 merged from 1.8 :: MDL-9306 :: explanation added for hooks as comma separated lists in Chameleon. 2008-01-12 16:31:50 +00:00
urs_hunkler 0cb3c46479 merged from 1.8 :: MDL-11486 :: added width to the adminblock 2008-01-12 14:51:52 +00:00
urs_hunkler f300eadf46 MDL-12210 :: set background-color: none to transparent 2008-01-12 14:26:20 +00:00
urs_hunkler 901c3d48a6 MDL-12910 :: changed top from 2.9em to 3.5em 2008-01-12 14:04:49 +00:00
skodak bcb667b7f5 MDL-12914 Register globals trouble 2008-01-11 23:21:35 +00:00
stronk7 9040c8d4e9 Fixed copy/paste typo. MDL-11341 ;-) 2008-01-11 17:20:31 +00:00
poltawski 99f36270c0 MDL-11341 - allow users with language editing perms to access language
editing
2008-01-11 16:26:10 +00:00
poltawski 5a3cafc899 MDL-11074 - incorrect test in page_generic_activity, thanks to Gordon Bateson 2008-01-11 15:42:05 +00:00
skodak ca9b92d39f MDL-12926 Discussion list shows all discussion in separate mode if user not member of any group and does not have accessallgroups 2008-01-11 13:08:17 +00:00
poltawski f57cdf69c8 MDL-12930 - wrong title text on search webpages button, thanks to Mitsuhiro
Yoshida
2008-01-11 11:58:41 +00:00
poltawski 18778321e8 MDL-12400 - superfluous required_param causing problems in upload
assignment user report.
2008-01-11 11:45:30 +00:00
urs_hunkler 56db843241 typo body#tag-manage table#tag-management-list, th, must be body#tag-manage table#tag-management-list th, 2008-01-11 11:32:49 +00:00
nicolasconnault d9d18969f0 Fixed intermixed quickgrading and quickfeedback help strings 2008-01-11 10:03:24 +00:00
urs_hunkler c309d41688 MDL-12221 :: removed the "nocoursepage" hack, which was an attempt to find out if a page has a layout-table. I developed this hack because Martin said, that he does not see any chance to implement a layout-table check. This hack followed several exception hacks because Moodel pages are inconsistently created. All those exceptions I could delete too.
Now I added a JavaScript layout-table check which works great.
2008-01-11 09:21:24 +00:00
moodler 2ac2ce803e Automatic installer.php lang files by installer_builder (20080111) 2008-01-11 03:41:08 +00:00
stronk7 a8482189a7 Adding custom check to test MDL-12914 2008-01-11 00:04:12 +00:00
stronk7 9e87c6033e Backported from HEAD. Added new library to store all core
custom checks to be performed by environmental stuff. MDL-12914
2008-01-10 23:49:15 +00:00
stronk7 692866105a file customcheckslib.php was added on branch MOODLE_19_STABLE on 2008-01-10 23:49:15 +0000 2008-01-10 23:46:28 +00:00
skodak b5c8f2f808 MDL-12921 Using visible groups in Q&A Forums student can't reply to discussions for All participants (including groups code cleanup) 2008-01-10 23:12:46 +00:00
poltawski ba4aea2b35 MDL-12915 - fixed require of removed file 2008-01-10 16:10:07 +00:00
jmg324 3dc2b907da MDL-6216 print_category_info no longer counts invisible courses if the user does't have permission to see them. 2008-01-10 15:43:21 +00:00
tjhunt 168eda8b3a MDL-12913 - Error messages when doing an XML grade import are not very helpful, include the idnumber that is causing the problem in the error message. 2008-01-10 15:38:47 +00:00
skodak fa366ea698 MDL-12911 fixed permission checks; merged from MOODLE_18_STABLE 2008-01-10 15:09:10 +00:00
tjhunt d67aacd867 Fix notice when you try to import an empty XML file. 2008-01-10 14:17:35 +00:00
tjhunt 33d2459c8d MDL-12373 - More instances of links to the participants list being shown in the navigation bar to people without the necessary capability.
I have not copied and pasted the same code into lots of different places. That sucks. We really need to refactor this into a function that builds the navigation up to, and including the user's name. However, I don't have time now. A list of the places touched by this bug (MDL-12373) will at least give a complete list of places that such a refactoring would have to touch.
2008-01-10 10:58:09 +00:00
poltawski ff82f12d5e MDL-12221 - use theme variables so it doesn't break on my setup ;) And remove
comment reffering to local server
2008-01-10 10:42:42 +00:00
skodak 0e2c2828fa search cron.php is included from search block, the config.php was already included in admin/cron.php - MFC 2008-01-10 10:05:50 +00:00
jmg324 decfd5028c altered require statement for config. (merged from head) 2008-01-10 09:54:31 +00:00
moodler ab54cc74d8 Removing some temp files that shouldn't be here 2008-01-10 06:12:07 +00:00
moodler 65743c17e0 Some small fixes to make custom_corners behave better as a parent theme MDL-12221 2008-01-10 06:10:02 +00:00
moodler 84dc99bbe9 Add support for db folder to auth plugins 2008-01-10 03:46:01 +00:00
moodler 5be691946f Automatic installer.php lang files by installer_builder (20080110) 2008-01-10 03:39:46 +00:00
stronk7 675b1a05ea Bump release to have it included in backups to beta 4 2008-01-10 00:19:57 +00:00
skodak d3d791f208 MDL-12822 removing some unused grade functions (obsoleted by format grade function), renaming PUBLIC API to activity communication API and adding new querylib.php with useful functions (requested by other devs) 2008-01-09 18:19:12 +00:00
tjhunt 0e544a84e6 MDL-12373 - If you can see your user profile, but don't have moodle/course:viewparticipants, you get a link in the nav bar that takes you to an error message - and there were also instances in blog. 2008-01-09 17:23:45 +00:00
tjhunt 79a9b69e28 MDL-12373 - If you can see your user profile, but don't have moodle/course:viewparticipants, you get a link in the nav bar that takes you to an error message - this was repeated in other parts of the user profile that I had not noticed when I fixed this before. 2008-01-09 16:46:19 +00:00
urs_hunkler 8f4a3ae2f1 MDL-12221 :: I added changes to weblib and the forum and glossary view pages, the custom_corners and standard theme to get those pages working.
In the view pages I changed the container function call to a simple "echo 'div ...'" to avoid the custom_corners container overhead and page oddity.

In weblib I added "clearfix" handling to the function "print_box_start($classes ...". "clearfix" is handed over to the containing divs. This is a hack, but I didn't know how to handle it without rewriting too much areas.
2008-01-09 15:03:29 +00:00
poltawski 3dd4e13cd6 MDL-12889 - bad capability check [thanks Tim!] in assignment recent activity report 2008-01-09 12:56:48 +00:00
poltawski f00d4c451b MDL-12888 - remove require to form no longer used 2008-01-09 11:03:00 +00:00
poltawski 18077e8b96 MDL-12888 - remove require to form no longer used 2008-01-09 10:56:48 +00:00
poltawski 78fb3bf3df MDL-10886 - Category edit: use 'save changes', enable cancel button to allow us
to get back from where we came from & refine where we are returned to when cancelled.
2008-01-09 10:49:05 +00:00
poltawski fd0e2fec76 MDL-12461 - wrong urls for message related log entries 2008-01-09 10:11:04 +00:00
moodler 4d7325ef33 Added back missing string to 1.9 MDL-12801 2008-01-09 07:35:47 +00:00
moodler 220a6d19b1 Hmm, somehow I checked in a conflict! :-( MDL-12801 2008-01-09 07:30:02 +00:00
moodler 8826b45a5a Bumping to Beta 4 2008-01-09 06:59:41 +00:00
moodler 1ec0ef254c Merged MDL-12801 from MOODLE_18_STABLE (Improve roles terminology for system) 2008-01-09 06:49:14 +00:00
scyrma 941802c3d1 Small documentation fix. 2008-01-09 04:09:00 +00:00
ericmerrill 95fb95cb3e MDL-11674
Undid change that could result in dataloss.
2008-01-09 02:08:04 +00:00
mjollnir_ 07e27f4746 MDL-12884 web installer should set the depth of the miscellaneous course category to 1 too (discussion in moodle hq skype chat with Petr) 2008-01-08 23:26:26 +00:00
martinlanghoff 9b672f584f mod/chat:chat_cron() - IS NOT NULL is better - MDL-11674 2008-01-08 22:37:18 +00:00
poltawski 8049c822ec MDL-12840 - gradebook CSV import was failing due to newlines with nothing
on them
2008-01-08 22:24:10 +00:00
martinlanghoff bf2de3499f mod/chat:chat_cron() delete stale chat messages with a single query, fast, and portable too! MDL-11674 2008-01-08 20:58:32 +00:00
poltawski 8432e9ba39 MDL-12882 - we were caching empty records which caused clone warnings 2008-01-08 20:19:18 +00:00
tjhunt 5e17bdd0eb MDL-12771 - change multianswer quetsion type HTML to more closely match that of other question types, in order to fix a layout glitch in Moodle 1.9. 2008-01-08 18:37:43 +00:00
tjhunt 5ae009ad6d MDL-12785 - Partially correct tick icon not displayed for MULTICHOICE, single answer questions. Fix thanks to Joseph R?zeau. Merged from MOODLE_18_STABLE. 2008-01-08 18:29:17 +00:00
urs_hunkler a35ce8ef14 MDL-12881 :: added class names "username" and "password" for better login form handling. 2008-01-08 17:59:44 +00:00
sam_marshall 6730788f48 MDL-12876 Moved accesshide text further off the screen as it was sometimes visible 2008-01-08 17:27:29 +00:00
poltawski 27e05b35a9 MDL-12464 - refine further so that glossary can't refer to instance from
another course (and cause breakage)
2008-01-08 16:46:41 +00:00
nicolasconnault b521e9ed8a MDL-12829 Removed a hard-coded test integer 2008-01-08 15:23:52 +00:00
tjhunt e0a411d4a4 MDL-12875 - Hidden courses not in category list not visible to teachers on those courses in the list of courses in a category. 2008-01-08 15:17:04 +00:00
tjhunt 0229dc83ea Put back DEBUG_DEVELOPER sanity check in has_capability, that makes sure the capabiltiy you are asking about actually exists. I know it takes an extra DB query, but it is DEBUG_DEVELOPER only, and it is worth its weight in gold, because otherwise you get really subtle bugs that take forever to diagnose. I know, I have just been banging my head against the wall for an hour. 2008-01-08 15:04:04 +00:00
poltawski 39dfcf7138 MDL-9372 - only show RSS options in database module when RSS is enabled 2008-01-08 13:39:35 +00:00
poltawski 0b7c820a73 MDL-10813 - Course requests not respecting course request category.
Also made the course request category more robust, as breakage would
incur if $CFG->defaultrequestcategory didn't exist as a category.
2008-01-08 12:49:41 +00:00
poltawski dc51efed7e MDL-12873 - show an add course button when editing at the top level (which
is the default view when you click 'Add/Edit Courses'
2008-01-08 11:59:07 +00:00
skodak df2a9e2a0a MDL-11830 width applied to input fields only, that should solve the incorrect size of button 2008-01-08 07:32:56 +00:00
skodak d65bb1547b MDL-12869 fixed minor security problem in installer - reported by hanno 2008-01-08 07:15:29 +00:00
iarenaza d0d840eaed MDL-12858 fix print_error() usage.
print_error()'s third parameter is the URL we jump to (defaults to
$CFG->wwwroot if not set) when we click the 'Continue' button, not the message
string parameter object.

Forward ported from MOODLE_18_STABLE
2008-01-08 00:16:18 +00:00
poltawski 7e65c42f39 MDL-12856 - previous commit was breaking moodle installs after
redeclaring method. Remove the duplicate function.
2008-01-07 20:56:20 +00:00
poltawski 6b843dfac1 MDL-12859 - add some whitespace so translation layout doesn't get messed
up
2008-01-07 20:31:02 +00:00
tjhunt d091ee027f Use the locale to sort the list of activites everywhere. This matches a change a made in one place before christmas. If you don't do this, the PHP sorts by ASCII order, so mixed case names, or special characters, get sorted wrongly. 2008-01-07 16:46:10 +00:00
poltawski d18387534d MDL-6529 - strip slashes when displaying category added success messsage 2008-01-07 12:20:13 +00:00
martinlanghoff 9276c875dd dmllib:rcache_set()/rcache_get() - use clone() function which we can support in PHP4 - MDL-12827 2008-01-07 05:03:45 +00:00
ikawhero f1d52ce1aa Adding method to allow printing of the enrolment key form code when using PayPal. 2008-01-07 00:58:10 +00:00
martinlanghoff 9dc8c1b014 MDL-12452 accesslib: get_users_by_capability() now excludes doanything'ers properly
With some subselect-outer-join poison-pill magic, when the we don't
want doanything users, we remove the roles that would grant such
dubious status.

Just a flick of the SQL muscle, actually.
2008-01-06 23:20:00 +00:00
martinlanghoff 264d665380 MDL-12523 accesslib: get_users_by_capability() fix subselect with ra.hidden
MDL-12452
2008-01-06 23:19:04 +00:00
martinlanghoff 4658b598b4 MDL-12523 lib/deprecatedlib: use sort_by_roleassignment_authority() to sort RAs
After calling get_users_by_capability(), use
sort_by_roleassignment_authority() to mimic what older versions of
Moodle did.

Affects: get_teacher(), get_course_teachers()

    MDL-12452
2008-01-06 23:18:51 +00:00
martinlanghoff 4ebe85b6a5 MDL-12523 accesslib: Introducing sort_by_roleassignment_authority()
This will help us bridge the gap from olden-style order-by
user_teachers.id. From the phpdoc...

 Will re-sort a $users results array (from get_users_by_capability(), usually)
 based on a sorting policy. This is to support the odd practice of
 sorting teachers by 'authority', where authority was "lowest id of the role
 assignment".

 Will execute 1 database query. Only suitable for small numbers of users, as it
 uses an u.id IN() clause.

 Notes about the sorting criteria.

 As a default, we cannot rely on role.sortorder because then
 admins/coursecreators will always win. That is why the sane
 rule "is locality matters most", with sortorder as 2nd
 consideration.

 If you want role.sortorder, use the 'sortorder' policy, and
 name explicitly what roles you want to cover. It's probably
 a good idea to see what roles have the capabilities you want
 (array_diff() them against roiles that have 'can-do-anything'
 to weed out admin-ish roles. Or fetch a list of roles from
 variables like $CFG->coursemanagers .

MDL-12452
2008-01-06 23:18:37 +00:00
martinlanghoff 3e117fb6af MDL-12523 lib/deprecatedlib: enrol/manual: Fix calls to get_users_by_capability() to avoid ra
get_users_by_capability() can no longer refer to properties of role
assignments or roles, as the capability aggregate is indirect.

Fixes:
 get_teacher() - though the results will be poor, as we cannot provide
                 role.sortorder reliably
		 (used mainly by mod/workshop)
 get_course_teachers() - which seems broken for a lot of situations as
                 its default parameters still refer to old tables.

MDL-12452
2008-01-06 23:18:19 +00:00
martinlanghoff f5687e385b MDL-12523 enrol/manual: Fix calls to get_users_by_capability() to avoid ra
get_users_by_capability() can no longer refer to properties of role
assignments or roles, as the capability aggregate is indirect.

MDL-12452
2008-01-06 23:18:08 +00:00
martinlanghoff b5ea0a4a52 MDL-12523 accesslib: get_user_by_capability() - Fix pagination
Ooops! Off-by-one error

MDL-12452
2008-01-06 23:17:53 +00:00
martinlanghoff 8658d5c5b0 MDL-12523 datalib: get_admins() - Rewrite to avoid get_users_by_capability()
get_admins() and get_admin() were counting on
get_users_by_capability() returning a role-assignment id to pick the
"primary" admin account. With the get_users_by_capability() rewrite,
we no longer have an RA id to clearly blame for the capability.

So, rewrite get_admins() based on the known-good SQL used in
is_siteadmin().

MDL-12452
2008-01-06 23:17:42 +00:00
martinlanghoff 22edc02cf9 MDL-12523 accesslib: get_user_by_capability() - Fix last_access handling
We were missing $courseid, which is actually $context->instanceid.

MDL-12452
2008-01-06 23:17:24 +00:00
martinlanghoff 3f1e6d3c73 MDL-12523 accesslib: get_user_by_capability() - Move capcheck to has_capability_from_rarc()
This fixes the handling of default roles as "tie breakers" for lower
RAs in conflict, and simplifies the code a lot.

The main loop in get_user_by_capability() runs a simpler state machine
that just collects role assignments (roleid and depth), and handles
pagination.

The complex part of the state machine has moved to
has_capability_from_rarc() which will walk the data structures
collected by get_user_by_capability() for each user.

Having all the complex state handling of $hascap there makes things a
lot easier for pagination and general sanity of
get_user_by_capability().

MDL-12452
2008-01-06 23:17:11 +00:00
martinlanghoff 53d3f7fd89 MDL-12523 accesslib: get_user_by_capability() - Move hidden RA checks to subselect
we don't deal with RAs in the main SELECT -- we deal with _capabilities_
which is an entirely different matter ;-) -- so push the ra.hidden check
into the subselect.

Also, remove ra.hidden from the default list of fields. Hopefully no
callers are using ra.hidden -- if they are, they should be calling
something else, as this function deals with capabilities. So we might
need an audit of callers, to check that noone is expecting ra.hidden
to be there.

MDL-12452
2008-01-06 23:16:54 +00:00
martinlanghoff ba702c6731 MDL-12523 accesslib: get_user_by_capability() - Handle the complex case
With this commit, we can handle the complex cases with

 - correct pagination, but not very efficient over large datasets

 - mostly-correct application of the override rules

The structure of the code is fairly complex in that we want to do
it without holding all the recs in memory, so we use a small state
machine. We have to handle the complex override rules over 1 or 2
permissions (when $doanything is set) so it all ends up quite complex.

There is one known issue with this code, in cases where the default
role ends up as the decider between 2 conflicting RAs, we fail to
apply it. This will need a bit of reorg of how the loop works.

MDL-12452
2008-01-06 23:16:33 +00:00
martinlanghoff b8dc2b75a4 MDL-12523 accesslib: get_user_by_capability() - Simple cases now handle multiple RAs
The "simple" case SQL did not handle multiple enrolments for the same
user correctly -- it would generate multiple rows for those users,
incorrectly.

With this patch we move the join to RA to a subselect where DISTINCT
takes care of things.

MDL-12452
2008-01-06 23:16:20 +00:00
martinlanghoff 6d5d43bab3 MDL-12523 accesslib: get_user_by_capability() - Handle complex rolecap resolution
With this patch, get_user_by_capability() can handle the cases where
users have multiple role assignments to the same course, and PREVENTs
and PROHIBITs affect the rolecaps of this course.

Without stored procedures we cannot resolve this entirely on the
server side - so in the complex cases we do as much as we can on SQL,
and post-process the data on the PHP side, including SQL-style
pagination.

MDL-12452
2008-01-06 23:16:07 +00:00
martinlanghoff 285b024ebf MDL-12523 accesslib: get_user_by_capability() - First, handle simple cases
This patch reorganises the conditions and field handling so
we can spot if this is a call we can resolve in a single SQL
query that we just pass back the results.

If there are any PREVENTs or PROHIBITs, we need to delve into
more involved stuff...

MDL-12452
2008-01-06 23:15:33 +00:00
martinlanghoff 26de0996d9 MDL-12523 accesslib: revert changes to get_users_by_capability() - MDL-12452 MDL-12451
The changes made by Yu and Tim are superceded by the patches that
follow -- and would not apply cleanly without this revert.
2008-01-06 23:14:25 +00:00
martinlanghoff 18ef2fc61e lib/setup: restore sanity to rcache handling
$CFG->rcache is safe to keep, even as we are reading the config table.

This is because whenever we update the config table, all the rcache
plugins either mark the cache as dirty or they update the cache.

The reason we want to be able to preserve this is that rcache settings
in CFG should usually be set in config.php rather than in the config
table.

With this fix, we support both control points.

Merged from HEAD.
2008-01-06 22:56:11 +00:00
martinlanghoff 73733d1b4b dmllib:rcache_get()/rcache_set() clone cached records - we do not want magic references here - MDL-12827\n And calling fullclone() with the huge cost in serialize()/unserialize() is not needed. Merged from HEAD. 2008-01-06 22:46:49 +00:00
moodler f0a794d200 Automatic installer.php lang files by installer_builder (20080106) 2008-01-06 03:24:42 +00:00
thepurpleblob 235b0335ef MDL-12701:
Missing string

Merged from STABLE_18
2008-01-04 21:05:44 +00:00
stronk7 fea7cdb0ba This change was missing in 19_STABLE 2008-01-04 18:18:18 +00:00
stronk7 c319e83622 Fixing $Id expansion. 2008-01-04 18:13:07 +00:00
moodler 890aec679c FIxed the navigation on the course assign roles tab MDL-12828 2008-01-04 05:19:21 +00:00
moodler 377002f981 Automatic installer.php lang files by installer_builder (20080104) 2008-01-04 03:31:09 +00:00
poltawski c5e1dedb3c MDL-12825 - add some extra height to popups in IE7, otherwise they cant
be used
2008-01-03 22:40:12 +00:00
skodak b85226a64e MDL-12817 logout before 1.9 upgrade in order to prevent weird upgrade problems 2008-01-03 16:36:22 +00:00
skodak c05ce94476 MDL-6786 Improved dropping of block and module tables during uninstall 2008-01-03 15:02:59 +00:00
moodler 2fa04d6d4b Automatic installer.php lang files by installer_builder (20080103) 2008-01-03 03:24:17 +00:00
skodak f113b4cc91 MDL-9744 passwork field for ldap bind pw - patch by Iñaki Arenaza; merged from MOODLE_18_STABLE 2008-01-02 22:54:25 +00:00
skodak 883ceaf293 MDL-10975 enrol_database_sync.php will run even if the plugin is disabled - patch by Braden MacDonald 2008-01-02 22:35:33 +00:00
skodak d282117166 MDL-11471 adodb 4.96a import 2008-01-02 18:37:42 +00:00
skodak d2b41f28a8 MDL-12796 iplookup rewrite; MFC 2008-01-02 16:49:02 +00:00
skodak 4d3e308a52 file geoipregionvars.php was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:05 +0000 2008-01-02 16:48:00 +00:00
skodak a54217c8fd file geoipcity.inc was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:05 +0000 2008-01-02 16:48:00 +00:00
skodak fa0516e1c4 file geoip.inc was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:05 +0000 2008-01-02 16:48:00 +00:00
skodak 5b6d891d19 file earth.jpeg was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:04 +0000 2008-01-02 16:48:00 +00:00
skodak 936649fc69 file README.htm was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:05 +0000 2008-01-02 16:48:00 +00:00
skodak 6a981df540 file ChangeLog.htm was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:04 +0000 2008-01-02 16:48:00 +00:00
skodak 60eb215831 file marker.gif was added on branch MOODLE_19_STABLE on 2008-01-02 16:49:04 +0000 2008-01-02 16:47:59 +00:00
stronk7 789d840942 Respect case of enumvalues. MDL-12803 ; Merged from 18_STABLE 2008-01-02 16:47:34 +00:00
poltawski 8a898cb994 MDL-12789 - dont unnecessarily iterate over all groups 2008-01-01 23:03:02 +00:00
skodak a6c905fdac MDL-12794 admin setting for file location 2008-01-01 22:23:35 +00:00
skodak fb179457ce MDL-12793 PARAM_HOST incorrect cleaning 2008-01-01 17:21:54 +00:00
skodak 9263acf92a MDL-12790 highlighting in admin search results breaks html
MDL-12791 add defaults parameter to format_admin_setting()
MDL-12792 search in admin settings and defaults
+ minor speedup of fast highlighting and fixed empty span tags
2008-01-01 15:51:12 +00:00
poltawski ecf8aad8ca just tweaking comment for easy greppage 2008-01-01 15:30:09 +00:00
stronk7 225ff8f476 Better behaviour for "-" course searches under MSSQL and Oracle. MDL-7312 ; merged from 18_STABLE 2008-01-01 12:01:36 +00:00
moodler 2d00ab58bf Automatic installer.php lang files by installer_builder (20080101) 2008-01-01 03:15:04 +00:00
skodak dc2c453d63 MDL-11845 fixed security issues in curl related code in new download_file_content() + minor fixes in Snoopy 2007-12-31 23:16:56 +00:00
skodak f3566b2674 MDL-12786 admin search in configselect choices 2007-12-31 15:54:28 +00:00
skodak 5cc576de2f MDL-12782 magpie now uses download_file_content() - that should solve several remote RSS issues including proxy user/password + several download_file_content() improvements + other minor fixes 2007-12-31 15:36:48 +00:00
stronk7 1ee938f8ef Removed old timezones file. MDL-12024 ; merged from 18_STABLE 2007-12-31 15:27:11 +00:00
stronk7 40a6466542 Correct timezones listing when importing olson files 2007-12-31 15:24:22 +00:00
stronk7 f7cf45ab80 Prevent some debugging notices, cast to object before inserting. 2007-12-31 15:18:59 +00:00
stronk7 3e04a3cae9 Moving from old "timezones" location to the new "timezone" one. MDL-12024 ; merged from 18_STABLE 2007-12-31 15:06:09 +00:00
poltawski e967a609ae MDL-12777 - No longer a second option so tweak language 2007-12-31 15:01:51 +00:00
stronk7 6a51c3b132 1976 rules from 2007j Olson files. MDL-12024 ; merged from 18_STABLE 2007-12-31 13:22:21 +00:00
stronk7 1dd5f6455f file timezone.txt was added on branch MOODLE_19_STABLE on 2007-12-31 13:22:21 +0000 2007-12-31 13:20:36 +00:00
moodler 1ac07fdbcd Automatic installer.php lang files by installer_builder (20071231) 2007-12-31 03:19:00 +00:00
stronk7 19f28a9a35 Missed this in my previous commit. MDL-12698 2007-12-31 01:09:31 +00:00
stronk7 6dbe0406b6 Change some constants to avoid name collisions. MDL-12698 2007-12-31 01:03:37 +00:00
poltawski 5738a677f2 MDL-11845 - use the http 1.0 'Moved Temporarily' rather than unhelpful 'Found' 2007-12-30 23:09:29 +00:00
skodak 7271bdaf04 MDL-11830 a bit bigger button in login block, removing colons and adding css spacing 2007-12-30 22:54:16 +00:00
skodak bd955d4add MDL-12698, MDL-12569 - fixed inline docs 2007-12-30 22:35:45 +00:00
skodak 668932588a MDL-12775 PARAM_INT value '' automatically converted to 0 in configtext settings 2007-12-30 22:29:47 +00:00
skodak 5a5534d815 MDL-11845 unmask password field type for proxy url - thanks Dan for reminding me 2007-12-30 22:24:38 +00:00
skodak 52d4f11037 MDL-12698, MDL-12569 - componentlib & langimport improvements and fixes 2007-12-30 22:18:39 +00:00
skodak 593eb8ee75 MDL-11845 removing curl emulation library, snoopy has better support for proxies and seems to be more reliable on different platforms; spelling correction cURL instead of Curl; adding all proxy admin settings; better debug messages for file downloading; SOCKS5 proxy support 2007-12-30 19:42:04 +00:00
skodak 994190c63b MDL-12774 allow returning of errors from admin configtext settings 2007-12-30 17:58:30 +00:00
moodler f2bb3ae677 Automatic installer.php lang files by installer_builder (20071230) 2007-12-30 03:16:09 +00:00
mark-nielsen c992ccef67 Merging fixes for MDL-12383 and MDL-12605 from MOODLE_18_STABLE 2007-12-29 22:47:48 +00:00
mark-nielsen 56c256f030 Merging fix for MDL-12605 from MOODLE_18_STABLE 2007-12-29 22:16:03 +00:00
poltawski 3d3e3df555 MDL-11306 - adding a bit of info to try and explain that you can use
.domain.com to allow subdomains
2007-12-29 22:08:21 +00:00
mark-nielsen 69cf3d1ffb Merging fix for MDL-11900 from MOODLE_18_STABLE 2007-12-29 21:49:39 +00:00
mark-nielsen da367cb720 Merging fix for MDL-12610 from MOODLE_18_STABLE 2007-12-29 20:40:18 +00:00
poltawski 8ab536ef8c MDL-9925 - When a user presses cancel on restore they are sent to
/admin/. For teachers this gives an ugly access denied message,
so instead send them back to the course they came from.

Thanks to Wen Hao Chuang for the fix!
2007-12-29 20:29:00 +00:00
poltawski 6984aea08f MDL-12763 - proxy_url() in langimport was doing its own custom proxied
download magic. Convert to use download_file_contents() for more
robust downloads. And also add a more helpful error message while i'm
at it.
2007-12-29 20:01:04 +00:00
skodak e2d53c3d9e MDL-12756 print save button in admin search only when there are settings to save 2007-12-29 16:47:58 +00:00
skodak f62b5930a7 MDL-12752 making unsupported pages truly hidden 2007-12-29 16:35:59 +00:00
poltawski 1a30e1bc5c MDL-7242 eliminate last use of location to refer to city in profile where
it causes problems for translators
2007-12-29 15:35:38 +00:00
moodler 1946941cd7 Automatic installer.php lang files by installer_builder (20071229) 2007-12-29 12:18:40 +00:00
poltawski 3e6c7834ed Remove debugging message 2007-12-29 12:06:10 +00:00
stronk7 b097747f75 Added note about automatic DB creation. MDL-9609 2007-12-29 11:53:25 +00:00
stronk7 93c366d35d New string goes to installer lang files. MDL-9609 2007-12-29 11:50:09 +00:00
stronk7 9dbf0647b4 New string added to note about automatic DB creation. MDL-9609 2007-12-29 11:46:25 +00:00
stronk7 4698d64435 Under MySQL, create the db on install if possible. MDL-9609 2007-12-29 11:27:18 +00:00
moodler b4cc78ec68 Automatic installer.php lang files by installer_builder (20071229) 2007-12-29 03:18:14 +00:00
poltawski bb28536f44 MDL-3842 - tweak file-moving text to clarify 2007-12-28 23:23:46 +00:00
poltawski f0f110ff74 MDL-4962 - intialise var 2007-12-28 22:54:28 +00:00
stronk7 e7282f1fe6 Prevent race condition in event creation. MDL-5956.
Credit goes to Penny, Luke and Martin @ Catalyst.

Merged from MOODLE_18_STABLE
2007-12-28 18:57:45 +00:00
mchurch 23d08ac7be MDL-12703 - Use the 'welcometocourse' language string if there is no 'welcomemessage' property set in the course object. Currently, there does not seem to be any code or data items that would set this property. 2007-12-28 17:12:32 +00:00
mchurch 16614d8106 MDL-12704 - Added error handling to print_recent_activity() to prevent fatal errors in the case of missing files. 2007-12-28 16:00:24 +00:00
poltawski 32261099c9 MDL-5598 - Custom feed titles on RSS block did not allow spaces or other
useful characters ;)
2007-12-28 12:56:32 +00:00
urs_hunkler e0a046d040 MDL-12749 :: print_box_strart was closed with pint_simple_box_end. corrected. 2007-12-28 12:43:43 +00:00
poltawski 2a2113d1be MDL-2414 - using quotes in enrolment keys failed due to slashes. 2007-12-28 12:35:26 +00:00
iarenaza 4efbaec111 MDL-12323 MDL-4061 Don't connect to the LDAP server if update external is not set for any field.
Forward ported from MOODLE_18_STABLE
2007-12-28 12:08:57 +00:00
moodler 5fcd786eca Automatic installer.php lang files by installer_builder (20071228) 2007-12-28 03:33:58 +00:00
mchurch aef130f71e MDL-12744 - Add ability to pass an extra button for use in print header for modules that use the course page to display themselves with blocks. 2007-12-27 21:32:04 +00:00
urs_hunkler d7d14a80ef MDL-12745 :: added class clearfix to "form-item" to stop div collapsing. 2007-12-27 20:54:33 +00:00
poltawski f1b73b438f MDL-12209 - fix css errors 2007-12-27 15:38:53 +00:00
poltawski 1107dde0a1 ZZMDL-12345 - use consistent ordering on both sides of the assign group members
pane, sorted by lastname like other screens
2007-12-27 13:39:43 +00:00
poltawski 11bdc5ab49 MDL-12530 - fixed changing of tag type in tag management 2007-12-27 12:11:21 +00:00
poltawski ed3e48f765 MDL-9312 - prevent more than 20 chars being typed in city field, (we only
store 20 chars )
2007-12-27 11:35:38 +00:00
poltawski 9964700f5b MDL-12640 - if $CFG->country is set, use it for signup default 2007-12-27 11:17:58 +00:00
stronk7 17f1039b58 Bump to 1.9 beta 3 2007-12-27 00:15:12 +00:00
skodak 36d703a877 MDL-9552 reverting the [$userid] change - we do need array there in upgrades and changes in modedit 2007-12-26 23:20:54 +00:00
poltawski 08b6eeeae3 MDL-4164 - fix typo 2007-12-26 22:12:23 +00:00
poltawski e3a87a68b9 MDL-3776 fix typo 2007-12-26 21:40:01 +00:00
skodak ad2c8da954 MDL-12735 Make AJAX on by default, add option to disable AJAX course editing by default 2007-12-26 21:32:34 +00:00
poltawski f6453c1cde MDL-12734, fix calling print_header() twice 2007-12-26 20:18:14 +00:00
poltawski c5f4b371fe MDL-2013 - Stop resource auto-linking from occuring when resources are hidden 2007-12-26 17:41:48 +00:00
skodak cf0352fa3b MDL-12729 show recoverable fatal errors in DEBUG_ALL and DEBUG_DEVELOPER 2007-12-26 13:31:52 +00:00
skodak 50726e2969 MDL-12351 verify active group before use because allowed groups may change 2007-12-26 12:41:54 +00:00
skodak 05a3688962 MDL-12728 missing USER->mnehostid in forum cron processing 2007-12-25 22:21:19 +00:00
skodak 564c1a9392 MDL-11783 no uploads after finalising 2007-12-25 22:02:05 +00:00
skodak 1665e2d3b6 MDL-11758 removing one htmlpurifier file to prevent problems on some systems 2007-12-25 21:05:33 +00:00
skodak fbedee57ef MDL-12338 prevent KSES from breaking í chars in alt/title tags - credit goes to Eloy 2007-12-25 20:55:57 +00:00
skodak e262e268b2 MDL-12458 fixed gradebook upgrade/update problems when not grades yet in activities 2007-12-25 20:50:42 +00:00
skodak 3ff4e0d771 MDL-11561 tex debug leaking sensitive info 2007-12-25 11:41:46 +00:00
skodak 8450217132 MDL-11561 improved text filter cache resetting when settings change; fixed bug causing fatal errors if html purifier enabled during upgrade 2007-12-25 10:03:16 +00:00
moodler b2bc7cc85c Automatic installer.php lang files by installer_builder (20071225) 2007-12-25 03:17:23 +00:00
poltawski 8a4cb9dd5e MDL-12697 Category Themes do not appear when editing off 2007-12-25 00:59:31 +00:00
skodak 74a05d3fc8 MDL-12725 remove_dir() does not return correct status and fails if dir does not exist + improved sanity test in check_dir_exists() 2007-12-24 21:15:05 +00:00
skodak cb6400a485 MDL-12724 import of html purifier 2.1.3 2007-12-24 21:06:34 +00:00
skodak c525a81701 MDL-12713 all IE versions are broken beyond belief, rewrite of admin tree collapsing/expanding 2007-12-24 20:53:20 +00:00
moodler 7938b1cced Automatic installer.php lang files by installer_builder (20071224) 2007-12-24 03:21:34 +00:00
arborrow 1444c9d07e added comment to see MDL-9609 for progress on resolving auto creation of MySQL database 2007-12-24 02:35:49 +00:00
skodak 54e0d9a55c MDL-12720 removing confusing/not implemented CONTEXT_PERSONAL 2007-12-23 20:00:51 +00:00
skodak 9ddbe2cfb8 MDL-12720 removing confusing/not implemented CONTEXT_PERSONAL 2007-12-23 19:47:59 +00:00
poltawski cbf2ebdeee MDL-9981 - remove hardcoded admin path 2007-12-23 17:20:44 +00:00
poltawski 37c9edcbdf MDL-10611 - backslashes in username get doubled up with an nonsuccessful log in
merged from MOODLE_18_STABLE
2007-12-23 16:41:48 +00:00
poltawski 5dc7db71af MDL-10241 - unenrolling self wasn't working properly from user profile
because unenrol.php was doing wrong capability check when $userid set.o
Also improves the lanaguage used when unenrolling self.
merged from MOODLE_18_STABLE
2007-12-23 16:17:13 +00:00
poltawski 868f172373 MDL-10607 - support single quotes in db user/password in installer 2007-12-23 13:26:54 +00:00
skodak 4bdb55f50b MDL-12716 fixed admin setting for rcache; more robust rcache handling in setup.php 2007-12-23 13:08:56 +00:00
skodak 0c6d0ae8ed MDL-12717 use apply_default_exception_settings before other admin defaults 2007-12-23 12:04:59 +00:00
skodak 05b11fcb66 MDL-12714 no guest autologin for admin settings 2007-12-23 11:52:59 +00:00
skodak 8d6e06a18a MDL-12711 use 'checked' value for enabled resource_popup 2007-12-23 11:49:42 +00:00
skodak ed2d5284f7 MDL-12712 fixed multiselect when nothing selected 2007-12-22 21:57:28 +00:00
poltawski 2be702e457 MDL-12707 - moved hotpot/ lams to use new admin settings
backported from HEAD
2007-12-22 20:04:11 +00:00
poltawski 7c23e5eff3 file settings.php was added on branch MOODLE_19_STABLE on 2007-12-22 20:04:12 +0000 2007-12-22 19:57:46 +00:00
skodak eeaf6aa373 MDL-12705 disabled guest autoogin in upgrade scripts 2007-12-22 18:16:22 +00:00
poltawski d44522b5f7 MDL-12706 - fix caps typo 2007-12-22 17:04:09 +00:00
moodler 068deeb136 Automatic installer.php lang files by installer_builder (20071222) 2007-12-21 19:10:26 +00:00
tjhunt 6bd8edfbde Ensure links of the form /mod/quiz/view.php?q=332 are backed up and restored correctly. 2007-12-21 15:38:38 +00:00
tjhunt 88b020ce95 Sort the add activites dropdown using the locale. 2007-12-21 15:37:50 +00:00
nfreear 999fb96f7b Merged MDL-7493 further fix: clean up themes, and remove references to 'hide-show-image' background images. Document smartpix for theming icons in wood and orangewhite readmes. 2007-12-21 12:01:24 +00:00
nfreear f7bd77baf5 Merged MDL-7493 further fix: strip_tags from title strings because the titles may have HTML in them.
-From Martin D/moodler in moodleblock.class.php - thanks.
2007-12-21 11:28:50 +00:00
skodak 67c2776bae MDL-12690 use the same title for block in admin tree as in blocks manage page 2007-12-21 09:52:20 +00:00
scyrma dc82ac6eff Let the admin choose if a textfield is to be shown as plain text or as a password (with '*' in place of normal text) 2007-12-21 08:17:36 +00:00
moodler 0319f6ccac Automatic installer.php lang files by installer_builder (20071221) 2007-12-21 03:24:25 +00:00
stronk7 13ffbef897 tidy up phpdoc 2007-12-20 23:16:51 +00:00
stronk7 c15475c93b After some more tests... apply the new preconfigure_dbconnection()
to core. MDL-12657
2007-12-20 23:12:51 +00:00
stronk7 73c4f0de0e Adding the new preconfigure_dbconnection() function
to pre-define some BD/ADOdb stuff before connection. MDL-12657
2007-12-20 22:51:10 +00:00
skodak c7d6dce97d MDL-12683 - fixing broken tex in windows (borked by my last commit) sorry 2007-12-20 21:37:00 +00:00
skodak 45158bdb9d MDL-12443 use "UTF-8" label instead of "None" in sitemailcharset select box 2007-12-20 21:16:33 +00:00
skodak 766acf6ce4 MDL-12684 fixing wrong link to manual settings page - settings.php not implemented yet, sorry 2007-12-20 20:59:13 +00:00
poltawski 5d2fb0f679 MDL-12159 - We were only showing the filter selections to the user list when
there were more results than shown on the current page. This is unintuitive
with small lists where we were invisibly exluding users because of a filter
which is applied (but not shown on screen).

Now we always show the filter selections. Thanks to John Ryan.
2007-12-20 17:42:30 +00:00
skodak 583c8c1ebe MDL-12680 Assignment count for groups not working - patch by Greg Humphreys 2007-12-20 17:37:52 +00:00
poltawski cf20428733 MDL-12668 - Various themes not respecting theme varaibles 2007-12-20 17:31:18 +00:00
skodak 7e9b2809a9 MDL-12678 moved pinned blocks setup page to Modules/Blocks/ 2007-12-20 16:30:39 +00:00
skodak ed277edea0 MDL-11814 use system context for pinned blocks 2007-12-20 16:25:17 +00:00
poltawski 0c3cdd4d79 MDL-12638 - fixed typo 2007-12-20 16:16:50 +00:00
poltawski ae74081cc3 MDL-12670 - fix warning when groupings not enabled 2007-12-20 16:10:03 +00:00
poltawski 847af02833 MDL-12676 - generate navigation if none supplied to print_header_simple() 2007-12-20 15:48:37 +00:00
tjhunt 176c6e8a23 MDL-12675 - Give teachers a direct link from the quiz index page to the results. 2007-12-20 15:11:01 +00:00
poltawski bcb2b60ff9 MDL-12674 - use require_capability on the participants page to get
friendly error messages
2007-12-20 15:09:40 +00:00
skodak 59a1e0f320 MDL12672 fixed parent::search trouble 2007-12-20 14:38:01 +00:00
tjhunt 204f51c760 MDL-12666 - When moving questions between categories, we should default to copying amy linked files. 2007-12-20 11:26:50 +00:00
skodak 0d3b5bdc16 MDL-10464 user list download in bulk ops 2007-12-20 10:54:07 +00:00
skodak 165ea8e3bb MDL-12659 fixed warning 2007-12-20 09:00:59 +00:00
moodler 5f4d28ccf9 MDL-7493 further fix: strip_tags from title strings because the titles may have HTML in them. 2007-12-20 01:50:38 +00:00
whchuang 2b9cc5a966 Fixed MDL-11812, thanks to Alan Trick's report 2007-12-20 01:35:17 +00:00
mjollnir_ 363d415464 fixing lying phpdoc comments in role_cap_duplicate function that I moved to accesslib yesterday 2007-12-19 23:32:15 +00:00
skodak 4d3769bf61 MDL-12656 indicate when current value is incorrect and propose default instead in admin settings 2007-12-19 22:37:37 +00:00
poltawski bc97420bd4 MDL-11561 - tweaking language a bit 2007-12-19 22:35:49 +00:00
skodak a5b7f1ab73 MDL-12655 set_config() should cast values to string because get_config does that too 2007-12-19 22:31:16 +00:00
poltawski a3eed2b0c0 MDL-11561 - remove unused variable 2007-12-19 21:06:12 +00:00
diml c695bf2783 adding keys for LESSON Module 2007-12-19 19:29:26 +00:00
skodak a8419f1a9d MDL-11561 use 60x8 text area to fit on all screens 2007-12-19 18:41:09 +00:00
skodak 00c2507ab0 MDL-11561 nail the editor width to 640px in admin settings pages - prevents resize problems (whitespace fix) 2007-12-19 18:25:19 +00:00
skodak 285286acf3 MDL-11561 nail the editor width to 640px in admin settings pages - prevents resize problems 2007-12-19 18:24:57 +00:00
skodak 765e3e8e82 MDL-10401 redirect to site/admin/ if section error found 2007-12-19 18:04:18 +00:00
skodak 3e1f8e095c MDL-12858 fix course category depths during upgrade to 1.9 2007-12-19 17:47:31 +00:00
skodak 40f43aa1fc MDL-11561 admin tree improvements and bugfixing; backported from HEAD 2007-12-19 17:38:37 +00:00
skodak d7381358f8 file filtersettings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:49 +0000 2007-12-19 17:35:28 +00:00
skodak 530239bbc9 file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:49 +0000 2007-12-19 17:35:27 +00:00
skodak 92c1df4735 file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:45 +0000 2007-12-19 17:35:26 +00:00
skodak 07053e3df5 file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:41 +0000 2007-12-19 17:35:26 +00:00
skodak 86a42c8ac9 file filtersettings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:43 +0000 2007-12-19 17:35:26 +00:00
skodak 8caa580efd file plugins.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:37 +0000 2007-12-19 17:35:25 +00:00
skodak 618689ef22 file lib.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:41 +0000 2007-12-19 17:35:24 +00:00
skodak 6237517812 file filtersettings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:42 +0000 2007-12-19 17:35:24 +00:00
skodak 5b8f6bcc0b file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:48 +0000 2007-12-19 17:35:22 +00:00
skodak 2328f76997 file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:47 +0000 2007-12-19 17:35:22 +00:00
skodak f58505164c file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:43 +0000 2007-12-19 17:35:22 +00:00
skodak 0384e168e8 file settings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:46 +0000 2007-12-19 17:35:21 +00:00
skodak 14b34c4af3 file filtersettings.php was added on branch MOODLE_19_STABLE on 2007-12-19 17:38:45 +0000 2007-12-19 17:35:21 +00:00
tjhunt 6dd47a844f Teach XMLDB about the local/db folder, but only include it if the local folders exists. 2007-12-19 15:06:52 +00:00
nfreear b310a2d7c0 Followup for MDL-7493... - Finally the correct images! fix transparency, and improve contrast in Windows High Contrast Black mode. Merged. 2007-12-19 13:39:11 +00:00
tjhunt 7542409d39 New option on print_single_button to all printing of disabled buttons. 2007-12-19 13:31:06 +00:00
tjhunt 5af229ea58 gradebook / graded_users_iterator - Typo in conditional. 2007-12-19 12:40:02 +00:00
tjhunt 16ee776952 MDL-12647 - Moving multiple_choice questions between contexts breaks them.
There was a subtle interaction between get_question_options  and replace_file_links for this question type.
2007-12-19 12:10:50 +00:00
scyrma e8fe560958 Fix a bug passed on after commit of by http://lists.moodle.org/arc/commits/2007-12/msg00352.html
There shouldn't be html tags in this place.
2007-12-19 05:57:24 +00:00
poltawski 0600c266e9 MDL-12639 - prevent debug warnings about help buttons on database presets 2007-12-18 21:25:21 +00:00
mjollnir_ 4f5ffe5a7e moving two functions from admin/roles/manage.php (switch_roles and role_cap_duplicate) to accesslib & added phpdoc. Fixes MDL-12621 2007-12-18 20:50:39 +00:00
tjhunt e5f0e7d200 Improve the quiz_rescale_grade function, and call it from one other place, instead of duplicating code. 2007-12-18 18:19:36 +00:00
skodak b9015c2c2b MDL-12496, MDL-11889 allow deleting of activities with disabled grading from gradebook 2007-12-18 17:37:45 +00:00
nfreear fc025aeae5 Fixes reopened MDL-7493... - foreground show/hide block icon/ALT text switched with Javscript. Merged. 2007-12-18 17:25:59 +00:00
tjhunt 3f7c4ee5c4 MDL-12635 - Manual grading report does not check capabilites - also, only show the tabs for the reports people can access. 2007-12-18 16:11:41 +00:00
poltawski dca17878da MDL-12515 Feedback not available to student on assignments unless a grade has been assigned 2007-12-18 15:35:35 +00:00
tjhunt 5db5737b4f MDL-12517 - fix typo in the last commit. 2007-12-18 14:57:05 +00:00
skodak 7293bdf4cb MDL-12517 reverting the moving of data processign, returning array of warnings instead from function 2007-12-18 13:52:15 +00:00
skodak 44e65ebf62 MDL-12517 null not treated properly, max instead of min typo and pretty please initialize all objects properly 2007-12-18 13:26:30 +00:00
skodak 5b6219a750 MDL-12628 acces typo fixed 2007-12-18 11:59:52 +00:00
scyrma 72d707a346 MDL-12613 - this should fix (part of) the problem with the search block (take 2) 2007-12-18 08:17:13 +00:00
scyrma 075e3c715d MDL-12613 - this should fix the problem with the search block 2007-12-18 07:53:32 +00:00
moodler 7fdfade8dc Automatic installer.php lang files by installer_builder (20071218) 2007-12-18 03:26:51 +00:00
skodak 470b711740 MDL-12103 new config option for mail newline chars 2007-12-17 23:39:43 +00:00
skodak e1be3139a4 MDL-12524 fixed quoting of phrases in mail header (problem with special chars in names of users) 2007-12-17 21:37:59 +00:00
tjhunt cfa16a536e Strip out an unneccessary HTML table that way causing a 'button moves when you try to click on it' problem. 2007-12-17 17:17:17 +00:00
tjhunt 860f345ceb Minor quiz layout improvements. 2007-12-17 16:56:16 +00:00
tjhunt 833711e3b8 Unset a meaningless id. This probably does not change anything in moodle, but it was part of a bug fix in the OU version of Moodle that seemed correct, so I am merging it over. 2007-12-17 15:29:43 +00:00
tjhunt 204666c569 MDL-12616 - Improve layout so you can distinguish the student's response to an essay question from the feedback. 2007-12-17 12:28:00 +00:00
fmarier 00ff61c64a course/lib: Cache get_categories() using a static variable (MDL-11938)
Some recursive functions call get_categories() repeatedly to get all of the
child categories of the current one.

This commit create a lazily-initialized cache of all of the categories so
that the database is only queried once to retrieve all of the categories.

It speeds up the both the homepage and the course edit page (where the
categories are displayed in combo boxes).
2007-12-17 04:48:52 +00:00
poltawski 0b777b60c6 MDL-12385 - glossary category edit page doesn't respect $CFG->pixpath 2007-12-16 18:15:00 +00:00
poltawski 071680021c MDL-11086 - more tweaks to helpfile as per Rays suggestions 2007-12-16 16:13:26 +00:00
skodak 04a9e1a834 MDL-12596 Timezone problem in PHPMailer RFCDate() Function - patch submitted by Leo Gaggl 2007-12-16 14:50:02 +00:00
poltawski 5b243bb55d MDL-11191 - lets not advocate copyright abuse by advising to steal pictures
from the web!
2007-12-16 11:57:34 +00:00
skodak 60414b0b11 MDL-12599 , MDL-12598 - fixed capability tests in user and overview reports 2007-12-16 10:53:36 +00:00
skodak f337e9c2c9 MDL-12598 use user context instead of personal 2007-12-16 10:34:41 +00:00
urs_hunkler 6c9f235d93 CSS cleanups :: collect some background definitions in a basic property and work with cascading to more special definitions. 2007-12-16 09:39:52 +00:00
poltawski dd377953f7 MDL-12593 - hidden role assignment icon wasn't being shown. Also prevent warning
about unset $hidden
2007-12-15 23:27:01 +00:00
poltawski 2559de3be6 Improving phpdocs for when to use format_string()/format_text() based on
wiki comments. It wasn't an entirely clear (e.g. mixup in MDL-11800)
2007-12-15 18:40:18 +00:00
skodak 504e7efe76 MDL-12580 fixed infinite redirect loop when editing profile for the first time 2007-12-15 16:56:33 +00:00
skodak 138b92ce7f MDL-12592 do not execute theme_setup() if header already printed 2007-12-15 16:52:27 +00:00
skodak 7d23e00836 MDL-12581 fixed multiple xhtml strict 2007-12-15 16:05:30 +00:00
skodak 05719ae21a MDL-12585 make sure category path, parent and depth are ok before creating contexts 2007-12-15 15:46:37 +00:00
skodak 2637d1d193 MDL-8992 eoas hack added only when really needed, removed slow fullclone 2007-12-15 13:20:28 +00:00
skodak 62d19b5336 MDL-11800 improving previous commit 2007-12-15 12:05:12 +00:00
skodak 4df7a2ef4f MDL-12570 option to disable lang autodetect from browser 2007-12-15 11:48:34 +00:00
stronk7 8b32d8e829 19_STABLE version bump by delta. Modify some timezone fields to accept new olson files. MDL-12024 2007-12-15 00:31:31 +00:00
stronk7 b0f0e1bb3a Modify some timezone fields to accept new olson files. MDL-12024
Merged from MOODLE_18_STABLE
2007-12-15 00:30:41 +00:00
skodak 7fdb5ee675 MDL-12221 reworked container autoclosing - error() and notice() do not work everywhere though; notice print header if needed now; new print_footer('empty') for empty footer - removes some hacky </body></html> 2007-12-14 21:21:06 +00:00
toyomoyo fc9aacd2d7 MDL-9290, restore performance improvements on reading xml 2007-12-14 06:15:11 +00:00
urs_hunkler 7006fb7609 MDL-12221 :: Some enhancements to handle the changed boxes - work in progress. 2007-12-13 20:21:05 +00:00
urs_hunkler aeb10b1c28 MDL-11438 :: added screenshot.jpg to prevent IEs crashing on the them selection page. 2007-12-13 20:17:37 +00:00
tjhunt c9cde2149e MDL-12575 - Backup and restore problems with the new question bank. 2007-12-13 18:48:16 +00:00
stronk7 ac11681809 Added the sql_cast_char2int() funtion to provide cross-db
casting from char/text to integer. MDL-12574
2007-12-13 18:00:30 +00:00
tjhunt ddd8279beb Improve error messages. 2007-12-13 17:24:51 +00:00
tjhunt 6a729d0756 MDL-12517 - Further refinement. Move the processing to after print_header, so any notices do not break XHTML strict. 2007-12-13 14:26:01 +00:00
tjhunt 99a4959494 MDL-12517 - Move checking code into the user interface layer where it belongs. 2007-12-13 14:17:29 +00:00
toyomoyo c912cc7258 MDL-12517, notify when grades entered into gradebook is out of bounds 2007-12-13 07:08:52 +00:00
toyomoyo 86b73f8e9c MDL-12470, fixing broken span tag 2007-12-13 02:32:27 +00:00
tjhunt 946db1620f MDL-11267 - follow-up - don't show the checkboxes in the overview report if you cannot do anything with them. 2007-12-12 19:12:54 +00:00
tjhunt a488df2a95 Improve PHP doc comments. 2007-12-12 19:02:01 +00:00
tjhunt 4e0af3b107 Fix Javascript error from essay questions on the review page. 2007-12-12 18:10:50 +00:00
tjhunt b7f00cff12 Fix notice. 2007-12-12 17:47:37 +00:00
tjhunt ea7f759cbf MDL-9459 - Provide information relating to groups in the summary message "Attemts: 123". Now, depending on the situation, you see one of three messages: "Attempts: 123", "Attemtps 123 (45 from your groups)" or "Attemtps 123 (45 from this group)".
I also took the opportunity to improve the layout of this message slightly, and clarify the message that tells you that you cannot add or remove questions from the quiz if there are attemts.
2007-12-12 17:23:38 +00:00
tjhunt 297178bc87 Improve PHP doc comments. 2007-12-12 17:10:51 +00:00
toyomoyo 82b7f28a61 MDL-12544, hide hidden roles in profile when user has no capability 2007-12-12 07:12:38 +00:00
toyomoyo d40f5b74e6 MDL-12550, wrong user count in role assignment 2007-12-12 03:28:41 +00:00
stronk7 214f6d7493 Reintroducing the possibility to declare a second row of tabs
via extratabs. MDL-12551
2007-12-12 00:56:54 +00:00
stronk7 a88c2ffdaa Adding the ability to perform custom uninstall tasks in modules. MDL-12520 2007-12-11 23:38:38 +00:00
tjhunt 5775ef80c0 MDL-12546 - The choice module was calling get_users_by_capability, which hammers the database and returns lots of data, inside a loop over users - and it was calling it with identical parameters each time. Ouch!
Actually, since the fix for MDL-12331, which changed the get_users_by_capability call at the top of this function, the check it was doing is entirely redundant anyway, so I removed it.
2007-12-11 18:49:44 +00:00
tjhunt 0eea4f9355 MDL-12543 - Quiz overview report displays a grade of 0 the same way as a missing grade for an incomplete attempt. 2007-12-11 16:55:40 +00:00
tjhunt 8d531749c3 MDL-8682 - followup. When disabling the enter key, don't disable it on links. That is bad for accessibility. 2007-12-11 16:23:32 +00:00
tjhunt 6233a11b29 MDL-12542 - backup_todb not called on restore on date before it is inserted into mdl_user. This would cause a backup from a pre 1.7 site (or a pre 1.7 that has been upgraded to 1.9) to a 1.9 fresh install, to fail sometimes. 2007-12-11 15:21:28 +00:00
nfreear 0a440a8682 Fixes MDL-12541 "Weeks course format - dates for each section should be marked up as heading". 2007-12-11 15:17:55 +00:00
tjhunt c6d734d3f9 MDL-12540 - Quiz sometimes outputs content before <head> when previewing - breaks HTML strict. 2007-12-11 15:04:09 +00:00
nfreear 2ec308a8b5 Fixes MDL-12539 "Help link text for all admin/user filters are broken". Merged. 2007-12-11 14:01:17 +00:00
nfreear 29308ee5da Fixes MDL-12539 "Help link text for all admin/user filters are broken". Merged. 2007-12-11 13:01:13 +00:00
tjhunt eabc30d78b Take out debugging output in role_assign. It only tells you that something has worked, and everywhere else we use debugging output to warn people they have called an API wrongly. Therefore, this is just confusing now that we trust this bit of roles code. 2007-12-11 10:37:56 +00:00
toyomoyo 66064c5262 MDL-12504, gradebook export does not respect course item position 2007-12-11 05:42:08 +00:00
scyrma 1c8bf4e4c2 prevent some notices, cleaner code. 2007-12-11 05:09:08 +00:00
scyrma 64fa3a1f8f MDL-12528 - getElementById was misspelled. 2007-12-11 04:58:13 +00:00
jamiesensei be350cb127 MDL-12410 - a way to select which questions to export, includes debug messages 2007-12-11 03:54:21 +00:00
toyomoyo 0abcfef0c9 MDL-12463, do not backup mod gradeitems if not selected 2007-12-11 03:15:33 +00:00
toyomoyo ed8bd3952b MDL-12519. grader report row colors override highlighting 2007-12-11 02:04:00 +00:00
martinlanghoff 25977a0eaf MDL-12523 accesslib:cleanup_contexts() - Fix invalid SQL syntax and reserved keywords
cleanup_contexts() was not working on Oracle - mostly due to 2 SQL
syntax problems. So probably marginally working elsewhere.

 - We should not use AS when naming table/subselect aliases - only
   when referring to column aliases in the resultset

 - level is a reserved word - oops! - so back to contextlevel
2007-12-10 21:34:05 +00:00
tjhunt abc011e5cc MDL-12512 - Gradebook calculations are broken. This was caused by == FALSE that should have been === FALSE deep in the 3rd pary maths lib. 2007-12-10 17:37:01 +00:00
tjhunt 1bb997ecc3 Do not suppress errors from developers! it makes debugging a nightmare! 2007-12-10 16:53:11 +00:00
tjhunt 200640a52c Fix notice in numerical question. 2007-12-10 11:57:22 +00:00
stronk7 2494fa8c7b Document MDL-12378 2007-12-09 18:21:39 +00:00
stronk7 6931f8a7b5 Prevent XHTML breackage. MDL-12378 2007-12-09 18:19:24 +00:00
skodak d6948ebc6a MDL-11835 proper merging 2007-12-09 15:26:00 +00:00
stronk7 91cd49491c Changing wrong UNSIGNEDs to nulls in tests. MDL-11662 2007-12-08 18:52:12 +00:00
stronk7 c9a6c442a3 Changing XMLDB_UNSIGNED to nulls for non-numeric types. MDL-11662 2007-12-08 18:33:33 +00:00
stronk7 25da458902 XMLDB_UNSIGNED only applicable to number types. MDL-11662 2007-12-08 18:18:56 +00:00
tjhunt f8c7c3ae32 MDL-12501 - Logic for including 'Grades' link in admin block is different for the logic in grade/report/index.php. 2007-12-07 16:57:53 +00:00
sam_marshall cc4dae1350 MDL-12500 Fixed restore conversion for links in database templates 2007-12-07 16:26:07 +00:00
stronk7 1b2335b2c6 Using new cross-db sql_isnotempty() function. MDL-12084
Backporte from HEAD
2007-12-07 16:02:08 +00:00
sam_marshall ac1b88eab8 MDL-11845 Last checkin accidentally omitted a require_once (hopefully finally done now!!) 2007-12-07 11:11:13 +00:00
sam_marshall 58520f98b0 MDL-11845 Updated the three file downloads from Snoopy to download_file_content (which I didn't know about before :) 2007-12-07 10:23:27 +00:00
moodler 3563da4aad Added some whitespace as a test, sorry for the noise 2007-12-07 08:12:43 +00:00
moodler 15ad5491a4 Added whitepspace 2007-12-07 07:45:52 +00:00
fmarier ec7125dc19 weblib: Fix typo in print_table() which was causing invalid <th> tag
MDL-11506
2007-12-07 04:59:32 +00:00
toyomoyo 8353edcdf1 customized cron should be in dirroot/local/cron.php 2007-12-07 04:38:57 +00:00
toyomoyo b1b887fd84 MDL-12373, restore should not try to restore pre 1.9 gradebook categories 2007-12-07 04:06:33 +00:00
moodler ba1674a11c A test commit, only whitespace affected 2007-12-07 02:26:59 +00:00
toyomoyo 9132d15eca MDL-12432, do not enable 'updated only' grades export for other plugins 2007-12-07 01:40:45 +00:00
mattc-catalyst b97e501d33 MDL-12433: course/info respect the $CFG->allowvisiblecoursesinhiddencategories setting
Credit goes to Petr Kalis
2007-12-07 00:24:29 +00:00
mattc-catalyst 4ead5c7e3c MDL-12335: mod/lesson - fixed missing navigation links 2007-12-06 22:52:27 +00:00
sam_marshall a8e3b790b5 MDL-11845 Support for config proxy options when downloading language packs (& other components), timezone file 2007-12-06 18:07:42 +00:00
poltawski e0af2ed26c MDL-12464 - if a glossary is deleted, it causes some breakage in the
random glossary entry block
2007-12-06 15:42:01 +00:00
skodak a964e03d4f fixing unmerged files 2007-12-06 09:30:45 +00:00
skodak 0cec6e0c68 fixing unmerged files 2007-12-06 09:23:27 +00:00
skodak f8ed98f83b fixing unmerged files 2007-12-06 09:02:02 +00:00
moodler 6aac29e4ef Bumped the version to Beta 3 for new CVS server 2007-12-06 07:46:42 +00:00
toyomoyo be8e377c91 MDL-12352, block/search fails to install on postgres 2007-12-06 07:07:32 +00:00
moodler 3bdac46d14 Automatic installer.php lang files by installer_builder (20071206) 2007-12-06 05:22:42 +00:00
toyomoyo a08b933a00 MDL-12451, in get_users_by_capability(), defaultroleid bit fixes 2007-12-06 03:55:19 +00:00
tjhunt ccc64d9cf0 MDL-12452 - not a fix I fear, just clarifying the comments about how this method is broken. 2007-12-05 17:25:18 +00:00
tjhunt 22dd4e275a MDL-12438 - followup - fix typos. Thanks to Dan Poltawski. 2007-12-05 16:50:15 +00:00
tjhunt ecfa2d90ff MDL-12450 - Matching up roles on the restore settings form is broken - this is basically a complete rewrite of these two functions. 2007-12-05 16:13:59 +00:00
diml 6e7e89849a fixing security hole. reference : http://moodle.org/mod/forum/discuss.php?d=85748#p379857
Inaki Arenzana
2007-12-05 15:55:27 +00:00
poltawski 33dfd09c2d MDL-12446 - profile signup page not respecting custom user profile field
sortorder
2007-12-05 14:29:55 +00:00
nicolasconnault 4e5fa682b5 MDL-11835 Implemented changes discussed in http://moodle.org/mod/forum/discuss.php?d=85908. Also added item name and module name and category name (for category totals) in alt tags of icons 2007-12-05 09:35:18 +00:00
toyomoyo 1c47be2472 MDL-12430, if new and regrade are chosen, then preview hides 'old' students 2007-12-05 07:49:21 +00:00
toyomoyo 566e9d1313 MDL-12439 database preset fixes 2007-12-05 06:12:38 +00:00
toyomoyo 26deeb61ab MDL-12435, cancel in preferences form doesn't work 2007-12-05 02:58:54 +00:00
toyomoyo c635d2acc8 MDL-12437, sorting by names adds teacher to gradebook list 2007-12-05 01:12:02 +00:00
skodak ce9dd0470a MDL-12133 fixed regression in user advanced edit, sorry 2007-12-04 23:52:09 +00:00
mudrd8mz 907e321018 Do not produce PHP warnings in case string file does not define array $string 2007-12-04 21:50:35 +00:00
tjhunt a7502277f2 MDL-12438 - Print a develoer debug message if you call get_records with a non-unique first column. 2007-12-04 17:29:35 +00:00
nicolasconnault 5203f7252e MDL-11835 Implemented all the default settings suggested in the pdf report, and turned down the size of the report table fonts. 2007-12-04 16:05:57 +00:00
poltawski d5ca7a5706 MDL-12415 - When we have more than one category/lots of courses the course
block shows two links next to search other (Search Courses/All courses)
which point to the same place....

The all courses link is able to be switched off and the search courses is not,
for this reason i've gone for removing the search courses link.
2007-12-04 12:54:47 +00:00
sam_marshall afeec49db6 MDL-12431 Added ability for filters to contain lang files 2007-12-04 11:46:12 +00:00
nicolasconnault dbb552852a MDL-12389 Removed the selectallornone element in favour of a more generic submitlink element. The checkbox controller is now added to a form using moodleform::add_checkbox_controller. 2007-12-04 10:27:14 +00:00
martinlanghoff 7e17fa336e datalib: get_logs_user*() - fix invalid SQL - MDL-12426
Oracle does not accept column labels in the GROUP BY section -
get_logs_usercourse() and get_logs_userday() were computing the
day/hours column and using it in the GROUP BY. The compatible fix
is to reproduce the same computation in the GROUP BY section.

Credit for the fix goes to Dennis Rochford <Dennis.Rochford@usq.edu.au>.
2007-12-04 06:24:23 +00:00
martinlanghoff fc3a00b2dc blocks/online_users: Remove SQL "id,id" which causes errors on Oracle - MDL-12425
Credit for the fix goes to Dennis Rochford <Dennis.Rochford@usq.edu.au>
2007-12-04 06:23:44 +00:00
martinlanghoff a3fd4aeea7 mod/assignment: Remove SQL "id,id" which causes errors on Oracle - MDL-12425
This loop also needs some rewriting - it is _very_ inefficient on
large courses.
2007-12-04 06:23:23 +00:00
martinlanghoff eaad116912 accesslib: build_context_path() remove $temptable for Oracle too
The removal of $temptable was incomplete - and so build_context_path()
was broken on Oracle. MDL-11347
2007-12-04 06:23:06 +00:00
moodler 522437d506 Automatic installer.php lang files by installer_builder (20071204) 2007-12-04 05:24:57 +00:00
toyomoyo 8473f41780 MDL-12399, shorten_text() truncates all closing tags 2007-12-04 05:07:11 +00:00
toyomoyo d5694b16bb MDL-12419, do not present course start date if start date is invalid 2007-12-04 01:07:59 +00:00
toyomoyo ff302bdbb9 MDL-12419, do not present course start date if start date is invalid 2007-12-04 01:03:12 +00:00
fmarier ce32e5047d ddllib: Mark table_column() as deprecated
Signed-off-by: Eloy Lafuente
2007-12-03 23:19:17 +00:00
stronk7 50371de63b Adding some outer spaces to returned SQL to avoid wrong
sentences caused by concatenation.

Merged from MOODLE_18_STABLE
2007-12-03 20:43:43 +00:00
stronk7 257d6684ca Adding two new functions: sql_isempty() and sql_isnotempty() to perform
SQL comparisons to empties in a cross-db way. General solution for
problems like MDL-12084

Merged from MOODLE_18_STABLE
2007-12-03 20:28:45 +00:00
nicolasconnault 4d502df33f MDL-12389 Removed testing code 2007-12-03 20:07:24 +00:00
nfreear 9008efba33 Fixes bug MDL-12416, Help links - img ALT text should contain phrase "new window" to match link TITLE. Merged. 2007-12-03 16:44:49 +00:00
nicolasconnault 3e328cac4e MDL-12389 Added a new getElementsByClassName function in lib/javascript.php, added the selectallornone formslib element, modified the advcheckbox element to support the group variable, and implemented the new element in grade_export_form 2007-12-03 15:42:08 +00:00
poltawski ab8eeb7b5a MDL-12409 - stop access to editing 'site course' with course edit form. 2007-12-03 12:12:15 +00:00
toyomoyo 5c451f237d MDL-10915, additional setting for emoticons 2007-12-03 06:25:58 +00:00
toyomoyo d062a31039 wrap search/replace in a function so that it could be used in cron 2007-12-03 04:45:49 +00:00
toyomoyo 58d4c2f1c0 MDL-12397, gradebook sort by names should start with ASC 2007-12-03 02:02:49 +00:00
tjhunt 974fc258fb MDL-12373 - If you can see your user profile, but don't have moodle/course:viewparticipants, you get a link in the nav bar that takes you to an error message. 2007-11-30 12:07:25 +00:00
tjhunt 25c052dbd7 MDL-12393 - Layout tweaks on question category editing page. 2007-11-30 11:00:06 +00:00
scyrma 4b50cb9857 Code style corrections. 2007-11-30 03:08:05 +00:00
toyomoyo 79aa617250 adding support for customized cronjob 2007-11-30 01:56:52 +00:00
toyomoyo 5ed7235b17 fixing duplicate navigation 2007-11-30 01:15:34 +00:00
moodler 2548ed0c9c New installer files added - stronk7
Backported from HEAD
2007-11-29 17:03:39 +00:00
moodler abe74df9d9 file installer.php was added on branch MOODLE_19_STABLE on 2007-11-29 17:03:33 +0000 2007-11-29 16:59:26 +00:00
skodak 5642a74c63 MDL-7028 rewritten course reset + forum role_unassign cleanup fixes 2007-11-29 14:40:36 +00:00
scyrma a723bf77c4 Possible fix to MDL-12093 : give window without heading and navigation special css classes. 2007-11-29 07:18:53 +00:00
toyomoyo 4904f5c7a5 fixing a typo 2007-11-29 07:08:45 +00:00
moodler e38cd94623 Automatic installer.php lang files by installer_builder (20071129) 2007-11-29 06:00:48 +00:00
scyrma 4c75fbc5bb MDL-12093 : new strings to get locale-aware popup windows. 2007-11-29 05:59:18 +00:00
scyrma 84f78756c8 MDL-12093 : cleanup & simplify code to get popup windows. 2007-11-29 05:52:38 +00:00
toyomoyo 095c40469a MDL-12346, lesson module GIFT import fails 2007-11-29 04:31:14 +00:00
stronk7 cb60bc9eda Adding new wraplevelXX class for easier containers identification. MDL-12339 2007-11-28 18:13:32 +00:00
tjhunt 811c6b01e0 MDL-12330 - moving a question that uses an image in a subfolder of course files, where the same subfolder does not exist at the destination, fails. 2007-11-28 16:43:04 +00:00
urs_hunkler 210caf54a8 added missing pix 2007-11-28 16:14:58 +00:00
urs_hunkler 6480900924 file adv.gif was added on branch MOODLE_19_STABLE on 2007-11-28 16:14:58 +0000 2007-11-28 16:14:08 +00:00
urs_hunkler c5de7683ad file req.gif was added on branch MOODLE_19_STABLE on 2007-11-28 16:14:58 +0000 2007-11-28 16:14:07 +00:00
urs_hunkler 63aaa32f88 MDL-12370 :: added missing images 2007-11-28 14:20:56 +00:00
tjhunt 49aeee2bf6 MDL-12369 - get_actual_response should not truncate the student's response. 2007-11-28 12:45:42 +00:00
skodak a863e9a119 MDL-7028 gradebook related changes for course reset 2007-11-28 09:43:04 +00:00
toyomoyo 53bbf98533 MDL-10263, enable forum search for multiple groups 2007-11-28 07:51:48 +00:00
nicolasconnault f6ae5aee7c MDL-12356 Merging changes back from HEAD 2007-11-28 05:15:54 +00:00
toyomoyo 55271966bf MDL-11818, single post forum descript = first post 2007-11-28 05:08:19 +00:00
toyomoyo 2266595f2f MDL-11800, multilang support for category description 2007-11-28 02:56:04 +00:00
toyomoyo 33d78656e4 MDL-12326, adding missing footer 2007-11-28 01:24:52 +00:00
toyomoyo 76cf7cce29 MDL-12366, removing useless print_capabilities function 2007-11-28 01:19:38 +00:00
tjhunt b4c11424e2 MDL-12362 - Don't show scores for incomplete attempts on the quiz view page. 2007-11-27 19:18:11 +00:00
nicolasconnault 7f5f3d5f28 MDL-8863 Initial page field was disabled when there were no entries in the wiki, making it useless. It is now always enabled 2007-11-27 13:30:22 +00:00
nicolasconnault 43ba326a82 MDL-12098 Printing a closing div tag and the moodle footer 2007-11-27 10:31:48 +00:00
nicolasconnault b3469a7e13 MDL-12312 Reviewed and slightly improved Petr's great help file 2007-11-27 10:00:45 +00:00
gbateson 4761566c54 MDL-12318 filter/mediaplugins/filter.php can no longer insert mediaplayers into javascript, so hotpot module now requires its own filter to mimic behavior of multimedia filter in Moodle 1.7 2007-11-27 08:41:00 +00:00
nicolasconnault 9333d66af5 MDL-9506 Added support for 'course' type in grade_get_grade_items() function, plus corrected a few typos 2007-11-27 07:08:41 +00:00
nicolasconnault cd7bc967e3 MDL-12356 CSS classes implemented 2007-11-27 06:38:56 +00:00
moodler 00a00321ae FIxed up info about recordset usage 2007-11-27 05:58:18 +00:00
toyomoyo 430196f1a0 MDL-12352, block/search fails to install on postgres 2007-11-27 05:30:10 +00:00
scyrma dab7fce2aa imagealt wasn't loaded in a list of the user's posts. 2007-11-27 04:59:35 +00:00
toyomoyo 19907e0cfa fixing a typo 2007-11-27 03:22:03 +00:00
toyomoyo 2be1f0f6bb MDL-11194, course role names not reflected in course description 2007-11-27 01:52:17 +00:00
skodak 81bfdff8dd MDL-12350 do not set parent cat when updating 2007-11-26 17:44:46 +00:00
dwoolhead 81d923af09 MDL-12313 basically rationalising getting calendar events function calls 2007-11-26 14:43:07 +00:00
jamiesensei 619b3ca8db fix for error message 2007-11-26 13:34:47 +00:00
toyomoyo 52fbb269fd MDL-12331, hidden teacher should not be displayed in choice results 2007-11-26 06:00:55 +00:00
scyrma 1e27409e63 MDL-12294 - one more string fix 2007-11-26 04:51:06 +00:00
scyrma 35c9a930f3 Fix for part of the missing strings, as reported in MDL-12294 2007-11-26 04:42:23 +00:00
toyomoyo 717d379f57 MDL-12175, forum reset should delete attachments 2007-11-26 04:21:30 +00:00
toyomoyo 98ee46df71 expect multiple groups from sql 2007-11-26 03:21:20 +00:00
toyomoyo cb00cf26de MDL-12081, teacher with import capability can not import course 2007-11-26 02:38:56 +00:00
moodler 013c9869e1 Automatic installer.php lang files by installer_builder (20071125) 2007-11-25 03:57:12 +00:00
skodak a11abf14cb MDL-12130 fixed regression - disabledIf did not work in dateselectors 2007-11-24 13:36:13 +00:00
skodak ef4ad6c66e MDL-12133 validate() method tidying up 2007-11-23 22:12:34 +00:00
skodak a7d006a0d9 MDL-12329 fixed last access when course not accessed yet - patch by Yolanda Ordóñez Rufat 2007-11-23 21:30:46 +00:00
skodak 6900784f92 MDL-12221 custom themes revisited - fixed bug in previous commit, added more developer debug 2007-11-23 20:23:43 +00:00
skodak d6756ebbbc MDL-12221 custom themes revisited - implemented container concept 2007-11-23 16:41:13 +00:00
thepurpleblob a87249f196 MDL-12296:
Oops, missed adding do-not-unenrol option to synchronisation script.
Also took out bogus test function
2007-11-23 15:41:27 +00:00
moodler 868282ddc0 Automatic installer.php lang files by installer_builder (20071123) 2007-11-23 05:02:43 +00:00
stronk7 7b6da3346c Deleting one ='' condition that isn't cross-db nor necessary. MDL-12186
Merged from MOODLE_18_STABLE
2007-11-22 22:46:56 +00:00
skodak a75f4ef3e3 MDL-12312 fixed outdated aggregation help, added examples 2007-11-22 21:35:34 +00:00
tjhunt d1453ce26e MDL-12322 - Reference to incorrect language file 2007-11-22 18:15:07 +00:00
skodak 4aa2dc193f MDL-12312 fixed outdated aggregation help 2007-11-22 17:52:08 +00:00
tjhunt 1dcf42a4ba MDL-12282 - fix typo in previous commit. Sorry. 2007-11-22 11:51:19 +00:00
nicolasconnault a4a66fc93b MDL-9506 Returning stdclass objects instead of grade_item objects 2007-11-22 08:50:33 +00:00
moodler 338efed0ca Rename Smallest -> Lowest so it pairs with Highest 2007-11-22 07:04:25 +00:00
scyrma d2957326c8 Replaces 'GMT' by 'UTC' where it showed in user interface and fixes MDL-9164. 2007-11-22 06:26:58 +00:00
toyomoyo 81e19d3595 MDL-12309, gradebook can not sort by names while in group mode 2007-11-22 05:15:47 +00:00
toyomoyo b7144a35b3 removing user class from firstname/lastname cell, to avoide arrow image css 2007-11-22 01:37:00 +00:00
toyomoyo 3202bd7416 turn this block off when CFG->messaging is off 2007-11-22 01:16:37 +00:00
toyomoyo 9e4ae46a4b MDL-10028, adding a string 2007-11-22 01:04:59 +00:00
tjhunt 4a0f06d551 MDL-12305 - Don't let the quiz reorder tool put a page break at the start of the quiz. 2007-11-21 18:08:56 +00:00
tjhunt a5f1acc2b4 MDL-12305 - Quiz reorder tool broken. 2007-11-21 17:59:52 +00:00
tjhunt ac6fa5eb90 Fix some whitespace. 2007-11-21 16:30:14 +00:00
tjhunt c4c1a7737f Fix typo. 2007-11-21 16:28:40 +00:00
nfreear 375f8d33f8 Fixes reopened bug MDL-7472, "Explicitly label radio buttons in Survey" - removes use of USER->screenreader using get_accesshide + many other accessibility fixes. MERGED. 2007-11-21 15:06:02 +00:00
thepurpleblob 5612af0dba MDL-12296:
Added option to prevent database enrolment plugin unenrolling users.
2007-11-21 11:07:56 +00:00
thepurpleblob e80944a42a MDL-12296:
Add option to turn off unenrolment by database plugin.
2007-11-21 11:04:52 +00:00
nicolasconnault 08403fd61c MDL-9506 Implemented and tested the new API functions 2007-11-21 10:04:19 +00:00
toyomoyo 02bd2e0d38 MDL-10294, MDL-10028, changing messaging/bulk messaging system 2007-11-21 07:52:50 +00:00
mudrd8mz 36d2ca6559 MDL-8090, MDL-10664 & others - improved help files editing
* langdoc.php has been merged into lang.php, some GUI improvements
* ability to edit both master and local help files
* preview fix (but still blocked by MDL-12291)
* added a help file
2007-11-21 02:56:30 +00:00
stronk7 7a92a518b3 Applying one missing string. tableofcontentsabbrev. MDL-12071 2007-11-20 23:43:15 +00:00
stronk7 a62cc62551 Adding one missing string. tableofcontentsabbrev. MDL-12071 2007-11-20 23:40:49 +00:00
diml 794d8721c0 added default values for datetime fields 2007-11-20 23:29:44 +00:00
diml c75d22a17c adding lesson support to 1.9 STABLE 2007-11-20 23:28:29 +00:00
diml e7b43fe5a2 fix unchecked foreach loops 2007-11-20 23:27:45 +00:00
diml 3b0d855c3c fix table name for deletion of indexes before regeneration 2007-11-20 23:27:26 +00:00
sam_marshall eebf6e2a47 MDL-12284 Moved require_js to weblib and improved it so that it works if called during header (also tidied up code) 2007-11-20 18:03:14 +00:00
tjhunt 5ee185d12e MDL-12286 - 'Save as new question' button ignores the setting in the 'Save in category' dropdown. 2007-11-20 17:51:45 +00:00
tjhunt b35f76841d MDL-12172 - Sorry, more fall-out from converting continue buttons to use GET instead of POST. Sometimes, URLs were being passed in with & already repalced by &amp; and we weren't handling that properly. Should now be fixed. 2007-11-20 17:30:56 +00:00
tjhunt 011508b2b0 MDL-12282 - Numerical question type - the units are displayed on the editing form with a stupidly large number of decimal places. Merged from MOODLE_18_STABLE. 2007-11-20 16:57:15 +00:00
tjhunt e1a0eb49d6 MDL-12280 - Question bank forgets sort order when adding multiple questions to a quiz. 2007-11-20 15:54:21 +00:00
tjhunt 09846a54ad MDL-12133 - Errors calling parent::validation in a moodle form subclass because the base class method returns true not an empty array. This patch allow subclasses to start their validate method with
$errors = parent::validation($data, $files);

which is what you naturally want to do if you are used to object oriented programming.
2007-11-20 15:07:48 +00:00
tjhunt 06d7ef9cd3 Remove a developer debug notice and save a database query. 2007-11-20 14:46:33 +00:00
nfreear 14156d6b54 Fixes for bug MDL-12256, "Course AJAX has very poor accessibility - ALT text" (includes white-space cleanup). Merged (+ hacks for IE). 2007-11-20 14:24:41 +00:00
ethem 104838c9db Fix for Canadian Postal Code
http://moodle.org/mod/forum/discuss.php?d=81736
2007-11-20 13:30:50 +00:00
tjhunt 1a632495f7 MDL-12133 - Errors calling parent::validation in a moodle form subclass because the base class method signature was changed. This patch fixes all calls to parent::validation in the question editing forms. 2007-11-20 12:40:44 +00:00
scyrma 6ededd5f41 Makes it possible to confirm users using manual auth system. 2007-11-20 05:26:57 +00:00
moodler 36103b02fa Automatic installer.php lang files by installer_builder (20071120) 2007-11-20 05:17:31 +00:00
toyomoyo c1427112a1 fixing header/formatting 2007-11-20 05:14:55 +00:00
toyomoyo cba041369f MDL-12234, fixing unicode issues for global searchy 2007-11-20 04:09:41 +00:00
mattc-catalyst a559555e6c MDL-12264 - course/info: check if course is hidden before displaying info about it.
Author: Matt Clarkson <mattc@catalyst.net.nz>
2007-11-20 02:34:55 +00:00
martinlanghoff 244f618892 MDL-12142 mailout-debugger: Now works on Windows too
Switched to use sys_get_temp_dir() to define
which tempdir to use.
2007-11-20 00:32:15 +00:00
martinlanghoff 27bb711fe9 accesslib: has_capability_in_accessdata() respects rdef locality a bit more
With this patch, we respect rdef locality when two roles
assignments in the same context have conflicting rdefs.
In that case, the most local rdef wins.

So RA locality still matters most. If you are a teacher
sitewide and a student in course X, student role trumps
teacher.

For a use case, see the discussion here
http://moodle.org/mod/forum/discuss.php?d=84472

Notes:

- If we wanted to have locality of RDEF trump everything
  we can. A comment in this patch shows how.

- I don't know how to reproduce this in pure SQL.

And Also:

This patch also fixes a bug where if CAP_PROHIBIT was set
_and_ another role added to it in the same context, we would
add or substract 1 to CAP_PROHIBIT, and it would lose its magic.

And while at it, tighten the code to avoid casts. All the
ints are unambiguously ints.
2007-11-20 00:19:07 +00:00
stronk7 d77bd5ecbe Some question formating...
Merged from MOODLE_18_STABLE
2007-11-20 00:08:58 +00:00
skodak 24b3c8307f MDL-12249 fixed distribution for small groups 2007-11-19 22:53:50 +00:00
skodak bad6da7acc MDL-12249 fixed small group ration, can be overriden from config.php now 2007-11-19 21:30:47 +00:00
skodak 70e10c77f3 MDL-12249 groups UI cleanup and improvements - see tracker for details 2007-11-19 20:27:50 +00:00
nfreear 9523ad0ab7 Initial fix for MDL-12256, "Course AJAX has very poor accessibility - ALT text" - test, imgAttributes.length NOT attributes.length. Merged. 2007-11-19 15:26:29 +00:00
sam_marshall ee20235449 MDL-12075 Display individually colour-coded events in calendar rather than random day colours 2007-11-19 10:50:53 +00:00
moodler 17afefef30 Improvements to the tabs for assigning and overriding roles. MDL-12120
Tabs are now all on the top row
Tabs have clearer titles
Other help texts improved
2007-11-19 07:10:48 +00:00
moodler d0131dbd89 Added some styles so that override screens have color. MDL-12248 2007-11-19 06:56:50 +00:00
scyrma 64b489a10d MDL-3632 : this prevents people without mod/forum:viewhiddentimedposts to see hiddentimedposts. 2007-11-19 04:42:43 +00:00
toyomoyo 8ed7f23e33 MDL-12218, display course specific rolenames on override page 2007-11-19 04:34:16 +00:00
toyomoyo 08f256c416 MDL-12217, display course specific rolename in participants page 2007-11-19 04:12:38 +00:00
martinlanghoff 27278d2346 user_login() was not converted to using get_cache_flags().
It was still using the 'old' get_config() interface, so the 'cookie'
set by ntlmsso_finish() wasn't retrieved at all, and the automatic
login always failed.

Signed-off-by: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>


Author: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>
Committer: Martin Langhoff <martin@catalyst.net.nz>
2007-11-19 02:51:36 +00:00
martinlanghoff bb4bfe13df If the cache flag is not set, it doesn't make sense trying to test its value
Signed-off-by: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>


Author: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>
Committer: Martin Langhoff <martin@catalyst.net.nz>
2007-11-19 02:51:25 +00:00
martinlanghoff c124578f93 Fix typo in ntlmsso_finish()
Signed-off-by: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>


Author: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>
Committer: Martin Langhoff <martin@catalyst.net.nz>
2007-11-19 02:51:14 +00:00
martinlanghoff 2e2892ce89 auth/ldap: "creators" role assignment now also supports contexts
Now the DNs that indicate a course-creator role can also be contexts.
This way we support one more widely used practice in the weird and
wonderful LDAP world... MDL-12178
2007-11-19 02:50:55 +00:00
toyomoyo 896c18e842 MDLSITE-294, have to use a type cast 2007-11-19 02:23:30 +00:00
toyomoyo a3752a0b13 MDLSITE-294, role id needs to be an int, not a string 2007-11-19 02:06:37 +00:00
mattc-catalyst fc0e5e988e MDL-12172: fixed get parameters not being submitted in Firefox
Author: Matt Clarkson <mattc@catalyst.net.nz>
2007-11-19 01:42:38 +00:00
toyomoyo 4ea6f1f0ef changed to get_recordset_sql because get_records forces the first element to be key 2007-11-19 01:38:59 +00:00
toyomoyo 8bb10719d6 making an SQL cross-db compatible 2007-11-19 01:12:22 +00:00
iarenaza 2fa4b6d68e MDL-11099 and MDL-11655 Don't show external db password in clear (backported from HEAD) 2007-11-18 12:47:26 +00:00
moodler 9e65d861f7 Automatic installer.php lang files by installer_builder (20071118) 2007-11-18 04:49:16 +00:00
skodak 92db621b5d MDL-12231 fixed applying of CFG defaults during initial install phase 2007-11-17 21:20:48 +00:00
skodak 119fb86673 fixed typo throwing warnings during install 2007-11-17 20:54:43 +00:00
skodak 056ac15288 MDL-12041 fixed groupmode flag in cm when mode forced in course 2007-11-17 17:40:46 +00:00
skodak be4dd6c79b MDL-12041 fixed groupmode flag in cm when mode forced in course 2007-11-17 16:55:26 +00:00
skodak 9743ed49b9 MDL-10888 parent definition_after_data() must be called too! 2007-11-17 16:52:45 +00:00
skodak eafe828b26 MDL-12221 initialised $output and fixed whitespace 2007-11-17 16:35:26 +00:00
skodak 16ba1b0cf2 MDL-12199 problem with "Show advanced" used after pressing of enter in forms 2007-11-17 13:29:14 +00:00
skodak 6d1ad6b3e1 MDL-12146 merged recent changes from normal item to outcome form 2007-11-16 22:13:12 +00:00
skodak e56fb50a4a MDL-12146 merged recent changes from normal item to outcome form 2007-11-16 22:13:12 +00:00
skodak 519b6676c8 MDL-12200 fixed problems when no custom user fields defined 2007-11-16 22:10:52 +00:00
dwoolhead 0c46637a1a MDL-12226 forum index page not always displaying forum links or subscription buttons as expected 2007-11-16 17:00:50 +00:00
nfreear 326cf96333 Fixes bug MDL-12225, Mark up lists correctly in course/lib (accessibility). Merged. 2007-11-16 16:51:14 +00:00
dwoolhead 2bb2aa4dbb MDL-11979 Forum subscriptions loop hole allowing users to subscribe to forums they should not have access to. 2007-11-16 16:23:42 +00:00
arborrow fc4a2fffc6 Clarified help for importing custom user profile field data in response to http://moodle.org/mod/forum/discuss.php?d=84651 2007-11-16 16:13:48 +00:00
urs_hunkler b173ea77d9 MDL-12221 :: example: adding custom_corners to the info box on the forum page. 2007-11-16 12:49:10 +00:00
urs_hunkler 441df375b6 MDL-12221 :: add CSS for custom_corners boxes 2007-11-16 12:47:16 +00:00
urs_hunkler 1adb0ebb50 MDL-12221 :: Added wrapper functions for print_box, print_box_start and print_box_end to be able to add custom_corners to any boxes.
If you call print_custom_corners_box with the same parameters as print_box and custom_corners is enabled you get the custom corners divs within those boxes and can style them accordingly.
2007-11-16 12:44:53 +00:00
skodak 5a948984c4 MDL-12096 changed label of parent cat 2007-11-16 07:34:55 +00:00
scyrma 6df78935f8 Small fix for MDL-12216 : user.imagealt now showing in forum posts. 2007-11-16 06:05:34 +00:00
moodler 45b20961da MDL-12215 made the advanced search tab more consistent with the interface 2007-11-16 05:55:00 +00:00
toyomoyo 14975c1946 MDL-12121, fixing a warning 2007-11-16 04:24:17 +00:00
scyrma d9b9b40a71 Fix to a bug preventing rss feeds from loading correctly. 2007-11-16 03:32:26 +00:00
toyomoyo d9c7b58af6 MDL-12187, fixing grader report style 2007-11-16 03:08:14 +00:00
toyomoyo 990e04d823 MDL-11672, hide hidden assignment descriptions from calendar 2007-11-16 02:48:32 +00:00
skodak b8e8419bfc MDL-12096 new simple weighted mean aggregation type 2007-11-15 22:28:45 +00:00
skodak 791ad685b2 MDL-12146 grade item settings can be now configured as advanced, new advanced defaults, minor tweaks in admintree 2007-11-15 17:31:07 +00:00
urs_hunkler 6142a99373 MDL-12195 :: added closing '>' in line 157. 2007-11-15 16:26:33 +00:00
skodak 72c475f9ab MFC: MDL-12140 weights/extrapoints are never advanced 2007-11-15 15:44:39 +00:00
mchurch 1ea47ba4c0 MDL-12016 Category text not being sent to 'create_category_path'. 2007-11-15 13:56:31 +00:00
mchurch 89d2e91d13 MDL-12015 Import question count was wrong. 2007-11-15 13:30:44 +00:00
urs_hunkler 3941cc43f1 MDL-12191 :: workaround with JavaScript to add MDL-12191"haslayouttabel" class to body. 2007-11-15 12:06:34 +00:00
urs_hunkler f545230234 changed the form lable look. 2007-11-15 11:43:25 +00:00
bobopinna d0d5d320b1 MDL-12161 Stripped slashes in LO titles 2007-11-15 08:40:02 +00:00
skodak 4217056ab9 MDL-12140 category can be selected when adding new items or categories 2007-11-15 08:27:13 +00:00
bobopinna c90933facf MDL-12161 Stripped slashes in LO titles 2007-11-15 08:01:51 +00:00
toyomoyo edc62676a2 MDL-12180, blocks capabilities not appearing when overriding block roles 2007-11-15 07:44:52 +00:00
scyrma f2ee9706a2 Fix for MDL-10996 : prevent course name from being displayed twice. 2007-11-15 04:08:44 +00:00
scyrma 42cf57fb26 MDL-11401 - This simplifies the code and makes the registration page a bit more clear & coherent. Also fixes an issue where the $id was mangled when coming back from moodle.org registration. 2007-11-15 02:02:12 +00:00
toyomoyo 59a24c227e MDL-8330, adding a warning to translators about updating of lang packs 2007-11-15 01:17:48 +00:00
martinlanghoff 77db689064 MDL-9399 - auth/ldap NTLM SSO - strings 2007-11-14 23:45:21 +00:00
martinlanghoff 4e5813e6f2 admin/mnet: undo accidental commit 2007-11-14 23:43:05 +00:00
martinlanghoff 53cda2de31 MDL-9399 - auth/ldap NTLM SSO - fix a missing global 2007-11-14 23:40:50 +00:00
martinlanghoff c1ef755c30 MDL-9399 auth/ldap: NTLM temp sessions now use cache_flags
cache_flags is now the apropriate way to manage this kind of temp
data. It gives us time expiry and GC for free, so it's a perfect fit
for the job, as it simplifies the code a bit.
2007-11-14 23:39:41 +00:00
martinlanghoff 8b435d0993 MDL-9399 auth/ldap: NTLM SSO - fix hardcoded strings
From Iñaki Arenaza
And here is a little patch with the last remaining non-traslated
strings (unless I missed something).
2007-11-14 23:39:24 +00:00
martinlanghoff 4912df1582 MDL-9399 auth/ldap: NTLM SSO - move textlib conversion earlier
From Iñaki Arenaza - fix for

... I forgot to put the textlib conversion
call before the block of code that uses $extusername, so it
completely breaks the user validation process.
2007-11-14 23:39:11 +00:00
martinlanghoff 6e45019417 MDL-9399 auth/ldap: NTLM SSO - cleanup of sesskey handling
Fix a bug in ntlmsso_finish(), and tighten up user_login() to avoid a
pointless DB lookup if the password doesn't match the sesskey.

Hopefully this makes things work again...
(thanks I~naki for the testing!)
2007-11-14 23:38:44 +00:00
martinlanghoff d8ee4dfa6e MDL-9399 auth/ldap: NTLM SSO - use sesskey and other tidyups
Several tidyups:

- use moodle_strtolower() for utf-8 correctness

 - use sesskey as the key instead of IP addr to support
   proxied users

 - clean the sesskey after success!

 - pull timeout out to a constant: AUTH_NTLMTIMEOUT
2007-11-14 23:38:31 +00:00
martinlanghoff 8f09118ae0 MDL-9399 moodlelib: set_config() deletes config entries if the value is NULL
New! Improved! If you pass NULL as the value, it will delete the
config entry for you.
2007-11-14 23:38:07 +00:00
martinlanghoff 176307a26a MDL-9399 auth/ldap: Tighten NTLM AD checks to the appropriate OU
From Iñaki Arenaza...

Right now, if someone logs in via NTLM magic, we don't check if that
user is inside the contexts specified in the LDAP settings. I mean,
if I want to restrict my Moodle site to those users inside a given OU
or subtree of my LDAP directory, with the current code any valid user
in my whole AD domain (and if we are using a GC as the LDAP server,
the whole forest) can log in. We should check that the user is inside
one of the configured contexts before allowing his/her to log in.

Something along the lines of the attached patch could do it.
2007-11-14 23:37:53 +00:00
martinlanghoff 58af55c35e MDL-9399 auth/ldap: ntlmsso_finish() now completes the user session setup
As Iñaki points out, ntlmsso_finish() needs to do all the setup that
login/index.php would do for a user once auth succeeds. With this
patch, the session setup is complete so the logon is usable.
2007-11-14 23:37:40 +00:00
martinlanghoff afac1a0781 MDL-9399 auth/ldap: NTLM redirect only on initial GET
We only want to redirect when users are being shown the login page (on
GET) but not when users are POSTing to it, actually trying to login.
2007-11-14 23:37:26 +00:00
martinlanghoff a1353477c4 MDL-9399 auth/ldap: NTLM SSO - lots of fixes from Iñaki
Lots of typos and minor errors fixed by Iñaki. Thanks!
2007-11-14 23:37:10 +00:00
martinlanghoff 3ae767d8ba MDL-9399 auth/ldap: NTLM SSO - Resolve Moodle cookies issue, tighten config.php require()s
Use $nomoodlecookie global to avoid session troubles. Also

 * Ensure we load the appropriate config.php, even if we are executing
   under a strange environment (ie: with a user's credentials!)

 * Test we have a spacer gif to open before we open it
2007-11-14 23:36:56 +00:00
martinlanghoff bdadff33ff MDL-9399 auth/ldap: Add NTLM SSO pages
These pages control the process of attempting an NTLM SSO login
safely. This is very draft and needs real-world testing and polish.

And string localisation too ;-)

  * If NTLM SSO is enabled, and the user's IP addr is in the right
    subnet, the loginpage_hook() of auth/ldap redirects to
    ntlmsso_attempt.php

  * ntlmsso_attempt.php will display a "redirect" msg with an img tag
    pointing to ntlmsso_magic.php, a 3s wait, and a redirect to
    ntlmsso_finish.php

  * ntlmsso_magic.php should be configured to have "Integrated
    Windows Authentication". If it does, it will serve a spacer gif
    and call ntlmsso_magic()

  * ntlmsso_finish.php calls ntlmsso_finish() to complete the SSO
    and handles failures.
2007-11-14 23:36:41 +00:00
martinlanghoff 94beeb79c7 MDL-9399 auth/ldap: flesh out ntlmsso_* functions
Flesh out the functions that get the job done. These will be triggered
by PHP files sitting under auth/ldap/ ...

ntlmsso_magic() - here is where the magic happens. Call it serving
something harmless, like a space GIF, from a URL that is blessed with
Integrated Windows Authentication. If the IWA is successful, it will
set a special session cookie in config_plugins table.

It won't complete the job because when we are under IWA magic we
cannot change (even read!) the session data, as the execution happens
under the OS privileges of the actual user acct being logged in (!!!)

ntlmsso_finish() - if it finds the session set by ntlmsso_magic() and
it hasn't expired, it will finish the job of logging in the user, by
calling authenticate_user_login() and exercising the whole auth
machinery.

user_login() - when called by authenticate_user_login() it will check
to see if there's a session setup by ntlmsso_magic() and OK the login
without really asking the AD backend to proof a password we don't have
anyway.
2007-11-14 23:36:14 +00:00
martinlanghoff 056a54babe MDL-9399 auth/ldap: Introducing loginpage_hook(), ntlmsso_attempt(), ntlmsso_finish()
A work in progress -- initial loginpage_hook() and headers for the
remaining functions. One thing to consider here is that this won't
work if there's a proxy in the middle.

Does NTLM auth thingy support proxies?
2007-11-14 23:36:00 +00:00
martinlanghoff 04038968be MDL-9399 auth/ldap: Manage 2 new config settings for NTLM SSO
Changes in the forms and forms handling to set and edit NTLM SSO
related config options.
2007-11-14 23:35:46 +00:00
martinlanghoff 6d3da6bf92 MDL-9399 auth/shibboleth: ensure we load enrolments
Most of this code should be replaced with complete_user_login() but it
does a few odd things, so we'll play it safe for now, specially since
I don't have a Shib setup to test...
2007-11-14 23:35:31 +00:00
martinlanghoff b3ebb9802e MDL-9399 loginas: call check_enrolment_plugins()
Admins will want to see an update of the user's enrolments when
they do a login-as.
2007-11-14 23:35:15 +00:00
martinlanghoff 12a113f24e MDL-9399 auth/mnet: when landing, user complete_user_login()
By using complete_user_login() we ensure that the session is fully
setup, and that enrolment plugins are called correctly.
2007-11-14 23:35:00 +00:00
martinlanghoff 8f5c5184aa MDL-9399 accesslib: Move check_enrolment_plugins() to complete_user_login()
... where it belongs ;-)

load_all_capabiloties() gets called at several points where we don't
want to be re-querying the enrolment backends. It needs to  be called
before load_all_capabilities() and only by callers that are setting up
a logon session.

Those callers need to be calling complete_user_login() anyway, as they
need to set the Moodle cookie, log the logon action, etc. In fact,
those callers duplicate a lot of that code already.

The callers that don't duplicate code for the login are actually the
cases where the backend enrolment plugins should not be queried.

To be followed by callers cleanup...
2007-11-14 23:34:46 +00:00
martinlanghoff 9d6a3d1513 MDL-9399 login/index, moodlelib: move session setup logic to complete_user_login()
Move most of the user session setup logic from login/index.php to
complete_user_login().
2007-11-14 23:34:29 +00:00
martinlanghoff 5f3315e78e file ntlmsso_finish.php was added on branch MOODLE_19_STABLE on 2007-11-14 23:36:41 +0000 2007-11-14 22:12:25 +00:00
martinlanghoff 5f084a4ecb file ntlmsso_attempt.php was added on branch MOODLE_19_STABLE on 2007-11-14 23:36:41 +0000 2007-11-14 22:12:25 +00:00
martinlanghoff 2115a30667 file ntlmsso_magic.php was added on branch MOODLE_19_STABLE on 2007-11-14 23:36:41 +0000 2007-11-14 22:08:55 +00:00
mudrd8mz dee938a59e MDL-11332 Preview did not work with help files in subdirectories. Thanks to Christian Deligant for the patch. 2007-11-14 21:20:41 +00:00
tjhunt 582e15dfd2 MDL-12066 - Links in the HTML block are not recoded on backup and restore.
This is messy because the links are hidden in the configdata column, which is serialized and base64encoded. So we have to untangle that, then ask the block whether there are any bits of $config that need to be fixed, then re-encode it before backup up. And reverse that on restore. It needs to remain base64 encoded in the backup file, so that the file format is backwards compatible.

I disucssed this with Eloy before doing it.
2007-11-14 17:03:16 +00:00
tjhunt d2219dda26 MDL-12172 - print_continue should create a method="get" button, not post. 2007-11-14 16:33:57 +00:00
urs_hunkler cf8781f41c added 2 CSS definitions to dimm the summary and the course no. in a hidden course topic. 2007-11-14 16:05:07 +00:00
tjhunt 2fca979ee3 Delete commented-out code that was actually not commented out properly, and so caused warnings. Merged from MOODLE_18_STABLE. 2007-11-14 14:48:46 +00:00
bobopinna 85ab48b33f MDL-12118 Fixed learner_response report. It was changed by SCORM2004 3rd Ed. specification 2007-11-14 12:59:16 +00:00
skodak 3929ee53cd MDL-12146 grade category defaults, forced settings and advanced options 2007-11-14 11:49:55 +00:00
bobopinna cf6e361c02 Fixed MDL-11914 2007-11-14 09:51:31 +00:00
toyomoyo 8909a7a075 removing duplicate entries in grade_grades prior to adding unique key 2007-11-14 05:06:50 +00:00
toyomoyo 0fb90ef70b MDL-12140, making most common non-weighted settings easy for teachers 2007-11-14 02:11:19 +00:00
martinlanghoff b21ca22e1f htmlarea: fix in FF - MDL-11242
The previous fix for IE left some problems in the FF side of
things because we were trying additions/substractions on
width once its had turned to a string of value + unit.

Do the math before we attach 'px' to it...
2007-11-14 01:24:40 +00:00
fmarier cfb5feb8b5 mod/quiz: Revert commit which added the "go back to course" link 2007-11-14 01:09:29 +00:00
mchurch bc304733e8 MDL-11991 Fixing error on undefined method while using the manual plug-in. 2007-11-13 18:04:58 +00:00
mchurch 90cef3dc05 MDL-12149 Added code to check for selected group as well, so that privileged users get correct count when changing groups. 2007-11-13 16:59:13 +00:00
skodak b4deed5688 MDL-12154 used proper cast to float before !== comparison 2007-11-13 16:46:12 +00:00
skodak 11b9b76181 MFC: MDL-12154 used proper cast to float before !== comparison 2007-11-13 16:09:00 +00:00
arborrow e3f5d9654a MDL-11743 - SHOW LOCAL VARIABLES more accurately returns database character set on some hosts and makes explicit what is normally the default behavior. 2007-11-13 16:02:20 +00:00
mchurch 8ead149149 MDL-12114 Fixed typo in elements array. 2007-11-13 15:59:51 +00:00
skodak 08d82f5688 MFC:
MDL-10901 new SUM aggregation type
MDL-12154 used proper cast to float before !== comparison
2007-11-13 15:33:16 +00:00
nfreear 1a78d381ff MDL-12153, "Validome - moodle.org invalid - require Content-Script-Type". Merged. 2007-11-13 14:49:04 +00:00
urs_hunkler 2c00ee97df removed CSSEdit reference line. 2007-11-13 10:31:37 +00:00
skodak 1a35d7472f MFC: MDL-12101 cleanup/fixing/refactoring of user bulk operation and admin user browsing 2007-11-13 09:02:11 +00:00
skodak 4d85a640dd file simpleselect.html was added on branch MOODLE_19_STABLE on 2007-11-13 09:02:12 +0000 2007-11-13 08:43:27 +00:00
skodak c8693d4dc1 file user_bulk_forms.php was added on branch MOODLE_19_STABLE on 2007-11-13 09:02:12 +0000 2007-11-13 08:43:22 +00:00
skodak 3d5f5f6021 file lib.php was added on branch MOODLE_19_STABLE on 2007-11-13 09:02:12 +0000 2007-11-13 08:43:22 +00:00
skodak 8ab940c495 file user_filter_forms.php was added on branch MOODLE_19_STABLE on 2007-11-13 09:02:12 +0000 2007-11-13 08:43:20 +00:00
skodak 0fe0327175 file simpleselect.php was added on branch MOODLE_19_STABLE on 2007-11-13 09:02:13 +0000 2007-11-13 08:43:20 +00:00
moodler cd73c31074 Fixed up some grammar and capitals MDL-12145 2007-11-13 08:41:47 +00:00
toyomoyo 995a53787b allowing horizontal and vertical highlighting 2007-11-13 06:21:48 +00:00
toyomoyo 6f04b5d626 MDL-12124, fixing styles for grader report 2007-11-13 03:18:18 +00:00
toyomoyo 522803d42a MDL-12138, set aggregate graded only as default 2007-11-13 03:06:56 +00:00
toyomoyo 815673e92f MDL-12141, category names should be mandatory 2007-11-13 02:52:30 +00:00
martinlanghoff 69a4aef1e1 admin: Introducing the mailout-debugger
A stand-in for sendmail that will log all emails instead of sending
them out. Use when debugging cron performance and output.

References:
  MDL-12142
  http://moodle.org/mod/forum/post.php?reply=349457
2007-11-13 00:33:42 +00:00
urs_hunkler d0796153bf The XHTML of the actual tab has been changed. Therefor the actual tab was not shown in front of the line any more. I changed the CSS to correct this introduced bug. 2007-11-12 20:20:48 +00:00
skodak 0fe09ea8fe MFC: MDL-12131 db debug messages now quoted properly 2007-11-12 17:22:22 +00:00
skodak 8490c5350e MFC: MDL-12130 and MDL-12129 - fixed advanced status of elements when header not closed; disableIf now works inside grouped elements too; code cleanup in focus() and _getElNamesRecursive() 2007-11-12 17:14:52 +00:00
nfreear 8ca956147b Fixes MDL-12125, Call to a member function FetchRow on a non-object in get_user_access_sitewide. Merged. 2007-11-12 16:56:38 +00:00
urs_hunkler 04139219e7 MDL-12093 :: changed function call from get_in_popup to is_in_popup. 2007-11-12 11:36:57 +00:00
urs_hunkler 24bcd2e3b1 MDL-12093 :: Tim propsed to change the name get_in_popup to is_in_popup for esear reading - done. 2007-11-12 11:05:18 +00:00
gbateson 393150a996 fix for MDL-9713 : use XMLDB functions to create tables when mod/hotpot/db/mysql.sql is not found. This allows upgrade direct from Moodle 1.5 (or earlier) to Moodle 1.8 (or later) 2007-11-12 08:53:54 +00:00
toyomoyo 903740173f MDL-9059, when teacher creates group event on calendar, they can not see it 2007-11-12 06:26:57 +00:00
martinlanghoff ce97dd9102 htmlarea: Fix fullscreen editor on IE6/7 -- MDL-11242
Only say px if the width is a pure number. Under IE we
get the "100%" for the width of the editor, so blindly
appending "px" results in a JS execution error.

With this patch we only attach px if it's a pure int.

Also tested the sizing of HTMLArea in the messaging
window. So both should be working now.
2007-11-12 04:09:37 +00:00
toyomoyo 2efdf88b94 MDL-12104, gradebook is showing 2 scales together 2007-11-12 03:13:05 +00:00
urs_hunkler ff3cf1e507 MDL-10683 :: added as Eric proposed:
.mform .ftextarea #id_alltext {
    width: 100%;
}
2007-11-11 19:32:09 +00:00
urs_hunkler aaef7468ac moved the sideblock accessibility property to the sidblocks section. 2007-11-11 19:24:56 +00:00
urs_hunkler fb529d5c10 added the clearfix option to the custom_corners call for admin pages to keep the "Save Changes" button within the area. 2007-11-11 17:27:55 +00:00
urs_hunkler 6a1a00bc50 Some theme enhancements while working on MDL-12098 and MDL-11154.Some theme enhancements while working on MDL-12098 and MDL-11154. 2007-11-11 16:02:21 +00:00
urs_hunkler fb87e8ae3b Added the check, if all opend custom_corners are closed. This way it's possible to add the close call in the footer which closes eventually open ccs. 2007-11-11 15:02:54 +00:00
urs_hunkler 60a4797402 MDL-12045 :: the extra "clearer" div broke the custom_corners theme on IE7. I removed the "clearer" div and added the class "clerafix" to the surrounding coursebox.
In FF and Safari floating is a mess now. I removed float:left for "coursebox" to get the page working in all browsers. It is a single element and should not need floating.
2007-11-11 11:19:36 +00:00
urs_hunkler cdedf35b0f MDL-12045 :: the extra "clearer" div broke the custom_corners theme on IE7. I removed the "clearer" div and added the class "clerafix" to the surrounding coursebox. 2007-11-11 10:53:31 +00:00
urs_hunkler b3c26633e5 added missing "if ($heading)" to suppress empty page header. 2007-11-11 09:29:51 +00:00
mark-nielsen 1e73338065 Mergin fix for MDL-12088 from MOODLE_18_STABLE 2007-11-11 01:21:52 +00:00
skodak d184f8f9b7 MFC: MDL-12079 fixed use of clean_param() 2007-11-10 14:55:46 +00:00
skodak 537e8dedfa MFC: MDL-12079 fixed use of clean_param() 2007-11-10 14:50:34 +00:00
urs_hunkler 1463bdc4ee MDL-12093 :: function get_in_popup() added to weblib.php. It returns true if the page is opened in a popup window.
* TODO Use a central function to create the popup calls allover Moodle and
 * TODO In the moment only works with resources and probably questions.
2007-11-10 14:44:41 +00:00
skodak 6ba839a768 MFC: MDL-12092 removed newline chars, we do not know the admin's platform, one line should be ok IMHO. 2007-11-10 14:36:36 +00:00
stronk7 42ae2fccb2 New profilefield_ lang files are now supported with
safe fallback to the "old" ones (stored in admin.php)
2007-11-09 20:10:14 +00:00
stronk7 d770f41a00 Adding lang support within profile fields to make them selfcontained.
Merged from MOODLE_18_STABLE
2007-11-09 19:10:08 +00:00
nfreear e9a5857b7d Follow up fixes MDL-12029 "Glossary view needs heading markup..." Merged, 2 days late :(. 2007-11-09 14:35:03 +00:00
toyomoyo 57a676ee7a MDL-12044, adding missing string 2007-11-09 02:55:59 +00:00
toyomoyo a48ae8ec5d MDL-12065, do not force parents to enrol in student courses 2007-11-09 01:39:06 +00:00
fmarier fa9ad7b620 Add missing fields when upgrading/installing on Postgres
mod/exercise, mod/scorm and question/type/rqp
MDL-12023
2007-11-09 01:24:28 +00:00
fmarier c10cac4e4a mod/quiz: Add a link back to the course page after a quiz is completed 2007-11-09 01:14:45 +00:00
poltawski e4e1faa6ab MDL-12070 - PARAM_CLEANHTML strips magic quotes.. 2007-11-08 22:18:33 +00:00
poltawski b72d8a7b98 MDL-12070 - re-enable the use of HTML in choice options,
merged from MOODLE_18_STABLE
2007-11-08 18:29:53 +00:00
sam_marshall fbaf314c87 MDL-12072 Added heading tag for calendar 'blocks' 2007-11-08 16:59:14 +00:00
sam_marshall eb8a6e6c60 MDL-12069 Make calendar events key labels and link titles consistent (also tidy up one bit of duplicated code) 2007-11-08 15:15:59 +00:00
skodak 5bdacd72ef MFC: MDL-10365 grade history can be turned off + lifetime 2007-11-08 09:58:55 +00:00
toyomoyo 46bdf8d1a8 keeping version numbers in sync 2007-11-08 05:53:02 +00:00
toyomoyo 05bab49047 MDL-12061, <p> in html editor breaks xhtml strict 2007-11-08 05:37:22 +00:00
moodler f6b74139d7 Automatic installer.php lang files by installer_builder (20071108) 2007-11-08 05:25:20 +00:00
nicolasconnault 44445b034f MDL-11790 Fixed hard-coded strings. Merci Nicolas! 2007-11-08 05:16:48 +00:00
toyomoyo 85c9758459 1.9 Beta 2 should not be read as 1.9.2 in environment page 2007-11-08 05:12:32 +00:00
toyomoyo f75cf3a13d MDL-11909, putting a unique constrait userid-itemid on grade_grades table 2007-11-08 01:59:49 +00:00
urs_hunkler 41b08f2d96 merged from 1.8 :: In the first table column class="header" was missing. 2007-11-07 18:11:26 +00:00
sam_marshall 366c49848f MDL-12055 Tweaked forum subscribe 'continue' address 2007-11-07 17:31:58 +00:00
sam_marshall 5d735c5281 MDL-12055 Tweaked forum subscribe 'continue' address 2007-11-07 17:05:06 +00:00
ethem f91a5b733a Fix for refactoring
Fatal error: Call to undefined method enrolment_plugin_authorize::print_enrolmentkeyfrom() in /usr/local/www/data/moodle/enrol/manual/enrol.html on line 7
2007-11-07 15:55:09 +00:00
tjhunt 6d3bcb44dd Eliminate duplicate $Id$ tag. 2007-11-07 15:26:29 +00:00
tjhunt 41c88b8cda Eliminate duplicate $Id$ tag. 2007-11-07 15:20:48 +00:00
tjhunt 228d5ecb07 Eliminate duplicate $Id$ tag. 2007-11-07 12:35:09 +00:00
toyomoyo 38161091d6 MDL-12025, enable row markings via javascript to keep track of current row 2007-11-07 07:45:30 +00:00
moodler 67945637f3 Merged a grammar fix from 1.8 2007-11-07 07:15:35 +00:00
toyomoyo 0646497a1e MDL-12048, assignment grades not migrated into 1.9 2007-11-07 04:27:53 +00:00
toyomoyo 69eedfa2fe backup/restore of grade histories should be off by default 2007-11-07 01:10:18 +00:00
nicolasconnault 6c5efa9157 MDL-8853 Applied Ann's Patch 2007-11-06 13:25:22 +00:00
toyomoyo 7d1b0eee29 fixing bogus $scoid 2007-11-06 05:40:58 +00:00
toyomoyo 0cd2561466 fixing a warning 2007-11-06 02:58:28 +00:00
toyomoyo 4e3dad540c MDL-10509, LDAP username to be always in lowercase 2007-11-06 01:00:27 +00:00
sam_marshall 7135ffca51 MDL-12030 Incorrect double quotes in sql 2007-11-05 17:57:10 +00:00
nfreear 6a021d6fc4 Fixes MDL-12029 "Glossary view needs heading markup + other accessibility fixes". Merged. 2007-11-05 15:24:58 +00:00
nicolasconnault 211e9c6d3f MDL-8992 Now only appearing once per page, and XHTML compliant. Also removed an ugly browser-sniffing css hack from the quicktime plugin, and applied the same browser detection as for the other plugins 2007-11-05 14:10:29 +00:00
skodak 071aeb9926 MFC: MDL-11399 make sure user context exists 2007-11-05 09:51:52 +00:00
skodak d5defbf5a8 MFC: MDL-11079 detect/prevent email duplicates when uploading users 2007-11-05 09:39:30 +00:00
skodak a17ca7ba09 MFC: MDL-11996 bulk user upload - custom profile fields docs 2007-11-05 09:13:15 +00:00
toyomoyo 31248c5d9c MDL-9552, update the gradebook everytime score is sent 2007-11-05 07:29:59 +00:00
skodak dd861fbc33 new csv import library included ;-) 2007-11-05 00:56:02 +00:00
skodak 3aa5023ef9 new csv import library included ;-) 2007-11-05 00:49:29 +00:00
skodak c92718aa13 file csvlib.class.php was added on branch MOODLE_19_STABLE on 2007-11-05 00:49:29 +0000 2007-11-05 00:43:37 +00:00
moodler f991a28d5c New installer file added to CVS repo. 2007-11-04 17:08:11 +00:00
moodler 76980fca70 file installer.php was added on branch MOODLE_19_STABLE on 2007-11-04 17:08:11 +0000 2007-11-04 17:05:25 +00:00
skodak 481425fadb MFC: MDL-12020 can not bulk delete users with the same email - new username collision 2007-11-04 13:52:30 +00:00
moodler 8453485495 Automatic installer.php lang files by installer_builder (20071103) 2007-11-03 05:09:41 +00:00
tjhunt 5cf2c57a22 Minor whitespace fixups. 2007-11-02 16:19:54 +00:00
stronk7 f2723764f7 There was a mistake in the dir being created. It must be
the backup temp area one. MDL-11912

Merged from MOODLE_18_STABLE
2007-11-02 13:02:37 +00:00
urs_hunkler 2b22a5f423 removed a typo: tabletable > table 2007-11-02 10:40:12 +00:00
stronk7 745a099abf Changed check_dir_exists() behaviour to be more robust
and to work better when used recursively under sites
with open_basedir enabled. Credit goes to René Samselnig. MDL-11437

Merged from MOODLE_18_STABLE
2007-11-02 09:52:42 +00:00
skodak b687218970 MFC: MDL-11996 bulk user upload - improvements, fixes and cleanup - part2 2007-11-02 08:42:36 +00:00
donal72 92a1d319fc Propagate additional error info about XML parse failures 2007-11-02 00:14:43 +00:00
donal72 98547f476f More error info about XML parse failures 2007-11-02 00:12:48 +00:00
stronk7 dddcaf6358 Now PHP code generated by the XMLDB editor automatically
adds calls to upgrade_main_savepoint(). MDL-11698
2007-11-01 23:21:41 +00:00
donal72 98a6fc4a3b Initialize the $message variable properly this time. 2007-11-01 21:30:09 +00:00
donal72 7499f511c8 Revert: Initialize the $message variable 2007-11-01 21:26:55 +00:00
stronk7 359ee558f0 Unsetting one white border.
Merged from MOODLE_18_STABLE
2007-11-01 20:07:55 +00:00
skodak 7b5f66308c MFC: MDL-11996 fixed previous speedup commit for user operations in admin tree 2007-11-01 19:44:32 +00:00
skodak 81c9dd751a MFC: MDL-11996 bulk user upload - improvements, fixes and cleanup - part1 2007-11-01 19:39:38 +00:00
skodak 0a48ba0c0b MFC: MDL-11995 prevent deleting of grade items attached to external activities 2007-11-01 15:09:42 +00:00
thepurpleblob 915e268e62 MDL-11977:
Add an an optional forgotten password handling url
2007-11-01 14:36:25 +00:00
nicolasconnault 5fc40f4208 MDL-8992 Added a simple script from http://mar.anomy.net/entry/2006/11/24/02.12.18/ to the mediaplugin filter output. Works like a charm on all tested browsers 2007-11-01 13:58:40 +00:00
nicolasconnault aa37778ca3 file eolas_fix.js was added on branch MOODLE_19_STABLE on 2007-11-01 13:58:40 +0000 2007-11-01 13:52:15 +00:00
nfreear 482b3d1677 Fixes bug MDL-11994, Accessibility: "Users tagged with ..." should be marked up as a list. Merged. 2007-11-01 12:34:39 +00:00
skodak f018ef4a52 MFC:
MDL-11966 fixed typo in grader report causing fatal errors
MDL-11993 refactored code for item headers and icons
2007-11-01 11:45:03 +00:00
skodak e8fc2358ca file calc_off.gif was added on branch MOODLE_19_STABLE on 2007-11-01 11:45:03 +0000 2007-11-01 11:42:33 +00:00
nicolasconnault 7e33b18807 MDL-11865 upgraded pagelib to using build_navigation() 2007-11-01 08:59:44 +00:00
skodak 219927349a MFC: MDL-11966 implemented dategraded and datesubmitted, tweaked altering of grades depending in hidden grades
MDL-11974 improved gradebook CSS
2007-11-01 08:50:30 +00:00
nicolasconnault f6d8678098 MDL-11912 Creating 1000's layer directory first, then userid directory: no need for recursion 2007-11-01 08:45:57 +00:00
donal72 71494eb0b1 Test for empty dataset to suppress a warning 2007-11-01 06:13:02 +00:00
donal72 3e6e9eaa52 Initialize the $message variable 2007-11-01 05:02:46 +00:00
pichetp 442e308648 MDL-11867 setting real null when response is null in calculated question merged from
head
2007-11-01 00:32:11 +00:00
wildgirl 48f66dd36e MDL-11725 en lang string edit 2007-10-31 21:54:30 +00:00
wildgirl c0d1c8f9cb MDL-11796 help file edit 2007-10-31 21:22:44 +00:00
wildgirl f46a06d08c MDL-11941 help file URL correction 2007-10-31 21:05:23 +00:00
nicolasconnault 6d7ab89b65 MDL-11912 Removed recursive param 2007-10-31 19:04:30 +00:00
tjhunt 2e978de3d1 MDL-10284 - wrong language string used on the quiz view page to inform students of the quiz deadline. I took the opportunity to strip out an unnecessary HTML table, and reviewing uses of the string /quiz(open|close)s?/ found one other inconsistency on the quiz editing form. Merged from MOODLE_18_STABLE. 2007-10-31 17:08:51 +00:00
tjhunt a999da51c5 MDL-11624 - /mod/quiz/index.php too dependant on individual course format names. I basically changed it to do the same as the forum module. Merged from MOODLE_18_STABLE. 2007-10-31 16:42:06 +00:00
nicolasconnault 150692da89 MDL-11912 Removed recursive param 2007-10-31 15:20:58 +00:00
skodak d01930668d MFC: MDL-11966 removed plugin selector when only one plugin available 2007-10-31 09:14:32 +00:00
skodak 809baca60a MFC: fixed numuser regression in overview 2007-10-31 09:00:06 +00:00
moodler 594676271f Automatic installer.php lang files by installer_builder (20071031) 2007-10-31 04:37:58 +00:00
pichetp a8f56ba982 solving MDL-7496 for calculated merged from head 2007-10-31 02:48:30 +00:00
skodak aa4847c757 MFC: MDL-11973 Improved showing of hidden items in ouuser and user report 2007-10-30 21:41:41 +00:00
skodak 29cf643cad MFC: MDL-11951 a little typo - no recursive call intended in has_any_capability() I guess 2007-10-30 20:52:54 +00:00
mattc-catalyst c546706479 Author: Matt Clarkson <mattc@catalyst.net.nz> 2007-10-30 20:45:04 +00:00
tjhunt 3d94c5e08e MDL-6376 - fix minor errors in the previous commit.
More significantly, this patch changes the '1 Students have made 1 attempts' string.

To start with, this code was being produced in five different places, so I made a function to do the work!. Next, as you can see, it is not gramatical. Also, some people find it confusing, as in MDL-6376.

Therefore, it now just says 'Attempts: 1'.
2007-10-30 19:28:05 +00:00
sam_marshall 3724757d96 MDL-11916 Added managegroupevents capability 2007-10-30 16:18:08 +00:00
skodak 11551df2c3 MFC: MDL-11957 improving and cleanup in grade overriding 2007-10-30 11:54:25 +00:00
tjhunt d09ab40142 MDL-11951 - supplemental - need capability checks in the outer if of the file too. 2007-10-30 10:49:25 +00:00
tjhunt 435d7bdba9 Unit tests for MDL-9295 - clean_param with PARAM_URL/PARAM_LOCALURL. Merged from MOODLE_18_STABLE. 2007-10-30 10:46:23 +00:00
tjhunt 7e340b3e8d MDL-9295 - PARAM_URL/PARAM_LOCALURL does not accept http://localhost/ or other hosts on lans. Merged from MOODLE_18_STABLE. 2007-10-30 10:15:27 +00:00
tjhunt 384a9cbda9 Correct misleading comment. Follow-on from the fix to MDL-11462. 2007-10-30 10:10:20 +00:00
toyomoyo 8b405ab59b making multibyte filename appear correctly under IE download 2007-10-30 00:33:45 +00:00
skodak 6543cbde7a MFC: MDL-11955 required scale selection when grade type is scale 2007-10-29 20:36:15 +00:00
skodak 6e0fd47067 MFC: MDL-11954 grader report links to profiles from the same course 2007-10-29 20:25:51 +00:00
skodak 90f36eaf96 MFC: MDL-11904 deny/accept Email settings conflict with text - now .example.com means all subdomains 2007-10-29 20:15:35 +00:00
tjhunt 13beed44aa MDL-11952 - In the course admin block, if the user has moodle/question:managecategory, but no other capabilites, the questions link should go to the manage categories page 2007-10-29 16:58:10 +00:00
tjhunt 1db25b8950 MDL-11951 - Need a link to the Front Page course question bank in the admin tree. 2007-10-29 16:53:41 +00:00
tjhunt 4288cc0e90 MDL-11784 - On the role assign page, list who is assigned the role for roles with only a few assignments. Improved version. Now, it only shows the extra column if some roles have between 1 and 10 assignees, as per Martin D's request. 2007-10-29 15:38:31 +00:00
poltawski fdd91b7098 MDL-11124 - Allowed 'There are no [modulename]' translations. This is currently
hardcoded and can be discovered through the user interface resonably easily.
2007-10-29 10:42:16 +00:00
poltawski 7da47c8128 MDL-11068 - fixed typo 2007-10-29 09:56:21 +00:00
poltawski 2e8b9f7325 MDL-11813 - Use existing group setting strings on course edit form so can be
better translated. Patch from Daniel Miksik
2007-10-29 09:45:38 +00:00
skodak 9a873b571d MFC: MDL-11874 grader report now indicates hidden items (gray title + range) and hidden grades (except when editing) 2007-10-29 08:39:25 +00:00
toyomoyo eab9dead49 MDL-11930, remove lang file for csv export 2007-10-29 02:02:30 +00:00
danmarsden 3a267ca3a0 missed one line.
Fix for MDL-10085  and MDL-8118 Problem with number of Responses in choice wrong, and displayed users incorrect on results. merged from HEAD
2007-10-29 00:22:44 +00:00
poltawski b1e96ca8b2 MDL-11767 SQL error with postgres 2007-10-29 00:20:30 +00:00
danmarsden 360342a41f Fix for MDL-10085 and MDL-8118 Problem with number of Responses in choice wrong, and displayed users incorrect on results. merged from HEAD 2007-10-28 23:28:14 +00:00
poltawski ce249c4de5 MDL-11937 - save 100 database queries in the case of the admin bookmarks block
without bookmarks on non-admin page
2007-10-28 23:03:33 +00:00
skodak a32126839c MFC: MDL-11563 replaced hardcoded permission check from admin_tree_block 2007-10-28 22:36:29 +00:00
skodak 020eae6335 MFC: MDL-11934 grade report in user profile now selectable 2007-10-28 18:11:17 +00:00
skodak d5d95c5e02 MFC: MDL-11927 fixed cookiepaths; patch by Kevin 2007-10-28 14:21:41 +00:00
skodak 038ee13b04 MFC: MDL-11718 report styles moved to report/xx/styles.php - for better consistency with other plugins; other cleanup in user report css; fixed css in user profile 2007-10-28 12:57:17 +00:00
skodak d6beb4690a file styles.php was added on branch MOODLE_19_STABLE on 2007-10-28 12:57:17 +0000 2007-10-28 12:51:16 +00:00
urs_hunkler 893194c625 MDL-11926 :: two comments confused Chameleon. I have deleted the comments and optimized CSS for Chameleon use. 2007-10-28 12:38:44 +00:00
urs_hunkler 55c7250333 MDL-11928 :: calendar width in IE6 && MDL-11730 :: header-home background color fixed 2007-10-28 08:53:46 +00:00
moodler b4f675e1d5 Automatic installer.php lang files by installer_builder (20071028) 2007-10-28 05:14:47 +00:00
skodak 96e3537213 MFC: added groups param to get_numusers() - to be used in oureport; might be handy elsewhere too 2007-10-27 22:06:46 +00:00
skodak 7823acb0c9 MFC: support for styles.php in grade reports 2007-10-27 22:02:47 +00:00
skodak 5e691be585 MFC: MDL-11718 fixed typos in prev commit 2007-10-27 20:38:05 +00:00
skodak b7049c9222 MFC: MDL-11718 minor cleanup 2007-10-27 20:36:34 +00:00
skodak 8941942a02 MFC: MDL-11718 minor fix for grades in user profile 2007-10-27 18:23:38 +00:00
skodak e685d5838d MFC: MDL-11718 partial cleanup in overview report - unfortunately the problems with hidden grades can not be solved here without db changes 2007-10-27 18:00:21 +00:00
skodak 70efa359e2 file settings.php was added on branch MOODLE_19_STABLE on 2007-10-27 18:00:22 +0000 2007-10-27 17:58:36 +00:00
skodak edc0fe896d MFC: MDL-11718 course settings for reports - for now only user report (rank and showing of hidden items) 2007-10-27 15:35:16 +00:00
skodak fbaa57cbf8 MFC: MDL-11718 grader report now does not show column totals if user does not have view hidden grades capability because we can not calculate the totals depending on altered aggregates 2007-10-27 13:15:06 +00:00
skodak 2ee13c5c8b MFC: fixed error when no scale present 2007-10-27 11:42:34 +00:00
nicolasconnault a7212cb9c7 grade_outcome->description doesn't exist 2007-10-27 06:28:39 +00:00
tjhunt e63938ba8a MDL-11917 - Improve the title on the assign/override roles page. 2007-10-26 16:59:49 +00:00
toyomoyo 6597b34eeb MDL-11532, updatesql needs to get run after each 'round' otherwise there's nothing to pull from the context table 2007-10-26 07:56:36 +00:00
toyomoyo c6ed8589e0 MDL-11836, show number of blocks but do not link if no reference to any course 2007-10-26 03:24:29 +00:00
toyomoyo bebdb9b162 MDL-11902, gradebook formula dereferencing problem 2007-10-26 02:06:21 +00:00
tjhunt 677ab5e475 Fix typo. 2007-10-25 14:29:39 +00:00
tjhunt 4a4b110509 MDL-11825 - Force penaltyfactor to 1 for truefalse questions on GIFT import, as is done on the editing form. Merged from MOODLE_18_STABLE. 2007-10-25 09:43:09 +00:00
toyomoyo 5e919c34ee MDL-11893, send email to admin when add_to_log fails 2007-10-25 04:01:38 +00:00
danmarsden 00f65b4e5d MDL-11397 bug with IE 6 not displaying anonymous results correctly.
- also fix for XHTML Strict.

merged from HEAD
2007-10-24 21:29:12 +00:00
toyomoyo 4ad8ec74e7 MDL-11513, adding support for grade letters 2007-10-24 07:38:23 +00:00
whchuang 8e48cb7180 Fixed MDL-10506 Hide/Show Advanced text does not toggle in IE and Safari when edit profile 2007-10-23 22:18:17 +00:00
tjhunt 6a3ba4e585 MDL-11784 - On the role assign page, list who is assigned the role for roles with only a few assignments. 2007-10-23 16:27:06 +00:00
tjhunt b16832dd09 MDL-11881 - User with question permission but not mod/quiz:manage can get a nasty require_capability error. 2007-10-23 16:15:31 +00:00
tjhunt e88133dc12 MDL-11870 - Notices on the quiz view page if the corresponding grade item was deleted. 2007-10-23 07:47:43 +00:00
moodler 841d2ca4c9 Automatic installer.php lang files by installer_builder (20071023) 2007-10-23 05:14:07 +00:00
danmarsden 319e0b83a5 Fix for MDL-9666 totals don't appear when full names are shown. merged from head. 2007-10-22 21:50:47 +00:00
danmarsden 210f57ff8a fix for MDL-11063 - thanks to Wen for the patch. merged from head. 2007-10-22 21:26:16 +00:00
arborrow 7ee7b84e9d MDL-11869 - javascript syntax error was preventing the call to the calc function. Adding in the double slashes around CDATA resolves the problem. (merging into 19STABLE) 2007-10-22 20:37:53 +00:00
tjhunt 7cc3f26d18 MDL-11708 - Zero answers are not allowed in Matching questions - sometimes I hate PHP. Merged from MOODLE_18_STABLE. 2007-10-22 16:57:09 +00:00
tjhunt 8ac54989eb MDL-11824 - Literal asterisk (\*) in shortanswer question not handled correctly by get_correct_responses + Unit tests. Merged from MOODLE_18_STABLE. 2007-10-22 15:37:25 +00:00
urs_hunkler 867354f9ae CSS color "lightgrey" does not exist. I replaced it with the "corresponding" Linux color value #D3D3D3. 2007-10-22 10:35:08 +00:00
nfreear b27db1be63 Fix for reopened bug MDL-7878, "Link identification and skipping" - includes site and course index.php. Merged. 2007-10-22 09:25:52 +00:00
nfreear b39a4fec6a Partial fix for reopened bug MDL-7878, "Link identification and skipping" - affects all course formats + other files. Merged. 2007-10-22 06:51:09 +00:00
toyomoyo a358f9b4e2 fixing some warnings 2007-10-22 03:02:00 +00:00
gbateson cde191082a improve XHTML compatability of HotPot reports; fix termination of <input> tags in JCloze and JQuiz 2007-10-22 01:43:19 +00:00
stronk7 fcad0318e9 Changing some standard colors. Merged from HEAD. 2007-10-21 19:27:30 +00:00
skodak 2f40c9ea94 MFC: MDL-11718 fixed altered aggregation of overridden and locked grades + some speedup and corrections 2007-10-21 13:23:07 +00:00
skodak d5f05bd60e MFC: MDL-11859 student rank and showing of hidden grade items are now configurable + fixed some incorrect include_once 2007-10-21 12:57:35 +00:00
skodak 94707762b5 file settings.php was added on branch MOODLE_19_STABLE on 2007-10-21 12:57:35 +0000 2007-10-21 12:56:20 +00:00
moodler bcdb15f066 Automatic installer.php lang files by installer_builder (20071021) 2007-10-21 04:23:45 +00:00
gbateson 0846150380 improvements to XHTML compatability:
(1) change & to &amp; in URLs;
(2) correctly terminate <input ... /> and <img ... /> tags;
(3) add closing tag for "page" and "content" divs when not using print_footer()
(4) change "<" and ">" to html entities in open text
2007-10-21 02:52:49 +00:00
skodak f39432cafe MFC: MDL-8605 fixed user image restore code 2007-10-20 20:59:20 +00:00
skodak 8809b99a1f MFC: MDL-11857 missing addslashes on idnumber field during backup restore 2007-10-20 19:34:26 +00:00
skodak aaf277889b MFC: MDL-11857 missing addslashes on idnumber field during backup restore 2007-10-20 19:26:53 +00:00
skodak f7266dd323 MFC: MDL-11835 proper labels for aggregation coef - weight and extra credit 2007-10-20 19:13:55 +00:00
skodak ee41a6a7c8 MFC: MDL-11718 fixed incorrect bounds when altering aggregates for hidden grades 2007-10-20 15:50:44 +00:00
skodak 8b378edc14 MFC: MDL-11278 improved forced category settings - refactoring + regrading forced + new setting to hide forced settings in UI 2007-10-20 15:11:48 +00:00
mudrd8mz e3dccebf8d Backporting tabindex support from HEAD. Sorry for adding a new feature into the stable but this is quite useful for translators. 2007-10-20 02:06:12 +00:00
stronk7 e21b7f0a57 Booleans are not always transformed to 0 /1. This was preventing install
under mysqli. Define block->multiple if needed.

Merged from MOODLE_18_STABLE
2007-10-19 17:52:03 +00:00
stronk7 74812cb716 Adding support to course/formats from within the editor. MDL-11842
Merged from MOODLE_18_STABLE
2007-10-19 16:52:06 +00:00
poltawski 7931e74e44 MDL-11766 Flickr/Youtube blocks don't respect http proxy vars 2007-10-19 15:07:02 +00:00
poltawski 612f6992c5 MDL-11840 - curl was set to use CONNECTs for all http requests. This is disallowed
by most http proxies to prevent tunneling. Added some debugging in case of failure.
2007-10-19 14:45:54 +00:00
poltawski 30a16e7e83 MDL-11766 download_file_content is quite broken with proxies - lacking global
CFG definition, so must never have worked, also incorrectly specified proxyhost..
2007-10-19 11:44:04 +00:00
skodak 8b6f55ee7a 2007-10-19 08:53:54 +00:00
skodak 2b0e9d6ef9 file agg_sum.gif was added on branch MOODLE_19_STABLE on 2007-10-19 08:53:55 +0000 2007-10-19 08:51:53 +00:00
skodak 8336513809 file agg_mean.gif was added on branch MOODLE_19_STABLE on 2007-10-19 08:53:56 +0000 2007-10-19 08:51:53 +00:00
toyomoyo 0b0ff32d3c MDL-11167, admin blocks page should not show blocks not placed on course pages 2007-10-19 07:53:09 +00:00
donal72 45bddb6e6d Enable access to Mahara from testclient.php 2007-10-19 00:44:40 +00:00
stronk7 5a27d062ee Commenting some more debug... 2007-10-18 16:02:47 +00:00
stronk7 551f994986 Commenting out some excess of debug info. 2007-10-18 15:52:16 +00:00
skodak 1e5d9d5d5f MFC: userid must be set in new grade too 2007-10-18 10:09:19 +00:00
toyomoyo 1914e3a8f3 grade_grade does not have itemid initialized in grader report 2007-10-18 07:07:59 +00:00
toyomoyo 650044d9a2 sorry fixing conflict marker 2007-10-18 05:51:39 +00:00
toyomoyo fb38e114e7 MDL-11241, adding logs for roles management 2007-10-18 05:50:41 +00:00
moodler 6d19ce3361 Automatic installer.php lang files by installer_builder (20071018) 2007-10-18 05:43:10 +00:00
mattc-catalyst 2bf84bba09 groups/autogroup: Allocate members to groups more fairly
Author: Matt Clarkson <mattc@catalyst.net.nz>
2007-10-18 03:00:23 +00:00
skodak 6bfe184be4 MFC: MDL-11718 aggregated grades which depend on hidden grades are now hidden too + cleanup in grader report 2007-10-17 20:40:19 +00:00
tjhunt b85eb9fa4a MDL-11061 - admin notifications about $CFG->wwwroot, which sometimes lead to obscure errors. 2007-10-17 20:20:17 +00:00
tjhunt c5c60abd3e Fix notice. 2007-10-17 14:35:34 +00:00
urs_hunkler 0c3f1da5b6 removed CSSEdit reference line. 2007-10-17 13:52:10 +00:00
urs_hunkler a27b6c2c52 RTL rendering optimized for IE6, IE7, Oper with CSS and Safari 2 with JavaScript. 2007-10-17 13:37:58 +00:00
skodak cdb4e23f90 MFC: MDL-11718 aggregated grades which depend on hidden grades are now hidden too; cleanup in user report 2007-10-17 10:02:51 +00:00
skodak e19f971389 MDL-11658 shared rdef definition - reduced memory usage in cron; MFC 2007-10-17 09:21:48 +00:00
donal72 47405f9b6f Laying groundwork for more Mnet error reporting 2007-10-17 08:14:32 +00:00
donal72 e04584907b Rewrite testclient.php to be a service browser for remote Moodles. This should be useful to people who are trying to connect to the API from non-Moodle hosts, or write software to connect to Moodle. MDL-10214, MDL-10174, MDL-10172, MDL-10171 2007-10-17 08:11:50 +00:00
donal72 3dff7f538b Change reflection methods to only report on methods that are being published to the inquiring host (instead of all methods that could be published). MDL-10214, MDL-10174, MDL-10172, MDL-10171 2007-10-17 08:07:50 +00:00
toyomoyo bef2f86f04 closing this $rs 2007-10-17 07:28:44 +00:00
toyomoyo cf5a890bd6 MDL-11801, chat message not shown 2007-10-17 07:18:14 +00:00
toyomoyo 244d9553ca MDL-11687, the string 'capability' should not be translated in the links to capabilities docs page 2007-10-17 05:36:23 +00:00
toyomoyo f8c11d0afc MDL-11687, the string 'capability' should not be translated in the links to capabilities docs page 2007-10-17 05:30:32 +00:00
toyomoyo bdd77c8326 MDL-11553, reducing the number of bulk user selection buttons and lang changes 2007-10-17 04:29:16 +00:00
toyomoyo c470dada5b MDL-11770, broken userid in add_to_log 2007-10-17 03:01:38 +00:00
toyomoyo 472bce6d12 MDL-11170, blog tagging code broken 2007-10-17 02:54:43 +00:00
tjhunt aeb50096a1 MDL-5262 - PHP notice when sorting on R% coloumn in the Item analysis report - I adopted the simple solution of stopping people sorting on that column, since it is the same as sorting on rcount, I think. 2007-10-16 21:26:03 +00:00
tjhunt 8af53beeec Fix possible notice. 2007-10-16 20:52:12 +00:00
tjhunt ede4316c01 MDL-11794 - Blocks editing on button is not XHTML Strict when produced by page_generic_activity. 2007-10-16 20:43:28 +00:00
tjhunt 49fa880ef6 MDL-11791 - Custom corners broken on the quiz view page because I missed a global declaration, and PHP empty was hiding the problem. 2007-10-16 20:29:37 +00:00
stronk7 7063eb9fbb Move the update of digestmailtimelast to the end of the
loop to allow digests to be sent over multiple cron
executions if something crash in the middle. MDL-11657
2007-10-16 16:08:34 +00:00
urs_hunkler abbad4af13 Added mod-data-view to the custom corners include list for properly displayed custom corners. They where missing arounfd the contetn area.
Replaced strstr with the faster strpos.
2007-10-16 14:54:46 +00:00
tjhunt 40c6886f95 Fix restore notice when a role has no capabilities. 2007-10-16 14:03:08 +00:00
donal72 49ce7ff03c Log error code and text in mnet_server_fault_xml function. MDL-10196 2007-10-16 14:03:00 +00:00
donal72 a4fbad6e80 Label for wwwroot field 2007-10-16 10:20:12 +00:00
donal72 646a6d9481 MDL-11329: fixed text: "Local courses for external users:" 2007-10-16 09:14:47 +00:00
donal72 936450330a More helpful MNet error messages in debug mode 2007-10-16 09:02:01 +00:00
urs_hunkler ac331d6a4a Updates for IE problems, mainly for RTL language display. IE6 still refuses to work properly :-( 2007-10-16 08:56:06 +00:00
donal72 29858f020e MDL-11040: get_complete_user_data doesn't get the complete user data. Replace with get_record to bring over the user's description. 2007-10-16 08:53:16 +00:00
skodak 625faf10a3 MDL-11759 missing RISK_XSS in manage groups capability; merged from MOODLE_18_STABLE 2007-10-16 08:43:54 +00:00
gustav_delius f9144364f4 Fixed yet another error in the same bit of SQL in get_users_by_capability() that made many things not work properly on the course front page. 2007-10-16 08:27:39 +00:00
gustav_delius e19c5c1018 Fixing typo that led to fatal SQL error 2007-10-16 08:20:31 +00:00
donal72 516c425215 Removed a constraint that caused mnet to fail on clusters, vservers and other network configurations where the mnet client's hostname (as specified in the wwwroot) resolves to an IP address that differs from the IP address that it uses to contact other hosts. This should address MDL-10672 2007-10-16 08:00:20 +00:00
toyomoyo 28215f3286 MDL-11679, overview report should only return mycourses 2007-10-16 05:34:10 +00:00
nicolasconnault d815125160 MDL-8605 Upgrade of user folder will not occur if the user folder already exists 2007-10-16 04:54:13 +00:00
toyomoyo 56ce5f0965 fixing a warning 2007-10-16 04:33:23 +00:00
toyomoyo 0e319f934d MDL-9059, admins can't see group events in course 2007-10-16 03:46:43 +00:00
stronk7 35c114a9dc Reverting last commit. This is an EXTERNAL library file and shouldn't
be modified. And it was broken (strange linefeeds). MDL-11779
2007-10-15 22:02:03 +00:00
nfreear 8d62aacbda Follow up for MDL-11430, Flickr & Youtube tag blocks should use list markup - Fix styles. Merged. 2007-10-15 17:01:49 +00:00
nfreear 4a7cd55555 MDL-11775 "Undefined constant 'data_submitted' ..." - it's a function! 2007-10-15 15:02:10 +00:00
nfreear 8608db739d Follow up fix for MDL-11535 "Blog block sql error" - ...MAX(ordering) max_order - adding "AS" 2007-10-15 14:46:34 +00:00
nfreear 4c8aa550dd Follow up fix for MDL-11535 "Blog block sql error" - GROUP BY, added ", tg.name" etc. 2007-10-15 14:20:22 +00:00
thepurpleblob 290084cfdc MDL-11769:
question name is properly truncated to less than 255 characters tom
stop PostGRES choking.
2007-10-15 13:50:16 +00:00
nfreear cc2c883f80 Fixes MDL-11430, Flickr & Youtube tag blocks should use list markup. Merged. 2007-10-15 12:34:13 +00:00
nfreear 7914d49318 Preparation for MDL-11430 - whitespace. 2007-10-15 12:32:42 +00:00
nfreear 4776de0668 Follow up fix for MDL-11436 'Encapsulate "accesshide" HTML class in function', and use. Merged. 2007-10-15 10:06:47 +00:00
tjhunt 478c9e9380 MDL-11762 - Navigation not set up properly for resources - $this->navlinks was not being initialised in the base class. 2007-10-15 07:31:52 +00:00
urs_hunkler 1258810abc removed the javascript to correct the header display :: IE7 hangs. Need to find a different solution. 2007-10-15 07:13:30 +00:00
nicolasconnault ca005e23f7 MDL-10905 iterating properly through readdir() 2007-10-15 05:42:20 +00:00
nicolasconnault ec74fb3501 MDL-8605 putting versions in sync between 1.9 and head 2007-10-15 05:18:09 +00:00
toyomoyo bee3222be8 MDL-10353, adding couse variable to nav bar in calendar preferences 2007-10-15 04:46:05 +00:00
moodler 8241c5e324 Automatic installer.php lang files by installer_builder (20071015) 2007-10-15 04:35:05 +00:00
toyomoyo 47641637e5 MDL-11717, adding dimmed_text a, to dim links as well 2007-10-15 02:02:19 +00:00
gbateson 8ee76d1ffe where the correct responses on a JQuiz multiple choice question all have a score of 0%, the scores will be corrected to 100% 2007-10-15 00:59:03 +00:00
stronk7 86bea5c65e Improving cron to make digests to use much less memory. MDL-11657 2007-10-14 16:13:16 +00:00
urs_hunkler 7a158dac13 corrected IE calendar display, removed CSS bugs. 2007-10-14 16:06:59 +00:00
stronk7 b782e682f0 Backported from HEAD
Drop one index that shouldn't be there. MDL-11751
2007-10-14 09:57:52 +00:00
tjhunt 94f07cd524 Correct misleading error message in upgrade_activity_modules. Spotted while diagnosing MDL-11732. 2007-10-13 22:00:30 +00:00
mark-nielsen eee9477bfd Mergin fix for MDL-11684 from MOODLE_18_STABLE 2007-10-13 03:07:27 +00:00
mark-nielsen c2325b6ffd Mergin fix for MDL-11696 from MOODLE_18_STABLE 2007-10-13 02:34:14 +00:00
mark-nielsen c09019a4b5 Merging fix for MDL-11636 from MOODLE_18_STABLE 2007-10-13 01:56:37 +00:00
urs_hunkler b1abcbd50a MDL-11664 :: IE6 can't display transparent PNGs. Added not transparent gifs instead and changed the background for IE6 to a solid colour. 2007-10-12 21:46:36 +00:00
urs_hunkler ced48de808 MDL-11664 :: added IE6/UE7 special CSS and because that didn't help at all places added JavaScript to correct some wrong calculated width. 2007-10-12 21:42:04 +00:00
nicolasconnault 01d786178d MDL-8605 Backup and restore implementation 2007-10-12 20:24:00 +00:00
nicolasconnault 46387ff2ae file testbackuplib.php was added on branch MOODLE_19_STABLE on 2007-10-12 20:24:09 +0000 2007-10-12 19:13:19 +00:00
tjhunt b34fc1be24 MDL-11741 - Convert core modules to take advantage of recent improvements to build_navigation.
This check-in removes about 400 lines of code. I hope I have not screwed anything up. I would be grateful if people could review this change, and keep an eye on the navigation bar in modules.

Any navigation bar bugs you find in the near future, feel free to file them in the tracker and assign them to me. Thanks.

If not to many problems are found, I think I would like to backport this to 1.9 stable, but I am not sure that is a good idea. Opinions to the General Developer Forum please. I am about to start a thread there.

Backported from head. Will update merged tags in a few hours. I am late for orchestra. Sorry.
2007-10-12 16:09:37 +00:00
tjhunt c971067f91 MDL-11699 - Making one more common case a bit nicer for callers. 2007-10-12 15:11:39 +00:00
nfreear 64b0ce50b7 Follow up fix for MDL-11535 "Blog block sql error" - GROUP BY, added ", tg.flag". Merged. 2007-10-12 11:01:18 +00:00
tjhunt 36f4fa0c2d MDL-11699 - Further, backwards-compatible, improvement to the build navigation API to simplify a common case. Also, further improvements to the doc comment, so it is easy to use. 2007-10-12 10:35:55 +00:00
stronk7 a1d04b878b Adding $Id tag 2007-10-12 09:44:16 +00:00
nfreear 3ab263074c Fixes MDL-11695, Skip block links inaccessible for many keyboard-only users. Merged. 2007-10-12 08:49:58 +00:00
urs_hunkler b024b748c7 MDL-11729 :: Removed commenting out loading of the Chameleon files loading. 2007-10-12 07:52:12 +00:00
moodler 22ee674191 Info about version numbers 2007-10-12 07:47:07 +00:00
toyomoyo 0f132d1bee missing context 2007-10-12 07:40:03 +00:00
toyomoyo c58f9a458e MDL-11717, dimmed_text class for hidden grade items in grader report 2007-10-12 07:17:39 +00:00
Martin Langhoff d54a1b6712 cvsimport fixups 2007-10-12 03:14:42 +00:00
toyomoyo 3ffbc9a3e0 MDL-11715, export form should follow sortorder 2007-10-12 03:14:42 +00:00
toyomoyo 0741bdca11 MDL-11714, removing debuging statement 2007-10-12 01:33:32 +00:00
tjhunt ba79369331 MDL-11699 - Addendum - fix typo in fixup code. Sorry. 2007-10-11 16:43:16 +00:00
tjhunt 0a4025eaa5 Small tidy-up in print_header_simple. 2007-10-11 15:25:14 +00:00
nicolasconnault 1ce63d3fc2 MDL-8605 Preventing new user folder from being created when original folder is empty 2007-10-11 14:18:04 +00:00
tjhunt b9ecfd4957 MDL-9542 - Show final grades from new gradebook in Quiz UI - with help from Petr. 2007-10-11 11:42:03 +00:00
nicolasconnault 16ef809654 Small unit test-related fix 2007-10-11 11:14:03 +00:00
11026 changed files with 667071 additions and 1846529 deletions
-27
View File
@@ -1,27 +0,0 @@
# This file specifies intentionally untracked files that all Moodle git
# repositories should ignore. It is recommended not to modify this file in your
# local clone. Instead, use .git/info/exclude and add new records there as
# needed.
#
# Example: if you deploy a contributed plugin mod/foobar into your site, put
# the following line into .git/info/exclude file in your Moodle clone:
# /mod/foobar/
#
# See gitignore(5) man page for more details
#
/config.php
/lib/editor/tinymce/extra/tools/temp/
*~
*.swp
/tags
/TAGS
/cscope.*
/.patches/
/.idea/
/nbproject/
CVS
.DS_Store
/.settings/
/.project
/.buildpath
/.cache
-674
View File
@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+13 -6
View File
@@ -1,18 +1,21 @@
README $Id$
------
QUICK INSTALL
=============
For the impatient, here is a basic outline of the
installation process, which normally takes me only
For the impatient, here is a basic outline of the
installation process, which normally takes me only
a few minutes:
1) Move the Moodle files into your web directory.
1) Move the Moodle files into your web directory.
2) 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
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
you through creating a config.php file and then
setting up Moodle, creating an admin account etc.
4) Set up a cron task to call the file admin/cron.php
@@ -21,7 +24,11 @@ a few minutes:
For more information, see the INSTALL DOCUMENTATION:
http://docs.moodle.org/en/Installing_Moodle
http://docs.moodle.org/en/Installing_Moodle
A local copy can also be found in
lang/en_utf8/help/install.html (or your language)
Good luck and have fun!
-34
View File
@@ -1,34 +0,0 @@
------------------------
Moodle Trademark License
------------------------
The name Moodle™ is a registered trademark of the Moodle Trust.
A key part of the business model that allows us to produce and
distribute Moodle as completely Free open source software is that
we restrict the commercial use of the Moodle trademark to those
who have contracted to support Moodle development (Moodle Partners).
If you are intending to use the name (and/or logo) to advertise
generic Moodle™ services (eg Moodle Hosting, Moodle Support,
Moodle Certification, Moodle Training, Moodle Consulting,
Moodle Customisation, Moodle Courseware Development, Moodle
Theme design, Moodle Integrations, Moodle Installations, etc)
or as the name of a software package, then you must seek
direct permission in writing from the Moodle Trust via the
moodle.com helpdesk, in accordance with normal trademark
restrictions.
There are no restrictions on how you use the name in other
contexts (for example, if you use Moodle just to provide
courses then you can use the name freely to refer to it.)
If you aren't sure of a particular case, please ask us via
http://moodle.com/helpdesk: we'll be happy to either provide
you with official permission in writing or help you fix
your wording.
Martin Dougiamas
Executive Director
Moodle Trust
http://moodle.com
+9 -10
View File
@@ -14,13 +14,14 @@ require_once($CFG->libdir.'/tablelib.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
$PAGE->set_url($returnurl);
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
$action = optional_param('action', '', PARAM_ACTION);
$auth = optional_param('auth', '', PARAM_SAFEDIR);
// get currently installed and enabled auth plugins
$authsavailable = get_list_of_plugins('auth');
get_enabled_auth_plugins(true); // fix the list of enabled auths
if (empty($CFG->auth)) {
$authsenabled = array();
@@ -29,7 +30,7 @@ if (empty($CFG->auth)) {
}
if (!empty($auth) and !exists_auth_plugin($auth)) {
print_error('pluginnotinstalled', 'auth', $returnurl, $auth);
error(get_string('pluginnotinstalled', 'auth', $auth), $url);
}
////////////////////////////////////////////////////////////////////////////////
@@ -51,7 +52,6 @@ switch ($action) {
if ($auth == $CFG->registerauth) {
set_config('registerauth', '');
}
session_gc(); // remove stale sessions
break;
case 'enable':
@@ -61,14 +61,13 @@ switch ($action) {
$authsenabled = array_unique($authsenabled);
set_config('auth', implode(',', $authsenabled));
}
session_gc(); // remove stale sessions
break;
case 'down':
$key = array_search($auth, $authsenabled);
// check auth plugin is valid
if ($key === false) {
print_error('pluginnotenabled', 'auth', $returnurl, $auth);
error(get_string('pluginnotenabled', 'auth', $auth), $url);
}
// move down the list
if ($key < (count($authsenabled) - 1)) {
@@ -83,7 +82,7 @@ switch ($action) {
$key = array_search($auth, $authsenabled);
// check auth is valid
if ($key === false) {
print_error('pluginnotenabled', 'auth', $returnurl, $auth);
error(get_string('pluginnotenabled', 'auth', $auth), $url);
}
// move up the list
if ($key >= 1) {
@@ -98,6 +97,6 @@ switch ($action) {
break;
}
redirect($returnurl);
redirect ($returnurl);
?>
+26 -26
View File
@@ -7,7 +7,8 @@ require_once '../config.php';
require_once $CFG->libdir.'/adminlib.php';
$auth = required_param('auth', PARAM_SAFEDIR);
$PAGE->set_pagetype('admin-auth-' . $auth);
$CFG->pagepath = 'auth/' . $auth;
admin_externalpage_setup('authsetting'.$auth);
@@ -18,6 +19,7 @@ $returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
// save configuration changes
if ($frm = data_submitted() and confirm_sesskey()) {
$frm = stripslashes_recursive($frm);
$authplugin->validate_form($frm, $err);
@@ -31,7 +33,9 @@ if ($frm = data_submitted() and confirm_sesskey()) {
if (preg_match('/^lockconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
$name = $matches[1];
set_config($name, $value, $plugin);
if (!set_config($name, $value, $plugin)) {
error("Problem saving config $name as $value for plugin $plugin");
}
}
}
redirect($returnurl);
@@ -43,13 +47,10 @@ if ($frm = data_submitted() and confirm_sesskey()) {
}
}
} else {
$frmlegacystyle = get_config('auth/'.$auth);
$frmnewstyle = get_config('auth_'.$auth);
$frm = (object)array_merge((array)$frmlegacystyle, (array)$frmnewstyle);
$frm = get_config("auth/$auth");
}
$user_fields = $authplugin->userfields;
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
/// Get the auth title (from core or own auth lang files)
$authtitle = $authplugin->get_title();
@@ -57,28 +58,28 @@ $user_fields = $authplugin->userfields;
$authdescription = $authplugin->get_description();
// output configuration form
echo $OUTPUT->header();
admin_externalpage_print_header();
// choose an authentication method
echo "<form id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />\n";
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
// auth plugin description
echo $OUTPUT->box_start();
echo $OUTPUT->heading($authtitle);
echo $OUTPUT->box_start('informationbox');
print_simple_box_start('center', '80%');
print_heading($authtitle);
print_simple_box_start('center', '80%', '', 5, 'informationbox');
echo $authdescription;
echo $OUTPUT->box_end();
print_simple_box_end();
echo "<hr />\n";
$authplugin->config_form($frm, $err, $user_fields);
echo $OUTPUT->box_end();
print_simple_box_end();
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
echo "</div>\n";
echo "</form>\n";
echo $OUTPUT->footer();
admin_externalpage_print_footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////
@@ -88,12 +89,12 @@ exit;
// other options
// Note: lockconfig_ fields have special handling.
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
global $OUTPUT;
echo '<tr><td colspan="3">';
if ($retrieveopts) {
echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth'));
print_heading(get_string('auth_data_mapping', 'auth'));
} else {
echo $OUTPUT->heading(get_string('auth_fieldlocks', 'auth'));
print_heading(get_string('auth_fieldlocks', 'auth'));
}
echo '</td></tr>';
@@ -134,11 +135,10 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
$fieldname = get_string('language');
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
} elseif ($fieldname == 'url') {
$fieldname = get_string('webpage');
} else {
$fieldname = get_string($fieldname);
}
if ($retrieveopts) {
$varname = 'field_map_' . $field;
@@ -149,23 +149,23 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\" />";
echo '<div style="text-align: right">';
echo '<label for="menulockconfig_field_updatelocal_'.$field.'">'.get_string('auth_updatelocal', 'auth') . '</label>&nbsp;';
echo html_writer::select($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, false);
choose_from_menu($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, "");
echo '<br />';
if ($updateopts) {
echo '<label for="menulockconfig_field_updateremote_'.$field.'">'.get_string('auth_updateremote', 'auth') . '</label>&nbsp;';
echo html_writer::select($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, false);
choose_from_menu($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, "");
echo '<br />';
}
echo '<label for="menulockconfig_field_lock_'.$field.'">'.get_string('auth_fieldlock', 'auth') . '</label>&nbsp;';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
echo '</div>';
} else {
echo '<tr valign="top"><td align="right">';
echo '<label for="menulockconfig_field_lock_'.$field.'">'.$fieldname.'</label>';
echo '</td><td>';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, "");
}
echo '</td>';
if (!empty($helptext)) {
@@ -176,4 +176,4 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
}
}
?>
+13 -19
View File
@@ -1,28 +1,29 @@
<?php
<?PHP // $Id$
// block.php - allows admin to edit all local configuration variables for a block
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/blocklib.php');
$blockid = required_param('block', PARAM_INT);
if(!$blockrecord = blocks_get_record($blockid)) {
print_error('blockdoesnotexist', 'error');
error('This block does not exist');
}
admin_externalpage_setup('blocksetting'.$blockrecord->name);
$block = block_instance($blockrecord->name);
if($block === false) {
print_error('blockcannotinistantiate', 'error');
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' => sesskey()
'sesskey' => $USER->sesskey
);
/// If data submitted, then process and store.
@@ -30,10 +31,10 @@
if ($config = data_submitted()) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
error(get_string('confirmsesskeybad', 'error'));
}
if(!$block->has_config()) {
print_error('blockcannotconfig', 'error');
error('This block does not support global configuration');
}
$remove = array_keys($hiddendata);
foreach($remove as $item) {
@@ -49,14 +50,11 @@
$strmanageblocks = get_string('manageblocks');
$strblockname = $block->get_title();
echo $OUTPUT->header();
admin_externalpage_print_header();
echo $OUTPUT->heading($strblockname);
print_heading($strblockname);
echo $OUTPUT->notification('This block still uses an old-style config_global.html file. ' .
'It must be updated by a developer to use a settings.php file.');
echo $OUTPUT->box(get_string('configwarning', 'admin'), 'generalbox boxwidthnormal boxaligncenter');
print_simple_box(get_string('configwarning', 'admin'), 'center', '50%');
echo '<br />';
echo '<form method="post" action="block.php">';
@@ -65,12 +63,8 @@
echo '<input type="hidden" name="'. $name .'" value="'. $val .'" />';
}
echo '</p>';
echo $OUTPUT->box_start();
include($CFG->dirroot.'/blocks/'. $block->name() .'/config_global.html');
echo $OUTPUT->box_end();
$block->config_print();
echo '</form>';
echo $OUTPUT->footer();
print_footer();
?>
+106 -78
View File
@@ -1,10 +1,12 @@
<?php
<?PHP // $Id$
// Allows the admin to configure blocks (hide/show, delete and configure)
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/ddllib.php');
admin_externalpage_setup('manageblocks');
@@ -12,6 +14,7 @@
$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);
/// Print headings
@@ -23,64 +26,79 @@
$strsettings = get_string('settings');
$strcourses = get_string('blockinstances', 'admin');
$strname = get_string('name');
$strmultiple = get_string('blockmultiple', 'admin');
$strshowblockcourse = get_string('showblockcourse');
/// If data submitted, then process and store.
if (!empty($hide) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$hide))) {
print_error('blockdoesnotexist', 'error');
if (!$block = get_record('block', 'id', $hide)) {
error("Block doesn't exist!");
}
$DB->set_field('block', 'visible', '0', array('id'=>$block->id)); // Hide block
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($show) && confirm_sesskey() ) {
if (!$block = $DB->get_record('block', array('id'=>$show))) {
print_error('blockdoesnotexist', 'error');
if (!$block = get_record('block', 'id', $show)) {
error("Block doesn't exist!");
}
$DB->set_field('block', 'visible', '1', array('id'=>$block->id)); // Show block
set_field('block', 'visible', '1', 'id', $block->id); // Show block
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($multiple) && confirm_sesskey()) {
if (!$block = blocks_get_record($multiple)) {
error("Block doesn't exist!");
}
$block->multiple = !$block->multiple;
update_record('block', $block);
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($delete) && confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
admin_externalpage_print_header();
print_heading($strmanageblocks);
if (!$block = blocks_get_record($delete)) {
print_error('blockdoesnotexist', 'error');
error("Block doesn't exist!");
}
if (get_string_manager()->string_exists('pluginname', "block_$block->name")) {
$strblockname = get_string('pluginname', "block_$block->name");
} else {
if (!block_is_compatible($block->name)) {
$strblockname = $block->name;
}
else {
$blockobject = block_instance($block->name);
$strblockname = $blockobject->get_title();
}
if (!$confirm) {
echo $OUTPUT->confirm(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete='.$block->id.'&confirm=1', 'blocks.php');
echo $OUTPUT->footer();
notice_yesno(get_string('blockdeleteconfirm', '', $strblockname),
'blocks.php?delete='.$block->id.'&amp;confirm=1&amp;sesskey='.$USER->sesskey,
'blocks.php');
admin_externalpage_print_footer();
exit;
} else {
// Inform block it's about to be deleted
if (file_exists("$CFG->dirroot/blocks/$block->name/block_$block->name.php")) {
$blockobject = block_instance($block->name);
if ($blockobject) {
$blockobject->before_delete(); //only if we can create instance, block might have been already removed
}
$blockobject = block_instance($block->name);
if ($blockobject) {
$blockobject->before_delete(); //only if we can create instance, block might have been already removed
}
// First delete instances and then block
$instances = $DB->get_records('block_instances', array('blockname' => $block->name));
$instances = get_records('block_instance', 'blockid', $block->id);
if(!empty($instances)) {
foreach($instances as $instance) {
blocks_delete_instance($instance);
blocks_delete_instance($instance, true);
}
}
// Delete block
$DB->delete_records('block', array('id'=>$block->id));
if (!delete_records('block', 'id', $block->id)) {
notify("Error occurred while deleting the $strblockname record from blocks table");
}
drop_plugin_tables($block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false); // old obsoleted table names
drop_plugin_tables('block_'.$block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false);
@@ -88,7 +106,7 @@
// Delete the capabilities that were defined by this block
capabilities_cleanup('block/'.$block->name);
// Remove event handlers and dequeue pending events
// remove entent handlers and dequeue pending events
events_uninstall('block/'.$block->name);
$a->block = $strblockname;
@@ -97,56 +115,59 @@
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
admin_externalpage_print_header();
print_heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
if (!$blocks = $DB->get_records('block', array(), 'name ASC')) {
print_error('noblocks', 'error'); // Should never happen
if (false === ($blocks = get_records('block'))) {
error('No blocks found!'); // Should never happen
}
$incompatible = array();
foreach ($blocks as $block) {
if(!block_is_compatible($block->name)) {
notify('Block '. $block->name .' is not compatible with the current version of Moodle and needs to be updated by a programmer.');
$incompatible[] = $block;
continue;
}
if(($blockobject = block_instance($block->name)) === false) {
// Failed to load
continue;
}
$blockbyname[$blockobject->get_title()] = $block->id;
$blockobjects[$block->id] = $blockobject;
}
if(empty($blockbyname)) {
error('One or more blocks are registered in the database, but they all failed to load!');
}
ksort($blockbyname);
/// Print the table of all blocks
$table = new flexible_table('admin-blocks-compatible');
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'delete', 'settings'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strdelete, $strsettings));
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'multiple', 'delete', 'settings'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strmultiple, $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'compatibleblockstable blockstable generaltable');
$table->set_attribute('id', 'blocks');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
foreach ($blocks as $blockid=>$block) {
$blockname = $block->name;
foreach ($blockbyname as $blockname => $blockid) {
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$blockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new stdClass();
$plugin->version = $block->version;
$blockobject = $blockobjects[$blockid];
$block = $blocks[$blockid];
} else {
$plugin = new stdClass();
$plugin->version = '???';
if (file_exists("$CFG->dirroot/blocks/$blockname/version.php")) {
include("$CFG->dirroot/blocks/$blockname/version.php");
}
if (!$blockobject = block_instance($block->name)) {
$incompatible[] = $block;
continue;
}
$strblockname = get_string('pluginname', 'block_'.$blockname);
}
$delete = '<a href="blocks.php?delete='.$blockid.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>';
$delete = '<a href="blocks.php?delete='.$blockid.'&amp;sesskey='.$USER->sesskey.'">'.$strdelete.'</a>';
$settings = ''; // By default, no configuration
if ($blockobject and $blockobject->has_config()) {
if ($blockobject->has_config()) {
if (file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else {
@@ -157,11 +178,15 @@
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
// and it should not show up on course search page
$totalcount = $DB->count_records('block_instances', array('blockname'=>$blockname));
$count = $DB->count_records('block_instances', array('blockname'=>$blockname, 'pagetypepattern'=>'course-view-*'));
$totalcount = count_records('block_instance', 'blockid', $blockid);
$count = count_records_sql('SELECT COUNT(*)
FROM '.$CFG->prefix.'block_instance
WHERE blockid = '.$blockid.' AND
pagetype = \'course-view\'');
if ($count>0) {
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&amp;sesskey=".sesskey()."\" ";
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&amp;sesskey={$USER->sesskey}\" ";
$blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
}
else {
@@ -169,30 +194,32 @@
}
$class = ''; // Nothing fancy, by default
if (!$blockobject) {
// ignore
$visible = '';
} else if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strhide.'">'.
'<img src="'.$OUTPUT->pix_url('i/hide') . '" class="icon" alt="'.$strhide.'" /></a>';
if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.$USER->sesskey.'" title="'.$strhide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" class="icon" alt="'.$strhide.'" /></a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strshow.'">'.
'<img src="'.$OUTPUT->pix_url('i/show') . '" class="icon" alt="'.$strshow.'" /></a>';
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.$USER->sesskey.'" title="'.$strshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" class="icon" alt="'.$strshow.'" /></a>';
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($block->version == $plugin->version) {
$version = $block->version;
} else {
$version = "$block->version ($plugin->version)";
if ($blockobject->instance_allow_multiple()) {
if($blocks[$blockid]->multiple) {
$multiple = '<span style="white-space: nowrap;">'.get_string('yes').' (<a href="blocks.php?multiple='.$blockid.'&amp;sesskey='.$USER->sesskey.'">'.get_string('change', 'admin').'</a>)</span>';
}
else {
$multiple = '<span style="white-space: nowrap;">'.get_string('no').' (<a href="blocks.php?multiple='.$blockid.'&amp;sesskey='.$USER->sesskey.'">'.get_string('change', 'admin').'</a>)</span>';
}
}
else {
$multiple = '';
}
$table->add_data(array(
'<span'.$class.'>'.$strblockname.'</span>',
'<span'.$class.'>'.$blockobject->get_title().'</span>',
$blocklist,
'<span'.$class.'>'.$version.'</span>',
'<span'.$class.'>'.$blockobject->get_version().'</span>',
$visible,
$multiple,
$delete,
$settings
));
@@ -200,8 +227,8 @@
$table->print_html();
if (!empty($incompatible)) {
echo $OUTPUT->heading(get_string('incompatibleblocks', 'blockstable', 'admin'));
if(!empty($incompatible)) {
print_heading(get_string('incompatibleblocks', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
@@ -209,19 +236,20 @@
$table->define_headers(array($strname, $strdelete));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
$table->set_attribute('id', 'incompatible');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
foreach ($incompatible as $block) {
$table->add_data(array(
$block->name,
'<a href="blocks.php?delete='.$block->id.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>',
'<a href="blocks.php?delete='.$block->id.'&amp;sesskey='.$USER->sesskey.'">'.$strdelete.'</a>',
));
}
$table->print_html();
}
echo $OUTPUT->footer();
admin_externalpage_print_footer();
?>
-152
View File
@@ -1,152 +0,0 @@
<?php
/// Create "blog" forums in each course and copy blog entries from these courses' participants in these forums
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/blog/lib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('bloglevelupgrade');
$PAGE->set_pagelayout('maintenance');
$go = optional_param('go', 0, PARAM_BOOL);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('bloglevelupgrade', 'admin'));
$strbloglevelupgrade = get_string('bloglevelupgradeinfo', 'admin');
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
echo $OUTPUT->confirm($strbloglevelupgrade, new moodle_url('bloglevelupgrade.php', $optionsyes), 'index.php');
echo $OUTPUT->footer();
die;
}
echo $OUTPUT->box_start();
/// Turn off time limits, sometimes upgrades can be slow.
set_time_limit(0);
$i = 0;
// If $CFG->bloglevel is set to BLOG_GROUP_LEVEL or BLOG_COURSE_LEVEL, create a new "blog" forum in each course
// whose enrolled students have written blog entries, copy these entries in that forum and switch off blogs at site level
if ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) {
$pbar = new progress_bar('bloglevelupgrade', 500, true);
$bloggers = $DB->get_records_sql("SELECT userid FROM {post} WHERE module = 'blog' GROUP BY userid");
require_once($CFG->dirroot.'/mod/forum/lib.php');
$a = new stdClass();
$a->userscount = 0;
$a->blogcount = 0;
foreach ($bloggers as $blogger) {
$courses = enrol_get_users_courses($blogger->userid, true, 'groupmode,groupmodeforce');
$blogentries = $DB->get_records('post', array('module' => 'blog', 'userid' => $blogger->userid));
foreach ($courses as $course) {
$forum = forum_get_course_forum($course->id, 'blog');
$cm = get_coursemodule_from_instance('forum', $forum->id);
if ($CFG->bloglevel == BLOG_GROUP_LEVEL && $course->groupmode != NOGROUPS) {
// Unless the course is set to separate groups forced, force the forum to Separate groups
if (!($course->groupmode == SEPARATEGROUPS && $course->groupmodeforce)) {
$cm->groupmode = SEPARATEGROUPS;
$DB->update_record('course_modules', $cm);
}
$groups = groups_get_user_groups($course->id, $blogger->userid);
foreach ($groups[0] as $groupid) { // [0] is for all groupings combined
$a->blogcount += bloglevelupgrade_entries($blogentries, $forum, $cm, $groupid);
}
} else {
$a->blogcount += bloglevelupgrade_entries($blogentries, $forum, $cm);
}
}
$a->userscount = $i . '/' . count($bloggers);
$pbar->update($i, count($bloggers), get_string('bloglevelupgradeprogress', 'admin', $a));
$i++;
}
}
function bloglevelupgrade_entries($blogentries, $forum, $cm, $groupid=-1) {
$count = 0;
$forumcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
foreach ($blogentries as $blogentry) {
$discussion = new stdClass();
$discussion->course = $forum->course;
$discussion->forum = $forum->id;
$discussion->name = $blogentry->subject;
$discussion->intro = $blogentry->summary;
$discussion->assessed = $forum->assessed;
$discussion->messageformat = $forum->introformat;
$discussion->messagetrust = 0;
$discussion->attachments = 0;
$discussion->mailnow = false;
$discussion->timemodified = $blogentry->created;
$discussion->itemid = null;
$discussion->groupid = $groupid;
$message = '';
$discussionid = forum_add_discussion($discussion, null, $message);
// Copy file attachment records
$fs = get_file_storage();
$files = $fs->get_area_files($sitecontext->id, 'blog', 'attachment', $blogentry->id);
if (!empty($files)) {
foreach ($files as $storedfile) {
$newfile = new stdClass();
$newfile->component = 'mod_forum';
$newfile->filearea = 'attachment';
$newfile->itemid = $discussion->firstpost;
$newfile->contextid = $forumcontext->id;
$fs->create_file_from_storedfile($newfile, $storedfile->get_id());
}
}
$files = $fs->get_area_files($sitecontext->id, 'blog', 'post', $blogentry->id);
if (!empty($files)) {
foreach ($files as $storedfile) {
$newfile = new stdClass();
$newfile->component = 'mod_forum';
$newfile->filearea = 'post';
$newfile->itemid = $discussion->firstpost;
$newfile->contextid = $forumcontext->id;
$fs->create_file_from_storedfile($newfile, $storedfile->get_id());
}
}
$count++;
}
return $count;
}
// END OF LOOP
// set conversion flag - switches to new plugin automatically
set_config('bloglevel_upgrade_complete', 1);
// Finally switch bloglevel to 0 (disabled)
set_config('bloglevel', 0);
echo $OUTPUT->box_end();
/// Rebuild course cache which might be incorrect now
echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
rebuild_course_cache();
echo $OUTPUT->notification('...finished', 'notifysuccess');
echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->footer();
die;
-100
View File
@@ -1,100 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automated backups CLI cron
*
* This script executes
*
* @package core
* @subpackage cli
* @copyright 2010 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Execute automated backups.
This script executes automated backups completely and is designed to be
called via cron.
Options:
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/automated_backups.php
";
echo $help;
die;
}
if (CLI_MAINTENANCE) {
echo "CLI maintenance mode active, backup execution suspended.\n";
exit(1);
}
if (moodle_needs_upgrading()) {
echo "Moodle upgrade pending, backup execution suspended.\n";
exit(1);
}
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/gradelib.php');
if (!empty($CFG->showcronsql)) {
$DB->set_debug(true);
}
if (!empty($CFG->showcrondebugging)) {
$CFG->debug = DEBUG_DEVELOPER;
$CFG->debugdisplay = true;
}
$starttime = microtime();
/// emulate normal session
cron_setup_user();
/// Start output log
$timenow = time();
mtrace("Server Time: ".date('r',$timenow)."\n\n");
// Run automated backups if required.
require_once($CFG->dirroot.'/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot.'/backup/util/helper/backup_cron_helper.class.php');
backup_cron_automated_helper::run_automated_backup(backup_cron_automated_helper::RUN_IMMEDIATLY);
mtrace("Automated cron backups completed correctly");
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
-61
View File
@@ -1,61 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* CLI cron
*
* This script looks through all the module directories for cron.php files
* and runs them. These files can contain cleanup functions, email functions
* or anything that needs to be run on a regular basis.
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Execute periodic cron actions.
Options:
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/cron.php
";
echo $help;
die;
}
cron_run();
-635
View File
@@ -1,635 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script creates config.php file and prepares database.
*
* This script is not intended for beginners!
* Potential problems:
* - environment check is not present yet
* - su to apache account or sudo before execution
* - not compatible with Windows platform
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
// extra execution prevention - we can not just require config.php here
if (isset($_SERVER['REMOTE_ADDR'])) {
exit(1);
}
$help =
"Command line Moodle installer, creates config.php and initializes database.
Please note you must execute this script with the same uid as apache
or use chmod/chown after installation.
Site defaults may be changed via local/defaults.php.
Options:
--chmod=OCTAL-MODE Permissions of new directories created within dataroot.
Default is 2777. You may want to change it to 2770
or 2750 or 750. See chmod man page for details.
--lang=CODE Installation and default site language.
--wwwroot=URL Web address for the Moodle site,
required in non-interactive mode.
--dataroot=DIR Location of the moodle data folder,
must not be web accessible. Default is moodledata
in the parent directory.
--dbtype=TYPE Database type. Default is mysqli
--dbhost=HOST Database host. Default is localhost
--dbname=NAME Database name. Default is moodle
--dbuser=USERNAME Database user. Default is root
--dbpass=PASSWORD Database password. Default is blank
--dbsocket Use database sockets. Available for some databases only.
--prefix=STRING Table prefix for above database tables. Default is mdl_
--fullname=STRING The fullname of the site
--shortname=STRING The shortname of the site
--adminuser=USERNAME Username for the moodle admin account. Default is admin
--adminpass=PASSWORD Password for the moodle admin account,
required in non-interactive mode.
--non-interactive No interactive questions, installation fails if any
problem encountered.
--agree-license Indicates agreement with software license,
required in non-interactive mode.
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/install.php --lang=cs
"; //TODO: localize, mark as needed in install - to be translated later when everything is finished
// Nothing to do if config.php exists
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
if (file_exists($configfile)) {
require($configfile);
require_once($CFG->libdir.'/clilib.php');
list($options, $unrecognized) = cli_get_params(array('help'=>false), array('h'=>'help'));
if ($options['help']) {
echo $help;
echo "\n\n";
}
cli_error(get_string('clialreadyinstalled', 'install'));
}
$olddir = getcwd();
// change directory so that includes bellow work properly
chdir(dirname($_SERVER['argv'][0]));
// Servers should define a default timezone in php.ini, but if they don't then make sure something is defined.
// This is a quick hack. Ideally we should ask the admin for a value. See MDL-22625 for more on this.
if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) {
@date_default_timezone_set(@date_default_timezone_get());
}
// make sure PHP errors are displayed - helps with diagnosing of problems
@error_reporting(E_ALL);
@ini_set('display_errors', '1');
// we need a lot of memory
@ini_set('memory_limit', '128M');
/** Used by library scripts to check they are being called by Moodle */
define('MOODLE_INTERNAL', true);
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.2.8") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
echo "Sorry, Moodle 2.0 requires PHP 5.2.8 or later (currently using version $phpversion).\n";
echo "Please upgrade your server software or install latest Moodle 1.9.x instead.";
die;
}
// set up configuration
$CFG = new stdClass();
$CFG->lang = 'en';
$CFG->dirroot = dirname(dirname(dirname(__FILE__)));
$CFG->libdir = "$CFG->dirroot/lib";
$CFG->wwwroot = "http://localhost";
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata');
$CFG->docroot = 'http://docs.moodle.org';
$CFG->running_installer = true;
$CFG->early_install_lang = true;
$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__))));
$CFG->admin = array_pop($parts);
require($CFG->dirroot.'/version.php');
$CFG->target_release = $release;
//point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else
//the problem is that we need specific version of quickforms and hacked excel files :-(
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
require_once($CFG->libdir.'/installlib.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/setuplib.php');
require_once($CFG->libdir.'/textlib.class.php');
require_once($CFG->libdir.'/weblib.php');
require_once($CFG->libdir.'/dmllib.php');
require_once($CFG->libdir.'/moodlelib.php');
require_once($CFG->libdir.'/deprecatedlib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
//Database types
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
'oci' => moodle_database::get_driver_instance('oci', 'native'),
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
'mssql' => moodle_database::get_driver_instance('mssql', 'native'), // FreeTDS driver
);
foreach ($databases as $type=>$database) {
if ($database->driver_installed() !== true) {
unset($databases[$type]);
}
}
if (empty($databases)) {
$defaultdb = '';
} else {
reset($databases);
$defaultdb = key($databases);
}
// now get cli options
list($options, $unrecognized) = cli_get_params(
array(
'chmod' => '2777',
'lang' => $CFG->lang,
'wwwroot' => '',
'dataroot' => $CFG->dataroot,
'dbtype' => $defaultdb,
'dbhost' => 'localhost',
'dbname' => 'moodle',
'dbuser' => 'root',
'dbpass' => '',
'dbsocket' => false,
'prefix' => 'mdl_',
'fullname' => '',
'shortname' => '',
'adminuser' => 'admin',
'adminpass' => '',
'non-interactive' => false,
'agree-license' => false,
'help' => false
),
array(
'h' => 'help'
)
);
$interactive = empty($options['non-interactive']);
// set up language
$lang = clean_param($options['lang'], PARAM_SAFEDIR);
if (file_exists($CFG->dirroot.'/install/lang/'.$lang)) {
$CFG->lang = $lang;
}
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
echo $help;
die;
}
//Print header
echo get_string('cliinstallheader', 'install', $CFG->target_release)."\n";
//Fist select language
if ($interactive) {
cli_separator();
$languages = get_string_manager()->get_list_of_translations();
// format the langs nicely - 3 per line
$c = 0;
$langlist = '';
foreach ($languages as $key=>$lang) {
$c++;
$length = iconv_strlen($lang, 'UTF-8');
$padded = $lang.str_repeat(' ', 38-$length);
$langlist .= $padded;
if ($c % 3 == 0) {
$langlist .= "\n";
}
}
$default = $CFG->lang;
cli_heading(get_string('availablelangs', 'install'));
echo $langlist."\n";
$prompt = get_string('clitypevaluedefault', 'admin', $CFG->lang);
$error = '';
do {
echo $error;
$input = cli_input($prompt, $default);
$input = clean_param($input, PARAM_SAFEDIR);
if (!file_exists($CFG->dirroot.'/install/lang/'.$input)) {
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
} else {
$error = '';
}
} while ($error !== '');
$CFG->lang = $input;
} else {
// already selected and verified
}
// Set directorypermissions first
$chmod = octdec(clean_param($options['chmod'], PARAM_INT));
if ($interactive) {
cli_separator();
cli_heading('Data directories permission'); // todo localize
$prompt = get_string('clitypevaluedefault', 'admin', decoct($chmod));
$error = '';
do {
echo $error;
$input = cli_input($prompt, decoct($chmod));
$input = octdec(clean_param($input, PARAM_INT));
if (empty($input)) {
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
} else {
$error = '';
}
} while ($error !== '');
$chmod = $input;
} else {
if (empty($chmod)) {
$a = (object)array('option' => 'chmod', 'value' => decoct($chmod));
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
$CFG->directorypermissions = $chmod;
//We need wwwroot before we test dataroot
$wwwroot = clean_param($options['wwwroot'], PARAM_URL);
$wwwroot = trim($wwwroot, '/');
if ($interactive) {
cli_separator();
cli_heading(get_string('wwwroot', 'install'));
if (strpos($wwwroot, 'http') === 0) {
$prompt = get_string('clitypevaluedefault', 'admin', $wwwroot);
} else {
$wwwroot = null;
$prompt = get_string('clitypevalue', 'admin');
}
$error = '';
do {
echo $error;
$input = cli_input($prompt, $wwwroot);
$input = clean_param($input, PARAM_URL);
$input = trim($input, '/');
if (strpos($input, 'http') !== 0) {
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
} else {
$error = '';
}
} while ($error !== '');
$wwwroot = $input;
} else {
if (strpos($wwwroot, 'http') !== 0) {
$a = (object)array('option'=>'wwwroot', 'value'=>$wwwroot);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
$CFG->wwwroot = $wwwroot;
$CFG->httpswwwroot = $CFG->wwwroot;
//We need dataroot before lang download
if (!empty($options['dataroot'])) {
$CFG->dataroot = $options['dataroot'];
}
if ($interactive) {
cli_separator();
$i=0;
while(is_dataroot_insecure()) {
$parrent = dirname($CFG->dataroot);
$i++;
if ($parrent == '/' or $parrent == '.' or preg_match('/^[a-z]:\\\?$/i', $parrent) or ($i > 100)) {
$CFG->dataroot = ''; //can not find secure location for dataroot
break;
}
$CFG->dataroot = dirname($parrent).'/moodledata';
}
cli_heading(get_string('dataroot', 'install'));
$error = '';
do {
if ($CFG->dataroot !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $CFG->dataroot);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
echo $error;
$CFG->dataroot = cli_input($prompt, $CFG->dataroot);
if ($CFG->dataroot === '') {
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
} else if (is_dataroot_insecure()) {
$CFG->dataroot = '';
$error = get_string('pathsunsecuredataroot', 'install')."\n";
} else {
if (install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) {
$error = '';
} else {
$a = (object)array('dataroot' => $CFG->dataroot);
$error = get_string('pathserrcreatedataroot', 'install', $a)."\n";
}
}
} while ($error !== '');
} else {
if (is_dataroot_insecure()) {
cli_error(get_string('pathsunsecuredataroot', 'install'));
}
if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) {
$a = (object)array('dataroot' => $CFG->dataroot);
cli_error(get_string('pathserrcreatedataroot', 'install', $a));
}
}
//download lang pack with optional notification
if ($CFG->lang != 'en') {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
if ($cd->install() == COMPONENT_ERROR) {
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip';
$a->dest = $CFG->dataroot.'/lang';
cli_problem(get_string($cd->get_error(), 'error', $a));
} else {
cli_problem(get_string($cd->get_error(), 'error'));
}
} else {
// install parent lang if defined
if ($parentlang = get_parent_language()) {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
$cd->install();
}
}
}
}
}
// switch the string_manager instance to stop using install/lang/
$CFG->early_install_lang = false;
$CFG->langotherroot = $CFG->dataroot.'/lang';
$CFG->langlocalroot = $CFG->dataroot.'/lang';
get_string_manager(true);
// ask for db type - show only drivers available
if ($interactive) {
$options['dbtype'] = strtolower($options['dbtype']);
cli_separator();
cli_heading(get_string('databasetypehead', 'install'));
foreach ($databases as $type=>$database) {
echo " $type \n";
}
if (!empty($databases[$options['dbtype']])) {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbtype']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbtype = cli_input($prompt, $options['dbtype'], array_keys($databases));
} else {
if (empty($databases[$options['dbtype']])) {
$a = (object)array('option'=>'dbtype', 'value'=>$options['dbtype']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
$CFG->dbtype = $options['dbtype'];
}
$database = $databases[$CFG->dbtype];
// ask for db host
if ($interactive) {
cli_separator();
cli_heading(get_string('databasehost', 'install'));
if ($options['dbhost'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbhost']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbhost = cli_input($prompt, $options['dbhost']);
} else {
$CFG->dbhost = $options['dbhost'];
}
// ask for db name
if ($interactive) {
cli_separator();
cli_heading(get_string('databasename', 'install'));
if ($options['dbname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbname = cli_input($prompt, $options['dbname']);
} else {
$CFG->dbname = $options['dbname'];
}
// ask for db prefix
if ($interactive) {
cli_separator();
cli_heading(get_string('dbprefix', 'install'));
//TODO: solve somehow the prefix trouble for oci
if ($options['prefix'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['prefix']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->prefix = cli_input($prompt, $options['prefix']);
} else {
$CFG->prefix = $options['prefix'];
}
// ask for db user
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseuser', 'install'));
if ($options['dbuser'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbuser = cli_input($prompt, $options['dbuser']);
} else {
$CFG->dbuser = $options['dbuser'];
}
// ask for db password
if ($interactive) {
cli_separator();
cli_heading(get_string('databasepass', 'install'));
do {
if ($options['dbpass'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbpass']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbpass = cli_input($prompt, $options['dbpass']);
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
} while ($hint_database !== '');
} else {
$CFG->dbpass = $options['dbpass'];
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbsocket'=>$options['dbsocket']));
if ($hint_database !== '') {
cli_error(get_string('dbconnectionerror', 'install'));
}
}
// ask for fullname
if ($interactive) {
cli_separator();
cli_heading(get_string('fullsitename', 'moodle'));
if ($options['fullname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['fullname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['fullname'] = cli_input($prompt, $options['fullname']);
} while (empty($options['fullname']));
} else {
if (empty($options['fullname'])) {
$a = (object)array('option'=>'fullname', 'value'=>$options['fullname']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// ask for shortname
if ($interactive) {
cli_separator();
cli_heading(get_string('shortsitename', 'moodle'));
if ($options['shortname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['shortname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['shortname'] = cli_input($prompt, $options['shortname']);
} while (empty($options['shortname']));
} else {
if (empty($options['shortname'])) {
$a = (object)array('option'=>'shortname', 'value'=>$options['shortname']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// ask for admin user name
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminusername', 'install'));
if (!empty($options['adminuser'])) {
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['adminuser'] = cli_input($prompt, $options['adminuser']);
} while (empty($options['adminuser']) or $options['adminuser'] === 'guest');
} else {
if (empty($options['adminuser']) or $options['adminuser'] === 'guest') {
$a = (object)array('option'=>'adminuser', 'value'=>$options['adminuser']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// ask for admin user password
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminpassword', 'install'));
$prompt = get_string('clitypevalue', 'admin');
do {
$options['adminpass'] = cli_input($prompt);
} while (empty($options['adminpass']) or $options['adminpass'] === 'admin');
} else {
if (empty($options['adminpass']) or $options['adminpass'] === 'admin') {
$a = (object)array('option'=>'adminpass', 'value'=>$options['adminpass']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
if ($interactive) {
if (!$options['agree-license']) {
cli_separator();
cli_heading(get_string('copyrightnotice'));
echo "Moodle - Modular Object-Oriented Dynamic Learning Environment\n";
echo get_string('gpl3')."\n\n";
echo get_string('doyouagree')."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
} else {
if (!$options['agree-license']) {
cli_error(get_string('climustagreelicense', 'install'));
}
}
// Finally we have all info needed for config.php
$configphp = install_generate_configphp($database, $CFG);
umask(0137);
if (($fh = fopen($configfile, 'w')) !== false) {
fwrite($fh, $configphp);
fclose($fh);
}
if (!file_exists($configfile)) {
cli_error('Can not create config file.');
}
// remember selected language
$installlang = $CFG->lang;
// return back to original dir before executing setup.php which changes the dir again
chdir($olddir);
// We have config.php, it is a real php script from now on :-)
require($configfile);
// use selected language
$CFG->lang = $installlang;
$SESSION->lang = $CFG->lang;
install_cli_database($options, $interactive);
echo get_string('cliinstallfinished', 'install')."\n";
exit(0); // 0 means success
-156
View File
@@ -1,156 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This installs Moodle into empty database, config.php must already exist.
*
* This script is intended for advanced usage such as in Debian packages.
* - sudo to www-data (apache account) before
* - not compatible with Windows platform
*
* @package core
* @subpackage cli
* @copyright 2010 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
// extra execution prevention - we can not just require config.php here
if (isset($_SERVER['REMOTE_ADDR'])) {
exit(1);
}
$help =
"Advanced command line Moodle database installer.
Please note you must execute this script with the same uid as apache.
Site defaults may be changed via local/defaults.php.
Options:
--lang=CODE Installation and default site language. Default is en.
--adminuser=USERNAME Username for the moodle admin account. Default is admin.
--adminpass=PASSWORD Password for the moodle admin account.
--agree-license Indicates agreement with software license.
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/install_database.php --lang=cs --adminpass=soMePass123 --agree-license
";
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.2.8") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Sorry, Moodle 2.0 requires PHP 5.2.8 or later (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install latest Moodle 1.9.x instead.\n");
die(1);
}
// Nothing to do if config.php does not exist
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
if (!file_exists($configfile)) {
fwrite(STDERR, 'config.php does not exist, can not continue'); // do not localize
fwrite(STDERR, "\n");
die(1);
}
// Include necessary libs
require($configfile);
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/installlib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
// make sure no tables are installed yet
if ($DB->get_tables() ) {
cli_error(get_string('clitablesexist', 'install'));
}
$CFG->early_install_lang = true;
get_string_manager(true);
raise_memory_limit(MEMORY_EXTRA);
// now get cli options
list($options, $unrecognized) = cli_get_params(
array(
'lang' => 'en',
'adminuser' => 'admin',
'adminpass' => '',
'agree-license' => false,
'help' => false
),
array(
'h' => 'help'
)
);
if ($options['help']) {
echo $help;
die;
}
if (!$options['agree-license']) {
cli_error('You have to agree to the license. --help prints out the help'); // TODO: localize
}
if ($options['adminpass'] === true or $options['adminpass'] === '') {
cli_error('You have to specify admin password. --help prints out the help'); // TODO: localize
}
$options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR);
if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
$options['lang'] = 'en';
}
$CFG->lang = $options['lang'];
//download lang pack with optional notification
if ($CFG->lang != 'en') {
make_upload_directory('lang');
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
if ($cd->install() == COMPONENT_ERROR) {
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/langpack/2.0/'.$CFG->lang.'.zip';
$a->dest = $CFG->dataroot.'/lang';
cli_problem(get_string($cd->get_error(), 'error', $a));
} else {
cli_problem(get_string($cd->get_error(), 'error'));
}
} else {
// install parent lang if defined
if ($parentlang = get_parent_language()) {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/2.0', $parentlang.'.zip', 'languages.md5', 'lang')) {
$cd->install();
}
}
}
}
}
// switch the string_manager instance to stop using install/lang/
$CFG->early_install_lang = false;
get_string_manager(true);
install_cli_database($options, true);
echo get_string('cliinstallfinished', 'install')."\n";
exit(0); // 0 means success
-76
View File
@@ -1,76 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Enable or disable maintenance mode
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
// now get cli options
list($options, $unrecognized) = cli_get_params(array('enable'=>false, 'disable'=>false, 'help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Maintenance mode settings.
Current status displayed if not option specified.
Options:
--enable Enable maintenance mode
--disable Disable maintenance mode
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/maintenance.php
"; //TODO: localize - to be translated later when everything is finished
echo $help;
die;
}
cli_heading(get_string('sitemaintenancemode', 'admin')." ($CFG->wwwroot)");
if ($options['enable']) {
set_config('maintenance_enabled', 1);
echo get_string('sitemaintenanceon', 'admin')."\n";
exit(0);
} else if ($options['disable']) {
set_config('maintenance_enabled', 0);
echo get_string('sitemaintenanceoff', 'admin')."\n";
exit(0);
}
if (!empty($CFG->maintenance_enabled)) {
echo get_string('clistatusenabled', 'admin')."\n";
} else {
echo get_string('clistatusdisabled', 'admin')."\n";
}
-115
View File
@@ -1,115 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* MySQL engine conversion tool.
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
if ($DB->get_dbfamily() !== 'mysql') {
cli_error('This function is designed for MySQL databases only!');
}
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false, 'list'=>false, 'engine'=>false),
array('h'=>'help', 'l'=>'list'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$help =
"MySQL engine conversions script.
It is recommended to stop the web server before the conversion.
Do not use MyISAM if possible, because it is not ACID compliant
and does not support transactions.
Options:
--engine=ENGINE Convert MySQL tables to different engine
-l, --list Show table information
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB
";
if (!empty($options['engine'])) {
$engine = clean_param($options['engine'], PARAM_ALPHA);
echo "Converting tables to '$engine' for $CFG->wwwroot:\n";
$prefix = $DB->get_prefix();
$prefix = str_replace('_', '\\_', $prefix);
$sql = "SHOW TABLE STATUS WHERE Name LIKE BINARY '$prefix%'";
$rs = $DB->get_recordset_sql($sql);
$converted = 0;
$skipped = 0;
foreach ($rs as $table) {
if ($table->engine === $engine) {
echo str_pad($table->name, 40). " - NO CONVERSION NEEDED\n";
$skipped++;
continue;
}
echo str_pad($table->name, 40). " - ";
$DB->change_database_structure("ALTER TABLE {$table->name} TYPE = $engine");
echo "DONE\n";
$converted++;
}
$rs->close();
echo "Converted: $converted, skipped: $skipped\n";
exit(0); // success
} else if (!empty($options['list'])) {
echo "List of tables for $CFG->wwwroot:\n";
$prefix = $DB->get_prefix();
$prefix = str_replace('_', '\\_', $prefix);
$sql = "SHOW TABLE STATUS WHERE Name LIKE BINARY '$prefix%'";
$rs = $DB->get_recordset_sql($sql);
$counts = array();
foreach ($rs as $table) {
if (isset($counts[$table->engine])) {
$counts[$table->engine]++;
} else {
$counts[$table->engine] = 1;
}
echo str_pad($table->engine, 10);
echo $table->name . "\n";
}
$rs->close();
echo "\n";
echo "Table engines summary for $CFG->wwwroot:\n";
foreach ($counts as $engine => $count) {
echo "$engine: $count\n";
}
exit(0); // success
} else {
echo $help;
die;
}
-81
View File
@@ -1,81 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script allows you to reset any local user password.
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Reset local user passwords, useful especially for admin acounts.
There are no security checks here because anybody who is able to
execute this file may execute any PHP too.
Options:
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php
"; //TODO: localize - to be translated later when everything is finished
echo $help;
die;
}
cli_heading('Password reset'); // TODO: localize
$prompt = "enter username (manual authentication only)"; // TODO: localize
$username = cli_input($prompt);
if (!$user = $DB->get_record('user', array('auth'=>'manual', 'username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
cli_error("Can not find user '$username'");
}
$prompt = "Enter new password"; // TODO: localize
$password = cli_input($prompt);
$errmsg = '';//prevent eclipse warning
if (!check_password_policy($password, $errmsg)) {
cli_error($errmsg);
}
$hashedpassword = hash_internal_user_password($password);
$DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
echo "Password changed\n";
exit(0); // 0 means success
-123
View File
@@ -1,123 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script creates config.php file and prepares database.
*
* This script is not intended for beginners!
* Potential problems:
* - environment check is not present yet
* - su to apache account or sudo before execution
* - not compatible with Windows platform
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/environmentlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(array('non-interactive'=>false, 'help'=>false),
array('h'=>'help'));
$interactive = empty($options['non-interactive']);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help =
"Command line Moodle upgrade.
Please note you must execute this script with the same uid as apache!
Site defaults may be changed via local/defaults.php.
Options:
--non-interactive No interactive questions or confirmations
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/upgrade.php
"; //TODO: localize - to be translated later when everything is finished
echo $help;
die;
}
if (empty($CFG->version)) {
cli_error(get_string('missingconfigversion', 'debug'));
}
require("$CFG->dirroot/version.php"); // defines $version and $release
$CFG->target_release = $release; // used during installation and upgrades
if ($version < $CFG->version) {
cli_error(get_string('downgradedcore', 'error'));
}
$newversion = "$release ($version)";
// test environment first
if (!check_moodle_environment($version, $environment_results, false, ENV_SELECT_RELEASE)) {
$errors = environment_get_errors($environment_results);
cli_heading(get_string('environment', 'admin'));
foreach ($errors as $error) {
list($info, $report) = $error;
echo "!! $info !!\n$report\n\n";
}
exit(1);
}
if ($interactive) {
echo html_to_text(get_string('upgradesure', 'admin', $newversion))."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
if ($version > $CFG->version) {
upgrade_core($version, true);
}
set_config('release', $release);
// unconditionally upgrade
upgrade_noncore(true);
// log in as admin - we need doanything permission when applying defaults
$admins = get_admins();
$admin = reset($admins);
session_set_user($admin);
// apply all default settings, just in case do it twice to fill all defaults
admin_apply_default_settings(NULL, false);
admin_apply_default_settings(NULL, false);
echo get_string('cliupgradefinished', 'admin')."\n";
exit(0); // 0 means success
+531 -74
View File
@@ -1,86 +1,543 @@
<?php
<?php // $Id$
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/// This script looks through all the module directories for cron.php files
/// and runs them. These files can contain cleanup functions, email functions
/// or anything that needs to be run on a regular basis.
///
/// This file is best run from cron on the host system (ie outside PHP).
/// The script can either be invoked via the web server or via a standalone
/// version of PHP compiled for CGI.
///
/// eg wget -q -O /dev/null 'http://moodle.somewhere.edu/admin/cron.php'
/// or php /web/moodle/admin/cron.php
set_time_limit(0);
$starttime = microtime();
/**
* Web cron
*
* This script looks through all the module directories for cron.php files
* and runs them. These files can contain cleanup functions, email functions
* or anything that needs to be run on a regular basis.
*
* This file is best run from cron on the host system (ie outside PHP).
* It is strongly recommended to add password protection via admin settings.
*
* eg wget -q -O /dev/null 'http: *moodle.somewhere.edu/admin/cron.php?password=SeCreT666'
*
* It is also possible to use CLI script admin/cli/cron.php instead,
* you can not call this script from command line any more.
*
* @package core
* @subpackage admin
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/// The following is a hack necessary to allow this script to work well
/// from the command line.
// This is a fake CLI script, it is a really ugly hack which emulates
// CLI via web interface, please do not use this hack elsewhere
define('CLI_SCRIPT', true);
define('WEB_CRON_EMULATED_CLI', 'defined'); // ugly ugly hack, do not use elsewhere please
define('NO_OUTPUT_BUFFERING', true);
define('FULLME', 'cron');
require('../config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/cronlib.php');
// extra safety
session_get_instance()->write_close();
/// Do not set moodle cookie because we do not need it here, it is better to emulate session
$nomoodlecookie = true;
// check if execution allowed
if (!empty($CFG->cronclionly)) {
// This script can only be run via the cli.
print_error('cronerrorclionly', 'admin');
exit;
}
// This script is being called via the web, so check the password if there is one.
if (!empty($CFG->cronremotepassword)) {
$pass = optional_param('password', '', PARAM_RAW);
if ($pass != $CFG->cronremotepassword) {
// wrong password.
print_error('cronerrorpassword', 'admin');
exit;
/// The current directory in PHP version 4.3.0 and above isn't necessarily the
/// directory of the script when run from the command line. The require_once()
/// would fail, so we'll have to chdir()
if (!isset($_SERVER['REMOTE_ADDR']) && isset($_SERVER['argv'][0])) {
chdir(dirname($_SERVER['argv'][0]));
}
}
// send mime type and encoding
if (check_browser_version('MSIE')) {
//ugly IE hack to work around downloading instead of viewing
@header('Content-Type: text/html; charset=utf-8');
echo "<xmp>"; //<pre> is not good enough for us here
} else {
//send proper plaintext header
@header('Content-Type: text/plain; charset=utf-8');
}
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/gradelib.php');
// execute the cron
cron_run();
/// Extra debugging (set in config.php)
if (!empty($CFG->showcronsql)) {
$db->debug = true;
}
if (!empty($CFG->showcrondebugging)) {
$CFG->debug = DEBUG_DEVELOPER;
$CFG->displaydebug = true;
}
// finish the IE hack
if (check_browser_version('MSIE')) {
echo "</xmp>";
}
/// extra safety
@session_write_close();
/// check if execution allowed
if (isset($_SERVER['REMOTE_ADDR'])) { // if the script is accessed via the web.
if (!empty($CFG->cronclionly)) {
// This script can only be run via the cli.
print_error('cronerrorclionly', 'admin');
exit;
}
// This script is being called via the web, so check the password if there is one.
if (!empty($CFG->cronremotepassword)) {
$pass = optional_param('password', '', PARAM_RAW);
if($pass != $CFG->cronremotepassword) {
// wrong password.
print_error('cronerrorpassword', 'admin');
exit;
}
}
}
/// emulate normal session
$SESSION = new object();
$USER = get_admin(); /// Temporarily, to provide environment for this script
/// ignore admins timezone, language and locale - use site deafult instead!
$USER->timezone = $CFG->timezone;
$USER->lang = '';
$USER->theme = '';
course_setup(SITEID);
/// send mime type and encoding
if (check_browser_version('MSIE')) {
//ugly IE hack to work around downloading instead of viewing
@header('Content-Type: text/html; charset=utf-8');
echo "<xmp>"; //<pre> is not good enough for us here
} else {
//send proper plaintext header
@header('Content-Type: text/plain; charset=utf-8');
}
/// no more headers and buffers
while(@ob_end_flush());
/// increase memory limit (PHP 5.2 does different calculation, we need more memory now)
@raise_memory_limit('128M');
/// Start output log
$timenow = time();
mtrace("Server Time: ".date('r',$timenow)."\n\n");
/// Run all cron jobs for each module
mtrace("Starting activity modules");
get_mailer('buffer');
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1 ")) {
foreach ($mods as $mod) {
$libfile = "$CFG->dirroot/mod/$mod->name/lib.php";
if (file_exists($libfile)) {
include_once($libfile);
$cron_function = $mod->name."_cron";
if (function_exists($cron_function)) {
mtrace("Processing module function $cron_function ...", '');
$pre_dbqueries = null;
if (!empty($PERF->dbqueries)) {
$pre_dbqueries = $PERF->dbqueries;
$pre_time = microtime(1);
}
if ($cron_function()) {
if (! set_field("modules", "lastcron", $timenow, "id", $mod->id)) {
mtrace("Error: could not update timestamp for $mod->fullname");
}
}
if (isset($pre_dbqueries)) {
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
mtrace("... used " . (microtime(1) - $pre_time) . " seconds");
}
/// Reset possible changes by modules to time_limit. MDL-11597
@set_time_limit(0);
mtrace("done.");
}
}
}
}
get_mailer('close');
mtrace("Finished activity modules");
mtrace("Starting blocks");
if ($blocks = get_records_select("block", "cron > 0 AND (($timenow - lastcron) > cron) AND visible = 1")) {
// we will need the base class.
require_once($CFG->dirroot.'/blocks/moodleblock.class.php');
foreach ($blocks as $block) {
$blockfile = $CFG->dirroot.'/blocks/'.$block->name.'/block_'.$block->name.'.php';
if (file_exists($blockfile)) {
require_once($blockfile);
$classname = 'block_'.$block->name;
$blockobj = new $classname;
if (method_exists($blockobj,'cron')) {
mtrace("Processing cron function for ".$block->name.'....','');
if ($blockobj->cron()) {
if (!set_field('block','lastcron',$timenow,'id',$block->id)) {
mtrace('Error: could not update timestamp for '.$block->name);
}
}
/// Reset possible changes by blocks to time_limit. MDL-11597
@set_time_limit(0);
mtrace('done.');
}
}
}
}
mtrace('Finished blocks');
mtrace('Starting admin reports');
// Admin reports do not have a database table that lists them. Instead a
// report includes cron.php with function report_reportname_cron() if it wishes
// to be cronned. It is up to cron.php to handle e.g. if it only needs to
// actually do anything occasionally.
$reports = get_list_of_plugins($CFG->admin.'/report');
foreach($reports as $report) {
$cronfile = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$report.'/cron.php';
if (file_exists($cronfile)) {
require_once($cronfile);
$cronfunction = 'report_'.$report.'_cron';
mtrace('Processing cron function for '.$report.'...', '');
$pre_dbqueries = null;
if (!empty($PERF->dbqueries)) {
$pre_dbqueries = $PERF->dbqueries;
$pre_time = microtime(true);
}
$cronfunction();
if (isset($pre_dbqueries)) {
mtrace("... used " . ($PERF->dbqueries - $pre_dbqueries) . " dbqueries");
mtrace("... used " . round(microtime(true) - $pre_time, 2) . " seconds");
}
mtrace('done.');
}
}
mtrace('Finished admin reports');
if (!empty($CFG->langcache)) {
mtrace('Updating languages cache');
get_list_of_languages(true);
}
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
$timenow = time();
$somefound = false;
// The preferred way saves memory, dmllib.php
// find courses where limited enrolment is enabled
global $CFG;
$rs_enrol = get_recordset_sql("SELECT ra.roleid, ra.userid, ra.contextid
FROM {$CFG->prefix}course c
INNER JOIN {$CFG->prefix}context cx ON cx.instanceid = c.id
INNER JOIN {$CFG->prefix}role_assignments ra ON ra.contextid = cx.id
WHERE cx.contextlevel = '".CONTEXT_COURSE."'
AND ra.timeend > 0
AND ra.timeend < '$timenow'
AND c.enrolperiod > 0
");
while ($oldenrolment = rs_fetch_next_record($rs_enrol)) {
role_unassign($oldenrolment->roleid, $oldenrolment->userid, 0, $oldenrolment->contextid);
$somefound = true;
}
rs_close($rs_enrol);
if($somefound) {
mtrace('Done');
} else {
mtrace('none found');
}
mtrace('Starting main gradebook job ...');
grade_cron();
mtrace('done.');
/// Run all core cron jobs, but not every time since they aren't too important.
/// These don't have a timer to reduce load, so we'll use a random number
/// to randomly choose the percentage of times we should run these jobs.
srand ((double) microtime() * 10000000);
$random100 = rand(0,100);
if ($random100 < 20) { // Approximately 20% of the time.
mtrace("Running clean-up tasks...");
/// Unenrol users who haven't logged in for $CFG->longtimenosee
if ($CFG->longtimenosee) { // value in days
$cuttime = $timenow - ($CFG->longtimenosee * 3600 * 24);
$rs = get_recordset_sql ("SELECT id, userid, courseid
FROM {$CFG->prefix}user_lastaccess
WHERE courseid != ".SITEID."
AND timeaccess < $cuttime ");
while ($assign = rs_fetch_next_record($rs)) {
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
if (role_unassign(0, $assign->userid, 0, $context->id)) {
mtrace("Deleted assignment for user $assign->userid from course $assign->courseid");
}
}
}
rs_close($rs);
/// Execute the same query again, looking for remaining records and deleting them
/// if the user hasn't moodle/course:view in the CONTEXT_COURSE context (orphan records)
$rs = get_recordset_sql ("SELECT id, userid, courseid
FROM {$CFG->prefix}user_lastaccess
WHERE courseid != ".SITEID."
AND timeaccess < $cuttime ");
while ($assign = rs_fetch_next_record($rs)) {
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
if (!has_capability('moodle/course:view', $context, $assign->userid)) {
delete_records('user_lastaccess', 'userid', $assign->userid, 'courseid', $assign->courseid);
mtrace("Deleted orphan user_lastaccess for user $assign->userid from course $assign->courseid");
}
}
}
rs_close($rs);
}
flush();
/// Delete users who haven't confirmed within required period
if (!empty($CFG->deleteunconfirmed)) {
$cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
$rs = get_recordset_sql ("SELECT id, firstname, lastname
FROM {$CFG->prefix}user
WHERE confirmed = 0
AND firstaccess > 0
AND firstaccess < $cuttime");
while ($user = rs_fetch_next_record($rs)) {
if (delete_records('user', 'id', $user->id)) {
mtrace("Deleted unconfirmed user for ".fullname($user, true)." ($user->id)");
}
}
rs_close($rs);
}
flush();
/// Delete users who haven't completed profile within required period
if (!empty($CFG->deleteunconfirmed)) {
$cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
$rs = get_recordset_sql ("SELECT id, username
FROM {$CFG->prefix}user
WHERE confirmed = 1
AND lastaccess > 0
AND lastaccess < $cuttime
AND deleted = 0
AND (lastname = '' OR firstname = '' OR email = '')");
while ($user = rs_fetch_next_record($rs)) {
if (delete_records('user', 'id', $user->id)) {
mtrace("Deleted not fully setup user $user->username ($user->id)");
}
}
rs_close($rs);
}
flush();
/// Delete old logs to save space (this might need a timer to slow it down...)
if (!empty($CFG->loglifetime)) { // value in days
$loglifetime = $timenow - ($CFG->loglifetime * 3600 * 24);
if (delete_records_select("log", "time < '$loglifetime'")) {
mtrace("Deleted old log records");
}
}
flush();
/// Delete old cached texts
if (!empty($CFG->cachetext)) { // Defined in config.php
$cachelifetime = time() - $CFG->cachetext - 60; // Add an extra minute to allow for really heavy sites
if (delete_records_select('cache_text', "timemodified < '$cachelifetime'")) {
mtrace("Deleted old cache_text records");
}
}
flush();
if (!empty($CFG->notifyloginfailures)) {
notify_login_failures();
mtrace('Notified login failured');
}
flush();
sync_metacourses();
mtrace('Synchronised metacourses');
//
// generate new password emails for users
//
mtrace('checking for create_password');
if (count_records('user_preferences', 'name', 'create_password', 'value', '1')) {
mtrace('creating passwords for new users');
$newusers = get_records_sql("SELECT u.id as id, u.email, u.firstname,
u.lastname, u.username,
p.id as prefid
FROM {$CFG->prefix}user u
JOIN {$CFG->prefix}user_preferences p ON u.id=p.userid
WHERE p.name='create_password' AND p.value=1 AND u.email !='' ");
foreach ($newusers as $newuserid => $newuser) {
$newuser->emailstop = 0; // send email regardless
// email user
if (setnew_password_and_mail($newuser)) {
// remove user pref
delete_records('user_preferences', 'id', $newuser->prefid);
} else {
trigger_error("Could not create and mail new user password!");
}
}
}
if(!empty($CFG->usetags)){
require_once($CFG->dirroot.'/tag/lib.php');
tag_cron();
mtrace ('Executed tag cron');
}
// Accesslib stuff
cleanup_contexts();
mtrace ('Cleaned up contexts');
gc_cache_flags();
mtrace ('Cleaned cache flags');
// If you suspect that the context paths are somehow corrupt
// replace the line below with: build_context_path(true);
build_context_path();
mtrace ('Built context paths');
mtrace("Finished clean-up tasks...");
} // End of occasional clean-up tasks
if (empty($CFG->disablescheduledbackups)) { // Defined in config.php
//Execute backup's cron
//Perhaps a long time and memory could help in large sites
@set_time_limit(0);
@raise_memory_limit("192M");
if (function_exists('apache_child_terminate')) {
// if we are running from Apache, give httpd a hint that
// it can recycle the process after it's done. Apache's
// memory management is truly awful but we can help it.
@apache_child_terminate();
}
if (file_exists("$CFG->dirroot/backup/backup_scheduled.php") and
file_exists("$CFG->dirroot/backup/backuplib.php") and
file_exists("$CFG->dirroot/backup/lib.php") and
file_exists("$CFG->libdir/blocklib.php")) {
include_once("$CFG->dirroot/backup/backup_scheduled.php");
include_once("$CFG->dirroot/backup/backuplib.php");
include_once("$CFG->dirroot/backup/lib.php");
require_once ("$CFG->libdir/blocklib.php");
mtrace("Running backups if required...");
if (! schedule_backup_cron()) {
mtrace("ERROR: Something went wrong while performing backup tasks!!!");
} else {
mtrace("Backup tasks finished.");
}
}
}
if (!empty($CFG->enablerssfeeds)) { //Defined in admin/variables page
include_once("$CFG->libdir/rsslib.php");
mtrace("Running rssfeeds if required...");
if ( ! cron_rss_feeds()) {
mtrace("Something went wrong while generating rssfeeds!!!");
} else {
mtrace("Rssfeeds finished");
}
}
/// Run the enrolment cron, if any
if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
$plugins = array($CFG->enrol);
}
require_once($CFG->dirroot .'/enrol/enrol.class.php');
foreach ($plugins as $p) {
$enrol = enrolment_factory::factory($p);
if (method_exists($enrol, 'cron')) {
$enrol->cron();
}
if (!empty($enrol->log)) {
mtrace($enrol->log);
}
unset($enrol);
}
/// Run the auth cron, if any
$auths = get_enabled_auth_plugins();
mtrace("Running auth crons if required...");
foreach ($auths as $auth) {
$authplugin = get_auth_plugin($auth);
if (method_exists($authplugin, 'cron')) {
mtrace("Running cron for auth/$auth...");
$authplugin->cron();
if (!empty($authplugin->log)) {
mtrace($authplugin->log);
}
}
unset($authplugin);
}
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
require_once($CFG->dirroot.'/lib/statslib.php');
// check we're not before our runtime
$timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour*60*60 + $CFG->statsruntimestartminute*60;
if (time() > $timetocheck) {
// process max 31 days per cron execution
if (stats_cron_daily(31)) {
if (stats_cron_weekly()) {
if (stats_cron_monthly()) {
stats_clean_old();
}
}
}
@set_time_limit(0);
} else {
mtrace('Next stats run after:'. userdate($timetocheck));
}
}
// run gradebook import/export/report cron
if ($gradeimports = get_list_of_plugins('grade/import')) {
foreach ($gradeimports as $gradeimport) {
if (file_exists($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php')) {
require_once($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php');
$cron_function = 'grade_import_'.$gradeimport.'_cron';
if (function_exists($cron_function)) {
mtrace("Processing gradebook import function $cron_function ...", '');
$cron_function;
}
}
}
}
if ($gradeexports = get_list_of_plugins('grade/export')) {
foreach ($gradeexports as $gradeexport) {
if (file_exists($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php')) {
require_once($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php');
$cron_function = 'grade_export_'.$gradeexport.'_cron';
if (function_exists($cron_function)) {
mtrace("Processing gradebook export function $cron_function ...", '');
$cron_function;
}
}
}
}
if ($gradereports = get_list_of_plugins('grade/report')) {
foreach ($gradereports as $gradereport) {
if (file_exists($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php')) {
require_once($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php');
$cron_function = 'grade_report_'.$gradereport.'_cron';
if (function_exists($cron_function)) {
mtrace("Processing gradebook report function $cron_function ...", '');
$cron_function;
}
}
}
}
// run any customized cronjobs, if any
// looking for functions in lib/local/cron.php
if (file_exists($CFG->dirroot.'/local/cron.php')) {
mtrace('Processing customized cron script ...', '');
include_once($CFG->dirroot.'/local/cron.php');
mtrace('done.');
}
//Unset session variables and destroy it
@session_unset();
@session_destroy();
mtrace("Cron script completed correctly");
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
/// finish the IE hack
if (check_browser_version('MSIE')) {
echo "</xmp>";
}
?>
+26 -15
View File
@@ -1,13 +1,10 @@
<?PHP
// dbperformance.php - shows latest ADOdb stats for the current server
<?PHP // $Id$
// dbperformance.php - shows latest ADOdb stats for the current server
// disable moodle specific debug messages and any errors in output
define('NO_DEBUG_DISPLAY', true);
require_once('../config.php');
error('TODO: rewrite db perf code'); // TODO: rewrite
require_once('../config.php');
// disable moodle specific debug messages that would be breaking the frames
disable_debugging();
$topframe = optional_param('topframe', 0, PARAM_BOOL);
$bottomframe = optional_param('bottomframe', 0, PARAM_BOOL);
@@ -15,18 +12,32 @@ error('TODO: rewrite db perf code'); // TODO: rewrite
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
$strdatabaseperformance = get_string("databaseperformance");
$stradministration = get_string("administration");
$site = get_site();
$navigation = build_navigation(array(
array('name'=>$stradministration, 'link'=>'index.php', 'type'=>'misc'),
array('name'=>$strdatabaseperformance, 'link'=>null, 'type'=>'misc')));
if (!empty($topframe)) {
$PAGE->set_url('/admin/dbperformance.php');
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
$PAGE->navbar->add($strdatabaseperformance);
$PAGE->set_title("$site->shortname: $strdatabaseperformance");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
print_header("$site->shortname: $strdatabaseperformance", "$site->fullname", $navigation);
exit;
}
if (!empty($bottomframe) or !empty($do)) {
$perf =&NewPerfMonitor($db);
$perf->UI($pollsecs=5);
exit;
}
?>
<head>
<title><?php echo "$site->shortname: $strdatabaseperformance" ?></title>
</head>
<frameset rows="80,*">
<frame src="dbperformance.php?topframe=true">
<frame src="dbperformance.php?bottomframe=true">
</frameset>
-19
View File
@@ -1,19 +0,0 @@
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once $CFG->libdir.'/formslib.php';
class database_export_form extends moodleform {
function definition() {
$mform = $this->_form;
$mform->addElement('header', 'database', get_string('dbexport', 'dbtransfer'));
$mform->addElement('textarea', 'description', get_string('description'), array('rows'=>5, 'cols'=>60));
$this->add_action_buttons(false, get_string('exportdata', 'dbtransfer'));
}
}
@@ -1,48 +0,0 @@
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once $CFG->libdir.'/formslib.php';
class database_transfer_form extends moodleform {
function definition() {
$mform = $this->_form;
$mform->addElement('header', 'database', get_string('dbtransfer', 'dbtransfer'));
$supported = array (
'mysqli/native',
'pgsql/native',
'mssql/native',
'oci/native',
'sqlite3/pdo',
);
$drivers = array();
foreach($supported as $driver) {
list($dbtype, $dblibrary) = explode('/', $driver);
$targetdb = moodle_database::get_driver_instance($dbtype, $dblibrary);
if ($targetdb->driver_installed() !== true) {
continue;
}
$drivers[$driver] = $driver;
}
$mform->addElement('select', 'driver', get_string('dbtype', 'install'), $drivers);
$mform->addElement('text', 'dbhost', get_string('dbhost', 'install'));
$mform->addElement('text', 'dbname', get_string('database', 'install'));
$mform->addElement('text', 'dbuser', get_string('user'));
$mform->addElement('text', 'dbpass', get_string('password'));
$mform->addElement('text', 'prefix', get_string('dbprefix', 'install'));
$mform->addRule('dbhost', get_string('required'), 'required', null);
$mform->addRule('dbname', get_string('required'), 'required', null);
$mform->addRule('dbuser', get_string('required'), 'required', null);
$mform->addRule('dbpass', get_string('required'), 'required', null);
$mform->addRule('prefix', get_string('required'), 'required', null);
$this->add_action_buttons(false, get_string('transferdata', 'dbtransfer'));
}
}
-21
View File
@@ -1,21 +0,0 @@
<?php
require('../../config.php');
require_once('lib.php');
require_once('database_export_form.php');
require_login();
admin_externalpage_setup('dbexport');
//create form
$form = new database_export_form();
if ($data = $form->get_data()) {
dbtransfer_export_xml_database($data->description, $DB);
die;
}
echo $OUTPUT->header();
// TODO: add some more info here
$form->display();
echo $OUTPUT->footer();
-47
View File
@@ -1,47 +0,0 @@
<?php
require('../../config.php');
require_once('lib.php');
require_once('database_transfer_form.php');
require_login();
admin_externalpage_setup('dbtransfer');
// Create the form
$form = new database_transfer_form();
// If we have valid input.
if ($data = $form->get_data()) {
// Connect to the other database.
list($dbtype, $dblibrary) = explode('/', $data->driver);
$targetdb = moodle_database::get_driver_instance($dbtype, $dblibrary);
if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, null)) {
throw new dbtransfer_exception('notargetconectexception', null, "$CFG->wwwroot/$CFG->admin/dbtransfer/");
}
if ($targetdb->get_tables()) {
throw new dbtransfer_exception('targetdatabasenotempty', null, "$CFG->wwwroot/$CFG->admin/dbtransfer/");
}
// Start output.
echo $OUTPUT->header();
$data->dbtype = $dbtype;
echo $OUTPUT->heading(get_string('transferringdbto', 'dbtransfer', $data));
// Do the transfer.
$feedback = new html_list_progress_trace();
dbtransfer_transfer_database($DB, $targetdb, $feedback);
$feedback->finished();
// Finish up.
echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/");
echo $OUTPUT->footer();
die;
}
// Otherwise display the settings form.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('transferdbtoserver', 'dbtransfer'));
echo '<p>', get_string('transferdbintro', 'dbtransfer'), "</p>\n\n";
$form->display();
echo $OUTPUT->footer();
-52
View File
@@ -1,52 +0,0 @@
<?php
/*
TODO:
- exporting to server file >2GB fails in 32bit operating systems - needs warning
- we may run out of disk space exporting to srever file - we must verify the file is not truncated; read from the end of file?
- when sending file >4GB - FAT32 limit, Apache limit, browser limit - needs warning
- there must be some form of progress bar during export, transfer - new tracking class could be passed around
- command line operation - could work around some 2G/4G limits in PHP; useful for cron full backups
- by default allow exporting into empty database only (no tables with the same prefix yet)
- all dangerous operation (like deleting of all data) should be confirmed by key found in special file in dataroot
(user would need file access to dataroot which might prevent various "accidents")
- implement "Export/import running" notification in lib/setup.php (similar to new upgrade flag in config table)
- gzip compression when storing xml file - the xml is very verbose and full of repeated tags (zip is not suitable here at all)
this could help us keep the files bellow 2G (expected ratio is > 10:1)
*/
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/dtllib.php');
function dbtransfer_export_xml_database($description, $mdb) {
@set_time_limit(0);
session_get_instance()->write_close(); // release session
header('Content-Type: application/xhtml+xml');
header('Content-Disposition: attachment; filename=database.xml');
header('Expires: 0');
header('Cache-Control: must-revalidate,post-check=0,pre-check=0');
header('Pragma: public');
while(@ob_flush());
$var = new file_xml_database_exporter('php://output', $mdb);
$var->export_database($description);
// no more output
die;
}
function dbtransfer_transfer_database($sourcedb, $targetdb, $feedback = null) {
@set_time_limit(0);
session_get_instance()->write_close(); // release session
$var = new database_mover($sourcedb, $targetdb, true, $feedback);
$var->export_database(null);
}
+14 -19
View File
@@ -1,4 +1,4 @@
<?php
<?PHP //$Id$
// Deletes the moodledata directory, COMPLETELY!!
// BE VERY CAREFUL USING THIS!
@@ -13,36 +13,31 @@
$sure = optional_param('sure', 0, PARAM_BOOL);
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
$deletedir = $CFG->dataroot; // The directory to delete!
echo $OUTPUT->header();
echo $OUTPUT->heading('Purge moodledata');
admin_externalpage_print_header();
print_heading('Purge moodledata');
if (empty($sure)) {
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'));
$formcancel = new single_button('index.php', get_string('no'), 'get');
echo $OUTPUT->confirm('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', $formcontinue, $formcancel);
echo $OUTPUT->footer();
notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?',
'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
exit;
}
if (!data_submitted() or empty($reallysure)) {
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'));
$formcancel = new single_button('index.php', get_string('no'), 'get');
echo $OUTPUT->confirm('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) ?',
$formcontinue, $formcancel);
echo $OUTPUT->footer();
notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?',
'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
exit;
}
if (!confirm_sesskey()) {
print_error('wrongcall', 'error');
error('This script was called wrongly');
}
/// OK, here goes ...
@@ -50,8 +45,8 @@
delete_subdirectories($deletedir);
echo '<h1 align="center">Done!</h1>';
echo $OUTPUT->continue_button($CFG->wwwroot);
echo $OUTPUT->footer();
print_continue($CFG->wwwroot);
admin_externalpage_print_footer();
exit;
@@ -83,4 +78,4 @@ function delete_subdirectories($rootdir) {
closedir($dir);
}
?>
-94
View File
@@ -1,94 +0,0 @@
<?php
/**
* Allows admin to configure editors.
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageeditors";
$action = optional_param('action', '', PARAM_ACTION);
$editor = optional_param('editor', '', PARAM_SAFEDIR);
// get currently installed and enabled auth plugins
$available_editors = editors_get_available();
if (!empty($editor) and empty($available_editors[$editor])) {
redirect ($returnurl);
}
$active_editors = explode(',', $CFG->texteditors);
foreach ($active_editors as $key=>$active) {
if (empty($available_editors[$active])) {
unset($active_editors[$key]);
}
}
////////////////////////////////////////////////////////////////////////////////
// process actions
if (!confirm_sesskey()) {
redirect($returnurl);
}
$return = true;
switch ($action) {
case 'disable':
// remove from enabled list
$key = array_search($editor, $active_editors);
unset($active_editors[$key]);
break;
case 'enable':
// add to enabled list
if (!in_array($editor, $active_editors)) {
$active_editors[] = $editor;
$active_editors = array_unique($active_editors);
}
break;
case 'down':
$key = array_search($editor, $active_editors);
// check auth plugin is valid
if ($key !== false) {
// move down the list
if ($key < (count($active_editors) - 1)) {
$fsave = $active_editors[$key];
$active_editors[$key] = $active_editors[$key + 1];
$active_editors[$key + 1] = $fsave;
}
}
break;
case 'up':
$key = array_search($editor, $active_editors);
// check auth is valid
if ($key !== false) {
// move up the list
if ($key >= 1) {
$fsave = $active_editors[$key];
$active_editors[$key] = $active_editors[$key - 1];
$active_editors[$key - 1] = $fsave;
}
}
break;
default:
break;
}
// at least one editor must be active
if (empty($active_editors)) {
$active_editors = array('textarea');
}
set_config('texteditors', implode(',', $active_editors));
if ($return) {
redirect ($returnurl);
}
+86 -100
View File
@@ -1,120 +1,106 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
<?PHP // $Id$
// enrol.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
/**
* Enrol config manipulation script.
*
* @package core
* @subpackage enrol
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
$CFG->pagepath = 'enrol';
$action = required_param('action', PARAM_ACTION);
$enrol = required_param('enrol', PARAM_SAFEDIR);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
admin_externalpage_setup('enrolment');
$PAGE->set_url('/admin/enrol.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_sesskey();
$enabled = enrol_get_plugins(true);
$all = enrol_get_plugins(false);
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$return = new moodle_url('/admin/settings.php', array('section'=>'manageenrols'));
/// Save settings
switch ($action) {
case 'disable':
unset($enabled[$enrol]);
set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
break;
case 'enable':
if (!isset($all[$enrol])) {
break;
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
$enabled = array_keys($enabled);
$enabled[] = $enrol;
set_config('enrol_plugins_enabled', implode(',', $enabled));
break;
case 'up':
if (!isset($enabled[$enrol])) {
break;
if (empty($frm->enable)) {
$frm->enable = array();
}
$enabled = array_keys($enabled);
$enabled = array_flip($enabled);
$current = $enabled[$enrol];
if ($current == 0) {
break; //already at the top
if (empty($frm->default)) {
$frm->default = '';
}
$enabled = array_flip($enabled);
$enabled[$current] = $enabled[$current - 1];
$enabled[$current - 1] = $enrol;
set_config('enrol_plugins_enabled', implode(',', $enabled));
break;
case 'down':
if (!isset($enabled[$enrol])) {
break;
if ($frm->default && $frm->default != 'manual' && !in_array($frm->default, $frm->enable)) {
$frm->enable[] = $frm->default;
}
$enabled = array_keys($enabled);
$enabled = array_flip($enabled);
$current = $enabled[$enrol];
if ($current == count($enabled) - 1) {
break; //already at the end
asort($frm->enable);
$frm->enable = array_merge(array('manual'), $frm->enable); // make sure manual plugin is called first
set_config('enrol_plugins_enabled', implode(',', $frm->enable));
set_config('enrol', $frm->default);
redirect("enrol.php", get_string("changessaved"), 1);
}
/// Print the form
$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));
admin_externalpage_print_header();
$modules = get_list_of_plugins("enrol");
$options = array();
foreach ($modules as $module) {
$options[$module] = get_string("enrolname", "enrol_$module");
}
asort($options);
print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
echo "<div>";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
$table = new stdClass();
$table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings);
$table->align = array('left', 'center', 'center', 'center');
$table->size = array('60%', '', '', '15%');
$table->width = '700';
$table->data = array();
$modules = get_list_of_plugins("enrol");
$enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
foreach ($modules as $module) {
// skip if directory is empty
if (!file_exists("$CFG->dirroot/enrol/$module/enrol.php")) {
continue;
}
$enabled = array_flip($enabled);
$enabled[$current] = $enabled[$current + 1];
$enabled[$current + 1] = $enrol;
set_config('enrol_plugins_enabled', implode(',', $enabled));
break;
case 'uninstall':
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolments', 'enrol'));
if (get_string_manager()->string_exists('pluginname', 'enrol_'.$enrol)) {
$strplugin = get_string('pluginname', 'enrol_'.$enrol);
$name = get_string("enrolname", "enrol_$module");
$plugin = enrolment_factory::factory($module);
$enable = '<input type="checkbox" name="enable[]" value="'.$module.'"';
if (in_array($module, $enabledplugins)) {
$enable .= ' checked="checked"';
}
if ($module == 'manual') {
$enable .= ' disabled="disabled"';
}
$enable .= ' />';
if (method_exists($plugin, 'print_entry')) {
$default = '<input type="radio" name="default" value="'.$module.'"';
if ($CFG->enrol == $module) {
$default .= ' checked="checked"';
}
$default .= ' />';
} else {
$strplugin = $enrol;
$default = '';
}
$table->data[$name] = array($name, $enable, $default,
'<a href="enrol_config.php?enrol='.$module.'">'.$str->edit.'</a>');
}
asort($table->data);
if (!$confirm) {
$uurl = new moodle_url('/admin/enrol.php', array('action'=>'uninstall', 'enrol'=>$enrol, 'sesskey'=>sesskey(), 'confirm'=>1));
echo $OUTPUT->confirm(get_string('uninstallconfirm', 'enrol', $strplugin), $uurl, $return);
echo $OUTPUT->footer();
exit;
print_table($table);
} else { // Delete everything!!
uninstall_plugin('enrol', $enrol);
echo "<div style=\"text-align:center\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></div>\n";
echo "</div>";
echo "</form>";
$a->plugin = $strplugin;
$a->directory = "$CFG->dirroot/enrol/$enrol";
echo $OUTPUT->notification(get_string('uninstalldeletefiles', 'enrol', $a), 'notifysuccess');
echo $OUTPUT->continue_button($return);
echo $OUTPUT->footer();
exit;
}
}
admin_externalpage_print_footer();
redirect($return);
?>
+71
View File
@@ -0,0 +1,71 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once("../config.php");
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('enrolment');
$enrol = required_param('enrol', PARAM_ALPHA);
$CFG->pagepath = 'enrol/' . $enrol;
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory($enrol);
/// If data submitted, then process and store.
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if ($enrolment->process_config($frm)) {
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
}
} else {
$frm = $CFG;
}
/// Otherwise fill and print the form.
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
unset($options);
$modules = get_list_of_plugins("enrol");
foreach ($modules as $module) {
$options[$module] = get_string("enrolname", "enrol_$module");
}
asort($options);
admin_externalpage_print_header();
echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
echo "<div>";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";
/// Print current enrolment type description
print_simple_box_start("center", "80%");
print_heading($options[$enrol]);
print_simple_box_start("center", "60%", '', 5, 'informationbox');
print_string("description", "enrol_$enrol");
print_simple_box_end();
echo "<hr />";
$enrolment->config_form($frm);
echo "<p class=\"centerpara\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p>\n";
print_simple_box_end();
echo "</div>";
echo "</form>";
admin_externalpage_print_footer();
exit;
?>
+18 -19
View File
@@ -1,4 +1,4 @@
<?php
<?php //$Id$
///////////////////////////////////////////////////////////////////////////
// //
@@ -52,18 +52,18 @@
$strmisc = get_string('miscellaneous');
/// Print the header stuff
echo $OUTPUT->header();
admin_externalpage_print_header();
/// Print the component download link
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&amp;sesskey='.sesskey().'">'.$strupdate.'</a></div>';
echo '<div class="reportlink"><a href="environment.php?action=updatecomponent&amp;sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
echo $OUTPUT->heading($strenvironment);
print_heading($strenvironment);
/// Handle the 'updatecomponent' action
if ($action == 'updatecomponent' && confirm_sesskey()) {
/// Create component installer and execute it
if ($cd = new component_installer('http://download.moodle.org',
'environment',
if ($cd = new component_installer('http://download.moodle.org',
'environment',
'environment.zip')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
switch ($status) {
@@ -72,23 +72,23 @@
$a = new stdClass();
$a->url = 'http://download.moodle.org/environment/environment.zip';
$a->dest= $CFG->dataroot.'/';
echo $OUTPUT->box(get_string($cd->get_error(), 'error', $a), 'errorbox');
print_simple_box(get_string($cd->get_error(), 'error', $a), 'center', '', '', 5, 'errorbox');
} else {
echo $OUTPUT->box(get_string($cd->get_error(), 'error'), 'errorbox');
print_simple_box(get_string($cd->get_error(), 'error'), 'center', '', '', 5, 'errorbox');
}
break;
case COMPONENT_UPTODATE:
echo $OUTPUT->box(get_string($cd->get_error(), 'error'));
print_simple_box(get_string($cd->get_error(), 'error'), 'center');
break;
case COMPONENT_INSTALLED:
echo $OUTPUT->box(get_string('componentinstalled', 'admin'));
print_simple_box(get_string('componentinstalled', 'admin'), 'center');
break;
}
}
}
/// Start of main box
echo $OUTPUT->box_start();
print_simple_box_start('center');
echo "<div style=\"text-align:center\">".$stradminhelpenvironment."</div><br />";
@@ -106,7 +106,7 @@
if (empty($version)) {
$version = $env_version;
}
///Iterate over each version, adding bigger than current
///Iterate over each version, adding bigged than current
foreach ($env_versions as $env_version) {
if (version_compare(normalize_version($current_version), $env_version, '<')) {
$versions[$env_version] = $env_version;
@@ -120,18 +120,17 @@
}
/// Print form and popup menu
echo '<div style="text-align:center"> ';
$select = new single_select(new moodle_url('/admin/environment.php'), 'version', $versions, $version, null);
$select->label = $strmoodleversion;
echo $OUTPUT->render($select);
echo '<div style="text-align:center">'.$strmoodleversion.' ';
popup_form("$CFG->wwwroot/$CFG->admin/environment.php?version=",
$versions, 'selectversion', $version, '');
echo '</div>';
/// End of main box
echo $OUTPUT->box_end();
print_simple_box_end();
/// Gather and show results
$status = check_moodle_environment($version, $environment_results);
/// Print footer
echo $OUTPUT->footer();
admin_externalpage_print_footer();
?>
+23 -82
View File
@@ -80,6 +80,7 @@
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="7.4" />
<VENDOR name="mssql" version="9.0" />
@@ -121,11 +122,6 @@
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="optional">
<FEEDBACK>
<ON_CHECK message="ctyperecommended" />
</FEEDBACK>
</PHP_EXTENSION>
</PHP_EXTENSIONS>
</MOODLE>
<MOODLE version="1.9">
@@ -139,6 +135,7 @@
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="8.0" />
<VENDOR name="mssql" version="9.0" />
@@ -180,13 +177,6 @@
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="optional">
<FEEDBACK>
<ON_CHECK message="ctyperecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
</PHP_EXTENSIONS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
@@ -200,7 +190,7 @@
<ON_OK message="questioncwqpfsok" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="required">
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
<FEEDBACK>
<ON_CHECK message="globalswarning" />
</FEEDBACK>
@@ -214,24 +204,24 @@
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="5.0.25">
<VENDOR name="mysql" version="4.1.16">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="8.3" />
<VENDOR name="postgres" version="8.0" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="10.2" />
<VENDOR name="sqlite" version="2.0" />
<VENDOR name="oracle" version="9.0" />
</DATABASE>
<PHP version="5.2.8" level="required">
<PHP version="5.2.0" level="required">
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<PHP_EXTENSION name="iconv" level="optional">
<FEEDBACK>
<ON_CHECK message="iconvrequired" />
<ON_CHECK message="iconvrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
@@ -239,9 +229,9 @@
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<PHP_EXTENSION name="curl" level="optional">
<FEEDBACK>
<ON_CHECK message="curlrequired" />
<ON_CHECK message="curlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
@@ -259,68 +249,19 @@
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="optional">
<FEEDBACK>
<ON_CHECK message="gdrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_CHECK message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_CHECK message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="optional">
<FEEDBACK>
<ON_CHECK message="intlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="40M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="safe_mode" value="0" level="optional">
<FEEDBACK>
<ON_CHECK message="settingsafemode" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="question/upgrade.php" function="question_check_no_rqp_questions" level="optional">
<FEEDBACK>
<ON_CHECK message="qtyperqpwillberemovedanyway" />
<ON_OK message="qtyperqpwillberemoved" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_register_globals" level="optional">
<FEEDBACK>
<ON_CHECK message="globalswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+90
View File
@@ -0,0 +1,90 @@
<?php // $Id$
// filter.php
// Edit text filter settings
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
$filterfull = required_param('filter', PARAM_PATH);
$forcereset = optional_param('reset', 0, PARAM_BOOL);
$filtername = substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
// get translated strings for use on page
$txt = new Object;
$txt->managefilters = get_string( 'managefilters' );
$txt->administration = get_string( 'administration' );
$txt->configuration = get_string( 'configuration' );
//======================
// Process Actions
//======================
// if reset pressed let filter config page handle it
if ($config = data_submitted() and !$forcereset) {
// check session key
if (!confirm_sesskey()) {
error( get_string('confirmsesskeybad', 'error' ) );
}
$configpath = $CFG->dirroot.'/filter/'.$filtername.'/filterconfig.php';
if (file_exists($configpath)) {
require_once($configpath);
$functionname = $filtername.'_process_config';
if (function_exists($functionname)) {
$functionname($config);
$saved = true;
}
}
if (empty($saved)) {
// run through submitted data
// reject if does not start with filter_
foreach ($config as $name => $value) {
set_config($name, stripslashes($value));
}
}
reset_text_filters_cache();
redirect($returnurl);
exit;
}
//==============================
// Display logic
//==============================
$filtername = ucfirst($filtername);
admin_externalpage_print_header();
print_heading( $filtername );
print_simple_box(get_string("configwarning", "admin"), "center", "50%");
echo "<br />";
print_simple_box_start("center",'');
?>
<form action="filter.php?filter=<?php echo urlencode($filterfull); ?>" method="post">
<div style="text-align: center">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
</div>
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
+75 -258
View File
@@ -1,285 +1,102 @@
<?php
<?php // $Id$
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once('../config.php');
/**
* Processes actions from the admin_setting_managefilters object (defined in
* adminlib.php).
*
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package administration
*//** */
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/adminlib.php');
$action = optional_param('action', '', PARAM_ACTION);
$action = optional_param('action', '', PARAM_ACTION);
$filterpath = optional_param('filterpath', '', PARAM_PATH);
require_login();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $systemcontext);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "$CFG->wwwroot/$CFG->admin/filters.php";
admin_externalpage_setup('managefilters');
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
$filters = filter_get_global_states();
// In case any new filters have been installed, but not put in the table yet.
$fitlernames = filter_get_all_installed();
$newfilters = $fitlernames;
foreach ($filters as $filter => $notused) {
unset($newfilters[$filter]);
if (!confirm_sesskey()) {
redirect($returnurl);
}
/// Process actions ============================================================
if ($action) {
if (!isset($filters[$filterpath]) && !isset($newfilters[$filterpath])) {
throw new moodle_exception('filternotinstalled', 'error', $returnurl, $filterpath);
}
if (!confirm_sesskey()) {
redirect($returnurl);
// get a list of installed filters
$installedfilters = array();
$filterlocations = array('mod','filter');
foreach ($filterlocations as $filterlocation) {
$plugins = get_list_of_plugins($filterlocation);
foreach ($plugins as $plugin) {
$pluginpath = "$CFG->dirroot/$filterlocation/$plugin/filter.php";
if (is_readable($pluginpath)) {
$installedfilters["$filterlocation/$plugin"] = "$filterlocation/$plugin";
}
}
}
// get all the currently selected filters
if (!empty($CFG->textfilters)) {
$activefilters = explode(',', $CFG->textfilters);
} else {
$activefilters = array();
}
//======================
// Process Actions
//======================
switch ($action) {
case 'setstate':
if ($newstate = optional_param('newstate', '', PARAM_INTEGER)) {
filter_set_global_state($filterpath, $newstate);
if ($newstate == TEXTFILTER_DISABLED) {
filter_set_applies_to_strings($filterpath, false);
}
unset($newfilters[$filterpath]);
case 'hide':
$key=array_search($filterpath, $activefilters);
// check filterpath is valid
if ($key===false) {
break;
}
// just delete it
unset($activefilters[$key]);
break;
case 'show':
// check filterpath is valid
if (!array_key_exists($filterpath, $installedfilters)) {
error("Filter $filterpath is not currently installed", $url);
} elseif (array_search($filterpath,$activefilters)) {
// filterpath is already active - doubleclick??
} else {
// add it to installed filters
$activefilters[] = $filterpath;
$activefilters = array_unique($activefilters);
}
break;
case 'setapplyto':
$applytostrings = optional_param('stringstoo', false, PARAM_BOOL);
filter_set_applies_to_strings($filterpath, $applytostrings);
break;
case 'down':
if (isset($filters[$filterpath])) {
$oldpos = $filters[$filterpath]->sortorder;
if ($oldpos <= count($filters)) {
filter_set_global_state($filterpath, $filters[$filterpath]->active, $oldpos + 1);
}
$key=array_search($filterpath, $activefilters);
// check filterpath is valid
if ($key===false) {
error("Filter $filterpath is not currently active", $url);
} elseif ($key>=(count($activefilters)-1)) {
// cannot be moved any further down - doubleclick??
} else {
// swap with $key+1
$fsave = $activefilters[$key];
$activefilters[$key] = $activefilters[$key+1];
$activefilters[$key+1] = $fsave;
}
break;
case 'up':
if (isset($filters[$filterpath])) {
$oldpos = $filters[$filterpath]->sortorder;
if ($oldpos >= 1) {
filter_set_global_state($filterpath, $filters[$filterpath]->active, $oldpos - 1);
}
$key=array_search($filterpath, $activefilters);
// check filterpath is valid
if ($key===false) {
error("Filter $filterpath is not currently active", $url);
} elseif ($key<1) {
//cannot be moved any further up - doubleclick??
} else {
// swap with $key-1
$fsave = $activefilters[$key];
$activefilters[$key] = $activefilters[$key-1];
$activefilters[$key-1] = $fsave;
}
break;
case 'delete':
if (!empty($filternames[$filterpath])) {
$filtername = $filternames[$filterpath];
} else {
$filtername = $filterpath;
}
if (substr($filterpath, 0, 4) == 'mod/') {
$mod = basename($filterpath);
$a = new stdClass;
$a->filter = $filtername;
$a->module = get_string('modulename', $mod);
print_error('cannotdeletemodfilter', 'admin', $returnurl, $a);
}
// If not yet confirmed, display a confirmation message.
if (!optional_param('confirm', '', PARAM_BOOL)) {
$title = get_string('deletefilterareyousure', 'admin', $filtername);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
$linkcontinue = new moodle_url($returnurl, array('action' => 'delete', 'filterpath' => $filterpath, 'confirm' => 1));
$formcancel = new single_button(new moodle_url($returnurl), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletefilterareyousuremessage', 'admin', $filtername), $linkcontinue, $formcancel);
echo $OUTPUT->footer();
exit;
}
// Do the deletion.
$title = get_string('deletingfilter', 'admin', $filtername);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
// Delete all data for this plugin.
filter_delete_all_for_filter($filterpath);
$a = new stdClass;
$a->filter = $filtername;
$a->directory = $filterpath;
echo $OUTPUT->box(get_string('deletefilterfiles', 'admin', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button($returnurl);
echo $OUTPUT->footer();
exit;
}
// Add any missing filters to the DB table.
foreach ($newfilters as $filter => $notused) {
filter_set_global_state($filter, TEXTFILTER_DISABLED);
}
// save, reset cache and return
set_config('textfilters', implode(',', $activefilters));
reset_text_filters_cache();
redirect($returnurl);
// Reset caches and return
if ($action) {
reset_text_filters_cache();
redirect($returnurl);
}
/// End of process actions =====================================================
/// Print the page heading.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('filtersettings', 'admin'));
$activechoices = array(
TEXTFILTER_DISABLED => get_string('disabled', 'filters'),
TEXTFILTER_OFF => get_string('offbutavailable', 'filters'),
TEXTFILTER_ON => get_string('on', 'filters'),
);
$applytochoices = array(
0 => get_string('content', 'filters'),
1 => get_string('contentandheadings', 'filters'),
);
$filters = filter_get_global_states();
// In case any new filters have been installed, but not put in the table yet.
$filternames = filter_get_all_installed();
$newfilters = $filternames;
foreach ($filters as $filter => $notused) {
unset($newfilters[$filter]);
}
$stringfilters = filter_get_string_filters();
$table = new html_table();
$table->head = array(get_string('filter'), get_string('isactive', 'filters'),
get_string('order'), get_string('applyto', 'filters'), get_string('settings'), get_string('delete'));
$table->align = array('left', 'left', 'center', 'left', 'left');
$table->width = '100%';
$table->data = array();
$lastactive = null;
foreach ($filters as $filter => $filterinfo) {
if ($filterinfo->active != TEXTFILTER_DISABLED) {
$lastactive = $filter;
}
}
// iterate through filters adding to display table
$firstrow = true;
foreach ($filters as $filter => $filterinfo) {
$applytostrings = isset($stringfilters[$filter]) && $filterinfo->active != TEXTFILTER_DISABLED;
$row = get_table_row($filterinfo, $firstrow, $filter == $lastactive, $applytostrings);
$table->data[] = $row;
if ($filterinfo->active == TEXTFILTER_DISABLED) {
$table->rowclasses[] = 'dimmed_text';
} else {
$table->rowclasses[] = '';
}
$firstrow = false;
}
foreach ($newfilters as $filter => $filtername) {
$filterinfo = new stdClass;
$filterinfo->filter = $filter;
$filterinfo->active = TEXTFILTER_DISABLED;
$row = get_table_row($filterinfo, false, false, false);
$table->data[] = $row;
$table->rowclasses[] = 'dimmed_text';
}
echo html_writer::table($table);
echo '<p class="filtersettingnote">' . get_string('filterallwarning', 'filters') . '</p>';
echo $OUTPUT->footer();
/// Display helper functions ===================================================
function filters_action_url($filterpath, $action) {
return new moodle_url('/admin/filters.php', array('sesskey'=>sesskey(), 'filterpath'=>$filterpath, 'action'=>$action));
}
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) {
global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames; //TODO: this is sloppy coding style!!
$row = array();
$filter = $filterinfo->filter;
// Filter name
if (!empty($filternames[$filter])) {
$row[] = $filternames[$filter];
} else {
$row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>';
}
// Disable/off/on
$select = new single_select(filters_action_url($filter, 'setstate'), 'newstate', $activechoices, $filterinfo->active, null, 'active' . basename($filter));
$row[] = $OUTPUT->render($select);
// Re-order
$updown = '';
$spacer = '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" /> ';
if ($filterinfo->active != TEXTFILTER_DISABLED) {
if (!$isfirstrow) {
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up')));
} else {
$updown .= $spacer;
}
if (!$islastactive) {
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'down'), new pix_icon('t/down', get_string('down')));
} else {
$updown .= $spacer;
}
}
$row[] = $updown;
// Apply to strings.
$select = new single_select(filters_action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, $applytostrings, null, 'applyto' . basename($filter));
$select->disabled = $filterinfo->active == TEXTFILTER_DISABLED;
$row[] = $OUTPUT->render($select);
// Settings link, if required
if (filter_has_global_settings($filter)) {
$row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' .
str_replace('/', '',$filter) . '">' . get_string('settings') . '</a>';
} else {
$row[] = '';
}
// Delete
if (substr($filter, 0, 4) != 'mod/') {
$row[] = '<a href="' . filters_action_url($filter, 'delete') . '">' . get_string('delete') . '</a>';
} else {
$row[] = '';
}
return $row;
}
?>
-1336
View File
File diff suppressed because it is too large Load Diff
+12 -41
View File
@@ -1,20 +1,19 @@
<?php
<?php // $Id$
/** 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
* 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.
*/
die('TODO: MDL-19380');
$fd = fopen('php://stdin','r');
if (!$fd) {
exit();
}
$FULLME='cron';
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->libdir.'/eventslib.php');
require_once($CFG->dirroot.'/lib/uploadlib.php'); // contains virus handling stuff.
$site = get_site();
@@ -30,7 +29,7 @@ while(!feof($fd)) {
$bits = explode('/',$file);
$a->filename = $bits[count($bits)-1];
if (!$log = $DB->get_record("log", array("module"=>"upload", "info"=>$file, "action"=>"upload"))) {
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);
@@ -38,9 +37,9 @@ while(!feof($fd)) {
}
$action = clam_handle_infected_file($file,$log->userid,true);
clam_replace_infected_file($file);
$user = $DB->get_record("user", array("id"=>$log->userid));
$course = $DB->get_record("course", array("id"=>$log->course));
$user = get_record("user","id",$log->userid);
$course = get_record("course","id",$log->course);
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
$a->date = userdate($log->time);
@@ -60,17 +59,7 @@ function notify_user($user,$subject,$a) {
return false;
}
$body = get_string('virusfoundlater','moodle',$a);
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = get_admin();
$eventdata->userto = $user;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
email_to_user($user,get_admin(),$subject,$body);
}
@@ -80,37 +69,19 @@ function notify_admins($user,$subject,$a) {
$body = get_string('virusfoundlateradmin','moodle',$a);
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
email_to_user($admin,$admin,$subject,$body);
}
}
function notify_admins_unknown($file,$a) {
global $site;
$admins = get_admins();
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
$body = get_string('virusfoundlateradminnolog','moodle',$a);
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
email_to_user($admin,$admin,$subject,$body);
}
}
@@ -143,4 +114,4 @@ function validate_line($line) {
return $file;
}
?>
+64 -292
View File
@@ -1,13 +1,15 @@
<?php
<?php // $Id$
ob_start(); //for whitespace test
require_once('../config.php');
// extra whitespace test - intentionally breaks cookieless mode
$extraws = '';
while (ob_get_level()) {
while (true) {
$extraws .= ob_get_contents();
ob_end_clean();
if (!@ob_end_clean()) {
break;
}
}
require_once($CFG->libdir.'/adminlib.php');
@@ -22,11 +24,11 @@
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
$site = get_site();
echo $OUTPUT->header();
admin_externalpage_print_header();
echo <<<STYLES
<style type="text/css">
@@ -98,13 +100,12 @@ STYLES;
}
echo $OUTPUT->footer();
admin_externalpage_print_footer();
function health_find_problems() {
global $OUTPUT;
echo $OUTPUT->heading(get_string('healthcenter'));
print_heading(get_string('healthcenter'));
$issues = array(
SEVERITY_CRITICAL => array(),
@@ -138,7 +139,7 @@ function health_find_problems() {
echo '</div>';
}
else {
echo $OUTPUT->heading(get_string('healthproblemsdetected'));
print_heading(get_string('healthproblemsdetected'));
$severities = array(SEVERITY_CRITICAL, SEVERITY_SIGNIFICANT, SEVERITY_ANNOYANCE, SEVERITY_NOTICE);
foreach($severities as $severity) {
if(!empty($issues[$severity])) {
@@ -157,7 +158,6 @@ function health_find_problems() {
}
function health_print_solution($classname) {
global $OUTPUT;
$problem = new $classname;
$data = array(
'title' => $problem->title(),
@@ -166,8 +166,8 @@ function health_print_solution($classname) {
'solution' => $problem->solution()
);
echo $OUTPUT->heading(get_string('healthcenter'));
echo $OUTPUT->heading(get_string('healthproblemsolution'));
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>';
@@ -196,6 +196,32 @@ class problem_base {
}
}
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 or other library function';
@@ -249,8 +275,8 @@ class problem_000004 extends problem_base {
return 'cron.php is not set up to run automatically';
}
function exists() {
global $DB;
$lastcron = $DB->get_field_sql('SELECT max(lastcron) FROM {modules}');
global $CFG;
$lastcron = get_field_sql('SELECT max(lastcron) FROM '.$CFG->prefix.'modules');
return (time() - $lastcron > 3600 * 24);
}
function severity() {
@@ -327,10 +353,8 @@ class problem_000008 extends problem_base {
return 'PHP: memory_limit cannot be controlled by Moodle';
}
function exists() {
global $CFG;
$oldmemlimit = @ini_get('memory_limit');
if (empty($oldmemlimit)) {
if(empty($oldmemlimit)) {
// PHP not compiled with memory limits, this means that it's
// probably limited to 8M or in case of Windows not at all.
// We can ignore it for now - there is not much to test anyway
@@ -338,9 +362,8 @@ class problem_000008 extends problem_base {
return false;
}
$oldmemlimit = get_real_size($oldmemlimit);
//now lets change the memory limit to something higher
$newmemlimit = ($oldmemlimit + 1024*1024*5);
raise_memory_limit($newmemlimit);
//now lets change the memory limit to something unique below 128M==134217728
@ini_set('memory_limit', 134217720);
$testmemlimit = get_real_size(@ini_get('memory_limit'));
//verify the change had any effect at all
if ($oldmemlimit == $testmemlimit) {
@@ -351,7 +374,7 @@ class problem_000008 extends problem_base {
return false;
}
}
reduce_memory_limit($oldmemlimit);
@ini_set('memory_limit', $oldmemlimit);
return false;
}
function severity() {
@@ -388,7 +411,7 @@ class problem_000009 extends problem_base {
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.');
}
}
/* // not implemented in 2.0 yet
class problem_000010 extends problem_base {
function title() {
return 'Uploaded files: slasharguments disabled or not working';
@@ -473,292 +496,41 @@ class problem_000010 extends problem_base {
default: return 0;
}
}
}*/
}
class problem_000012 extends problem_base {
class problem_000011 extends problem_base {
function title() {
return 'Random questions data consistency';
return 'Session errors detected';
}
function exists() {
global $DB;
return $DB->record_exists_select('question', "qtype = 'random' AND parent <> id", array());
global $CFG;
return isset($CFG->session_error_counter);
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
return '<p>For random questions, question.parent should equal question.id. ' .
'There are some questions in your database for which this is not true. ' .
'One way that this could have happened is for random questions restored from backup before ' .
'<a href="http://tracker.moodle.org/browse/MDL-5482">MDL-5482</a> was fixed.</p>';
global $CFG;
if (isset($CFG->session_error_counter)) {
return 'Session problems were detected. Total count: '.$CFG->session_error_counter;
} else {
return 'No session errors detected.';
}
}
function solution() {
global $CFG;
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the SQL</p>' .
'<pre>UPDATE ' . $CFG->prefix . 'question SET parent = id WHERE qtype = \'random\' and parent &lt;> id;</pre>';
}
}
class problem_000013 extends problem_base {
function title() {
return 'Multi-answer questions data consistency';
}
function exists() {
global $DB;
$positionexpr = $DB->sql_position($DB->sql_concat("','", "q.id", "','"),
$DB->sql_concat("','", "qma.sequence", "','"));
return $DB->record_exists_sql("
SELECT * FROM {question} q
JOIN {question_multianswer} qma ON $positionexpr > 0
WHERE qma.question <> q.parent") ||
$DB->record_exists_sql("
SELECT * FROM {question} q
JOIN {question} parent_q ON parent_q.id = q.parent
WHERE q.category <> parent_q.category");
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
return '<p>For each sub-question whose id is listed in ' .
'question_multianswer.sequence, its question.parent field should equal ' .
'question_multianswer.question; and each sub-question should be in the same ' .
'category as its parent. There are questions in your database for ' .
'which this is not the case. One way that this could have happened is ' .
'for multi-answer questions restored from backup before ' .
'<a href="http://tracker.moodle.org/browse/MDL-14750">MDL-14750</a> was fixed.</p>';
}
function solution() {
return '<p>Upgrade to Moodle 1.9.1 or later, or manually execute the ' .
'code in question_multianswer_fix_subquestion_parents_and_categories in ' .
'<a href="http://cvs.moodle.org/moodle/question/type/multianswer/db/upgrade.php?revision=1.1.10.2&amp;view=markup">/question/type/multianswer/db/upgrade.php' .
'from the 1.9 stable branch</a>.</p>';
}
}
class problem_000014 extends problem_base {
function title() {
return 'Only multianswer and random questions should be the parent of another question';
}
function exists() {
global $DB;
return $DB->record_exists_sql("
SELECT * FROM {question} q
JOIN {question} parent_q ON parent_q.id = q.parent
WHERE parent_q.qtype NOT IN ('random', 'multianswer')");
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
return '<p>You have questions that violate this in your databse. ' .
'You will need to investigate to determine how this happened.</p>';
}
function solution() {
return '<p>It is impossible to give a solution without knowing more about ' .
' how the problem was caused. You may be able to get help from the ' .
'<a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a>.</p>';
}
}
class problem_000015 extends problem_base {
function title() {
return 'Question categories should belong to a valid context';
}
function exists() {
global $DB;
return $DB->record_exists_sql("
SELECT qc.*, (SELECT COUNT(1) FROM {question} q WHERE q.category = qc.id) AS numquestions
FROM {question_categories} qc
LEFT JOIN {context} con ON qc.contextid = con.id
WHERE con.id IS NULL");
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
global $DB;
$problemcategories = $DB->get_records_sql("
SELECT qc.id, qc.name, qc.contextid, (SELECT COUNT(1) FROM {question} q WHERE q.category = qc.id) AS numquestions
FROM {question_categories} qc
LEFT JOIN {context} con ON qc.contextid = con.id
WHERE con.id IS NULL
ORDER BY numquestions DESC, qc.name");
$table = '<table><thead><tr><th>Cat id</th><th>Category name</th>' .
"<th>Context id</th><th>Num Questions</th></tr></thead><tbody>\n";
foreach ($problemcategories as $cat) {
$table .= "<tr><td>$cat->id</td><td>" . s($cat->name) . "</td><td>" .
$cat->contextid ."</td><td>$cat->numquestions</td></tr>\n";
}
$table .= '</tbody></table>';
return '<p>All question categories are linked to a context id, and, ' .
'the context they are linked to must exist. The following categories ' .
'belong to a non-existant category:</p>' . $table . '<p>Any of these ' .
'categories that contain no questions can just be deleted form the database. ' .
'Other categories will require more thought.</p>';
}
function solution() {
global $CFG;
return '<p>You can delete the empty categories by executing the following SQL:</p><pre>
DELETE FROM ' . $CFG->prefix . 'question_categories
WHERE
NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'question q WHERE q.category = ' . $CFG->prefix . 'question_categories.id)
AND NOT EXISTS (SELECT * FROM ' . $CFG->prefix . 'context con WHERE contextid = con.id)
</pre><p>Any remaining categories that contain questions will require more thought. ' .
'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
}
}
class problem_000016 extends problem_base {
function title() {
return 'Question categories should belong to the same context as their parent';
}
function exists() {
global $DB;
return $DB->record_exists_sql("
SELECT parent_qc.id AS parent, child_qc.id AS child, child_qc.contextid
FROM {question_categories} child_qc
JOIN {question_categories} parent_qc ON child_qc.parent = parent_qc.id
WHERE child_qc.contextid <> parent_qc.contextid");
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
global $DB;
$problemcategories = $DB->get_records_sql("
SELECT
parent_qc.id AS parentid, parent_qc.name AS parentname, parent_qc.contextid AS parentcon,
child_qc.id AS childid, child_qc.name AS childname, child_qc.contextid AS childcon
FROM {question_categories} child_qc
JOIN {question_categories} parent_qc ON child_qc.parent = parent_qc.id
WHERE child_qc.contextid <> parent_qc.contextid");
$table = '<table><thead><tr><th colspan="3">Child category</th><th colspan="3">Parent category</th></tr><tr>' .
'<th>Id</th><th>Name</th><th>Context id</th>' .
'<th>Id</th><th>Name</th><th>Context id</th>' .
"</tr></thead><tbody>\n";
foreach ($problemcategories as $cat) {
$table .= "<tr><td>$cat->childid</td><td>" . s($cat->childname) .
"</td><td>$cat->childcon</td><td>$cat->parentid</td><td>" . s($cat->parentname) .
"</td><td>$cat->parentcon</td></tr>\n";
}
$table .= '</tbody></table>';
return '<p>When one question category is the parent of another, then they ' .
'should both belong to the same context. This is not true for the following categories:</p>' .
$table;
}
function solution() {
return '<p>An automated solution is difficult. It depends whether the ' .
'parent or child category is in the wrong pace.' .
'People in the <a href="http://moodle.org/mod/forum/view.php?f=121">Quiz forum</a> may be able to help.</p>';
}
}
class problem_000017 extends problem_base {
function title() {
return 'Question categories tree structure';
}
function find_problems() {
global $DB;
static $answer = null;
if (is_null($answer)) {
$categories = $DB->get_records('question_categories', array(), 'id');
// Look for missing parents.
$missingparent = array();
foreach ($categories as $category) {
if ($category->parent != 0 && !array_key_exists($category->parent, $categories)) {
$missingparent[$category->id] = $category;
}
if (optional_param('resetsesserrorcounter', 0, PARAM_BOOL)) {
if (get_field('config', 'name', 'name', 'session_error_counter')) {
delete_records('config', 'name', 'session_error_counter');
}
// Look for loops.
$loops = array();
while (!empty($categories)) {
$current = array_pop($categories);
$thisloop = array($current->id => $current);
while (true) {
if (isset($thisloop[$current->parent])) {
// Loop detected
$loops[$current->id] = $thisloop;
break;
} else if (!isset($categories[$current->parent])) {
// Got to the top level, or a category we already know is OK.
break;
} else {
// Continue following the path.
$current = $categories[$current->parent];
$thisloop[$current->id] = $current;
unset($categories[$current->id]);
}
}
}
$answer = array($missingparent, $loops);
return 'Error counter was cleared.';
} else {
return '<p>Session errors can be caused by:<ul><li>unresolved problem in server software (aka random switching of users),</li><li>blocked or modified cookies,</li><li>deleting of active session files.</li></ul></p><p><a href="'.me().'&resetsesserrorcounter=1">Reset counter.</a></p>';
}
return $answer;
}
function exists() {
list($missingparent, $loops) = $this->find_problems();
return !empty($missingparent) || !empty($loops);
}
function severity() {
return SEVERITY_ANNOYANCE;
}
function description() {
list($missingparent, $loops) = $this->find_problems();
$description = '<p>The question categories should be arranged into tree ' .
' structures by the question_categories.parent field. Sometimes ' .
' this tree structure gets messed up.</p>';
if (!empty($missingparent)) {
$description .= '<p>The following categories are missing their parents:</p><ul>';
foreach ($missingparent as $cat) {
$description .= "<li>Category $cat->id: " . s($cat->name) . "</li>\n";
}
$description .= "</ul>\n";
}
if (!empty($loops)) {
$description .= '<p>The following categories form a loop of parents:</p><ul>';
foreach ($loops as $loop) {
$description .= "<li><ul>\n";
foreach ($loop as $cat) {
$description .= "<li>Category $cat->id: " . s($cat->name) . " has parent $cat->parent</li>\n";
}
$description .= "</ul></li>\n";
}
$description .= "</ul>\n";
}
return $description;
}
function solution() {
global $CFG;
list($missingparent, $loops) = $this->find_problems();
$solution = '<p>Consider executing the following SQL queries. These fix ' .
'the problem by moving some categories to the top level.</p>';
if (!empty($missingparent)) {
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
" SET parent = 0\n" .
" WHERE id IN (" . implode(',', array_keys($missingparent)) . ");</pre>\n";
}
if (!empty($loops)) {
$solution .= "<pre>UPDATE " . $CFG->prefix . "question_categories\n" .
" SET parent = 0\n" .
" WHERE id IN (" . implode(',', array_keys($loops)) . ");</pre>\n";
}
return $solution;
}
}
class problem_00000x extends problem_base {
function title() {
return '';
@@ -787,4 +559,4 @@ TODO:
*/
?>
+619 -384
View File
File diff suppressed because it is too large Load Diff
+29 -31
View File
@@ -1,45 +1,43 @@
<?php
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('toinodb');
admin_externalpage_setup('toinodb');
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
require_login();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
echo $OUTPUT->header();
echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB');
admin_externalpage_print_header();
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
if ($DB->get_dbfamily() != 'mysql') {
if ($CFG->dbfamily != 'mysql') {
notice('This function is for MySQL databases only!', 'index.php');
}
}
if (data_submitted() and $confirm and confirm_sesskey()) {
if (data_submitted() and $confirm and confirm_sesskey()) {
echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');
notify('Please be patient and wait for this to complete...', 'notifysuccess');
if ($tables = $DB->get_tables()) {
$DB->set_debug(true);
foreach ($tables as $table) {
$fulltable = $DB->get_prefix().$table;
$DB->change_database_structure("ALTER TABLE $fulltable TYPE=INNODB");
}
$DB->set_debug(false);
}
echo $OUTPUT->notification('... done.', 'notifysuccess');
echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->footer();
} else {
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
$formcontinue = new single_button(new moodle_url('/admin/innodb.php', $optionsyes), get_string('yes'));
$formcancel = new single_button(new moodle_url('/admin/index.php'), get_string('no'), 'get');
echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
echo $OUTPUT->footer();
}
if ($tables = $db->MetaTables()) {
$db->debug = true;
foreach ($tables as $table) {
execute_sql("ALTER TABLE $table TYPE=INNODB; ");
}
$db->debug = false;
}
notify('... done.', 'notifysuccess');
print_continue('index.php');
admin_externalpage_print_footer();
} else {
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
notice_yesno('Are you sure you want convert all your tables to the InnoDB format?',
'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get');
admin_externalpage_print_footer();
}
?>
+1370
View File
File diff suppressed because it is too large Load Diff
+259
View File
@@ -0,0 +1,259 @@
<?php // $Id$
/**
* This script enables Moodle translators to edit /docs and /help language
* files directly via WWW interface.
*
* Author: mudrd8mz@uxit.pedf.cuni.cz (http://moodle.cz)
* Based on: lang.php in 1.4.3+ release
* Thanks: Jaime Villate for important bug fixing, koen roggemans for his job and all moodlers
* for intensive testing of this my first contribution
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('langedit');
//
// 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$';
$currentfile = optional_param('currentfile', 'docs/README.txt', PARAM_PATH);
$strlanguage = get_string("language");
$strcurrentlanguage = get_string("currentlanguage");
$strthislanguage = get_string("thislanguage");
$stredithelpdocs = get_string('edithelpdocs', 'admin');
admin_externalpage_print_header();
notify('NOTICE: This interface is obsolete now and will be removed. You should use
improved <a href="lang.php?mode=helpfiles">lang.php</a> interface.');
$currentlang = current_language();
$langdir = "$CFG->dataroot/lang/$currentlang";
$enlangdir = "$CFG->dirroot/lang/en_utf8";
if (!file_exists($langdir)) {
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
}
// 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_utf8/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_utf8/docs/$file")) {
$options["docs/$file"] .= "$fileoldmark";
}
}
}
// Get all files from /help directory
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/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_utf8/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>";
}
//en_utf8 in dataroot is not editable
if ($currentlang == 'en_utf8') {
$editable = false;
}
echo "<table align=\"center\"><tr valign=\"center\"><td align=\"center\">\n";
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">\n";
echo htmlspecialchars(file_get_contents("$enlangdir/$currentfile"));
echo "</textarea>\n";
//link_to_popup_window("/lang/en_utf8/$currentfile", "popup", get_string("preview"));
$preview_url = langdoc_preview_url($currentfile);
if ($preview_url) {
link_to_popup_window($preview_url.'&amp;forcelang=en_utf8', 'popup', get_string('preview'));
}
echo "</td>\n";
if ($fileeditorinline == 1) {
echo "</tr>\n<tr valign=\"center\">\n";
}
echo "<td align=\"center\">\n";
if ($editable) {
echo "<form id=\"$currentfile\" action=\"langdoc.php\" method=\"post\">";
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo '<input type="hidden" name="currentfile" value="'.$currentfile.'" />';
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
if (file_exists("$langdir/$currentfile")) {
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
} else {
echo ($filetemplate);
}
echo "</textarea>\n";
$preview_url = langdoc_preview_url($currentfile);
if ($preview_url) {
link_to_popup_window($preview_url, 'popup', get_string('preview'));
}
echo '<div align="center"><input type="submit" value="'.get_string('savechanges').': lang/'.$currentlang.'/'.$currentfile.'" /></div>';
echo '</form>';
}
echo "</td>\n</tr>\n</table>";
error_reporting($CFG->debug);
}
admin_externalpage_print_footer();
//////////////////////////////////////////////////////////////////////
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 = trim($content); // Delete leading/trailing whitespace
fwrite($f, stripslashes($content));
fclose($f);
// Remove file if its empty
if (filesize("$path/$file") == 0) {
unlink("$path/$file");
}
return true;
}
/**
* Return a preview URL for the file, if available.
*
* Documentation will be moved into moodle.org wiki and current version 1.6 does not
* seem to be able to display local documentation. Thus, return empty URL for doc files.
* See lib/moodlelib.php document_file() - it still relies on old pre-UTF8 lang/ location.
*/
function langdoc_preview_url($currentfile) {
if (substr($currentfile, 0, 5) == 'help/') {
$currentfile = substr($currentfile, 5);
$currentpathexp = explode('/', $currentfile);
if (count($currentpathexp) > 1) {
$url = '/help.php?module='.implode('/',array_slice($currentpathexp,0,count($currentpathexp)-1)).'&amp;file='.end($currentpathexp);
} else {
$url = '/help.php?module=moodle&amp;file='.$currentfile;
}
} else {
$url = '';
}
return $url;
}
?>
+348 -348
View File
@@ -1,387 +1,387 @@
<?php
<?php //$Id$
///This file only manages the installation of 1.6 lang packs.
///in downloads.moodle.org, they are store in separate directory /lang16
///in local server, they are stored in $CFG->dataroot/lang
///This helps to avoid confusion.
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
/**
* Fetches language packages from download.moodle.org server
*
* Language packages are available at http://download.moodle.org/langpack/2.0/
* in ZIP format together with a file languages.md5 containing their hashes
* and meta info.
* Locally, language packs are saved into $CFG->dataroot/lang/
*
* @package core
* @copyright 2005 Yu Zhang
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
admin_externalpage_setup('langimport');
require_once(dirname(dirname(__FILE__)).'/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
$mode = optional_param('mode', 0, PARAM_INT); //phase
$pack = optional_param('pack', '', PARAM_FILE); //pack to install
$displaylang = $pack;
$uninstalllang = optional_param('uninstalllang', '', PARAM_FILE);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$sitelang = optional_param('sitelangconfig', '', PARAM_FILE);
$thisversion = '2.0'; // TODO this information should be taken from version.php or similar source
define('INSTALLATION_OF_SELECTED_LANG', 2);
define('DELETION_OF_SELECTED_LANG', 4);
define('UPDATE_ALL_LANG', 5);
admin_externalpage_setup('langimport');
$strlang = get_string('langimport','admin');
$strlanguage = get_string('language');
$strthislanguage = get_string('thislanguage');
$title = $strlang;
if (!empty($CFG->skiplangupgrade)) {
echo $OUTPUT->header();
echo $OUTPUT->box(get_string('langimportdisabled', 'admin'));
echo $OUTPUT->footer();
die;
}
$mode = optional_param('mode', 0, PARAM_INT); // action
$pack = optional_param('pack', array(), PARAM_SAFEDIR); // pack to install
$uninstalllang = optional_param('uninstalllang', '', PARAM_LANG); // installed pack to uninstall
$confirm = optional_param('confirm', 0, PARAM_BOOL); // uninstallation confirmation
define('INSTALLATION_OF_SELECTED_LANG', 2);
define('DELETION_OF_SELECTED_LANG', 4);
define('UPDATE_ALL_LANG', 5);
//reset and diagnose lang cache permissions
remove_dir($CFG->dataroot.'/cache/languages');
if (file_exists($CFG->dataroot.'/cache/languages')) {
print_error('cannotdeletelangcache', 'error');
}
get_string_manager()->reset_caches();
$notice_ok = array();
$notice_error = array();
if (($mode == INSTALLATION_OF_SELECTED_LANG) and confirm_sesskey() and !empty($pack)) {
set_time_limit(0);
make_upload_directory('temp');
make_upload_directory('lang');
if (is_array($pack)) {
$packs = $pack;
} else {
$packs = array($pack);
//reset and diagnose lang cache permissions
@unlink($CFG->dataroot.'/cache/languages');
if (file_exists($CFG->dataroot.'/cache/languages')) {
error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
}
get_list_of_languages(true); //refresh lang cache
foreach ($packs as $pack) {
if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion, $pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install();
switch ($status) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/langpack/'.$thisversion.'/'.$pack.'.zip';
$a->dest = $CFG->dataroot.'/lang';
print_error($cd->get_error(), 'error', 'langimport.php', $a);
$notice_ok = array();
$notice_error = array();
switch ($mode){
case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack
if (confirm_sesskey()) {
@mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there
@mkdir ($CFG->dataroot.'/lang/');
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
$pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
switch ($status) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new object();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$a->dest= $CFG->dataroot.'/lang';
error(get_string($cd->get_error(), 'error', $a), 'langimport.php');
} else {
error(get_string($cd->get_error(), 'error'), 'langimport.php');
}
break;
case COMPONENT_INSTALLED:
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
break;
case COMPONENT_UPTODATE:
break;
}
} else {
print_error($cd->get_error(), 'error', 'langimport.php');
notify('Had an unspecified error with the component installer, sorry.');
}
break;
case COMPONENT_INSTALLED:
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
if ($parentlang = get_parent_language($pack)) {
// install also parent pack if specified
if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion,
$parentlang.'.zip', 'languages.md5', 'lang')) {
$cd->install();
}
break;
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
if ($uninstalllang == 'en_utf8') {
$notice_error[] = 'en_utf8 can not be uninstalled!';
} else if (!$confirm && confirm_sesskey()) {
admin_externalpage_print_header();
notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang),
'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&amp;uninstalllang='.$uninstalllang.'&amp;confirm=1&amp;sesskey='.sesskey(),
'langimport.php');
print_footer();
die;
} else if (confirm_sesskey()) {
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)){
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)){
$rm2 = remove_dir($dest2);
}
get_list_of_languages(true); //refresh lang cache
//delete the direcotries
if ($rm1 or $rm2) {
$notice_ok[] = get_string('langpackremoved','admin');
} else { //nothing deleted, possibly due to permission error
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
}
}
break;
case UPDATE_ALL_LANG: //1 click update for all updatable language packs
//0th pull a list from download.moodle.org,
//key = langname, value = md5
$md5array = array();
$updated = 0; //any packs updated?
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
$lang16 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
$packs = array(); //all the packs that needs updating
if (!$availablelangs = get_remote_list_of_languages()) {
print_error('cannotdownloadlanguageupdatelist');
}
//and build an associative array
foreach ($availablelangs as $alang) {
$md5array[$alang[0]] = $alang[1];
}
//filtering out non-16 and unofficial packs
foreach ($alllangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
$notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$dest2 = $CFG->dirroot.'/lang/'.$clang;
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')){
$lang16[] = $clang;
}
}
//then filter out packs that have the same md5 key
foreach ($lang16 as $clang) {
if (!is_installed_lang($clang, $md5array[$clang])){
$packs[] = $clang;
}
}
@mkdir ($CFG->dataroot.'/temp/');
@mkdir ($CFG->dataroot.'/lang/');
foreach ($packs as $pack){ //for each of the remaining in the list, we
if ($pack == 'en_utf8') { // no update for en_utf8
continue;
}
//1. delete old director(ies)
$dest1 = $CFG->dataroot.'/lang/'.$pack;
$dest2 = $CFG->dirroot.'/lang/'.$pack;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)) {
if (!remove_dir($dest1)) {
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
continue;
}
}
break;
case COMPONENT_UPTODATE:
break;
}
} else {
echo $OUTPUT->notification('Had an unspecified error with the component installer, sorry.');
}
}
}
if ($mode == DELETION_OF_SELECTED_LANG and !empty($uninstalllang)) {
if ($uninstalllang == 'en') {
$notice_error[] = 'English language pack can not be uninstalled';
} else if (!$confirm and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('uninstallconfirm', 'admin', $uninstalllang),
'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1',
'langimport.php');
echo $OUTPUT->footer();
die;
} else if (confirm_sesskey()) {
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)){
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)){
$rm2 = remove_dir($dest2);
}
if ($rm1 or $rm2) {
$notice_ok[] = get_string('langpackremoved','admin');
} else { //nothing deleted, possibly due to permission error
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
}
}
}
if ($mode == UPDATE_ALL_LANG) {
set_time_limit(0);
if (!$availablelangs = get_remote_list_of_languages()) {
print_error('cannotdownloadlanguageupdatelist', 'error');
}
$md5array = array(); // (string)langcode => (string)md5
foreach ($availablelangs as $alang) {
$md5array[$alang[0]] = $alang[1];
}
// filter out unofficial packs
$currentlangs = array_keys(get_string_manager()->get_list_of_translations(true));
$updateablelangs = array();
foreach ($currentlangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
$notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$dest2 = $CFG->dirroot.'/lang/'.$clang;
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')){
$updateablelangs[] = $clang;
}
}
// then filter out packs that have the same md5 key
$neededlangs = array(); // all the packs that needs updating
foreach ($updateablelangs as $ulang) {
if (!is_installed_lang($ulang, $md5array[$ulang])) {
$neededlangs[] = $ulang;
}
}
make_upload_directory('temp');
make_upload_directory('lang');
$updated = false; // any packs updated?
foreach ($neededlangs as $pack) {
if ($pack == 'en') {
continue;
}
// delete old directories
$dest1 = $CFG->dataroot.'/lang/'.$pack;
$dest2 = $CFG->dirroot.'/lang/'.$pack;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)) {
if (!remove_dir($dest1)) {
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
continue;
}
}
if (file_exists($dest2)) {
if (!remove_dir($dest2)) {
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
continue;
}
}
// copy and unzip new version
if ($cd = new component_installer('http://download.moodle.org', 'langpack/'.$thisversion, $pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install();
switch ($status) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/langpack/'.$thisversion.'/'.$pack.'.zip';
$a->dest = $CFG->dataroot.'/lang';
print_error($cd->get_error(), 'error', 'langimport.php', $a);
} else {
print_error($cd->get_error(), 'error', 'langimport.php');
if (file_exists($dest2)) {
if (!remove_dir($dest2)) {
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
continue;
}
}
break;
case COMPONENT_UPTODATE:
// should not get here
break;
//2. copy & unzip into new
case COMPONENT_INSTALLED:
$notice_ok[] = get_string('langpackupdated', 'admin', $pack);
$updated = true;
break;
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
$pack.'.zip', 'languages.md5', 'lang')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
switch ($status) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$a->dest= $CFG->dataroot.'/lang';
error(get_string($cd->get_error(), 'error', $a)); // not probable
} else {
error(get_string($cd->get_error(), 'error')); // not probable
}
break;
case COMPONENT_UPTODATE:
//Print error string or whatever you want to do
break;
case COMPONENT_INSTALLED:
$notice_ok[] = get_string('langpackupdated', 'admin', $pack);
$updated = true;
//Print/do whatever you want
break;
default:
}
} else {
}
}
}
}
if ($updated) {
$notice_ok[] = get_string('langupdatecomplete','admin');
if ($updated) {
$notice_ok[] = get_string('langupdatecomplete','admin');
} else {
$notice_ok[] = get_string('nolangupdateneeded','admin');
}
break;
} //close of main switch
admin_externalpage_print_header();
$installedlangs = get_list_of_languages(true, true);
if ($availablelangs = get_remote_list_of_languages()) {
$remote = 1;
} else {
$notice_ok[] = get_string('nolangupdateneeded','admin');
$remote = 0; //flag for reading from remote or local
$availablelangs = get_local_list_of_languages();
}
}
get_string_manager()->reset_caches();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('langimport', 'admin'));
$installedlangs = get_string_manager()->get_list_of_translations(true);
$missingparents = array();
foreach ($installedlangs as $installedlang => $unused) {
$parent = get_parent_language($installedlang);
if (empty($parent) or ($parent === 'en')) {
continue;
if (!$remote) {
print_box_start();
print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/');
print_box_end();
}
if (!isset($installedlangs[$parent])) {
$missingparents[$installedlang] = $parent;
if ($notice_ok) {
$info = implode('<br />', $notice_ok);
notify($info, 'notifysuccess');
}
}
if ($availablelangs = get_remote_list_of_languages()) {
$remote = true;
} else {
$remote = false;
$availablelangs = array();
echo $OUTPUT->box_start();
print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/');
echo $OUTPUT->box_end();
}
if ($notice_error) {
$info = implode('<br />', $notice_error);
notify($info, 'notifyproblem');
}
if ($notice_ok) {
$info = implode('<br />', $notice_ok);
echo $OUTPUT->notification($info, 'notifysuccess');
}
print_box_start();
echo '<table summary="">';
echo '<tr><td align="center" valign="top">';
echo '<form id="uninstallform" action="langimport.php?mode='.DELETION_OF_SELECTED_LANG.'" method="post">';
echo '<fieldset class="invisiblefieldset">';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
if ($notice_error) {
$info = implode('<br />', $notice_error);
echo $OUTPUT->notification($info, 'notifyproblem');
}
/// display installed langs here
if ($missingparents) {
foreach ($missingparents as $l=>$parent) {
$a = new stdClass();
$a->lang = $installedlangs[$l];
$a->parent = $parent;
foreach ($availablelangs as $alang) {
if ($alang[0] == $parent) {
$shortlang = $alang[0];
$a->parent = $alang[2].' ('.$shortlang.')';
}
echo '<label for="uninstalllang">'.get_string('installedlangs','admin')."</label><br />\n";
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
foreach ($installedlangs as $clang =>$ilang){
echo '<option value="'.$clang.'">'.$ilang.'</option>';
}
echo '</select>';
echo '<br /><input type="submit" value="'.get_string('uninstall','admin').'" />';
echo '</fieldset>';
echo '</form>';
if ($remote) {
echo '<form id="updateform" action="langimport.php?mode='.UPDATE_ALL_LANG.'" method="post">';
echo '<div>';
echo '<br /><input type="submit" value="'.get_string('updatelangs','admin').'" />';
echo '</div>';
echo '</form>';
}
/// Display option to change site language
/// display to be installed langs here
echo '</td><td align="center" valign="top">';
//availabe langs table
$empty = 1; //something to pring
/// if this language pack is not already installed, then we allow installation
echo '<form id="installform" method="post" action="langimport.php?mode='.INSTALLATION_OF_SELECTED_LANG.'">';
echo '<fieldset class="invisiblefieldset">';
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
echo '<label for="pack">'.get_string('availablelangs','admin')."</label><br />\n";
if ($remote) {
echo '<select name="pack" id="pack" size="15">';
}
foreach ($availablelangs as $alang) {
if ($alang[0] == '') {
continue;
}
if (trim($alang[0]) != "en_utf8") {
if ($remote) {
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
$shortlang = substr($alang[0], 0, -5);
} else {
$shortlang = $alang[0];
}
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
}
} else { //print list in local format, and instruction to install
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
}
$empty = 0;
}
$info = get_string('missinglangparent', 'admin', $a);
echo $OUTPUT->notification($info, 'notifyproblem');
}
}
echo $OUTPUT->box_start();
echo html_writer::start_tag('table');
echo html_writer::start_tag('tr');
// list of installed languages
$url = new moodle_url('/admin/langimport.php', array('mode' => DELETION_OF_SELECTED_LANG));
echo html_writer::start_tag('td', array('valign' => 'top'));
echo html_writer::start_tag('form', array('id' => 'uninstallform', 'action' => $url->out(), 'method' => 'post'));
echo html_writer::start_tag('fieldset');
echo html_writer::label(get_string('installedlangs','admin'), 'uninstalllang');
echo html_writer::empty_tag('br');
echo html_writer::select($installedlangs, 'uninstalllang', '', false, array('size' => 15));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::empty_tag('br');
echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('uninstall','admin')));
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
if ($remote) {
$url = new moodle_url('/admin/langimport.php', array('mode' => UPDATE_ALL_LANG));
echo html_writer::start_tag('form', array('id' => 'updateform', 'action' => $url->out(), 'method' => 'post'));
echo html_writer::tag('fieldset', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('updatelangs','admin'))));
echo html_writer::end_tag('form');
}
echo html_writer::end_tag('td');
// list of available languages
$options = array();
foreach ($availablelangs as $alang) {
if (!empty($alang[0]) and trim($alang[0]) !== 'en' and !is_installed_lang($alang[0], $alang[1])) {
$options[$alang[0]] = $alang[2].' ('.$alang[0].')';
if ($remote) {
echo '</select>';
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
}
}
if (!empty($options)) {
echo html_writer::start_tag('td', array('valign' => 'top'));
$url = new moodle_url('/admin/langimport.php', array('mode' => INSTALLATION_OF_SELECTED_LANG));
echo html_writer::start_tag('form', array('id' => 'installform', 'action' => $url->out(), 'method' => 'post'));
echo html_writer::start_tag('fieldset');
echo html_writer::label(get_string('availablelangs','install'), 'pack');
echo html_writer::empty_tag('br');
echo html_writer::select($options, 'pack[]', '', false, array('size' => 15, 'multiple' => 'multiple'));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::empty_tag('br');
echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('install','admin')));
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
echo html_writer::end_tag('td');
}
echo '</fieldset>';
echo '</form>';
echo html_writer::end_tag('tr');
echo html_writer::end_tag('table');
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
die();
////////////////////////////////////////////////////////////////////////////////
// Local functions /////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/**
* checks the md5 of the zip file, grabbed from download.moodle.org,
* against the md5 of the local language file from last update
* @param string $lang
* @param string $md5check
* @return bool
*/
function is_installed_lang($lang, $md5check) {
global $CFG;
$md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
if (file_exists($md5file)){
return (file_get_contents($md5file) == $md5check);
if ($empty) {
echo '<br />';
print_string('nolanguagetodownload','admin');
}
return false;
}
/**
* Returns the list of available language packs from download.moodle.org
*
* @return array|bool false if can not download
*/
function get_remote_list_of_languages() {
$source = 'http://download.moodle.org/langpack/2.0/languages.md5';
$availablelangs = array();
//close available langs table
echo '</td></tr></table>';
print_box_end();
if ($content = download_file_content($source)) {
$alllines = explode("\n", $content);
foreach($alllines as $line) {
if (!empty($line)){
$availablelangs[] = explode(',', $line);
admin_externalpage_print_footer();
/**
* Returns a list of available language packs from a
* local copy shipped with standard moodle distro
* this is for site that can't download components.
* @return array
*/
function get_local_list_of_languages() {
global $CFG;
$source = $CFG->dirroot.'/lib/languages.md5';
$availablelangs = array();
if ($fp = fopen($source, 'r')) {
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
}
return $availablelangs;
}
} else {
/**
* checks the md5 of the zip file, grabbed from download.moodle.org,
* against the md5 of the local language file from last update
* @param string $lang
* @param string $md5check
* @return bool
*/
function is_installed_lang($lang, $md5check) {
global $CFG;
$md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
if (file_exists($md5file)){
return (file_get_contents($md5file) == $md5check);
}
return false;
}
}
/**
* Returns the latest list of available language packs from
* moodle.org
* @return array or false if can not download
*/
function get_remote_list_of_languages() {
$source = 'http://download.moodle.org/lang16/languages.md5';
$availablelangs = array();
if ($content = download_file_content($source)) {
$alllines = split("\n", $content);
foreach($alllines as $line) {
if (!empty($line)){
$availablelangs[] = split(',', $line);
}
}
return $availablelangs;
} else {
return false;
}
}
?>
-57
View File
@@ -1,57 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Allows admin to configure licenses.
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/licenselib.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managelicenses";
$action = optional_param('action', '', PARAM_ACTION);
$license = optional_param('license', '', PARAM_SAFEDIR);
////////////////////////////////////////////////////////////////////////////////
// process actions
if (!confirm_sesskey()) {
redirect($returnurl);
}
$return = true;
switch ($action) {
case 'disable':
license_manager::disable($license);
break;
case 'enable':
license_manager::enable($license);
break;
default:
break;
}
if ($return) {
redirect ($returnurl);
}
-110
View File
@@ -1,110 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an overview of installed local plugins
*
* Displays the list of found local plugins, their version (if found) and
* a link to delete the local plugin.
*
* @see http://docs.moodle.org/en/Development:Local_customisation
* @package admin
* @copyright 2010 David Mudrak <david.mudrak@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('managelocalplugins');
$delete = optional_param('delete', '', PARAM_SAFEDIR);
$confirm = optional_param('confirm', '', PARAM_BOOL);
/// If data submitted, then process and store.
if (!empty($delete) and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('localplugins'));
if (!$confirm) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $delete)) {
$strpluginname = get_string('pluginname', 'local_' . $delete);
} else {
$strpluginname = $delete;
}
echo $OUTPUT->confirm(get_string('localplugindeleteconfirm', '', $strpluginname),
new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
$PAGE->url);
echo $OUTPUT->footer();
die();
} else {
uninstall_plugin('local', $delete);
$a = new stdclass();
$a->name = $delete;
$pluginlocation = get_plugin_types();
$a->directory = $pluginlocation['local'] . '/' . $delete;
echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
echo $OUTPUT->continue_button($PAGE->url);
echo $OUTPUT->footer();
die();
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('localplugins'));
/// Print the table of all installed local plugins
$table = new flexible_table('localplugins_administration_table');
$table->define_columns(array('name', 'version', 'delete'));
$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('delete')));
$table->define_baseurl($PAGE->url);
$table->set_attribute('id', 'localplugins');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
$plugins = array();
foreach (get_plugin_list('local') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $plugin)) {
$strpluginname = get_string('pluginname', 'local_' . $plugin);
} else {
$strpluginname = $plugin;
}
$plugins[$plugin] = $strpluginname;
}
textlib_get_instance()->asort($plugins);
foreach ($plugins as $plugin => $name) {
$delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
$delete = html_writer::link($delete, get_string('delete'));
$version = get_config('local_' . $plugin);
if (!empty($version->version)) {
$version = $version->version;
} else {
$version = '?';
}
$table->add_data(array($name, $version, $delete));
}
$table->print_html();
echo $OUTPUT->footer();
+3 -3
View File
@@ -22,7 +22,7 @@
* - Run your admin/cron.php
*
* - Read /tmp/moodle-mailout.log
*
*
*
* This script will create logfiles in /tmp/ or in $TMPDIR if set.
* On windows, use php -r 'print sys_get_temp_dir()' to see where the file is saved.
@@ -63,7 +63,7 @@ fclose($stdin);
*
* Very useful for perl-like error-handling:
*
* do_something() or mdie("Something went wrong");
* do_somethting() or mdie("Something went wrong");
*
* @param string $msg Error message
* @param integer $errorcode Error code to emit
@@ -74,4 +74,4 @@ function mdie($msg='', $errorcode=1) {
exit($errorcode);
}
?>
+69
View File
@@ -0,0 +1,69 @@
<?php // $Id$
// Enables/disables maintenance mode
require('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = optional_param('action', '', PARAM_ALPHA);
admin_externalpage_setup('maintenancemode');
//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.'/'.SITEID.'/maintenance.html';
if ($form = data_submitted()) {
if (confirm_sesskey()) {
if ($form->action == "disable") {
unlink($filename);
redirect('maintenance.php', get_string('sitemaintenanceoff','admin'));
} else {
$file = fopen($filename, 'w');
fwrite($file, stripslashes($form->text));
fclose($file);
redirect('maintenance.php', get_string('sitemaintenanceon', 'admin'));
}
}
}
/// Print the header stuff
admin_externalpage_print_header();
/// Print the appropriate form
if (file_exists($filename)) { // We are in maintenance mode
echo '<div style="margin-left:auto;margin-right:auto">';
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 '</div>';
} else { // We are not in maintenance mode
$usehtmleditor = can_use_html_editor();
echo '<div style="text-align:center;margin-left:auto;margin-right:auto">';
echo '<form action="maintenance.php" method="post">';
echo '<div>';
echo '<input type="hidden" name="action" value="enable" />';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<p><input type="submit" value="'.get_string('enable').'" /></p>';
echo '<p>'.get_string('optionalmaintenancemessage', 'admin').':</p>';
echo '<table><tr><td>';
print_textarea($usehtmleditor, 20, 50, 600, 400, "text");
echo '</td></tr></table>';
echo '</div>';
echo '</form>';
echo '</div>';
if ($usehtmleditor) {
use_html_editor();
}
}
admin_externalpage_print_footer();
?>
+583
View File
@@ -0,0 +1,583 @@
<?php
/**
* Adapted for Moodle from the AMFPHP Project at http://www.amfphp.org/
* Creates the methodTable for a service class.
*
* @usage $this->methodTable = MethodTable::create($this);
* @author Christophe Herreman
* @since 05/01/2005
* @version $id$
*
* Special contributions by Allessandro Crugnola and Ted Milker
*/
if (!defined('T_ML_COMMENT')) {
define('T_ML_COMMENT', T_COMMENT);
} else {
define('T_DOC_COMMENT', T_ML_COMMENT);
}
/**
* Return string from start of haystack to first occurance of needle, or whole
* haystack, if needle does not occur
*
* @access public
* @param $haystack(String) Haystack to search in
* @param $needle(String) Needle to look for
*/
function strrstr($haystack, $needle)
{
return substr($haystack, 0, strpos($haystack.$needle,$needle));
}
/**
* Return substring of haystack from end of needle onwards, or FALSE
*
* @access public
* @param $haystack(String) Haystack to search in
* @param $needle(String) Needle to look for
*/
function strstrafter($haystack, $needle)
{
return substr(strstr($haystack, $needle), strlen($needle));
}
class MethodTable
{
/**
* Constructor.
*
* Since this class should only be accessed through the static create() method
* this constructor should be made private. Unfortunately, this is not possible
* in PHP4.
*
* @access private
*/
function MethodTable(){
}
/**
* Creates the methodTable for a passed class.
*
* @static
* @access public
* @param $sourcePath(String) The path to the file you want to parse
* @param $containsClass(Bool) True if the file is a class definition (optional)
*/
function create($sourcePath, $containsClass = false){
$methodTable = array();
if(!file_exists($sourcePath))
{
return false;
}
$source = file_get_contents($sourcePath);
$tokens = (array)token_get_all($source);
$waitingForOpenParenthesis = false;
$waitingForFunction = false;
$waitingForClassName = false;
$bufferingArgs = false;
$argBuffer = "";
$lastFunction = "";
$lastFunctionComment = "";
$lastComment = "";
$classMethods = array();
$realClassName = "";
if($containsClass) {
$openBraces = -10000;
}
else
{
$openBraces = 1;
}
$waitingForEndEncapsedString = false;
foreach($tokens as $token)
{
if (is_string($token)) {
if($token == '{')
{
$openBraces++;
}
if($token == '}')
{
if($waitingForEndEncapsedString)
{
$waitingForEndEncapsedString = false;
}
else
{
$lastComment = '';
$openBraces--;
if($openBraces == 0)
{
break;
}
}
}
elseif($waitingForOpenParenthesis && $token == '(')
{
$bufferingArgs = true;
$argBuffer = "";
$waitingForOpenParenthesis = false;
}
elseif($bufferingArgs)
{
if($token != ')')
{
$argBuffer .= $token;
}
else
{
if($lastFunction != $realClassName)
{
$classMethods[] = array("name" => $lastFunction,
"comment" => $lastFunctionComment,
"args" => $argBuffer);
$bufferingArgs = false;
$argBuffer = "";
$lastFunction = "";
$lastFunctionComment = "";
}
}
}
} else {
// token array
list($id, $text) = $token;
if($bufferingArgs)
{
$argBuffer .= $text;
}
switch ($id)
{
case T_COMMENT:
case T_ML_COMMENT: // we've defined this
case T_DOC_COMMENT: // and this
// no action on comments
$lastComment = $text;
break;
case T_FUNCTION:
if($openBraces >= 1)
{
$waitingForFunction = true;
}
break;
case T_STRING:
if($waitingForFunction)
{
$waitingForFunction = false;
$waitingForOpenParenthesis = true;
$lastFunction = $text;
$lastFunctionComment = $lastComment;
$lastComment = "";
}
if($waitingForClassName)
{
$waitingForClassName = false;
$realClassName = $text;
}
break;
case T_CLASS:
$openBraces = 0;
$waitingForClassName = true;
break;
case T_CURLY_OPEN:
case T_DOLLAR_OPEN_CURLY_BRACES:
$waitingForEndEncapsedString = true;
break;
}
}
}
foreach ($classMethods as $key => $value) {
$methodSignature = $value['args'];
$methodName = $value['name'];
$methodComment = $value['comment'];
$description = MethodTable::getMethodDescription($methodComment) . " " . MethodTable::getMethodCommentAttribute($methodComment, "desc");
$description = trim($description);
$access = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "access");
$roles = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "roles");
$instance = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "instance");
$returns = MethodTable::getMethodReturnValue($methodComment);
$pagesize = MethodTable::getMethodCommentAttributeFirstWord($methodComment, "pagesize");
$params = MethodTable::getMethodCommentArguments($methodComment);
//description, arguments, access, [roles, [instance, [returns, [pagesize]]]]
$methodTable[$methodName] = array();
//$methodTable[$methodName]["signature"] = $methodSignature; //debug purposes
$methodTable[$methodName]["description"] = ($description == "") ? "No description given." : $description;
$methodTable[$methodName]["arguments"] = MethodTable::getMethodArguments($methodSignature, $params);
$methodTable[$methodName]["access"] = ($access == "") ? "private" : $access;
if($roles != "") $methodTable[$methodName]["roles"] = $roles;
if($instance != "") $methodTable[$methodName]["instance"] = $instance;
if($returns != "") $methodTable[$methodName]["returns"] = $returns;
if($pagesize != "") $methodTable[$methodName]["pagesize"] = $pagesize;
}
return $methodTable;
}
/**
*
*/
function getMethodCommentServices($comment)
{
$pieces = explode('@service', $comment);
$args = array();
if(is_array($pieces) && count($pieces) > 1)
{
for($i = 0; $i < count($pieces) - 1; $i++)
{
$ps = strrstr($pieces[$i + 1], '@');
$ps = strrstr($ps, '*/');
$args[] = MethodTable::cleanComment($ps);
}
}
return $args;
}
/**
*
*/
function getMethodCommentArguments($comment)
{
$pieces = explode('@param', $comment);
$args = array();
if(is_array($pieces) && count($pieces) > 1)
{
for($i = 0; $i < count($pieces) - 1; $i++)
{
$ps = strrstr($pieces[$i + 1], '@');
$ps = strrstr($ps, '*/');
$args[] = MethodTable::cleanComment($ps);
}
}
return $args;
}
/**
* Returns the description from the comment.
* The description is(are) the first line(s) in the comment.
*
* @static
* @private
* @param $comment(String) The method's comment.
*/
function getMethodDescription($comment){
$comment = MethodTable::cleanComment(strrstr($comment, "@"));
return trim($comment);
}
/**
* Returns the value of a comment attribute.
*
* @static
* @private
* @param $comment(String) The method's comment.
* @param $attribute(String) The name of the attribute to get its value from.
*/
function getMethodCommentAttribute($comment, $attribute){
$pieces = strstrafter($comment, '@' . $attribute);
if($pieces !== FALSE)
{
$pieces = strrstr($pieces, '@');
$pieces = strrstr($pieces, '*/');
return MethodTable::cleanComment($pieces);
}
return "";
}
/**
* Returns the value of a comment attribute.
*
* @static
* @private
* @param $comment(String) The method's comment.
* @param $attribute(String) The name of the attribute to get its value from.
*/
function getMethodCommentAttributeFirstLine($comment, $attribute){
$pieces = strstrafter($comment, '@' . $attribute);
if($pieces !== FALSE)
{
$pieces = strrstr($pieces, '@');
$pieces = strrstr($pieces, "*");
$pieces = strrstr($pieces, "/");
$pieces = strrstr($pieces, "-");
$pieces = strrstr($pieces, "\n");
$pieces = strrstr($pieces, "\r");
$pieces = strrstr($pieces, '*/');
return MethodTable::cleanComment($pieces);
}
return "";
}
/**
* Returns the value of a comment attribute.
*
* @static
* @private
* @param $comment(String) The method's comment.
* @param $attribute(String) The name of the attribute to get its value from.
*/
function getMethodReturnValue($comment){
$result = array('type' => 'void', 'description' => '');
$pieces = strstrafter($comment, '@returns');
if(FALSE == $pieces) $pieces = strstrafter($comment, '@return');
if($pieces !== FALSE)
{
$pieces = strrstr($pieces, '@');
$pieces = strrstr($pieces, "*");
$pieces = strrstr($pieces, "/");
$pieces = strrstr($pieces, "-");
$pieces = strrstr($pieces, "\n");
$pieces = strrstr($pieces, "\r");
$pieces = strrstr($pieces, '*/');
$pieces = trim(MethodTable::cleanComment($pieces));
@list($result['type'], $result['description']) = explode(' ', $pieces, 2);
$result['type'] = MethodTable::standardizeType($result['type']);
}
return $result;
}
function getMethodCommentAttributeFirstWord($comment, $attribute){
$pieces = strstrafter($comment, '@' . $attribute);
if($pieces !== FALSE)
{
$val = MethodTable::cleanComment($pieces);
return trim(strrstr($val, ' '));
}
return "";
}
/**
* Returns an array with the arguments of a method.
*
* @static
* @access private
* @param $methodSignature(String) The method's signature;
*/
function getMethodArguments($methodSignature, $commentParams){
if(strlen($methodSignature) == 0){
//no arguments, return an empty array
$result = array();
}else{
//clean the arguments before returning them
$result = MethodTable::cleanArguments(explode(",", $methodSignature), $commentParams);
}
return $result;
}
/**
* Cleans the function or method's return value.
*
* @static
* @access private
* @param $value(String) The "dirty" value.
*/
function cleanReturnValue($value){
$result = array();
$value = trim($value);
list($result['type'], $result['description']) = explode(' ', $value, 2);
$result['type'] = MethodTable::standardizeType($result['type']);
return $result;
}
/**
* Takes a string and returns the XMLRPC type that most closely matches it.
*
* @static
* @access private
* @param $type(String) The given type string.
*/
function standardizeType($type) {
$type = strtolower($type);
if('str' == $type || 'string' == $type) return 'string';
if('int' == $type || 'integer' == $type) return 'int';
if('bool' == $type || 'boolean' == $type) return 'boolean';
// Note that object is not a valid XMLRPC type
if('object' == $type || 'class' == $type) return 'object';
if('float' == $type || 'dbl' == $type || 'double' == $type || 'flt' == $type) return 'double';
// Note that null is not a valid XMLRPC type. The null type can have
// only one value - null.
if('null' == $type) return 'null';
// Note that mixed is not a valid XMLRPC type
if('mixed' == $type) return 'mixed';
if('array' == $type || 'arr' == $type) return 'array';
if('assoc' == $type || 'struct' == $type) return 'struct';
// Note that this is not a valid XMLRPC type. As references cannot be
// serialized or exported, there is no way this could be XML-RPCed.
if('reference' == $type || 'ref' == $type) return 'reference';
return 'string';
}
/**
* Cleans the arguments array.
* This method removes all whitespaces and the leading "$" sign from each argument
* in the array.
*
* @static
* @access private
* @param $args(Array) The "dirty" array with arguments.
*/
function cleanArguments($args, $commentParams){
$result = array();
if(!is_array($args)) return array();
foreach($args as $index => $arg){
$arg = strrstr(str_replace(array('$','&$'), array('','&'), $arg), '=');
if(!isset($commentParams[$index]))
{
$result[] = trim($arg);
}
else
{
$start = trim($arg);
$end = trim(str_replace('$', '', $commentParams[$index]));
// Suppress Notice of 'Undefined offset' with @
@list($word0, $word1, $tail) = preg_split("/[\s]+/", $end, 3);
$word0 = strtolower($word0);
$word1 = strtolower($word1);
$wordBase0 = ereg_replace('^[&$]+','',$word0);
$wordBase1 = ereg_replace('^[&$]+','',$word1);
$startBase = strtolower(ereg_replace('^[&$]+','',$start));
if ($wordBase0 == $startBase) {
$type = str_replace(array('(',')'),'', $word1);
} elseif($wordBase1 == $startBase) {
$type = str_replace(array('(',')'),'', $word0);
} elseif( ereg('(^[&$]+)|(\()([a-z0-9]+)(\)$)', $word0, $regs) ) {
$tail = str_ireplace($word0, '', $end);
$type = $regs[3];
} else {
// default to string
$type = 'string';
}
$type = MethodTable::standardizeType($type);
/*
if($type == 'str') {
$type = 'string';
} elseif($type == 'int' || $type == 'integer') {
$type = 'int';
} elseif($type == 'bool' || $type == 'boolean') {
$type = 'boolean';
} elseif($type == 'object' || $type == 'class') {
// Note that this is not a valid XMLRPC type
$type = 'object';
} elseif($type == 'float' || $type == 'dbl' || $type == 'double' || $type == 'flt') {
$type = 'double';
} elseif($type == 'null') {
// Note that this is not a valid XMLRPC type
// The null type can have only one value - null. Why would
// that be an argument to a function? Just in case:
$type = 'null';
} elseif($type == 'mixed') {
// Note that this is not a valid XMLRPC type
$type = 'mixed';
} elseif($type == 'array' || $type == 'arr') {
$type = 'array';
} elseif($type == 'assoc') {
$type = 'struct';
} elseif($type == 'reference' || $type == 'ref') {
// Note that this is not a valid XMLRPC type
// As references cannot be serialized or exported, there is
// no way this could be XML-RPCed.
$type = 'reference';
} else {
$type = 'string';
}
*/
$result[] = array('type' => $type, 'description' => $start . ' - ' . $tail);
}
}
return $result;
}
/**
* Cleans the comment string by removing all comment start and end characters.
*
* @static
* @private
* @param $comment(String) The method's comment.
*/
function cleanComment($comment){
$comment = str_replace("/**", "", $comment);
$comment = str_replace("*/", "", $comment);
$comment = str_replace("*", "", $comment);
$comment = str_replace("\n", "\\n", trim($comment));
$comment = eregi_replace("[\r\t\n ]+", " ", trim($comment));
$comment = str_replace("\"", "\\\"", $comment);
return $comment;
}
/**
*
*/
function showCode($methodTable){
if(!is_array($methodTable)) $methodTable = array();
foreach($methodTable as $methodName=>$methodProps){
$result .= "\n\t\"" . $methodName . "\" => array(";
foreach($methodProps as $key=>$value){
$result .= "\n\t\t\"" . $key . "\" => ";
if($key=="arguments"){
$result .= "array(";
for($i=0; $i<count($value); $i++){
$result .= "\"" . addslashes($value[$i]) . "\"";
if($i<count($value)-1){
$result .= ", ";
}
}
$result .= ")";
}else{
$result .= "\"" . $value . "\"";
}
$result .= ",";
}
$result = substr($result, 0, -1);
$result .= "\n\t),";
}
$result = substr($result, 0, -1);
$result = "\$this->methodTable = array(" . $result;
$result .= "\n);";
return $result;
}
}
?>
+40 -37
View File
@@ -1,4 +1,4 @@
<?php
<?php // $Id$
// Allows the admin to control user logins from remote moodles.
@@ -16,10 +16,10 @@ require_login();
admin_externalpage_setup('ssoaccesscontrol');
echo $OUTPUT->header();
admin_externalpage_print_header();
if (!extension_loaded('openssl')) {
print_error('requiresopenssl', 'mnet');
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
@@ -27,7 +27,7 @@ $sesskey = sesskey();
$formerror = array();
// grab the mnet hosts and remove the localhost
$mnethosts = $DB->get_records_menu('mnet_host', array(), 'name', 'id, name');
$mnethosts = get_records_menu('mnet_host', '', '', 'name', 'id, name');
if (array_key_exists($CFG->mnet_localhost_id, $mnethosts)) {
unset($mnethosts[$CFG->mnet_localhost_id]);
}
@@ -36,38 +36,38 @@ if (array_key_exists($CFG->mnet_localhost_id, $mnethosts)) {
// process actions
if (!empty($action) and confirm_sesskey()) {
// boot if insufficient permission
if (!has_capability('moodle/user:delete', $sitecontext)) {
print_error('nomodifyacl','mnet');
error(get_string('nomodifyacl','mnet'));
}
// fetch the record in question
$id = required_param('id', PARAM_INT);
if (!$idrec = $DB->get_record('mnet_sso_access_control', array('id'=>$id))) {
print_error('recordnoexists','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
error(get_string('recordnoexists','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
switch ($action) {
case "delete":
$DB->delete_records('mnet_sso_access_control', array('id'=>$id));
redirect('access_control.php', get_string('deleteuserrecord', 'mnet', array('user'=>$idrec->username, 'host'=>$mnethosts[$idrec->mnet_host_id])));
delete_records('mnet_sso_access_control', 'id', $id);
redirect('access_control.php', get_string('deleteuserrecord', 'mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
break;
case "acl":
// require the access parameter, and it must be 'allow' or 'deny'
$accessctrl = trim(strtolower(required_param('accessctrl', PARAM_ALPHA)));
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
print_error('invalidaccessparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
error(get_string('invalidaccessparam', 'mnet') , "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
if ($accessctrl == 'allow') {
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array('uset'=>$idrec->username, 'host'=>$mnethosts[$idrec->mnet_host_id])));
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
} elseif ($accessctrl == 'deny') {
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array('user'=>$idrec->username, 'host'=>$mnethosts[$idrec->mnet_host_id])));
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
}
}
break;
@@ -84,7 +84,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
// check permissions and verify form input
if (!has_capability('moodle/user:delete', $sitecontext)) {
print_error('nomodifyacl','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
error(get_string('nomodifyacl','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
if (empty($form->username)) {
$formerror['username'] = get_string('enterausername','mnet');
@@ -107,9 +107,9 @@ if ($form = data_submitted() and confirm_sesskey()) {
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array('user'=>$username, 'host'=>$mnethosts[$form->mnet_host_id])));
redirect('access_control.php', get_string('ssl_acl_allow','mnet', array($username, $mnethosts[$form->mnet_host_id])));
} elseif ($form->accessctrl == 'deny') {
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array('user'=>$username, 'host'=>$mnethosts[$form->mnet_host_id])));
redirect('access_control.php', get_string('ssl_acl_deny','mnet', array($username, $mnethosts[$form->mnet_host_id])));
}
}
}
@@ -119,7 +119,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
}
// Explain
echo $OUTPUT->box(get_string('ssoacldescr','mnet'));
print_box(get_string('ssoacldescr','mnet'));
// Are the needed bits enabled?
$warn = '';
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
@@ -130,9 +130,12 @@ if (!is_enabled_auth('mnet')) {
$warn .= '<p>' . get_string('authmnetdisabled','mnet').'</p>';
}
if (get_config('auth/mnet', 'auto_add_remote_users') != true) {
$warn .= '<p>' . get_string('authmnetautoadddisabled','mnet').'</p>';
}
if (!empty($warn)) {
$warn = '<p>' . get_string('ssoaclneeds','mnet').'</p>' . $warn;
echo $OUTPUT->box($warn);
print_box($warn);
}
// output the ACL table
$columns = array("username", "mnet_host_id", "access", "delete");
@@ -148,52 +151,50 @@ foreach ($columns as $column) {
} else {
$columndir = $dir == "ASC" ? "DESC" : "ASC";
$columnicon = $dir == "ASC" ? "down" : "up";
$columnicon = " <img src=\"" . $OUTPUT->pix_url('t/' . $columnicon) . "\" alt=\"\" />";
$columnicon = " <img src=\"$CFG->pixpath/t/$columnicon.gif\" alt=\"\" />";
}
$headings[$column] = "<a href=\"?sort=$column&amp;dir=$columndir&amp;\">".$string[$column]."</a>$columnicon";
}
$headings['delete'] = '';
$acl = $DB->get_records('mnet_sso_access_control', null, "$sort $dir", '*'); //, $page * $perpage, $perpage);
$aclcount = $DB->count_records('mnet_sso_access_control');
$acl = get_records('mnet_sso_access_control', '', '', "$sort $dir", '*'); //, $page * $perpage, $perpage);
$aclcount = count_records('mnet_sso_access_control');
if (!$acl) {
echo $OUTPUT->heading(get_string('noaclentries','mnet'));
print_heading(get_string('noaclentries','mnet'));
$table = NULL;
} else {
$table = new html_table();
$table->head = $headings;
$table->align = array('left', 'left', 'center');
$table->width = "95%";
foreach ($acl as $aclrecord) {
if ($aclrecord->accessctrl == 'allow') {
$accesscolumn = get_string('allow', 'mnet')
. " (<a href=\"?id={$aclrecord->id}&amp;action=acl&amp;accessctrl=deny&amp;sesskey=".sesskey()."\">"
. " (<a href=\"?id={$aclrecord->id}&amp;action=acl&amp;accessctrl=deny&amp;sesskey={$USER->sesskey}\">"
. get_string('deny', 'mnet') . "</a>)";
} else {
$accesscolumn = get_string('deny', 'mnet')
. " (<a href=\"?id={$aclrecord->id}&amp;action=acl&amp;accessctrl=allow&amp;sesskey=".sesskey()."\">"
. " (<a href=\"?id={$aclrecord->id}&amp;action=acl&amp;accessctrl=allow&amp;sesskey={$USER->sesskey}\">"
. get_string('allow', 'mnet') . "</a>)";
}
$deletecolumn = "<a href=\"?id={$aclrecord->id}&amp;action=delete&amp;sesskey=".sesskey()."\">"
$deletecolumn = "<a href=\"?id={$aclrecord->id}&amp;action=delete&amp;sesskey={$USER->sesskey}\">"
. get_string('delete') . "</a>";
$table->data[] = array (s($aclrecord->username), $aclrecord->mnet_host_id, $accesscolumn, $deletecolumn);
$table->data[] = array ($aclrecord->username, $aclrecord->mnet_host_id, $accesscolumn, $deletecolumn);
}
}
if (!empty($table)) {
echo html_writer::table($table);
print_table($table);
echo '<p>&nbsp;</p>';
$baseurl = new moodle_url('/admin/mnet/access_control.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
echo $OUTPUT->paging_bar($aclcount, $page, $perpage, $baseurl);
print_paging_bar($aclcount, $page, $perpage, "?sort=$sort&amp;dir=$dir&amp;perpage=$perpage&amp;");
}
// output the add form
echo $OUTPUT->box_start();
print_simple_box_start('center','90%','','20');
?>
<div class="mnetaddtoaclform">
<div class="mnetaddtoaclform">
<form id="mnetaddtoacl" method="post">
<input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>" />
<?php
@@ -210,7 +211,7 @@ echo " " . get_string('remotehost', 'mnet') . ":\n";
if (!empty($formerror['mnet_host_id'])) {
echo '<span class="error"> * </span>';
}
echo html_writer::select($mnethosts, 'mnet_host_id');
choose_from_menu($mnethosts, 'mnet_host_id');
// choose an access level
echo " " . get_string('accesslevel', 'mnet') . ":\n";
@@ -219,7 +220,7 @@ if (!empty($formerror['accessctrl'])) {
}
$accessmenu['allow'] = get_string('allow', 'mnet');
$accessmenu['deny'] = get_string('deny', 'mnet');
echo html_writer::select($accessmenu, 'accessctrl');
choose_from_menu($accessmenu, 'accessctrl');
// submit button
echo '<input type="submit" value="' . get_string('addtoacl', 'mnet') . '" />';
@@ -230,5 +231,7 @@ foreach ($formerror as $error) {
echo "<br><span class=\"error\">$error<span>";
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
print_simple_box_end();
admin_externalpage_print_footer();
?>
+182
View File
@@ -0,0 +1,182 @@
<?php
/**
* Library functions for mnet
*
* @author Donal McMullan donal@catalyst.net.nz
* @version 0.0.1
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mnet
*/
/**
* Parse a file to find out what functions/methods exist in it, and add entries
* for the remote-call-enabled functions to the database.
*
* The path to a file, e.g. auth/mnet/auth.php can be thought of as
* type/parentname/docname
*
* @param string $type mod, auth or enrol
* @param string $parentname Implementation of type, e.g. 'mnet' in the
* case of auth/mnet/auth.php
* @return bool True on success, else false
*/
function mnet_get_functions($type, $parentname) {
global $CFG;
$dataobject = new stdClass();
$docname = $type.'.php';
$publishes = array();
if ('mod' == $type) {
$docname = 'rpclib.php';
$relname = '/mod/'.$parentname.'/'.$docname;
$filename = $CFG->dirroot.$relname;
if (file_exists($filename)) include_once $filename;
$mnet_publishes = $parentname.'_mnet_publishes';
if (function_exists($mnet_publishes)) {
(array)$publishes = $mnet_publishes();
}
} else {
// auth or enrol
$relname = '/'.$type.'/'.$parentname.'/'.$docname;
$filename = $CFG->dirroot.$relname;
if (file_exists($filename)) include_once $filename;
$class = $type.($type=='enrol'? 'ment':'').'_plugin_'.$parentname;
if (class_exists($class)) {
$object = new $class();
if (method_exists($object, 'mnet_publishes')) {
(array)$publishes = $object->mnet_publishes();
}
}
}
$methodServiceArray = array();
foreach($publishes as $service) {
if (is_array($service['methods'])) {
foreach($service['methods'] as $methodname) {
$methodServiceArray[$methodname][] = $service;
}
}
}
// Disable functions that don't exist (any more) in the source
// Should these be deleted? What about their permissions records?
$rpcrecords = get_records_select('mnet_rpc', ' parent=\''.$parentname.'\' AND parent_type=\''.$type.'\' ', 'function_name ASC ');
if (!empty($rpcrecords)) {
foreach($rpcrecords as $rpc) {
if (!array_key_exists($rpc->function_name, $methodServiceArray)) {
$rpc->enabled = 0;
update_record('mnet_rpc', $rpc);
}
}
}
if (!file_exists($filename)) return false;
if (extension_loaded('tokenizer')) {
include_once "$CFG->dirroot/$CFG->admin/mnet/MethodTable.php";
$functions = (array)MethodTable::create($filename,false);
}
foreach($methodServiceArray as $method => $servicearray) {
if (!empty($functions[$method])) {
$details = $functions[$method];
$profile = $details['arguments'];
if (!isset($details['returns'])) {
array_unshift($profile, array('type' => 'void', 'description' => 'No return value'));
} else {
array_unshift($profile, $details['returns']);
}
$dataobject->profile = serialize($profile);
$dataobject->help = addslashes($details['description']);
} else {
$dataobject->profile = serialize(array(array('type' => 'void', 'description' => 'No return value')));
$dataobject->help = '';
}
$dataobject->function_name = $method;
$dataobject->xmlrpc_path = $type.'/'.$parentname.'/'.$docname.'/'.$method;
$dataobject->parent_type = $type;
$dataobject->parent = $parentname;
$dataobject->enabled = '0';
if ($record_exists = get_record('mnet_rpc', 'xmlrpc_path', $dataobject->xmlrpc_path)) {
$dataobject->id = $record_exists->id;
$dataobject->enabled = $record_exists->enabled;
update_record('mnet_rpc', $dataobject);
} else {
$dataobject->id = insert_record('mnet_rpc', $dataobject, true);
}
foreach($servicearray as $service) {
$serviceobj = get_record('mnet_service', 'name', $service['name']);
if (false == $serviceobj) {
$serviceobj = new stdClass();
$serviceobj->name = $service['name'];
$serviceobj->apiversion = $service['apiversion'];
$serviceobj->offer = 1;
$serviceobj->id = insert_record('mnet_service', $serviceobj, true);
}
if (false == get_record('mnet_service2rpc', 'rpcid', $dataobject->id, 'serviceid', $serviceobj->id)) {
$obj = new stdClass();
$obj->rpcid = $dataobject->id;
$obj->serviceid = $serviceobj->id;
insert_record('mnet_service2rpc', $obj, true);
}
}
}
return true;
}
function upgrade_RPC_functions($returnurl) {
global $CFG;
$basedir = $CFG->dirroot.'/mod';
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
continue;
}
if (filetype($basedir .'/'. $dir) != 'dir') {
continue;
}
mnet_get_functions('mod', $dir);
}
}
$basedir = $CFG->dirroot.'/auth';
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
continue;
}
if (filetype($basedir .'/'. $dir) != 'dir') {
continue;
}
mnet_get_functions('auth', $dir);
}
}
$basedir = $CFG->dirroot.'/enrol';
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
continue;
}
if (filetype($basedir .'/'. $dir) != 'dir') {
continue;
}
mnet_get_functions('enrol', $dir);
}
}
}
?>
+55
View File
@@ -0,0 +1,55 @@
<?php
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => get_string('mnetsettings', 'mnet'), 'link' => "$CFG->wwwroot/$CFG->admin/mnet/index.php", 'type' => 'misc');
$navlinks[] = array('name' => get_string('deletehost', 'mnet'), 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strmnetsettings", "$site->fullname", $navigation);
print_heading(get_string('mnetsettings', 'mnet'));
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<table class="generalbox standard" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header" cellpadding="0"><span><?php print_string('deleteaserver', 'mnet'); ?>Deleting a Server</span></td>
</tr>
<?php
if (count($warn) > 0){
?>
<tr valign="top">
<td align="right" colspan="2"><?php print_string('receivedwarnings','mnet'); ?>:<br />
<?php foreach($warn as $warning) echo $warning .'<br />'; ?>
</td>
</tr>
<?php
}
?>
<tr valign="top">
<td colspan="2"><?php print_string('reallydeleteserver','mnet'); ?>: "<?php echo $mnet_peer->name; ?>"?</td>
</tr>
<tr valign="top">
<td width="80">
<form method="post" action="delete.php">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="hostid" value="<?php echo $mnet_peer->id; ?>" />
<input type="hidden" name="step" value="delete" />
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
</form>
</td>
<td>
<form method="get" action="index.php">
<input type="submit" name="ignore" value="<?php print_string('cancel'); ?>"/>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?php
print_footer();
?>
+44 -61
View File
@@ -1,65 +1,48 @@
<?php
<?PHP // $Id$
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
include_once($CFG->dirroot.'/mnet/lib.php');
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmnetsettings = get_string('mnetsettings', 'mnet');
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
/**
* Page to allow the administrator to delete networked hosts, with a confirm message
*
* @package core
* @subpackage mnet
* @copyright 2007 Donal McMullan
* @copyright 2007 Martin Langhoff
* @copyright 2010 Penny Leach
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir . '/adminlib.php');
$step = optional_param('step', 'verify', PARAM_ALPHA);
$hostid = required_param('hostid', PARAM_INT);
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$mnet = get_mnet_environment();
$PAGE->set_url('/admin/mnet/delete.php');
admin_externalpage_setup('mnetpeer' . $hostid);
require_sesskey();
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
if ('verify' == $step) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deleteaserver', 'mnet'));
if ($live_users = $mnet_peer->count_live_sessions() > 0) {
echo $OUTPUT->notification(get_string('usersareonline', 'mnet', $live_users));
if (!$site = get_site()) {
print_error('nosite', '', '', NULL, true);
}
$yesurl = new moodle_url('/admin/mnet/delete.php', array('hostid' => $mnet_peer->id, 'step' => 'delete'));
$nourl = new moodle_url('/admin/mnet/peers.php');
echo $OUTPUT->confirm(get_string('reallydeleteserver', 'mnet') . ': ' . $mnet_peer->name, $yesurl, $nourl);
echo $OUTPUT->footer();
} elseif ('delete' == $step) {
$mnet_peer->delete();
redirect(new moodle_url('/admin/mnet/peers.php'), get_string('hostdeleted', 'mnet'), 5);
}
/// Initialize variables.
// Step must be one of:
// input Parse the details of a new host and fetch its public key
// commit Save our changes (to a new OR existing host)
$step = optional_param('step', 'verify', PARAM_ALPHA);
$hostid = required_param('hostid', PARAM_INT);
$warn = array();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
redirect('index.php', get_string('postrequired','mnet') ,7);
}
if ('verify' == $step) {
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$live_users = $mnet_peer->count_live_sessions();
if ($live_users > 0) {
$warn[] = get_string('usersareonline', 'mnet', $live_users);
}
include('delete.html');
} elseif ('delete' == $step) {
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$mnet_peer->delete();
redirect('peers.php', get_string('hostdeleted', 'mnet'), 5);
}
?>
+104
View File
@@ -0,0 +1,104 @@
<form id="assignform" method="post" action="">
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
<input type="hidden" name="host" value="<?php p($mnet_peer->id) ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
<table class="generaltable" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<?php print_string('existingusers', 'role', count($mnetenrolledusers)); ?>
</td>
<td></td>
<td valign="top">
<?php print_string('potentialusers', 'role', $availableusers->_numOfRows); ?>
</td>
</tr>
<tr>
<td valign="top">
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=false;
getElementById('assignform').addselect.selectedIndex=-1;">
<?php
foreach ($mnetenrolledusers as $enrolleduser) {
$fullname = fullname($enrolleduser, true);
echo "<option value=\"$enrolleduser->id\">".s($fullname)." (".s($enrolleduser->rolename).")</option>\n";
}
?>
</select></td>
<td valign="top">
<br />
<input name="add" type="submit" id="add" value="&larr;" />
<br />
<input name="remove" type="submit" id="remove" value="&rarr;" />
<br />
</td>
<td valign="top">
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=false;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;">
<?php
if (!empty($searchtext)) {
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
while ($user = rs_fetch_next_record($availableusers)) {
if (!isset($enrolledusers[$user->id])) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
echo "</optgroup>\n";
} else {
if ($availableusers->_numOfRows > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else {
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
}
?>
</select>
<br />
<input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
onfocus ="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;
getElementById('assignform').addselect.selectedIndex=-1;"
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
if (keyCode == 13) {
getElementById('assignform').previoussearch.value=1;
getElementById('assignform').submit();
} " />
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
<?php
if (!empty($searchusers)) {
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
}
?>
</td>
</tr>
<tr>
<td valign="top"><?php print_string('otherenrolledusers', 'mnet'); ?>:<br />
<ul>
<?php
foreach ($remtenrolledusers as $enrolleduser) {
$fullname = fullname($enrolleduser, true);
print '<li>'
. s($fullname) . ' (' . s($enrolleduser->rolename) . ') '
. s($enrolleduser->enroltype)."</li>\n";
}
?></ul></td>
<td valign="top"></td>
<td valign="top"></td>
</tr>
</table>
</div>
</form>
+279
View File
@@ -0,0 +1,279 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
$mnethostid = required_param('host', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$mnet_peer = new mnet_peer();
if (!$mnet_peer->set_id($mnethostid)) {
print_error('hostcoursenotfound','mnet');
}
$course = get_record('mnet_enrol_course', 'id', $courseid, 'hostid', $mnet_peer->id);
if (empty($course)) {
print_error('hostcoursenotfound','mnet');
}
define("MAX_USERS_PER_PAGE", 5000);
$add = optional_param('add', 0, PARAM_BOOL);
$remove = optional_param('remove', 0, PARAM_BOOL);
$showall = optional_param('showall', 0, PARAM_BOOL);
$searchtext = optional_param('searchtext', '', PARAM_RAW); // search string
$previoussearch = optional_param('previoussearch', 0, PARAM_BOOL);
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
$errors = array();
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
$baseurl = "remote_enrolment.php?courseid={$course->id}&amp;host={$mnet_peer->id}";
if (!empty($userid)) {
$baseurl .= '&amp;userid='.$userid;
}
/// Process incoming role assignment
if ($frm = data_submitted()) {
if ($add and !empty($frm->addselect) and confirm_sesskey()) {
$timemodified = time();
foreach ($frm->addselect as $adduser) {
if (!$adduser = clean_param($adduser, PARAM_INT)) {
continue;
}
if (! $enrolment->req_enrol_user($adduser, $course->id)) {
$errors[] = "Could not add user with id $adduser to course {$course->id}!";
}
}
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
foreach ($frm->removeselect as $removeuser) {
$removeuser = clean_param($removeuser, PARAM_INT);
if (! $enrolment->req_unenrol_user($removeuser, $course->id)) {
$errors[] = "Could not remove user with id $removeuser from course {$course->id}!";
}
}
} else if ($showall) {
$searchtext = '';
$previoussearch = 0;
}
}
/// Prepare data for users / enrolled users panes
/// Create a new request object
$mnet_request = new mnet_xmlrpc_client();
/// Pass it the path to the method that we want to execute
$mnet_request->set_method('enrol/mnet/enrol.php/course_enrolments');
$mnet_request->add_param($course->remoteid, 'int');
$mnet_request->send($mnet_peer);
$all_enrolled_users = $mnet_request->response;
unset($mnet_request);
$select = '';
$all_enrolled_usernames = '';
$timemodified = array();
/// List all the users (homed on this server) who are enrolled on the course
/// This will include mnet-enrolled users, and those who have enrolled
/// themselves, etc.
if (is_array($all_enrolled_users) && count($all_enrolled_users)) {
foreach($all_enrolled_users as $username => $data) {
$all_enrolled_usernames .= "'$username', ";
}
$select = ' u.username IN (' .substr($all_enrolled_usernames, 0, -2) .') AND ';
} else {
$all_enrolled_users = array();
}
/// Synch our mnet_enrol_assignments with remote server
$sql = "
SELECT
u.id,
u.firstname,
u.lastname,
u.username,
u.email,
a.enroltype,
a.id as enrolid,
COALESCE(a.hostid, 0) as wehaverecord,
a.courseid
FROM
{$CFG->prefix}user u
LEFT JOIN
{$CFG->prefix}mnet_enrol_assignments a
ON
a.userid = u.id AND a.courseid={$courseid}
WHERE
$select
u.deleted = 0 AND
u.confirmed = 1 AND
u.mnethostid = {$CFG->mnet_localhost_id}
ORDER BY
u.firstname ASC,
u.lastname ASC";
if (!$enrolledusers = get_records_sql($sql)) {
$enrolledusers = array();
}
foreach($enrolledusers as $user) {
$dataobj = new stdClass();
$dataobj->userid = $user->id;
$dataobj->hostid = $mnet_peer->id;
$dataobj->courseid = $courseid;
$dataobj->rolename = $all_enrolled_users[$user->username]['name'];
$dataobj->enroltype = $all_enrolled_users[$user->username]['enrol'];
if ($user->wehaverecord == 0) {
$dataobj->enroltime = $all_enrolled_users[$user->username]['timemodified'];
$dataobj->id = insert_record('mnet_enrol_assignments', $dataobj);
} elseif (array_key_exists($user->username, $all_enrolled_users)) {
$dataobj->id = $user->enrolid;
update_record('mnet_enrol_assignments', $dataobj);
} elseif (is_array($all_enrolled_users) && count($all_enrolled_users)) {
delete_record('mnet_enrol_assignments', 'id', $user->enrolid);
}
}
unset($enrolledusers);
// Read about our remote enrolments in 2 sets
// first, get the remote enrolments done via enrol/mnet $mnetenrolledusers
// second, get the remote enrolments done with other plugins $remtenrolledusers
// NOTE: both arrays are keyed on the userid!
$sql = "
SELECT
u.id,
u.firstname,
u.lastname,
a.rolename,
a.enroltype,
a.courseid
FROM
{$CFG->prefix}user u,
{$CFG->prefix}mnet_enrol_assignments a
WHERE
a.userid = u.id AND
a.courseid={$courseid} AND
a.enroltype = 'mnet' AND
u.deleted = 0 AND
u.confirmed = 1 AND
u.mnethostid = {$CFG->mnet_localhost_id}
ORDER BY
u.firstname ASC,
u.lastname ASC";
if (!$mnetenrolledusers = get_records_sql($sql)) {
$mnetenrolledusers = array();
}
$sql = "
SELECT
u.id,
u.firstname,
u.lastname,
a.rolename,
a.enroltype,
a.courseid
FROM
{$CFG->prefix}user u,
{$CFG->prefix}mnet_enrol_assignments a
WHERE
a.userid = u.id AND
a.courseid={$courseid} AND
a.enroltype != 'mnet' AND
u.deleted = 0 AND
u.confirmed = 1 AND
u.mnethostid = {$CFG->mnet_localhost_id}
ORDER BY
u.firstname ASC,
u.lastname ASC";
if (!$remtenrolledusers = get_records_sql($sql)) {
$remtenrolledusers = array();
}
$select = '';
$exclude = array_merge(array_keys($mnetenrolledusers), array_keys($remtenrolledusers));
$exclude[] = 0;
$select = 'AND u.username!=\'guest\' AND u.id NOT IN ('. join(',',$exclude) .') ';
unset($exclude);
$searchtext = trim($searchtext);
if ($searchtext !== '') { // Search for a subset of remaining users
$LIKE = sql_ilike();
$FULLNAME = sql_fullname();
$select .= " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
}
$sql = ('SELECT id, firstname, lastname, email
FROM '.$CFG->prefix.'user u
WHERE deleted = 0 AND confirmed = 1
AND mnethostid = '.$CFG->mnet_localhost_id.' '
.$select
.'ORDER BY lastname ASC, firstname ASC');
$availableusers = get_recordset_sql($sql, 0, MAX_USERS_PER_PAGE);
/// Print the page
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
/// Get some language strings
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strroletoassign = get_string('roletoassign', 'role');
$strcurrentcontext = get_string('currentcontext', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');
$strparticipants = get_string('participants');
$strsearchresults = get_string('searchresults');
admin_externalpage_print_header();
print_box('<strong>' . s($mnet_peer->name) . ' : '
. format_string($course->shortname) .' '. format_string($course->fullname)
. '</strong><br />'
. get_string("enrolcourseenrol_desc", "mnet"));
echo "<hr />";
include(dirname(__FILE__).'/enr_course_enrol.html');
if (!empty($errors)) {
$msg = '<p>';
foreach ($errors as $e) {
$msg .= $e.'<br />';
}
$msg .= '</p>';
notify($msg);
}
admin_externalpage_print_footer();
?>
+57
View File
@@ -0,0 +1,57 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
$mnethost = required_param('host', PARAM_INT);
$host = get_record('mnet_host', 'id', $mnethost);
$courses = $enrolment->fetch_remote_courses($mnethost);
/// Print the page
admin_externalpage_print_header();
print_box('<strong>' . s($host->name) . ' </strong><br />'
. get_string("enrolcourses_desc", "mnet"));
echo '<hr />';
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
. '<table class="generaltable">';
$icon = "<img src=\"$CFG->pixpath/i/course.gif\"".
" class=\"icon\" alt=\"".get_string("course")."\" />";
foreach ($courses as $course) {
$link = "$CFG->wwwroot/$CFG->admin/mnet/enr_course_enrol.php?"
. "host={$mnethost}&amp;courseid={$course->id}&amp;sesskey={$USER->sesskey}";
echo '<tr>'
. "<td>$icon</td>"
. "<td><a href=\"$link\">".format_string($course->fullname). "</a></td>"
. '</tr><tr>'
. '<td></td>'
. '<td>'.format_string($course->shortname). ' - ' .format_string($course->cat_name).'</td>'
. '</tr><tr>'
. '<td></td>'
. "<td align=\"left\" >{$course->summary}</td>"
. '</tr>';
}
echo '</table></div>';
admin_externalpage_print_footer();
?>
+61
View File
@@ -0,0 +1,61 @@
<?PHP // $Id$
// enrol_config.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling.
require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
/// Otherwise fill and print the form.
/// get language strings
admin_externalpage_print_header();
print_box(get_string("remoteenrolhosts_desc", "mnet"));
echo '<hr />';
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
print_box(get_string('mnetdisabled','mnet'));
}
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
. '<table cellspacing="0" cellpadding="5" id="hosts" class="generaltable generalbox" >'
. '<tr>'
. '<th class="header c0"> '.get_string('host', 'mnet').' </th>'
. '<th class="header c1"> '.get_string('enrolments', 'mnet').' </th>'
. '<th class="header c2"> '.get_string('courses', 'mnet').' </th>'
// . '<th class="header c3"> &nbsp; </th>'
. '</tr>';
$hosts = $enrolment->list_remote_servers();
foreach ($hosts as $host) {
$coursesurl = "$CFG->wwwroot/$CFG->admin/mnet/enr_courses.php?host={$host->id}&amp;sesskey={$USER->sesskey}";
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
if (empty($coursecount)) {
$coursecount = '?';
}
$enrolcount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_assignments WHERE hostid={$host->id}");
echo '<tr>'
. "<td><a href=\"{$coursesurl}\">{$host->name}</a></td>"
. "<td align=\"center\" >$enrolcount</td>"
. "<td align=\"center\" >$coursecount - <a href=\"{$coursesurl}\">".get_string('editenrolments', 'mnet')."</a></td>"
// TODO: teach report/log/index.php to show per-host-logs
// . '<td align="center" ><a href="$CFG->wwwroot/$CFG->admin/report/log/index.php?course_host={$host->id}">'
// . get_string('logs', 'mnet').'</a> </td>'
. '</tr>';
}
echo '</table>'
. '</div>';
admin_externalpage_print_footer();
?>
+48 -30
View File
@@ -1,4 +1,4 @@
<?PHP
<?PHP // $Id$
// Allows the admin to configure mnet stuff
@@ -13,19 +13,23 @@
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$site = get_site();
$mnet = get_mnet_environment();
if (!extension_loaded('openssl')) {
echo $OUTPUT->header();
admin_externalpage_print_header();
set_config('mnet_dispatcher_mode', 'off');
print_error('requiresopenssl', 'mnet');
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
if (!$site = get_site()) {
admin_externalpage_print_header();
set_config('mnet_dispatcher_mode', 'off');
print_error('nosite', '', '', NULL, true);
}
if (!function_exists('curl_init') ) {
echo $OUTPUT->header();
admin_externalpage_print_header();
set_config('mnet_dispatcher_mode', 'off');
print_error('nocurl', 'mnet');
print_error('nocurl', 'mnet', '', NULL, true);
}
if (!isset($CFG->mnet_dispatcher_mode)) {
@@ -39,29 +43,32 @@
if (set_config('mnet_dispatcher_mode', $form->mode)) {
redirect('index.php', get_string('changessaved'));
} else {
print_error('invalidaction', '', 'index.php');
error('Invalid action parameter.', 'index.php');
}
}
} elseif (!empty($form->submit) && $form->submit == get_string('delete')) {
$mnet->get_private_key();
$SESSION->mnet_confirm_delete_key = md5(sha1($mnet->keypair['keypair_PEM'])).':'.time();
$formcontinue = new single_button(new moodle_url('index.php', array('confirm' => md5($mnet->public_key))), get_string('yes'));
$formcancel = new single_button(new moodle_url('index.php', array()), get_string('no'));
echo $OUTPUT->confirm(get_string("deletekeycheck", "mnet"), $formcontinue, $formcancel);
$MNET->get_private_key();
$_SESSION['mnet_confirm_delete_key'] = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time();
notice_yesno(get_string("deletekeycheck", "mnet"),
"index.php?sesskey=$USER->sesskey&amp;confirm=".md5($MNET->public_key),
"index.php",
array('sesskey' => $USER->sesskey),
NULL,
'post',
'get');
exit;
} else {
// We're deleting
if (!isset($SESSION->mnet_confirm_delete_key)) {
if (!isset($_SESSION['mnet_confirm_delete_key'])) {
// fail - you're being attacked?
}
$key = '';
$time = '';
@list($key, $time) = explode(':',$SESSION->mnet_confirm_delete_key);
$mnet->get_private_key();
@list($key, $time) = explode(':',$_SESSION['mnet_confirm_delete_key']);
$MNET->get_private_key();
if($time < time() - 60) {
// fail - you're out of time.
@@ -69,36 +76,45 @@
exit;
}
if ($key != md5(sha1($mnet->keypair['keypair_PEM']))) {
if ($key != md5(sha1($MNET->keypair['keypair_PEM']))) {
// fail - you're being attacked?
print_error ('deletewrongkeyvalue', 'mnet', 'index.php');
exit;
}
$mnet->replace_keys();
$MNET->replace_keys();
redirect('index.php', get_string('keydeleted','mnet'));
exit;
}
}
$hosts = $DB->get_records_select('mnet_host', "id <> ? AND deleted = 0", array($CFG->mnet_localhost_id), 'wwwroot ASC');
$hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' );
echo $OUTPUT->header();
admin_externalpage_print_header();
?>
<center>
<form method="post" action="index.php">
<table align="center" width="635" class="generalbox" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header"><?php print_string('aboutyourhost', 'mnet'); ?></td>
<td colspan="2" class="header" cellpadding="0"><?php print_string('aboutyourhost', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('publickey', 'mnet'); ?>:</td>
<td><pre><?php echo $mnet->public_key; ?></pre></td>
<td><pre><?php echo $MNET->public_key; ?></pre></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('expires', 'mnet'); ?>:</td>
<td><?php echo userdate($mnet->public_key_expires); ?></td>
<td><?php echo userdate($MNET->public_key_expires); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('net', 'mnet'); ?>:</td>
<td><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="radio" name="mode" value="off" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('off', 'mnet'); ?> <br />
<input type="radio" name="mode" value="strict" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('on', 'mnet'); ?><br />
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
</td>
</tr>
</table>
</td>
@@ -111,14 +127,14 @@
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header"><?php print_string('expireyourkey', 'mnet'); ?></td>
<td colspan="2" class="header" cellpadding="0"><?php print_string('expireyourkey', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td colspan="2"><?php print_string('expireyourkeyexplain', 'mnet'); ?></td>
<td colspan="2" cellpadding="0"><?php print_string('expireyourkeyexplain', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td align="left" width="10" nowrap="nowrap"><?php print_string('expireyourkey', 'mnet'); ?></td>
<td align="left"><input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
<td align="left"><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="deleteKey" value="" />
<input type="submit" name="submit" value="<?php print_string('delete'); ?>" />
</td>
@@ -128,6 +144,8 @@
</tr>
</table>
</form>
</center>
<?php
echo $OUTPUT->footer();
admin_externalpage_print_footer();
?>
+140
View File
@@ -0,0 +1,140 @@
<?php
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
admin_externalpage_print_header();
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
if ($mnet_peer->application->name == 'moodle') {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
} else {
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
}
print_tabs(array($tabs), 'mnetdetails');
print_simple_box_start("center", "");
?>
<form method="post" action="peers.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="step" value="commit" />
<input type="hidden" name="last_connect_time" value="<?php echo $mnet_peer->last_connect_time; ?>" />
<input type="hidden" name="id" value="<?php echo isset($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
<input type="hidden" name="applicationid" value="<?php echo isset($mnet_peer->applicationid)? $mnet_peer->applicationid : '0' ; ?>" />
<input type="hidden" name="applicationname" value="<?php echo isset($mnet_peer->application->name)? $mnet_peer->application->name : '' ; ?>" />
<table cellpadding="9" cellspacing="0" width="635">
<tr>
<td align="right" valign="top"><?php print_string('site'); ?>:</td>
<td valign="top"><input type="text" name="name" size="30" value="<?php echo $mnet_peer->name; ?>" /></td>
</tr>
<tr>
<td align="right" valign="top"><?php print_string('hostname', 'mnet'); ?>:</td>
<td valign="top"><input type="text" name="wwwroot" size="30" value="<?php echo $mnet_peer->wwwroot; ?>" /></td>
</tr>
<?php
if (empty($mnet_peer->public_key)) $mnet_peer->public_key = '';
?>
<tr>
<td align="right" valign="top"><?php
print_string('publickey', 'mnet');
echo ': <br />';
helpbutton("publickey", get_string('publickey', 'mnet'), "mnet", true, true);
?></td>
<?php
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0) {
$key = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application->xmlrpc_server_url);
$mnet_peer->public_key = clean_param($key, PARAM_PEM);
}
?>
<td valign="top">
<?php
if (empty($mnet_peer->public_key)) {
print_string('nopubkey', 'mnet');
}
?><br />
<textarea rows="17" cols="65" name="public_key" style="font-size: 8px;"><?php echo $mnet_peer->public_key; ?></textarea>
</td>
</tr>
<tr>
<td align="right" valign="top"><?php print_string('expires', 'mnet'); ?>:</td>
<td valign="top">
<?php
if($mnet_peer->public_key_expires < time()) {
print_string('expired', 'mnet');
echo ' ';
}
echo userdate($mnet_peer->public_key_expires);
?>
</td>
</tr>
<?php
if(!empty($currentkey)) {
?>
<tr>
<td align="right" valign="top"></td>
<td valign="top"><?php print_string('keymismatch', 'mnet'); ?></td>
</tr>
<tr>
<td align="right" valign="top"><?php print_string('currentkey', 'mnet'); ?>:</td>
<td valign="top"><pre style="font-size: 8px;"><?php echo $currentkey;?></pre></td>
</tr>
<?php
}
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
?>
<tr>
<td align="right" valign="top"><?php print_string('last_connect_time', 'mnet'); ?>:</td>
<td valign="top"><?php echo ($mnet_peer->last_connect_time == 0)? get_string('never','mnet') : date('H:i:s d/m/Y',$mnet_peer->last_connect_time);?></td>
</tr>
<?php
}
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0){
?>
<tr>
<td align="right" valign="top"><?php print_string('deleted'); ?>:</td>
<td valign="top">
<input type="radio" name="deleted" value="0" checked="checked" /> <?php print_string('reenableserver','mnet'); ?><br />
<input type="radio" name="deleted" value="1" /> <?php print_string('yes'); ?><br />
</td>
</tr>
<?php
}
if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
?>
<tr>
<td align="right" valign="top"><?php print_string('ipaddress', 'mnet');
echo ': <br />';
helpbutton("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true, true);
?>:</td>
<td valign="top"><?php echo $mnet_peer->ip_address; ?></td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td><input type="submit" value="<?php print_string("savechanges"); ?>" /></td>
</tr>
</table>
</div>
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
admin_externalpage_print_header();
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
print_tabs(array($tabs), 'mnetdetails');
print_simple_box_start("center", "");
?>
<table cellpadding="9" cellspacing="0" >
<tr>
<td align="right" valign="top"><?php print_string('site'); ?>:</td>
<td valign="top"><?php echo $mnet_peer->name; ?></td>
</tr>
<tr>
<td align="right" valign="top" colspan="2"><?php print_string('allhosts_no_options'); ?>:</td>
</tr>
</table>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
+103
View File
@@ -0,0 +1,103 @@
<?php
admin_externalpage_print_header();
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
if ($mnet_peer->id != $CFG->mnet_all_hosts_id && $mnet_peer->application->name == 'moodle') {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
print_tabs(array($tabs), 'mnetservices');
print_simple_box_start("center", "");
?>
<form method="post" action="mnet_services.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="step" value="<?php echo $mnet_peer->nextstep; ?>" />
<input type="hidden" name="hostid" value="<?php echo ($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
<table cellpadding="9" cellspacing="0" >
<?php
foreach($myservices as $name => $versions) {
$version = current($versions);
?>
<tr>
<td align="left" valign="top" colspan="2">
<h3><?php echo get_string($name.'_name', $version['parent_type'].'_'.$version['parent'] , $mnet_peer->name); ?></h3>
<?php echo get_string($name.'_description', $version['parent_type'].'_'.$version['parent'], $mnet_peer->name); ?>
<?php
$breakstring = '';
foreach($versions as $version){
if (count($versions) > 1) {
$versionstring = '('.get_string('version','mnet') .' '.$version['apiversion'].')';
} else {
$versionstring = '';
}
echo $breakstring;
?>
<input type="hidden" name="exists[<?php echo $version['serviceid']; ?>]" value="1" />
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked="checked" ': '' ; ?>/>
<?php
print_string('publish','mnet');
echo $versionstring;
if (!empty($version['hostsubscribes'])) {
echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">&radic;</a> ';
}
if (!empty($version['allhosts_publish'])) {
print_string("enabled_for_all",'mnet',!empty($version['I_publish']));
}
echo '<br />';
?>
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked="checked" ': '' ; ?>/>
<?php
print_string('subscribe','mnet');
echo $versionstring;
if (!empty($version['hostpublishes'])) {
echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">&radic;</a> ';
}
if (!empty($version['allhosts_subscribe'])) {
print_string("enabled_for_all",'mnet',!empty($version['I_subscribe']));
}
echo '<br />';
$breakstring = '. . . . . . . . . . . . . . . . . . . . . . . . <br>';
} // end foreach
?>
</td>
</tr>
<?php
} // end foreach
?>
<tr>
<td align="left" valign="top" colspan="2">
<div id="pubTreeLoc"></div>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">
<div id="subTreeLoc"></div>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">
<div id="formElements"><input type="hidden" name="outer" value="4" /></div>
</td>
</tr>
</table>
</div>
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer();
?>
+183
View File
@@ -0,0 +1,183 @@
<?php
// Allows the admin to configure services for remote hosts
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!$site = get_site()) {
print_error('nosite', '', '', NULL, true);
}
/// Initialize variables.
// Step must be one of:
// input Parse the details of a new host and fetch its public key
// commit Save our changes (to a new OR existing host)
// force Go ahead with something we've been warned is strange
$step = optional_param('step', NULL, PARAM_ALPHA);
$hostid = optional_param('hostid', NULL, PARAM_INT);
$nocertstring = '';
$nocertmatch = '';
$badcert = '';
$certerror = '';
$noipmatch = '';
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmnetsettings = get_string('mnetsettings', 'mnet');
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetthemes = get_string('mnetthemes', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$strmneteditservices = get_string('reviewhostservices', 'mnet');
$mnet_peer = new mnet_peer();
if (($form = data_submitted()) && confirm_sesskey()) {
$mnet_peer->set_id($hostid);
$treevals = array();
foreach($_POST['exists'] as $key => $value) {
$host2service = get_record('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
$publish = (isset($_POST['publish'][$key]) && $_POST['publish'][$key] == 'on')? 1 : 0;
$subscribe = (isset($_POST['subscribe'][$key]) && $_POST['subscribe'][$key] == 'on')? 1 : 0;
if ($publish != 1 && $subscribe != 1) {
if (false == $host2service) {
// We don't have or need a record - do nothing!
} else {
// We don't need the record - delete it
delete_records('mnet_host2service', 'hostid', $_POST['hostid'], 'serviceid', $key);
}
} elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
$host2service = new stdClass();
$host2service->hostid = $_POST['hostid'];
$host2service->serviceid = $key;
$host2service->publish = $publish;
$host2service->subscribe = $subscribe;
$host2service->id = insert_record('mnet_host2service', $host2service);
} elseif ($host2service->publish != $publish || $host2service->subscribe != $subscribe) {
$host2service->publish = $publish;
$host2service->subscribe = $subscribe;
$tf = update_record('mnet_host2service', $host2service);
}
}
}
if (is_int($hostid)) {
if (0 == $mnet_peer->id) $mnet_peer->set_id($hostid);
$mnet_peer->nextstep = 'verify';
$id_list = $mnet_peer->id;
if (!empty($CFG->mnet_all_hosts_id)) {
$id_list .= ', '.$CFG->mnet_all_hosts_id;
}
$concat = sql_concat('COALESCE(h2s.id,0) ', ' \'-\' ', ' svc.id');
$query = "
SELECT DISTINCT
$concat as id,
svc.id as serviceid,
svc.name,
svc.offer,
svc.apiversion,
r.parent_type,
r.parent,
h2s.hostid,
h2s.publish,
h2s.subscribe
FROM
{$CFG->prefix}mnet_service2rpc s2r,
{$CFG->prefix}mnet_rpc r,
{$CFG->prefix}mnet_service svc
LEFT JOIN
{$CFG->prefix}mnet_host2service h2s
ON
h2s.hostid in ($id_list) AND
h2s.serviceid = svc.id
WHERE
svc.offer = '1' AND
s2r.serviceid = svc.id AND
s2r.rpcid = r.id
ORDER BY
svc.name ASC";
$resultset = get_records_sql($query);
if (is_array($resultset)) {
$resultset = array_values($resultset);
} else {
$resultset = array();
}
require_once $CFG->dirroot.'/mnet/xmlrpc/client.php';
$remoteservices = array();
if ($hostid != $CFG->mnet_all_hosts_id) {
// Create a new request object
$mnet_request = new mnet_xmlrpc_client();
// Tell it the path to the method that we want to execute
$mnet_request->set_method('system/listServices');
$mnet_request->send($mnet_peer);
if (is_array($mnet_request->response)) {
foreach($mnet_request->response as $service) {
$remoteservices[$service['name']][$service['apiversion']] = $service;
}
}
}
$myservices = array();
foreach($resultset as $result) {
$result->hostpublishes = false;
$result->hostsubscribes = false;
if (isset($remoteservices[$result->name][$result->apiversion])) {
if ($remoteservices[$result->name][$result->apiversion]['publish'] == 1) {
$result->hostpublishes = true;
}
if ($remoteservices[$result->name][$result->apiversion]['subscribe'] == 1) {
$result->hostsubscribes = true;
}
}
if (empty($myservices[$result->name][$result->apiversion])) {
$myservices[$result->name][$result->apiversion] = array('serviceid' => $result->serviceid,
'name' => $result->name,
'offer' => $result->offer,
'apiversion' => $result->apiversion,
'parent_type' => $result->parent_type,
'parent' => $result->parent,
'hostsubscribes' => $result->hostsubscribes,
'hostpublishes' => $result->hostpublishes
);
}
// allhosts_publish allows us to tell the admin that even though he
// is disabling a service, it's still available to the host because
// he's also publishing it to 'all hosts'
if ($result->hostid == $CFG->mnet_all_hosts_id && $CFG->mnet_all_hosts_id != $mnet_peer->id) {
$myservices[$result->name][$result->apiversion]['allhosts_publish'] = $result->publish;
$myservices[$result->name][$result->apiversion]['allhosts_subscribe'] = $result->subscribe;
} elseif (!empty($result->hostid)) {
$myservices[$result->name][$result->apiversion]['I_publish'] = $result->publish;
$myservices[$result->name][$result->apiversion]['I_subscribe'] = $result->subscribe;
}
}
} else {
redirect('peers.php', get_string('nohostid','mnet'), '5');
exit;
}
include('./mnet_services.html');
?>
+128
View File
@@ -0,0 +1,128 @@
<?php
admin_externalpage_print_header($adminroot);
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
$tabs[] = new tabobject('mnetthemes', 'mnet_themes.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetthemes, $strmnetthemes, false);
if ($mnet_peer->id != $CFG->mnet_all_hosts_id) $tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
print_tabs(array($tabs), 'mnetthemes');
print_simple_box_start("center", "");
print_heading($strthemes);
$themes = get_list_of_plugins("theme");
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">";
if (count($report)) {
echo '<tr>';
echo '<td align="center" colspan="2">';
echo '<span class="'.$report[1].'">'.$report[0].'</span>';
echo '</td>';
echo '</tr>';
}
if (!$USER->screenreader) {
echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th>";
echo "<th scope=\"col\">$strinfo</th></tr>";
}
echo "<tr>";
echo '<td align="center"><span class="informationbox">Choose this option to use your site\'s default theme: <strong>'.$CFG->theme.'</strong>.</span></td>';
if ($mnet_peer->theme == '') {
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
} else {
echo '<td valign="top">';
}
echo '<p style="font-size:1.5em;font-style:bold;">Site Theme</p>';
$options = null;
$options['choose'] = $unlikely_name;// Something unlikely to ever be a theme name... initially $unlikely_name = 'ZoqZoqZ';
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
print_single_button('mnet_themes.php', $options, $strchoose);
echo '</td>';
echo "</tr>";
foreach ($themes as $theme) {
unset($THEME);
if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder
continue;
}
include($CFG->themedir.'/'.$theme.'/config.php');
$readme = '';
$screenshot = '';
$screenshotpath = '';
if (file_exists($CFG->themedir.'/'.$theme.'/README.html')) {
$readme = '<li>'.
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
} else if (file_exists($CFG->themedir.'/'.$theme.'/README.txt')) {
$readme = '<li>'.
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
}
if (file_exists("$theme/screenshot.png")) {
$screenshotpath = "$theme/screenshot.png";
} else if (file_exists("$theme/screenshot.jpg")) {
$screenshotpath = "$theme/screenshot.jpg";
}
echo "<tr>";
// no point showing this if user is using screen reader
if (!$USER->screenreader) {
echo "<td align=\"center\">";
if ($screenshotpath) {
$screenshot = '<li><a href='.$CFG->wwwroot .'/theme/'. $theme.'/screenshot.jpg">'.$strscreenshot.'</a></li>';
echo "<object type=\"text/html\" data=\"$screenshotpath\" height=\"200\" width=\"400\">$theme</object></td>";
} else {
echo '<object type="text/html" data="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'" height="200" width="400">'.$theme.'</object></td>';
}
}
if ($mnet_peer->theme == $theme) {
echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
} else {
echo '<td valign="top">';
}
if (isset($THEME->sheets)) {
echo '<p style="font-size:1.5em;font-style:bold;">'.$theme.'</p>';
} else {
echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
}
if ($screenshot or $readme) {
echo '<ul>';
if (!$USER->screenreader) {
echo '<li><a href="'.$CFG->wwwroot.'/theme/preview.php?preview='.$theme.'">'.$strpreview.'</a></li>';
}
echo $screenshot.$readme;
echo '</ul>';
}
$options = null;
$options['choose'] = $theme;
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
print_single_button('mnet_themes.php', $options, $strchoose);
echo '</td>';
echo "</tr>";
}
echo "</table>";
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
?>
+79
View File
@@ -0,0 +1,79 @@
<?php
// Allows the admin to configure services for remote hosts
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
error_reporting(E_ALL);
ini_set('display_errors', true);
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!$site = get_site()) {
print_error('nosite', '', '', NULL, true);
}
/// Initialize variables.
$hostid = required_param('hostid', PARAM_INT);
$stradministration = get_string('administration');
$strconfiguration = get_string('configuration');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$strmnetsettings = get_string('mnetsettings', 'mnet');
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetthemes = get_string('mnetthemes', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$mnet_peer = new mnet_peer();
if (is_int($hostid)) {
$mnet_peer->set_id($hostid);
}
$choose = optional_param("choose",'',PARAM_FILE); // set this theme as default
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strthemes = get_string("themes");
$strpreview = get_string("preview");
$strchoose = get_string("choose");
$strinfo = get_string("info");
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
$strscreenshot = get_string("screenshot");
$stroldtheme = get_string("oldtheme");
$report = array();
$unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
if ($choose) {
if (confirm_sesskey()) {
if ($choose == $unlikely_name) {
$mnet_peer->force_theme = 1;
$mnet_peer->theme = '';
if ($mnet_peer->commit()) {
$report = array(get_string('themesaved'), 'informationbox');
} else {
$report = array(get_string('themesavederror', 'mnet'), 'errorbox');
}
} elseif (!is_dir($CFG->themedir .'/'. $choose) || !file_exists($CFG->themedir .'/'. $choose .'/config.php')) {
echo 'CHOOSE -'.$choose.' '. $CFG->themedir .'/'. $choose .'/config.php' ;
$report = array('This theme is not installed!'.'3', 'errorbox');
} else {
$mnet_peer->force_theme = 1;
$mnet_peer->theme = addslashes($choose);
if ($mnet_peer->commit()) {
$report = array(get_string('themesaved').'1', 'informationbox');
} else {
$report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
}
}
}
}
include('./mnet_themes.html');
?>
-167
View File
@@ -1,167 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains two forms for adding/editing mnet hosts, used by peers.php
*
* @package core
* @subpackage mnet
* @copyright 2010 Penny Leach
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/formslib.php');
/**
* The very basic first step add new host form - just wwwroot & application
* The second form is loaded up with the information from this one.
*/
class mnet_simple_host_form extends moodleform {
function definition() {
global $DB;
$mform = $this->_form;
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
$mform->setType('wwwroot', PARAM_URL);
$mform->addRule('wwwroot', null, 'required', null, 'client');
$mform->addElement('select', 'applicationid', get_string('applicationtype', 'mnet'),
$DB->get_records_menu('mnet_application', array(), 'id,display_name'));
$mform->addRule('applicationid', null, 'required', null, 'client');
$this->add_action_buttons(false, get_string('addhost', 'mnet'));
}
function validation($data) {
global $DB;
$wwwroot = $data['wwwroot'];
// ensure the wwwroot starts with a http or https prefix
if (strtolower(substr($wwwroot, 0, 4)) != 'http') {
$wwwroot = 'http://'.$wwwroot;
}
if ($host = $DB->get_record('mnet_host', array('wwwroot' => $wwwroot))) {
global $CFG;
return array('wwwroot' => get_string('hostexists', 'mnet', $CFG->wwwroot . '/admin/mnet/peers.php?hostid=' . $host->id));
}
return array();
}
}
/**
* The second step of the form - reviewing the host details
* This is also the same form that is used for editing an existing host
*/
class mnet_review_host_form extends moodleform {
function definition() {
global $OUTPUT;
$mform = $this->_form;
$mnet_peer = $this->_customdata['peer'];
$mform->addElement('hidden', 'last_connect_time');
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'applicationid');
$mform->addElement('hidden', 'oldpublickey');
$mform->addElement('text', 'name', get_string('site'));
$mform->setType('name', PARAM_NOTAGS);
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
$mform->setType('wwwroot', PARAM_URL);
$themes = array('' => get_string('forceno'));
foreach (array_keys(get_plugin_list('theme')) as $themename) {
$themes[$themename] = get_string('pluginname', 'theme_'.$themename);
}
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
$mform->addElement('textarea', 'public_key', get_string('publickey', 'mnet'), array('rows' => 17, 'cols' => 100, 'class' => 'smalltext'));
$mform->setType('public_key', PARAM_PEM);
if ($mnet_peer && !empty($mnet_peer->deleted)) {
$radioarray = array();
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' '), false);
} else {
$mform->addElement('hidden', 'deleted');
}
// finished with form controls, now the static informational stuff
if ($mnet_peer && !empty($mnet_peer->bootstrapped)) {
$expires = '';
if ($mnet_peer->public_key_expires < time()) {
$expires = get_string('expired', 'mnet') . ' ';
}
$expires .= userdate($mnet_peer->public_key_expires);
$mform->addElement('static', 'validuntil', get_string('expires', 'mnet'), $expires);
$lastconnect = '';
if ($mnet_peer->last_connect_time == 0) {
$lastconnect = get_string('never', 'mnet');
} else {
$lastconnect = date('H:i:s d/m/Y',$mnet_peer->last_connect_time);
}
$mform->addElement('static', 'lastconnect', get_string('last_connect_time', 'mnet'), $lastconnect);
$mform->addElement('static', 'ipaddress', get_string('ipaddress', 'mnet'), $mnet_peer->ip_address);
if (isset($mnet_peer->currentkey)) { // key being published is not the same as our records
$currentkeystr = '<b>' . get_string('keymismatch', 'mnet') . '</b><br /><br /> ' . $OUTPUT->box('<pre>' . $mnet_peer->currentkey . '</pre>');
$mform->addElement('static', 'keymismatch', get_string('currentkey', 'mnet'), $currentkeystr);
}
$credstr = '';
if ($credentials = $mnet_peer->check_credentials($mnet_peer->public_key)) {
foreach($credentials['subject'] as $key => $credential) {
if (is_scalar($credential)) {
$credstr .= str_pad($key, 16, " ", STR_PAD_LEFT).': '.$credential."\n";
} else {
$credstr .= str_pad($key, 16, " ", STR_PAD_LEFT).': '.var_export($credential,1)."\n";
}
}
}
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'), $OUTPUT->box('<pre>' . $credstr . '</pre>'));
}
// finished with static stuff, print save button
$this->add_action_buttons(false);
}
function validation($data) {
$errors = array();
if ($data['oldpublickey'] == $data['public_key']) {
return;
}
$mnet_peer = new mnet_peer(); // idiotic api
$mnet_peer->wwwroot = $data['wwwroot']; // just hard-set this rather than bootstrap the object
if (!$credentials = $mnet_peer->check_credentials($data['public_key'])) {
$errmsg = '';
foreach ($mnet_peer->error as $err) {
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
}
$errors['public_key'] = get_string('invalidpubkey', 'mnet', $errmsg);
}
unset($mnet_peer);
return $errors;
}
}
+101
View File
@@ -0,0 +1,101 @@
<?php
admin_externalpage_print_header();
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
print_box(get_string('mnetdisabled','mnet'));
}
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<form method="post" action="peers.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="updateregisterall" value="1" />
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
<tr>
<th class="header c0" colspan="2"><?php print_string('registerallhosts', 'mnet'); ?></th>
</tr>
<tr>
<td class="cell c1" colspan="2"><?php print_string('registerallhostsexplain', 'mnet'); ?></td>
</tr>
<tr>
<td class="cell c1"><input type="checkbox" name="registerallhosts" <?php if (!empty($CFG->mnet_register_allhosts)) echo 'checked="checked" '; ?>/></td>
<td class="cell c1"> <?php print_string('registerallhosts', 'mnet'); ?> </td>
</tr>
<tr>
<td align="right" colspan="2"><input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" /></td>
</tr>
</table>
</div>
</form>
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
<tr>
<th class="header c0"><?php print_string('site'); ?></th>
<th class="header c1"><?php print_string('system','mnet'); ?></th>
<th class="header c2"><?php print_string('last_connect_time', 'mnet'); ?></th>
<th class="header c3"></th>
</tr>
<?php
foreach($hosts as $host) {
if ($host->last_connect_time == 0) {
$last_connect = get_string('never');
} else {
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
}
?>
<tr>
<td class="cell c0"><a href="peers.php?step=update&amp;hostid=<?php echo $host->id; ?>"><?php echo $host->name; ?></a></td>
<td class="cell c1"><a href="peers.php?step=update&amp;hostid=<?php echo $host->id; ?>"><?php echo $host->wwwroot; ?></a></td>
<td class="cell c2"><?php if ($host->id != $CFG->mnet_all_hosts_id) echo $last_connect; ?></td>
<td class="cell c3">
<?php if ($host->id != $CFG->mnet_all_hosts_id){ ?>
<form method="post" action="delete.php">
<div>
<input type="hidden" name="hostid" value="<?php echo $host->id; ?>" />
<input type="hidden" name="step" value="verify" />
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
</div>
</form>
<?php } ?>
</td>
</tr>
<?php
}
?>
</table>
<form method="post" action="peers.php">
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
<tr>
<th class="header c4" colspan="4">
<?php print_string('addnewhost', 'mnet'); ?>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="hidden" name="step" value="input" />
</th>
</tr>
<tr>
<td class="cell c0">wwwroot:</td>
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
<td class="cell c2">
<select name="applicationid">
<?php
foreach($applications as $application) {
echo ' <option value="'.$application->id.'">'.$application->display_name."</option>\n";
}
?>
</select>
</td>
<td class="cell c3"></td>
</tr>
<tr>
<td class="cell c4" align="right" colspan="4"><input type="submit" value="<?php print_string('addhost','mnet'); ?>" /></td>
</tr>
</table>
</form>
</div>
<?php
admin_externalpage_print_footer();
?>
+152 -236
View File
@@ -1,265 +1,181 @@
<?php
<?PHP // $Id$
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Page to allow the administrator to configure networked hosts, and add new ones
*
* @package core
* @subpackage mnet
* @copyright 2007 Donal McMullan
* @copyright 2007 Martin Langhoff
* @copyright 2010 Penny Leach
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Allows the admin to configure other Moodle hosts info
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/mnet/lib.php');
require_once($CFG->dirroot.'/admin/mnet/peer_forms.php');
include_once($CFG->dirroot.'/mnet/lib.php');
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
/// Initialize variables.
$hostid = optional_param('hostid', 0, PARAM_INT);
$updra = optional_param('updateregisterall', 0, PARAM_INT);
// first process the register all hosts setting if required
if (!empty($updra)) {
set_config('mnet_register_allhosts', optional_param('registerallhosts', 0, PARAM_INT));
redirect(new moodle_url('/admin/mnet/peers.php'), get_string('changessaved'));
}
$adminsection = 'mnetpeers';
if ($hostid && $DB->get_field('mnet_host', 'deleted', array('id' => $hostid)) != 1) {
$adminsection = 'mnetpeer' . $hostid;
}
$PAGE->set_url('/admin/mnet/peers.php');
admin_externalpage_setup($adminsection);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!extension_loaded('openssl')) {
print_error('requiresopenssl', 'mnet');
admin_externalpage_print_header();
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
if (!$site = get_site()) {
admin_externalpage_print_header();
print_error('nosite', '', '', NULL, true);
}
if (!function_exists('curl_init') ) {
print_error('nocurl', 'mnet');
admin_externalpage_print_header();
print_error('nocurl', 'mnet', '', NULL, true);
}
if (!function_exists('xmlrpc_encode_request')) {
print_error('xmlrpc-missing', 'mnet');
}
/// Initialize variables.
if (!isset($CFG->mnet_dispatcher_mode)) {
set_config('mnet_dispatcher_mode', 'off');
}
// Step must be one of:
// input Parse the details of a new host and fetch its public key
// commit Save our changes (to a new OR existing host)
$step = optional_param('step', NULL, PARAM_ALPHA);
$hostid = optional_param('hostid', NULL, PARAM_INT);
$mnet_peer = new mnet_peer();
$simpleform = new mnet_simple_host_form(); // the one that goes on the bottom of the main page
$reviewform = null; // set up later in different code branches, so mnet_peer can be passed to the constructor
// Fetch some strings for the HTML templates
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$strmnetthemes = get_string('mnetthemes', 'mnet');
// if the first form has been submitted, bootstrap the peer and load up the review form
if ($formdata = $simpleform->get_data()) {
// ensure we remove trailing slashes
$formdata->wwwroot = trim($formdata->wwwroot);
$formdata->wwwroot = rtrim($formdata->wwwroot, '/');
if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
// ensure the wwwroot starts with a http or https prefix
if (strtolower(substr($formdata->wwwroot, 0, 4)) != 'http') {
$formdata->wwwroot = 'http://'.$formdata->wwwroot;
}
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
$mnet_peer->set_applicationid($formdata->applicationid);
$application = $DB->get_field('mnet_application', 'name', array('id'=>$formdata->applicationid));
$mnet_peer->bootstrap($formdata->wwwroot, null, $application);
// bootstrap the second form straight with the data from the first form
$reviewform = new mnet_review_host_form(null, array('peer' => $mnet_peer)); // the second step (also the edit host form)
$formdata->oldpublickey = $mnet_peer->public_key; // set this so we can confirm on form post without having to recreate the mnet_peer object
$reviewform->set_data($mnet_peer);
echo $OUTPUT->header();
echo $OUTPUT->box_start();
$reviewform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
} else if ($simpleform->is_submitted()) { // validation failed
$noreviewform = true;
}
if (!empty($form->wwwroot)) {
// ensure we remove trailing slashes
$form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
// editing a host - load up the review form
if (!empty($hostid)) {
// TODO print a nice little heading
$mnet_peer->set_id($hostid);
echo $OUTPUT->header();
$currenttab = 'mnetdetails';
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
if ($hostid != $CFG->mnet_all_hosts_id) {
$mnet_peer->currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
if ($mnet_peer->currentkey == $mnet_peer->public_key) {
unset($mnet_peer->currentkey);
} else {
error_log($mnet_peer->currentkey);
error_log($mnet_peer->public_key);
error_log(md5($mnet_peer->currentkey));
error_log(md5($mnet_peer->public_key));
// ensure the wwwroot starts with a http or https prefix
if (strtolower(substr($form->wwwroot, 0, 4)) != 'http') {
$form->wwwroot = 'http://'.$form->wwwroot;
}
$credentials = $mnet_peer->check_credentials($mnet_peer->public_key);
$reviewform = new mnet_review_host_form(null, array('peer' => $mnet_peer)); // the second step (also the edit host form)
$mnet_peer->oldpublickey = $mnet_peer->public_key; // set this so we can confirm on form post without having to recreate the mnet_peer object
$reviewform->set_data((object)$mnet_peer);
echo $OUTPUT->box_start();
$reviewform->display();
echo $OUTPUT->box_end();
}
if(!function_exists('xmlrpc_encode_request')) {
trigger_error("You must have xml-rpc enabled in your PHP build to use this feature.");
error(get_string('xmlrpc-missing', 'mnet'),'peers.php');
exit;
}
if (!empty($form->updateregisterall)) {
if (!empty($form->registerallhosts)) {
set_config('mnet_register_allhosts',1);
} else {
set_config('mnet_register_allhosts',0);
}
redirect('peers.php', get_string('changessaved'));
} else {
// no options for allhosts host - just let the tabs display and print a notification
echo $OUTPUT->notification(get_string('allhosts_no_options', 'mnet'));
$mnet_peer = new mnet_peer();
if (!empty($form->id)) {
$form->id = clean_param($form->id, PARAM_INT);
$mnet_peer->set_id($form->id);
} else {
// PARAM_URL requires a genuine TLD (I think) This breaks my testing
$temp_wwwroot = clean_param($form->wwwroot, PARAM_URL);
if ($temp_wwwroot !== $form->wwwroot) {
trigger_error("We now parse the wwwroot with PARAM_URL. Your URL will need to have a valid TLD, etc.");
error(get_string("invalidurl", 'mnet'),'peers.php');
exit;
}
unset($temp_wwwroot);
$mnet_peer->set_applicationid($form->applicationid);
$application = get_field('mnet_application', 'name', 'id', $form->applicationid);
$mnet_peer->bootstrap($form->wwwroot, null, $application);
}
if (isset($form->name) && $form->name != $mnet_peer->name) {
$form->name = clean_param($form->name, PARAM_NOTAGS);
$mnet_peer->set_name($form->name);
}
if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
$mnet_peer->deleted = $form->deleted;
}
if (isset($form->public_key)) {
$form->public_key = clean_param($form->public_key, PARAM_PEM);
if (empty($form->public_key)) {
error(get_string("invalidpubkey", 'mnet'),'peers.php?step=update&amp;hostid='.$mnet_peer->id);
exit;
} else {
$oldkey = $mnet_peer->public_key;
$mnet_peer->public_key = $form->public_key;
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
if ($mnet_peer->public_key_expires == false) {
$mnet_peer->public_key == $oldkey;
$errmsg = '<br />';
foreach ($mnet_peer->error as $err) {
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
}
error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&amp;hostid='.$mnet_peer->id);
exit;
}
}
}
// PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
if ('input' == $form->step) {
if ( isset($mnet_peer->id) && $mnet_peer->id > 0 ) {
error(get_string("hostexists", 'mnet', $mnet_peer->id),'peers.php?step=update&amp;hostid='.$mnet_peer->id);
}
}
if ('input' == $form->step) {
include('./mnet_review.html');
} elseif ('commit' == $form->step) {
$bool = $mnet_peer->commit();
if ($bool) {
redirect('peers.php?step=update&amp;hostid='.$mnet_peer->id, get_string('changessaved'));
} else {
error('Invalid action parameter.', 'index.php');
}
}
}
echo $OUTPUT->footer();
exit;
}
// either we're in the second step of setting up a new host
// or editing an existing host
// try our best to set up the mnet_peer object to pass to the form definition
// unless validation on simpleform failed, in which case fall through.
if (empty($noreviewform) && $id = optional_param('id', 0, PARAM_INT)) {
// we're editing an existing one, so set up the tabs
$currenttab = 'mnetdetails';
$mnet_peer->set_id($id);
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
} else if (empty($noreviewform) && ($wwwroot = optional_param('wwwroot', '', PARAM_URL)) && ($applicationid = optional_param('applicationid', 0, PARAM_INT))) {
$application = $DB->get_field('mnet_application', 'name', array('id'=>$applicationid));
$mnet_peer->bootstrap($wwwroot, null, $application);
}
$reviewform = new mnet_review_host_form(null, array('peer' => $mnet_peer));
if ($formdata = $reviewform->get_data()) {
$mnet_peer->set_applicationid($formdata->applicationid);
$application = $DB->get_field('mnet_application', 'name', array('id'=>$formdata->applicationid));
$mnet_peer->bootstrap($formdata->wwwroot, null, $application);
if (!empty($formdata->name) && $formdata->name != $mnet_peer->name) {
$mnet_peer->set_name($formdata->name);
}
if (empty($formdata->theme)) {
$mnet_peer->force_theme = 0;
$mnet_peer->theme = null;
} elseif (is_int($hostid)) {
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
if($currentkey == $mnet_peer->public_key) unset($currentkey);
$form = new stdClass();
if ($hostid != $CFG->mnet_all_hosts_id) {
include('./mnet_review.html');
} else {
$mnet_peer->force_theme = 1;
$mnet_peer->theme = $formdata->theme;
include('./mnet_review_allhosts.html');
}
$mnet_peer->deleted = $formdata->deleted;
$mnet_peer->public_key = $formdata->public_key;
$credentials = $mnet_peer->check_credentials($mnet_peer->public_key);
$mnet_peer->public_key_expires = $credentials['validTo_time_t'];
if ($mnet_peer->commit()) {
redirect(new moodle_url('/admin/mnet/peers.php', array('hostid' => $mnet_peer->id)), get_string('changessaved'));
} else {
print_error('invalidaction', 'error', 'index.php');
}
} else if ($reviewform->is_submitted()) { // submitted, but errors
echo $OUTPUT->header();
echo $OUTPUT->box_start();
$reviewform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
}
// normal flow - just display all hosts with links
echo $OUTPUT->header();
$hosts = mnet_get_hosts();
// print the table to display the register all hosts setting
$table = new html_table();
$table->head = array(get_string('registerallhosts', 'mnet'));
$registerrow = '';
$registerstr = '';
$registerurl = new moodle_url('/admin/mnet/peers.php', array('updateregisterall' => 1));
if (!empty($CFG->mnet_register_allhosts)) {
$registerrow = get_string('registerhostson', 'mnet');
$registerurl->param('registerallhosts', 0);
$registerstr = get_string('turnitoff', 'mnet');
} else {
$registerrow = get_string('registerhostsoff', 'mnet');
$registerurl->param('registerallhosts', 1);
$registerstr = get_string('turniton', 'mnet');
$hosts = get_records_sql(' SELECT
h.id,
h.wwwroot,
h.ip_address,
h.name,
h.public_key,
h.public_key_expires,
h.transport,
h.portno,
h.last_connect_time,
h.last_log_id,
h.applicationid,
a.name as app_name,
a.display_name as app_display_name,
a.xmlrpc_server_url
FROM
'.$CFG->prefix.'mnet_host h,
'.$CFG->prefix.'mnet_application a
WHERE
h.id != \''.$CFG->mnet_localhost_id.'\' AND
h.deleted = \'0\' AND
h.applicationid=a.id');
if (empty($hosts)) $hosts = array();
$applications = get_records('mnet_application');
include('./peers.html');
}
$registerrow .= $OUTPUT->single_button($registerurl, $registerstr);
// simple table with two rows of a single cell
$table->data = array(
array(
get_string('registerallhostsexplain', 'mnet'),
),
array(
$registerrow
),
);
echo html_writer::table($table);
// print the list of all hosts, with little action links and buttons
$table = new html_table();
$table->head = array(
get_string('site'),
get_string('system', 'mnet'),
get_string('last_connect_time', 'mnet'),
'',
);
$table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap');
$baseurl = new moodle_url('/admin/mnet/peers.php');
foreach($hosts as $host) {
$hosturl = new moodle_url($baseurl, array('hostid' => $host->id));
// process all hosts first since it's the easiest
if ($host->id == $CFG->mnet_all_hosts_id) {
$table->data[] = array(html_writer::tag('a', $host->name, array('href'=>$hosturl)), '', '', '');
continue;
}
if ($host->last_connect_time == 0) {
$last_connect = get_string('never');
} else {
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
}
$table->data[] = array(
html_writer::link($hosturl, $host->name),
html_writer::link($hosturl, $host->wwwroot),
$last_connect,
$OUTPUT->single_button(new moodle_url('/admin/mnet/delete.php', array('hostid' => $host->id)), get_string('delete'))
);
}
echo html_writer::table($table);
// finally, print the initial form to add a new host
echo $OUTPUT->box_start();
echo $OUTPUT->heading(get_string('addnewhost', 'mnet'), 3);
$simpleform->display();
echo $OUTPUT->box_end();
// done
echo $OUTPUT->footer();
exit;
?>
-93
View File
@@ -1,93 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Allows the admin to configure a list of profile fields that are sent/recieved
*
* @package core
* @subpackage mnet
* @copyright 2010 onwards Penny Leach <penny@liip.ch>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php');
$mnet = get_mnet_environment();
require_login();
$hostid = required_param('hostid', PARAM_INT);
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
admin_externalpage_setup('mnetpeers');
$form = new mnet_profile_form(null, array('hostid' => $hostid));
if ($data = $form->get_data()) {
if (!isset($data->importdefault)) {
$data->importdefault = 0;
}
if (!isset($data->exportdefault)) {
$data->exportdefault = 0;
}
if (!isset($data->importfields)) {
$data->importfields = array();
}
if (!isset($data->exportfields)) {
$data->exportfields = array();
}
set_config('host' . $hostid . 'importdefault', $data->importdefault, 'mnet');
set_config('host' . $hostid . 'importfields', implode(',', $data->importfields), 'mnet');
set_config('host' . $hostid . 'exportdefault', $data->exportdefault, 'mnet');
set_config('host' . $hostid . 'exportfields', implode(',', $data->exportfields), 'mnet');
redirect(new moodle_url('/admin/mnet/peers.php'), get_string('changessaved'));
} elseif ($form->is_cancelled()) {
redirect(new moodle_url('/admin/mnet/peers.php', array('hostid' => $hostid)));
}
echo $OUTPUT->header();
$currenttab = 'mnetprofilefields';
require_once('tabs.php');
echo $OUTPUT->heading(get_string('peerprofilefielddesc', 'mnet'), 4);
$data = new Stdclass;
$data->importdefault = get_config('mnet', 'host' . $hostid . 'importdefault');
$data->exportdefault = get_config('mnet', 'host' . $hostid . 'exportdefault');
$data->importfields = get_config('mnet', 'host' . $hostid . 'importfields');
$data->exportfields = get_config('mnet', 'host' . $hostid . 'exportfields');
if ($data->importfields === false) {
$data->importdefault = true;
} else {
$data->importfields = explode(',', $data->importfields);
}
if ($data->exportfields === false) {
$data->exportdefault = true;
} else {
$data->exportfields = explode(',', $data->exportfields);
}
$form->set_data($data);
$form->display();
echo $OUTPUT->footer();
-64
View File
@@ -1,64 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Allows the admin to configure a list of profile fields that are sent/recieved
*
* @package core
* @subpackage mnet
* @copyright 2010 onwards Penny Leach <penny@liip.ch>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->libdir . '/formslib.php');
/**
* small form to allow the administrator to configure (override) which profile fields are sent/imported over mnet
*/
class mnet_profile_form extends moodleform {
function definition() {
global $CFG;
$mform =& $this->_form;
$mform->addElement('hidden', 'hostid', $this->_customdata['hostid']);
$fields = mnet_profile_field_options();
// Fields to import ----------------------------------------------------
$mform->addElement('header', 'import', get_string('importfields', 'mnet'));
$select = $mform->addElement('select', 'importfields', get_string('importfields', 'mnet'), $fields['optional']);
$select->setMultiple(true);
$mform->addElement('checkbox', 'importdefault', get_string('leavedefault', 'mnet'), str_replace(',', ', ', $CFG->mnetprofileimportfields));
// Fields to export ----------------------------------------------------
$mform->addElement('header', 'export', get_string('exportfields', 'mnet'));
$select = $mform->addElement('select', 'exportfields', get_string('exportfields', 'mnet'), $fields['optional']);
$select->setMultiple(true);
$mform->addElement('checkbox', 'exportdefault', get_string('leavedefault', 'mnet'), str_replace(',', ', ', $CFG->mnetprofileexportfields));
$this->add_action_buttons();
}
}
-92
View File
@@ -1,92 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This page is for configuring which services are published/subscribed on a host
*
* @package core
* @subpackage mnet
* @copyright 2010 Penny Leach
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/mnet/services_form.php');
$mnet = get_mnet_environment();
require_login();
admin_externalpage_setup('mnetpeers');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$hostid = required_param('hostid', PARAM_INT);
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$mform = new mnet_services_form(null, array('peer' => $mnet_peer));
if ($formdata = $mform->get_data()) {
if (!isset($formdata->publish)) {
$formdata->publish = array();
}
if (!isset($formdata->subscribe)) {
$formdata->subscribe = array();
}
foreach($formdata->exists as $key => $value) {
$host2service = $DB->get_record('mnet_host2service', array('hostid'=>$hostid, 'serviceid'=>$key));
$publish = (array_key_exists($key, $formdata->publish)) ? $formdata->publish[$key] : 0;
$subscribe = (array_key_exists($key, $formdata->subscribe)) ? $formdata->subscribe[$key] : 0;
if ($publish != 1 && $subscribe != 1) {
if (false == $host2service) {
// We don't have or need a record - do nothing!
} else {
// We don't need the record - delete it
$DB->delete_records('mnet_host2service', array('hostid' => $hostid, 'serviceid'=>$key));
}
} elseif (false == $host2service && ($publish == 1 || $subscribe == 1)) {
$host2service = new stdClass();
$host2service->hostid = $hostid;
$host2service->serviceid = $key;
$host2service->publish = $publish;
$host2service->subscribe = $subscribe;
$host2service->id = $DB->insert_record('mnet_host2service', $host2service);
} elseif ($host2service->publish != $publish || $host2service->subscribe != $subscribe) {
$host2service->publish = $publish;
$host2service->subscribe = $subscribe;
$DB->update_record('mnet_host2service', $host2service);
}
}
$redirecturl = new moodle_url('/admin/mnet/services.php?hostid=' . $hostid);
redirect($redirecturl, get_string('changessaved'));
}
echo $OUTPUT->header();
$currenttab = 'mnetservices';
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
echo $OUTPUT->box_start();
$s = mnet_get_service_info($mnet_peer, false); // basic data only
$mform->set_data($s);
$mform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
-74
View File
@@ -1,74 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The form for configuring which services are subscribed and published on a host
*
* @package core
* @subpackage mnet
* @copyright 2010 Penny Leach
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->libdir . '/formslib.php');
class mnet_services_form extends moodleform {
function definition() {
$mform =& $this->_form;
$mnet_peer =& $this->_customdata['peer'];
$myservices =& mnet_get_service_info($mnet_peer);
$mform->addElement('hidden', 'hostid', $mnet_peer->id);
$count = 0;
foreach ($myservices as $name => $versions) {
$version = current($versions);
$langmodule =
($version['plugintype'] == 'mod'
? ''
: ($version['plugintype'] . '_'))
. $version['pluginname']; // TODO there should be a moodle-wide way to do this
if ($count > 0) {
$mform->addElement('html', '<hr />');
}
$mform->addElement('html', '<h3>' . get_string($name.'_name', $langmodule , $mnet_peer->name) . '</h3>' . get_string($name.'_description', $langmodule, $mnet_peer->name));
$mform->addElement('hidden', 'exists[' . $version['serviceid'] . ']', 1);
$pubstr = get_string('publish','mnet');
if (!empty($version['hostsubscribes'])) {
$pubstr .= ' <a class="notifysuccess" title="'.s(get_string('issubscribed','mnet', $mnet_peer->name)).'">&radic;</a> ';
}
$mform->addElement('advcheckbox', 'publish[' . $version['serviceid'] . ']', $pubstr);
$substr = get_string('subscribe','mnet');
if (!empty($version['hostpublishes'])) {
$substr .= ' <a class="notifysuccess" title="'.s(get_string('ispublished','mnet', $mnet_peer->name)).'">&radic;</a> ';
}
$mform->addElement('advcheckbox', 'subscribe[' . $version['serviceid']. ']', $substr);
$count++;
}
$this->add_action_buttons();
}
}
-56
View File
@@ -1,56 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tabs to be included on the pages for configuring a single host
* $mnet_peer object must be set and bootstrapped
* $currenttab string must be set
*
* @package core
* @subpackage mnet
* @copyright 2007 Donal McMullan
* @copyright 2007 Martin Langhoff
* @copyright 2010 Penny Leach
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); // It must be included from a Moodle page
}
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs = array();
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'services.php?hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
if ($mnet_peer->application->name == 'moodle' && $mnet_peer->id != $CFG->mnet_all_hosts_id) {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
$tabs[] = new tabobject('mnetprofilefields', 'profilefields.php?hostid=' . $mnet_peer->id, get_string('profilefields', 'mnet'), get_string('profilefields', 'mnet'), false);
} else {
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
}
print_tabs(array($tabs), $currenttab);
-212
View File
@@ -1,212 +0,0 @@
<?php
/**
* A service browser for remote Moodles
*
* This script 'remotely' executes the reflection methods on a remote Moodle,
* and publishes the details of the available services
*
* @package core
* @subpackage mnet
* @author Donal McMullan donal@catalyst.net.nz
* @version 0.0.1
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mnet
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once $CFG->dirroot.'/mnet/xmlrpc/client.php';
require_once($CFG->libdir.'/adminlib.php');
include_once($CFG->dirroot.'/mnet/lib.php');
if ($CFG->mnet_dispatcher_mode === 'off') {
print_error('mnetdisabled', 'mnet');
}
require_login();
admin_externalpage_setup('mnettestclient');
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
error_reporting(DEBUG_ALL);
echo $OUTPUT->header();
if (!extension_loaded('openssl')) {
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
// optional drilling down parameters
$hostid = optional_param('hostid', 0, PARAM_INT);
$servicename = optional_param('servicename', '', PARAM_SAFEDIR);
$methodid = optional_param('method', 0, PARAM_INT);
$hosts = $DB->get_records('mnet_host');
$moodleapplicationid = $DB->get_field('mnet_application', 'id', array('name' => 'moodle'));
$url = new moodle_url('/admin/mnet/testclient.php');
$PAGE->set_url($url);
echo $OUTPUT->heading(get_string('hostlist', 'mnet'));
foreach ($hosts as $id => $host) {
if (empty($host->wwwroot) || $host->wwwroot == $CFG->wwwroot) {
continue;
}
$newurl = new moodle_url($url, array('hostid' => $host->id));
echo '<p>' . html_writer::link($newurl, $host->wwwroot) . '</p>';
}
if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
$host = $hosts[$hostid];
if ($host->applicationid != $moodleapplicationid) {
echo $OUTPUT->notification(get_string('notmoodleapplication', 'mnet'));
}
$mnet_peer = new mnet_peer();
$mnet_peer->set_wwwroot($host->wwwroot);
$mnet_request = new mnet_xmlrpc_client();
$mnet_request->set_method('system/listServices');
$mnet_request->send($mnet_peer);
$services = $mnet_request->response;
$yesno = array('No', 'Yes');
$servicenames = array();
echo $OUTPUT->heading(get_string('servicesavailableonhost', 'mnet', $host->wwwroot));
$table = new html_table();
$table->head = array(
get_string('serviceid', 'mnet'),
get_string('service', 'mnet'),
get_string('version', 'mnet'),
get_string('theypublish', 'mnet'),
get_string('theysubscribe', 'mnet'),
get_string('options', 'mnet'),
);
$table->data = array();
$yesno = array(get_string('no'), get_string('yes'));
// this query is horrible and has to be remapped afterwards, because of the non-uniqueness
// of the remoterep service (it has two plugins so far that use it)
// it's possible to get a unique list back using a subquery with LIMIT but that would break oracle
// so it's best to just do this small query and then remap the results afterwards
$sql = '
SELECT DISTINCT
' . $DB->sql_concat('r.plugintype', "'_'", 'r.pluginname', "'_'", 's.name') . ' AS uniqueid,
s.name,
r.plugintype,
r.pluginname
FROM
{mnet_service} s
JOIN {mnet_remote_service2rpc} s2r ON s2r.serviceid = s.id
JOIN {mnet_remote_rpc} r ON r.id = s2r.rpcid';
$serviceinfo = array();
foreach ($DB->get_records_sql($sql) as $result) {
$serviceinfo[$result->name] = $result->plugintype . '_' . $result->pluginname;
}
foreach ($services as $id => $servicedata) {
if (array_key_exists($servicedata['name'], $serviceinfo)) {
$service = $serviceinfo[$servicedata['name']];
$servicedata['humanname'] = get_string($servicedata['name'].'_name', $service);
} else {
$servicedata['humanname'] = get_string('unknown', 'mnet');
}
$newurl = new moodle_url($url, array('hostid' => $host->id, 'servicename' => $servicedata['name']));
$table->data[] = array(
$servicedata['name'],
$servicedata['humanname'],
$servicedata['apiversion'],
$yesno[$servicedata['publish']],
$yesno[$servicedata['subscribe']],
html_writer::link($newurl, get_string('listservices', 'mnet'))
);
}
echo html_writer::table($table);
$mnet_request->set_method('system/listMethods');
if (isset($servicename) && array_key_exists($servicename, $serviceinfo)) {
echo $OUTPUT->heading(get_string('methodsavailableonhostinservice', 'mnet', (object)array('host' => $host->wwwroot, 'service' => $servicename)));
$service = $serviceinfo[$servicename];
$mnet_request->add_param($servicename, 'string');
} else {
echo $OUTPUT->heading(get_string('methodsavailableonhost', 'mnet', $host->wwwroot));
}
$mnet_request->send($mnet_peer);
$methods = $mnet_request->response;
$table = new html_table();
$table->head = array(
get_string('method', 'mnet'),
get_string('options', 'mnet'),
);
$table->data = array();
foreach ($methods as $id => $method) {
$params = array('hostid' => $host->id, 'method' => $id+1);
if (isset($servicename)) {
$params['servicename'] = $servicename;
}
$newurl = new moodle_url($url, $params);
$table->data[] = array(
$method,
html_writer::link($newurl, get_string('inspect', 'mnet'))
);
}
echo html_writer::table($table);
if (isset($methodid) && array_key_exists($methodid-1, $methods)) {
$method = $methods[$methodid-1];
$mnet_request = new mnet_xmlrpc_client();
$mnet_request->set_method('system/methodSignature');
$mnet_request->add_param($method, 'string');
$mnet_request->send($mnet_peer);
$signature = $mnet_request->response;
echo $OUTPUT->heading(get_string('methodsignature', 'mnet', $method));
$table = new html_table();
$table->head = array(
get_string('position', 'mnet'),
get_string('name', 'mnet'),
get_string('type', 'mnet'),
get_string('description', 'mnet'),
);
$table->data = array();
$params = $signature['parameters'];
foreach ($params as $pos => $details) {
$table->data[] = array(
$pos,
$details['name'],
$details['type'],
$details['description'],
);
}
$table->data[] = array(
get_string('returnvalue', 'mnet'),
'',
$signature['return']['type'],
$signature['return']['description']
);
echo html_writer::table($table);
$mnet_request->set_method('system/methodHelp');
$mnet_request->add_param($method, 'string');
$mnet_request->send($mnet_peer);
$help = $mnet_request->response;
echo $OUTPUT->heading(get_string('methodhelp', 'mnet', $method));
echo(str_replace('\n', '<br />',$help));
}
}
echo $OUTPUT->footer();
?>
+6 -6
View File
@@ -1,5 +1,5 @@
<?php
echo $OUTPUT->header();
admin_externalpage_print_header();
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
@@ -13,7 +13,7 @@ echo $OUTPUT->header();
<td class="cell c1" colspan="2">
<form method="post" action="trustedhosts.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<textarea name="hostlist" cols="40" rows="20"><?php echo $trusted_hosts; ?></textarea><br />
<input type="submit" value="<?php print_string('savechanges'); ?>" />
</div>
@@ -25,7 +25,7 @@ echo $OUTPUT->header();
<tr>
<th class="header c0" colspan="2"><?php print_string('testtrustedhosts', 'mnet'); ?></th>
</tr>
<?php
<?php
if (!empty($test_ip_address)){
?>
<tr>
@@ -48,13 +48,13 @@ echo $OUTPUT->header();
<td class="cell c1" colspan="2"><?php print_string('testtrustedhostsexplain', 'mnet'); ?></td>
</tr>
<?php
}
}
?>
<tr>
<td class="cell c1" colspan="2">
<form method="get" action="trustedhosts.php">
<div>
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="text" name="testipaddress" value="<?php echo $test_ip_address; ?>" />
<input type="submit" value="<?php print_string('go'); ?>" />
</div>
@@ -64,5 +64,5 @@ echo $OUTPUT->header();
</table>
</div>
<?php
echo $OUTPUT->footer();
admin_externalpage_print_footer();
?>
+13 -5
View File
@@ -13,11 +13,14 @@
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
if (!extension_loaded('openssl')) {
echo $OUTPUT->header();
admin_externalpage_print_header();
print_error('requiresopenssl', 'mnet', '', NULL, true);
}
$site = get_site();
if (!$site = get_site()) {
admin_externalpage_print_header();
print_error('nosite', '', '', NULL, true);
}
$trusted_hosts = '';//array();
$old_trusted_hosts = get_config('mnet', 'mnet_trusted_hosts');
@@ -31,9 +34,13 @@
$in_range = false;
if (!empty($test_ip_address)) {
foreach($old_trusted_hosts as $host) {
if (address_in_subnet($test_ip_address, $host)) {
list($network, $mask) = explode('/', $host.'/');
if (empty($network)) continue;
if (strlen($mask) == 0) $mask = 32;
if (ip_in_range($test_ip_address, $network, $mask)) {
$in_range = true;
$validated_by = $host;
$validated_by = $network.'/'.$mask;
break;
}
}
@@ -61,3 +68,4 @@
}
include('./trustedhosts.html');
?>
+69
View File
@@ -0,0 +1,69 @@
<?PHP // $Id$
// module.php - allows admin to edit all local configuration variables for a module
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
/// If data submitted, then process and store.
if ($config = data_submitted()) {
$module = optional_param('module', '', PARAM_SAFEDIR);
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if ($module != '') {
include_once("$CFG->dirroot/mod/$module/lib.php");
admin_externalpage_setup('modsetting'.$module);
// if the config.html contains a hidden form field giving
// the module name then the form does not have to prefix all
// its variable names, we will do it here.
$moduleprefix = $module.'_';
// let the module process the form data if it has to,
// $config is passed to this function by reference
$moduleconfig = $module.'_process_options';
if (function_exists($moduleconfig)) {
$moduleconfig($config);
}
} else {
admin_externalpage_setup('managemodules');
$moduleprefix = '';
}
unset($config->sesskey);
unset($config->module);
foreach ($config as $name => $value) {
set_config($moduleprefix.$name, $value);
}
redirect("$CFG->wwwroot/$CFG->admin/modules.php", get_string("changessaved"), 1);
exit;
}
/// Otherwise print the form.
$module = required_param('module', PARAM_SAFEDIR);
include_once("$CFG->dirroot/mod/$module/lib.php");
admin_externalpage_setup('modsetting'.$module);
$strmodulename = get_string("modulename", $module);
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'mod/' . $module . '/config';
admin_externalpage_print_header();
print_heading($strmodulename);
print_simple_box(get_string("configwarning", 'admin'), "center", "60%");
echo "<br />";
print_simple_box_start("center", "");
include("$CFG->dirroot/mod/$module/config.html");
print_simple_box_end();
admin_externalpage_print_footer();
?>
+146 -73
View File
@@ -1,10 +1,11 @@
<?php
<?PHP // $Id$
// Allows the admin to manage activity modules
require_once('../config.php');
require_once('../course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/ddllib.php');
// defines
define('MODULE_TABLE','module_administration_table');
@@ -32,84 +33,166 @@
/// If data submitted, then process and store.
if (!empty($hide) and confirm_sesskey()) {
if (!$module = $DB->get_record("modules", array("name"=>$hide))) {
print_error('moduledoesnotexist', 'error');
if (!$module = get_record("modules", "name", $hide)) {
error("Module doesn't exist!");
}
$DB->set_field("modules", "visible", "0", array("id"=>$module->id)); // Hide main module
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
// Remember the visibility status in visibleold
// and hide...
$sql = "UPDATE {course_modules}
SET visibleold=visible, visible=0
WHERE module=?";
$DB->execute($sql, array($module->id));
$sql = "UPDATE {$CFG->prefix}course_modules
SET visibleold=visible,
visible=0
WHERE module={$module->id}";
execute_sql($sql, false);
// clear the course modinfo cache for courses
// where we just deleted something
$sql = "UPDATE {course}
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {course_modules}
WHERE visibleold=1 AND module=?)";
$DB->execute($sql, array($module->id));
$sql = "UPDATE {$CFG->prefix}course
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {$CFG->prefix}course_modules
WHERE visibleold=1 AND module={$module->id})";
execute_sql($sql, false);
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($show) and confirm_sesskey()) {
if (!$module = $DB->get_record("modules", array("name"=>$show))) {
print_error('moduledoesnotexist', 'error');
if (!$module = get_record("modules", "name", $show)) {
error("Module doesn't exist!");
}
$DB->set_field("modules", "visible", "1", array("id"=>$module->id)); // Show main module
$DB->set_field('course_modules', 'visible', '1', array('visibleold'=>1, 'module'=>$module->id)); // Get the previous saved visible state for the course module.
set_field("modules", "visible", "1", "id", $module->id); // Show main module
set_field('course_modules', 'visible', '1', 'visibleold',
'1', 'module', $module->id); // Get the previous saved visible state for the course module.
// clear the course modinfo cache for courses
// where we just made something visible
$sql = "UPDATE {course}
SET modinfo = ''
WHERE id IN (SELECT DISTINCT course
FROM {course_modules}
WHERE visible=1 AND module=?)";
$DB->execute($sql, array($module->id));
$sql = "UPDATE {$CFG->prefix}course
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {$CFG->prefix}course_modules
WHERE visible=1 AND module={$module->id})";
execute_sql($sql, false);
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($delete) and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading($stractivities);
admin_externalpage_print_header();
print_heading($stractivities);
if (get_string_manager()->string_exists('modulename', $delete)) {
$strmodulename = get_string('modulename', $delete);
} else {
$strmodulename = $delete;
}
$strmodulename = get_string("modulename", "$delete");
if (!$confirm) {
echo $OUTPUT->confirm(get_string("moduledeleteconfirm", "", $strmodulename), "modules.php?delete=$delete&confirm=1", "modules.php");
echo $OUTPUT->footer();
notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename),
"modules.php?delete=$delete&amp;confirm=1&amp;sesskey=$USER->sesskey",
"modules.php");
admin_externalpage_print_footer();
exit;
} else { // Delete everything!!
if ($delete == "forum") {
print_error("cannotdeleteforummodule", 'forum');
error("You can not delete the forum module!!");
}
if (!$module = get_record("modules", "name", $delete)) {
error("Module doesn't exist!");
}
// OK, first delete all the relevant instances from all course sections
if ($coursemods = get_records("course_modules", "module", $module->id)) {
foreach ($coursemods as $coursemod) {
if (! delete_mod_from_section($coursemod->id, $coursemod->section)) {
notify("Could not delete the $strmodulename with id = $coursemod->id from section $coursemod->section");
}
}
}
// delete calendar events
if (!delete_records("event", "modulename", $delete)) {
notify("Error occurred while deleting all $strmodulename records in calendar event table");
}
// clear course.modinfo for courses
// that used this module...
$sql = "UPDATE {$CFG->prefix}course
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
FROM {$CFG->prefix}course_modules
WHERE module={$module->id})";
execute_sql($sql, false);
// Now delete all the course module records
if (!delete_records("course_modules", "module", $module->id)) {
notify("Error occurred while deleting all $strmodulename records in course_modules table");
}
// Then delete all the logs
if (!delete_records("log", "module", $module->name)) {
notify("Error occurred while deleting all $strmodulename records in log table");
}
// And log_display information
if (!delete_records("log_display", "module", $module->name)) {
notify("Error occurred while deleting all $strmodulename records in log_display table");
}
// And the module entry itself
if (!delete_records("modules", "name", $module->name)) {
notify("Error occurred while deleting the $strmodulename record from modules table");
}
// And the module configuration records
if (!execute_sql("DELETE FROM {$CFG->prefix}config WHERE name LIKE '{$module->name}_%'")) {
notify("Error occurred while deleting the $strmodulename records from the config table");
}
// cleanup the gradebook
require_once($CFG->libdir.'/gradelib.php');
grade_uninstalled_module($module->name);
// Then the tables themselves
drop_plugin_tables($module->name, "$CFG->dirroot/mod/$module->name/db/install.xml", false);
// Delete the capabilities that were defined by this module
capabilities_cleanup('mod/'.$module->name);
// remove entent handlers and dequeue pending events
events_uninstall('mod/'.$module->name);
// Perform any custom uninstall tasks
if (file_exists($CFG->dirroot . '/mod/' . $module->name . '/lib.php')) {
require_once($CFG->dirroot . '/mod/' . $module->name . '/lib.php');
$uninstallfunction = $module->name . '_uninstall';
if (function_exists($uninstallfunction)) {
if (! $uninstallfunction() ) {
notify('Encountered a problem running uninstall function for '. $module->name.'!');
}
}
}
uninstall_plugin('mod', $delete);
$a->module = $strmodulename;
$a->directory = "$CFG->dirroot/mod/$delete";
echo $OUTPUT->notification(get_string("moduledeletefiles", "", $a), 'notifysuccess');
echo $OUTPUT->continue_button("modules.php");
echo $OUTPUT->footer();
exit;
notice(get_string("moduledeletefiles", "", $a), "modules.php");
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading($stractivities);
admin_externalpage_print_header();
print_heading($stractivities);
/// Get and sort the existing modules
if (!$modules = $DB->get_records('modules', array(), 'name ASC')) {
print_error('moduledoesnotexist', 'error');
if (!$modules = get_records("modules")) {
error("No modules found!!"); // Should never happen
}
foreach ($modules as $module) {
$strmodulename = get_string("modulename", "$module->name");
// Deal with modules which are lacking the language string
if ($strmodulename == '[[modulename]]') {
$strmodulename = $module->name;
}
$modulebyname[$strmodulename] = $module;
}
ksort($modulebyname, SORT_LOCALE_STRING);
/// Print the table of all modules
// construct the flexible table ready to display
$table = new flexible_table(MODULE_TABLE);
@@ -117,50 +200,41 @@
$table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/modules.php');
$table->set_attribute('id', 'modules');
$table->set_attribute('class', 'generaltable');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
foreach ($modules as $module) {
foreach ($modulebyname as $modulename => $module) {
if (!file_exists("$CFG->dirroot/mod/$module->name/lib.php")) {
$strmodulename = '<span class="notifyproblem">'.$module->name.' ('.get_string('missingfromdisk').')</span>';
$missing = true;
} else {
// took out hspace="\10\", because it does not validate. don't know what to replace with.
$icon = "<img src=\"" . $OUTPUT->pix_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
$strmodulename = $icon.' '.get_string('modulename', $module->name);
$missing = false;
}
// took out hspace="\10\", because it does not validate. don't know what to replace with.
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" class=\"icon\" alt=\"\" />";
$delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=".sesskey()."\">$strdelete</a>";
$delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=$USER->sesskey\">$strdelete</a>";
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php") ||
file_exists("$CFG->dirroot/mod/$module->name/settingstree.php")) {
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php")) {
$settings = "<a href=\"settings.php?section=modsetting$module->name\">$strsettings</a>";
} else if (file_exists("$CFG->dirroot/mod/$module->name/config.html")) {
$settings = "<a href=\"module.php?module=$module->name\">$strsettings</a>";
} else {
$settings = "";
}
$count = $DB->count_records_select($module->name, "course<>0");
$count = count_records_select("$module->name",'course<>0');
if ($count>0) {
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
"&amp;sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
"&amp;sesskey={$USER->sesskey}\" title=\"$strshowmodulecourse\">$count</a>";
}
else {
$countlink = "$count";
}
if ($missing) {
$visible = '';
$class = '';
} else if ($module->visible) {
$visible = "<a href=\"modules.php?hide=$module->name&amp;sesskey=".sesskey()."\" title=\"$strhide\">".
"<img src=\"" . $OUTPUT->pix_url('i/hide') . "\" class=\"icon\" alt=\"$strhide\" /></a>";
$class = '';
if ($module->visible) {
$visible = "<a href=\"modules.php?hide=$module->name&amp;sesskey=$USER->sesskey\" title=\"$strhide\">".
"<img src=\"$CFG->pixpath/i/hide.gif\" class=\"icon\" alt=\"$strhide\" /></a>";
$class = "";
} else {
$visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=".sesskey()."\" title=\"$strshow\">".
"<img src=\"" . $OUTPUT->pix_url('i/show') . "\" class=\"icon\" alt=\"$strshow\" /></a>";
$class = ' class="dimmed_text"';
$visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=$USER->sesskey\" title=\"$strshow\">".
"<img src=\"$CFG->pixpath/i/show.gif\" class=\"icon\" alt=\"$strshow\" /></a>";
$class = " class=\"dimmed_text\"";
}
if ($module->name == "forum") {
$delete = "";
@@ -168,9 +242,8 @@
$class = "";
}
$table->add_data(array(
'<span'.$class.'>'.$strmodulename.'</span>',
'<span'.$class.'>'.$icon.' '.$modulename.'</span>',
$countlink,
'<span'.$class.'>'.$module->version.'</span>',
$visible,
@@ -181,6 +254,6 @@
$table->print_html();
echo $OUTPUT->footer();
admin_externalpage_print_footer();
?>
+31 -28
View File
@@ -1,8 +1,6 @@
<?php
<?php /// $Id$
/// Search and replace strings throughout all texts in the whole database
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
@@ -12,54 +10,57 @@ admin_externalpage_setup('multilangupgrade');
$go = optional_param('go', 0, PARAM_BOOL);
###################################################################
echo $OUTPUT->header();
admin_externalpage_print_header();
echo $OUTPUT->heading(get_string('multilangupgrade', 'admin'));
print_heading(get_string('multilangupgrade', 'admin'));
$strmultilangupgrade = get_String('multilangupgradeinfo', 'admin');
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('multilangupgrade.php', $optionsyes), 'index.php');
echo $OUTPUT->footer();
notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get');
admin_externalpage_print_footer();
die;
}
if (!$tables = $DB->get_tables() ) { // No tables yet at all.
print_error('notables', 'debug');
if (!$tables = $db->Metatables() ) { // No tables yet at all.
error("no tables");
}
echo $OUTPUT->box_start();
print_simple_box_start('center');
/// Turn off time limits, sometimes upgrades can be slow.
@set_time_limit(0);
@ob_implicit_flush(true);
while(@ob_end_flush());
echo '<strong>Progress:</strong>';
$i = 0;
$skiptables = array('config', 'user_students', 'user_teachers');
$skiptables = array($CFG->prefix.'config', $CFG->prefix.'user_students', $CFG->prefix.'user_teachers');//, $CFG->prefix.'sessions2');
foreach ($tables as $table) {
if (strpos($table,'pma') === 0) { // Not our tables
if (($CFG->prefix && strpos($table, $CFG->prefix) !== 0)
or strpos($table, $CFG->prefix.'pma') === 0) { // Not our tables
continue;
}
if (in_array($table, $skiptables)) { // Don't process these
continue;
}
$fulltable = $DB->get_prefix().$table;
if ($columns = $DB->get_columns($table)) {
if (!array_key_exists('id', $columns)) {
if ($columns = $db->MetaColumns($table, false)) {
if (!array_key_exists('id', $columns) and !array_key_exists('ID', $columns)) {
continue; // moodle tables have id
}
foreach ($columns as $column => $data) {
if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only
// first find candidate records
$sql = "SELECT id, $column FROM $fulltable WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'";
if ($rs = $DB->get_recordset_sql($sql)) {
foreach ($rs as $data) {
$text = $data->$column;
$id = $data->id;
$rs = get_recordset_sql("SELECT id, $column FROM $table WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'");
if ($rs) {
while (!$rs->EOF) {
$text = $rs->fields[$column];
$id = $rs->fields['id'];
if ($i % 600 == 0) {
echo '<br />';
}
@@ -67,6 +68,7 @@ foreach ($tables as $table) {
echo '.';
}
$i++;
$rs->MoveNext();
if (empty($text) or is_numeric($text)) {
continue; // nothing to do
@@ -80,10 +82,11 @@ foreach ($tables as $table) {
}
if ($newtext != $text) {
$DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id));
$newtext = addslashes($newtext);
execute_sql("UPDATE $table SET $column='$newtext' WHERE id=$id", false);
}
}
$rs->close();
rs_close($rs);
}
}
}
@@ -93,16 +96,16 @@ foreach ($tables as $table) {
// set conversion flag - switches to new plugin automatically
set_config('filter_multilang_converted', 1);
echo $OUTPUT->box_end();
print_simple_box_end();
/// Rebuild course cache which might be incorrect now
echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
notify('Rebuilding course cache...', 'notifysuccess');
rebuild_course_cache();
echo $OUTPUT->notification('...finished', 'notifysuccess');
notify('...finished', 'notifysuccess');
echo $OUTPUT->continue_button('index.php');
print_continue('index.php');
echo $OUTPUT->footer();
admin_externalpage_print_footer();
die;
@@ -115,4 +118,4 @@ function multilangupgrade_impl($langblock) {
}
return $return;
}
?>
+26 -27
View File
@@ -1,4 +1,4 @@
<?php
<?php // $Id$
if (!isset($CFG)) {
@@ -7,19 +7,19 @@ if (!isset($CFG)) {
admin_externalpage_setup('oacleanup');
echo $OUTPUT->header();
admin_externalpage_print_header();
online_assignment_cleanup(true);
echo $OUTPUT->footer();
admin_externalpage_print_footer();
}
function online_assignment_cleanup($output=false) {
global $CFG, $DB, $OUTPUT;
global $CFG;
if ($output) {
echo $OUTPUT->heading('Online Assignment Cleanup');
print_heading('Online Assignment Cleanup');
echo '<center>';
}
@@ -27,7 +27,7 @@ function online_assignment_cleanup($output=false) {
/// We don't want to run this code if we are doing an upgrade from an assignment
/// version earlier than 2005041400
/// because the assignment type field will not exist
$amv = $DB->get_field('modules', 'version', array('name'=>'assignment'));
$amv = get_field('modules', 'version', 'name', 'assignment');
if ((int)$amv < 2005041400) {
if ($output) {
echo '</center>';
@@ -37,26 +37,22 @@ function online_assignment_cleanup($output=false) {
/// get the module id for assignments from db
$arecord = $DB->get_record('modules', array('name', 'assignment'));
$arecord = get_record('modules', 'name', 'assignment');
$aid = $arecord->id;
/// get a list of all courses on this site
$courses = $DB->get_records('course');
$courses = get_records('course');
/// cycle through each course
foreach ($courses as $course) {
$fullname = empty($course->fullname) ? 'Course: '.$course->id : $course->fullname;
if ($output) echo $OUTPUT->heading($fullname);
if ($output) print_heading($fullname);
/// retrieve a list of sections beyond what is currently being shown
$sql = "SELECT *
FROM {course_sections}
WHERE course=? AND section>?
ORDER BY section ASC";
$params = array($course->id, $course->numsections);
if (!($xsections = $DB->get_records_sql($sql, $params))) {
$sql = 'SELECT * FROM '.$CFG->prefix.'course_sections WHERE course='.$course->id.' AND section>'.$course->numsections.' ORDER BY section ASC';
if (!($xsections = get_records_sql($sql))) {
if ($output) echo 'No extra sections<br />';
continue;
}
@@ -74,13 +70,16 @@ function online_assignment_cleanup($output=false) {
foreach ($instances as $instance) {
/// is this an instance of an online assignment
$sql = "SELECT a.id
FROM {course_modules} cm, {assignment} a
WHERE cm.id = ? AND cm.module = ? AND
cm.instance = a.id AND a.assignmenttype = 'online'";
$params = array($instance, $aid);
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}assignment a
WHERE cm.id = '$instance' AND
cm.module = '$aid' AND
cm.instance = a.id AND
a.assignmenttype = 'online'";
/// if record exists then we need to move instance to it's correct section
if ($DB->record_exists_sql($sql, $params)) {
if (record_exists_sql($sql)) {
/// check the new section id
/// the journal update erroneously stored it in course_sections->section
@@ -88,14 +87,14 @@ function online_assignment_cleanup($output=false) {
/// double check the new section
if ($newsection > $course->numsections) {
/// get the record for section 0 for this course
if (!($zerosection = $DB->get_record('course_sections', array('course'=>$course->id, 'section'=>'0')))) {
if (!($zerosection = get_record('course_sections', 'course', $course->id, 'section', '0'))) {
continue;
}
$newsection = $zerosection->id;
}
/// grab the section record
if (!($section = $DB->get_record('course_sections', array('id'=>$newsection)))) {
if (!($section = get_record('course_sections', 'id', $newsection))) {
if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. format_string($course->fullname) .'<br />';
continue;
}
@@ -111,12 +110,12 @@ function online_assignment_cleanup($output=false) {
/// implode the sequence
$section->sequence = implode(',', $sequence);
$DB->set_field('course_sections', 'sequence', $section->sequence, array('id'=>$section->id));
set_field('course_sections', 'sequence', $section->sequence, 'id', $section->id);
/// now we need to remove the instance from the old sequence
/// grab the old section record
if (!($section = $DB->get_record('course_sections', array('id'=>$xsection->id)))) {
if (!($section = get_record('course_sections', 'id', $xsection->id))) {
if ($output) echo 'Serious error: Cannot retrieve old section: '.$xsection->id.' for course: '.$course->fullname.'<br />';
continue;
}
@@ -133,7 +132,7 @@ function online_assignment_cleanup($output=false) {
/// implode the sequence
$section->sequence = implode(',', $sequence);
$DB->set_field('course_sections', 'sequence', $section->sequence, array('id'=>$section->id));
set_field('course_sections', 'sequence', $section->sequence, 'id', $section->id);
if ($output) echo 'Online Assignment (instance '.$instance.') moved from section '.$section->id.': to section '.$newsection.'<br />';
@@ -144,7 +143,7 @@ function online_assignment_cleanup($output=false) {
/// if the summary and sequence are empty then remove this section
if (empty($xsection->summary) and empty($xsection->sequence)) {
$DB->delete_records('course_sections', array('id'=>$xsection->id));
delete_records('course_sections', 'id', $xsection->id);
if ($output) echo 'Deleting empty section '.$xsection->section.'<br />';
}
}
@@ -153,4 +152,4 @@ function online_assignment_cleanup($output=false) {
echo '</center>';
}
?>
+132
View File
@@ -0,0 +1,132 @@
<?php // $Id$
require_once($CFG->libdir.'/pagelib.php');
define('PAGE_ADMIN', 'admin');
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
$lmin = (empty($THEME->block_l_min_width)) ? 0 : $THEME->block_l_min_width;
$lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
$rmin = (empty($THEME->block_r_min_width)) ? 0 : $THEME->block_r_min_width;
$rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width;
define('BLOCK_L_MIN_WIDTH', $lmin);
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
define('BLOCK_R_MAX_WIDTH', $rmax);
page_map_class(PAGE_ADMIN, 'page_admin');
class page_admin extends page_base {
var $section;
var $visiblepathtosection;
// hack alert!
// this function works around the inability to store the section name
// in default block, maybe we should "improve" the blocks a bit?
function init_extra($section) {
global $CFG;
if($this->full_init_done) {
return;
}
$adminroot =& admin_get_root(false, false); //settings not required - only pages
// fetch the path parameter
$this->section = $section;
$current =& $adminroot->locate($section, true);
$this->visiblepathtosection = array_reverse($current->visiblepath);
// all done
$this->full_init_done = true;
}
function blocks_get_default() {
return 'admin_tree,admin_bookmarks';
}
// seems reasonable that the only people that can edit blocks on the admin pages
// are the admins... but maybe we want a role for this?
function user_allowed_editing() {
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
}
// has to be fixed. i know there's a "proper" way to do this
function user_is_editing() {
global $USER;
return $USER->adminediting;
}
function url_get_path() {
global $CFG;
$adminroot =& admin_get_root(false, false); //settings not required - only pages
$root =& $adminroot->locate($this->section);
if (is_a($root, 'admin_externalpage')) {
return $root->url;
} else {
return ($CFG->wwwroot . '/' . $CFG->admin . '/settings.php');
}
}
function url_get_parameters() { // only handles parameters relevant to the admin pagetype
return array('section' => (isset($this->section) ? $this->section : ''));
}
function blocks_get_positions() {
return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
}
function blocks_default_position() {
return BLOCK_POS_LEFT;
}
function blocks_move_position(&$instance, $move) {
if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
return BLOCK_POS_RIGHT;
} else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
return BLOCK_POS_LEFT;
}
return $instance->position;
}
// does anything need to be done here?
function init_quick($data) {
parent::init_quick($data);
}
function print_header($section = '', $focus='') {
global $USER, $CFG, $SITE;
$this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
// if not, print_header() has to be called with a $section parameter
// The search page currently doesn't handle block editing
if ($this->section != 'search' and $this->user_allowed_editing()) {
$buttons = '<div><form '.$CFG->frametarget.' method="get" action="' . $this->url_get_path() . '">'.
'<div><input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
'<input type="hidden" name="section" value="'.$this->section.'" />'.
'<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></div>';
} else {
$buttons = '&nbsp;';
}
$navlinks = array();
foreach ($this->visiblepathtosection as $element) {
$navlinks[] = array('name' => $element, 'link' => null, 'type' => 'misc');
}
$navigation = build_navigation($navlinks);
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');
}
function get_type() {
return PAGE_ADMIN;
}
}
?>
+4 -4
View File
@@ -1,4 +1,4 @@
<?php
<?PHP // $Id$
// phpinfo.php - shows phpinfo for the current server
require_once("../config.php");
@@ -6,7 +6,7 @@
admin_externalpage_setup('phpinfo');
echo $OUTPUT->header();
admin_externalpage_print_header();
echo '<div class="phpinfo">';
@@ -28,6 +28,6 @@
echo '</div>';
echo $OUTPUT->footer();
admin_externalpage_print_footer();
?>
-247
View File
@@ -1,247 +0,0 @@
<?php
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir . '/portfoliolib.php');
require_once($CFG->libdir . '/portfolio/forms.php');
require_once($CFG->libdir . '/adminlib.php');
$portfolio = optional_param('pf', '', PARAM_FORMAT);
$action = optional_param('action', '', PARAM_ALPHA);
$sure = optional_param('sure', '', PARAM_ALPHA);
$display = true; // fall through to normal display
$pagename = 'manageportfolios';
if ($action == 'edit') {
$pagename = 'portfoliosettings' . $portfolio;
} else if ($action == 'delete') {
$pagename = 'portfoliodelete';
} else if (($action == 'newon') || ($action == 'newoff')) {
$pagename = 'portfolionew';
}
// Need to remember this for form
$formaction = $action;
// Check what visibility to show the new repository
if ($action == 'newon') {
$action = 'new';
$visible = 1;
} else if ($action == 'newoff') {
$action = 'new';
$visible = 0;
}
admin_externalpage_setup($pagename);
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$baseurl = "$CFG->wwwroot/$CFG->admin/portfolio.php";
$sesskeyurl = "$CFG->wwwroot/$CFG->admin/portfolio.php?sesskey=" . sesskey();
$configstr = get_string('manageportfolios', 'portfolio');
$return = true; // direct back to the main page
/**
* Helper function that generates a moodle_url object
* relevant to the portfolio
*/
function portfolio_action_url($portfolio) {
global $baseurl;
return new moodle_url($baseurl, array('sesskey'=>sesskey(), 'pf'=>$portfolio));
}
if (($action == 'edit') || ($action == 'new')) {
if (($action == 'edit')) {
$instance = portfolio_instance($portfolio);
$plugin = $instance->get('plugin');
// Since visible is being passed to form
// and used to set the value when a new
// instance is created - we must also
// place the currently visibility into the
// form as well
$visible = $instance->get('visible');
} else {
$instance = null;
$plugin = $portfolio;
}
$PAGE->set_pagetype('admin-portfolio-' . $plugin);
// Display the edit form for this instance
$mform = new portfolio_admin_form('', array('plugin' => $plugin, 'instance' => $instance, 'portfolio' => $portfolio, 'action' => $formaction, 'visible' => $visible));
// End setup, begin output
if ($mform->is_cancelled()){
redirect($baseurl);
exit;
} else if (($fromform = $mform->get_data()) && (confirm_sesskey())) {
// Unset whatever doesn't belong in fromform
foreach (array('pf', 'action', 'plugin', 'sesskey', 'submitbutton') as $key) {
unset($fromform->{$key});
}
// This branch is where you process validated data.
if ($action == 'edit') {
$instance->set_config((array)$fromform);
$instance->save();
} else {
portfolio_static_function($plugin, 'create_instance', $plugin, $fromform->name, $fromform);
}
$savedstr = get_string('instancesaved', 'portfolio');
redirect($baseurl, $savedstr, 1);
exit;
} else {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('configplugin', 'portfolio'));
echo $OUTPUT->box_start();
$mform->display();
echo $OUTPUT->box_end();
$return = false;
}
} else if (($action == 'hide') || ($action == 'show')) {
require_sesskey();
$instance = portfolio_instance($portfolio);
$current = $instance->get('visible');
if (empty($current) && $instance->instance_sanity_check()) {
print_error('cannotsetvisible', 'portfolio', $baseurl);
}
if ($action == 'show') {
$visible = 1;
} else {
$visible = 0;
}
$instance->set('visible', $visible);
$instance->save();
$return = true;
} else if ($action == 'delete') {
$instance = portfolio_instance($portfolio);
if ($sure) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', '', $baseurl);
}
if ($instance->delete()) {
$deletedstr = get_string('instancedeleted', 'portfolio');
redirect($baseurl, $deletedstr, 1);
} else {
print_error('instancenotdeleted', 'portfolio', $baseurl);
}
exit;
} else {
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('sure', 'portfolio', $instance->get('name')), $sesskeyurl . '&pf='.$portfolio.'&action=delete&sure=yes', $baseurl);
$return = false;
}
} else {
// If page is loaded directly
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('manageportfolios', 'portfolio'));
// Get strings that are used
$strshow = get_string('on', 'portfolio');
$strhide = get_string('off', 'portfolio');
$strdelete = get_string('disabledinstance', 'portfolio');
$strsettings = get_string('settings');
$actionchoicesforexisting = array(
'show' => $strshow,
'hide' => $strhide,
'delete' => $strdelete
);
$actionchoicesfornew = array(
'newon' => $strshow,
'newoff' => $strhide,
'delete' => $strdelete
);
$output = $OUTPUT->box_start('generalbox');
$plugins = get_plugin_list('portfolio');
$plugins = array_keys($plugins);
$instances = portfolio_instances(false, false);
$usedplugins = array();
// to avoid notifications being sent out while admin is editing the page
define('ADMIN_EDITING_PORTFOLIO', true);
$insane = portfolio_plugin_sanity_check($plugins);
$insaneinstances = portfolio_instance_sanity_check($instances);
$table = new html_table();
$table->head = array(get_string('plugin', 'portfolio'), '', '');
$table->data = array();
foreach ($instances as $i) {
$settings = '<a href="' . $sesskeyurl . '&amp;action=edit&amp;pf=' . $i->get('id') . '">' . $strsettings .'</a>';
// Set some commonly used variables
$pluginid = $i->get('id');
$plugin = $i->get('plugin');
$pluginname = $i->get('name');
// Check if the instance is misconfigured
if (array_key_exists($plugin, $insane) || array_key_exists($pluginid, $insaneinstances)) {
if (!empty($insane[$plugin])) {
$information = $insane[$plugin];
} else if (!empty($insaneinstances[$pluginid])) {
$information = $insaneinstances[$pluginid];
}
$table->data[] = array($pluginname, $strdelete . " " . $OUTPUT->help_icon($information, 'portfolio_' . $plugin), $settings);
} else {
if ($i->get('visible')) {
$currentaction = 'show';
} else {
$currentaction = 'hide';
}
$select = new single_select(portfolio_action_url($pluginid, 'pf'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . $pluginid);
$table->data[] = array($pluginname, $OUTPUT->render($select), $settings);
}
if (!in_array($plugin, $usedplugins)) {
$usedplugins[] = $plugin;
}
}
// Create insane plugin array
$insaneplugins = array();
if (!empty($plugins)) {
foreach ($plugins as $p) {
// Check if it can not have multiple instances and has already been used
if (!portfolio_static_function($p, 'allows_multiple_instances') && in_array($p, $usedplugins)) {
continue;
}
// Check if it is misconfigured - if so store in array then display later
if (array_key_exists($p, $insane)) {
$insaneplugins[] = $p;
} else {
$select = new single_select(portfolio_action_url($p, 'pf'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . $p);
$table->data[] = array(portfolio_static_function($p, 'get_name'), $OUTPUT->render($select), '');
}
}
}
// Loop through all the insane plugins
if (!empty($insaneplugins)) {
foreach ($insaneplugins as $p) {
$table->data[] = array(portfolio_static_function($p, 'get_name'), $strdelete . " " . $OUTPUT->help_icon($insane[$p], 'portfolio_' . $p), '');
}
}
$output .= html_writer::table($table);
$output .= $OUTPUT->box_end();
echo $output;
$return = false;
}
if ($return) {
// Redirect to base
redirect($baseurl);
}
echo $OUTPUT->footer();
+12 -13
View File
@@ -1,6 +1,6 @@
#!/usr/bin/php -f
<?php
<?php // $Id$
define('FULLME','cron'); // prevent warnings
//error_reporting(0);
//ini_set('display_errors',0);
require_once(dirname(dirname(__FILE__)).'/config.php');
@@ -9,17 +9,16 @@ $address = $tmp[0];
// BOUNCE EMAILS TO NOREPLY
if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
$user = new stdClass();
$user->email = $_ENV['SENDER'];
if (!validate_email($user->email)) {
die();
}
$site = get_site();
$subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname));
$body = get_string('noreplybouncemessage','moodle',format_string($site->fullname))."\n\n";
$fd = fopen('php://stdin','r');
if ($fd) {
while(!feof($fd)) {
@@ -27,14 +26,14 @@ if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
}
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 ();
}
@@ -54,13 +53,13 @@ if ($modid == '0') { // special
$modname = 'moodle';
}
else {
$modname = $DB->get_field("modules", "name", array("id"=>$modid));
$modname = get_field("modules","name","id",$modid);
include_once('mod/'.$modname.'/lib.php');
}
$function = $modname.'_process_email';
if (!function_exists($function)) {
die();
die();
}
$fd = fopen('php://stdin','r');
if (!$fd) {
@@ -71,10 +70,10 @@ while(!feof($fd)) {
$body .= fgets($fd);
}
$function($modargs,$body);
fclose($fd);
$function($modargs,$body);
fclose($handle);
?>
-63
View File
@@ -1,63 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script triggers a full purging of system caches,
* this is useful mostly for developers who did not disable the caching.
*
* @package core
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$confirm = optional_param('confirm', 0, PARAM_BOOL);
admin_externalpage_setup('purgecaches');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
if ($confirm) {
require_sesskey();
// Valid request. Purge, and redisplay the form so it is easy to purge again
// in the near future.
purge_all_caches();
redirect(new moodle_url('/admin/purgecaches.php'), get_string('purgecachesfinished', 'admin'));
} else {
// Show a confirm form.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('purgecaches', 'admin'));
$url = new moodle_url('/admin/purgecaches.php', array('sesskey'=>sesskey(), 'confirm'=>1));
$button = new single_button($url, get_string('purgecaches','admin'), 'post');
// Cancel button takes them back to the page the were on, if possible,
// otherwise to the site home page.
$return = new moodle_url('/');
if (isset($_SERVER['HTTP_REFERER']) and !empty($_SERVER['HTTP_REFERER'])) {
if ($_SERVER['HTTP_REFERER'] !== "$CFG->wwwroot/$CFG->admin/purgecaches.php") {
$return = $_SERVER['HTTP_REFERER'];
}
}
echo $OUTPUT->confirm(get_string('purgecachesconfirm', 'admin'), $button, $return);
echo $OUTPUT->footer();
}
-289
View File
@@ -1,289 +0,0 @@
<?php
// Allows the admin to manage question types.
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/tablelib.php');
/// Check permissions.
require_login();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/question:config', $systemcontext);
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
admin_externalpage_setup('manageqtypes');
/// Get some data we will need - question counts and which types are needed.
$counts = $DB->get_records_sql("
SELECT qtype, COUNT(1) as numquestions, SUM(hidden) as numhidden
FROM {question} GROUP BY qtype", array());
$needed = array();
foreach ($QTYPES as $qtypename => $qtype) {
if (!isset($counts[$qtypename])) {
$counts[$qtypename] = new stdClass;
$counts[$qtypename]->numquestions = 0;
$counts[$qtypename]->numhidden = 0;
}
$needed[$qtypename] = $counts[$qtypename]->numquestions > 0;
$counts[$qtypename]->numquestions -= $counts[$qtypename]->numhidden;
}
$needed['missingtype'] = true; // The system needs the missing question type.
foreach ($QTYPES as $qtypename => $qtype) {
foreach ($qtype->requires_qtypes() as $reqtype) {
$needed[$reqtype] = true;
}
}
foreach ($counts as $qtypename => $count) {
if (!isset($QTYPES[$qtypename])) {
$counts['missingtype']->numquestions += $count->numquestions - $count->numhidden;
$counts['missingtype']->numhidden += $count->numhidden;
}
}
/// Work of the correct sort order.
$config = get_config('question');
$sortedqtypes = array();
foreach ($QTYPES as $qtypename => $qtype) {
$sortedqtypes[$qtypename] = $qtype->local_name();
}
$sortedqtypes = question_sort_qtype_array($sortedqtypes, $config);
/// Process actions ============================================================
// Disable.
if (($disable = optional_param('disable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
if (!isset($QTYPES[$disable])) {
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $disable);
}
set_config($disable . '_disabled', 1, 'question');
redirect(admin_url('qtypes.php'));
}
// Enable.
if (($enable = optional_param('enable', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
if (!isset($QTYPES[$enable])) {
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $enable);
}
if (!$QTYPES[$enable]->menu_name()) {
print_error('cannotenable', 'question', admin_url('qtypes.php'), $enable);
}
unset_config($enable . '_disabled', 'question');
redirect(admin_url('qtypes.php'));
}
// Move up in order.
if (($up = optional_param('up', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
if (!isset($QTYPES[$up])) {
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $up);
}
$neworder = question_reorder_qtypes($sortedqtypes, $up, -1);
question_save_qtype_order($neworder, $config);
redirect(admin_url('qtypes.php'));
}
// Move down in order.
if (($down = optional_param('down', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
if (!isset($QTYPES[$down])) {
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $down);
}
$neworder = question_reorder_qtypes($sortedqtypes, $down, +1);
question_save_qtype_order($neworder, $config);
redirect(admin_url('qtypes.php'));
}
// Delete.
if (($delete = optional_param('delete', '', PARAM_SAFEDIR)) && confirm_sesskey()) {
// Check it is OK to delete this question type.
if ($delete == 'missingtype') {
print_error('cannotdeletemissingqtype', 'admin', admin_url('qtypes.php'));
}
if (!isset($QTYPES[$delete])) {
print_error('unknownquestiontype', 'question', admin_url('qtypes.php'), $delete);
}
$qtypename = $QTYPES[$delete]->local_name();
if ($counts[$delete]->numquestions + $counts[$delete]->numhidden > 0) {
print_error('cannotdeleteqtypeinuse', 'admin', admin_url('qtypes.php'), $qtypename);
}
if ($needed[$delete] > 0) {
print_error('cannotdeleteqtypeneeded', 'admin', admin_url('qtypes.php'), $qtypename);
}
// If not yet confirmed, display a confirmation message.
if (!optional_param('confirm', '', PARAM_BOOL)) {
$qtypename = $QTYPES[$delete]->local_name();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deleteqtypeareyousure', 'admin', $qtypename));
echo $OUTPUT->confirm(get_string('deleteqtypeareyousuremessage', 'admin', $qtypename),
admin_url('qtypes.php?delete=' . $delete . '&confirm=1'),
admin_url('qtypes.php'));
echo $OUTPUT->footer();
exit;
}
// Do the deletion.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deletingqtype', 'admin', $qtypename));
// Delete any configuration records.
if (!unset_all_config_for_plugin('qtype_' . $delete)) {
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qtype_' . $delete));
}
unset_config($delete . '_disabled', 'question');
unset_config($delete . '_sortorder', 'question');
// Then the tables themselves
drop_plugin_tables($delete, $QTYPES[$delete]->plugin_dir() . '/db/install.xml', false);
// Remove event handlers and dequeue pending events
events_uninstall('qtype/' . $delete);
$a->qtype = $qtypename;
$a->directory = $QTYPES[$delete]->plugin_dir();
echo $OUTPUT->box(get_string('qtypedeletefiles', 'admin', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button(admin_url('qtypes.php'));
echo $OUTPUT->footer();
exit;
}
// End of process actions ==================================================
/// Print the page heading.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('manageqtypes', 'admin'));
/// Set up the table.
$table = new flexible_table('qtypeadmintable');
$table->define_columns(array('questiontype', 'numquestions', 'version', 'requires',
'availableto', 'delete', 'settings'));
$table->define_headers(array(get_string('questiontype', 'admin'), get_string('numquestions', 'admin'),
get_string('version'), get_string('requires', 'admin'), get_string('availableq', 'question'),
get_string('delete'), get_string('settings')));
$table->set_attribute('id', 'qtypes');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
/// Add a row for each question type.
$createabletypes = question_type_menu();
foreach ($sortedqtypes as $qtypename => $localname) {
$qtype = $QTYPES[$qtypename];
$row = array();
// Question icon and name.
$fakequestion = new stdClass;
$fakequestion->qtype = $qtypename;
$icon = print_question_icon($fakequestion, true);
$row[] = $icon . ' ' . $localname;
// Number of questions of this type.
if ($counts[$qtypename]->numquestions + $counts[$qtypename]->numhidden > 0) {
if ($counts[$qtypename]->numhidden > 0) {
$strcount = get_string('numquestionsandhidden', 'admin', $counts[$qtypename]);
} else {
$strcount = $counts[$qtypename]->numquestions;
}
if ($canviewreports) {
$row[] = '<a href="' . admin_url('/report/questioninstances/index.php?qtype=' . $qtypename) .
'" title="' . get_string('showdetails', 'admin') . '">' . $strcount . '</a>';
} else {
$strcount;
}
} else {
$row[] = 0;
}
// Question version number.
$version = get_config('qtype_' . $qtypename, 'version');
if ($version) {
$row[] = $version;
} else {
$row[] = '<span class="disabled">' . get_string('nodatabase', 'admin') . '</span>';
}
// Other question types required by this one.
$requiredtypes = $qtype->requires_qtypes();
$strtypes = array();
if (!empty($requiredtypes)) {
foreach ($requiredtypes as $required) {
$strtypes[] = $QTYPES[$required]->local_name();
}
$row[] = implode(', ', $strtypes);
} else {
$row[] = '';
}
// Are people allowed to create new questions of this type?
$rowclass = '';
if ($qtype->menu_name()) {
$createable = isset($createabletypes[$qtypename]);
$icons = enable_disable_button($qtypename, $createable);
if (!$createable) {
$rowclass = 'dimmed_text';
}
} else {
$icons = '<img src="' . $OUTPUT->pix_url('spacer') . '" alt="" class="spacer" />';
}
// Move icons.
$icons .= icon_html('up', $qtypename, 't/up', get_string('up'), '');
$icons .= icon_html('down', $qtypename, 't/down', get_string('down'), '');
$row[] = $icons;
// Delete link, if available.
if ($needed[$qtypename]) {
$row[] = '';
} else {
$row[] = '<a href="' . admin_url('qtypes.php?delete=' . $qtypename .
'&amp;sesskey=' . sesskey()) . '" title="' .
get_string('uninstallqtype', 'admin') . '">' . get_string('delete') . '</a>';
}
// Settings link, if available.
if (file_exists($qtype->plugin_dir() . '/settings.php')) {
$row[] = '<a href="' . admin_url('settings.php?section=qtypesetting' . $qtypename) .
'">' . get_string('settings') . '</a>';
} else {
$row[] = '';
}
$table->add_data($row, $rowclass);
}
$table->finish_output();
echo $OUTPUT->footer();
function admin_url($endbit) {
global $CFG;
return $CFG->wwwroot . '/' . $CFG->admin . '/' . $endbit;
}
function enable_disable_button($qtypename, $createable) {
if ($createable) {
return icon_html('disable', $qtypename, 'i/hide', get_string('enabled', 'question'), get_string('disable'));
} else {
return icon_html('enable', $qtypename, 'i/show', get_string('disabled', 'question'), get_string('enable'));
}
}
function icon_html($action, $qtypename, $icon, $alt, $tip) {
global $OUTPUT;
if ($tip) {
$tip = 'title="' . $tip . '" ';
}
$html = ' <form action="' . admin_url('qtypes.php') . '" method="post"><div>';
$html .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
$html .= '<input type="image" name="' . $action . '" value="' . $qtypename .
'" src="' . $OUTPUT->pix_url($icon) . '" alt="' . $alt . '" ' . $tip . '/>';
$html .= '</div></form>';
return $html;
}
+192
View File
@@ -0,0 +1,192 @@
<?php // $Id$
// register.php - allows admin to register their site on moodle.org
require_once('../config.php');
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
if (!$site = get_site()) {
redirect("index.php");
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if (!$admin = get_admin()) {
error("No admins");
}
if (!$admin->country and $CFG->country) {
$admin->country = $CFG->country;
}
if (empty($CFG->siteidentifier)) { // Unique site identification code
set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
}
/// Print headings
$stradministration = get_string("administration");
$strregistration = get_string("registration");
$strregistrationinfo = get_string("registrationinfo");
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strregistration", $site->fullname, $navigation);
print_heading($strregistration);
print_simple_box($strregistrationinfo, "center", "70%");
/// Print the form
echo "<form id=\"mform1\" class=\"mform\" action=\"http://moodle.org/register/\" method=\"post\">\n";
echo '<fieldset id="registration">';
echo '<legend>Registration Information</legend>';
echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\" />\n";
echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\" />\n";
echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\" />\n";
echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\" />\n";
echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\" />\n";
echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\" />\n";
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>URL</label></div>';
echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
echo '<div class="felement ftext">';
echo '<input size="50" id="sitename" type="text" name="sitename" value="'.format_string($site->fullname).'" />';
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menucountry">'.get_string("country").'</label></div>';
echo '<div class="felement ftext">';
choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menupublic">'."<a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"".get_string("publicdirectorytitle")."\">".get_string("publicdirectory")."</a>".'</label></div>';
echo '<div class="felement ftext">';
$options[0] = get_string("publicdirectory0");
$options[1] = get_string("publicdirectory1");
$options[2] = get_string("publicdirectory2");
choose_from_menu ($options, "public", "2", "", "", "");
unset($options);
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menucontact">'.get_string("registrationcontact").'</label></div>';
echo '<div class="felement ftext">';
$options[0] = get_string("registrationcontactno");
$options[1] = get_string("registrationcontactyes");
choose_from_menu ($options, "contact", "1", "", "", "");
unset($options);
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
echo '<div class="felement ftext">';
$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', 'deleted', 0);
echo get_string("users").": ".$count;
echo "<input type=\"hidden\" name=\"users\" value=\"$count\" />\n";
echo '<br />';
// total number of role assignments
$count = count_records('role_assignments');
echo get_string('roleassignments', 'role').": ".$count;
echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
echo '<br />';
// first find all distinct roles with mod/course:update
// please change the name and strings to something appropriate to reflect the new data collected
$sql = "SELECT COUNT(DISTINCT u.id)
FROM {$CFG->prefix}role_capabilities rc,
{$CFG->prefix}role_assignments ra,
{$CFG->prefix}user u
WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything')
AND rc.roleid = ra.roleid
AND u.id = ra.userid";
$count = count_records_sql($sql);
echo get_string("teachers").": ".$count;
echo "<input type=\"hidden\" name=\"courseupdaters\" 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('question');
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 '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
echo '<div class="felement ftext">';
echo "<input size=\"50\" type=\"text\" id=\"adminname\" name=\"adminname\" value=\"".fullname($admin, true)."\" />";
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="adminemail">'.get_string("email").'</label></div>';
echo '<div class="felement ftext">';
echo "<input size=\"50\" type=\"text\" id=\"adminemail\" name=\"adminemail\" value=\"$admin->email\" />";
echo '</div>';
echo '</div>';
echo '<div class="fitem">';
echo '<div class="fitemtitle"><label for="menumailme">'.get_string("registrationemail").'</label></div>';
echo '<div class="felement ftext">';
$options[0] = get_string("registrationno");
$options[1] = get_string("registrationyes");
choose_from_menu ($options, "mailme", "1", "", "", "");
unset($options);
echo '</div>';
echo '</div>';
echo '<div class="felement fsubmit"><input name="submitbutton" value="'.get_string('registrationsend').'" type="submit" id="id_submitbutton" /></div>';
echo "</fieldset>\n";
echo "</form>\n";
print_footer();
?>
@@ -1,92 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// This file is part of Moodle - http://moodle.org/ //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// //
// Moodle is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Moodle is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. //
// //
///////////////////////////////////////////////////////////////////////////
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* The administrator is redirect to this page from the hub to confirm that the
* site has been registered. It is an administration page. The administrator
* should be using the same browser during all the registration process.
* This page save the token that the hub gave us, in order to call the hub
* directory later by web service.
*/
require('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
$newtoken = optional_param('newtoken', '', PARAM_ALPHANUM);
$url = optional_param('url', '', PARAM_URL);
$hubname = optional_param('hubname', '', PARAM_TEXT);
$token = optional_param('token', '', PARAM_TEXT);
$error = optional_param('error', '', PARAM_ALPHANUM);
admin_externalpage_setup('registrationindex');
if (!empty($error) and $error == 'urlalreadyexist') {
throw new moodle_exception('urlalreadyregistered', 'hub',
$CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
}
//check that we are waiting a confirmation from this hub, and check that the token is correct
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_unconfirmedhub($url);
if (!empty($registeredhub) and $registeredhub->token == $token) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
$hublink = html_writer::tag('a', $hubname, array('href' => $url));
$registeredhub->token = $newtoken;
$registeredhub->confirmed = 1;
$registeredhub->hubname = $hubname;
$registrationmanager->update_registeredhub($registeredhub);
//display notficiation message
$notificationmessage = $OUTPUT->notification(
get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
echo $notificationmessage;
//display continue button
$registrationpage = new moodle_url('/admin/registration/index.php');
$continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue', 'hub')));
$continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
echo $continuebutton;
if (!extension_loaded('xmlrpc')) {
//display notice about xmlrpc
$xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
echo $OUTPUT->notification($xmlrpcnotification);
}
echo $OUTPUT->footer();
} else {
throw new moodle_exception('wrongtoken', 'hub',
$CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
}
-467
View File
@@ -1,467 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// This file is part of Moodle - http://moodle.org/ //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// //
// Moodle is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Moodle is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. //
// //
///////////////////////////////////////////////////////////////////////////
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* The forms needed by registration pages.
*/
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
/**
* This form display a unregistration form.
*/
class site_unregistration_form extends moodleform {
public function definition() {
$mform = & $this->_form;
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
$huburl = $this->_customdata['huburl'];
$hubname = $this->_customdata['hubname'];
$unregisterlabel = get_string('unregister', 'hub');
$mform->addElement('checkbox', 'unpublishalladvertisedcourses', '',
' ' . get_string('unpublishalladvertisedcourses', 'hub'));
$mform->addElement('checkbox', 'unpublishalluploadedcourses', '',
' ' . get_string('unpublishalluploadedcourses', 'hub'));
$mform->addElement('hidden', 'confirm', 1);
$mform->setType('confirm', PARAM_INT);
$mform->addElement('hidden', 'unregistration', 1);
$mform->setType('unregistration', PARAM_INT);
$mform->addElement('hidden', 'huburl', $huburl);
$mform->setType('huburl', PARAM_URL);
$mform->addElement('hidden', 'hubname', $hubname);
$mform->setType('hubname', PARAM_TEXT);
$this->add_action_buttons(true, $unregisterlabel);
}
}
/**
* This form display a clean registration data form.
*/
class site_clean_registration_data_form extends moodleform {
public function definition() {
$mform = & $this->_form;
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
$huburl = $this->_customdata['huburl'];
$hubname = $this->_customdata['hubname'];
$unregisterlabel = get_string('forceunregister', 'hub');
$mform->addElement('static', '', get_string('warning', 'hub'), get_string('forceunregisterconfirmation', 'hub', $hubname));
$mform->addElement('hidden', 'confirm', 1);
$mform->setType('confirm', PARAM_INT);
$mform->addElement('hidden', 'unregistration', 1);
$mform->setType('unregistration', PARAM_INT);
$mform->addElement('hidden', 'cleanregdata', 1);
$mform->setType('cleanregdata', PARAM_INT);
$mform->addElement('hidden', 'huburl', $huburl);
$mform->setType('huburl', PARAM_URL);
$mform->addElement('hidden', 'hubname', $hubname);
$mform->setType('hubname', PARAM_TEXT);
$this->add_action_buttons(true, $unregisterlabel);
}
}
/**
* This form display a hub selector.
* The hub list is retrieved from Moodle.org hub directory.
* Also displayed, a text field to enter private hub url + its password
*/
class hub_selector_form extends moodleform {
public function definition() {
global $CFG, $OUTPUT;
$mform = & $this->_form;
$mform->addElement('header', 'site', get_string('selecthub', 'hub'));
//retrieve the hub list on the hub directory by web service
$function = 'hubdirectory_get_hubs';
$params = array();
$serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
try {
$hubs = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
$error = $OUTPUT->notification(get_string('errorhublisting', 'hub', $e->getMessage()));
$mform->addElement('static', 'errorhub', '', $error);
$hubs = array();
}
//remove moodle.org from the hub list
foreach ($hubs as $key => $hub) {
if ($hub['url'] == HUB_MOODLEORGHUBURL) {
unset($hubs[$key]);
}
}
//Public hub list
$options = array();
foreach ($hubs as $hub) {
//to not display a name longer than 100 character (too big)
if (strlen($hub['name']) > 100) {
$hubname = substr($hub['name'], 0, 100);
$hubname = $hubname . "...";
} else {
$hubname = $hub['name'];
}
$options[$hub['url']] = $hubname;
$mform->addElement('hidden', clean_param($hub['url'], PARAM_ALPHANUMEXT), $hubname);
$mform->setType(clean_param($hub['url'], PARAM_ALPHANUMEXT), PARAM_ALPHANUMEXT);
}
if (!empty($hubs)) {
$mform->addElement('select', 'publichub', get_string('publichub', 'hub'),
$options, array("size" => 15));
}
$mform->addElement('static', 'or', '', get_string('orenterprivatehub', 'hub'));
//Private hub
$mform->addElement('text', 'unlistedurl', get_string('privatehuburl', 'hub'),
array('class' => 'registration_textfield'));
$mform->addElement('text', 'password', get_string('password'),
array('class' => 'registration_textfield'));
$this->add_action_buttons(false, get_string('selecthub', 'hub'));
}
/**
* Check the unlisted URL is a URL
*/
function validation($data, $files) {
global $CFG;
$errors = parent::validation($data, $files);
$unlistedurl = $this->_form->_submitValues['unlistedurl'];
if (!empty($unlistedurl)) {
$unlistedurltotest = clean_param($unlistedurl, PARAM_URL);
if (empty($unlistedurltotest)) {
$errors['unlistedurl'] = get_string('badurlformat', 'hub');
}
}
return $errors;
}
}
/**
* The site registration form. Information will be sent to a given hub.
*/
class site_registration_form extends moodleform {
public function definition() {
global $CFG, $DB;
$strrequired = get_string('required');
$mform = & $this->_form;
$huburl = $this->_customdata['huburl'];
$hubname = $this->_customdata['hubname'];
$password = $this->_customdata['password'];
$admin = get_admin();
$site = get_site();
//retrieve config for this hub and set default if they don't exist
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
$sitename = get_config('hub', 'site_name_' . $cleanhuburl);
if ($sitename === false) {
$sitename = $site->fullname;
}
$sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
if ($sitedescription === false) {
$sitedescription = $site->summary;
}
$contactname = get_config('hub', 'site_contactname_' . $cleanhuburl);
if ($contactname === false) {
$contactname = fullname($admin, true);
}
$contactemail = get_config('hub', 'site_contactemail_' . $cleanhuburl);
if ($contactemail === false) {
$contactemail = $admin->email;
}
$contactphone = get_config('hub', 'site_contactphone_' . $cleanhuburl);
if ($contactphone === false) {
$contactphone = $admin->phone1;
}
$imageurl = get_config('hub', 'site_imageurl_' . $cleanhuburl);
$privacy = get_config('hub', 'site_privacy_' . $cleanhuburl);
$address = get_config('hub', 'site_address_' . $cleanhuburl);
$region = get_config('hub', 'site_region_' . $cleanhuburl);
$country = get_config('hub', 'site_country_' . $cleanhuburl);
if ($country === false) {
$country = $admin->country;
}
$language = get_config('hub', 'site_language_' . $cleanhuburl);
if ($language === false) {
$language = current_language();
}
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
$emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl);
$coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl);
$usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl);
$roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl);
$postsnumber = get_config('hub', 'site_postsnumber_' . $cleanhuburl);
$questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
$resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
$mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
//hidden parameters
$mform->addElement('hidden', 'huburl', $huburl);
$mform->setType('huburl', PARAM_URL);
$mform->addElement('hidden', 'hubname', $hubname);
$mform->setType('hubname', PARAM_TEXT);
$mform->addElement('hidden', 'password', $password);
$mform->setType('password', PARAM_RAW);
//the input parameters
$mform->addElement('header', 'moodle', get_string('registrationinfo', 'hub'));
$mform->addElement('text', 'name', get_string('sitename', 'hub'),
array('class' => 'registration_textfield'));
$mform->addRule('name', $strrequired, 'required', null, 'client');
$mform->setType('name', PARAM_TEXT);
$mform->setDefault('name', $sitename);
$mform->addHelpButton('name', 'sitename', 'hub');
$options = array();
$registrationmanager = new registration_manager();
$options[HUB_SITENOTPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENOTPUBLISHED);
$options[HUB_SITENAMEPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENAMEPUBLISHED);
$options[HUB_SITELINKPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITELINKPUBLISHED);
$mform->addElement('select', 'privacy', get_string('siteprivacy', 'hub'), $options);
$mform->setDefault('privacy', $privacy);
$mform->addHelpButton('privacy', 'privacy', 'hub');
unset($options);
$mform->addElement('textarea', 'description', get_string('sitedesc', 'hub'),
array('rows' => 8, 'cols' => 41));
$mform->addRule('description', $strrequired, 'required', null, 'client');
$mform->setDefault('description', $sitedescription);
$mform->setType('description', PARAM_TEXT);
$mform->addHelpButton('description', 'sitedesc', 'hub');
$mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $CFG->wwwroot);
$mform->addHelpButton('urlstring', 'siteurl', 'hub');
$languages = get_string_manager()->get_list_of_languages();
textlib_get_instance()->asort($languages);
$mform->addElement('select', 'language', get_string('sitelang', 'hub'),
$languages);
$mform->setType('language', PARAM_ALPHANUMEXT);
$mform->addHelpButton('language', 'sitelang', 'hub');
$mform->setDefault('language', $language);
$mform->addElement('static', 'versionstring', get_string('siteversion', 'hub'), $CFG->version);
$mform->addElement('hidden', 'moodleversion', $CFG->version);
$mform->setType('moodleversion', PARAM_INT);
$mform->addHelpButton('versionstring', 'siteversion', 'hub');
$mform->addElement('static', 'releasestring', get_string('siterelease', 'hub'), $CFG->release);
$mform->addElement('hidden', 'moodlerelease', $CFG->release);
$mform->setType('moodlerelease', PARAM_TEXT);
$mform->addHelpButton('releasestring', 'siterelease', 'hub');
$mform->addElement('textarea', 'address', get_string('postaladdress', 'hub'),
array('rows' => 4, 'cols' => 41));
$mform->setType('address', PARAM_TEXT);
$mform->setDefault('address', $address);
$mform->addHelpButton('address', 'postaladdress', 'hub');
//TODO: use the region array I generated
// $mform->addElement('select', 'region', get_string('selectaregion'), array('-' => '-'));
// $mform->setDefault('region', $region);
$mform->addElement('hidden', 'regioncode', '-');
$mform->setType('regioncode', PARAM_ALPHANUMEXT);
$countries = get_string_manager()->get_list_of_countries();
$mform->addElement('select', 'countrycode', get_string('sitecountry', 'hub'), $countries);
$mform->setDefault('countrycode', $country);
$mform->addHelpButton('countrycode', 'sitecountry', 'hub');
$mform->addElement('text', 'geolocation', get_string('sitegeolocation', 'hub'),
array('class' => 'registration_textfield'));
$mform->setDefault('geolocation', $geolocation);
$mform->addHelpButton('geolocation', 'sitegeolocation', 'hub');
$mform->addElement('text', 'contactname', get_string('siteadmin', 'hub'),
array('class' => 'registration_textfield'));
$mform->addRule('contactname', $strrequired, 'required', null, 'client');
$mform->setType('contactname', PARAM_TEXT);
$mform->setDefault('contactname', $contactname);
$mform->addHelpButton('contactname', 'siteadmin', 'hub');
$mform->addElement('text', 'contactphone', get_string('sitephone', 'hub'),
array('class' => 'registration_textfield'));
$mform->setType('contactphone', PARAM_TEXT);
$mform->addHelpButton('contactphone', 'sitephone', 'hub');
$mform->addElement('text', 'contactemail', get_string('siteemail', 'hub'),
array('class' => 'registration_textfield'));
$mform->addRule('contactemail', $strrequired, 'required', null, 'client');
$mform->setType('contactemail', PARAM_TEXT);
$mform->setDefault('contactemail', $contactemail);
$mform->addHelpButton('contactemail', 'siteemail', 'hub');
$options = array();
$options[0] = get_string("registrationcontactno");
$options[1] = get_string("registrationcontactyes");
$mform->addElement('select', 'contactable', get_string('siteregistrationcontact', 'hub'), $options);
$mform->setDefault('contactable', $contactable);
$mform->addHelpButton('contactable', 'siteregistrationcontact', 'hub');
unset($options);
$options = array();
$options[0] = get_string("registrationno");
$options[1] = get_string("registrationyes");
$mform->addElement('select', 'emailalert', get_string('siteregistrationemail', 'hub'), $options);
$mform->setDefault('emailalert', $emailalert);
$mform->addHelpButton('emailalert', 'siteregistrationemail', 'hub');
unset($options);
//TODO site logo
$mform->addElement('hidden', 'imageurl', ''); //TODO: temporary
$mform->setType('imageurl', PARAM_URL);
/// Display statistic that are going to be retrieve by the hub
$coursecount = $DB->count_records('course') - 1;
$usercount = $DB->count_records('user', array('deleted' => 0));
$roleassigncount = $DB->count_records('role_assignments');
$postcount = $DB->count_records('forum_posts');
$questioncount = $DB->count_records('question');
$resourcecount = $DB->count_records('resource');
require_once($CFG->dirroot . "/course/lib.php");
$participantnumberaverage = number_format(average_number_of_participants(), 2);
$modulenumberaverage = number_format(average_number_of_courses_modules(), 2);
if (HUB_MOODLEORGHUBURL != $huburl) {
$mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
" " . get_string('coursesnumber', 'hub', $coursecount));
$mform->setDefault('courses', true);
$mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
$mform->addElement('checkbox', 'users', '',
" " . get_string('usersnumber', 'hub', $usercount));
$mform->setDefault('users', true);
$mform->addElement('checkbox', 'roleassignments', '',
" " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
$mform->setDefault('roleassignments', true);
$mform->addElement('checkbox', 'posts', '',
" " . get_string('postsnumber', 'hub', $postcount));
$mform->setDefault('posts', true);
$mform->addElement('checkbox', 'questions', '',
" " . get_string('questionsnumber', 'hub', $questioncount));
$mform->setDefault('questions', true);
$mform->addElement('checkbox', 'resources', '',
" " . get_string('resourcesnumber', 'hub', $resourcecount));
$mform->setDefault('resources', true);
$mform->addElement('checkbox', 'participantnumberaverage', '',
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
$mform->setDefault('participantnumberaverage', true);
$mform->addElement('checkbox', 'modulenumberaverage', '',
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
$mform->setDefault('modulenumberaverage', true);
} else {
$mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
" " . get_string('coursesnumber', 'hub', $coursecount));
$mform->addElement('hidden', 'courses', true);
$mform->setType('courses', PARAM_FLOAT);
$mform->addHelpButton('courseslabel', 'sendfollowinginfo', 'hub');
$mform->addElement('static', 'userslabel', '',
" " . get_string('usersnumber', 'hub', $usercount));
$mform->addElement('hidden', 'users', true);
$mform->setType('users', PARAM_FLOAT);
$mform->addElement('static', 'roleassignmentslabel', '',
" " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
$mform->addElement('hidden', 'roleassignments', true);
$mform->setType('roleassignments', PARAM_FLOAT);
$mform->addElement('static', 'postslabel', '',
" " . get_string('postsnumber', 'hub', $postcount));
$mform->addElement('hidden', 'posts', true);
$mform->setType('posts', PARAM_FLOAT);
$mform->addElement('static', 'questionslabel', '',
" " . get_string('questionsnumber', 'hub', $questioncount));
$mform->addElement('hidden', 'questions', true);
$mform->setType('questions', PARAM_FLOAT);
$mform->addElement('static', 'resourceslabel', '',
" " . get_string('resourcesnumber', 'hub', $resourcecount));
$mform->addElement('hidden', 'resources', true);
$mform->setType('resources', PARAM_FLOAT);
$mform->addElement('static', 'participantnumberaveragelabel', '',
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
$mform->addElement('hidden', 'participantnumberaverage', true);
$mform->setType('participantnumberaverage', PARAM_FLOAT);
$mform->addElement('static', 'modulenumberaveragelabel', '',
" " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
$mform->addElement('hidden', 'modulenumberaverage', true);
$mform->setType('modulenumberaverage', PARAM_FLOAT);
}
//check if it's a first registration or update
$hubregistered = $registrationmanager->get_registeredhub($huburl);
if (!empty($hubregistered)) {
$buttonlabel = get_string('updatesite', 'hub',
!empty($hubname) ? $hubname : $huburl);
$mform->addElement('hidden', 'update', true);
$mform->setType('update', PARAM_BOOL);
} else {
$buttonlabel = get_string('registersite', 'hub',
!empty($hubname) ? $hubname : $huburl);
}
$this->add_action_buttons(false, $buttonlabel);
}
}
-68
View File
@@ -1,68 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* Thsi page displays a hub selector or a hub URL + password. Then it will redirect to
* the site registration form (with the selected hub as parameter)
*/
require('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/' . $CFG->admin . '/registration/forms.php');
admin_externalpage_setup('registrationselector');
$hubselectorform = new hub_selector_form();
$fromform = $hubselectorform->get_data();
//// Redirect to the registration form if an URL has been choosen ////
$selectedhuburl = optional_param('publichub', false, PARAM_URL);
$unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
$password = optional_param('password', '', PARAM_RAW);
if (!empty($unlistedhuburl)) {
if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
$huburl = $unlistedhuburl;
}
} else if (!empty($selectedhuburl)) {
$huburl = $selectedhuburl;
}
//redirect
if (!empty($huburl) and confirm_sesskey()) {
$hubname = optional_param(clean_param($huburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
$params = array('sesskey' => sesskey(), 'huburl' => $huburl,
'password' => $password, 'hubname' => $hubname);
redirect(new moodle_url($CFG->wwwroot."/" . $CFG->admin . "/registration/register.php",
$params));
}
//// OUTPUT ////
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('registeron', 'hub'), 3, 'main');
$hubselectorform->display();
echo $OUTPUT->footer();
-168
View File
@@ -1,168 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* On this page the administrator select if he wants to register on Moodle.org or
* a specific hub
*/
require('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
require_once($CFG->dirroot . '/course/publish/lib.php');
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
admin_externalpage_setup('registrationindex');
$renderer = $PAGE->get_renderer('core', 'register');
$unregistration = optional_param('unregistration', 0, PARAM_INT);
$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_INT);
$huburl = optional_param('huburl', '', PARAM_URL);
$cancel = optional_param('cancel', null, PARAM_ALPHA);
$registrationmanager = new registration_manager();
$publicationmanager = new course_publish_manager();
$errormessage = '';
if (empty($cancel) and $unregistration and $confirm and confirm_sesskey()) {
$hub = $registrationmanager->get_registeredhub($huburl);
//unpublish course and unregister the site by web service
if (!$cleanregdata) {
//check if we need to unpublish courses
//enrollable courses
$unpublishalladvertisedcourses = optional_param('unpublishalladvertisedcourses', 0, PARAM_INT);
$hubcourseids = array();
if ($unpublishalladvertisedcourses) {
$enrollablecourses = $publicationmanager->get_publications($huburl, null, 1);
if (!empty($enrollablecourses)) {
foreach ($enrollablecourses as $enrollablecourse) {
$hubcourseids[] = $enrollablecourse->hubcourseid;
}
}
}
//downloadable courses
$unpublishalluploadedcourses = optional_param('unpublishalluploadedcourses', 0, PARAM_INT);
if ($unpublishalluploadedcourses) {
$downloadablecourses = $publicationmanager->get_publications($huburl, null, 0);
if (!empty($downloadablecourses)) {
foreach ($downloadablecourses as $downloadablecourse) {
$hubcourseids[] = $downloadablecourse->hubcourseid;
}
}
}
//unpublish the courses by web service
if (!empty($hubcourseids)) {
$function = 'hub_unregister_courses';
$params = array('courseids' => $hubcourseids);
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
try {
$result = $xmlrpcclient->call($function, $params);
//delete the published courses
if (!empty($enrollablecourses)) {
$publicationmanager->delete_hub_publications($huburl, 1);
}
if (!empty($downloadablecourses)) {
$publicationmanager->delete_hub_publications($huburl, 0);
}
} catch (Exception $e) {
$errormessage = $e->getMessage();
$errormessage .= html_writer::empty_tag('br') .
get_string('errorunpublishcourses', 'hub');
$confirm = false;
$cleanregdata = 1;
}
}
}
//course unpublish went ok, unregister the site now
if ($confirm) {
$function = 'hub_unregister_site';
$params = array();
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
try {
$result = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
if (!$cleanregdata) {
$errormessage = $e->getMessage();
$confirm = false;
$cleanregdata = 1;
}
}
}
//check that we are still processing the unregistration,
//it could have been unset if an exception were previsouly catched
if ($confirm) {
$registrationmanager->delete_registeredhub($huburl);
}
}
echo $OUTPUT->header();
//do not check sesskey if confirm = false because this script is linked into email message
if (!empty($errormessage)) {
echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
}
if (empty($cancel) and $unregistration and !$confirm) {
$hub = $registrationmanager->get_registeredhub($huburl);
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', $hub->hubname), 3, 'main');
if ($cleanregdata) {
$siteunregistrationform = new site_clean_registration_data_form('',
array('huburl' => $huburl, 'hubname' => $hub->hubname));
} else {
$siteunregistrationform = new site_unregistration_form('',
array('huburl' => $huburl, 'hubname' => $hub->hubname));
}
$siteunregistrationform->display();
} else {
$registeredonmoodleorg = false;
$moodleorghub = $registrationmanager->get_registeredhub(HUB_MOODLEORGHUBURL);
if (!empty($moodleorghub)) {
$registeredonmoodleorg = true;
}
echo $OUTPUT->heading(get_string('registeron', 'hub'), 3, 'main');
echo $renderer->registrationselector($registeredonmoodleorg);
if (extension_loaded('xmlrpc')) {
$hubs = $registrationmanager->get_registered_on_hubs();
if (!empty($hubs)) {
echo $OUTPUT->heading(get_string('registeredon', 'hub'), 3, 'main');
echo $renderer->registeredonhublisting($hubs);
}
} else { //display notice about xmlrpc
$xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
echo $OUTPUT->notification($xmlrpcnotification);
}
}
echo $OUTPUT->footer();
-269
View File
@@ -1,269 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
//// SITE PRIVACY /////
/**
* Site privacy: private
*/
define('HUB_SITENOTPUBLISHED', 'notdisplayed');
/**
* Site privacy: public
*/
define('HUB_SITENAMEPUBLISHED', 'named');
/**
* Site privacy: public and global
*/
define('HUB_SITELINKPUBLISHED', 'linked');
/**
*
* Site registration library
*
* @package course
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
* @author Jerome Mouneyrac
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class registration_manager {
/**
* Automatically update the registration on all hubs
*/
public function cron() {
global $CFG;
if (extension_loaded('xmlrpc')) {
//check if the last registration cron update was less than a week ago
$lastcron = get_config('registration', 'crontime');
if ($lastcron === false or $lastcron < strtotime("-7 day")) { //set to a week, see MDL-23704
$function = 'hub_update_site_info';
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
//update all hub where the site is registered on
$hubs = $this->get_registered_on_hubs();
foreach ($hubs as $hub) {
//update the registration
$siteinfo = $this->get_site_info($hub->huburl);
$params = array('siteinfo' => $siteinfo);
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
try {
$result = $xmlrpcclient->call($function, $params);
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
} catch (Exception $e) {
$errorparam = new stdClass();
$errorparam->errormessage = $e->getMessage();
$errorparam->hubname = $hub->hubname;
mtrace(get_string('errorcron', 'hub', $errorparam));
}
}
set_config('crontime', time(), 'registration');
}
} else {
mtrace(get_string('errorcronnoxmlrpc', 'hub'));
}
}
/**
* When the site register on a hub, he must call this function
* @param object $hub where the site is registered on
* @return integer id of the record
*/
public function add_registeredhub($hub) {
global $DB;
$id = $DB->insert_record('registration_hubs', $hub);
return $id;
}
/**
* When a site unregister from a hub, he must call this function
* @param string $huburl the huburl to delete
*/
public function delete_registeredhub($huburl) {
global $DB;
$DB->delete_records('registration_hubs', array('huburl' => $huburl));
}
/**
* Get a hub on which the site is registered for a given url or token
* Mostly use to check if the site is registered on a specific hub
* @param string $huburl
* @param string $token
* @return object the hub
*/
public function get_registeredhub($huburl = null, $token = null) {
global $DB;
$params = array();
if (!empty($huburl)) {
$params['huburl'] = $huburl;
}
if (!empty($token)) {
$params['token'] = $token;
}
$params['confirmed'] = 1;
$token = $DB->get_record('registration_hubs', $params);
return $token;
}
/**
* Get the hub which has not confirmed that the site is registered on,
* but for which a request has been sent
* @param string $huburl
* @return object the hub
*/
public function get_unconfirmedhub($huburl) {
global $DB;
$params = array();
$params['huburl'] = $huburl;
$params['confirmed'] = 0;
$token = $DB->get_record('registration_hubs', $params);
return $token;
}
/**
* Update a registered hub (mostly use to update the confirmation status)
* @param object $communication the hub
*/
public function update_registeredhub($communication) {
global $DB;
$DB->update_record('registration_hubs', $communication);
}
/**
* Return all hubs where the site is registered on
*/
public function get_registered_on_hubs() {
global $DB;
$hubs = $DB->get_records('registration_hubs', array('confirmed' => 1));
return $hubs;
}
/**
* Return site information for a specific hub
* @param string $huburl
* @return array site info
*/
public function get_site_info($huburl) {
global $CFG, $DB;
$siteinfo = array();
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
$siteinfo['name'] = get_config('hub', 'site_name_' . $cleanhuburl);
$siteinfo['description'] = get_config('hub', 'site_description_' . $cleanhuburl);
$siteinfo['contactname'] = get_config('hub', 'site_contactname_' . $cleanhuburl);
$siteinfo['contactemail'] = get_config('hub', 'site_contactemail_' . $cleanhuburl);
$siteinfo['contactphone'] = get_config('hub', 'site_contactphone_' . $cleanhuburl);
$siteinfo['imageurl'] = get_config('hub', 'site_imageurl_' . $cleanhuburl);
$siteinfo['privacy'] = get_config('hub', 'site_privacy_' . $cleanhuburl);
$siteinfo['street'] = get_config('hub', 'site_address_' . $cleanhuburl);
$siteinfo['regioncode'] = get_config('hub', 'site_region_' . $cleanhuburl);
$siteinfo['countrycode'] = get_config('hub', 'site_country_' . $cleanhuburl);
$siteinfo['geolocation'] = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$siteinfo['contactable'] = get_config('hub', 'site_contactable_' . $cleanhuburl);
$siteinfo['emailalert'] = get_config('hub', 'site_emailalert_' . $cleanhuburl);
if (get_config('hub', 'site_coursesnumber_' . $cleanhuburl) == -1) {
$coursecount = -1;
} else {
$coursecount = $DB->count_records('course') - 1;
}
$siteinfo['courses'] = $coursecount;
if (get_config('hub', 'site_usersnumber_' . $cleanhuburl) == -1) {
$usercount = -1;
} else {
$usercount = $DB->count_records('user', array('deleted' => 0));
}
$siteinfo['users'] = $usercount;
if (get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl) == -1) {
$roleassigncount = -1;
} else {
$roleassigncount = $DB->count_records('role_assignments');
}
$siteinfo['enrolments'] = $roleassigncount;
if (get_config('hub', 'site_postsnumber_' . $cleanhuburl) == -1) {
$postcount = -1;
} else {
$postcount = $DB->count_records('forum_posts');
}
$siteinfo['posts'] = $postcount;
if (get_config('hub', 'site_questionsnumber_' . $cleanhuburl) == -1) {
$questioncount = -1;
} else {
$questioncount = $DB->count_records('question');
}
$siteinfo['questions'] = $questioncount;
if (get_config('hub', 'site_resourcesnumber_' . $cleanhuburl) == -1) {
$resourcecount = -1;
} else {
$resourcecount = $DB->count_records('resource');
}
$siteinfo['resources'] = $resourcecount;
//TODO
require_once($CFG->dirroot . "/course/lib.php");
if (get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl) == -1) {
$participantnumberaverage = -1;
} else {
$participantnumberaverage = average_number_of_participants();
}
$siteinfo['participantnumberaverage'] = $participantnumberaverage;
if (get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl) == -1) {
$modulenumberaverage = -1;
} else {
$modulenumberaverage = average_number_of_courses_modules();
}
$siteinfo['modulenumberaverage'] = $modulenumberaverage;
$siteinfo['language'] = get_config('hub', 'site_language_' . $cleanhuburl);
$siteinfo['moodleversion'] = $CFG->version;
$siteinfo['moodlerelease'] = $CFG->release;
$siteinfo['url'] = $CFG->wwwroot;
return $siteinfo;
}
/**
* Retrieve the site privacy string matching the define value
* @param string $privacy must match the define into moodlelib.php
* @return string
*/
public function get_site_privacy_string($privacy) {
switch ($privacy) {
case HUB_SITENOTPUBLISHED:
$privacystring = get_string('siteprivacynotpublished', 'hub');
break;
case HUB_SITENAMEPUBLISHED:
$privacystring = get_string('siteprivacypublished', 'hub');
break;
case HUB_SITELINKPUBLISHED:
$privacystring = get_string('siteprivacylinked', 'hub');
break;
}
if (empty($privacystring)) {
throw new moodle_exception('unknownprivacy');
}
return $privacystring;
}
}
?>
-163
View File
@@ -1,163 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// This file is part of Moodle - http://moodle.org/ //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// //
// Moodle is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Moodle is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. //
// //
///////////////////////////////////////////////////////////////////////////
/*
* @package moodle
* @subpackage registration
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* This page displays the site registration form.
* It handles redirection to the hub to continue the registration workflow process.
* It also handles update operation by web service.
*/
require_once('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
require_once($CFG->dirroot . '/webservice/lib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
admin_externalpage_setup('registrationindex');
$huburl = required_param('huburl', PARAM_URL);
$huburl = rtrim($huburl, "/");
$password = optional_param('password', '', PARAM_TEXT);
$hubname = optional_param('hubname', '', PARAM_TEXT);
if (!confirm_sesskey()) {
throw new moodle_exception('missingparameter');
}
/* TO DO
if DB config plugin table is not good for dealing with token reference and token confirmation
=> create other DB table
-----------------------------------------------------------------------------
Local Type | Token | Local WS | Remote Type | Remote URL | Confirmed
-----------------------------------------------------------------------------
HUB 4er4e server HUB-DIRECTORY http...moodle.org Yes
HUB 73j53 client HUB-DIRECTORY http...moodle.org Yes
SITE dfsd7 server HUB http...hub Yes
SITE fd8fd client HUB http...hub Yes
HUB ds78s server SITE http...site.com Yes
HUB-DIR. d7d8s server HUB http...hub Yes
-----------------------------------------------------------------------------
*/
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_registeredhub($huburl);
$siteregistrationform = new site_registration_form('',
array('alreadyregistered' => !empty($registeredhub->token),
'huburl' => $huburl, 'hubname' => $hubname,
'password' => $password));
$fromform = $siteregistrationform->get_data();
if (!empty($fromform) and confirm_sesskey()) {
//save the settings
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
set_config('site_contactname_' . $cleanhuburl, $fromform->contactname, 'hub');
set_config('site_contactemail_' . $cleanhuburl, $fromform->contactemail, 'hub');
set_config('site_contactphone_' . $cleanhuburl, $fromform->contactphone, 'hub');
set_config('site_imageurl_' . $cleanhuburl, $fromform->imageurl, 'hub');
set_config('site_privacy_' . $cleanhuburl, $fromform->privacy, 'hub');
set_config('site_address_' . $cleanhuburl, $fromform->address, 'hub');
set_config('site_region_' . $cleanhuburl, $fromform->regioncode, 'hub');
set_config('site_country_' . $cleanhuburl, $fromform->countrycode, 'hub');
set_config('site_language_' . $cleanhuburl, $fromform->language, 'hub');
set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
set_config('site_postsnumber_' . $cleanhuburl, $fromform->posts, 'hub');
set_config('site_questionsnumber_' . $cleanhuburl, $fromform->questions, 'hub');
set_config('site_resourcesnumber_' . $cleanhuburl, $fromform->resources, 'hub');
set_config('site_modulenumberaverage_' . $cleanhuburl, $fromform->modulenumberaverage, 'hub');
set_config('site_participantnumberaverage_' . $cleanhuburl, $fromform->participantnumberaverage, 'hub');
}
/////// UPDATE ACTION ////////
// update the hub registration
$update = optional_param('update', 0, PARAM_INT);
if ($update and confirm_sesskey()) {
//update the registration
$function = 'hub_update_site_info';
$siteinfo = $registrationmanager->get_site_info($huburl);
$params = array('siteinfo' => $siteinfo);
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
try {
$result = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
$error = $OUTPUT->notification(get_string('errorregistration', 'hub', $e->getMessage()));
}
}
/////// FORM REGISTRATION ACTION //////
if (!empty($fromform) and empty($update) and confirm_sesskey()) {
if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
$params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
$unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
if (empty($unconfirmedhub)) {
//we save the token into the communication table in order to have a reference
$unconfirmedhub = new stdClass();
$unconfirmedhub->token = get_site_identifier();
$unconfirmedhub->huburl = $huburl;
$unconfirmedhub->hubname = $hubname;
$unconfirmedhub->confirmed = 0;
$unconfirmedhub->id = $registrationmanager->add_registeredhub($unconfirmedhub);
}
$params['token'] = $unconfirmedhub->token;
$params['url'] = $CFG->wwwroot;
redirect(new moodle_url($huburl . '/local/hub/siteregistration.php', $params));
}
}
/////// OUTPUT SECTION /////////////
echo $OUTPUT->header();
//Display update notification result
if (!empty($registeredhub->confirmed)) {
if (!empty($result)) {
echo $OUTPUT->notification(get_string('siteregistrationupdated', 'hub'), 'notifysuccess');
}
}
if (!empty($error)) {
echo $error;
}
$siteregistrationform->display();
echo $OUTPUT->footer();
-129
View File
@@ -1,129 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// This file is part of Moodle - http://moodle.org/ //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// //
// Moodle is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Moodle is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Registration renderer.
* @package moodle
* @subpackage registration
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
* @author Jerome Mouneyrac
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_register_renderer extends plugin_renderer_base {
/**
* Display a box message confirming a site registration (add or update)
* @param string $confirmationmessage
* @return string
*/
public function registration_confirmation($confirmationmessage) {
$linktositelist = html_writer::tag('a', get_string('sitelist', 'hub'),
array('href' => new moodle_url('/local/hub/index.php')));
$message = $confirmationmessage . html_writer::empty_tag('br') . $linktositelist;
return $this->output->box($message);
}
/**
* Display the page to register on Moodle.org or on a specific hub
*/
public function registrationselector($updatemoodleorg = false) {
global $CFG;
$table = new html_table();
$table->head = array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub'));
$table->size = array('50%', '50%');
//$table->attributes['class'] = 'registerindextable';
//Moodle.org information cell
$moodleorgcell = get_string('moodleorgregistrationdetail', 'hub');
$moodleorgcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br');
$moodleorgcell = html_writer::tag('div', $moodleorgcell, array('class' => 'justifytext'));
//Specific hub information cell
$specifichubcell = get_string('specifichubregistrationdetail', 'hub');
$specifichubcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br');
$specifichubcell = html_writer::tag('div', $specifichubcell, array('class' => 'justifytext'));
//add information cells
$cells = array($moodleorgcell, $specifichubcell);
$row = new html_table_row($cells);
$table->data[] = $row;
//Moodle.org button cell
$registeronmoodleorgurl = new moodle_url("/" . $CFG->admin . "/registration/register.php",
array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL
, 'hubname' => 'Moodle.org'));
$registeronmoodleorgbutton = new single_button($registeronmoodleorgurl,
$updatemoodleorg ? get_string('updatesite', 'hub', 'Moodle.org') : get_string('registeronmoodleorg', 'hub'));
$registeronmoodleorgbutton->class = 'centeredbutton';
$registeronmoodleorgbuttonhtml = $this->output->render($registeronmoodleorgbutton);
$moodleorgcell = $registeronmoodleorgbuttonhtml;
//Specific hub button cell
$registeronspecifichuburl = new moodle_url("/" . $CFG->admin . "/registration/hubselector.php",
array('sesskey' => sesskey()));
$registeronspecifichubbutton = new single_button($registeronspecifichuburl,
get_string('registeronspecifichub', 'hub'));
$registeronspecifichubbutton->class = 'centeredbutton';
$registeronspecifichubbuttonhtml = $this->output->render($registeronspecifichubbutton);
$specifichubcell = $registeronspecifichubbuttonhtml;
//add button cells
$cells = array($moodleorgcell, $specifichubcell);
$row = new html_table_row($cells);
$table->data[] = $row;
return html_writer::table($table);
}
/**
* Display the listing of registered on hub
*/
public function registeredonhublisting($hubs) {
global $CFG;
$table = new html_table();
$table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub'));
$table->size = array('80%', '20%');
foreach ($hubs as $hub) {
if ($hub->huburl == HUB_MOODLEORGHUBURL) {
$hub->hubname = get_string('registeredmoodleorg', 'hub', $hub->hubname);
}
$hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
$hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow'));
$unregisterhuburl = new moodle_url("/" . $CFG->admin . "/registration/index.php",
array('sesskey' => sesskey(), 'huburl' => $hub->huburl,
'unregistration' => 1));
$unregisterbutton = new single_button($unregisterhuburl,
get_string('unregister', 'hub'));
$unregisterbutton->class = 'centeredbutton';
$unregisterbuttonhtml = $this->output->render($unregisterbutton);
//add button cells
$cells = array($hublinkcell, $unregisterbuttonhtml);
$row = new html_table_row($cells);
$table->data[] = $row;
}
return html_writer::table($table);
}
}
+16 -28
View File
@@ -1,8 +1,6 @@
<?php
<?php /// $Id$
/// Search and replace strings throughout all texts in the whole database
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
@@ -13,52 +11,42 @@ $search = optional_param('search', '', PARAM_RAW);
$replace = optional_param('replace', '', PARAM_RAW);
###################################################################
echo $OUTPUT->header();
admin_externalpage_print_header();
echo $OUTPUT->heading('Search and replace text throughout the whole database');
print_heading('Search and replace text throughout the whole database');
if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Print a form
echo $OUTPUT->box_start();
echo '<div class="mdl-align">';
print_simple_box_start('center');
echo '<div align="center">';
echo '<form action="replace.php" method="post">';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo 'Search whole database for: <input type="text" name="search" /><br />';
echo 'Replace with this string: <input type="text" name="replace" /><br />';
echo '<input type="submit" value="Yes, do it now" /><br />';
echo '</form>';
echo '</div>';
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
print_simple_box_end();
admin_externalpage_print_footer();
die;
}
echo $OUTPUT->box_start();
print_simple_box_start('center');
if (!db_replace($search, $replace)) {
print_error('erroroccur', debug);
error('An error has occured during this process');
}
echo $OUTPUT->box_end();
/// Try to replace some well-known serialised contents (html blocks)
echo $OUTPUT->notification('Replacing in html blocks...');
$instances = $DB->get_recordset('block_instances', array('blockname' => 'html'));
foreach ($instances as $instance) {
$blockobject = block_instance('html', $instance);
$blockobject->config->text = str_replace($search, $replace, $blockobject->config->text);
$blockobject->instance_config_commit();
}
$instances->close();
print_simple_box_end();
/// Rebuild course cache which might be incorrect now
echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
notify('Rebuilding course cache...');
rebuild_course_cache();
echo $OUTPUT->notification('...finished', 'notifysuccess');
notify('...finished');
echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->footer();
print_continue('index.php');
admin_externalpage_print_footer();
?>
+39 -29
View File
@@ -1,19 +1,27 @@
<?php
<?php // $Id$
// index.php - scheduled backup logs
require_once('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/backup/lib.php');
admin_externalpage_setup('reportbackups');
admin_externalpage_print_header();
$courseid = optional_param('courseid', 0, PARAM_INT);
admin_externalpage_setup('reportbackups');
echo $OUTPUT->header();
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
/// Automated backups aren't active by the site admin
/// Scheduled backups are disabled by the server admin
if (!empty($CFG->disablescheduledbackups)) {
print_error('scheduledbackupsdisabled', '', '', NULL, true);
}
/// Scheduled backups aren't active by the site admin
$backup_config = backup_get_config();
if (empty($backup_config->backup_auto_active)) {
echo $OUTPUT->notification(get_string('automatedbackupsinactive', 'backup'));
if (empty($backup_config->backup_sche_active)) {
notify(get_string('scheduledbackupsinactive'));
}
/// Get needed strings
@@ -33,18 +41,18 @@
$strcourse = get_string("course");
$strtimetaken = get_string("timetaken","quiz");
$strstatus = get_string("status");
$strnext = get_string("backupnext");
$strnext = get_string("next");
/// Decide when to show last execution logs or detailed logs
/// Lastlog view
if (!$courseid) {
echo $OUTPUT->heading($backuploglaststatus);
echo $OUTPUT->box_start();
print_heading($backuploglaststatus);
print_simple_box_start('center');
/// Now, get every record from backup_courses
$courses = $DB->get_records("backup_courses");
$courses = get_records("backup_courses");
if (!$courses) {
echo $OUTPUT->notification(get_string('nologsfound'));
notify(get_string('nologsfound'));
} else {
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
//Print table header
@@ -55,7 +63,7 @@
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"3\">$strnext</font></td></tr>";
foreach ($courses as $course) {
/// Get the course shortname
$coursename = $DB->get_field ("course", "fullname", array("id"=>$course->courseid));
$coursename = get_field ("course","fullname","id",$course->courseid);
if ($coursename) {
echo "<tr>";
echo "<td nowrap=\"nowrap\"><font size=\"2\"><a href=\"index.php?courseid=$course->courseid\">".$coursename."</a></font></td>";
@@ -77,37 +85,38 @@
}
echo "</table>";
}
echo $OUTPUT->box_end();
print_simple_box_end();
/// Detailed View !!
} else {
echo $OUTPUT->heading($backuplogdetailed);
print_heading($backuplogdetailed);
$coursename = $DB->get_field("course", "fullname", array("id"=>"$courseid"));
echo $OUTPUT->heading("$strcourse: $coursename");
$coursename = get_field("course","fullname","id","$courseid");
print_heading("$strcourse: $coursename");
echo $OUTPUT->box_start();
print_simple_box_start('center');
/// First, me get all the distinct backups for that course in backup_log
$executions = $DB->get_records_sql("SELECT DISTINCT laststarttime
FROM {backup_log}
WHERE courseid = ? AND backuptype = ?
ORDER BY laststarttime DESC", array($courseid,'scheduledbackup'));
$executions = get_records_sql("SELECT DISTINCT laststarttime,laststarttime
FROM {$CFG->prefix}backup_log
WHERE courseid = '$courseid'
ORDER BY laststarttime DESC");
/// Iterate over backup executions
if (!$executions) {
echo $OUTPUT->notification(get_string('nologsfound'));
notify(get_string('nologsfound'));
} else {
echo "<table border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
foreach($executions as $execution) {
echo "<tr>";
echo "<td nowrap=\"nowrap\" align=\"center\" colspan=\"3\">";
echo $OUTPUT->box(userdate($execution->laststarttime));
print_simple_box("<center>".userdate($execution->laststarttime)."</center>", "center");
echo "</td>";
echo "</tr>";
$logs = $DB->get_records_sql("SELECT *
FROM {backup_log}
WHERE courseid = ? AND laststarttime = ? AND backuptype = ?
ORDER BY id", array($courseid, $execution->laststarttime,'scheduledbackup'));
$logs = get_records_sql("SELECT *
FROM {$CFG->prefix}backup_log
WHERE courseid = '$courseid' AND
laststarttime = '$execution->laststarttime'
ORDER BY id");
if ($logs) {
foreach ($logs as $log) {
echo "<tr>";
@@ -121,8 +130,9 @@
}
echo "</table>";
}
echo $OUTPUT->box_end();
print_simple_box_end();
}
echo $OUTPUT->footer();
print_footer();
?>
-5
View File
@@ -1,5 +0,0 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportbackups', get_string('backups', 'admin'), "$CFG->wwwroot/$CFG->admin/report/backups/index.php",'moodle/backup:backupcourse'));
-214
View File
@@ -1,214 +0,0 @@
<?php
/**
* For a given capability, show what permission it has for every role, and
* everywhere that it is overridden.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package roles
*/
/** */
require_once(dirname(__FILE__).'/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
// Check permissions.
require_login();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/role:manage', $systemcontext);
// Get URL parameters.
$capability = optional_param('capability', '', PARAM_CAPABILITY);
$roleids = optional_param('roles', array('0'), PARAM_INTEGER);
// Clean the passed in list of role ids. If 'All' selected as an option, or
// if none were selected, do all roles.
$allroles = get_all_roles();
$cleanedroleids = array();
foreach ($roleids as $roleid) {
if ($roleid == 0) {
$cleanedroleids = array_keys($allroles);
break;
}
if (array_key_exists($roleid, $allroles)) {
$cleanedroleids[] = $roleid;
}
}
if (empty($cleanedroleids)) {
$cleanedroleids = array_keys($allroles);
}
// Include the required JavaScript.
$PAGE->requires->js_init_call('M.report_capability.init', array(get_string('search')));
// Log.
add_to_log(SITEID, "admin", "report capability", "report/capability/index.php?capability=$capability", $capability);
// Print the header.
admin_externalpage_setup('reportcapability');
echo $OUTPUT->header();
// Prepare the list of capabilities to choose from
$allcapabilities = fetch_context_capabilities($systemcontext);
$capabilitychoices = array();
foreach ($allcapabilities as $cap) {
$capabilitychoices[$cap->name] = $cap->name . ': ' . get_capability_string($cap->name);
}
// Prepare the list of roles to choose from
$rolechoices = array('0' => get_string('all'));
foreach ($allroles as $role) {
$rolechoices[$role->id] = $role->name;
}
if (count($cleanedroleids) == count($allroles)) {
// Select 'All', rather than each role individually.
$selectedroleids = array('0');
} else {
$selectedroleids = $cleanedroleids;
}
// Print the settings form.
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
echo '<form method="get" action="." id="settingsform"><div>';
echo $OUTPUT->heading(get_string('reportsettings', 'report_capability'));
echo '<p id="intro">', get_string('intro', 'report_capability') , '</p>';
echo '<p><label for="menucapability"> ' . get_string('capabilitylabel', 'report_capability') . '</label></p>';
echo html_writer::select($capabilitychoices, 'capability', $capability, array(''=>'choose'), array('size'=>10));
echo '<p><label for="menuroles"> ' . get_string('roleslabel', 'report_capability') . '</label></p>';
echo html_writer::select($rolechoices, 'roles[]', $selectedroleids, false, array('size'=>10, 'multiple'=>'multiple'));
echo '<p><input type="submit" id="settingssubmit" value="' . get_string('getreport', 'report_capability') . '" /></p>';
echo '</div></form>';
echo $OUTPUT->box_end();
// If we have a capability, generate the report.
if ($capability) {
// Work out the bits needed for the SQL WHERE clauses.
$params = array($capability);
$sqlroletest = '';
if (count($cleanedroleids) != count($allroles)) {
list($sqlroletest, $roleparams) = $DB->get_in_or_equal($cleanedroleids);
$params = array_merge($params, $roleparams);
$sqlroletest = 'AND roleid ' . $sqlroletest;
}
// Get all the role_capabilities rows for this capability - that is, all
// role definitions, and all role overrides.
$rolecaps = $DB->get_records_sql("
SELECT id, roleid, contextid, permission
FROM {role_capabilities}
WHERE capability = ? $sqlroletest", $params);
// In order to display a nice tree of contexts, we need to get all the
// ancestors of all the contexts in the query we just did.
$relevantpaths = $DB->get_records_sql_menu("
SELECT DISTINCT con.path, 1
FROM {context} con JOIN {role_capabilities} rc ON rc.contextid = con.id
WHERE capability = ? $sqlroletest", $params);
$requiredcontexts = array($systemcontext->id);
foreach ($relevantpaths as $path => $notused) {
$requiredcontexts = array_merge($requiredcontexts, explode('/', trim($path, '/')));
}
$requiredcontexts = array_unique($requiredcontexts);
// Now load those contexts.
list($sqlcontexttest, $contextparams) = $DB->get_in_or_equal($requiredcontexts);
$contexts = get_sorted_contexts('ctx.id ' . $sqlcontexttest, $contextparams);
// Prepare some empty arrays to hold the data we are about to compute.
foreach ($contexts as $conid => $con) {
$contexts[$conid]->children = array();
$contexts[$conid]->rolecapabilities = array();
}
// Put the contexts into a tree structure.
foreach ($contexts as $conid => $con) {
$parentcontextid = get_parent_contextid($con);
if ($parentcontextid) {
$contexts[$parentcontextid]->children[] = $conid;
}
}
// Put the role capabilities into the context tree.
foreach ($rolecaps as $rolecap) {
$contexts[$rolecap->contextid]->rolecapabilities[$rolecap->roleid] = $rolecap->permission;
}
// Fill in any missing rolecaps for the system context.
foreach ($cleanedroleids as $roleid) {
if (!isset($contexts[$systemcontext->id]->rolecapabilities[$roleid])) {
$contexts[$systemcontext->id]->rolecapabilities[$roleid] = CAP_INHERIT;
}
}
// Print the report heading.
echo $OUTPUT->heading(get_string('reportforcapability', 'report_capability', get_capability_string($capability)), 2, 'main', 'report');
if (count($cleanedroleids) != count($allroles)) {
$rolenames = array();
foreach ($cleanedroleids as $roleid) {
$rolenames[] = $allroles[$roleid]->name;
}
echo '<p>', get_string('forroles', 'report_capability', implode(', ', $rolenames)), '</p>';
}
// Now, recursively print the contexts, and the role information.
print_report_tree($systemcontext->id, $contexts, $allroles);
}
// Footer.
echo $OUTPUT->footer();
function print_report_tree($contextid, $contexts, $allroles) {
global $CFG;
// Array for holding lang strings.
static $strpermissions = null;
if (is_null($strpermissions)) {
$strpermissions = array(
CAP_INHERIT => get_string('notset','role'),
CAP_ALLOW => get_string('allow','role'),
CAP_PREVENT => get_string('prevent','role'),
CAP_PROHIBIT => get_string('prohibit','role')
);
}
// Start the list item, and print the context name as a link to the place to
// make changes.
if ($contextid == get_system_context()->id) {
$url = "$CFG->wwwroot/$CFG->admin/roles/manage.php";
$title = get_string('changeroles', 'report_capability');
} else {
$url = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$contextid";
$title = get_string('changeoverrides', 'report_capability');
}
echo '<h3><a href="' . $url . '" title="' . $title . '">', print_context_name($contexts[$contextid]), '</a></h3>';
// If there are any role overrides here, print them.
if (!empty($contexts[$contextid]->rolecapabilities)) {
$rowcounter = 0;
echo '<table class="generaltable rolecaps"><tbody>';
foreach ($allroles as $role) {
if (isset($contexts[$contextid]->rolecapabilities[$role->id])) {
$permission = $contexts[$contextid]->rolecapabilities[$role->id];
echo '<tr class="r' . ($rowcounter % 2) . '"><th class="cell">', $role->name,
'</th><td class="cell">' . $strpermissions[$permission] . '</td></tr>';
$rowcounter++;
}
}
echo '</tbody></table>';
}
// After we have done the site context, change the string for CAP_INHERIT
// from 'notset' to 'inherit'.
$strpermissions[CAP_INHERIT] = get_string('inherit','role');
// If there are any child contexts, print them recursively.
if (!empty($contexts[$contextid]->children)) {
echo '<ul>';
foreach ($contexts[$contextid]->children as $childcontextid) {
echo '<li>';
print_report_tree($childcontextid, $contexts, $allroles);
echo '</li>';
}
echo '</ul>';
}
}
@@ -1,36 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'report_capability', language 'en', branch 'MOODLE_20_STABLE'
*
* @package report_capability
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['capabilitylabel'] = 'Capability:';
$string['capabilityreport'] = 'Capability report';
$string['forroles'] = 'For roles {$a}';
$string['getreport'] = 'Get the report';
$string['changeoverrides'] = 'Change overrides in this context';
$string['changeroles'] = 'Change role definitions';
$string['intro'] = 'This report shows, for a particular capability, what permission that capability has in the definition of every role (or a selection of roles), and everywhere in the site where that capability is overridden.';
$string['pluginname'] = 'Capability report';
$string['reportforcapability'] = 'Report for capability \'{$a}\'';
$string['reportsettings'] = 'Report settings';
$string['roleslabel'] = 'Roles:';
-75
View File
@@ -1,75 +0,0 @@
M.report_capability = {
select: null,
input: null,
button: null,
init: function(Y, strsearch) {
var context = M.report_capability;
// Find the form controls.
context.select = document.getElementById('menucapability');
context.button = document.getElementById('settingssubmit');
// Create a div to hold the search UI.
var div = document.createElement('div');
div.id = 'capabilitysearchui';
// Find the capability search input.
var input = document.createElement('input');
input.type = 'text';
input.id = 'capabilitysearch';
context.input = input;
// Create a label for the search input.
var label = document.createElement('label');
label.htmlFor = input.id;
label.appendChild(document.createTextNode(strsearch + ' '));
// Tie it all together
div.appendChild(label);
div.appendChild(input);
context.select.parentNode.insertBefore(div, context.select);
Y.on('keyup', context.typed, input);
Y.on('change', context.validate, context.select);
context.select.options[0].style.display = 'none';
context.validate();
},
typed: function() {
var context = M.report_capability;
var filtertext = context.input.value;
var options = context.select.options;
var onlycapability = -1;
for (var i = 1; i < options.length; i++) {
if (options[i].text.indexOf(filtertext) >= 0) {
options[i].disabled = false;
options[i].style.display = 'block';
if (onlycapability == -1) {
onlycapability = i;
} else {
onlycapability = -2;
}
} else {
options[i].disabled = true;
options[i].selected = false;
options[i].style.display = 'none';
}
}
if (onlycapability >= 0) {
options[onlycapability].selected = true;
}
if (onlycapability == -1) {
context.input.className = "error";
} else {
context.input.className = "";
}
context.validate();
},
validate: function() {
var context = M.report_capability;
context.button.disabled = (context.select.value == '');
}
}
-5
View File
@@ -1,5 +0,0 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('pluginname', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
-110
View File
@@ -1,110 +0,0 @@
<?php
require_once(dirname(__FILE__).'/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
// page parameters
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 30, PARAM_INT); // how many per page
$sort = optional_param('sort', 'timemodified', PARAM_ALPHA);
$dir = optional_param('dir', 'DESC', PARAM_ALPHA);
admin_externalpage_setup('reportconfiglog');
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('configlog', 'report_configlog'));
$changescount = $DB->count_records('config_log');
$columns = array('firstname' => get_string('firstname'),
'lastname' => get_string('lastname'),
'timemodified' => get_string('timemodified', 'report_configlog'),
'plugin' => get_string('plugin', 'report_configlog'),
'name' => get_string('setting', 'report_configlog'),
'value' => get_string('value', 'report_configlog'),
'oldvalue' => get_string('oldvalue', 'report_configlog'),
);
$hcolumns = array();
if (!isset($columns[$sort])) {
$sort = 'lastname';
}
foreach ($columns as $column=>$strcolumn) {
if ($sort != $column) {
$columnicon = '';
if ($column == 'lastaccess') {
$columndir = 'DESC';
} else {
$columndir = 'ASC';
}
} else {
$columndir = $dir == 'ASC' ? 'DESC':'ASC';
if ($column == 'lastaccess') {
$columnicon = $dir == 'ASC' ? 'up':'down';
} else {
$columnicon = $dir == 'ASC' ? 'down':'up';
}
$columnicon = " <img src=\"" . $OUTPUT->pix_url('t/' . $columnicon) . "\" alt=\"\" />";
}
$hcolumns[$column] = "<a href=\"index.php?sort=$column&amp;dir=$columndir&amp;page=$page&amp;perpage=$perpage\">".$strcolumn."</a>$columnicon";
}
$baseurl = new moodle_url('index.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
echo $OUTPUT->paging_bar($changescount, $page, $perpage, $baseurl);
$override = new stdClass();
$override->firstname = 'firstname';
$override->lastname = 'lastname';
$fullnamelanguage = get_string('fullnamedisplay', '', $override);
if (($CFG->fullnamedisplay == 'firstname lastname') or
($CFG->fullnamedisplay == 'firstname') or
($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname' )) {
$fullnamedisplay = $hcolumns['firstname'].' / '.$hcolumns['lastname'];
} else { // ($CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'lastname firstname')
$fullnamedisplay = $hcolumns['lastname'].' / '.$hcolumns['firstname'];
}
$table = new html_table();
$table->head = array($hcolumns['timemodified'], $fullnamedisplay, $hcolumns['plugin'], $hcolumns['name'], $hcolumns['value'], $hcolumns['oldvalue']);
$table->align = array('left', 'left', 'left', 'left', 'left', 'left');
$table->size = array('30%', '10%', '10%', '10%', '20%', '20%');
$table->width = '95%';
$table->data = array();
if ($sort == 'firstname' or $sort == 'lastname') {
$orderby = "u.$sort $dir";
} else {
$orderby = "cl.$sort $dir";
}
$ufields = user_picture::fields('u');
$sql = "SELECT $ufields,
cl.timemodified, cl.plugin, cl.name, cl.value, cl.oldvalue
FROM {config_log} cl
JOIN {user} u ON u.id = cl.userid
ORDER BY $orderby";
$rs = $DB->get_recordset_sql($sql, array(), $page*$perpage, $perpage);
foreach ($rs as $log) {
$row = array();
$row[] = userdate($log->timemodified);
$row[] = fullname($log);
if (is_null($log->plugin)) {
$row[] = 'core';
} else {
$row[] = $log->plugin;
}
$row[] = $log->name;
$row[] = s($log->value);
$row[] = s($log->oldvalue);
$table->data[] = $row;
}
$rs->close();
echo html_writer::table($table);
echo $OUTPUT->footer();
@@ -1,31 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'report_configlog', language 'en', branch 'MOODLE_20_STABLE'
*
* @package report_configlog
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['configlog'] = 'Config changes';
$string['oldvalue'] = 'Original value';
$string['plugin'] = 'Plugin';
$string['setting'] = 'Setting';
$string['timemodified'] = 'Date';
$string['value'] = 'New value';
-5
View File
@@ -1,5 +0,0 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportconfiglog', get_string('configlog', 'report_configlog'), "$CFG->wwwroot/$CFG->admin/report/configlog/index.php"));
-40
View File
@@ -1,40 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$capabilities = array(
'report/courseoverview:view' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:viewreports',
)
);

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