".$msg['chklnk_verifencours']."" ;
error_reporting (E_ERROR | E_PARSE | E_WARNING);
@set_time_limit(0) ;
$curl = new Curl();
$curl->timeout=5;
$curl->limit=1000;//Limite à 1Ko
mysql_query("set wait_timeout=3600");
$req_notice = array();
$req_explnum_noti = array();
$req_explnum_bull = array();
$req_cp = array();
$requete_notice ="select notice_id, tit1, lien from notices !!JOIN!! where lien!='' and lien is not null";
$requete_explnum_noti = "select notice_id, tit1, explnum_url, explnum_id from notices !!JOIN!! join explnum on explnum_notice=notice_id and explnum_notice != 0 where explnum_mimetype = 'URL'";
$requete_explnum_bull = "select bulletin_id, concat(notices.tit1,' ',bulletin_numero,' ',date_date) as tit, explnum_url, explnum_id, notices.notice_id from notices join bulletins on notices.notice_id=bulletin_notice !!JOIN!! join explnum on explnum_bulletin=bulletin_id and explnum_bulletin != 0 where explnum_mimetype = 'URL'";
$requete_cp = "select distinct notice_id, tit1 from notices join notices_custom_values on notice_id = notices_custom_origine join notices_custom on idchamp = notices_custom_champ !!JOIN!! where type in ('url','resolve')";
//on s'occupe des restrictions
if($chkrestrict){
//pour les paniers de notice
if($idcaddienoti){
$paniers_ids = implode(",",$idcaddienoti);
//restriction aux notices des paniers
$limit_noti = "join caddie_content as c1 on c1.caddie_id in ($paniers_ids) and notice_id = c1.object_id";
//restriction aux bulletins des notices de bulletins des paniers
$limit_noti_bull = "join notices as n1 on n1.niveau_biblio = 'b' and n1.niveau_hierar = '2' and num_notice = n1.notice_id join caddie_content as c2 on n1.notice_id = c2.object_id and c2.caddie_id in ($paniers_ids)";
$req_notice[] =str_replace("!!JOIN!!",$limit_noti,$requete_notice);
$req_explnum_noti[]= str_replace("!!JOIN!!",$limit_noti,$requete_explnum_noti);
$req_explnum_bull[]=str_replace("!!JOIN!!",$limit_noti_bull,$requete_explnum_bull);
$req_cp[] = str_replace("!!JOIN!!",$limit_noti,$requete_cp);
}
//pour les paniers de bulletins
if($idcaddiebull){
$paniers_ids = implode(",",$idcaddiebull);
//restriction aux bulletins du paniers
$limit_bull = "join caddie_content as c3 on c3.caddie_id in ($paniers_ids) and bulletin_id = c3.object_id";
//restriction aux notices de bulletins associées aux bulletins des paniers
$limit_bull_noti = "join bulletins as b1 on b1.num_notice = notice_id join caddie_content as c4 on c4.caddie_id in ($paniers_ids) and c4.object_id = b1.bulletin_id";
$req_notice[] =str_replace("!!JOIN!!",$limit_bull_noti,$requete_notice);
$req_explnum_noti[]= str_replace("!!JOIN!!",$limit_bull_noti,$requete_explnum_noti);
$req_explnum_bull[]=str_replace("!!JOIN!!",$limit_bull,$requete_explnum_bull);
$req_cp[] = str_replace("!!JOIN!!",$limit_noti,$requete_cp);
}
//pour les paniers d'exemplaires
if($idcaddieexpl){
$paniers_ids = implode(",",$idcaddieexpl);
//restriction aux notices associées au exemplaires des paniers
$limit_expl_noti = "join exemplaires as e1 on e1.expl_notice = notice_id and e1.expl_notice != 0 join caddie_content as c5 on c5.caddie_id in ($paniers_ids) and e1.expl_id = c5.object_id";
//restrictions aux bulletin associés au exemplaires des paniers
$limit_expl_bull = "join exemplaires as e2 on e2.expl_bulletin = bulletin_id join caddie_content as c6 on c6.caddie_id in ($paniers_ids) and e2.expl_id = c6.object_id";
//restriction aux notices de bulletins associées aux bulletins dont les exemplaires sont dans le paniers
$limit_expl_bull_noti ="join bulletins as b2 on b2.num_notice = notice_id join exemplaires as e3 on e3.expl_bulletin = b2.bulletin_id join caddie_content as c7 on c7.caddie_id in ($paniers_ids) and e3.expl_id = c7.object_id";
$req_notice[] =str_replace("!!JOIN!!",$limit_expl_noti,$requete_notice);
$req_notice[] =str_replace("!!JOIN!!",$limit_expl_bull_noti,$requete_notice);
$req_explnum_noti[]= str_replace("!!JOIN!!",$limit_expl_noti,$requete_explnum_noti);
$req_explnum_bull[]=str_replace("!!JOIN!!",$limit_expl_bull,$requete_explnum_bull);
$req_cp[] =str_replace("!!JOIN!!",$limit_expl_noti,$requete_cp);
$req_cp[] =str_replace("!!JOIN!!",$limit_expl_bull_noti,$requete_cp);
}
}else{
//si on a pas restreint par panier,
$req_notice[] =str_replace("!!JOIN!!","",$requete_notice);
$req_explnum_noti[]= str_replace("!!JOIN!!","",$requete_explnum_noti);
$req_explnum_bull[]=str_replace("!!JOIN!!","",$requete_explnum_bull);
$req_cp[] = str_replace("!!JOIN!!","",$requete_cp);
}
$pb=new progress_bar();
$pb->pas=10;
if ($chknoti) {
if ($ajtnoti) {
$cad=new caddie($idcaddienot);
$liencad=" ".$cad->name."";
} else $liencad="";
echo "
".$liencad."
";
$q =implode($req_notice," union ");
$r = mysql_query($q) ;
$rc=mysql_num_rows($r);
$pb->count=$rc;
$pb->nb_progress_call=0;
$pb->set_text($msg['chklnk_verif_notice']);
flush();
while ($o=mysql_fetch_object($r)) {
$response = $curl->get($o->lien);
if (!$response) {
echo "
";
if ($ajtbull) $cad->add_item($o->bulletin_id,'BULL');
}
$pb->progress();
flush();
}
echo "
";
flush();
}
if ($chkautaut) {
$resl="";
echo "
";
$q = "select author_id, concat(author_name,', ',author_rejete,' - ',author_date) as nom_auteur, author_web from authors where author_web!='' and author_web is not null order by index_author ";
$r = mysql_query($q) or die(mysql_error()." ".$q);
$rc=mysql_num_rows($r);
$pb->count=$rc;
$pb->nb_progress_call=0;
$pb->set_text($msg['chklnk_verifurl_auteur']);
while ($o=mysql_fetch_object($r)) {
$response = $curl->get($o->author_web);
if (!$response) {
echo "
";
$q = "select ed_id, concat(ed_name,' - ',ed_ville,' - ',ed_pays) as nom_pub, ed_web from publishers where ed_web!='' and ed_web is not null order by index_publisher ";
$r = mysql_query($q) or die(mysql_error()." ".$q);
$rc=mysql_num_rows($r);
$pb->count=$rc;
$pb->nb_progress_call=0;
$pb->set_text($msg['chklnk_verifurl_editeur']);
while ($o=mysql_fetch_object($r)) {
$response = $curl->get($o->ed_web);
if (!$response) {
echo "
";
$q = "select collection_id, concat(collection_name,' - ',collection_issn) as nom_col, collection_web from collections where collection_web!='' and collection_web is not null order by index_coll ";
$r = mysql_query($q) or die(mysql_error()." ".$q);
$rc=mysql_num_rows($r);
$pb->count=$rc;
$pb->nb_progress_call=0;
$pb->set_text($msg['chklnk_verifurl_coll']);
while ($o=mysql_fetch_object($r)) {
$response = $curl->get($o->collection_web);
if (!$response) {
echo "
";
$q = "select sub_coll_id, concat(sub_coll_name,' - ',sub_coll_issn) as nom_sco, subcollection_web from sub_collections where subcollection_web!='' and subcollection_web is not null order by index_sub_coll ";
$r = mysql_query($q) or die(mysql_error()." ".$q);
$rc=mysql_num_rows($r);
$pb->count=$rc;
$pb->nb_progress_call=0;
$pb->set_text($msg['chklnk_verifurl_ss_coll']);
while ($o=mysql_fetch_object($r)) {
$response = $curl->get($o->subcollection_web);
if (!$response) {
echo "