//
// Fonctions communes
//
// Fonction pour coder en format Excel
// $titre = encoding_conv($titre,'Windows-1252');
//
function encoding_conv($var, $enc_out, $enc_in='utf-8')
{
$var = htmlentities($var, ENT_QUOTES, $enc_in);
return html_entity_decode($var, ENT_QUOTES, $enc_out);
}
//
// Function pour remplacer les apostrophes spéciaux par des courants
//
function clean_apostrophes($var)
{
// Apostrophes spéciaux
$searchapostrophes = array(
'′', // 1
'″', // 2
'‘', // 3
'’', // 4
'‚', // 5
'‛', // 6
'“', // 7
'”', // 8
'„' // 9
);
$replaceapostrophes = array(
"'", // 1
'"', // 2
"'", // 3
"'", // 4
"'", // 5
"'", // 6
'"', // 7
'"', // 8
'"' // 9
);
$var = str_replace($searchapostrophes, $replaceapostrophes, $var);
return $var;
}
//
// Function pour nettoyer les critères de recherche (mots vides, ponctuation...)
//
function clean_search($var)
{
$searchapostrophes = array(
'′', // 1
'″', // 2
'‘', // 3
'’', // 4
'‚', // 5
'‛', // 6
'“', // 7
'”', // 8
'„' // 9
);
$replaceapostrophes = array(
"'", // 1
'"', // 2
"'", // 3
"'", // 4
"'", // 5
"'", // 6
'"', // 7
'"', // 8
'"' // 9
);
$var = str_replace($searchapostrophes, $replaceapostrophes, $var);
$var = " " . $var . " ";
$var = str_ireplace(",","",$var);
$var = str_ireplace(". "," ",$var);
$var = str_ireplace(": "," ",$var);
$var = str_ireplace(":"," ",$var);
$var = str_ireplace("-"," ",$var);
$var = str_ireplace(";","",$var);
$var = str_ireplace(" (the) "," ",$var);
$var = str_ireplace(" the "," ",$var);
$var = str_ireplace(" [the] "," ",$var);
$var = str_ireplace(" of "," ",$var);
$var = str_ireplace(" de "," ",$var);
$var = str_ireplace(" du "," ",$var);
$var = str_ireplace(" le "," ",$var);
$var = str_ireplace(" les "," ",$var);
$var = str_ireplace(" des "," ",$var);
$var = str_ireplace(" l'"," ",$var);
$var = str_ireplace(" la "," ",$var);
$var = str_ireplace(" los "," ",$var);
$var = str_ireplace(" el "," ",$var);
$var = str_ireplace(" and "," ",$var);
$var = str_ireplace(" (and) "," ",$var);
$var = str_ireplace(" [and] "," ",$var);
$var = str_ireplace(" et "," ",$var);
$var = str_ireplace(" (et) "," ",$var);
$var = str_ireplace(" [et] "," ",$var);
$var = str_ireplace(" y "," ",$var);
$var = str_ireplace(" und "," ",$var);
$var = str_ireplace(" der "," ",$var);
$var = str_ireplace(" die "," ",$var);
$var = str_ireplace(" das "," ",$var);
$var = str_ireplace(" fur "," ",$var);
$var = str_ireplace(" für "," ",$var);
$var = str_ireplace(" & "," ",$var);
$var = str_ireplace(" (&) "," ",$var);
$var = str_ireplace(" [&] "," ",$var);
$var = str_ireplace(" & "," ",$var);
// $var = str_ireplace("’","'",$var);
// $var = str_ireplace("\xe2\x80\x99","'",$var);
// $var = str_ireplace(chr(146),"'",$var);
$var = trim($var);
return $var;
}
//
// Extraction de l'adresse IP du client
//
$ip = $_SERVER['REMOTE_ADDR'];
$sep = ".";
$ips1 = strtok( $ip, $sep );
$ips2 = strtok( $sep );
$ips3 = strtok( $sep );
$ips4 = strtok( $sep );
if (($ips1 == '155') && ($ips2 == '105'))
{
$locip = "CHUV";
}
else
{
if (($ips1 == '130') && ($ips2 == '223'))
{
$locip = "UNIL";
}
else
{
$locip = "WWW";
}
}
$moncollapse="0";
$collapsetemp="";
if (!empty($_COOKIE[perunilid]))
{
$monnom=$_COOKIE['perunilid']['nom'];
$monaut=$_COOKIE['perunilid']['aut'];
$monlog=$_COOKIE['perunilid']['log'];
$moncollapse=$_COOKIE['perunilid']['collapse'];
$monsuggest=$_COOKIE['perunilid']['suggest'];
}
$collapse=$_GET['collapse'];
$collapsetemp=$_GET['collapsetemp'];
if ($collapse=="")
{
if ($collapsetemp=="")
$collapse=$moncollapse;
else
$collapse=$collapsetemp;
}
require ("connexion.php");
if(!isset($_GET['page']))
{
$page = 1;
}
else
{
$page = $_GET['page'];
}
//
// Define the number of results per page
//
$max_results = 25;
$from = (($page * $max_results) - $max_results);
$searchadvok = 0;
$searchadmok = 0;
$searcheq = "";
$searcheqs = "";
$searcheqa = "";
$andq = "";
$recherchetype=$_GET['search'];
$export=$_GET['export'];
$init=$_GET['init'];
$qall=$_GET['allfields'];
$nodpl=$_GET['nodpl'];
if ($qall)
{
$searcheq = $searcheq . $andq . "tous les champs = " . $qall;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
$searchadmok = $searchadmok + 1;
}
$qall = str_ireplace("'","\\'",$qall);
$q=$_GET['q'];
$searcheqs = $q;
$q = clean_apostrophes($q);
$q = str_ireplace("'","\\'",$q);
$q1="";
$title=$_GET['title'];
if ($title)
{
$searcheq = $searcheq . $andq . "titre = " . $title;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
$searchadmok = $searchadmok + 1;
}
$title = str_ireplace("'","\\'",$title);
$title1="";
//
// Split de la chaine de recherche q pour les combinaisons dans les differents ordres
//
if ($q)
{
$q = trim($q);
$qstop = clean_search($q);
if (($qstop=="")||($qstop==" "))
{
$qstop = $q;
}
$qstop=str_ireplace("*","%",$qstop);
$q1=str_ireplace(" ","%",$qstop);
$startespaceq = stripos($qstop, " ");
if ($startespaceq !== false)
{
$ktq=split(" ",$qstop);
while(list($keyq,$valq)=each($ktq))
{
if($valq<>" " and strlen($valq) > 0)
{
$q2 .= "(titre LIKE '%$valq%' OR titreabrege LIKE '%$valq%' OR variantetitre LIKE '%$valq%' OR soustitre LIKE '%$valq%') AND ";
$q3 .= "(perunilid LIKE '%$valq%' OR titre LIKE '%$valq%' OR titreabrege LIKE '%$valq%' OR variantetitre LIKE '%$valq%' OR soustitre LIKE '%$valq%' OR issn LIKE '%$valq%' OR issnl LIKE '%$valq%' OR nlmid LIKE '%$valq%' OR reroid LIKE '%$valq%' OR doi LIKE '%$valq%' OR coden LIKE '%$valq%' OR urn LIKE '%$valq%' OR faitsuitea LIKE '%$valq%' OR devient LIKE '%$valq%' OR editeur LIKE '%$valq%' OR etatcoll LIKE '%$valq%' OR url LIKE '%$valq%' OR rss LIKE '%$valq%' OR licence LIKE '%$valq%' OR plateforme LIKE '%$valq%' OR gestion LIKE '%$valq%' OR historiqueabo LIKE '%$valq%' OR cote LIKE '%$valq%' OR localisation LIKE '%$valq%' OR user LIKE '%$valq%' OR keywords LIKE '%$valq%' OR commentairepub LIKE '%$valq%' OR commentairepro LIKE '%$valq%' OR package LIKE '%$valq%' OR corecollection LIKE '%$valq%' OR idediteur LIKE '%$valq%' OR codeediteur LIKE '%$valq%') AND ";
}
}
$q2=substr($q2,0,(strlen($q2)-4));
$q3=substr($q3,0,(strlen($q3)-4));
}
else
{
$q2 = "(titre LIKE '%$q1%' OR titreabrege LIKE '%$q1%' OR variantetitre LIKE '%$q1%' OR soustitre LIKE '%$q1%' OR issn LIKE '%$q1%' OR issnl LIKE '%$q1%' OR perunilid LIKE '$q1' OR url LIKE '%$q1%')";
$q3 = "(perunilid LIKE '%$q1%' OR titre LIKE '%$q1%' OR titreabrege LIKE '%$q1%' OR variantetitre LIKE '%$q1%' OR soustitre LIKE '%$q1%' OR issn LIKE '%$q1%' OR issnl LIKE '%$q1%' OR nlmid LIKE '%$q1%' OR reroid LIKE '%$q1%' OR doi LIKE '%$q1%' OR coden LIKE '%$q1%' OR urn LIKE '%$q1%' OR faitsuitea LIKE '%$q1%' OR devient LIKE '%$q1%' OR editeur LIKE '%$q1%' OR etatcoll LIKE '%$q1%' OR url LIKE '%$q1%' OR rss LIKE '%$q1%' OR licence LIKE '%$q1%' OR plateforme LIKE '%$q1%' OR gestion LIKE '%$q1%' OR historiqueabo LIKE '%$q1%' OR cote LIKE '%$q1%' OR localisation LIKE '%$q1%' OR user LIKE '%$q1%' OR keywords LIKE '%$q1%' OR commentairepub LIKE '%$q1%' OR commentairepro LIKE '%$q1%' OR package LIKE '%$q1%' OR corecollection LIKE '%$q1%' OR idediteur LIKE '%$q1%' OR codeediteur LIKE '%$q1%')";
}
}
// ******************************
// ******************************
// ******************************
// début de la recherche administrateur
// ******************************
// ******************************
// ******************************
if ($recherchetype=="admin")
{
$searcheqa = $searcheq;
$searcheq = "";
$perunilidcrit1=$_GET['perunilidcrit1'];
$perunilid1=$_GET['perunilid1'];
if ($perunilid1)
{
$searcheqa = $searcheqa . $andq . "perunilid";
if ($perunilidcrit1 == "equal")
$searcheqa = $searcheqa . " = " . $perunilid1;
if ($perunilidcrit1 == "before")
$searcheqa = $searcheqa . " < " . $perunilid1;
if ($perunilidcrit1 == "after")
$searcheqa = $searcheqa . " > " . $perunilid1;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$perunilidcrit2=$_GET['perunilidcrit2'];
$perunilid2=$_GET['perunilid2'];
if ($perunilid2)
{
$searcheqa = $searcheqa . $andq . "perunilid";
if ($perunilidcrit2 == "equal")
$searcheqa = $searcheqa . " = " . $perunilid2;
if ($perunilidcrit2 == "before")
$searcheqa = $searcheqa . " < " . $perunilid2;
if ($perunilidcrit2 == "after")
$searcheqa = $searcheqa . " > " . $perunilid2;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$titre=$_GET['titre'];
if ($titre)
{
$searcheqa = $searcheqa . $andq . "titre = " . $titre;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$titre=str_ireplace("*","%",$titre);
$titre2=str_ireplace(" ","%",$titre);
$soustitre=$_GET['soustitre'];
if ($soustitre)
{
$searcheqa = $searcheqa . $andq . "soustitre = " . $soustitre;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$soustitre=str_ireplace("*","%",$soustitre);
$soustitre2=str_ireplace(" ","%",$soustitre);
$titreabrege=$_GET['titreabrege'];
if ($titreabrege)
{
$searcheqa = $searcheqa . $andq . "titreabrege = " . $titreabrege;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$titreabrege=str_ireplace("*","%",$titreabrege);
$titreabrege2=str_ireplace(" ","%",$titreabrege);
$variantetitre=$_GET['variantetitre'];
if ($variantetitre)
{
$searcheqa = $searcheqa . $andq . "variantetitre = " . $variantetitre;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$variantetitre=str_ireplace("*","%",$variantetitre);
$variantetitre2=str_ireplace(" ","%",$variantetitre);
$faitsuitea=$_GET['faitsuitea'];
if ($faitsuitea)
{
$searcheqa = $searcheqa . $andq . "faitsuitea = " . $faitsuitea;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$faitsuitea=str_ireplace("*","%",$faitsuitea);
$faitsuitea2=str_ireplace(" ","%",$faitsuitea);
$devient=$_GET['devient'];
if ($devient)
{
$searcheqa = $searcheqa . $andq . "devient = " . $devient;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$devient=str_ireplace("*","%",$devient);
$devient2=str_ireplace(" ","%",$devient);
$editeur=$_GET['editeur'];
if ($editeur)
{
$searcheqa = $searcheqa . $andq . "editeur = " . $editeur;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$editeur=str_ireplace("*","%",$editeur);
$editeur2=str_ireplace(" ","%",$editeur);
$codeediteur=$_GET['codeediteur'];
if ($codeediteur)
{
$searcheqa = $searcheqa . $andq . "codeediteur = " . $codeediteur;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$codeediteur=str_ireplace("*","%",$codeediteur);
$publiunil=$_GET['publiunil'];
if ($publiunil != "")
{
$searcheqa = $searcheqa . $andq . "publiunil = " . $publiunil;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$openaccess=$_GET['openaccess'];
if ($openaccess != "")
{
$searcheqa = $searcheqa . $andq . "openaccess = " . $openaccess;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$issnl=$_GET['issnl'];
if ($issnl)
{
$searcheqa = $searcheqa . $andq . "issnl = " . $issnl;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$issnl=str_ireplace("*","%",$issnl);
$issn=$_GET['issn'];
if ($issn)
{
$searcheqa = $searcheqa . $andq . "issn = " . $issn;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$issn=str_ireplace("*","%",$issn);
$issn2=str_ireplace(" ","%",$issn);
$reroid=$_GET['reroid'];
if ($reroid)
{
$searcheqa = $searcheqa . $andq . "reroid = " . $reroid;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$reroid=str_ireplace("*","%",$reroid);
$nlmid=$_GET['nlmid'];
if ($nlmid)
{
$searcheqa = $searcheqa . $andq . "nlmid = " . $nlmid;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$nlmid=str_ireplace("*","%",$nlmid);
$coden=$_GET['coden'];
if ($coden)
{
$searcheqa = $searcheqa . $andq . "coden = " . $coden;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$coden=str_ireplace("*","%",$coden);
$doi=$_GET['doi'];
if ($doi)
{
$searcheqa = $searcheqa . $andq . "doi = " . $doi;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$doi=str_ireplace("*","%",$doi);
$urn=$_GET['urn'];
if ($urn)
{
$searcheqa = $searcheqa . $andq . "urn = " . $urn;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$urn=str_ireplace("*","%",$urn);
$url=$_GET['url'];
if ($url)
{
$searcheqa = $searcheqa . $andq . "url = " . $url;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$url=str_ireplace("*","%",$url);
$rss=$_GET['rss'];
if ($rss)
{
$searcheqa = $searcheqa . $andq . "rss = " . $rss;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$rss=str_ireplace("*","%",$rss);
$user=$_GET['user'];
if ($user)
{
$searcheqa = $searcheqa . $andq . "user = " . $user;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$user=str_ireplace("*","%",$user);
$pwd=$_GET['pwd'];
if ($pwd)
{
$searcheqa = $searcheqa . $andq . "pwd = " . $pwd;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$pwd=str_ireplace("*","%",$pwd);
$licence=$_GET['licence'];
if ($licence)
{
$searcheqa = $searcheqa . $andq . "licence = " . $licence;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$licence=str_ireplace("*","%",$licence);
$statutabo=$_GET['statutabo'];
if ($statutabo != "")
{
$searcheqa = $searcheqa . $andq . "statutabo = " . $statutabo;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$statutabo=str_ireplace("*","%",$statutabo);
$titreexclu=$_GET['titreexclu'];
if ($titreexclu != "")
{
$searcheqa = $searcheqa . $andq . "titreexclu = " . $titreexclu;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$corecollection=$_GET['corecollection'];
if ($corecollection != "")
{
$searcheqa = $searcheqa . $andq . "corecollection = " . $corecollection;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$plateforme=$_GET['plateforme'];
if ($plateforme)
{
$searcheqa = $searcheqa . $andq . "plateforme = " . $plateforme;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$plateforme=str_ireplace("*","%",$plateforme);
$gestion=$_GET['gestion'];
if ($gestion)
{
$searcheqa = $searcheqa . $andq . "gestion = " . $gestion;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$gestion=str_ireplace("*","%",$gestion);
$historiqueabo=$_GET['historiqueabo'];
if ($historiqueabo)
{
$searcheqa = $searcheqa . $andq . "historiqueabo = " . $historiqueabo;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$historiqueabo=str_ireplace("*","%",$historiqueabo);
$support=$_GET['support'];
if ($support)
{
$searcheqa = $searcheqa . $andq . "support = " . $support;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$support=str_ireplace("*","%",$support);
$format=$_GET['format'];
if ($format)
{
$searcheqa = $searcheqa . $andq . "format = " . $format;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$format=str_ireplace("*","%",$format);
$acceselecunil=$_GET['acceselecunil'];
if ($acceselecunil)
{
$searcheqa = $searcheqa . $andq . "acceselecunil = " . $acceselecunil;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$acceselecchuv=$_GET['acceselecchuv'];
if ($acceselecchuv)
{
$searcheqa = $searcheqa . $andq . "acceselecchuv = " . $acceselecchuv;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$acceseleclibre=$_GET['acceseleclibre'];
if ($acceseleclibre)
{
$searcheqa = $searcheqa . $andq . "acceseleclibre = " . $acceseleclibre;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$package=$_GET['package'];
if ($package)
{
$searcheqa = $searcheqa . $andq . "package = " . $package;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$package=str_ireplace("*","%",$package);
$idediteur=$_GET['idediteur'];
if ($idediteur)
{
$searcheqa = $searcheqa . $andq . "idediteur = " . $idediteur;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$idediteur=str_ireplace("*","%",$idediteur);
$etatcoll=$_GET['etatcoll'];
if ($etatcoll)
{
$searcheqa = $searcheqa . $andq . "etatcoll = " . $etatcoll;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$etatcoll=str_ireplace("*","%",$etatcoll);
$embargo=$_GET['embargo'];
$embargocrit=$_GET['embargocrit'];
if ($embargo)
{
$searcheqa = $searcheqa . $andq . "embargo";
if ($embargocrit == "equal")
$searcheqa = $searcheqa . " = " . $embargo;
if ($embargocrit == "before")
$searcheqa = $searcheqa . " < " . $embargo;
if ($embargocrit == "after")
$searcheqa = $searcheqa . " > " . $embargo;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$embargo=str_ireplace("*","%",$embargo);
$etatcolldeba=$_GET['etatcolldeba'];
if ($etatcolldeba != "")
{
$searcheqa = $searcheqa . $andq . "etatcolldeba = " . $etatcolldeba;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$etatcolldebv=$_GET['etatcolldebv'];
if ($etatcolldebv != "")
{
$searcheqa = $searcheqa . $andq . "etatcolldebv = " . $etatcolldebv;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$etatcolldebf=$_GET['etatcolldebf'];
if ($etatcolldebf != "")
{
$searcheqa = $searcheqa . $andq . "etatcolldebf = " . $etatcolldebf;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$etatcollfina=$_GET['etatcollfina'];
if ($etatcollfina != "")
{
$searcheqa = $searcheqa . $andq . "etatcollfina = " . $etatcollfina;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$etatcollfinv=$_GET['etatcollfinv'];
if ($etatcollfinv != "")
{
$searcheqa = $searcheqa . $andq . "etatcollfinv = " . $etatcollfinv;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$etatcollfinf=$_GET['etatcollfinf'];
if ($etatcollfinf != "")
{
$searcheqa = $searcheqa . $andq . "etatcollfinf = " . $etatcollfinf;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$localisation=$_GET['localisation'];
if ($localisation)
{
$searcheqa = $searcheqa . $andq . "localisation = " . $localisation;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$localisation=str_ireplace("*","%",$localisation);
$cote=$_GET['cote'];
if ($cote)
{
$searcheqa = $searcheqa . $andq . "cote = " . $cote;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$cote=str_ireplace("*","%",$cote);
$commentairepro=$_GET['commentairepro'];
if ($commentairepro)
{
$searcheqa = $searcheqa . $andq . "commentairepro = " . $commentairepro;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$commentairepro=str_ireplace("*","%",$commentairepro);
$commentairepro2=str_ireplace(" ","%",$commentairepro);
$commentairepub=$_GET['commentairepub'];
if ($commentairepub)
{
$searcheqa = $searcheqa . $andq . "commentairepub = " . $commentairepub;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$commentairepub=str_ireplace("*","%",$commentairepub);
$commentairepub2=str_ireplace(" ","%",$commentairepub);
$keywords=$_GET['keywords'];
if ($keywords)
{
$searcheqa = $searcheqa . $andq . "keywords = " . $keywords;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$keywords=str_ireplace("*","%",$keywords);
$keywords2=str_ireplace(" ","%",$keywords);
$sujet=$_GET['theme'];
if ($sujet)
{
$searcheqa = $searcheqa . $andq . "sujet = " . $sujet;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$sujet=str_ireplace("*","%",$sujet);
$sujetsfm=$_GET['sujetsfm'];
if ($sujetsfm)
{
$searcheqa = $searcheqa . $andq . "sujetsfm = " . $sujetsfm;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$sujetsfm=str_ireplace("*","%",$sujetsfm);
$sujetsfm2=str_ireplace(" ","%",$sujetsfm2);
$fmid=$_GET['fmid'];
if ($fmid)
{
$searcheqa = $searcheqa . $andq . "fmid = " . $fmid;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$signaturecreation=$_GET['signaturecreation'];
if ($signaturecreation)
{
$searcheqa = $searcheqa . $andq . "signaturecreation = " . $signaturecreation;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$signaturecreation=str_ireplace("*","%",$signaturecreation);
$signaturemodif=$_GET['signaturemodif'];
if ($signaturemodif)
{
$searcheqa = $searcheqa . $andq . "signaturemodif = " . $signaturemodif;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$signaturemodif=str_ireplace("*","%",$signaturemodif);
$datecreation1=$_GET['datecreation1'];
$datecreationcrit1=$_GET['datecreationcrit1'];
if ($datecreation1)
{
$searcheqa = $searcheqa . $andq . "datecreation";
if ($datecreationcrit1 == "equal")
$searcheqa = $searcheqa . " = " . $datecreation1;
if ($datecreationcrit1 == "before")
$searcheqa = $searcheqa . " < " . $datecreation1;
if ($datecreationcrit1 == "after")
$searcheqa = $searcheqa . " > " . $datecreation1;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$datecreation2=$_GET['datecreation2'];
$datecreationcrit2=$_GET['datecreationcrit2'];
if ($datecreation2)
{
$searcheqa = $searcheqa . $andq . "datecreation";
if ($datecreationcrit2 == "equal")
$searcheqa = $searcheqa . " = " . $datecreation2;
if ($datecreationcrit2 == "before")
$searcheqa = $searcheqa . " < " . $datecreation2;
if ($datecreationcrit2 == "after")
$searcheqa = $searcheqa . " > " . $datecreation2;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$datemodif1=$_GET['datemodif1'];
$datemodifcrit1=$_GET['datemodifcrit1'];
if ($datemodif1)
{
$searcheqa = $searcheqa . $andq . "datemodif";
if ($datemodifcrit1 == "equal")
$searcheqa = $searcheqa . " = " . $datemodif1;
if ($datemodifcrit1 == "before")
$searcheqa = $searcheqa . " < " . $datemodif1;
if ($datemodifcrit1 == "after")
$searcheqa = $searcheqa . " > " . $datemodif1;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$datemodif2=$_GET['datemodif2'];
$datemodifcrit2=$_GET['datemodifcrit2'];
if ($datemodif2)
{
$searcheqa = $searcheqa . $andq . "datemodif";
if ($datemodifcrit2 == "equal")
$searcheqa = $searcheqa . " = " . $datemodif2;
if ($datemodifcrit2 == "before")
$searcheqa = $searcheqa . " < " . $datemodif2;
if ($datemodifcrit2 == "after")
$searcheqa = $searcheqa . " > " . $datemodif2;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$historique=$_GET['historique'];
if ($historique)
{
$searcheqa = $searcheqa . $andq . "historique = " . $historique;
$andq = " ET ";
$searchadmok = $searchadmok + 1;
}
$historique=str_ireplace("*","%",$historique);
$historique2=str_ireplace(" ","%",$historique);
$and = "";
$reqadm = "";
if ($qall)
{
$qall=trim($qall);
$qallstop = clean_search($qall);
if (($qallstop=="")||($qallstop==" "))
{
$qallstop = $qall;
}
$qallstop=str_ireplace("*","%",$qallstop);
$qall1=str_ireplace(" ","%",$qallstop);
$startespaceqall = stripos($qallstop, " ");
if ($startespaceqall !== false)
{
$ktqall=split(" ",$qallstop);
while(list($keyqall,$valqall)=each($ktqall))
{
if($valqall<>" " and strlen($valqall) > 0)
{
$qall2 .= "(perunilid LIKE '%$valqall%' OR titre LIKE '%$valqall%' OR titreabrege LIKE '%$valqall%' OR variantetitre LIKE '%$valqall%' OR soustitre LIKE '%$valqall%' OR issn LIKE '%$valqall%' OR issnl LIKE '%$valqall%' OR nlmid LIKE '%$valqall%' OR reroid LIKE '%$valqall%' OR doi LIKE '%$valqall%' OR coden LIKE '%$valqall%' OR urn LIKE '%$valqall%' OR faitsuitea LIKE '%$valqall%' OR devient LIKE '%$valqall%' OR editeur LIKE '%$valqall%' OR etatcoll LIKE '%$valqall%' OR url LIKE '%$valqall%' OR rss LIKE '%$valqall%' OR licence LIKE '%$valqall%' OR plateforme LIKE '%$valqall%' OR gestion LIKE '%$valqall%' OR historiqueabo LIKE '%$valqall%' OR cote LIKE '%$valqall%' OR localisation LIKE '%$valqall%' OR user LIKE '%$valqall%' OR keywords LIKE '%$valqall%' OR commentairepub LIKE '%$valqall%' OR commentairepro LIKE '%$valqall%' OR package LIKE '%$valqall%' OR corecollection LIKE '%$valqall%' OR idediteur LIKE '%$valqall%' OR codeediteur LIKE '%$valqall%') AND ";
}
}
$qall2=substr($qall2,0,(strlen($qall2)-4));
}
else
$qall2= "(perunilid LIKE '%$qall1%' OR titre LIKE '%$qall1%' OR titreabrege LIKE '%$qall1%' OR variantetitre LIKE '%$qall1%' OR soustitre LIKE '%$qall1%' OR issn LIKE '%$qall1%' OR issnl LIKE '%$qall1%' OR nlmid LIKE '%$qall1%' OR reroid LIKE '%$qall1%' OR doi LIKE '%$qall1%' OR coden LIKE '%$qall1%' OR urn LIKE '%$qall1%' OR faitsuitea LIKE '%$qall1%' OR devient LIKE '%$qall1%' OR editeur LIKE '%$qall1%' OR etatcoll LIKE '%$qall1%' OR url LIKE '%$qall1%' OR rss LIKE '%$qall1%' OR licence LIKE '%$qall1%' OR plateforme LIKE '%$qall1%' OR gestion LIKE '%$qall1%' OR historiqueabo LIKE '%$qall1%' OR cote LIKE '%$qall1%' OR localisation LIKE '%$qall1%' OR user LIKE '%$qall1%' OR keywords LIKE '%$qall1%' OR commentairepub LIKE '%$qall1%' OR commentairepro LIKE '%$qall1%' OR package LIKE '%$qall1%' OR corecollection LIKE '%$qall1%' OR idediteur LIKE '%$qall1%' OR codeediteur LIKE '%$qall1%')";
$reqadm = "($qall2)";
$and = " AND ";
}
if ($title)
{
if (($field != "tbegin")&&($field != "texact"))
{
$reqadm = $reqadm . $and . "($title2)";
$and = " AND ";
}
else
{
$mapostitle = strpos($title, "the ");
if (($mapostitle = 0) && (strlen($title)>7))
$titlesanst = substr($title,4,(strlen($title)));
else
$titlesanst = $title;
$titleavect = "the " . $title;
$titleavectf = $title . ", the";
$titleavectf2 = $title . " (the)";
$titleavectf3 = $titlesanst . " (the)";
$titleavectf4 = $titlesanst . ", the";
$titleandv1 = str_ireplace(" & "," and ",$title);
$titleandv2 = str_ireplace(" and "," & ",$title);
$titleavecs = $title . " :";
$titleavecm = $title . " /";
$titleavectp = $title . " =";
if ($field == "tbegin")
{
$reqadm = $reqadm . $and . "(titre LIKE '$title%' OR titre LIKE '$titlesanst%' OR titre LIKE '$titleavect%' OR titre LIKE '$titleandv1%' OR titre LIKE '$titleandv2%')";
$and = " AND ";
}
if ($field == "texact")
{
$reqadm = $reqadm . $and . "(titre LIKE '$title' OR titre LIKE '$titlesanst' OR titre LIKE '$titleavect' OR titre LIKE '$titleavectf' OR titre LIKE '$titleavectf2' OR titre LIKE '$titleavectf3' OR titre LIKE '$titleavectf4' OR titre LIKE '$titleavecs%' OR titre LIKE '$titleavecm%' OR titre LIKE '$titleavectp%' OR titre LIKE '$titleandv1' OR titre LIKE '$titleandv2')";
$and = " AND ";
}
}
}
if ($perunilid1)
{
if ($perunilidcrit1 == "equal")
$reqadm = $reqadm . $and . "(perunilid = $perunilid1)";
if ($perunilidcrit1 == "before")
$reqadm = $reqadm . $and . "(perunilid < $perunilid1)";
if ($perunilidcrit1 == "after")
$reqadm = $reqadm . $and . "(perunilid > $perunilid1)";
$and = " AND ";
}
if ($perunilid2)
{
if ($perunilidcrit2 == "equal")
$reqadm = $reqadm . $and . "(perunilid = $perunilid2)";
if ($perunilidcrit2 == "before")
$reqadm = $reqadm . $and . "(perunilid < $perunilid2)";
if ($perunilidcrit2 == "after")
$reqadm = $reqadm . $and . "(perunilid > $perunilid2)";
$and = " AND ";
}
if ($titre)
{
$reqadm = $reqadm . $and . "(titre LIKE '%$titre2%')";
$and = " AND ";
}
if ($soustitre)
{
$reqadm = $reqadm . $and . "(soustitre LIKE '%$soustitre2%')";
$and = " AND ";
}
if ($titreabrege)
{
$reqadm = $reqadm . $and . "(titreabrege LIKE '%$titreabrege2%')";
$and = " AND ";
}
if ($variantetitre)
{
$reqadm = $reqadm . $and . "(variantetitre LIKE '%$variantetitre2%')";
$and = " AND ";
}
if ($faitsuitea)
{
$reqadm = $reqadm . $and . "(faitsuitea LIKE '%$faitsuitea2%')";
$and = " AND ";
}
if ($devient)
{
$reqadm = $reqadm . $and . "(devient LIKE '%$devient2%')";
$and = " AND ";
}
if ($editeur)
{
$reqadm = $reqadm . $and . "(editeur LIKE '%$editeur2%')";
$and = " AND ";
}
if ($codeediteur)
{
$reqadm = $reqadm . $and . "(codeediteur LIKE '$codeediteur')";
$and = " AND ";
}
if ($publiunil != "")
{
$reqadm = $reqadm . $and . "(publiunil = $publiunil)";
$and = " AND ";
}
if ($openaccess != "")
{
$reqadm = $reqadm . $and . "(openaccess LIKE '$openaccess')";
$and = " AND ";
}
if ($issnl)
{
$reqadm = $reqadm . $and . "(issnl LIKE '$issnl')";
$and = " AND ";
}
if ($issn)
{
$reqadm = $reqadm . $and . "(issn LIKE '%$issn%')";
$and = " AND ";
}
if ($reroid)
{
$reqadm = $reqadm . $and . "(reroid LIKE '$reroid')";
$and = " AND ";
}
if ($nlmid)
{
$reqadm = $reqadm . $and . "(nlmid LIKE '$nlmid')";
$and = " AND ";
}
if ($coden)
{
$reqadm = $reqadm . $and . "(coden LIKE '$coden')";
$and = " AND ";
}
if ($doi)
{
$reqadm = $reqadm . $and . "(doi LIKE '$doi')";
$and = " AND ";
}
if ($urn)
{
$reqadm = $reqadm . $and . "(urn LIKE '$urn')";
$and = " AND ";
}
if ($url)
{
$reqadm = $reqadm . $and . "(url LIKE '%$url%')";
$and = " AND ";
}
if ($rss)
{
$reqadm = $reqadm . $and . "(rss LIKE '%$rss%')";
$and = " AND ";
}
if ($user)
{
$reqadm = $reqadm . $and . "(user LIKE '$user')";
$and = " AND ";
}
if ($pwd)
{
$reqadm = $reqadm . $and . "(pwd LIKE '$pwd')";
$and = " AND ";
}
if ($licence)
{
$reqadm = $reqadm . $and . "(licence LIKE '$licence')";
$and = " AND ";
}
if ($statutabo != "")
{
$reqadm = $reqadm . $and . "(statutabo = $statutabo)";
$and = " AND ";
}
if ($titreexclu != "")
{
$reqadm = $reqadm . $and . "(titreexclu = $titreexclu)";
$and = " AND ";
}
if ($corecollection != "")
{
$reqadm = $reqadm . $and . "(corecollection = $corecollection)";
$and = " AND ";
}
if ($plateforme)
{
$reqadm = $reqadm . $and . "(plateforme LIKE '$plateforme')";
$and = " AND ";
}
if ($gestion)
{
$reqadm = $reqadm . $and . "(gestion LIKE '$gestion')";
$and = " AND ";
}
if ($historiqueabo)
{
$reqadm = $reqadm . $and . "(historiqueabo LIKE '$historiqueabo')";
$and = " AND ";
}
if ($support)
{
$reqadm = $reqadm . $and . "(support LIKE '$support')";
$and = " AND ";
}
if ($format)
{
$reqadm = $reqadm . $and . "(format LIKE '$format')";
$and = " AND ";
}
if ($acceselecunil)
{
$reqadm = $reqadm . $and . "(acceselecunil = $acceselecunil)";
$and = " AND ";
}
if ($acceselecchuv)
{
$reqadm = $reqadm . $and . "(acceselecchuv = $acceselecchuv)";
$and = " AND ";
}
if ($acceseleclibre)
{
$reqadm = $reqadm . $and . "(acceseleclibre = $acceseleclibre)";
$and = " AND ";
}
if ($package)
{
$reqadm = $reqadm . $and . "(package LIKE '$package')";
$and = " AND ";
}
if ($idediteur)
{
$reqadm = $reqadm . $and . "(idediteur LIKE '$idediteur')";
$and = " AND ";
}
if ($etatcoll)
{
$reqadm = $reqadm . $and . "(etatcoll LIKE '%$etatcoll%')";
$and = " AND ";
}
if ($embargo)
{
if ($embargocrit == "equal")
$reqadm = $reqadm . $and . "(embargo = $embargo)";
if ($embargocrit == "before")
$reqadm = $reqadm . $and . "(embargo < $embargo)";
if ($embargocrit == "after")
$reqadm = $reqadm . $and . "(embargo > $embargo)";
$and = " AND ";
}
if ($etatcolldeba != "")
{
$reqadm = $reqadm . $and . "(etatcolldeba = $etatcolldeba)";
$and = " AND ";
}
if ($etatcolldebv != "")
{
$reqadm = $reqadm . $and . "(etatcolldebv = $etatcolldebv)";
$and = " AND ";
}
if ($etatcolldebf != "")
{
$reqadm = $reqadm . $and . "(etatcolldebf = $etatcolldebf)";
$and = " AND ";
}
if ($etatcollfina != "")
{
$reqadm = $reqadm . $and . "(etatcollfina = $etatcollfina)";
$and = " AND ";
}
if ($etatcollfinv != "")
{
$reqadm = $reqadm . $and . "(etatcollfinv = $etatcollfinv)";
$and = " AND ";
}
if ($etatcollfinf != "")
{
$reqadm = $reqadm . $and . "(etatcollfinf = $etatcollfinf)";
$and = " AND ";
}
if ($localisation)
{
$reqadm = $reqadm . $and . "(localisation LIKE '$localisation')";
$and = " AND ";
}
if ($cote)
{
$reqadm = $reqadm . $and . "(cote LIKE '%$cote%')";
$and = " AND ";
}
if ($commentairepro)
{
$reqadm = $reqadm . $and . "(commentairepro LIKE '%$commentairepro2%')";
$and = " AND ";
}
if ($commentairepub)
{
$reqadm = $reqadm . $and . "(commentairepub LIKE '%$commentairepub2%')";
$and = " AND ";
}
if ($keywords)
{
$reqadm = $reqadm . $and . "(keywords LIKE '%$keywords2%')";
$and = " AND ";
}
if ($sujet)
{
$reqadm = $reqadm . $and . "(journals_sujets.sujetsid LIKE '$sujet')";
$and = " AND ";
}
if ($sujetsfm)
{
$reqadm = $reqadm . $and . "(sujetsfm LIKE '%$sujetsfm2%')";
$and = " AND ";
}
if ($fmid)
{
$reqadm = $reqadm . $and . "(fmid = $fmid)";
$and = " AND ";
}
if ($signaturecreation)
{
$reqadm = $reqadm . $and . "(signaturecreation LIKE '$signaturecreation')";
$and = " AND ";
}
if ($signaturemodif)
{
$reqadm = $reqadm . $and . "(signaturemodif LIKE '$signaturemodif')";
$and = " AND ";
}
if ($datecreation1)
{
if ($datecreationcrit1 == "equal")
$reqadm = $reqadm . $and . "(datecreation LIKE '$datecreation1%')";
if ($datecreationcrit1 == "before")
$reqadm = $reqadm . $and . "(datecreation < '$datecreation1')";
if ($datecreationcrit1 == "after")
$reqadm = $reqadm . $and . "(datecreation > '$datecreation1')";
$and = " AND ";
}
if ($datecreation2)
{
if ($datecreationcrit2 == "equal")
$reqadm = $reqadm . $and . "(datecreation LIKE '$datecreation2%')";
if ($datecreationcrit2 == "before")
$reqadm = $reqadm . $and . "(datecreation < '$datecreation2')";
if ($datecreationcrit2 == "after")
$reqadm = $reqadm . $and . "(datecreation > '$datecreation2')";
$and = " AND ";
}
if ($datemodif1)
{
if ($datemodifcrit1 == "equal")
$reqadm = $reqadm . $and . "(datemodif LIKE '$datemodif1%')";
if ($datemodifcrit1 == "before")
$reqadm = $reqadm . $and . "(datemodif < '$datemodif1')";
if ($datemodifcrit1 == "after")
$reqadm = $reqadm . $and . "(datemodif > '$datemodif1')";
$and = " AND ";
}
if ($datemodif2)
{
if ($datemodifcrit2 == "equal")
$reqadm = $reqadm . $and . "(datemodif LIKE '$datemodif2%')";
if ($datemodifcrit2 == "before")
$reqadm = $reqadm . $and . "(datemodif < '$datemodif2')";
if ($datemodifcrit2 == "after")
$reqadm = $reqadm . $and . "(datemodif > '$datemodif2')";
$and = " AND ";
}
if ($historique)
{
$reqadm = $reqadm . $and . "(historique LIKE '%$historique2%')";
$and = " AND ";
}
if ($reqadm!="")
{
if($export == "yes")
{
$max_results = 10000;
$from = 0;
}
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadm . ") GROUP BY journals.perunilid ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadm . ") GROUP BY journals.perunilid";
if ($collapse == "1")
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadm . ") GROUP BY journals.perunilid, journals.titre, journals.support ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadm . ") GROUP BY journals.perunilid, journals.titre, journals.support";
}
$pagetitle = "PérUnil : résultats de la recherche administrateur '" . $searcheqa . "'";
if($export == "yes")
{
require ("headerexport.php");
}
else
{
require ("header.php");
require ("menurech.php");
}
$result2 = mysql_query($req2,$link);
$total_results = mysql_num_rows($result2);
$result = mysql_query($req,$link);
$nb = mysql_num_rows($result);
$total_pages = ceil($total_results / $max_results);
}
else
{
$pagetitle = "PérUnil : résultats de la recherche administrateur";
require ("header.php");
require ("menurech.php");
$total_results = 0;
}
}
// ******************************
// ******************************
// ******************************
// fin de la recherche administrateur
// début de la recherche avancée
// ******************************
// ******************************
// ******************************
if ($recherchetype=="advanced")
{
//
// Split de la chaine de recherche title pour les combinaisons dans les differents ordres
//
if ($title)
{
$title=trim($title);
$tstop = clean_search($title);
if (($tstop=="")||($tstop==" "))
{
$tstop = $title;
}
$tstop=str_ireplace("*","%",$tstop);
$title1=str_ireplace(" ","%",$tstop);
$startespace = stripos($tstop, " ");
if ($startespace !== false)
{
$kt=split(" ",$tstop);
while(list($key,$val)=each($kt))
{
if($val<>" " and strlen($val) > 0)
{
$title2 .= "(titre LIKE '%$val%' OR titreabrege LIKE '%$val%' OR variantetitre LIKE '%$val%' OR soustitre LIKE '%$val%') AND ";
}
}
$title2=substr($title2,0,(strlen($title2)-4));
}
else
$title2="(titre LIKE '%$title1%' OR titreabrege LIKE '%$title1%' OR variantetitre LIKE '%$title1%' OR soustitre LIKE '%$$title1%' OR issn LIKE '%$$title1%' OR issnl LIKE '%$$title1%')";;
}
$field=$_GET['field'];
$publisher=$_GET['publisher'];
if ($publisher)
{
$searcheq = $searcheq . $andq . "editeur = " . $publisher;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$publisher=str_ireplace("*","%",$publisher);
$publisher2=str_ireplace(" ","%",$publisher);
$issn=$_GET['issn'];
if ($issn)
{
$searcheq = $searcheq . $andq . "ISSN = " . $issn;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$format=$_GET['format'];
if ($format=="e")
{
$searcheq = $searcheq . $andq . "format = électronique";
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
if ($format=="p")
{
$searcheq = $searcheq . $andq . "format = papier";
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
if ($format == "")
{
$format = "all";
}
if ($nodpl=="yes")
{
$searcheq = $searcheq . $andq . "exclusion du dépôt légal VD = oui";
$andq = " ET ";
}
$platform=$_GET['platform'];
if ($platform)
{
$searcheq = $searcheq . $andq . "plateforme = " . $platform;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$platform=str_ireplace("*","%",$platform);
$platform2=str_ireplace(" ","%",$platform);
$licence=$_GET['licence'];
if ($licence)
{
$searcheq = $searcheq . $andq . "licence = " . $licence;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$licence=str_ireplace("*","%",$licence);
$licence2=str_ireplace(" ","%",$licence);
$accessunil=$_GET['accessunil'];
$accesschuv=$_GET['accesschuv'];
$accesslibre=$_GET['accesslibre'];
if (($accessunil=="1") && ($accesslibre!="1"))
{
$searcheq = $searcheq . $andq . "accès libre = non";
$andq = " ET ";
}
if (($accessunil!="1") && ($accesslibre=="1"))
{
$searcheq = $searcheq . $andq . "accès Unil / CHUV = non";
$andq = " ET ";
}
$oa=$_GET['oa'];
$statut=$_GET['statut'];
if ($statut != "")
{
$searcheq = $searcheq . $andq . "abonnement = " . $statut;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$localisation=$_GET['localisation'];
if ($localisation)
{
$searcheq = $searcheq . $andq . "localisation = " . $localisation;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$localisation=str_ireplace("*","%",$localisation);
$localisation2=str_ireplace(" ","%",$localisation);
$cote=$_GET['cote'];
if ($cote)
{
$searcheq = $searcheq . $andq . "cote = " . $cote;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$cote=str_ireplace("*","%",$cote);
$cote2=str_ireplace(" ","%",$cote);
$sujet=$_GET['sujet'];
if ($sujet)
{
$searcheq = $searcheq . $andq . "thème = " . $sujet;
$andq = " ET ";
$searchadvok = $searchadvok + 1;
}
$and = "";
$reqadv = "";
if ($qall)
{
$qall=trim($qall);
$qallstop = clean_search($qall);
if (($qallstop=="")||($qallstop==" "))
{
$qallstop = $qall;
}
$qallstop=str_ireplace("*","%",$qallstop);
$qall1=str_ireplace(" ","%",$qallstop);
$startespaceqall = stripos($qallstop, " ");
if ($startespaceqall !== false)
{
$ktqall=split(" ",$qallstop);
while(list($keyqall,$valqall)=each($ktqall))
{
if($valqall<>" " and strlen($valqall) > 0)
{
$qall2 .= "(perunilid LIKE '%$valqall%' OR titre LIKE '%$valqall%' OR titreabrege LIKE '%$valqall%' OR variantetitre LIKE '%$valqall%' OR soustitre LIKE '%$valqall%' OR issn LIKE '%$valqall%' OR issnl LIKE '%$valqall%' OR nlmid LIKE '%$valqall%' OR reroid LIKE '%$valqall%' OR doi LIKE '%$valqall%' OR coden LIKE '%$valqall%' OR urn LIKE '%$valqall%' OR faitsuitea LIKE '%$valqall%' OR devient LIKE '%$valqall%' OR editeur LIKE '%$valqall%' OR etatcoll LIKE '%$valqall%' OR url LIKE '%$valqall%' OR rss LIKE '%$valqall%' OR licence LIKE '%$valqall%' OR plateforme LIKE '%$valqall%' OR gestion LIKE '%$valqall%' OR historiqueabo LIKE '%$valqall%' OR cote LIKE '%$valqall%' OR localisation LIKE '%$valqall%' OR user LIKE '%$valqall%' OR keywords LIKE '%$valqall%' OR commentairepub LIKE '%$valqall%' OR commentairepro LIKE '%$valqall%' OR package LIKE '%$valqall%' OR corecollection LIKE '%$valqall%' OR idediteur LIKE '%$valqall%' OR codeediteur LIKE '%$valqall%') AND ";
}
}
$qall2=substr($qall2,0,(strlen($qall2)-4));
}
else
$qall2= "(perunilid LIKE '%$qall1%' OR titre LIKE '%$qall1%' OR titreabrege LIKE '%$qall1%' OR variantetitre LIKE '%$qall1%' OR soustitre LIKE '%$qall1%' OR issn LIKE '%$qall1%' OR issnl LIKE '%$qall1%' OR nlmid LIKE '%$qall1%' OR reroid LIKE '%$qall1%' OR doi LIKE '%$qall1%' OR coden LIKE '%$qall1%' OR urn LIKE '%$qall1%' OR faitsuitea LIKE '%$qall1%' OR devient LIKE '%$qall1%' OR editeur LIKE '%$qall1%' OR etatcoll LIKE '%$qall1%' OR url LIKE '%$qall1%' OR rss LIKE '%$qall1%' OR licence LIKE '%$qall1%' OR plateforme LIKE '%$qall1%' OR gestion LIKE '%$qall1%' OR historiqueabo LIKE '%$qall1%' OR cote LIKE '%$qall1%' OR localisation LIKE '%$qall1%' OR user LIKE '%$qall1%' OR keywords LIKE '%$qall1%' OR commentairepub LIKE '%$qall1%' OR commentairepro LIKE '%$qall1%' OR package LIKE '%$qall1%' OR corecollection LIKE '%$qall1%' OR idediteur LIKE '%$qall1%' OR codeediteur LIKE '%$qall1%')";
$reqadv = "($qall2)";
$and = " AND ";
}
if ($title)
{
if (($field != "tbegin")&&($field != "texact"))
{
$reqadv = $reqadv . $and . "($title2)";
$and = " AND ";
}
else
{
$mapostitle = strpos($title, "the ");
if (($mapostitle = 0) && (strlen($title)>7))
$titlesanst = substr($title,4,(strlen($title)));
else
$titlesanst = $title;
$titleavect = "the " . $title;
$titleavectf = $title . ", the";
$titleavectf2 = $title . " (the)";
$titleavectf3 = $titlesanst . " (the)";
$titleavectf4 = $titlesanst . ", the";
$titleandv1 = str_ireplace(" & "," and ",$title);
$titleandv2 = str_ireplace(" and "," & ",$title);
$titleavecs = $title . " :";
$titleavecm = $title . " /";
$titleavectp = $title . " =";
if ($field == "tbegin")
{
$reqadv = $reqadv . $and . "(titre LIKE '$title%' OR titre LIKE '$titlesanst%' OR titre LIKE '$titleavect%' OR titre LIKE '$titleandv1%' OR titre LIKE '$titleandv2%')";
$and = " AND ";
}
if ($field == "texact")
{
$reqadv = $reqadv . $and . "(titre LIKE '$title' OR titre LIKE '$titlesanst' OR titre LIKE '$titleavect' OR titre LIKE '$titleavectf' OR titre LIKE '$titleavectf2' OR titre LIKE '$titleavectf3' OR titre LIKE '$titleavectf4' OR titre LIKE '$titleavecs%' OR titre LIKE '$titleavecm%' OR titre LIKE '$titleavectp%' OR titre LIKE '$titleandv1' OR titre LIKE '$titleandv2')";
$and = " AND ";
}
}
}
if ($publisher)
{
$reqadv = $reqadv . $and . "(editeur LIKE '%$publisher2%')";
$and = " AND ";
}
if ($issn)
{
$reqadv = $reqadv . $and . "(issn LIKE '%$issn%')";
$and = " AND ";
}
if ($format == "p")
{
$reqadv = $reqadv . $and . "(support LIKE 'papier')";
$and = " AND ";
}
if ($format == "e")
{
$reqadv = $reqadv . $and . "(support LIKE 'electronique')";
$and = " AND ";
}
if ($platform)
{
$reqadv = $reqadv . $and . "(plateforme LIKE '%$platform2%')";
$and = " AND ";
}
if ($licence)
{
$reqadv = $reqadv . $and . "(licence LIKE '$licence')";
$and = " AND ";
}
if (($accesslibre != "1")&&($accessunil == "1"))
{
$reqadv = $reqadv . $and . "(acceselecunil LIKE '1' OR acceselecchuv LIKE '1')";
$and = " AND ";
}
if (($accesslibre == "1")&&($accessunil != "1"))
{
$reqadv = $reqadv . $and . "(acceseleclibre LIKE '1' OR openaccess LIKE '1')";
$and = " AND ";
}
// if ($oa == "1")
// {
// $reqadv = $reqadv . $and . "(openaccess LIKE '1')";
// $and = " AND ";
// }
if ($statut != "")
{
$reqadv = $reqadv . $and . "(statutabo LIKE '$statut')";
$and = " AND ";
}
if ($localisation)
{
$reqadv = $reqadv . $and . "(localisation LIKE '%$localisation2%')";
$and = " AND ";
}
if ($cote)
{
$reqadv = $reqadv . $and . "(cote LIKE '%$cote2%')";
$and = " AND ";
}
if ($sujet)
{
$reqadv = $reqadv . $and . "(journals_sujets.sujetsid LIKE '$sujet')";
$and = " AND ";
}
if ($nodpl == "yes")
{
$reqadv = $reqadv . $and . "(localisation IS NULL OR localisation NOT LIKE '%depot legal%')";
$and = " AND ";
}
if ($reqadv!="")
{
if (($monaut != "admin")&&($monaut != "sadmin")&&($monaut != "user"))
$reqadv = $reqadv . " AND titreexclu = 0";
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadv . ") GROUP BY journals.perunilid ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadv . ") GROUP BY journals.perunilid";
if ($collapse == "1")
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadv . ") GROUP BY journals.perunilid, journals.titre, journals.support ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (" . $reqadv . ") GROUP BY journals.perunilid, journals.titre, journals.support";
}
$pagetitle = "PérUnil : résultats de la recherche avancée '" . $searcheq . "'";
require ("header.php");
require ("menurech.php");
$result2 = mysql_query($req2,$link);
$total_results = mysql_num_rows($result2);
$result = mysql_query($req,$link);
$nb = mysql_num_rows($result);
$total_pages = ceil($total_results / $max_results);
}
else
{
$pagetitle = "PérUnil : résultats de la recherche avancée";
require ("header.php");
require ("menurech.php");
$total_results = 0;
}
}
// ******************************
// ******************************
// ******************************
// fin de la recherche avancée
// début de la recherche sujets
// ******************************
// ******************************
// ******************************
if ($recherchetype=="subject")
{
$sujet=$_GET['subject'];
$sujetname=$_GET['sname'];
$sujetcode=$_GET['scode'];
if ($sujet != '')
{
if (($monaut == "admin")||($monaut == "sadmin")||($monaut == "user"))
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid";
if ($collapse == "1")
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid, journals.titre, journals.support ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid, journals.titre, journals.support";
}
}
else
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid";
if ($collapse == "1")
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid, journals.titre, journals.support ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid, journals.titre, journals.support";
}
}
}
else
{
$reqsubject = "SELECT * FROM sujets WHERE sujetscode LIKE '$sujetcode'";
$resultsubject = mysql_query($reqsubject,$link);
$nbsubject = mysql_num_rows($resultsubject);
if ($nbsubject == 1)
{
$enregsubject = mysql_fetch_array($resultsubject);
$sujet = $enregsubject['sujetsid'];
$sujetname = $enregsubject['sujetsfr'];
if (($monaut == "admin")||($monaut == "sadmin")||($monaut == "user"))
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid";
if ($collapse == "1")
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid, journals.titre, journals.support ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') GROUP BY journals.perunilid, journals.titre, journals.support";
}
}
else
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid";
if ($collapse == "1")
{
$req = "SELECT * FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid, journals.titre, journals.support ORDER BY titre,support ASC LIMIT $from, $max_results";
$req2 = "SELECT perunilid FROM journals LEFT JOIN journals_sujets USING (perunilid) WHERE (journals_sujets.sujetsid LIKE '$sujet') AND titreexclu = 0 GROUP BY journals.perunilid, journals.titre, journals.support";
}
}
}
}
$pagetitle = "PérUnil : périodiques sur le thème '" . $sujetname . "'";
require ("header.php");
require ("menurech.php");
echo "
\n";
echo "
Titre | \n"; if ($collapse != "1") { echo "Etat de la collection | \n"; echo "Plateforme / Dépôt | \n"; echo "\n"; echo " | \n"; if (($monaut == "admin")||($monaut == "sadmin")||($monaut == "user")) { echo " | \n"; } } echo " | |
---|---|---|---|---|---|---|
"; else echo " | ";
if ($support == "papier")
echo "![]() ![]() ![]() ![]() \n";
echo substr($titrelong, 0, $posw);
echo " [...]\n";
echo " \n";
echo "\n";
if ($url && $support != 'papier')
{
echo "";
}
echo $titrelong;
if ($url && $support != 'papier')
echo "";
// echo " \n";
}
else
echo $titrelong;
}
else
echo $titrelong;
if ($url && $support != 'papier')
echo "";
// else
// echo " ![]() ![]() | \n";
echo "\n";
echo "";
if (strlen($etatcoll) > 40)
{
$posw = strpos($etatcoll, '|', 0);
if ($posw)
{
echo " \n";
echo substr($etatcoll, 0, $posw);
echo " [...]\n";
echo " \n";
echo "\n";
}
else
echo $etatcoll."\n";
}
else
echo $etatcoll."\n";
if ($statutabo == 4)
echo " [Négociation en cours]";
if ($titreexclu == '1')
echo " [TITRE EXCLU DE LA LICENCE]";
echo " | \n";
echo ""; if ($support == "papier") { echo "" . $localisation . "\n"; if ($localisation == "") echo str_ireplace("Abo ","",str_ireplace("gratuit","Accès libre",$licence)) . "\n"; } else { if ($plateforme == "") echo str_ireplace("Abo ","",str_ireplace("gratuit","Accès libre",$licence)) . "\n"; else echo $plateforme."\n"; } echo " | \n"; echo "";
if ($openaccess == 1)
echo "![]() ![]() ![]() password : " . $pwd . "]\n"; } } echo " | \n";
echo "![]() | ";
if (($monaut == "admin")||($monaut == "sadmin")||($monaut == "user"))
{
echo "![]() | ";
}
echo "