diff --git a/admin/renderer.php b/admin/renderer.php index 8d496364d35..802cab3f251 100644 --- a/admin/renderer.php +++ b/admin/renderer.php @@ -918,9 +918,11 @@ class core_admin_renderer extends plugin_renderer_base { } else { $str = 'otherplugin'; } + $componenturl = new moodle_url('https://moodle.org/plugins/view.php?plugin='.$component); + $componenturl = html_writer::tag('a', $component, array('href' => $componenturl->out())); $requires[] = html_writer::tag('li', get_string($str, 'core_plugin', - array('component' => $component, 'version' => $requiredversion)), + array('component' => $componenturl, 'version' => $requiredversion)), array('class' => $class)); } diff --git a/admin/repository.php b/admin/repository.php index 3eb48b0da4d..f2aa3934e91 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -140,8 +140,10 @@ if (($action == 'edit') || ($action == 'new')) { $success = $repositorytype->update_options($settings); } else { $type = new repository_type($plugin, (array)$fromform, $visible); - $type->create(); $success = true; + if (!$repoid = $type->create()) { + $success = false; + } $data = data_submitted(); } if ($success) { diff --git a/admin/tool/langimport/lang/en/tool_langimport.php b/admin/tool/langimport/lang/en/tool_langimport.php index e194219e0dd..87dee884b1d 100644 --- a/admin/tool/langimport/lang/en/tool_langimport.php +++ b/admin/tool/langimport/lang/en/tool_langimport.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['install'] = 'Install selected language pack'; +$string['install'] = 'Install selected language pack(s)'; $string['installedlangs'] = 'Installed language packs'; $string['langimport'] = 'Language import utility'; $string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level. Do not forget to purge string caches after you do so.'; @@ -38,7 +38,7 @@ $string['nolangupdateneeded'] = 'All your language packs are up to date, no upda $string['pluginname'] = 'Language packs'; $string['purgestringcaches'] = 'Purge string caches'; $string['remotelangnotavailable'] = 'Because Moodle cannot connect to download.moodle.org, it is not possible for language packs to be installed automatically. Please download the appropriate ZIP file(s) from download.moodle.org/langpack, copy them to your {$a} directory and unzip them manually.'; -$string['uninstall'] = 'Uninstall selected language pack'; +$string['uninstall'] = 'Uninstall selected language pack(s)'; $string['uninstallconfirm'] = 'You are about to completely uninstall language pack {$a}, are you sure?'; $string['updatelangs'] = 'Update all installed language packs'; diff --git a/admin/tool/xmldb/lang/en/tool_xmldb.php b/admin/tool/xmldb/lang/en/tool_xmldb.php index 4dfc221820a..040cf3acb54 100644 --- a/admin/tool/xmldb/lang/en/tool_xmldb.php +++ b/admin/tool/xmldb/lang/en/tool_xmldb.php @@ -33,24 +33,38 @@ $string['confirmdeleteindex'] = 'Are you absolutely sure that you want to delete $string['confirmdeletekey'] = 'Are you absolutely sure that you want to delete the key:'; $string['confirmdeletetable'] = 'Are you absolutely sure that you want to delete the table:'; $string['confirmdeletexmlfile'] = 'Are you absolutely sure that you want to delete the file:'; -$string['confirmcheckbigints'] = 'This functionality will search for potential wrong integer fields in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined.

-Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).

-It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of wrong integers.

+$string['confirmcheckbigints'] = 'This functionality will search for potential wrong integer fields in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined. + +Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that). + +It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of wrong integers. + This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; -$string['confirmcheckdefaults'] = 'This functionality will search for inconsistent default values in your Moodle server, generating (but not executing!) the needed SQL statements to have all the default values properly defined.

-Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).

-It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of inconsistent default values.

+$string['confirmcheckdefaults'] = 'This functionality will search for inconsistent default values in your Moodle server, generating (but not executing!) the needed SQL statements to have all the default values properly defined. + +Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that). + +It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of inconsistent default values. + This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; -$string['confirmcheckforeignkeys'] = 'This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.)

-It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of missing indexes.

+$string['confirmcheckforeignkeys'] = 'This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.) + +It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes. + This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; -$string['confirmcheckindexes'] = 'This functionality will search for potential missing indexes in your Moodle server, generating (but not executing!) automatically the needed SQL statements to keep everything updated.

-Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).

-It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of missing indexes.

+$string['confirmcheckindexes'] = 'This functionality will search for potential missing indexes in your Moodle server, generating (but not executing!) automatically the needed SQL statements to keep everything updated. + +Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that). + +It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes. + This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; -$string['confirmcheckoraclesemantics'] = 'This functionality will search for Oracle varchar2 columns using BYTE semantics in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the columns converted to use CHAR semantics instead (better for cross-db compatibility and increased contents max. length).

-Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).

-It\'s highly recommended to be running the latest (+ version) available of your Moodle release (2.2, 2.3, 2.x ...) before executing the search of BYTE semantics.

+$string['confirmcheckoraclesemantics'] = 'This functionality will search for Oracle varchar2 columns using BYTE semantics in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the columns converted to use CHAR semantics instead (better for cross-db compatibility and increased contents max. length). + +Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that). + +It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of BYTE semantics. + This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; $string['confirmrevertchanges'] = 'Are you absolutely sure that you want to revert changes performed over:'; $string['create'] = 'Create'; diff --git a/blocks/course_list/lang/en/block_course_list.php b/blocks/course_list/lang/en/block_course_list.php index a9e8dc99239..6d8589a0f6f 100644 --- a/blocks/course_list/lang/en/block_course_list.php +++ b/blocks/course_list/lang/en/block_course_list.php @@ -26,9 +26,9 @@ $string['adminview'] = 'Admin view'; $string['allcourses'] = 'Admin user sees all courses'; $string['configadminview'] = 'What should the admin see in the course list block?'; -$string['confighideallcourseslink'] = 'Hide "All courses" link at the bottom of the block. Link hiding does not affects Admin\'s view'; +$string['confighideallcourseslink'] = 'Remove the \'All courses\' link under the list of courses. (This setting does not affect the admin view.)'; $string['course_list:addinstance'] = 'Add a new courses block'; $string['course_list:myaddinstance'] = 'Add a new courses block to My home'; -$string['hideallcourseslink'] = 'Hide All courses link'; +$string['hideallcourseslink'] = 'Hide \'All courses\' link'; $string['owncourses'] = 'Admin user sees own courses'; $string['pluginname'] = 'Courses'; diff --git a/calendar/lib.php b/calendar/lib.php index 193b3bea3f8..7da4e0ee0ee 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -110,6 +110,16 @@ define('CALENDAR_IMPORT_EVENT_UPDATED', 1); */ define('CALENDAR_IMPORT_EVENT_INSERTED', 2); +/** + * CALENDAR_SUBSCRIPTION_UPDATE - Used to represent update action for subscriptions in various forms. + */ +define('CALENDAR_SUBSCRIPTION_UPDATE', 1); + +/** + * CALENDAR_SUBSCRIPTION_REMOVE - Used to represent remove action for subscriptions in various forms. + */ +define('CALENDAR_SUBSCRIPTION_REMOVE', 2); + /** * Return the days of the week * @@ -2851,11 +2861,9 @@ function calendar_process_subscription_row($subscriptionid, $pollinterval, $acti // Fetch the subscription from the database making sure it exists. $sub = $DB->get_record('event_subscriptions', array('id' => $subscriptionid), '*', MUST_EXIST); - $strupdate = get_string('update'); - $strremove = get_string('remove'); // Update or remove the subscription, based on action. switch ($action) { - case $strupdate: + case CALENDAR_SUBSCRIPTION_UPDATE: // Skip updating file subscriptions. if (empty($sub->url)) { break; @@ -2866,7 +2874,7 @@ function calendar_process_subscription_row($subscriptionid, $pollinterval, $acti // Update the events. return "

".get_string('subscriptionupdated', 'calendar', $sub->name)."

" . calendar_update_subscription_events($subscriptionid); - case $strremove: + case CALENDAR_SUBSCRIPTION_REMOVE: calendar_delete_subscription($subscriptionid); return get_string('subscriptionremoved', 'calendar', $sub->name); break; diff --git a/calendar/managesubscriptions.php b/calendar/managesubscriptions.php index 21782aaa4d6..06d60b49342 100644 --- a/calendar/managesubscriptions.php +++ b/calendar/managesubscriptions.php @@ -33,7 +33,7 @@ $courseid = optional_param('course', SITEID, PARAM_INT); // Used for processing subscription actions. $subscriptionid = optional_param('id', 0, PARAM_INT); $pollinterval = optional_param('pollinterval', 0, PARAM_INT); -$action = optional_param('action', '', PARAM_ALPHA); +$action = optional_param('action', '', PARAM_INT); $url = new moodle_url('/calendar/managesubscriptions.php'); if ($courseid != SITEID) { diff --git a/calendar/renderer.php b/calendar/renderer.php index b7cbd7978c8..85a2485907d 100644 --- a/calendar/renderer.php +++ b/calendar/renderer.php @@ -814,9 +814,11 @@ class core_calendar_renderer extends plugin_renderer_base { $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'course', 'value' => $courseid)); $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $subscription->id)); if (!empty($subscription->url)) { - $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'action', 'value' => get_string('update'))); + $html .= html_writer::tag('button', get_string('update'), array('type' => 'submit', 'name' => 'action', + 'value' => CALENDAR_SUBSCRIPTION_UPDATE)); } - $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'action', 'value' => get_string('remove'))); + $html .= html_writer::tag('button', get_string('remove'), array('type' => 'submit', 'name' => 'action', + 'value' => CALENDAR_SUBSCRIPTION_REMOVE)); $html .= html_writer::end_tag('div'); $html .= html_writer::end_tag('form'); return $html; diff --git a/enrol/ldap/lang/en/enrol_ldap.php b/enrol/ldap/lang/en/enrol_ldap.php index a54e35e71c9..d9be622e1bc 100644 --- a/enrol/ldap/lang/en/enrol_ldap.php +++ b/enrol/ldap/lang/en/enrol_ldap.php @@ -55,6 +55,7 @@ $string['course_summary_key'] = 'Summary'; $string['createcourseextid'] = 'CREATE User enrolled to a nonexistant course \'{$a->courseextid}\''; $string['createnotcourseextid'] = 'User enrolled to a nonexistant course \'{$a->courseextid}\''; $string['creatingcourse'] = 'Creating course \'{$a}\'...'; +$string['duplicateshortname'] = "Course creation failed. Duplicate short name. Skipping course with idnumber '{\$a->idnumber}'..."; $string['editlock'] = 'Lock value'; $string['emptyenrolment'] = "Empty enrolment for role '{\$a->role_shortname}' in course '{\$a->course_shortname}'\n"; $string['enrolname'] = 'LDAP'; diff --git a/enrol/ldap/lib.php b/enrol/ldap/lib.php index f602ffbd1f2..439e54690d6 100644 --- a/enrol/ldap/lib.php +++ b/enrol/ldap/lib.php @@ -184,9 +184,10 @@ class enrol_ldap_plugin extends enrol_plugin { if ($this->get_config('autocreate')) { // Autocreate error_log($this->errorlogtag.get_string('createcourseextid', 'enrol_ldap', array('courseextid'=>$course_ext_id))); - if ($newcourseid = $this->create_course($enrol)) { - $course = $DB->get_record('course', array('id'=>$newcourseid)); + if (!$newcourseid = $this->create_course($enrol)) { + continue; } + $course = $DB->get_record('course', array('id'=>$newcourseid)); } else { error_log($this->errorlogtag.get_string('createnotcourseextid', 'enrol_ldap', array('courseextid'=>$course_ext_id))); @@ -400,9 +401,10 @@ class enrol_ldap_plugin extends enrol_plugin { if ($this->get_config('autocreate')) { // Autocreate error_log($this->errorlogtag.get_string('createcourseextid', 'enrol_ldap', array('courseextid'=>$idnumber))); - if ($newcourseid = $this->create_course($course)) { - $course_obj = $DB->get_record('course', array('id'=>$newcourseid)); + if (!$newcourseid = $this->create_course($course)) { + continue; } + $course_obj = $DB->get_record('course', array('id'=>$newcourseid)); } else { error_log($this->errorlogtag.get_string('createnotcourseextid', 'enrol_ldap', array('courseextid'=>$idnumber))); @@ -977,6 +979,12 @@ class enrol_ldap_plugin extends enrol_plugin { $course->summary = $course_ext[$this->get_config('course_summary')][0]; } + // Check if the shortname already exists if it does - skip course creation. + if ($DB->record_exists('course', array('shortname' => $course->shortname))) { + error_log($this->errorlogtag . get_string('duplicateshortname', 'enrol_ldap', $course)); + return false; + } + $newcourse = create_course($course); return $newcourse->id; } diff --git a/error/index.php b/error/index.php index 0e57570747d..35de451a486 100644 --- a/error/index.php +++ b/error/index.php @@ -49,9 +49,9 @@ header("Status: 404 Not Found"); $PAGE->set_url('/error/'); + $PAGE->set_context(get_system_context()); $PAGE->set_title($site->fullname .':Error'); $PAGE->set_heading($site->fullname .': Error 404'); - $PAGE->set_context(get_system_context()); $PAGE->navbar->add('Error 404 - File not Found'); echo $OUTPUT->header(); echo $OUTPUT->box(get_string('pagenotexist', 'error'). '
'.s($requesturi), 'generalbox boxaligncenter'); diff --git a/files/renderer.php b/files/renderer.php index 2e3aca0c07e..c4a321686cb 100644 --- a/files/renderer.php +++ b/files/renderer.php @@ -201,9 +201,9 @@ class core_files_renderer extends plugin_renderer_base {
@@ -520,10 +520,10 @@ class core_files_renderer extends plugin_renderer_base { */ private function fp_js_template_generallayout() { $rv = ' -
+