header('Location: '.$_base_path.'tools/tile/index.php');
}
else if ($oauth_import) {
- echo "error=".urlencode('Empty OAuth token');
+ echo "error=".urlencode('No space for the content.');
}
else {
header('Location: '.$_SERVER['HTTP_REFERER']);
//other arrays.
//Using sizeof make sure it's not a subset of array2.
//-1 on data because it always contain the imsmanifest.xml file
- if (!empty($result) || sizeof($data)-1>sizeof($filearray)){
- $msg->addError(array('IMPORT_CARTRIDGE_FAILED', _AT('ims_missing_references')));
+ if (!$skip_ims_validation){
+ if (!empty($result) || sizeof($data)-1>sizeof($filearray)){
+ $msg->addError(array('IMPORT_CARTRIDGE_FAILED', _AT('ims_missing_references')));
+ }
}
return true;
}
/* builds the $path array which is the path from the root to the current element */
function startElement($parser, $name, $attrs) {
global $items, $path, $package_base_path, $all_package_base_path, $package_real_base_path;
- global $element_path, $import_path;
+ global $element_path, $import_path, $skip_ims_validation;
global $xml_base_path, $test_message, $content_type;
global $current_identifier, $msg, $ns, $ns_cp;
global $course_primary_lang;
}
//validate namespaces
- if(isset($attrs['xsi:schemaLocation']) && $name=='manifest'){
+ if(!$skip_ims_validation && isset($attrs['xsi:schemaLocation']) && $name=='manifest'){
$schema_location = array();
$split_location = preg_split('/[\r\n\s]+/', trim($attrs['xsi:schemaLocation']));
$xml_base_path = $attrs['xml:base'];
} else if ($name == 'file') {
// check if it misses file references
- if(!isset($attrs['href']) || $attrs['href']==''){
+ if(!$skip_ims_validation && (!isset($attrs['href']) || $attrs['href']=='')){
//$msg->addError('MANIFEST_NOT_WELLFORM');
$msg->addError(array('IMPORT_CARTRIDGE_FAILED', _AT('ims_missing_references')));
}
if(!isset($items[$current_identifier]) && $attrs['href']!=''){
$items[$current_identifier]['href'] = $attrs['href'];
}
- if (substr($attrs['href'], 0, 7) == 'http://' || substr($attrs['href'], 0, 8) == 'https://' || file_exists($import_path.$attrs['href'])){
+ if (substr($attrs['href'], 0, 7) == 'http://' || substr($attrs['href'], 0, 8) == 'https://' || file_exists($import_path.$attrs['href']) || $skip_ims_validation){
$items[$current_identifier]['file'][] = $attrs['href'];
} else {
//$msg->addError('');
$cid = intval($_POST['cid']);
+//If user chooses to ignore validation.
+if(isset($_POST['ignore_validation']) && $_POST['ignore_validation']==1) {
+ $skip_ims_validation = true;
+}
+
if (isset($_REQUEST['url']) && ($_REQUEST['url'] != 'http://') ) {
if ($content = @file_get_contents($_REQUEST['url'])) {
$filename = substr(time(), -6). '.zip';
*/
// Check if all the files exists in the manifest, iff it's a IMS CC package.
if ($content_type == 'IMS Common Cartridge') {
- //If user chooses to ignore validation.
- if(isset($_POST['ignore_validation']) && $_POST['ignore_validation']==1) {
- $skip_ims_validation = true;
- }
checkResources($import_path);
}
}
} else if (isset($elements[$name]) && ($attrs[$elements[$name]] != '')) {
/* we know exactly which attribute contains the reference to the file. */
- $my_files[] = $attrs[$elements[$name]];
+ //hack, if param[name]=autoplay or autostart, ignore
+ if (!($name=='param' && ($attrs['name']=='autoplay' || $attrs['name']=='autoStart'))){
+ //skip glossary.html, tweak to accomodate atutor imscp; also skip repeated entries.
+ if (strpos($attrs[$elements[$name]], 'glossary.html')===false
+ && !in_array($attrs[$elements[$name]], $my_files)){
+ $my_files[] = $attrs[$elements[$name]];
+ }
+ }
}
}
function closeHandler(& $parser,$name) { }
function isTokenExpired($token)
{
$sql = "SELECT unix_timestamp(now()) now_timestamp,
- unix_timestamp(addtime(ost.assign_date, osc.expire_threshold)) expire_timestamp
+ osc.expire_threshold,
+ unix_timestamp(addtime(ost.assign_date, sec_to_time(osc.expire_threshold))) expire_timestamp
FROM ".TABLE_PREFIX."oauth_server_consumers osc, ".TABLE_PREFIX."oauth_server_tokens ost
WHERE osc.consumer_id=ost.consumer_id
AND ost.token='".$token."'
ORDER BY ost.assign_date DESC";
$row = $this->execute($sql);
- if (!is_array($row) || $row['now_timestamp'] > $row['expire_timestamp'])
+ if ((!is_array($row) || $row['now_timestamp'] > $row['expire_timestamp']) && $row['expire_threshold'] != 0) {
return true;
- else
+ } else {
return false;
+ }
}
}
?>
\ No newline at end of file
$_config_defaults = array();
$_config_defaults['site_name'] = '';
$_config_defaults['contact_email'] = '';
-$_config_defaults['max_file_size'] = 1048576; // 1MB
-$_config_defaults['max_course_size'] = 10485760; // 10 MB
-$_config_defaults['max_file_size'] = 1048576; // 1MB
+$_config_defaults['max_file_size'] = 10485760; // 10MB
+$_config_defaults['max_course_size'] = 104857600; // 100 MB
+$_config_defaults['max_file_size'] = 10485760; // 10MB
$_config_defaults['illegal_extentions'] = 'exe|asp|php|php3|bat|cgi|pl|com|vbs|reg|pcd|pif|scr|bas|inf|vb|vbe|wsc|wsf|wsh';
$_config_defaults['default_language'] = 'en';
$_config_defaults['use_captcha'] = 0; //use captcha?