Skip to content

Commit

Permalink
added ===TRUE to check for AT_FORCE_GET_FILE, which was failing
Browse files Browse the repository at this point in the history
  • Loading branch information
atutorlangs committed Nov 26, 2014
1 parent 44d7047 commit c1e66d5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 40 deletions.
42 changes: 21 additions & 21 deletions content.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@

require (AT_INCLUDE_PATH.'footer.inc.php');
exit;
}
}
}/* else: */

if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {
if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE === TRUE) {
$course_base_href = 'get.php/';
} else {
$course_base_href = 'content/' . $_SESSION['course_id'] . '/';
Expand Down Expand Up @@ -94,18 +94,18 @@
foreach ($path as $i=>$page) {
// When login is a student, remove content folder from breadcrumb path as content folders are
// just toggles for students. Keep content folder in breadcrumb path for instructors as they
// can edit content folder title.
if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) &&
// can edit content folder title.
if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) &&
$contentManager->_menu_info[$page['content_id']]['content_type'] == CONTENT_TYPE_FOLDER) {
unset($path[$i]);
continue;
}

if ($contentManager->_menu_info[$page['content_id']]['content_type'] == CONTENT_TYPE_FOLDER)
$content_url = 'mods/_core/editor/edit_content_folder.php?cid='.$page['content_id'];
else
$content_url = 'content.php?cid='.$page['content_id'];

if (!$parent) {
$_pages[$content_url]['title'] = $page['content_number'] . $page['title'];
$_pages[$content_url]['parent'] = 'index.php';
Expand Down Expand Up @@ -139,7 +139,7 @@
$content_forum_ids[] = $content_forum_row;
}

// use any styles that were part of the imported document, except on the mobile theme.
// use any styles that were part of the imported document, except on the mobile theme.
// $_custom_css = $_base_href.'headstuff.php?cid='.$cid.SEP.'path='.urlEncode($_base_href.$course_base_href.$content_base_href);
if (is_mobile_device() == false) {
if ($content_row['use_customized_head'] && strlen($content_row['head']) > 0)
Expand Down Expand Up @@ -182,7 +182,7 @@
}

$pre_test_id = $contentManager->getPretest($cid);

if (intval($pre_test_id) > 0)
{
if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN)) {
Expand All @@ -193,28 +193,28 @@
exit;
}
}
// if one of the prerequisite test(s) has expired, student cannot view the content

