".$msg['chklnk_verifencours']."" ; @set_time_limit(0) ; $curl = new Curl(); $curl->timeout=($chkcurltimeout*1 ? $chkcurltimeout*1 : 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) ; if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verif_notice']); flush(); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->lien); if (!$response) { echo "
notice_id."\">".$o->tit1." lien."\">".$o->lien." ".$curl->error."
"; if ($ajtnoti) $cad->add_item($o->notice_id,'NOTI'); } elseif ($response->headers['Status-Code']!='200') { echo "
notice_id."\">".$o->tit1." lien."\">".$o->lien." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; if ($ajtnoti) $cad->add_item($o->notice_id,'NOTI'); } $pb->progress(); flush(); } } echo "
"; flush(); } if($chkcp){ if($ajtcp){ $cad=new caddie($idcaddiecp); $liencad=" ".$cad->name.""; } else $liencad=""; echo "

".$liencad."
"; $q =implode($req_cp," union "); $r = mysql_query($q) ; if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verif_cp']); flush(); $pp = new parametres_perso("notices"); if ($r) { while ($o=mysql_fetch_object($r)) { $pp->get_values($o->notice_id); foreach($pp->values as $id_cp => $values){ if($pp->t_fields[$id_cp]['TYPE'] == "url"){ foreach($values as $value){ $link = ""; if(strpos($value,"|")!== false){ $link = substr($value,0,strpos($value,"|")); }else $link = $value; $response = $curl->get($link); if (!$response) { echo "
notice_id."\">".$o->tit1." ".$link." ".$curl->error."
"; if ($ajtcp) $cad->add_item($o->notice_id,'NOTI'); } elseif ($response->headers['Status-Code']!='200') { echo "
notice_id."\">".$o->tit1." ".$link." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; if ($ajtcp) $cad->add_item($o->notice_id,'NOTI'); } } }else if ($pp->t_fields[$id_cp]['TYPE'] == "resolve"){ $options=_parser_text_no_function_("\n".$pp->t_fields[$id_cp]['OPTIONS'], "OPTIONS"); foreach($values as $value){ $link = ""; $val = explode("|",$value); if(count($val)>1){ $id =$val[0]; foreach ($options[RESOLVE] as $res){ if($res[ID] == $val[1]){ $label = $res[LABEL]; $url= $res[value]; break; } } $link = str_replace("!!id!!",$id,$url); $response = $curl->get($link); if (!$response) { echo "
notice_id."\">".$o->tit1." ".$link." ".$curl->error."
"; if ($ajtcp) $cad->add_item($o->notice_id,'NOTI'); } elseif ($response->headers['Status-Code']!='200') { echo "
notice_id."\">".$o->tit1." ".$link." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; if ($ajtcp) $cad->add_item($o->notice_id,'NOTI'); } } } } } $pb->progress(); flush(); } } echo "
"; flush(); } if ($chkenum) { $resl=""; if ($ajtenum) { $cad=new caddie($idcaddielnk); $liencad=" ".$cad->name.""; } else $liencad=""; echo "

".$liencad."
"; $q = implode($req_explnum_noti," union "); $r = mysql_query($q) or die(mysql_error()."
".$q); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_docnum']); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->explnum_url); if (!$response) { echo "
notice_id."&explnum_id=".$o->explnum_id."\">".$o->tit1." explnum_url."\">".$o->explnum_url." ".$curl->error."
"; if ($ajtenum) $cad->add_item($o->notice_id,'NOTI'); } elseif ($response->headers['Status-Code']!='200') { echo "
notice_id."&explnum_id=".$o->explnum_id."\">".$o->tit1." explnum_url."\">".$o->explnum_url." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; if ($ajtenum) $cad->add_item($o->notice_id,'NOTI'); } $pb->progress(); flush(); } } echo "
"; flush(); } if ($chkbull) { $resl=""; if ($ajtbull) { $cad=new caddie($idcaddiebul); $liencad=" ".$cad->name.""; } else $liencad=""; echo "

