
<center><?php
if(isset($_POST['motcle'])) {
$base_Newscom = 'http://www.manga-news.com/index.php/rechercheplus/?action=adsearch&q=';

$motcle = stripslashes($_POST['motcle']);

// on remplace les caractères spéciaux
$motcle = str_replace(array('à','á','â','ã','ä','å'),'a',$motcle);
$motcle = str_replace(array('ò','ó','ô','õ','ö','ø'),'o',$motcle);
$motcle = str_replace(array('è','é','ê','ë'),'e',$motcle);
$motcle = str_replace('ç','c',$motcle);
$motcle = str_replace(array('ì','í','î','ï'),'i',$motcle);
$motcle = str_replace(array('ù','ú','û','ü'),'u',$motcle);
$motcle = str_replace('ÿ','y',$motcle);
$motcle = str_replace('ñ','n',$motcle);
$motcle = str_replace('É','E',$motcle);
$motcle = str_replace('Ç','C',$motcle);
$motcle = str_replace('E','E',$motcle);
// passage des majuscule en minuscule
$motcle = strtolower($motcle);

$search_list = explode("\n", htmlentities($motcle));
$tmp = 0;

foreach($search_list as $search_string) {

	$url_Newscom = $base_Newscom . $search_string . '&dvdvolume=1&volumeVO=1';
    $url_Newscom = str_replace(" ","+",$url_Newscom);
	
	list($mangas,$erreur) = getListMangasNewscom($url_Newscom);


	if(!empty($mangas)) {
				  
		  echo '<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                  <td height="91" valign="bottom" background="./images/img_manga/f_manga_h.png"></td></tr><tr>
                  <td background="./images/img_manga/f_manga_c.png">
				  <h4 class="dvd">Dans les volumes DVD</h4>';

		foreach($mangas as $unManga)
		{
		  
		  echo '<div class="mangas"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                <td>'.$unManga['categorie'].'</td>
                </tr>
                <tr>
                <td><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                <td><ul class="liste_mangas"><li>&nbsp;' . $unManga['titre'] . '</td><td width="30" align="center"><a href="http://www.manga-news.com/index.php/' . $unManga['id'] . '" target="_blank">
				<img src="images/fiche_manga.gif" title="Voir la Fiche Compl&egrave;te sur mangas-news.com" width="12" height="12" border="0"></a></td>
                <td><form name="mangas" id="info" action="?page=mangas&action=info" method="post"><input type="hidden" name="mangainfo[' . $tmp . '][titre]" value="' . $unManga['titre'] . '"><input type="hidden" name="mangainfo[' . $tmp . '][id]" value="' . $unManga['id'] . '"><input type="image" src="images/ok_jeu.png" border="0" name="' . $unManga['id'] . '" title="Selectionner cette Fiche" onmouseover="javascript:this.src=\'images/ok_jeu1.png\';" onmouseout="javascript:this.src=\'images/ok_jeu.png\';"></form></li></ul></td>
                </tr>
                </table></td>
                </tr>
                </table></div>';

		$tmp++;
		
		}	
echo '<br></td></tr><tr><td height="13" class="f_manga_b"></td></tr></table>';
	}else{
		if(!empty($erreur)) {
		echo '<center><meta http-equiv="Refresh" content="5;URL='.$PHP_SELF.'?page=mangas">
              <div style="background-color:#FFCCCC; border:#000000 1px double; width:100%">
              <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
              <td align="center" valign="middle"><img src="./images/Panneauattention.png" hspace="10" vspace="10" border="0"></td>
              <td width="100%" align="center" valign="middle"><p>! --- ### ATTENTION ### --- !</p>
              <p>Une erreur s\'est produite, Veuillez nous en escuser ....</p>
			  <p>&raquo; La cause de cette erreur est certainement due au serveur interne de FREE</p>
			  <p>&raquo; Veuillez patientez le temp de la maintenance des techniciens de FREE et utiliser la version Prez-Manuelle</p>
              <p>( Redirection dans 5 secondes)</p></td>
              <td align="center" valign="middle"><img src="./images/Panneauattention.png" hspace="10" vspace="10" border="0"></td>
              </tr>
              </table>
              </div></center>';
			  

	}else {
	
	echo '<center><meta http-equiv="Refresh" content="5;URL='.$PHP_SELF.'?page=mangas">
          <div style="background-color:#FFCCCC; border:#000000 1px dashed; width:100%">
          <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
          <td align="center" valign="middle"><img src="./images/Aide.png" hspace="10" vspace="10" border="0"></td>
          <td width="100%" align="center" valign="middle"><p>! --- ### ATTENTION ### --- !</p>
          <p>&quot; Vous avez specifi&eacute; un mot cl&eacute; incorrect , ou il n\'existe pas &quot;</p>
          <p>Veuillez retaper un mot cl&eacute; svp ...</p>
          <p>( Redirection dans 5 secondes)</p></td>
          <td align="center" valign="middle"><img src="./images/Aide.png" hspace="10" vspace="10" border="0"></td>
          </tr>
          </table>
          </div></center>';
		
	}
	}
	
	echo '</fieldset><br />';
}
}else{ echo '<meta http-equiv="Refresh" content="1;URL='.$PHP_SELF.'?page=mangas">';}
?>
</center>