/* Version 2.5 / 12152006 - Suite à migration Violet */ require_once( 'configuration.php' ); if ($MaLangue == "FR") { $LibTitle_1 = "Un Message pour"; $LibTitle_2 = ", mon Nabaztag !"; $LibIco_1 = "Vers Text to Speech"; $LibIco_2 = "Vers Clins d'oeil"; $LibMessage = "Message"; $LibSignature = "Signature"; $LibClindoeil = "Clin d'oeil"; $LibOreilles = "Oreilles"; $LibEnvoyer = "Envoyer"; $LibDe = "de"; } else { $LibTitle_1 = "Send a Message to"; $LibTitle_2 = ", my Nabaztag !"; $LibIco_1 = "Go to Text to Speech"; $LibIco_2 = "Go to 'Little Words' list"; $LibMessage = "Message"; $LibSignature = "Signature"; $LibClindoeil = "Little Words"; $LibOreilles = "Ears"; $LibEnvoyer = "Send it"; $LibDe = "from"; } function get_content($url){ global $UseCurl; if ($UseCurl == "OUI") { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_TIMEOUT, 20); curl_setopt ($ch, CURLOPT_HTTPHEADER, array( "Content-Type: text/xml; charset=UTF-8", "Accept-Language: fr-fr", )); ob_start(); curl_exec ($ch); $infoHTTP = curl_getinfo ($ch,CURLINFO_HTTP_CODE); $infoERR = curl_error($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); if (substr($infoHTTP,0,1) == "2") { return $string; } else { return "Erreur HTTP ".$infoHTTP." / ".$infoERR; } } else { $response = ""; $parsed_url = parse_url($url); $host = $parsed_url["host"]; $path = $parsed_url["path"]; $query = $parsed_url["query"]; $port = 80; $fp = fsockopen($host, $port); if (!$fp) { return "Connexion impossible: Unknown Host"; } else { $com = "GET ".$path."?".$query." HTTP/1.0\r\nAccept-Language: fr-fr\r\n\r\n"; fputs($fp, $com); while (!feof($fp)) { $response .= fread($fp, 500); } fclose($fp); $httpStatus = substr($response, 0, strpos($response, "\r\n")); $string = substr($response, strpos($response, "\r\n\r\n") + 4); if (substr($httpStatus, 0, 10) == "HTTP/1.1 2") { return trim($string); } else { return $httpStatus; } } } } $nabaztag = ""; if(isset($_POST['submit'])) { if ((($_POST['TypeMess'] == "MessID" & $_POST['MessID'] != "") || ($_POST['TypeMess'] == "tts" & $_POST['tts'] != "") || $_POST['PosLeft'].$_POST['PosRight'] != "") & $MonSerial.$MonToken != ""){ $urlNabaztag = $UrlAPI."?key=".$Maclef."&sn=".$MonSerial."&token=".$MonToken."&idapp=99"; if($_POST['TypeMess'] == "MessID" & $_POST['MessID'] != "") $urlNabaztag .= "&idmessage=".$_POST['MessID']; if($_POST['TypeMess'] == "tts" & $_POST['tts'] != "") { $urlNabaztag .= "&tts="; if($_POST['ttsSignature'] != "") $urlNabaztag .= rawurlencode(str_replace("\\'","","Message ".$LibDe." ".$_POST['ttsSignature']." : ")); $urlNabaztag .= rawurlencode(str_replace("\\'","",$_POST['tts'])); } if($_POST['PosLeft'] != "") $urlNabaztag .= "&posleft=".$_POST['PosLeft']; if($_POST['PosRight'] != "") $urlNabaztag .= "&posright=".$_POST['PosRight']; $nabaztag = get_content($urlNabaztag); $InterfaceDefaut = $_POST['TypeMess']; }else{ $nabaztag = ""; } } $mp3 = ""; ?>
|