// if one of the prerequisite test(s) has expired, student cannot view the content
if (intval($pre_test_id) != -1 || authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN))
{
// find whether the body has alternatives defined
list($has_text_alternative, $has_audio_alternative, $has_visual_alternative, $has_sign_lang_alternative)
= provide_alternatives($cid, $content_row['text'], true);

// apply alternatives
if (intval($_GET['alternative']) > 0) {
$content = provide_alternatives($cid, $content_row['text'], false, intval($_GET['alternative']));
} else {
$content = provide_alternatives($cid, $content_row['text']);
}
$content = format_content($content, $content_row['formatting'], $glossary);

$content_array = get_content_table($content);

// Create the array of alternative information for generating the AFA tool bar
$alt_infos = array();
$pause_image = find_image("pause.png");

if($has_text_alternative){
$alt_infos['has_text_alternative'] = array('3', _AT('apply_text_alternatives'), _AT('stop_apply_text_alternatives'), $pause_image, find_image('text_alternative.png'));
}
Expand All @@ -227,12 +227,12 @@
if($has_sign_lang_alternative){
$alt_infos['has_sign_lang_alternative'] = array('2', _AT('apply_sign_lang_alternatives'), _AT('stop_apply_sign_lang_alternatives'), $pause_image, find_image('sign_lang_alternative.png'));
}

$savant->assign('content_table', $content_array[0]);
$savant->assign('body', stripslashes($content_array[1]));
$savant->assign('cid', $cid);
$savant->assign('alt_infos', $alt_infos);

//assign test pages if there are tests associated with this content page
if (!empty($content_test_ids)){
$savant->assign('test_message', $content_row['test_message']);
Expand All @@ -241,7 +241,7 @@
$savant->assign('test_message', '');
$savant->assign('test_ids', array());
}

/*TODO***************BOLOGNA***************REMOVE ME**********/
//assign forum pages if there are forums associated with this content page
if (!empty($content_forum_ids)){
Expand All @@ -255,7 +255,7 @@
// get the content that the standard and add-on modules want to display on the content page
$module_status_bits = AT_MODULE_STATUS_ENABLED;
$module_type_bits = AT_MODULE_TYPE_STANDARD + AT_MODULE_TYPE_EXTRA;

$module_list = $moduleFactory->getModules($module_status_bits, $module_type_bits, $sort = TRUE);
$module_contents = '';
foreach($module_list as $key=>$obj) {
Expand All @@ -265,7 +265,7 @@
}
}
if ($module_contents <> '') $savant->assign('module_contents', $module_contents);
}
}
}
} else {
$infos = array('NOT_RELEASED', AT_date(_AT('announcement_date_format'), $released_status, AT_DATE_UNIX_TIMESTAMP));
Expand Down Expand Up @@ -295,10 +295,10 @@
$dom->loadHTML($fp);
libxml_use_internal_errors(FALSE);
$doc->formatOutput = TRUE;

//discard white space
$dom->preserveWhiteSpace = false;

$node = $dom->getElementById('content-text');
// row commented because of the old version of PHP
//$content = $dom->saveHTML($node);
Expand Down
8 changes: 4 additions & 4 deletions get.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$force_download = false;

//get path to file
if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {
if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE === TRUE) {
if ((version_compare(phpversion(), '5.2.0', '<') > 0) && !empty($_SERVER['ORIG_PATH_INFO'])){
//http://www.atutor.ca/atutor/mantis/view.php?id=3436
$current_file = $_SERVER['ORIG_PATH_INFO'];
Expand Down Expand Up @@ -102,16 +102,16 @@
if (file_exists($real) && (substr($real, 0, strlen(AT_CONTENT_DIR)) == AT_CONTENT_DIR)) {
if ($force_download) {
header('Content-Type: application/force-download');
header('Content-transfer-encoding: binary');
header('Content-transfer-encoding: binary');
header('Content-Disposition: attachment; filename="'.$pathinfo['basename'].'"');
} else {
header('Content-Disposition: inline; filename="'.$pathinfo['basename'].'"');
}

/**
* although we can check if mod_xsendfile is installed in apache2
* we can't actually check if it's enabled. also, we can't check if
* it's enabled and installed in lighty, so instead we send the
* it's enabled and installed in lighty, so instead we send the
* header anyway, if it works then the line after it will not
* execute. if it doesn't work, then the line after it will replace
* it so that the full server path is not exposed.
Expand Down
35 changes: 20 additions & 15 deletions mods/_standard/flowplayer/module_format_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
// input string. DO NOT CHANGE.
global $_input, $_content_base_href;

if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {
$_content_base_href = 'get.php/';
} else {
$_content_base_href = 'content/' . $_SESSION['course_id'] . '/';
}
// Output for flowplayer module.
// Note: The properly functioning of flowplayer requires flash to be installed.
// Note: The properly functioning of flowplayer requires flash to be installed.
// The conversion performed by this module converts the [media] tag into flowplayer class
// only when the flash is installed, otherwise, the [media] tag is converted into a plain
// only when the flash is installed, otherwise, the [media] tag is converted into a plain
// <a> link.
$media_replace = array();
$media_matches = array();
$flowplayerholder_class = "atutor.flowplayerholder"; // style class used to play flowplayer medias
$flowplayerholder_def = '$f("*.'.$flowplayerholder_class.'"'; // javascript definition for atutor.flowplayerholder
$flowplayerholder_def = '$f("*.'.$flowplayerholder_class.'"'; // javascript definition for atutor.flowplayerholder

// .flv
preg_match_all("#\[media[0-9a-z\|]*\]([.\w\d]+[^\s\"]+)\.flv\[/media\]#i",$_input,$media_matches[],PREG_SET_ORDER);
Expand Down Expand Up @@ -51,7 +56,7 @@
foreach($media_matches[$i] as $media)
{
//find width and height for each matched media
if (preg_match("/\[media\|([0-9]*)\|([0-9]*)\]*/", $media[0], $matches))
if (preg_match("/\[media\|([0-9]*)\|([0-9]*)\]*/", $media[0], $matches))
{
$width = $matches[1];
$height = $matches[2];
Expand All @@ -61,7 +66,7 @@
$width = DEFAULT_VIDEO_PLAYER_WIDTH;
$height = DEFAULT_VIDEO_PLAYER_HEIGHT;
}

//replace media tags with embedded media for each media tag
$media_input = $media_replace[$i];
$media_input = str_replace("##WIDTH##","$width",$media_input);
Expand All @@ -75,22 +80,22 @@
// Include the javascript only if:
// 1. $flowplayerholder_class is used but not defined
// 2. exclude from export common cartridge or content package
if (strpos($_input, $flowplayerholder_class)
if (strpos($_input, $flowplayerholder_class)
&& !strpos($_input, $flowplayerholder_def)
&& !strpos($_SERVER['PHP_SELF'], "ims_export.php"))
{
$_input .= '<script type="text/javascript">
'.$flowplayerholder_def.', "'.AT_BASE_HREF.'mods/_standard/flowplayer/flowplayer-3.2.4.swf", {
clip: {
'.$flowplayerholder_def.', "'.AT_BASE_HREF.'mods/_standard/flowplayer/flowplayer-3.2.4.swf", {
clip: {
autoPlay: false,
baseUrl: \''.AT_BASE_HREF.'get.php/'.$_content_base_href.'\'},
plugins: {
controls: {
buttons:true,
play: true,
scrubber: true,
baseUrl: \''.AT_BASE_HREF.$_content_base_href.'\'},
plugins: {
controls: {
buttons:true,
play: true,
scrubber: true,
autoHide:false
}
}
}
});
</script>'."\n";
Expand Down

0 comments on commit c1e66d5

Please sign in to comment.