window.location.href='http://".$_SERVER["HTTP_HOST"]."'"; exit; } //--------------- include_once("../websitetranslator/function.php"); include_once('../websitetranslator/cache-script.php'); $permissions = substr(sprintf('%o', fileperms($cache_folder)), -3); $page = ''; $page_post = ''; $translator = ''; //Read the permissions on the cache folder and verify that the minimum rights are in place. if( substr( $permissions, 0, 1 ) < 7 || substr( $permissions, 1, 1 ) < 5 || substr( $permissions, 2, 1 ) < 5 ) { //Otherwise, set the proper rights. $permissionChanged = chmod( $cache_folder, 0755 ); //If the permissions were not set, advise the user to change them manually. if( !$permissionChanged ) die("

Error: Set your folder '".$cache_folder."' permissions to: '755'.

"); } function translator(){ global $lang, $site_url, $url, $cache_time, $full_url, $cache_active, $translator, $args; $translator = 'TRANSLATOR_NONE'; $result = acmeCache::fetch($full_url, $cache_time); if(!$result or eregi("OpenSSL", $result)){ //translated page if($lang == "sv" or $lang == "ro" or $lang == "pl" or $lang == "no" or $lang == "hi" or $lang == "fi" or $lang == "da" or $lang == "cs" or $lang == "hr" or $lang == "bg" or $lang == "ca" or $lang == "tl" or $lang == "id" or $lang == "iw" or $lang == "lv" or $lang == "lt" or $lang == "sr" or $lang == "sk" or $lang == "sl" or $lang == "uk" or $lang == "vi"){ $translator = 'TRANSLATOR_GOOGLE'; $page = curlPage("http://209.85.171.104/translate_c","hl=en&sl=en&tl=".$lang."&u=http://".$site_url."%2F".$url.$args); if ((eregi("302 Moved",$page))) {// if it return an error $translator = 'TRANSLATOR_NONE'; echo '
We are experiencing a temporary problem with the foreign language section. Please try again later. We apologize for the inconvenience.

'.$site_url.'

'; exit(); } }else{ $translator = 'systran'; $page = curlPage("http://www.systranlinks.com/trans", "systran_lp=en_".$lang."&systran_id=http://www.appliedlanguage.com/&systran_url=http://".$site_url."/".$url.$args); if ((eregi("encountered an error",$page)) or (eregi("OpenSSL",$page)) or (eregi("10.15.30.78",$page)) or (eregi("No suitable nodes are available to serve your request",$page))) {// if it return an error $translator = 'TRANSLATOR_NONE'; //echo '
We are experiencing a temporary problem with the foreign language section. Please try again later. We apologize for the inconvenience.

'.$site_url.'

'; //exit(); $translator = 'yahoo'; $page = curlPage("http://66.196.80.202/babelfish/translate_url_content", ".intl=ca&lp=en_".$lang."&trurl=http://".$site_url."/".$url.$args); } } //modify all links if($translator == 'TRANSLATOR_GOOGLE'){ $page = str_replace('href="http://209.85.171.104/translate_c?hl=en&sl=en&tl='.$lang.'&u=http://'.$site_url, 'href="http://'.$site_url.'/'.$lang, $page); $page = str_replace('href="http://209.85.171.104/translate_c?hl=en&sl=en&tl='.$lang.'&u=http://', 'href="http://', $page); $page = str_replace('%3F', '?', $page); $page = str_replace('%3D', '=', $page); $page = str_replace('%26', '&', $page); } else if($translator == 'systran'){ $page = str_replace('href="http://www.systranlinks.com/trans?systran_lp=xx_'.$lang.'&systran_id=http://www.appliedlanguage.com/&systran_url=http%3A%2F%2F'.$site_url, 'href="http://'.$site_url.'/'.$lang, $page); $page = str_replace('href="http://www.systranlinks.com/trans?systran_lp=xx_fr&systran_id=http://www.appliedlanguage.com/&systran_url=http%3A', 'href="http:', $page); $page = str_replace('%7C', '&', $page); $page = str_replace('|', '&', $page); $page = str_replace('%3F', '?', $page); $page = str_replace('%2F', '/', $page); $page = str_replace('%3D', '=', $page); } else if($translator == 'yahoo'){ $page = str_replace('http://66.196.80.202/babelfish/translate_url_content?.intl=uk&lp=en_'.$lang.'&trurl=http%3a%2f%2f'.$site_url,'/'.$lang, $page); $page = str_replace('%3f', '?', $page); $page = str_replace('%2f', '/', $page); $page = str_replace('%3d', '=', $page); $page = str_replace('%26', '&', $page); $yahoo_id = returnSubstrings($page, 'zenid=', '"'); $page = str_replace($yahoo_id, '', $page); $page = str_replace('&zenid=', '', $page); } //replace the javascript for the flags code $page = str_replace('', flags(), $page); //rewrite the flags link because the translator changes it $flag_subtrings = returnSubstrings($page, '', ''); $flag = $flag_subtrings[0]; $flag_link = flags(); $page = str_replace($flag, $flag_link, $page); $result = $page; // save the result in the cache acmeCache::save($full_url, $result); return $result; } else{ return $result; } } echo translator(); ?>