Compare commits

...

112 Commits

Author SHA1 Message Date
Sam Hemelryk 1f6c3ff2f4 Moodle 1.9.13 release 2011-08-01 16:53:14 +08:00
Petr Skoda 4d3c6ac7d3 weekly release 1.9.12+ 2011-07-26 11:04:59 +02:00
Sam Hemelryk 05f38de60e MDL-28411 Post-integration improvement of string changes 2011-07-26 16:09:12 +08:00
Petr Skoda fdee5d95b7 Merge branch 'MDL-27717_MOODLE_19_STABLE' into MOODLE_19_STABLE 2011-07-25 16:40:56 +02:00
Aparup Banerjee 10fbf4d8ca MDL-27717 Enrolments - separated display of localized cost being displayed from cost being charged at authorize.net 2011-07-25 12:59:49 +08:00
Dan Poltawski ba4dfc998d MDL-28232 - Course log text export is missing a new line 2011-07-25 12:59:18 +08:00
Sam Hemelryk e41831dde4 Merge branch 'w29_MDL-27464_m19_continue' of git://github.com/skodak/moodle into MOODLE_19_STABLE 2011-07-25 11:04:13 +08:00
Sam Hemelryk fb50bf6c32 Merge branch 'w29_MDL-28360_m19_flatfile' of git://github.com/skodak/moodle into MOODLE_19_STABLE 2011-07-25 10:25:08 +08:00
Matt Meisberger 8f9f666c90 MDL-27464 continuation link sometimes links off-site
Integrating #CSTAGE-656, continuation link sometimes links off-site, into trunk.
2011-07-23 13:21:14 +02:00
Petr Skoda 9dce25dea5 MDL-28411 make sure people understand the difference between groupings and Available for group members only 2011-07-21 11:24:00 +02:00
Matt Meisberger bd4f3fa5c4 MDL-28360 Fix for sql injection vulnerability in flat file enrollment - Matt Meisberger (WebCourseworks) 2011-07-20 15:52:22 +02:00
Petr Skoda 6bbf934a3e weekly release 1.9.12+ 2011-07-19 15:20:19 +02:00
Petr Skoda 5c66e926b6 MDL-27889 use new recaptcha google urls in lang packs 2011-07-19 10:15:46 +02:00
Sam Hemelryk 61b865f72c Merge branch 'MDL-27889_MOODLE_19_STABLE' of git://github.com/nebgor/moodle into MOODLE_19_STABLE 2011-07-18 17:29:08 +08:00
Sam Hemelryk 215e7a00a2 weekly release 1.9.12+ 2011-07-13 20:26:00 +08:00
Eloy Lafuente (stronk7) 715b7649bd MDL-23580 course overview - remove debugging junk
Conflicts:

	admin/report/courseoverview/index.php
