Example #1
0
 private function change_img_url_for_pdf($str)
 {
     $pattern = '/(.*?)<img (.*?)src=(\'|")(.*?)url=(.*?)=&(.*?)(\'|")(.*?)>(.*?)/is';
     if (!preg_match($pattern, urldecode($str), $matches)) {
         return $str;
     }
     if (count($matches) != 10) {
         return $str;
     }
     if (is_download_url_encoded($matches[5])) {
         $matches[5] = download_url_decode($matches[5]);
     }
     $matches[5] = get_conf('rootWeb') . 'courses/' . claro_get_current_course_id() . '/document' . $matches[5];
     //$replace = strip_tags( $matches[1] ) . '<img ' . /*$matches[2] .*/ ' src="' . $matches[5] .'" ' . /*$matches[8] .*/ '>' . strip_tags( $matches[9] );
     $replace = strip_tags($matches[1]) . '<img src="' . $matches[5] . '" >' . strip_tags($matches[9]);
     return $replace;
 }
Example #2
0
require_once get_path('incRepositorySys') . '/lib/file.lib.php';
require_once get_path('incRepositorySys') . '/lib/file/downloader.lib.php';
$nameTools = get_lang('Display file');
$dialogBox = new DialogBox();
$noPHP_SELF = true;
$isDownloadable = true;
if (claro_is_in_a_course() && !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
$claroline->notification->addListener('download', 'trackInCourse');
if (isset($_REQUEST['url'])) {
    $requestUrl = strip_tags($_REQUEST['url']);
} else {
    $requestUrl = strip_tags(get_path_info());
}
if (is_download_url_encoded($requestUrl)) {
    $requestUrl = download_url_decode($requestUrl);
}
if (empty($requestUrl)) {
    $isDownloadable = false;
    $dialogBox->error(get_lang('Missing parameters'));
} else {
    if (isset($_REQUEST['moduleLabel']) && !empty($_REQUEST['moduleLabel'])) {
        $moduleLabel = $_REQUEST['moduleLabel'];
    } else {
        if (!claro_is_in_a_course()) {
            $moduleLabel = null;
        } else {
            $moduleLabel = 'CLDOC';
        }
    }