예제 #1
0
 public function dataAction()
 {
     $w = 80;
     $h = 100;
     $img = $this->_getParam('img');
     $ar_img = split('\\.', $img);
     //print_r($ar_img);exit;
     $Product = new Product();
     $product = $Product->get($ar_img[0]);
     if ($product && $product['picture']) {
         $res = GetWebPage($product['picture'], $RetStatus);
         //header('Content-type: image/jpg');
         //print_r($res);exit;
         //$ar = getimagesizefromstring($res);
         $im = imagecreatefromstring($res);
         $width = imagesx($im);
         $height = imagesy($im);
         //print_r($width." ".$height);
         if ($width > $height) {
             $new_height = $w * $height / $width;
             $new_width = $w;
         } else {
             $new_height = $h;
             $new_width = $h * $width / $height;
         }
         $im_new = imagecreatetruecolor($new_width, $new_height);
         //imagecopyresized($im_new,$im,0, 0, 0, 0, $new_width, $new_height, $width, $height);
         imagecopyresampled($im_new, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
         header('Content-type: image/jpg');
         imagejpeg($im_new);
     }
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
 }
 protected function sendCurlResponse($id)
 {
     global $part_id;
     $server = "http://p.my-shop.ru/cgi-bin/myorder.pl";
     $request = "partner={$part_id}&master=&cart={$id}-1&cartsource=get";
     /*
     $ch = curl_init($server);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     
     curl_setopt ($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
     curl_setopt ($ch, CURLOPT_PROXY,"192.168.5.1:8080");
     curl_setopt ($ch, CURLOPT_PROXYUSERPWD,"respect\prog3:128146");
     
     $content = curl_exec($ch);
     $curl_errno = curl_errno($ch);
     $curl_error = curl_error($ch);
     curl_close($ch);
     
     if (empty($curl_error)) {
     	$res = $content;
     } else {
     	$res = false;
     }
     */
     $res = GetWebPage($server, $RetStatus, $request, true);
     return $res;
 }
예제 #3
0
파일: zzzSocial.php 프로젝트: spinit/osy
            die('POST_OK[;]');
            break;
        case 'comment':
            $strSQL = "SELECT p.cnt as cmt_msg,\n                                         a.nik_nam as cmt_usr,\n                                         a.fld_6   as cmt_img,\n                                         get_time_stamp(p.dat_ins) as cmt_tim,\n                                         DATE_FORMAT(dat_ins,'%d %M %Y %H:%i') as cmt_dat\n                                  FROM   tbl_pst p\n                                  INNER JOIN tbl_ana a ON (p.id_usr = a.id)\n                                  WHERE  p.id = '{$ObjID}'";
            list($cmt) = Site::$Db->GetAll($strSQL);
            echo 'COMMENT_OK[;]';
            PrintComment($cmt);
            break;
        case 'get_notify':
            PrintPostList(UID, $_POST['pid']);
            break;
        case 'scroll_down':
            PrintPostList(UID, $_POST['pid'], $_POST['npst']);
            break;
        case 'get_webpage':
            echo GetWebPage($_POST['url']);
            break;
    }
    exit;
}
?>
<script>
    var StopUpdate = false;
    function Post(obj){
        var tid = 'post';
        var pid = '';
        switch($(obj).attr('class')){
            case 'comment': 
                            tid = 'comment';
                            pid = $(obj).closest('div.cnt').attr('pid');
                            break;
예제 #4
0
function get_picture($url)
{
    //$url = 'http://my-shop.ru/_files/product/2/43/428102.jpg';
    //$url = 'http://my-shop.ru/_files/product/2/48/478234.jpg';
    $file_name = 'files/' . uniqid();
    $s = GetWebPage($url, $ar_data);
    if ($ar_data['ret_status'] == 200) {
        $f = fopen($file_name, 'wb');
        fwrite($f, $s);
        fclose($f);
        $img = getimagesize($file_name);
        switch ($img[2]) {
            case 1:
                $imsource = ImageCreateFromGif($file_name);
                break;
            case 2:
                $imsource = ImageCreateFromJpeg($file_name);
                break;
            case 3:
                $imsource = ImageCreateFromPng($file_name);
                break;
        }
        $ar_x_y_new = get_x_y();
        $x_new = $ar_x_y_new['x'];
        $y_new = $ar_x_y_new['y'];
        //write_log($x_new.'-'.$y_new);
        if ($x_new < $img[0] || $y_new < $img[1]) {
            $x_del = $x_new / $img[0];
            $y_del = $y_new / $img[1];
            if ($x_del < $y_del) {
                $del = $x_del;
            } else {
                $del = $y_del;
            }
            $small_file_name = $file_name . "_1";
            MakeOutputImageFile($small_file_name, floor($del * $img[0]), array('x' => $img[0], 'y' => $img[1], 'imsource' => $imsource));
            if (file_exists($small_file_name)) {
                $s_new = implode('', file($small_file_name));
                unlink($small_file_name);
                header("Content-type: {$img['mime']}");
                echo $s_new;
            }
        } else {
            header("Content-type: {$img['mime']}");
            echo $s;
        }
        unlink($file_name);
    }
}
예제 #5
0
 public function deliveryAction()
 {
     $Settings = new Settings();
     $settings = $Settings->get('partner_id');
     $delivery_info = $Settings->get('delivery_info');
     $file_name = FTP_PATH . '/cache/' . $this->delivery_cache_file;
     $ok = false;
     //if ( ((int)date('N') == 1) || (!file_exists($file_name)) ) {
     if (time() - intval($delivery_info['s_val']) > 7 * 24 * 60 * 60 || !file_exists($file_name)) {
         $s = GetWebPage('http://my-shop.ru/my/helper_25', $RetStatus);
         //$s = implode('',file('D:\\xampp\\htdocs\\is\\1\\helper_25.htm'));
         $RetStatus = 200;
         if ($RetStatus == 200) {
             if (preg_match('/(<hr class="help"><\\/div>\\nНабор доступных способов доставки зависит.*<li><a href="\\/my\\/helper_71">Дополнительные курьерские службы<.*<\\/td>)/Uis', $s, $r)) {
                 //$r[1] = preg_replace($find,$repl,$r[1]);
                 $r[1] = $this->replace_url($r[1], $settings['s_val']);
                 $content = "<table><tr><td>" . $r[1] . "</td></tr></table>";
                 $this->view->delivery_content = $content;
                 $this->save_cache($file_name, $content);
                 $Settings->set('delivery_info', time());
                 $ok = true;
             }
         }
     }
     if (!$ok) {
         $this->view->delivery_content = $this->load_cache($file_name);
     }
     $this->view->partner_id = $settings['s_val'];
     $this->_helper->_layout->setLayout('layout_without_left');
 }