Skip to content

Commit

Permalink
Merge branch 'MDL-30435' of git://github.com/kiklop74/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Nov 29, 2011
2 parents cc6a4b0 + adf8f7a commit 8192d3c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
19 changes: 16 additions & 3 deletions backup/cc/entity.resource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function generate_node () {
}

private function create_node_course_modules_mod_resource ($sheet_mod_resource, $instance) {
global $CFG;

require_once($CFG->libdir.'/validateurlsyntax.php');

$link = '';
$mod_alltext = '';
Expand Down Expand Up @@ -77,9 +80,19 @@ private function create_node_course_modules_mod_resource ($sheet_mod_resource, $

if (!empty($resource)) {
$xpath = cc2moodle::newx_path($resource, cc2moodle::getresourcens());
$resource = $xpath->query('/wl:webLink/wl:url/@href');
$resource = $xpath->query('//url/@href');
if ($resource->length > 0) {
$link = $resource->item(0)->nodeValue;
$rawlink = $resource->item(0)->nodeValue;
if (!validateUrlSyntax($rawlink, 's+')) {
$changed = rawurldecode($rawlink);
if (validateUrlSyntax($changed, 's+')) {
$link = $changed;
} else {
$link = 'http://invalidurldetected/';
}
} else {
$link = $rawlink;
}
}
}
}
Expand All @@ -98,7 +111,7 @@ private function create_node_course_modules_mod_resource ($sheet_mod_resource, $
$mod_options = 'objectframe';
$mod_reference = $link;
//detected if we are dealing with html file
if (!empty($link) && ($instance['common_cartriedge_type'] == cc112moodle::CC_TYPE_WEBCONTENT)) {
if (!empty($link) && ($instance['common_cartriedge_type'] == cc2moodle::CC_TYPE_WEBCONTENT)) {
$ext = strtolower(pathinfo($link, PATHINFO_EXTENSION));
if (in_array($ext, array('html', 'htm', 'xhtml'))) {
$mod_type = 'html';
Expand Down
15 changes: 14 additions & 1 deletion backup/cc/entity11.resource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function generate_node () {
}

private function create_node_course_modules_mod_resource ($sheet_mod_resource, $instance) {
global $CFG;

require_once($CFG->libdir.'/validateurlsyntax.php');

$link = '';
$mod_alltext = '';
Expand Down Expand Up @@ -87,7 +90,17 @@ private function create_node_course_modules_mod_resource ($sheet_mod_resource, $
$xpath = cc112moodle::newx_path($resource, cc112moodle::$resourcens);
$resource = $xpath->query('/wl:webLink/wl:url/@href');
if ($resource->length > 0) {
$link = $resource->item(0)->nodeValue;
$rawlink = $resource->item(0)->nodeValue;
if (!validateUrlSyntax($rawlink, 's+')) {
$changed = rawurldecode($rawlink);
if (validateUrlSyntax($changed, 's+')) {
$link = $changed;
} else {
$link = 'http://invalidurldetected/';
}
} else {
$link = $rawlink;
}
}
}
}
Expand Down

0 comments on commit 8192d3c

Please sign in to comment.