explnum_id) { header("Location: images/mimetype/unknown.gif"); exit ; } $id_for_rigths = $explnum->explnum_notice; if($explnum->explnum_bulletin != 0){ //si bulletin, les droits sont rattachés à la notice du bulletin, à défaut du pério... $req = "select bulletin_notice,num_notice from bulletins where bulletin_id =".$explnum->explnum_bulletin; $res = pmb_mysql_query($req); if(pmb_mysql_num_rows($res)){ $row = pmb_mysql_fetch_object($res); $id_for_rigths = $row->num_notice; if(!$id_for_rigths){ $id_for_rigths = $row->bulletin_notice; } } $type = "" ; } //droits d'acces emprunteur/notice if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $ac= new acces(); $dom_2= $ac->setDomain(2); $rights= $dom_2->getRights($_SESSION['id_empr_session'],$id_for_rigths); } else { $dom_2=null; $rights=0; } //Accessibilité des documents numériques aux abonnés en opac $req_restriction_abo = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM notices,notice_statut WHERE notice_id='".$id_for_rigths."' AND statut=id_notice_statut "; $result=pmb_mysql_query($req_restriction_abo); $expl_num=pmb_mysql_fetch_array($result,PMB_MYSQL_ASSOC); $docnum_rights = 0; //droits d'acces emprunteur/document numérique if ($gestion_acces_active==1 && $gestion_acces_empr_docnum==1) { $ac= new acces(); $dom_3= $ac->setDomain(3); $docnum_rights= $dom_3->getRights($_SESSION['id_empr_session'],$explnum_id); } //Accessibilité (Consultation/Téléchargement) sur le document numérique aux abonnés en opac $req_restriction_docnum_abo = "SELECT explnum_download_opac, explnum_download_opac_abon FROM explnum,explnum_statut WHERE explnum_id='".$explnum_id."' AND explnum_docnum_statut=id_explnum_statut "; $result_docnum=pmb_mysql_query($req_restriction_docnum_abo); $docnum_expl_num=pmb_mysql_fetch_array($result_docnum,PMB_MYSQL_ASSOC); if( ( ($rights & 16) || (is_null($dom_2) && $expl_num["explnum_visible_opac"] && (!$expl_num["explnum_visible_opac_abon"] || ($expl_num["explnum_visible_opac_abon"] && $_SESSION["user_code"])))) && ( ($docnum_rights & 8) || (empty($dom_3) && $docnum_expl_num["explnum_download_opac"] && (!$docnum_expl_num["explnum_download_opac_abon"] || ($docnum_expl_num["explnum_download_opac_abon"] && $_SESSION["user_code"]))))){ if (!($file_loc = $explnum->get_is_file())) { $content = $explnum->get_file_content(); } else { $content = ''; } if($file_loc || $content ) { if($pmb_logs_activate){ //Enregistrement du log global $log; if($_SESSION['user_code']) { $res=pmb_mysql_query($log->get_empr_query()); if($res){ $empr_carac = pmb_mysql_fetch_array($res); $log->add_log('empr',$empr_carac); } } $log->add_log('num_session',session_id()); $log->add_log('explnum',$explnum->get_explnum_infos()); $infos_restriction_abo = array(); foreach ($expl_num as $key=>$value) { $infos_restriction_abo[$key] = $value; } $log->add_log('restriction_abo',$infos_restriction_abo); $infos_restriction_docnum_abo = array(); foreach ($docnum_expl_num as $key=>$value) { $infos_restriction_docnum_abo[$key] = $value; } $log->add_log('restriction_docnum_abo',$infos_restriction_docnum_abo); $log->save(); } create_tableau_mimetype() ; $name=$_mimetypes_bymimetype_[$explnum->explnum_mimetype]["plugin"] ; if ($name) { $type = "" ; // width='700' height='525' $name = " name='$name' "; } $type="type='$explnum->explnum_mimetype'" ; if ($_mimetypes_bymimetype_[$explnum->explnum_mimetype]["embeded"]=="yes") { print "" ; if ($fo) fclose($fo); exit ; } $file_name = $explnum->get_file_name(); if ($file_name) header('Content-Disposition: inline; filename="'.$file_name.'"'); if ((substr($explnum->explnum_mimetype,0,5)=="image")&&($opac_photo_watermark)) { if (!$content) { $content = $explnum->get_file_content(); } $content_image=reduire_image_middle($content); session_write_close(); pmb_mysql_close(); if ($content_image) { print header("Content-Type: image/png"); print $content_image; } else { header("Content-Type: ".$explnum->explnum_mimetype); print $content; } } else { if($explnum->explnum_mimetype == 'text/html') { header("Content-Type: ".$explnum->explnum_mimetype." charset=".$charset); } else { header("Content-Type: ".$explnum->explnum_mimetype); } if($file_loc){ session_write_close(); pmb_mysql_close(); readfile($file_loc); }else{ if (!$content) { $content = $explnum->get_file_content(); } session_write_close(); pmb_mysql_close(); print $content; } } exit ; } if ($explnum->explnum_mimetype=="URL") { if ($explnum->explnum_url){ $explnum_url = $explnum->explnum_url; // CAIRN if (strpos($explnum_url, "cairn.info") !== false) { require_once($base_path."/admin/connecteurs/in/cairn/cairn.class.php"); $cairn_connector = new cairn(); $cairn_sso_params = $cairn_connector->get_sso_params(); if ($cairn_sso_params && (strpos($explnum_url, "?") === false)) { $explnum_url.= "?"; $cairn_sso_params = substr($cairn_sso_params, 1); } $explnum_url.= $cairn_sso_params; } if($pmb_logs_activate){ global $log, $infos_notice, $infos_expl; if($_SESSION['user_code']) { $res=pmb_mysql_query($log->get_empr_query()); if($res){ $empr_carac = pmb_mysql_fetch_array($res); $log->add_log('empr',$empr_carac); } } $log->add_log('num_session',session_id()); $log->add_log('explnum',$explnum->get_explnum_infos()); //Enregistrement vue if($opac_opac_view_activate){ $log->add_log('opac_view', $_SESSION["opac_view"]); } $log->get_log["called_url"] = $explnum_url; $log->get_log["type_url"] = "external_url_docnum"; $log->save(); } header("Location: ".$explnum_url); } exit ; } }else{ if(!$_SESSION['id_empr_session'] && ( $opac_show_links_invisible_docnums || ( ( is_null($dom_2) ) && ( is_null($dom_3) ) && $expl_num["explnum_visible_opac"] && $docnum_expl_num["explnum_download_opac"] && ($docnum_expl_num["explnum_download_opac_abon"] || $expl_num["explnum_visible_opac_abon"]) ))){ require_once($base_path."/includes/templates/common.tpl.php"); $short_header = str_replace("!!liens_rss!!","",$short_header); print $short_header; require_once($class_path."/auth_popup.class.php"); print "
"; print ""; }else{ print $msg['forbidden_docnum']; } }