Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-38040 Clean core from CRLFs

  • Loading branch information...
commit 03fd922158fdf04dc890af51c5393707523fa6ba 1 parent 09de5eb
@stronk7 stronk7 authored
View
92 blocks/html/backup/moodle1/lib.php
@@ -1,46 +1,46 @@
-<?php
-
-/**
- * Provides support for the conversion of moodle1 backup to the moodle2 format
- *
- * @package block_html
- * @copyright 2012 Paul Nicholls
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Block conversion handler for html
- */
-class moodle1_block_html_handler extends moodle1_block_handler {
- private $fileman = null;
- protected function convert_configdata(array $olddata) {
- $instanceid = $olddata['id'];
- $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
- $configdata = unserialize(base64_decode($olddata['configdata']));
-
- // get a fresh new file manager for this instance
- $this->fileman = $this->converter->get_file_manager($contextid, 'block_html');
-
- // convert course files embedded in the block content
- $this->fileman->filearea = 'content';
- $this->fileman->itemid = 0;
- $configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
- $configdata->format = FORMAT_HTML;
-
- return base64_encode(serialize($configdata));
- }
-
- protected function write_inforef_xml($newdata, $data) {
- $this->open_xml_writer("course/blocks/{$data['name']}_{$data['id']}/inforef.xml");
- $this->xmlwriter->begin_tag('inforef');
- $this->xmlwriter->begin_tag('fileref');
- foreach ($this->fileman->get_fileids() as $fileid) {
- $this->write_xml('file', array('id' => $fileid));
- }
- $this->xmlwriter->end_tag('fileref');
- $this->xmlwriter->end_tag('inforef');
- $this->close_xml_writer();
- }
-}
+<?php
+
+/**
+ * Provides support for the conversion of moodle1 backup to the moodle2 format
+ *
+ * @package block_html
+ * @copyright 2012 Paul Nicholls
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Block conversion handler for html
+ */
+class moodle1_block_html_handler extends moodle1_block_handler {
+ private $fileman = null;
+ protected function convert_configdata(array $olddata) {
+ $instanceid = $olddata['id'];
+ $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
+ $configdata = unserialize(base64_decode($olddata['configdata']));
+
+ // get a fresh new file manager for this instance
+ $this->fileman = $this->converter->get_file_manager($contextid, 'block_html');
+
+ // convert course files embedded in the block content
+ $this->fileman->filearea = 'content';
+ $this->fileman->itemid = 0;
+ $configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
+ $configdata->format = FORMAT_HTML;
+
+ return base64_encode(serialize($configdata));
+ }
+
+ protected function write_inforef_xml($newdata, $data) {
+ $this->open_xml_writer("course/blocks/{$data['name']}_{$data['id']}/inforef.xml");
+ $this->xmlwriter->begin_tag('inforef');
+ $this->xmlwriter->begin_tag('fileref');
+ foreach ($this->fileman->get_fileids() as $fileid) {
+ $this->write_xml('file', array('id' => $fileid));
+ }
+ $this->xmlwriter->end_tag('fileref');
+ $this->xmlwriter->end_tag('inforef');
+ $this->close_xml_writer();
+ }
+}
View
68 blocks/rss_client/backup/moodle1/lib.php
@@ -1,34 +1,34 @@
-<?php
-
-/**
- * Provides support for the conversion of moodle1 backup to the moodle2 format
- *
- * @package block_rss_client
- * @copyright 2012 Paul Nicholls
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Block conversion handler for rss_client
- */
-class moodle1_block_rss_client_handler extends moodle1_block_handler {
- public function process_block(array $data) {
- parent::process_block($data);
- $instanceid = $data['id'];
- $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $data['id']);
-
- // Moodle 1.9 backups do not include sufficient data to restore feeds, so we need an empty shell rss_client.xml
- // for the restore process to find
- $this->open_xml_writer("course/blocks/{$data['name']}_{$instanceid}/rss_client.xml");
- $this->xmlwriter->begin_tag('block', array('id' => $instanceid, 'contextid' => $contextid, 'blockname' => 'rss_client'));
- $this->xmlwriter->begin_tag('rss_client', array('id' => $instanceid));
- $this->xmlwriter->full_tag('feeds', '');
- $this->xmlwriter->end_tag('rss_client');
- $this->xmlwriter->end_tag('block');
- $this->close_xml_writer();
-
- return $data;
- }
-}
+<?php
+
+/**
+ * Provides support for the conversion of moodle1 backup to the moodle2 format
+ *
+ * @package block_rss_client
+ * @copyright 2012 Paul Nicholls
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Block conversion handler for rss_client
+ */
+class moodle1_block_rss_client_handler extends moodle1_block_handler {
+ public function process_block(array $data) {
+ parent::process_block($data);
+ $instanceid = $data['id'];
+ $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $data['id']);
+
+ // Moodle 1.9 backups do not include sufficient data to restore feeds, so we need an empty shell rss_client.xml
+ // for the restore process to find
+ $this->open_xml_writer("course/blocks/{$data['name']}_{$instanceid}/rss_client.xml");
+ $this->xmlwriter->begin_tag('block', array('id' => $instanceid, 'contextid' => $contextid, 'blockname' => 'rss_client'));
+ $this->xmlwriter->begin_tag('rss_client', array('id' => $instanceid));
+ $this->xmlwriter->full_tag('feeds', '');
+ $this->xmlwriter->end_tag('rss_client');
+ $this->xmlwriter->end_tag('block');
+ $this->close_xml_writer();
+
+ return $data;
+ }
+}
View
4 blog/edit_form.php
@@ -87,8 +87,8 @@ function definition() {
}
if (has_capability('moodle/blog:associatecourse', $context)) {
- $mform->addElement('header', 'assochdr', get_string('associations', 'blog'));
- $mform->addElement('advcheckbox', 'courseassoc', get_string('associatewithcourse', 'blog', $a), null, null, array(0, $contextid));
+ $mform->addElement('header', 'assochdr', get_string('associations', 'blog'));
+ $mform->addElement('advcheckbox', 'courseassoc', get_string('associatewithcourse', 'blog', $a), null, null, array(0, $contextid));
$mform->setDefault('courseassoc', $contextid);
}
View
94 blog/locallib.php
@@ -104,44 +104,44 @@ public function prepare_render() {
$this->renderable->user = $DB->get_record('user', array('id'=>$this->userid));
- // Entry comments.
- if (!empty($CFG->usecomments) and $CFG->blogusecomments) {
+ // Entry comments.
+ if (!empty($CFG->usecomments) and $CFG->blogusecomments) {
require_once($CFG->dirroot . '/comment/lib.php');
-
- $cmt = new stdClass();
- $cmt->context = context_user::instance($this->userid);
- $cmt->courseid = $PAGE->course->id;
- $cmt->area = 'format_blog';
- $cmt->itemid = $this->id;
- $cmt->showcount = $CFG->blogshowcommentscount;
- $cmt->component = 'blog';
- $this->renderable->comment = new comment($cmt);
+
+ $cmt = new stdClass();
+ $cmt->context = context_user::instance($this->userid);
+ $cmt->courseid = $PAGE->course->id;
+ $cmt->area = 'format_blog';
+ $cmt->itemid = $this->id;
+ $cmt->showcount = $CFG->blogshowcommentscount;
+ $cmt->component = 'blog';
+ $this->renderable->comment = new comment($cmt);
}
-
- $this->summary = file_rewrite_pluginfile_urls($this->summary, 'pluginfile.php', SYSCONTEXTID, 'blog', 'post', $this->id);
- // External blog link.
- if ($this->uniquehash && $this->content) {
- if ($externalblog = $DB->get_record('blog_external', array('id' => $this->content))) {
- $urlparts = parse_url($externalblog->url);
+ $this->summary = file_rewrite_pluginfile_urls($this->summary, 'pluginfile.php', SYSCONTEXTID, 'blog', 'post', $this->id);
+
+ // External blog link.
+ if ($this->uniquehash && $this->content) {
+ if ($externalblog = $DB->get_record('blog_external', array('id' => $this->content))) {
+ $urlparts = parse_url($externalblog->url);
$this->renderable->externalblogtext = get_string('retrievedfrom', 'blog') . get_string('labelsep', 'langconfig');
- $this->renderable->externalblogtext .= html_writer::link($urlparts['scheme'] . '://'.$urlparts['host'], $externalblog->name);
- }
+ $this->renderable->externalblogtext .= html_writer::link($urlparts['scheme'] . '://'.$urlparts['host'], $externalblog->name);
+ }
}
// Retrieve associations
$this->renderable->unassociatedentry = false;
if (!empty($CFG->useblogassociations)) {
-
+
// Adding the entry associations data.
if ($associations = $associations = $DB->get_records('blog_association', array('blogid' => $this->id))) {
-
- // Check to see if the entry is unassociated with group/course level access.
- if ($this->publishstate == 'group' || $this->publishstate == 'course') {
- $this->renderable->unassociatedentry = true;
+
+ // Check to see if the entry is unassociated with group/course level access.
+ if ($this->publishstate == 'group' || $this->publishstate == 'course') {
+ $this->renderable->unassociatedentry = true;
}
-
- foreach ($associations as $key => $assocrec) {
+
+ foreach ($associations as $key => $assocrec) {
if (!$context = context::instance_by_id($assocrec->contextid, IGNORE_MISSING)) {
unset($associations[$key]);
@@ -150,14 +150,14 @@ public function prepare_render() {
// The renderer will need the contextlevel of the association.
$associations[$key]->contextlevel = $context->contextlevel;
-
- // Course associations.
+
+ // Course associations.
if ($context->contextlevel == CONTEXT_COURSE) {
$instancename = $DB->get_field('course', 'shortname', array('id' => $context->instanceid)); //TODO: performance!!!!
$associations[$key]->url = $assocurl = new moodle_url('/course/view.php', array('id' => $context->instanceid));
$associations[$key]->text = $instancename;
- $associations[$key]->icon = new pix_icon('i/course', $associations[$key]->text);
+ $associations[$key]->icon = new pix_icon('i/course', $associations[$key]->text);
}
// Mod associations.
@@ -174,11 +174,11 @@ public function prepare_render() {
$associations[$key]->url = new moodle_url('/mod/' . $modinfo->name . '/view.php', array('id' => $context->instanceid));
$associations[$key]->text = $instancename;
$associations[$key]->icon = new pix_icon('icon', $associations[$key]->text, $modinfo->name);
- }
+ }
}
}
- $this->renderable->blogassociations = $associations;
- }
+ $this->renderable->blogassociations = $associations;
+ }
// Entry attachments.
$this->renderable->attachments = $this->get_attachments();
@@ -193,23 +193,23 @@ public function prepare_render() {
*/
function get_attachments() {
- global $CFG;
-
- require_once($CFG->libdir.'/filelib.php');
-
+ global $CFG;
+
+ require_once($CFG->libdir.'/filelib.php');
+
$syscontext = context_system::instance();
-
+
$fs = get_file_storage();
- $files = $fs->get_area_files($syscontext->id, 'blog', 'attachment', $this->id);
+ $files = $fs->get_area_files($syscontext->id, 'blog', 'attachment', $this->id);
// Adding a blog_entry_attachment for each non-directory file.
- $attachments = array();
- foreach ($files as $file) {
- if ($file->is_directory()) {
- continue;
+ $attachments = array();
+ foreach ($files as $file) {
+ if ($file->is_directory()) {
+ continue;
}
- $attachments[] = new blog_entry_attachment($file, $this->id);
- }
+ $attachments[] = new blog_entry_attachment($file, $this->id);
+ }
return $attachments;
}
@@ -636,7 +636,7 @@ public function print_entries() {
global $CFG, $USER, $DB, $OUTPUT, $PAGE;
$sitecontext = context_system::instance();
- // Blog renderer
+ // Blog renderer
$output = $PAGE->get_renderer('blog');
$page = optional_param('blogpage', 0, PARAM_INT);
@@ -1030,8 +1030,8 @@ public function __construct($file, $entryid) {
global $CFG;
$this->file = $file;
- $this->filename = $file->get_filename();
- $this->url = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.SYSCONTEXTID.'/blog/attachment/'.$entryid.'/'.$this->filename);
+ $this->filename = $file->get_filename();
+ $this->url = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.SYSCONTEXTID.'/blog/attachment/'.$entryid.'/'.$this->filename);
}
}
View
10 mod/data/renderer.php
@@ -3,7 +3,7 @@
defined('MOODLE_INTERNAL') || die();
class mod_data_renderer extends plugin_renderer_base {
-
+
public function import_setting_mappings($datamodule, data_preset_importer $importer) {
$strblank = get_string('blank', 'data');
@@ -24,7 +24,7 @@ public function import_setting_mappings($datamodule, data_preset_importer $impor
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'action', 'value'=>'finishimport'));
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'d', 'value'=>$datamodule->id));
-
+
if ($importer instanceof data_preset_existing_importer) {
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'fullname', 'value'=>$importer->get_userid().'/'.$importer->get_directory()));
} else {
@@ -60,7 +60,7 @@ public function import_setting_mappings($datamodule, data_preset_importer $impor
} else {
$row[1] .= html_writer::tag('option', get_string('mapnewfield', 'data'), array('value'=>'-1', 'selected'=>'selected'));
}
-
+
$row[1] .= html_writer::end_tag('select');
$table->data[] = $row;
}
@@ -82,5 +82,5 @@ public function import_setting_mappings($datamodule, data_preset_importer $impor
return $html;
}
-
-}
+
+}
View
10 mod/scorm/report/graphs/graph.php
@@ -79,11 +79,11 @@
// Do this only if we have students to report
if(!$nostudents) {
- // Construct the SQL
- $select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
- $select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid ';
- $from = 'FROM {scorm_scoes_track} st ';
- $where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?';
+ // Construct the SQL
+ $select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
+ $select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid ';
+ $from = 'FROM {scorm_scoes_track} st ';
+ $where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?';
$attempts = $DB->get_records_sql($select.$from.$where, $params);
foreach ($attempts as $attempt) {
View
2  tag/coursetagslib.php
@@ -24,7 +24,7 @@
*/
require_once $CFG->dirroot.'/tag/lib.php';
-require_once $CFG->dirroot.'/tag/locallib.php';
+require_once $CFG->dirroot.'/tag/locallib.php';
/**
* Returns an ordered array of tags associated with visible courses
Please sign in to comment.
Something went wrong with that request. Please try again.