".$liencad."
"; $q = implode($req_explnum_bull," union "); $r = mysql_query($q) or die(mysql_error()."
".$q); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_bull']); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->explnum_url); if (!$response) { echo "
bulletin_id."&explnum_id=".$o->explnum_id."\">".$o->tit." explnum_url."\">".$o->explnum_url." ".$curl->error."
"; if ($ajtbull) $cad->add_item($o->bulletin_id,'BULL'); } elseif ($response->headers['Status-Code']!='200') { echo "
bulletin_id."&explnum_id=".$o->explnum_id."\">".$o->tit." explnum_url."\">".$o->explnum_url." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; 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); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_auteur']); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->author_web); if (!$response) { echo "
author_id."\">".$o->nom_auteur." author_web."\">".$o->author_web." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
author_id."\">".$o->nom_auteur." author_web."\">".$o->author_web." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } $pb->progress(); flush(); } } echo "
"; flush(); } if ($chkautpub) { $resl=""; 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); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_editeur']); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->ed_web); if (!$response) { echo "
ed_id."\">".$o->nom_pub." ed_web."\">".$o->ed_web." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
ed_id."\">".$o->nom_pub." ed_web."\">".$o->ed_web." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } $pb->progress(); flush(); } } echo "
"; flush(); } if ($chkautcol) { 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); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_coll']); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->collection_web); if (!$response) { echo "
collection_id."\">".$o->nom_col." collection_web."\">".$o->collection_web." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
collection_id."\">".$o->nom_col." collection_web."\">".$o->collection_web." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } $pb->progress(); flush(); } } echo "
"; flush(); } if ($chkautsco) { $resl=""; 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); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_ss_coll']); if ($r) { while ($o=mysql_fetch_object($r)) { $response = $curl->get($o->subcollection_web); if (!$response) { echo "
sub_coll_id."\">".$o->nom_sco." subcollection_web."\">".$o->subcollection_web." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
sub_coll_id."\">".$o->nom_sco." subcollection_web."\">".$o->subcollection_web." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } $pb->progress(); flush(); } } echo "
"; flush(); } if($chkeditorialcontentcp){ echo "

"; $q = "select distinct id_article, article_title from cms_articles join cms_editorial_custom_values on id_article = cms_editorial_custom_origine join cms_editorial_custom on idchamp = cms_editorial_custom_champ where type in ('url','resolve')"; $r = mysql_query($q) or die(mysql_error()."
".$q); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_editorial_content_cp']); flush(); $pp = new parametres_perso("cms_editorial"); if ($r) { while ($o=mysql_fetch_object($r)) { $pp->get_values($o->id_article); foreach($pp->values as $id_cp => $values){ if($pp->t_fields[$id_cp]['TYPE'] == "url"){ foreach($values as $value){ $link = ""; if(strpos($value,"|")!== false){ $link = substr($value,0,strpos($value,"|")); }else $link = $value; $response = $curl->get($link); if (!$response) { echo "
".$o->article_title." ".$link." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
".$o->article_title." ".$link." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } } }else if ($pp->t_fields[$id_cp]['TYPE'] == "resolve"){ $options=_parser_text_no_function_("\n".$pp->t_fields[$id_cp]['OPTIONS'], "OPTIONS"); foreach($values as $value){ $link = ""; $val = explode("|",$value); if(count($val)>1){ $id =$val[0]; foreach ($options[RESOLVE] as $res){ if($res[ID] == $val[1]){ $label = $res[LABEL]; $url= $res[value]; break; } } $link = str_replace("!!id!!",$id,$url); $response = $curl->get($link); if (!$response) { echo "
".$o->article_title." ".$link." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
".$o->article_title." ".$link." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } } } } } $pb->progress(); flush(); } } echo "
"; $q = "select distinct id_section, section_title from cms_sections join cms_editorial_custom_values on id_section = cms_editorial_custom_origine join cms_editorial_custom on idchamp = cms_editorial_custom_champ where type in ('url','resolve')"; $r = mysql_query($q) or die(mysql_error()."
".$q); if ($r) $rc=mysql_num_rows($r); else $rc=0; $pb->count=$rc; $pb->nb_progress_call=0; $pb->set_text($msg['chklnk_verifurl_editorial_content_cp']); flush(); $pp = new parametres_perso("cms_editorial"); if ($r) { while ($o=mysql_fetch_object($r)) { $pp->get_values($o->id_section); foreach($pp->values as $id_cp => $values){ if($pp->t_fields[$id_cp]['TYPE'] == "url"){ foreach($values as $value){ $link = ""; if(strpos($value,"|")!== false){ $link = substr($value,0,strpos($value,"|")); }else $link = $value; $response = $curl->get($link); if (!$response) { echo "
".$o->section_title." ".$link." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
".$o->section_title." ".$link." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } } }else if ($pp->t_fields[$id_cp]['TYPE'] == "resolve"){ $options=_parser_text_no_function_("\n".$pp->t_fields[$id_cp]['OPTIONS'], "OPTIONS"); foreach($values as $value){ $link = ""; $val = explode("|",$value); if(count($val)>1){ $id =$val[0]; foreach ($options[RESOLVE] as $res){ if($res[ID] == $val[1]){ $label = $res[LABEL]; $url= $res[value]; break; } } $link = str_replace("!!id!!",$id,$url); $response = $curl->get($link); if (!$response) { echo "
".$o->section_title." ".$link." ".$curl->error."
"; } elseif ($response->headers['Status-Code']!='200') { echo "
".$o->section_title." ".$link." ".$response->headers['Status-Code']." -> ".$curl->reponsecurl[$response->headers['Status-Code']]."
"; } } } } } $pb->progress(); flush(); } } echo "
"; flush(); } if ($curl->timeout != $pmb_curl_timeout) { $q = "update parametres set valeur_param='".$curl->timeout."' where type_param='pmb' and sstype_param='curl_timeout'"; $r = mysql_query($q) or die(mysql_error()."
".$q); } echo "

".$msg['chklnk_fin']."

"; }