global $addslashes, $db;
$content_id = intval($content_id);
- $file_name = $addslashes($file_name);
+ $file_name = $addslashes(htmlentities_utf8($file_name));
$lang = $addslashes($lang);
$sql = "INSERT INTO ".TABLE_PREFIX."primary_resources SET content_id=$content_id, resource='$file_name', language_code='$lang'";
$import_files = get_import_files($content['text']);
if (count($import_files) > 0) $my_files = array_merge($my_files, $import_files);
-
foreach ($my_files as $file) {
/* filter out full urls */
$url_parts = @parse_url($file);
}
}
+ /**
+ * A hack to fix youtube links. one uses youtube.com?watch=xxx, the other uses youtube.com/v/xxx,
+ * in which both points to the same file, but needed different links to play.
+ * in A4a, these youtube links are always stored as "?watch=xxx", however, output.inc.php converted
+ * these to /v/xxx for rendering purposes. Convert it back if youtube exists in url.
+ * http://atutor.ca/atutor/mantis/view.php?id=4548
+ * @harris 9/30/2010
+ */
+ if (strpos($file, 'youtube.com')!==false){
+ //apply the conversion before linking the alternatives. Otherwise it will not be added.
+ $file = convert_youtube_playURL_to_watchURL($file);
+ }
// If this file has a4a alternatives, link it.
if (isset($a4a_xml_array[$file]) || isset($a4a_secondary_files[$file])){
//if this is an array, meaning that it has more than 1 alternatives, print all
$test_zipped_files[] = $file;
}
}
-
/******************************
* http://www.atutor.ca/atutor/mantis/view.php?id=4383
*/