Пример #1
0
function tep_get_translation($string, $from_language = 'ru', $to_language = 'en')
{
    $string = stripslashes(strip_tags(tep_html_entity_decode($string)));
    if (empty($string)) {
        return;
    }
    $max_length = 100;
    $pieces = array();
    if (strlen($string) > $max_length) {
        for ($i = 0, $j = 0; $i < strlen($string); $i++) {
            $pieces[$j] .= $string[$i];
            if (in_array($string[$i], array('.', '!', '?', ',')) && strlen($pieces[$j]) > $max_length) {
                $j++;
            }
        }
    } else {
        $pieces[] = $string;
    }
    $tpieces = array();
    reset($pieces);
    while (list(, $piece) = each($pieces)) {
        $url = 'http://translate.google.ru/?hl=ru&layout=2&eotf=0&sl=' . $from_language . '&tl=' . $to_language . '&q=' . urlencode($piece);
        //	  $url = 'http://www.webproxyonline.info/browse.php?u=' . urlencode($url);
        $url = 'http://4.hidemyass.com/browse.php?u=' . urlencode($url);
        //	  $url = 'http://www.bind2.com/browse.php?u=' . rawurlencode($url);
        $result = tep_request_html($url, 'GET');
        $result = mb_convert_encoding($result, 'HTML-ENTITIES', 'UTF-8');
        preg_match('/<span id=result_box[^>]+>(.+)<div id=res-translit/', $result, $regs);
        $tpieces[] = tep_db_prepare_input(strip_tags($regs[1]));
    }
    $translation = implode(' ', $tpieces);
    return $translation;
}
Пример #2
0
$country_found = false;
$usps_country_id = 0;
$fp = fopen(UPLOAD_DIR . 'csv/usps_countries.csv', 'r');
while ((list($u_countries_id, $u_countries_name) = fgetcsv($fp, 100, ';')) !== FALSE) {
    $u_countries_name = str_replace(array('united states', 'bosnia-herzegovina', 'laos', 'vietnam'), array('usa', 'bosnia and herzegowina', 'lao people\'s democratic republic', 'viet nam'), strtolower(trim($u_countries_name)));
    if (strpos($u_countries_name, $delivery_country_name) !== false) {
        $country_found = true;
        $usps_country_id = trim($u_countries_id);
        break;
    }
}
fclose($fp);
$weight_ounces = round($shipping_weight * 1000 * 453.7 * 16);
$url = 'http://ircalc.usps.gov/MailServices.aspx?country=' . $usps_country_id . '&m=6&p=0&o=' . $weight_ounces;
$data_array = array('ctl00_ToolkitScriptManager1_HiddenField' => 'ctl00_ToolkitScriptManager1_HiddenField', 'ScriptMailProperties' => substr($url, strpos($url, '?') + 1), '__LASTFOCUS' => '', '__VIEWSTATE' => '', '__EVENTTARGET' => 'ctl00$ContentPlaceHolder1$CheckBoxDisplayAllOptions', '__EVENTARGUMENT' => '');
echo $content = tep_request_html($url, 'GET');
preg_match('/<table class="GridViewTable"[^>]*>(.*)<\\/table>/i', $content, $regs);
echo $regs[1];
tep_db_select_db(DDB_DATABASE);
echo 'OK';
die;
tep_set_time_limit(300);
tep_db_select_db('setbook_us');
$max_specials_types_id_query = tep_db_query("select max(specials_types_id) as max_specials_types_id from " . TABLE_SPECIALS_TYPES . "");
$max_specials_types_id_row = tep_db_fetch_array($max_specials_types_id_query);
$max_specials_types_id = $max_specials_types_id_row['max_specials_types_id'];
$max_specials_date_query = tep_db_query("select max(specials_date_added) as specials_date_added from " . TABLE_SPECIALS . " where status = '1'");
$max_specials_date_row = tep_db_fetch_array($max_specials_date_query);
$max_specials_date = strtotime($max_specials_date_row['specials_date_added']);
$min_specials_date_added = date('Y-m-d', $max_specials_date - 60 * 60 * 24 * 7);
$query = tep_db_query("select p.products_id, (p.products_listing_status*5 + p.products_image_exists*3 + if((s.specials_types_id > 0), (" . (int) $max_specials_types_id . " - s.specials_types_id), 0)) as new_sort_order from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on (s.products_id = p.products_id and date_format(s.specials_date_added, '%Y-%m-%d') >= '" . tep_db_input($min_specials_date_added) . "') where 1 order by new_sort_order desc, products_price");
Пример #3
0
         } else {
             $store_number = $store_phone_number;
             $store_number_type = 'phone';
         }
     } elseif (STORE_CALLBACK_ORDER == 'skype') {
         list($store_skype_number) = array_map('trim', explode(',', STORE_OWNER_SKYPE_NUMBER));
         $store_number = $store_skype_number;
         $store_number_type = 'skype';
     } else {
         $store_number = $store_phone_number;
         $store_number_type = 'phone';
     }
     if ($customer_id == 2) {
         echo $store_number . ' - ' . $store_number_type;
     }
     if ($callback_answer = tep_request_html('http://users.telecomax.net/cabapi/amfphp/json.php?/service2.makeCallBack/' . $store_number . '/' . $callback_number . '/' . $store_number_type . '/' . $callback_number_type . '/', 'GET', array('cookie' => $cookie))) {
         list(, $callback_answer) = explode("\r\n\r\n", $callback_answer);
         if (tep_not_null($callback_answer)) {
             $callback_answer_array = unserialize($callback_answer);
             if (strpos($callback_answer, '"desc":"OK"')) {
                 echo '<br /><span>' . CALLBACK_CONNECTION_SUCCCESS . '</span><script language="javascript" type="text/javascript">' . "\n" . 'if (document.getElementById(\'callback_phone\')) document.getElementById(\'callback_phone\').style.display = \'none\'; else parent.document.getElementById(\'callback_phone\').style.display = \'none\';' . "\n" . 'if (document.getElementById(\'callback_skype\')) document.getElementById(\'callback_skype\').style.display = \'none\'; else parent.document.getElementById(\'callback_skype\').style.display = \'none\';' . "\n" . '</script>';
             } else {
                 echo '<br />' . CALLBACK_CONNECTION_ERROR;
             }
         } else {
             echo '<br />' . CALLBACK_CONNECTION_ERROR;
         }
     } else {
         echo '<br />' . CALLBACK_CONNECTION_ERROR;
     }
 } else {
Пример #4
0
function tep_get_translation($string)
{
    $string = stripslashes(strip_tags(tep_html_entity_decode(trim($string), ENT_QUOTES)));
    if (empty($string)) {
        return;
    }
    $max_length = 100;
    $pieces = array();
    if (strlen($string) > $max_length) {
        for ($i = 0, $j = 0; $i < strlen($string); $i++) {
            $pieces[$j] .= $string[$i];
            if (in_array($string[$i], array('.', '!', '?', ',')) && strlen($pieces[$j]) > $max_length) {
                $j++;
            }
        }
    } else {
        $pieces[] = $string;
    }
    $tpieces = array();
    reset($pieces);
    while (list(, $piece) = each($pieces)) {
        $url = 'http://translate.google.ru/?hl=ru&layout=2&eotf=0&sl=ru&tl=en&q=' . urlencode($piece);
        $url = 'http://www.webproxyonline.info/browse.php?u=' . urlencode($url);
        //	  $url = 'http://www.nedproxy.com/browse.php?u=' . urlencode($url);
        $result = tep_request_html($url, 'GET');
        $result = mb_convert_encoding($result, 'CP1251', 'UTF-8');
        preg_match('/<span id=result_box[^>]+>(.+)<div id="translit"/', $result, $regs);
        $tpieces[] = tep_db_prepare_input(strip_tags($regs[1]));
    }
    $translation = implode(' ', $tpieces);
    return array('page' => $result, 'translation' => $translation);
}