2011-07-11 16:55:15 +02:00
Eloy Lafuente (stronk7) 4a817f0753 Merge branch 'MDL-27515_m19' of git://github.com/rwijaya/moodle into MOODLE_19_STABLE 2011-07-11 16:19:16 +02:00
Sam Hemelryk b2d016f3da Merge branch 'wip-MDL-28197-MOODLE_19_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_19_STABLE 2011-07-11 13:38:58 +08:00
Marina Glancy 682e430ce0 MDL-28197 another possible sql vulnerability injection fixed 2011-07-11 09:40:05 +08:00
Marina Glancy ffd3e38977 MDL-28197 adding slashes to group name when creating group in user upload 2011-07-11 09:40:05 +08:00
Eloy Lafuente (stronk7) 731e813ac8 MDL-28062 glossary - rate redirect not working after search 2011-07-11 02:14:00 +02:00
Eloy Lafuente (stronk7) 85c123b5b1 weekly release 1.9.12+ 2011-07-08 11:23:51 +02:00
Rossiani Wijaya b2fd028829 MDL-27515 resource module: change 'require' to 'require_once' 2011-07-08 10:51:39 +08:00
Aparup Banerjee a424b206f6 MDL-27889 lib Updated recaptchlib to point to google urls based on google's api v1.11 2011-07-07 04:59:51 +08:00
Sam Hemelryk c74a93d017 Merge branch 'MDL-27716_19' of git://github.com/timhunt/moodle into MOODLE_19_STABLE 2011-07-06 12:10:17 +08:00
Joseph Rezeau 96aec10056 MDL-27716 qtype_multianswer make the work 'Close' in the overlib popup translatable. 2011-07-04 15:50:17 +01:00
Eloy Lafuente (stronk7) 6c56155188 weekly release 1.9.12+ 2011-07-02 00:02:12 +02:00
Aparup Banerjee 5cea248b8b MDL-28044 general - updated print_error() to point to versioned docs.moodle.org 2011-06-30 11:56:35 +08:00
Eloy Lafuente (stronk7) 1b75cdd4c7 weekly release 1.9.12+ 2011-06-23 11:27:56 +02:00
Eloy Lafuente (stronk7) ed64a00a57 MDL-27966 timezones - updated to 2011g version + fix minor notice 2011-06-21 16:25:43 +02:00
Eloy Lafuente (stronk7) d395fa4024 weekly release 1.9.12+ 2011-06-16 19:11:01 +02:00
Eloy Lafuente (stronk7) 54a70ffb8c Merge branch 'wip-MDL-24355-MOODLE_19_STABLE' of git://github.com/andyjdavis/moodle into MOODLE_19_STABLE 2011-06-16 10:40:46 +02:00
Eloy Lafuente (stronk7) 4474ee420a Merge branch 'wip-mdl-27863-MOODLE_19_STABLE' of git://github.com/rajeshtaneja/moodle into MOODLE_19_STABLE 2011-06-15 11:53:28 +02:00
Rajesh Taneja de5da04c5f MDL-27863 moodlelib - fixed testcase faliure in MDL-27577 2011-06-15 17:38:49 +08:00
Eloy Lafuente (stronk7) 6cc32cbb9e Merge branch 'wip-MDL-27638-MOODLE_19_STABLE' of git://github.com/samhemelryk/moodle into MOODLE_19_STABLE 2011-06-14 12:06:09 +02:00
Sam Hemelryk 3b246aca22 MDL-27638 Removed buggy status line from query as it is being calculated in php anyway 2011-06-14 10:15:21 +08:00
Sam Hemelryk d98e3d6b60 Merge branch 'm19_MDL-27404' of git://github.com/danmarsden/moodle into MOODLE_19_STABLE 2011-06-13 14:55:48 +08:00
Dan Marsden 7ef0866c93 MDL-27404 SCORM fix for IE 6 - thanks to Howard Miller 2011-06-13 11:29:05 +12:00
Dan Marsden c58d4eef1e MDL-27545 fix length of log action field - merged from 2.0 stable MDL-26880 2011-06-13 09:54:06 +12:00
Eloy Lafuente (stronk7) 1de5024830 weekly release 1.9.12+ 2011-06-09 03:43:55 +02:00
Eloy Lafuente (stronk7) c0e462c5d1 Merge branch 'wip-mdl-27577-MOODLE_19_STABLE' of git://github.com/rajeshtaneja/moodle into MOODLE_19_STABLE 2011-06-09 01:10:53 +02:00
Sam Hemelryk d17b16b697 MDL-27695 doc link checks ->release before including version.php now 2011-06-08 16:54:35 +08:00
Aparup Banerjee 7bfc8766bc MDL-27695 Documentation : updated the moodle docs link at the footer of pages to point to new docs url 2011-06-08 13:42:00 +08:00
Andrew Davis (andyjdavis) ab0c861479 MDL-24355 tag: added code to prevent an error if there are no tag correlations found 2011-06-07 17:06:00 +08:00
Rajesh Taneja 7a94695536 MDL-27577 moodlelib - fixed dst offset in userdate, usergetdate and make_timestamp functions 2011-06-03 10:02:30 +08:00
Eloy Lafuente (stronk7) 59d8944377 weekly release 1.9.12+ 2011-06-02 23:38:05 +02:00
Eloy Lafuente (stronk7) 2ecbeaf815 weekly release 1.9.12+ 2011-05-26 00:09:20 +02:00
Sam Hemelryk 226f0f6fdc weekly release 1.9.12+ 2011-05-18 18:14:25 +08:00
Eloy Lafuente (stronk7) 8347921cfa Merge branch 'MDL-26704_user_outline_report_19' of git://github.com/andyjdavis/moodle into MOODLE_19_STABLE 2011-05-17 12:01:40 +02:00
Eloy Lafuente (stronk7) 4f336e2c97 weekly release 1.9.12+ 2011-05-11 15:24:42 +02:00
Andrew Davis (andyjdavis) b66705e52c MDL-26704 gradebook: added some intelligence to the dates displayed on the user outline activity report 2011-05-10 11:28:29 +08:00
Andrew Davis (andyjdavis) d221a3839d Merge branch 'MOODLE_19_STABLE' of git://git.moodle.org/moodle into MOODLE_19_STABLE 2011-05-10 11:17:45 +08:00
Eloy Lafuente (stronk7) 0e4c5bfdbe Moodle 1.9.12 release 2011-05-09 15:59:53 +02:00
Andrew Davis (andyjdavis) a1bc21b045 Revert "MDL-26704 gradebook: switched the user outline activity report to use date submitted instead of date graded"
This reverts commit e9cd73e2f3.
2011-05-06 11:10:01 +08:00
Andrew Davis (andyjdavis) e9cd73e2f3 MDL-26704 gradebook: switched the user outline activity report to use date submitted instead of date graded 2011-05-06 11:08:07 +08:00
Eloy Lafuente (stronk7) 9251e27e76 weekly release 1.9.11+ 2011-05-05 00:38:37 +02:00
Eloy Lafuente (stronk7) 9330414966 Merge branch 'MDL-26937' of git://github.com/timhunt/moodle into MOODLE_19_STABLE 2011-05-02 11:37:08 +02:00
Tim Hunt 71ec5d19df MDL-26937 quiz grades report. Work-around MySQL fussiness, like for MDL-26416. 2011-04-29 12:09:05 +01:00
Tim Hunt 551a610ed1 MDL-26981 qtype_random fix restore of attempt data.
Fix worked out by Colin Campbell from colin@umn.edu. Many thanks.
2011-04-28 23:54:59 +01:00
Petr Skoda d14e8ea454 weekly release 1.9.11+ 2011-04-27 12:05:55 +02:00
Eloy Lafuente (stronk7) d58181c60b weekly release 1.9.11+ 2011-04-20 13:37:43 +02:00
Sam Hemelryk ef7383d32a MDL-24355 Fixed up deletion of tag correlations when deleting tags 2011-04-20 12:03:00 +08:00
Sam Hemelryk 3aeb4f03bd MDL-24355 Greatly improved performance of the tag correlation function and fixed up bugs with it 2011-04-20 11:51:16 +08:00
Dan Marsden ac9387b049 SCORM MDL-26450 fix undefined pkgtype warning (ONLY REQUIRED IN 1.9 STABLE BRANCH) 2011-04-14 09:58:21 +12:00
Petr Skoda 8be4ad990a weekly release 1.9.11+ 2011-04-13 22:06:49 +02:00
Sam Hemelryk 032be8a19b Merge branch 'MDL-26130' of git://github.com/MaryE/moodle into MOODLE_19_STABLE 2011-04-11 11:31:38 +08:00
Eloy Lafuente (stronk7) bd49223246 Merge branch 'w15_MDL-27069_m19_httpsrequired' of git://github.com/skodak/moodle into MOODLE_19_STABLE 2011-04-11 01:35:47 +02:00
Petr Skoda 7e58c03d6c MDL-27069 fix notice when inserting images in editor 2011-04-10 21:16:24 +02:00
Mary Evans 5a76642ddf MDL-26130 css fix for orangewhite theme 2011-04-10 01:15:24 +01:00
Tony Levi 697664c813 MDL-27108: Fix invalid SQL syntax in mod/data/field/latlong 2011-04-07 10:05:47 +09:30
Petr Skoda fb8642bce5 weekly release 1.9.11+ 2011-04-06 14:55:11 +02:00
Eloy Lafuente (stronk7) d2cabfdf9b Merge branch 'MDL-20946_19_simplehistory' of git://github.com/andyjdavis/moodle into MOODLE_19_STABLE 2011-04-04 11:39:51 +02:00
Petr Skoda 0c3c77269d weekly release 2011-03-30 13:40:40 +02:00
Andrew Davis (andyjdavis) 6c41ae0a0c gradebook MDL-20946 switched from using IN to using JOIN in the quiries 2011-03-30 13:31:47 +08:00
Eloy Lafuente (stronk7) d6ed445589 Merge branch 'w13_MDL-26966_19_urlparsing' of git://github.com/skodak/moodle into MOODLE_19_STABLE 2011-03-28 19:12:04 +02:00
Petr Skoda 5a3010310b MDL-26966 improve self URL validation 2011-03-27 12:03:22 +02:00
Petr Skoda dedb3c5121 MDL-26985 new Moodle 2.1 requirements
For now only extra PHP 5.3.2 requirement compared to 2.0.
2011-03-26 22:03:13 +01:00
Petr Skoda 3215955fd0 weekly release 2011-03-23 11:32:35 +01:00
Eloy Lafuente (stronk7) 19f65e6c6b Merge branch 'm19_MDL-25770_hotpotfix' of git://github.com/danmarsden/moodle into MOODLE_19_STABLE 2011-03-21 22:52:16 +01:00
Sam Hemelryk 5b2d591bcb Cherry-picked changes for PULL-460/MDL-26557 into MOODLE_19_STABLE 2011-03-21 17:36:29 +08:00
Tim Hunt 6d276b3254 MDL-20946 fix gradebook SQL to cope with multi-role and deleted users. 2011-03-17 12:30:58 +00:00
Dan Marsden 68d3425577 Hotpot MDL-25770 - missing return - thanks to Tomasz Pawlik for report/fix 2011-03-17 15:30:45 +13:00
Petr Skoda 08bf2b2723 weekly release 2011-03-16 09:34:19 +01:00
Petr Skoda 5dce59a4cf Merge branch 'MDL-4633-m19' of git://github.com/rwijaya/moodle into MOODLE_19_STABLE 2011-03-14 17:58:46 +01:00
Eloy Lafuente (stronk7) 72250eed86 Merge branch 'w11_MDL-26634_19_ldapset' of git://github.com/skodak/moodle into MOODLE_19_STABLE 2011-03-14 16:29:02 +01:00
Eloy Lafuente (stronk7) 49e0d5d5e3 Merge branch 'MDL-19555_m19' of git://github.com/rwijaya/moodle into MOODLE_19_STABLE 2011-03-14 01:41:32 +01:00
Eloy Lafuente (stronk7) fd602f4620 MDL-9376 fix minor global use 2011-03-14 01:37:28 +01:00
Eloy Lafuente (stronk7) fb7abd481b Merge branch 's7_MDL-9376_qaforum_m19' of git://github.com/dongsheng/moodle into MOODLE_19_STABLE 2011-03-14 01:35:57 +01:00
Eloy Lafuente (stronk7) 7e06e9ff4a Merge branch 'MDL-21446_19' of git://github.com/timhunt/moodle into MOODLE_19_STABLE 2011-03-14 01:32:18 +01:00
Petr Skoda 416ea17252 MDL-26634 LDAP NTLM SSO Multiple subnet separator is not specified and people use a wrong one
Credit goes to Inaki Arenaza.
2011-03-13 10:18:02 +01:00
Aparup Banerjee f8fb37424e MDL-26757 fixed regression in glossary recent activity block url 2011-03-11 13:27:45 +08:00
Dongsheng Cai a6df2c2e5f MDL-9376, disallow student to see the other users posts in max editing time, credits to Vlas Voloshin and Charles Fulton MOODLE_19_STABLE 2011-03-11 12:25:46 +08:00
Rossiani Wijaya 04b4210605 MDL-19555: add NULL string test to format_test(). Credit goes to Matej Vela. Thanks 2011-03-11 12:14:29 +08:00
Rossiani Wijaya e1bde19170 MDL-4633: remove 'required' rule for user's profile description 2011-03-10 15:56:20 +08:00
Tim Hunt 5cf3a84aee MDL-21446 truncate >31 char worksheet names that otherwise break Excel export. 2011-03-09 14:48:24 +00:00
Petr Skoda 1c712d947a weekly release 2011-03-09 09:05:15 +01:00
Eloy Lafuente (stronk7) 1b607c2266 Merge branch 'm19_MDL-26672_aiccfix' of git://github.com/danmarsden/moodle into MOODLE_19_STABLE 2011-03-07 02:38:48 +01:00
Eloy Lafuente (stronk7) cddf3e1679 Merge branch 'MDL-26324_19' of git://github.com/timhunt/moodle into MOODLE_19_STABLE 2011-03-07 01:25:53 +01:00
Dan Marsden eb2dc3ab87 AICC MDL-26672 fix for AICC Value=0 - thanks to Matteo for fix/report 2011-03-07 10:03:04 +13:00
Petr Skoda f483e32922 MDL-26605 fix problematic mediaplugin regex matching 2011-03-05 10:04:26 +01:00
Tim Hunt 83f22aae0e MDL-26324 overall feedback problem when quiz changed to being graded out of 0 2011-03-04 17:45:03 +00:00
Petr Skoda 0e33a45653 weekly release 2011-03-03 18:25:05 +01:00
Daren Chandisingh 18174ef082 MDL-26534 allow iframes in course category descriptions 2011-02-28 09:27:11 +01:00
Eloy Lafuente (stronk7) 6720f29ccf weekly release 2011-02-23 20:04:29 +01:00
Eloy Lafuente (stronk7) 9044a8edb3 Merge branch 'MDL-26528_restore_forum_read' of git://github.com/stronk7/moodle into MOODLE_19_STABLE 2011-02-22 16:15:24 +01:00
Eloy Lafuente (stronk7) 86a8740b67 Merge branch 'MDL-26502_symbian' of git://github.com/stronk7/moodle into MOODLE_19_STABLE 2011-02-22 15:21:01 +01:00
Eloy Lafuente (stronk7) 49a1b113ad Merge branch 'MDL-25122_19' of git://github.com/timhunt/moodle into MOODLE_19_STABLE 2011-02-22 12:45:37 +01:00
Eloy Lafuente (stronk7) f733078c91 MDL-26502 check browser - fix for Symbian (backported) 2011-02-22 11:51:26 +01:00
Eloy Lafuente (stronk7) eeff6a0839 Merge branch 'MDL-26505_19' of git://github.com/timhunt/moodle into MOODLE_19_STABLE 2011-02-22 10:56:28 +01:00
Eloy Lafuente (stronk7) 9170eb5aab MDL-26528 restore - ignore wrong forum_read records 2011-02-21 16:00:41 +01:00
Tim Hunt 49b2521492 MDL-26505 rounding problem in quiz_save_best_grade.
Note I cheated and slipped in a fix for another instance of MDL-21811 too, since I noticed it at the same time.
2011-02-18 19:34:31 +00:00
Tim Hunt 8d5eaee1c9 MDL-25122 Quiz review page does not check and enforce separate groups mode. 2011-02-18 17:23:41 +00:00
55 changed files with 3072 additions and 2400 deletions
+114
View File
@@ -328,4 +328,118 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="2.1" requires="1.9">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="5.0.25">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
</VENDOR>
<VENDOR name="postgres" version="8.3" />
<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" />
</DATABASE>
<PHP version="5.3.2" level="required">
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_CHECK message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_CHECK message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="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>
</MOODLE>
</COMPATIBILITY_MATRIX>
+2 -2
View File
@@ -75,12 +75,12 @@
.$param->extras
." ORDER BY ".$param->orderby;
}
error_log($sql);
$courses = get_records_sql($sql, 0, $numcourses);
if (empty($courses)) {
notify(get_string('statsnodata'));echo '</td></tr></table>';echo '<p>after notify</p>';
notify(get_string('statsnodata'));
echo '</td></tr></table>';
} else {
if (empty($CFG->gdversion)) {
+2 -2
View File
@@ -558,7 +558,7 @@ if ($formdata = $mform->is_cancelled()) {
continue;
}
// save custom profile fields data
profile_save_data($user);
profile_save_data(addslashes_recursive($user));
// make sure user context exists
get_context_instance(CONTEXT_USER, $user->id);
@@ -665,7 +665,7 @@ if ($formdata = $mform->is_cancelled()) {
$newgroupdata = new object();
$newgroupdata->name = $addgroup;
$newgroupdata->courseid = $ccache[$shortname]->id;
if ($ccache[$shortname]->groups[$addgroup]->id = groups_create_group($newgroupdata)){
if ($ccache[$shortname]->groups[$addgroup]->id = groups_create_group(addslashes_recursive($newgroupdata))){
$ccache[$shortname]->groups[$addgroup]->name = $newgroupdata->name;
} else {
$upt->track('enrolments', get_string('unknowngroup', 'error', $addgroup), 'error');
+5 -2
View File
@@ -57,7 +57,7 @@
if ($resort and confirm_sesskey()) {
if ($courses = get_courses($category->id, "fullname ASC", 'c.id,c.fullname,c.sortorder')) {
// move it off the range
$sortorderresult = get_record_sql('SELECT MIN(sortorder) AS min, 1
FROM ' . $CFG->prefix . 'course WHERE category=' . $category->id);
$sortordermin = $sortorderresult->min;
@@ -131,7 +131,10 @@
/// Print current category description
if (!$editingon && $category->description) {
print_box_start();
echo format_text($category->description); // for multilang filter
$options = new stdClass();
$options->noclean = true;
$options->para = false;
echo format_text($category->description, FORMAT_MOODLE, $options); // for multilang filter
print_box_end();
}
+1 -1
View File
@@ -523,7 +523,7 @@ function print_log_csv($course, $user, $date, $order='l.time DESC', $modname,
header("Pragma: public");
echo get_string('savedat').userdate(time(), $strftimedatetime)."\n";
echo $text;
echo $text."\n";
if (empty($logs['logs'])) {
return true;
+2 -2
View File
@@ -71,7 +71,7 @@ class enrolment_plugin_authorize
$curcost = get_course_cost($course);
echo '<div class="mdl-align">';
echo '<p>'.get_string('paymentrequired').'</p>';
echo '<p><b>'.get_string('cost').": $curcost[currency] $curcost[cost]".'</b></p>';
echo '<p><b>'.get_string('cost').': '. $curcost['currency'] . $curcost['localizedcost'] .'</b></p>';
echo '<p><a href="'.$CFG->httpswwwroot.'/login/">'.get_string('loginsite').'</a></p>';
echo '</div>';
}
@@ -387,7 +387,7 @@ class enrolment_plugin_authorize
}
$str .= '<div class="cost" title="'.$strrequirespayment.'">'.$strcost.': ';
$str .= $currency . ' ' . $curcost['cost'].'</div>';
$str .= $currency . ' ' . $curcost['localizedcost'].'</div>';
}
return $str;
+3 -2
View File
@@ -12,10 +12,11 @@ function get_course_cost($course)
if (!empty($course->cost)) {
$cost = (float)(((float)$course->cost) < 0) ? $CFG->enrol_cost : $course->cost;
}
$cost = format_float($cost, 2);
$costlocalizeddisplay = format_float($cost, 2);
$cost = format_float($cost, 2, false);
$ret = array(
'cost' => $cost,
'localizedcost' => $costlocalizeddisplay,
'currency' => $currency
);
+2 -2
View File
@@ -157,13 +157,13 @@ function get_access_icons($course) {
continue;
}
if (! $user = get_record("user", "idnumber", $fields[2]) ) {
if (! $user = get_record("user", "idnumber", addslashes($fields[2])) ) {
$this->log .= "Unknown user idnumber in field 3 - ignoring line\n";
continue;
}
if (! $course = get_record("course", "idnumber", $fields[3]) ) {
if (! $course = get_record("course", "idnumber", addslashes($fields[3])) ) {
$this->log .= "Unknown course idnumber in field 4 - ignoring line\n";
continue;
}
+17 -17
View File
@@ -36,80 +36,80 @@ function mediaplugin_filter($courseid, $text) {
$newtext = $text; // fullclone is slow and not needed here
if ($CFG->filter_mediaplugin_enable_mp3) {
$search = '/<a.*?href="([^"]+\.mp3)"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.mp3)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_mp3_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_ogg) {
$search = '/<a[^>]*?href="([^"]+\.ogg)"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.ogg)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_ogg_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_ogv) {
$search = '/<a[^>]*?href="([^"]+\.ogv)"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.ogv)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_ogv_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_swf) {
$search = '/<a.*?href="([^"]+\.swf)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.swf)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_swf_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_flv) {
$search = '/<a.*?href="([^"]+\.flv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.flv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_flv_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_mov) {
$search = '/<a.*?href="([^"]+\.mov)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.mov)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
// MDL-18658
$search = '/<a.*?href="([^"]+\.mp4)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.mp4)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
$search = '/<a.*?href="([^"]+\.m4v)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.m4v)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
$search = '/<a.*?href="([^<]+\.m4a)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^<]+\.m4a)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_wmv) {
$search = '/<a.*?href="([^"]+\.wmv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.wmv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_wmp_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_mpg) {
$search = '/<a.*?href="([^"]+\.mpe?g)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.mpe?g)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_avi) {
$search = '/<a.*?href="([^"]+\.avi)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.avi)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_wmp_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_ram) {
$search = '/<a.*?href="([^"]+\.ram)"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.ram)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_rpm) {
$search = '/<a.*?href="([^"]+\.rpm)"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.rpm)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
}
if ($CFG->filter_mediaplugin_enable_rm) {
$search = '/<a.*?href="([^"]+\.rm)"[^>]*>.*?<\/a>/is';
$search = '/<a\s[^>]*href="([^"]+\.rm)"[^>]*>.*?<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
}
if (!empty($CFG->filter_mediaplugin_enable_youtube)) {
$search = '/<a[^>]*?href="([^"]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
$search = '/<a\s[^>]*href="([^"]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_youtube_callback', $newtext);
$search = '/<a[^>]*?href="([^"]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
$search = '/<a\s[^>]*href="([^"]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'mediaplugin_filter_youtube_callback', $newtext);
}
+17 -9
View File
@@ -108,10 +108,14 @@ class graded_users_iterator {
$users_sql = "SELECT u.* $ofields
FROM {$CFG->prefix}user u
INNER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
$groupsql
WHERE ra.roleid $gradebookroles
AND ra.contextid $relatedcontexts
JOIN (
SELECT DISTINCT ra.userid
FROM {$CFG->prefix}role_assignments ra
WHERE ra.roleid $gradebookroles
AND ra.contextid $relatedcontexts
) rainner ON rainner.userid = u.id
WHERE u.deleted = 0
$groupwheresql
ORDER BY $order";
@@ -123,13 +127,17 @@ class graded_users_iterator {
$grades_sql = "SELECT g.* $ofields
FROM {$CFG->prefix}grade_grades g
INNER JOIN {$CFG->prefix}user u ON g.userid = u.id
INNER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
JOIN {$CFG->prefix}user u ON g.userid = u.id
$groupsql
WHERE ra.roleid $gradebookroles
AND ra.contextid $relatedcontexts
AND g.itemid IN ($itemids)
$groupwheresql
JOIN (
SELECT DISTINCT ra.userid
FROM {$CFG->prefix}role_assignments ra
WHERE ra.roleid $gradebookroles
AND ra.contextid $relatedcontexts
) rainner ON rainner.userid = u.id
WHERE u.deleted = 0
AND g.itemid IN ($itemids)
$groupwheresql
ORDER BY $order, g.itemid ASC";
$this->grades_rs = get_recordset_sql($grades_sql);
} else {
+44 -42
View File
@@ -327,41 +327,38 @@ class grade_report_grader extends grade_report {
global $CFG;
if (is_numeric($this->sortitemid)) {
// the MAX() magic is required in order to please PG
$sort = "MAX(g.finalgrade) $this->sortorder";
$sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
FROM {$CFG->prefix}user u
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
$this->groupsql
LEFT JOIN {$CFG->prefix}grade_grades g ON (g.userid = u.id AND g.itemid = $this->sortitemid)
WHERE ra.roleid in ($this->gradebookroles) AND u.deleted = 0
$this->groupwheresql
AND ra.contextid ".get_related_contexts_string($this->context)."
GROUP BY u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
ORDER BY $sort";
$sortjoin = "LEFT JOIN {$CFG->prefix}grade_grades g ON " .
"g.userid = u.id AND g.itemid = $this->sortitemid";
$sort = "g.finalgrade $this->sortorder";
} else {
$sortjoin = '';
switch($this->sortitemid) {
case 'lastname':
$sort = "u.lastname $this->sortorder, u.firstname $this->sortorder"; break;
$sort = "u.lastname $this->sortorder, u.firstname $this->sortorder";
break;
case 'firstname':
$sort = "u.firstname $this->sortorder, u.lastname $this->sortorder"; break;
$sort = "u.firstname $this->sortorder, u.lastname $this->sortorder";
break;
case 'idnumber':
default:
$sort = "u.idnumber $this->sortorder"; break;
$sort = "u.idnumber $this->sortorder";
break;
}
$sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
FROM {$CFG->prefix}user u
JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
$this->groupsql
WHERE ra.roleid in ($this->gradebookroles)
$this->groupwheresql
AND ra.contextid ".get_related_contexts_string($this->context)."
ORDER BY $sort";
}
$sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
FROM {$CFG->prefix}user u
$this->groupsql
$sortjoin
JOIN (
SELECT DISTINCT ra.userid
FROM {$CFG->prefix}role_assignments ra
WHERE ra.roleid IN ($this->gradebookroles)
AND ra.contextid " . get_related_contexts_string($this->context) . "
) rainner ON rainner.userid = u.id
WHERE u.deleted = 0
$this->groupwheresql
ORDER BY $sort";
$this->users = get_records_sql($sql, $this->get_pref('studentsperpage') * $this->page,
$this->get_pref('studentsperpage'));
@@ -1152,20 +1149,24 @@ class grade_report_grader extends grade_report {
if ($showaverages) {
// find sums of all grade items in course
$SQL = "SELECT g.itemid, SUM(g.finalgrade) AS sum
$sql = "SELECT g.itemid, SUM(g.finalgrade) AS sum
FROM {$CFG->prefix}grade_items gi
JOIN {$CFG->prefix}grade_grades g ON g.itemid = gi.id
JOIN {$CFG->prefix}user u ON u.id = g.userid
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
JOIN {$CFG->prefix}grade_grades g ON g.itemid = gi.id
JOIN {$CFG->prefix}user u ON u.id = g.userid
$groupsql
WHERE gi.courseid = $this->courseid
AND ra.roleid in ($this->gradebookroles)
AND ra.contextid ".get_related_contexts_string($this->context)."
AND g.finalgrade IS NOT NULL
$groupwheresql
JOIN (
SELECT DISTINCT ra.userid
FROM {$CFG->prefix}role_assignments ra
WHERE ra.roleid IN ($this->gradebookroles)
AND ra.contextid " . get_related_contexts_string($this->context) . "
) rainner ON rainner.userid = u.id
WHERE gi.courseid = $this->courseid
AND u.deleted = 0
AND g.finalgrade IS NOT NULL
$groupwheresql
GROUP BY g.itemid";
$sum_array = array();
if ($sums = get_records_sql($SQL)) {
if ($sums = get_records_sql($sql)) {
foreach ($sums as $itemid => $csum) {
$sum_array[$itemid] = $csum->sum;
}
@@ -1177,20 +1178,21 @@ class grade_report_grader extends grade_report {
// MDL-10875 Empty grades must be evaluated as grademin, NOT always 0
// This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
$SQL = "SELECT gi.id, COUNT(u.id) AS count
$sql = "SELECT gi.id, COUNT(DISTINCT u.id) AS count
FROM {$CFG->prefix}grade_items gi
CROSS JOIN {$CFG->prefix}user u
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
LEFT OUTER JOIN {$CFG->prefix}grade_grades g ON (g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL)
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
LEFT OUTER JOIN {$CFG->prefix}grade_grades g ON g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL
$groupsql
WHERE gi.courseid = $this->courseid
AND ra.roleid in ($this->gradebookroles)
AND ra.contextid ".get_related_contexts_string($this->context)."
AND ra.roleid IN ($this->gradebookroles)
AND u.deleted = 0
AND ra.contextid " . get_related_contexts_string($this->context) . "
AND g.id IS NULL
$groupwheresql
GROUP BY gi.id";
$ungraded_counts = get_records_sql($SQL);
$ungraded_counts = get_records_sql($sql);
$fixedstudents = $this->is_fixed_students();
if (!$fixedstudents) {
+4 -4
View File
@@ -114,7 +114,7 @@ $string['configdisablecourseajax'] = 'Do not use AJAX when editing main course p
$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.';
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
$string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.';
$string['configenablegroupings'] = 'This setting enables groupings of groups.';
$string['configenablegroupings'] = 'This setting enables the creation of groupings and the \'Available for group members only\' option. Groupings are a standard feature in Moodle 2.0 onwards whereas \'Available for group members only\' remains an experimental feature.';
$string['configenablehtmlpurifier'] = 'Use HTML Purifier instead of KSES for cleaning of untrusted text. HTML Purifier is actively developed and is believed to be more secure, but it is more resource intensive. Expect minor visual differences in the resulting html code. Please note that embed and object tags can not be enabled, MathML tags and old lang tags are not supported. ';
$string['configenablerssfeeds'] = 'This switch will enable RSS feeds from across the site. To actually see any change you will need to enable RSS feeds in the individual modules too - go to the Modules settings under Admin Configuration.';
$string['configenablerssfeedsdisabled'] = 'It is not available because RSS feeds are disabled in all the Site. To enable them, go to the Variables settings under Admin Configuration.';
@@ -209,8 +209,8 @@ $string['configcronremotepassword'] = 'This means that the cron.php script canno
</pre>If this is left empty, no password is required.';
$string['configrcache'] = 'Use the cache to store database records. Remember to set \'cachetype\' as well!';
$string['configrcachettl'] = 'Time-to-live for cached records, in seconds. Use a short (&lt;15) value here.';
$string['configrecaptchaprivatekey'] = 'String of characters used to communicate between your Moodle server and the recaptcha.net server. Obtain one for this site by visiting http://recaptcha.net';
$string['configrecaptchapublickey'] = 'String of characters used to display the reCAPTCHA element in the signup form. Generated by http://recaptcha.net';
$string['configrecaptchaprivatekey'] = 'String of characters used to communicate between your Moodle server and the recaptcha server. Obtain one for this site by visiting http://www.google.com/recaptcha';
$string['configrecaptchapublickey'] = 'String of characters used to display the reCAPTCHA element in the signup form. Generated by http://www.google.com/recaptcha';
$string['configregenloginsession'] = 'Regeneration of the session id during each login request is highly recommended for security reasons. This setting might not be compatible with some authentication plugins.';
$string['configrequestedstudentname'] = 'Word for student used in requested courses';
$string['configrequestedstudentsname'] = 'Word for students used in requested courses';
@@ -358,7 +358,7 @@ $string['enableajax'] = 'Enable AJAX';
$string['enablecalendarexport'] = 'Enable calendar export';
$string['enablecourserequests'] = 'Enable course requests';
$string['enableglobalsearch'] = 'Enable global search';
$string['enablegroupings'] = 'Enable groupings';
$string['enablegroupings'] = 'Enable groupings and \'Available for group members only\'';
$string['enablehtmlpurifier'] = 'Enable HTML Purifier';
$string['enablerecordcache'] = 'Enable Record Cache';
$string['enablerssfeeds'] = 'Enable RSS feeds';
+2 -2
View File
@@ -125,7 +125,7 @@ $string['auth_emailnowexists'] = 'The email address you tried to assign to your
$string['auth_emailtitle'] = 'Email-based self-registration';
$string['auth_emailnoinsert'] = 'Could not add your record to the database!';
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://recaptcha.net/learnmore.html for more details. <br /><em>PHP cURL extension is required.</em>';
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha/learnmore for more details. <br /><em>PHP cURL extension is required.</em>';
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
$string['auth_emailsettings'] = 'Settings';
$string['auth_emailupdatemessage'] = 'Dear $a->fullname,
@@ -260,7 +260,7 @@ $string['auth_ntlmsso_enabled'] = 'Set to yes to attempt Single Sign On with the
$string['auth_ntlmsso_ie_fastpath'] = 'Set to yes to enable the NTLM SSO fast path (bypasses certain steps and only works if the client\'s browser is MS Internet Explorer).';
$string['auth_ntlmsso_ie_fastpath_key'] = 'MS IE fast path?';
$string['auth_ntlmsso_subnet_key'] = 'Subnet';
$string['auth_ntlmsso_subnet'] = 'If set, it will only attempt SSO with clients in this subnet. Format: xxx.xxx.xxx.xxx/bitmask';
$string['auth_ntlmsso_subnet'] = 'If set, it will only attempt SSO with clients in this subnet. Format: xxx.xxx.xxx.xxx/bitmask. Separate multiple subnets with \',\' (comma).';
$string['ntlmsso_attempting'] = 'Attempting Single Sign On via NTLM...';
$string['ntlmsso_failed'] = 'Auto-login failed, try the normal login page...';
$string['ntlmsso_isdisabled'] = 'NTLM SSO is disabled.';
+1 -1
View File
@@ -94,7 +94,7 @@ $string['forum'] = 'Forum';
$string['forum:addnews'] = 'Add news';
$string['forumauthorhidden'] = 'Author (hidden)';
$string['forumblockingalmosttoomanyposts'] = 'You are approaching the posting threshold. You have posted $a->numposts times in the last $a->blockperiod and the limit is $a->blockafter posts.';
$string['forumbodyhidden'] = 'This post cannot be viewed by you, probably because you have not posted in the discussion yet.';
$string['forumbodyhidden'] = 'This post cannot be viewed by you, probably because you have not posted in the discussion or the maximum editing time hasn\'t passed yet.';
$string['forum:createattachment'] = 'Create attachments';
$string['forum:deleteanypost'] = 'Delete any posts (anytime)';
$string['forum:deleteownpost'] = 'Delete own posts (within deadline)';
+6
View File
@@ -1677,6 +1677,12 @@ function error ($message, $link='') {
}
}
// when printing an error the continue button should never link offsite
if (stripos($link, $CFG->wwwroot) === false &&
stripos($link, $CFG->httpswwwroot) === false) {
$link = $CFG->wwwroot.'/';
}
if (!empty($link)) {
print_continue($link);
}
@@ -3,6 +3,7 @@
require("../../../../config.php");
$id = optional_param('id', SITEID, PARAM_INT);
$httpsrequired = optional_param('httpsrequired', 0, PARAM_BOOL);
require_login($id);
require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id));
@@ -2,8 +2,10 @@
require("../../../../config.php");
$id = optional_param('id', SITEID, PARAM_INT);
$httpsrequired = optional_param('httpsrequired', 0, PARAM_BOOL);
require_course_login($id);
@header('Content-Type: text/html; charset=utf-8');
if ($httpsrequired or (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off')) {
+10 -1
View File
@@ -122,7 +122,16 @@ class MoodleExcelWorksheet {
*/
function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) {
/// Internally, add one sheet to the workbook
if (strlen($name) > 31) {
// Excel does not seem able to cope with sheet names > 31 chars.
// With $latin_output = false, it does not cope at all.
// With $latin_output = true it is supposed to work, but in our experience,
// it doesn't. Therefore, truncate in all circumstances.
$textlib = textlib_get_instance();
$name = $textlib->substr($name, 0, 31);
}
/// Internally, add one sheet to the workbook
$this->pear_excel_worksheet =& $workbook->addWorksheet($name);
$this->latin_output = $latin_output;
/// Set encoding to UTF-16LE
+4 -2
View File
@@ -656,12 +656,14 @@ class moodleform {
/**
* Adds a link/button that controls the checked state of a group of checkboxes.
* @param int $groupid The id of the group of advcheckboxes this element controls
* @param string $text The text of the link. Defaults to "select all/none"
* @param string $text The text of the link. Defaults to selectallornone ("select all/none")
* @param array $attributes associative array of HTML attributes
* @param int $originalValue The original general state of the checkboxes before the user first clicks this element
*/
function add_checkbox_controller($groupid, $buttontext, $attributes, $originalValue = 0) {
function add_checkbox_controller($groupid, $text = null, $attributes = null, $originalValue = 0) {
global $CFG;
// Set the default text if none was specified
if (empty($text)) {
$text = get_string('selectallornone', 'form');
}
+30 -26
View File
@@ -1115,27 +1115,28 @@ function get_user_preferences($name=NULL, $default=NULL, $otheruserid=NULL) {
* @param int $hour The hour part to create timestamp of
* @param int $minute The minute part to create timestamp of
* @param int $second The second part to create timestamp of
* @param float $timezone ?
* @param bool $applydst ?
* @param mixed $timezone Timezone modifier, if 99 then use default user's timezone
* @param bool $applydst Toggle Daylight Saving Time, default true, will be
* applied only if timezone is 99 or string.
* @return int timestamp
* @todo Finish documenting this function
*/
function make_timestamp($year, $month=1, $day=1, $hour=0, $minute=0, $second=0, $timezone=99, $applydst=true) {
$strtimezone = NULL;
if (!is_numeric($timezone)) {
$strtimezone = $timezone;
}
//save input timezone, required for dst offset check.
$passedtimezone = $timezone;
$timezone = get_user_timezone_offset($timezone);
if (abs($timezone) > 13) {
if (abs($timezone) > 13) { //server time
$time = mktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
} else {
$time = gmmktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
$time = usertime($time, $timezone);
if($applydst) {
$time -= dst_offset_on($time, $strtimezone);
//Apply dst for string timezones or if 99 then try dst offset with user's default timezone
if ($applydst && ((99 == $passedtimezone) || !is_numeric($passedtimezone))) {
$time -= dst_offset_on($time, $passedtimezone);
}
}
@@ -1222,7 +1223,8 @@ function make_timestamp($year, $month=1, $day=1, $hour=0, $minute=0, $second=0,
* @uses HOURSECS
* @param int $date timestamp in GMT
* @param string $format strftime format
* @param float $timezone
* @param mixed $timezone by default, uses the user's time zone. if numeric and
* not 99 then daylight saving will not be added.
* @param bool $fixday If true (default) then the leading
* zero from %d is removed. If false then the leading zero is mantained.
* @return string
@@ -1231,11 +1233,6 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
global $CFG;
$strtimezone = NULL;
if (!is_numeric($timezone)) {
$strtimezone = $timezone;
}
if (empty($format)) {
$format = get_string('strftimedaydatetime');
}
@@ -1247,7 +1244,11 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
$fixday = ($formatnoday != $format);
}
$date += dst_offset_on($date, $strtimezone);
//add daylight saving offset for string timezones only, as we can't get dst for
//float values. if timezone is 99 (user default timezone), then try update dst.
if ((99 == $timezone) || !is_numeric($timezone)) {
$date += dst_offset_on($date, $timezone);
}
$timezone = get_user_timezone_offset($timezone);
@@ -1289,16 +1290,15 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
*
* @uses HOURSECS
* @param int $time Timestamp in GMT
* @param float $timezone ?
* @param mixed $timezone offset time with timezone, if float and not 99, then no
* dst offset is applyed
* @return array An array that represents the date in user time
* @todo Finish documenting this function
*/
function usergetdate($time, $timezone=99) {
$strtimezone = NULL;
if (!is_numeric($timezone)) {
$strtimezone = $timezone;
}
//save input timezone, required for dst offset check.
$passedtimezone = $timezone;
$timezone = get_user_timezone_offset($timezone);
@@ -1306,8 +1306,12 @@ function usergetdate($time, $timezone=99) {
return getdate($time);
}
// There is no gmgetdate so we use gmdate instead
$time += dst_offset_on($time, $strtimezone);
//add daylight saving offset for string timezones only, as we can't get dst for
//float values. if timezone is 99 (user default timezone), then try update dst.
if ($passedtimezone == 99 || !is_numeric($passedtimezone)) {
$time += dst_offset_on($time, $passedtimezone);
}
$time += intval((float)$timezone * HOURSECS);
$datestring = gmstrftime('%B_%A_%j_%Y_%m_%w_%d_%H_%M_%S', $time);
@@ -1456,7 +1460,7 @@ function get_timezone_offset($tz) {
*
* @uses $USER
* @uses $CFG
* @param float $tz If this value is provided and not equal to 99, it will be returned as is and no other settings will be checked
* @param mixed $tz If this value is provided and not equal to 99, it will be returned as is and no other settings will be checked
* @return mixed
*/
function get_user_timezone($tz = 99) {
@@ -6431,12 +6435,12 @@ function check_php_version($version='4.1.0') {
break;
case 'Safari': /// Safari
// Look for AppleWebKit, excluding strings with OmniWeb, Shiira and SimbianOS
// Look for AppleWebKit, excluding strings with OmniWeb, Shiira and SymbianOS
if (strpos($agent, 'OmniWeb')) { // Reject OmniWeb
return false;
} elseif (strpos($agent, 'Shiira')) { // Reject Shiira
return false;
} elseif (strpos($agent, 'SimbianOS')) { // Reject SimbianOS
} elseif (strpos($agent, 'SymbianOS')) { // Reject SymbianOS
return false;
}
if (strpos($agent, 'iPhone') or strpos($agent, 'iPad') or strpos($agent, 'iPod')) {
+1
View File
@@ -664,6 +664,7 @@ function olson_parse_at ($at, $set = 'set', $gmtoffset) {
$at = substr($at, 0, strlen($at)-1); // chop
}
$at = (strpos($at, ':') === false) ? $at . ':0' : $at;
list($hours, $mins) = explode(':', $at);
// GMT -- return as is!
+41 -35
View File
@@ -2,13 +2,13 @@
/*
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* {@link http://code.google.com/apis/recaptcha/docs/php.html}
* - Get a reCAPTCHA API Key
* http://recaptcha.net/api/getkey
* {@link https://www.google.com/recaptcha/admin/create}
* - Discussion group
* http://groups.google.com/group/recaptcha
*
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
* Copyright (c) 2007 reCAPTCHA -- {@link http://www.google.com/recaptcha}
* AUTHORS:
* Mike Crawford
* Ben Maurer
@@ -30,14 +30,17 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package moodlecore
* @copyright (c) 2007 reCAPTCHA -- {@link http://www.google.com/recaptcha}
*/
/**
* The reCAPTCHA server URL's
*/
define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net");
define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net");
define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net");
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
/**
* Encodes the given data into a query string format
@@ -107,15 +110,15 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) {
$recaptchatype = optional_param('recaptcha', 'image', PARAM_TEXT);
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
$server = RECAPTCHA_API_SERVER;
}
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
$server = RECAPTCHA_API_SERVER;
}
$errorpart = "";
if ($error) {
@@ -175,6 +178,9 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) {
/**
* A ReCaptchaResponse is returned from recaptcha_check_answer()
*
* @package moodlecore
* @copyright (c) 2007 reCAPTCHA -- {@link http://www.google.com/recaptcha}
*/
class ReCaptchaResponse {
var $is_valid;
@@ -192,9 +198,9 @@ class ReCaptchaResponse {
*/
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $https=false)
{
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
}
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($remoteip == null || $remoteip == '') {
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
@@ -210,12 +216,12 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ht
return $recaptcha_response;
}
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
'challenge' => $challenge,
'response' => $response
$response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
'challenge' => $challenge,
'response' => $response
),
$https
);
@@ -242,7 +248,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ht
* @param string $appname The name of your application
*/
function recaptcha_get_signup_url ($domain = null, $appname = null) {
return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname));
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
}
function _recaptcha_aes_pad($val) {
@@ -270,16 +276,16 @@ function _recaptcha_mailhide_urlbase64 ($x) {
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://mailhide.recaptcha.net/apikey'>http://mailhide.recaptcha.net/apikey</a>");
}
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}
/**
@@ -304,7 +310,7 @@ function _recaptcha_mailhide_email_parts ($email) {
* Gets html to display an email address given a public an private key.
* to get a key, go to:
*
* http://mailhide.recaptcha.net/apikey
* http://www.google.com/recaptcha/mailhide/apikey
*/
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);
+274 -2
View File
@@ -255,7 +255,14 @@ class moodlelib_test extends UnitTestCase {
}
function test_usergetdate() {
global $USER;
global $USER, $CFG;
//Check if forcetimezone is set then save it and set it to use user timezone
$cfgforcetimezone = null;
if (isset($CFG->forcetimezone)) {
$cfgforcetimezone = $CFG->forcetimezone;
$CFG->forcetimezone = 99; //get user default timezone.
}
$userstimezone = $USER->timezone;
$USER->timezone = 2;//set the timezone to a known state
@@ -292,9 +299,274 @@ class moodlelib_test extends UnitTestCase {
$this->assertEqual($weekday,'Wednesday');
$this->assertEqual($month,'December');
//restore forcetimezone if changed.
if (!is_null($cfgforcetimezone)) {
$CFG->forcetimezone = $cfgforcetimezone;
}
//set the timezone back to what it was
$USER->timezone = $userstimezone;
}
public function test_userdate() {
global $USER, $CFG;
$testvalues = array(
array(
'time' => '1309514400',
'usertimezone' => 'America/Moncton',
'timezone' => '0.0', //no dst offset
'expectedoutput' => 'Friday, 1 July 2011, 10:00 AM'
),
array(
'time' => '1309514400',
'usertimezone' => 'America/Moncton',
'timezone' => '99', //dst offset and timezone offset.
'expectedoutput' => 'Friday, 1 July 2011, 07:00 AM'
),
array(
'time' => '1309514400',
'usertimezone' => 'America/Moncton',
'timezone' => 'America/Moncton', //dst offset and timezone offset.
'expectedoutput' => 'Friday, 1 July 2011, 07:00 AM'
),
array(
'time' => '1293876000 ',
'usertimezone' => 'America/Moncton',
'timezone' => '0.0', //no dst offset
'expectedoutput' => 'Saturday, 1 January 2011, 10:00 AM'
),
array(
'time' => '1293876000 ',
'usertimezone' => 'America/Moncton',
'timezone' => '99', //no dst offset in jan, so just timezone offset.
'expectedoutput' => 'Saturday, 1 January 2011, 06:00 AM'
),
array(
'time' => '1293876000 ',
'usertimezone' => 'America/Moncton',
'timezone' => 'America/Moncton', //no dst offset in jan
'expectedoutput' => 'Saturday, 1 January 2011, 06:00 AM'
),
array(
'time' => '1293876000 ',
'usertimezone' => '2',
'timezone' => '99', //take user timezone
'expectedoutput' => 'Saturday, 1 January 2011, 12:00 PM'
),
array(
'time' => '1293876000 ',
'usertimezone' => '-2',
'timezone' => '99', //take user timezone
'expectedoutput' => 'Saturday, 1 January 2011, 08:00 AM'
),
array(
'time' => '1293876000 ',
'usertimezone' => '-10',
'timezone' => '2', //take this timezone
'expectedoutput' => 'Saturday, 1 January 2011, 12:00 PM'
),
array(
'time' => '1293876000 ',
'usertimezone' => '-10',
'timezone' => '-2', //take this timezone
'expectedoutput' => 'Saturday, 1 January 2011, 08:00 AM'
)
);
//Check if forcetimezone is set then save it and set it to use user timezone
$cfgforcetimezone = null;
if (isset($CFG->forcetimezone)) {
$cfgforcetimezone = $CFG->forcetimezone;
$CFG->forcetimezone = 99; //get user default timezone.
}
//store user default timezone to restore later
$userstimezone = $USER->timezone;
// The string version of date comes from server locale setting and does
// not respect user language, so it is necessary to reset that.
$oldlocale = setlocale(LC_TIME, '0');
setlocale(LC_TIME, 'en_AU.UTF-8');
//get instance of textlib for strtolower
$textlib = textlib_get_instance();
foreach ($testvalues as $vals) {
$USER->timezone = $vals['usertimezone'];
$actualoutput = userdate($vals['time'], '%A, %d %B %Y, %I:%M %p', $vals['timezone']);
//On different systems case of AM PM changes so compare case insenitive
$vals['expectedoutput'] = $textlib->strtolower($vals['expectedoutput']);
$actualoutput = $textlib->strtolower($actualoutput);
$this->assertEqual($vals['expectedoutput'], $actualoutput,
"Expected: {$vals['expectedoutput']} => Actual: {$actualoutput},
Please check if timezones are updated (Site adminstration -> location -> update timezone)");
}
//restore user timezone back to what it was
$USER->timezone = $userstimezone;
//restore forcetimezone
if (!is_null($cfgforcetimezone)) {
$CFG->forcetimezone = $cfgforcetimezone;
}
//restore system default values.
setlocale(LC_TIME, $oldlocale);
}
public function test_make_timestamp() {
global $USER, $CFG;
$testvalues = array(
array(
'usertimezone' => 'America/Moncton',
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '0.0', //no dst offset
'applydst' => false,
'expectedoutput' => '1309528800'
),
array(
'usertimezone' => 'America/Moncton',
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '99', //user default timezone
'applydst' => false, //don't apply dst
'expectedoutput' => '1309528800'
),
array(
'usertimezone' => 'America/Moncton',
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '99', //user default timezone
'applydst' => true, //apply dst
'expectedoutput' => '1309525200'
),
array(
'usertimezone' => 'America/Moncton',
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => 'America/Moncton', //string timezone
'applydst' => true, //apply dst
'expectedoutput' => '1309525200'
),
array(
'usertimezone' => '2',//no dst applyed
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '99', //take user timezone
'applydst' => true, //apply dst
'expectedoutput' => '1309507200'
),
array(
'usertimezone' => '-2',//no dst applyed
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '99', //take usertimezone
'applydst' => true, //apply dst
'expectedoutput' => '1309521600'
),
array(
'usertimezone' => '-10',//no dst applyed
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '2', //take this timezone
'applydst' => true, //apply dst
'expectedoutput' => '1309507200'
),
array(
'usertimezone' => '-10',//no dst applyed
'year' => '2011',
'month' => '7',
'day' => '1',
'hour' => '10',
'minutes' => '00',
'seconds' => '00',
'timezone' => '-2', //take this timezone
'applydst' => true, //apply dst,
'expectedoutput' => '1309521600'
)
);
//Check if forcetimezone is set then save it and set it to use user timezone
$cfgforcetimezone = null;
if (isset($CFG->forcetimezone)) {
$cfgforcetimezone = $CFG->forcetimezone;
$CFG->forcetimezone = 99; //get user default timezone.
}
//store user default timezone to restore later
$userstimezone = $USER->timezone;
// The string version of date comes from server locale setting and does
// not respect user language, so it is necessary to reset that.
$oldlocale = setlocale(LC_TIME, '0');
setlocale(LC_TIME, 'en_AU.UTF-8');
//get instance of textlib for strtolower
$textlib = textlib_get_instance();
//Test make_timestamp with all testvals and assert if anything wrong.
foreach ($testvalues as $vals) {
$USER->timezone = $vals['usertimezone'];
$actualoutput = make_timestamp(
$vals['year'],
$vals['month'],
$vals['day'],
$vals['hour'],
$vals['minutes'],
$vals['seconds'],
$vals['timezone'],
$vals['applydst']
);
//On different systems case of AM PM changes so compare case insenitive
$vals['expectedoutput'] = $textlib->strtolower($vals['expectedoutput']);
$actualoutput = $textlib->strtolower($actualoutput);
$this->assertEqual($vals['expectedoutput'], $actualoutput,
"Expected: {$vals['expectedoutput']} => Actual: {$actualoutput},
Please check if timezones are updated (Site adminstration -> location -> update timezone)");
}
//restore user timezone back to what it was
$USER->timezone = $userstimezone;
//restore forcetimezone
if (!is_null($cfgforcetimezone)) {
$CFG->forcetimezone = $cfgforcetimezone;
}
//restore system default values.
setlocale(LC_TIME, $oldlocale);
}
}
?>
?>
+2149 -2112
View File
File diff suppressed because it is too large Load Diff
+63 -23
View File
@@ -216,33 +216,41 @@ function get_referer($stripquery=true) {
*
* @return string
*/
function me() {
function me() {
if (!empty($_SERVER['REQUEST_URI'])) {
return $_SERVER['REQUEST_URI'];
$return = $_SERVER['REQUEST_URI'];
} else if (!empty($_SERVER['PHP_SELF'])) {
if (!empty($_SERVER['QUERY_STRING'])) {
return $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
$return = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
} else {
$return = $_SERVER['PHP_SELF'];
}
return $_SERVER['PHP_SELF'];
} else if (!empty($_SERVER['SCRIPT_NAME'])) {
if (!empty($_SERVER['QUERY_STRING'])) {
return $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
$return = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
} else {
$return = $_SERVER['SCRIPT_NAME'];
}
return $_SERVER['SCRIPT_NAME'];
} else if (!empty($_SERVER['URL'])) { // May help IIS (not well tested)
if (!empty($_SERVER['QUERY_STRING'])) {
return $_SERVER['URL'] .'?'. $_SERVER['QUERY_STRING'];
$return = $_SERVER['URL'] .'?'. $_SERVER['QUERY_STRING'];
} else {
$return = $_SERVER['URL'];
}
return $_SERVER['URL'];
} else {
notify('Warning: Could not find any of these web server variables: $REQUEST_URI, $PHP_SELF, $SCRIPT_NAME or $URL');
return false;
}
// sanitize the url a bit more, the encoding style may be different in vars above
$return = str_replace('"', '%22', $return);
$return = str_replace('\'', '%27', $return);
return $return;
}
/**
@@ -1502,7 +1510,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
static $croncache = array();
if ($text === '') {
if ($text === '' || is_null($text)) {
return ''; // no need to do any filters and cleaning
}
@@ -2757,9 +2765,9 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
$pageclass .= ' dir-'.get_string('thisdirection');
$pageclass .= ' lang-'.$currentlanguage;
$pageclass .= ' lang-'.s($currentlanguage);
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
$bodytags .= ' class="'.s($pageclass).'" id="'.s($pageid).'"';
ob_start();
include($CFG->header);
@@ -5833,12 +5841,20 @@ function print_error($errorcode, $module='error', $link='', $a=NULL, $extralocat
}
}
// when printing an error the continue button should never link offsite
if (stripos($link, $CFG->wwwroot) === false &&
stripos($link, $CFG->httpswwwroot) === false) {
$link = $CFG->wwwroot.'/';
}
if (!empty($CFG->errordocroot)) {
$errordocroot = $CFG->errordocroot;
} else if (!empty($CFG->docroot)) {
$errordocroot = $CFG->docroot;
$errordoclink = $CFG->errordocroot.'/en';
} else {
$errordocroot = 'http://docs.moodle.org';
$errordoclink = get_doc_root();
if (is_null($errordoclink)) {
$lang = current_language();
$errordoclink = 'http://docs.moodle.org/19/'.$lang; //no doc links set. point to default.
}
}
if (defined('FULLME') && FULLME == 'cron') {
@@ -5855,7 +5871,7 @@ function print_error($errorcode, $module='error', $link='', $a=NULL, $extralocat
$message = clean_text('<p class="errormessage">'.$message.'</p>'.
'<p class="errorcode">'.
'<a href="'.$errordocroot.'/en/error/'.$modulelink.'/'.$errorcode.'">'.
'<a href="'.$errordoclink.'/error/'.$modulelink.'/'.$errorcode.'">'.
get_string('moreinformation').'</a></p>');
if (! defined('HEADER_PRINTED')) {
@@ -6949,18 +6965,16 @@ function page_doc_link($text='', $iconpath='') {
function doc_link($path='', $text='', $iconpath='') {
global $CFG;
if (empty($CFG->docroot)) {
return '';
}
$target = '';
if (!empty($CFG->doctonewwindow)) {
$target = ' target="_blank"';
}
$lang = str_replace('_utf8', '', current_language());
if (is_null($docroot = get_doc_root())) {
return '';
}
$str = '<a href="' .$CFG->docroot. '/' .$lang. '/' .$path. '"' .$target. '>';
$str = '<a href="' .$docroot. '/' .$path. '"' .$target. '>';
if (empty($iconpath)) {
$iconpath = $CFG->httpswwwroot . '/pix/docs.gif';
@@ -6972,6 +6986,32 @@ function doc_link($path='', $text='', $iconpath='') {
return $str;
}
/**
* A function that checks if docroot is set, builds and returns the docs root url according to version release.
* @return string documentation url, null if doc root isn't set (ie:during installation perhaps).
*/
function get_doc_root() {
global $CFG;
if (empty($CFG->docroot)) {
return null;
}
$lang = str_replace('_utf8', '', current_language());
if (!empty($CFG->release)) {
$release = $CFG->release;
} else {
//derive branch from the first three letters of version.php's $release with the period taken out.($CFG->release isn't populated yet during upgrade)
include($CFG->dirroot.'/version.php');
}
if (preg_match('/^(.)\.(.)/', $release, $matches)) {
$branch = $matches[1].$matches[2];
} else {
$branch = '.';
}
return $CFG->docroot. '/' .$branch. '/' .$lang;
}
/**
* Returns true if the current site debugging settings are equal or above specified level.
+2 -4
View File
@@ -838,8 +838,7 @@ class assignment_base {
if ($users) {
$select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
s.id AS submissionid, s.grade, s.submissioncomment,
s.timemodified, s.timemarked,
COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
s.timemodified, s.timemarked ';
$sql = 'FROM '.$CFG->prefix.'user u '.
'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid
AND s.assignment = '.$this->assignment->id.' '.
@@ -1167,8 +1166,7 @@ class assignment_base {
$select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
s.id AS submissionid, s.grade, s.submissioncomment,
s.timemodified, s.timemarked,
COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
s.timemodified, s.timemarked ';
$sql = 'FROM '.$CFG->prefix.'user u '.
'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid
AND s.assignment = '.$this->assignment->id.' '.
+1 -1
View File
@@ -29,7 +29,7 @@
<option value="-2"<?php if($this->field->param2==-2) echo ' selected="selected"' ?>><?php echo get_string('latitude', 'data').'/'.get_string('longitude', 'data') ?></option>
<?php
// Fetch all "suitable" other fields that exist for this database
$textfields = get_records_select('data_fields', 'dataid='.$this->data->id.' AND type="text"');
$textfields = get_records_select('data_fields', 'dataid='.$this->data->id." AND type='text'");
echo '<optgroup label="'.get_string('latlongotherfields', 'data').':">';
if(sizeof($textfields)>0) {
foreach($textfields as $textfield) {
+9 -1
View File
@@ -729,7 +729,15 @@ function data_user_outline($course, $user, $mod, $data) {
} else if ($grade) {
$result = new object();
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
//datesubmitted == time created. dategraded == time modified or time overridden
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
$result->time = $grade->dategraded;
} else {
$result->time = $grade->datesubmitted;
}
return $result;
}
return NULL;
+36 -4
View File
@@ -380,6 +380,12 @@ function forum_cron() {
continue;
}
// Don't send email if the forum is Q&A and the user has not posted
if ($forum->type == 'qanda' && !forum_get_user_posted_time($discussion->id, $userto->id)) {
mtrace('Did not email '.$userto->id.' because user has not posted in discussion');
continue;
}
// Get info about the sending user
if (array_key_exists($post->userid, $users)) { // we might know him/her already
$userfrom = $users[$post->userid];
@@ -970,7 +976,15 @@ function forum_user_outline($course, $user, $mod, $forum) {
} else if ($grade) {
$result = new object();
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
//datesubmitted == time created. dategraded == time modified or time overridden
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
$result->time = $grade->dategraded;
} else {
$result->time = $grade->datesubmitted;
}
return $result;
}
return NULL;
@@ -4636,7 +4650,7 @@ function forum_user_can_see_discussion($forum, $discussion, $context, $user=NULL
*
*/
function forum_user_can_see_post($forum, $discussion, $post, $user=NULL, $cm=NULL) {
global $USER;
global $CFG, $USER;
// retrieve objects (yuk)
if (is_numeric($forum)) {
@@ -4697,9 +4711,10 @@ function forum_user_can_see_post($forum, $discussion, $post, $user=NULL, $cm=NUL
if ($forum->type == 'qanda') {
$firstpost = forum_get_firstpost_from_discussion($discussion->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$userfirstpost = forum_get_user_posted_time($discussion->id, $user->id);
return (forum_user_has_posted($forum->id,$discussion->id,$user->id) ||
$firstpost->id == $post->id ||
return (($userfirstpost !== false && (time() - $userfirstpost >= $CFG->maxeditingtime)) ||
$firstpost->id == $post->id || $post->userid == $user->id || $firstpost->userid == $user->id ||
has_capability('mod/forum:viewqandawithoutposting', $modcontext, $user->id, false));
}
return true;
@@ -6937,4 +6952,21 @@ function forum_get_extra_capabilities() {
return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames', 'moodle/site:trustcontent');
}
/**
* Returns creation time of the first user's post in given discussion
* @global object $DB
* @param int $did Discussion id
* @param int $userid User id
* @return int|bool post creation time stamp or return false
*/
function forum_get_user_posted_time($did, $userid) {
global $CFG;
$posttime = get_field('forum_posts', 'MIN(created)', 'userid', $userid, 'discussion', $did);
if (empty($posttime)) {
return false;
}
return $posttime;
}
?>
+5 -10
View File
@@ -385,15 +385,12 @@
$read->firstread = backup_todb($rea_info['#']['FIRSTREAD']['0']['#']);
$read->lastread = backup_todb($rea_info['#']['LASTREAD']['0']['#']);
//Some recoding and check are performed now
$toinsert = true;
//We have to recode the userid field
$user = backup_getid($restore->backup_unique_code,"user",$read->userid);
if ($user) {
$read->userid = $user->new_id;
} else {
$toinsert = false;
continue; // Skip this forum_read record
}
//We have to recode the discussionid field
@@ -401,7 +398,7 @@
if ($discussion) {
$read->discussionid = $discussion->new_id;
} else {
$toinsert = false;
continue; // Skip this forum_read record
}
//We have to recode the postid field
@@ -409,14 +406,12 @@
if ($post) {
$read->postid = $post->new_id;
} else {
$toinsert = false;
continue; // Skip this forum_read record
}
//The structure is equal to the db, so insert the forum_read
// Arrived here, the structure is equal to the db, so insert the forum_read
$newid = 0;
if ($toinsert) {
$newid = insert_record ("forum_read",$read);
}
$newid = insert_record ("forum_read",$read);
//Do some output
if (($i+1) % 50 == 0) {
+11 -4
View File
@@ -189,7 +189,15 @@ function glossary_user_outline($course, $user, $mod, $glossary) {
} else if ($grade) {
$result = new object();
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
//datesubmitted == time created. dategraded == time modified or time overridden
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
$result->time = $grade->dategraded;
} else {
$result->time = $grade->datesubmitted;
}
return $result;
}
@@ -301,12 +309,11 @@ function glossary_print_recent_activity($course, $viewfullnames, $timestart) {
if ($entrycount < GLOSSARY_RECENT_ACTIVITY_LIMIT) {
if ($entry->approved) {
$dimmed = '';
$urlparams = array('g' => $entry->glossaryid, 'mode' => 'entry', 'hook' => $entry->id);
$link = $CFG->wwwroot.'/mod/glossary/view.php?g='.$entry->glossaryid.'&amp;mode=entry&amp;hook='.$entry->id;
} else {
$dimmed = ' dimmed_text';
$urlparams = array('id' => $ids[$entry->glossaryid], 'mode' => 'approval', 'hook' => format_text($entry->concept, true));
$link = $CFG->wwwroot.'/mod/glossary/view.php?id='.$ids[$entry->glossaryid].'&amp;mode=approval&amp;hook='.format_text($entry->concept, true);
}
$link = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php' , $urlparams);
echo '<div class="head'.$dimmed.'">';
echo '<div class="date">'.userdate($entry->timemodified, $strftimerecent).'</div>';
echo '<div class="name">'.fullname($entry, $viewfullnames).'</div>';
+2 -2
View File
@@ -329,12 +329,12 @@
/// Search box
if ($showcommonelements ) {
echo '<form method="post" action="view.php">';
echo '<form method="get" action="view.php">';
echo '<table class="boxaligncenter" width="70%" border="0">';
echo '<tr><td align="center" class="glossarysearchbox">';
echo '<input type="submit" value="'.$strsearch.'" name="searchbutton" /> ';
echo '<input type="submit" value="'.$strsearch.'" /> ';
if ($mode == 'search') {
echo '<input type="text" name="hook" size="20" value="'.s($hook).'" alt="'.$strsearch.'" /> ';
} else {
+3 -3
View File
@@ -1089,13 +1089,13 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
// JCross quiztype
function v6_expand_CluesAcrossLabel() {
$this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-across');
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-across');
}
function v6_expand_CluesDownLabel() {
$this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-down');
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-down');
}
function v6_expand_EnterCaption() {
$this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',enter-caption');
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',enter-caption');
}
function v6_expand_ShowHideClueList() {
$value = $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-clue-list');
+8 -1
View File
@@ -155,7 +155,14 @@ function lesson_user_outline($course, $user, $mod, $lesson) {
} else {
$grade = reset($grades->items[0]->grades);
$return->info = get_string("grade") . ': ' . $grade->str_long_grade;
$return->time = $grade->dategraded;
//datesubmitted == time created. dategraded == time modified or time overridden
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
$result->time = $grade->dategraded;
} else {
$result->time = $grade->datesubmitted;
}
}
return $return;
}
+1 -1
View File
@@ -147,7 +147,7 @@
$feedback = '';
if ($quiz->grade && !is_null($bestgrade)) {
if ($alloptions->scores) {
$grade = "$bestgrade / $quiz->grade";
$grade = round($bestgrade, $quiz->decimalpoints) . ' / ' . $quiz->grade;
}
if ($alloptions->overallfeedback) {
$feedback = quiz_feedback_for_grade($bestgrade, $quiz->id);
+10 -2
View File
@@ -186,7 +186,7 @@ function quiz_get_best_grade($quiz, $userid) {
// Need to detect errors/no result, without catching 0 scores.
if (is_numeric($grade)) {
return round($grade, $quiz->decimalpoints);
return $grade + 0;
} else {
return NULL;
}
@@ -209,7 +209,15 @@ function quiz_user_outline($course, $user, $mod, $quiz) {
$result = new stdClass;
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
//datesubmitted == time created. dategraded == time modified or time overridden
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
$result->time = $grade->dategraded;
} else {
$result->time = $grade->datesubmitted;
}
return $result;
}
+1 -1
View File
@@ -429,7 +429,7 @@ function quiz_save_best_grade($quiz, $userid = null) {
// Calculate the best grade
$bestgrade = quiz_calculate_best_grade($quiz, $attempts);
$bestgrade = quiz_rescale_grade($bestgrade, $quiz);
$bestgrade = quiz_rescale_grade($bestgrade, $quiz, false);
// Save the best grade in the database
if ($grade = get_record('quiz_grades', 'quiz', $quiz->id, 'userid', $userid)) {
+8
View File
@@ -282,6 +282,14 @@ class mod_quiz_mod_form extends moodleform_mod {
$key = 0;
foreach ($this->_feedbacks as $feedback){
$default_values['feedbacktext['.$key.']'] = $feedback->feedbacktext;
if ($default_values['grade'] == 0) {
// When a quiz is un-graded, there can only be one lot of
// feedback. If the quiz previously had a maximum grade and
// several lots of feedback, we must now avoid putting text
// into input boxes that are disabled, but which the
// validation will insist are blank.
break;
}
if ($feedback->mingrade > 0) {
$default_values['feedbackboundaries['.$key.']'] = (100.0 * $feedback->mingrade / $default_values['grade']) . '%';
}
+16 -3
View File
@@ -348,9 +348,22 @@ class quiz_report extends quiz_default_report {
"END) AS gradedattempt, ";
}
$select .= 'qa.uniqueid AS attemptuniqueid, qa.id AS attempt, ' .
'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, ' .
'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration ';
$select .= '
qa.uniqueid AS attemptuniqueid,
qa.id AS attempt,
u.id AS userid,
u.idnumber,
u.firstname,
u.lastname,
u.picture,
u.imagealt,
u.email,
qa.sumgrades,
qa.timefinish,
qa.timestart,
CASE WHEN qa.timefinish = 0 THEN null
WHEN qa.timefinish > qa.timestart THEN qa.timefinish - qa.timestart
ELSE 0 END AS duration ';
// This part is the same for all cases - join users and quiz_attempts tables
$from = 'FROM '.$CFG->prefix.'user u ';
+10
View File
@@ -78,6 +78,16 @@
redirect('view.php?q=' . $quiz->id, $message);
}
}
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
// Check the users have at least one group in common.
$teachersgroups = groups_get_activity_allowed_groups($cm);
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
if (!($teachersgroups && $studentsgroups &&
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
}
}
/// Bits needed to print a good URL for this page.
+10
View File
@@ -80,6 +80,16 @@
if ($attempt->userid != $USER->id) {
error('This is not your attempt!');
}
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
// Check the users have at least one group in common.
$teachersgroups = groups_get_activity_allowed_groups($cm);
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
if (!($teachersgroups && $studentsgroups &&
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
}
}
//add_to_log($course->id, 'quiz', 'review', "review.php?id=$cm->id&amp;attempt=$attempt->id", "$quiz->id", "$cm->id");
+3 -3
View File
@@ -267,11 +267,11 @@
}
// Ouside the if because we may be showing feedback but not grades.
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz);
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
if ($gradecolumn) {
if ($attemptoptions->scores && $attempt->timefinish > 0) {
$formattedgrade = $attemptgrade;
$formattedgrade = round($attemptgrade, $quiz->decimalpoints);
// highlight the highest grade if appropriate
if ($overallstats && $numattempts > 1 && !is_null($mygrade) && $attemptgrade == $mygrade && $quiz->grademethod == QUIZ_GRADEHIGHEST) {
$table->rowclass[$attempt->attempt] = 'bestrow';
@@ -313,7 +313,7 @@
if ($available && $moreattempts) {
$a = new stdClass;
$a->method = quiz_get_grading_option_name($quiz->grademethod);
$a->mygrade = $mygrade;
$a->mygrade = round($mygrade, $quiz->decimalpoints);
$a->quizgrade = $quiz->grade;
$resultinfo .= print_heading(get_string('gradesofar', 'quiz', $a), '', 2, 'main', true);
} else {
+1 -1
View File
@@ -22,7 +22,7 @@ class mod_resource_mod_form extends moodleform_mod {
$mform->setType('type', PARAM_ALPHA);
$mform->setDefault('type', $type);
require($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php');
require_once($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php');
$resclass = 'resource_'.$type;
$this->_resinstance = new $resclass();
+6 -7
View File
@@ -77,7 +77,7 @@
if ($sco = scorm_get_sco($scoid)) {
$userdata->course_id = $sco->identifier;
$userdata->datafromlms = isset($sco->datafromlms)?$sco->datafromlms:'';
$userdata->mastery_score = isset($sco->mastery_score)?$sco->mastery_score:'';
$userdata->mastery_score = isset($sco->mastery_score) && is_numeric($sco->mastery_score)?trim($sco->mastery_score):'';
$userdata->max_time_allowed = isset($sco->max_time_allowed)?$sco->max_time_allowed:'';
$userdata->time_limit_action = isset($sco->time_limit_action)?$sco->time_limit_action:'';
echo "error=0\r\nerror_text=Successful\r\naicc_data=";
@@ -135,7 +135,7 @@
echo "[Core_Vendor]\r\n".$userdata->datafromlms."\r\n";
echo "[Evaluation]\r\nCourse_ID = {".$userdata->course_id."}\r\n";
echo "[Student_Data]\r\n";
echo 'Mastery_Score='.$userdata->mastery_score."\r\n";
echo 'Mastery_Score='.$userdata->mastery_score."\r\n";
echo 'Max_Time_Allowed='.$userdata->max_time_allowed."\r\n";
echo 'Time_Limit_Action='.$userdata->time_limit_action."\r\n";
} else {
@@ -250,7 +250,7 @@
$value .= $datarow."\r\n";
next($datarows);
}
$value = rawurlencode(stripslashes($value));
$value = rawurlencode(stripslashes($value));
$id = scorm_insert_track($USER->id, $scorm->id, $sco->id, $attempt, $element, $value);
}
}
@@ -260,11 +260,10 @@
$id = scorm_insert_track($USER->id, $scorm->id, $sco->id, $attempt, 'cmi.core.lesson_status', 'browsed');
}
if ($mode == 'normal') {
if ($sco = scorm_get_sco($scoid)) {
if (!empty($sco->mastery_score)) {
if (!empty($score)) {
if ($score >= $sco->mastery_score) {
if (isset($sco->mastery_score) && is_numeric($sco->mastery_score)) {
if ($score != '') { // $score is correctly initialized w/ an empty string, see above
if ($score >= trim($sco->mastery_score)) {
$lessonstatus = 'passed';
} else {
$lessonstatus = 'failed';
+4 -2
View File
@@ -10,8 +10,10 @@
$attempt = required_param('attempt', PARAM_INT); // new attempt
//IE 6 Bug workaround
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && ini_get('zlib.output_compression') == 'On') {
ini_set('zlib.output_compression', 'Off');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
@ini_set('zlib.output_compression', 'Off');
@apache_setenv('no-gzip', 1);
header( 'Content-Type: application/javascript' );
}
if (!empty($id)) {
+1 -1
View File
@@ -68,7 +68,7 @@
// Log every datamodel update requested
if (substr($element,0,15) == 'adl.nav.request' || substr($element,0,3) == 'cmi') {
if (debugging('',DEBUG_DEVELOPER)) {
add_to_log($course->id, 'scorm', 'trk: '.trim($scorm->name).' at: '.$attempt, 'view.php?id='.$cm->id, "$element => $value", $cm->id);
add_to_log($course->id, 'scorm', 'trk: scoid/'.$scoid.' at: '.$attempt, 'view.php?id='.$cm->id, "$element => $value", $cm->id);
}
}
}
+10 -2
View File
@@ -225,7 +225,15 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
$grade = reset($grades->items[0]->grades);
$result = new object();
$result->info = get_string('grade') . ': '. $grade->str_long_grade;
$result->time = $grade->dategraded;
//datesubmitted == time created. dategraded == time modified or time overridden
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
$result->time = $grade->dategraded;
} else {
$result->time = $grade->datesubmitted;
}
return $result;
}
return null;
@@ -664,4 +672,4 @@ function scorm_is_moddata_trusted() {
return true;
}
?>
?>
+5
View File
@@ -730,6 +730,11 @@ function scorm_simple_play($scorm,$user, $context) {
$result = false;
if ($scorm->updatefreq == UPDATE_EVERYTIME) {
if (strpos($scorm->version, 'AICC') !== false) {
$scorm->pkgtype = 'AICC';
} else {
$scorm->pkgtype = 'SCORM';
}
scorm_parse($scorm);
}
if (has_capability('mod/scorm:viewreport', $context)) { //if this user can view reports, don't skipview so they can see links to reports.
+3 -2
View File
@@ -16,8 +16,9 @@
$newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt
//IE 6 Bug workaround
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && ini_get('zlib.output_compression') == 'On') {
ini_set('zlib.output_compression', 'Off');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
@ini_set('zlib.output_compression', 'Off');
@apache_setenv('no-gzip', 1);
}
if (!empty($id)) {
+3 -2
View File
@@ -292,6 +292,7 @@ class embedded_cloze_qtype extends default_questiontype {
$feedback = '' ;
$correctanswer = '';
$strfeedbackwrapped = $strfeedback;
$strclosewindow = get_string('close', 'editor');
$testedstate = clone($state);
if ($correctanswers = $QTYPES[$wrapped->qtype]->get_correct_responses($wrapped, $testedstate)) {
if ($options->readonly && $options->correct_responses) {
@@ -357,7 +358,7 @@ class embedded_cloze_qtype extends default_questiontype {
}else {
$strfeedbackwrapped = get_string('feedback', 'quiz');
}
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF');\" ".
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF', CLOSETEXT, '$strclosewindow');\" ".
" onmouseout=\"return nd();\" ";
}
@@ -373,7 +374,7 @@ class embedded_cloze_qtype extends default_questiontype {
if ($feedback !='' && $popup == ''){
$strfeedbackwrapped = get_string('correctanswer', 'qtype_multianswer');
$feedback = s(str_replace(array("\\", "'"), array("\\\\", "\\'"), $feedback));
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF');\" ".
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF', CLOSETEXT, '$strclosewindow');\" ".
" onmouseout=\"return nd();\" ";
}
+1 -1
View File
@@ -373,7 +373,7 @@ class random_qtype extends default_questiontype {
echo 'Could not get qtype while recoding question random-'.$answerregs[1].'<br />';
return($answer_field);
}
$newstate = $state;
$newstate = clone($state);
$newstate->question = $wrapped->new_id;
$newstate->answer = $answerregs[2];
$answer_field = 'random'.$wrapped->new_id.'-';
+102 -49
View File
@@ -495,14 +495,14 @@ function tag_delete($tagids) {
}
$success = true;
foreach( $tagids as $tagid ) {
foreach ($tagids as $tagid) {
if (is_null($tagid)) { // can happen if tag doesn't exists
continue;
}
// only delete the main entry if there were no problems deleting all the
// instances - that (and the fact we won't often delete lots of tags)
// is the reason for not using delete_records_select()
if ( delete_records('tag_instance', 'tagid', $tagid) ) {
if (delete_records('tag_instance', 'tagid', $tagid) && delete_records('tag_correlation', 'tagid', $tagid)) {
$success &= (bool) delete_records('tag', 'id', $tagid);
}
}
@@ -758,59 +758,109 @@ function tag_cleanup() {
* It works as a cache for a potentially heavy load query done at the 'tag_instance' table.
* So, the 'tag_correlation' table stores redundant information derived from the 'tag_instance' table.
*
* @param number $min_correlation cutoff percentage (optional, default is 2)
* @param number $mincorrelation cutoff percentage (optional, default is 2)
*/
function tag_compute_correlations($min_correlation=2) {
function tag_compute_correlations($mincorrelation = 2) {
global $CFG;
if (!$all_tags = get_records_list('tag')) {
return;
}
$mincorrelation = (int)$mincorrelation;
// This mighty one line query fetches a row from the database for every
// individual tag correlation. We then need to process the rows collecting
// the correlations for each tag id.
// The fields used by this query are as follows:
// tagid : This is the tag id, there should be at least $mincorrelation
// rows for each tag id.
// correlation : This is the tag id that correlates to the above tagid field.
// correlationid : This is the id of the row in the tag_correlation table that
// relates to the tagid field and will be NULL if there are no
// existing correlations
$sql = "SELECT pairs.tagid, pairs.correlation, pairs.ocurrences, co.id AS correlationid
FROM (
SELECT ta.tagid, tb.tagid AS correlation, COUNT(*) AS ocurrences
FROM {$CFG->prefix}tag_instance ta
JOIN {$CFG->prefix}tag_instance tb ON (ta.itemtype = tb.itemtype AND ta.itemid = tb.itemid AND ta.tagid <> tb.tagid)
GROUP BY ta.tagid, tb.tagid
HAVING COUNT(*) > $mincorrelation
) pairs
LEFT JOIN {$CFG->prefix}tag_correlation co ON co.tagid = pairs.tagid
ORDER BY pairs.tagid ASC, pairs.ocurrences DESC, pairs.correlation ASC";
$rs = get_recordset_sql($sql);
$tag_correlation_obj = new object();
foreach($all_tags as $tag) {
// Set up an empty tag correlation object
$tagcorrelation = new stdClass;
$tagcorrelation->id = null;
$tagcorrelation->tagid = null;
$tagcorrelation->correlatedtags = array();
// query that counts how many times any tag appears together in items
// with the tag passed as argument ($tag_id)
$query = "SELECT tb.tagid ".
"FROM {$CFG->prefix}tag_instance ta INNER JOIN {$CFG->prefix}tag_instance tb ON ta.itemid = tb.itemid ".
"WHERE ta.tagid = {$tag->id} AND tb.tagid != {$tag->id} ".
"GROUP BY tb.tagid ".
"HAVING COUNT(*) > $min_correlation ".
"ORDER BY COUNT(*) DESC";
// We store each correction id in this array so we can remove any correlations
// that no longer exist.
$correlations = array();
$correlated = array();
// Correlated tags happen when they appear together in more occasions
// than $min_correlation.
if ($tag_correlations = get_records_sql($query)) {
foreach($tag_correlations as $correlation) {
// commented out - now done in query. kept here in case it breaks on some db
// if($correlation->nr >= $min_correlation){
$correlated[] = $correlation->tagid;
// }
// Iterate each row of the result set and build them into tag correlations.
while ($row = rs_fetch_next_record($rs)) {
if ($row->tagid != $tagcorrelation->tagid) {
// The tag id has changed so its now time to process the tag
// correlation information we have.
$tagcorrelationid = tag_process_computed_correlation($tagcorrelation);
if ($tagcorrelationid) {
$correlations[] = $tagcorrelationid;
}
// Now we reset the tag correlation object so we can reuse it and set it
// up for the current record.
$tagcorrelation = new stdClass;
$tagcorrelation->id = $row->correlationid;
$tagcorrelation->tagid = $row->tagid;
$tagcorrelation->correlatedtags = array();
}
if (empty($correlated)) {
continue;
}
$correlated = implode(',', $correlated);
//var_dump($correlated);
//saves correlation info in the caching table
if ($tag_correlation_obj = get_record('tag_correlation', 'tagid', $tag->id, '', '', '', '', 'id')) {
$tag_correlation_obj->correlatedtags = $correlated;
update_record('tag_correlation', $tag_correlation_obj);
} else {
$tag_correlation_obj = new stdClass();
$tag_correlation_obj->tagid = $tag->id;
$tag_correlation_obj->correlatedtags = $correlated;
insert_record('tag_correlation', $tag_correlation_obj);
}
$tagcorrelation->correlatedtags[] = $row->correlation;
}
// Update the current correlation after the last record.
$tagcorrelationid = tag_process_computed_correlation($tagcorrelation);
if ($tagcorrelationid) {
$correlations[] = $tagcorrelationid;
}
// Close the recordset
rs_close($rs);
// Remove any correlations that weren't just identified
if (empty($correlations)) {
//there are no correlations so delete any in the database
delete_records('tag_correlation');
} else {
delete_records_select('tag_correlation', 'id NOT IN ('.join(',', $correlations).')');
}
}
/**
* This function processes a tag correlation and makes changes in the database
* as required.
*
* The tag correlation object needs have both a tagid property and a correlatedtags
* property that is an array.
*
* @param stdClass $tagcorrelation
* @return int The id of the tag correlation that was just processed.
*/
function tag_process_computed_correlation(stdClass $tagcorrelation) {
// You must provide a tagid and correlatedtags must be set and be an array
if (empty($tagcorrelation->tagid) || !isset($tagcorrelation->correlatedtags) || !is_array($tagcorrelation->correlatedtags)) {
return false;
}
// The row tagid doesn't match the current tag id which means we are onto
// the next tag. Before we switch over we need to either insert or update
// the correlation.
$tagcorrelation->correlatedtags = join(',', $tagcorrelation->correlatedtags);
if (!empty($tagcorrelation->id)) {
// The tag correlation already exists so update it
update_record('tag_correlation', $tagcorrelation);
} else {
// This is a new correlation to insert
$tagcorrelation->id = insert_record('tag_correlation', $tagcorrelation, true);
}
return $tagcorrelation->id;
}
/**
@@ -894,9 +944,12 @@ function tag_get_correlated($tag_id, $limitnum=null) {
}
// this is (and has to) return the same fields as the query in tag_get_tags
if ( !$result = get_records_sql("SELECT tg.id, tg.tagtype, tg.name, tg.rawname, tg.flag, ti.ordering ".
"FROM {$CFG->prefix}tag tg INNER JOIN {$CFG->prefix}tag_instance ti ON tg.id = ti.tagid ".
"WHERE tg.id IN ({$tag_correlation->correlatedtags})") ) {
$sql = "SELECT tg.id, tg.tagtype, tg.name, tg.rawname, tg.flag, ti.ordering
FROM {$CFG->prefix}tag tg
INNER JOIN {$CFG->prefix}tag_instance ti ON tg.id = ti.tagid
WHERE tg.id IN ({$tag_correlation->correlatedtags})";
$result = get_records_sql($sql);
if (!$result) {
return array();
}
+1 -1
View File
@@ -308,7 +308,7 @@ form.mform div.textarea textarea {
width:30px
}
#course-view .section .left a {
display:none
/* display:none */
}
#course-view .section .spacer {
height:2em
-1
View File
@@ -27,7 +27,6 @@ class user_edit_form extends moodleform {
useredit_shared_definition($mform);
/// extra settigs
$mform->addRule('description', $strrequired, 'required', null, 'client');
if (!empty($CFG->gdversion) and !empty($CFG->disableuserimages)) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
+2 -2
View File
@@ -6,10 +6,10 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2007101591.02; // YYYYMMDD = date of the 1.9 branch (don't change)
$version = 2007101591.04; // YYYYMMDD = date of the 1.9 branch (don't change)
// X = release number 1.9.[0,1,2,3,4,5...]
// Y.YY = micro-increments between releases
$release = '1.9.11 (Build: 20110221)'; // Human-friendly version name
$release = '1.9.13 (Build: 20110801)'; // Human-friendly version name
?>