Advertisement
Guest User

Untitled

a guest
Jul 10th, 2013
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 39.96 KB | None | 0 0
  1. <?php
  2.  
  3. class poster extends socialaction {
  4.     public $success;
  5.     public $logs = array();
  6.     public function post() {
  7.         global $smoconfig, $dater;
  8.         $news_data = $dater->getFormatedData();
  9.         foreach ( $news_data as $key=>$val ) { $this->$key = $val;}
  10.         if ( $this->type == "vkontaktegroup" or $this->type == "vkontaktewall" ) { $this->proxy = $smoconfig['vk_proxy'];}
  11.         elseif ( $this->type == "twitter" ) { $this->proxy = $smoconfig['tt_proxy'];}
  12.         else { $this->proxy = "";}
  13.         $type = $this->type;
  14.         $this->$type();
  15.         $proxylist = $this->getProxy();
  16.         if ( $smoconfig['autoproxy'] and $this->proxy != "" and $this->noresp ) {
  17.             foreach ( $proxylist as $val ) {
  18.                 if ( substr_count($val, $this->proxy) ) {
  19.                     $this->proxy = current($proxylist);
  20.                     if (!$this->proxy) $this->proxy = reset($proxylist);
  21.                     break;
  22.                 }
  23.             }
  24.             if ( $this->type == "vkontaktegroup" or $this->type == "vkontaktewall" ) { $smoconfig['vk_proxy'] = $this->proxy;}
  25.             elseif ( $this->type == "twitter" ) { $smoconfig['tt_proxy'] = $this->proxy;}
  26.             smocnof($smoconfig);
  27.         }
  28.         $dater->saveResult($this->type, $this->success, $this->socials, $dater->news_id);
  29.         file_put_contents( LOG_DIR."/detail_journal.txt", join("\r\n", $this->logs));
  30.         if ( $this->success ) echo '{"status":"ok"}';else echo '{"status":"no"}';
  31.     }
  32.     private function googlehex ( $data ){
  33.         global $config;
  34.         $data = preg_replace('/([а-яА-ЯіїєґІЇЄҐёЁ])|(\s)/se', '"\u".bin2hex(iconv("'.$config['charset'].'","utf-16BE", "$1"))$2', $data);
  35.         $data = preg_replace('/\\\\u(?=\\\\u)/', ' ', $data);
  36.         return $data;
  37.     }
  38.     private function json_unescaped_unslashed_unicod( $data ){
  39.         $data = preg_replace( '/u([0-9a-f]{4})/se', 'iconv("UTF-16BE", "UTF-8", pack("H4","$1"))', $data);
  40.         $data = stripcslashes($data);
  41.         return $data;
  42.     }
  43.     private function memori() {
  44.         global $smoconfig;
  45.         $logins = explode ('@', $this->login);
  46.         $this->sendpost ('http://api.qip.ru/api/test?user='.$logins[0].'&pass='.$this->password.'&host='.$logins[1], '' );
  47.         $result = $this->sendpost ( 'http://memori.qip.ru/linkadd/', '' );
  48.         $token = $this->getReg( '/name="token" value="(\w+)"/i', $result, 1 );
  49.         $post = $this->cp1251( array ( 'whereadd' => 'personal', 'linkImageUrl' => 'http://open.thumbshots.org/image.aspx?url='.$_SERVER['HTTP_HOST'], 'linkImageType' => 'screenshot', 'book' => '', 'urlRedirect' => '', 'url' => $this->url, 'title' => $this->title, 'description' => $this->body, 'tags' => $this->tags_space, 'token' => $token ) );
  50.         $result = $this->sendpost ( 'http://memori.qip.ru/linkaddaction/', $post );
  51.         if( $this->referer == 'http://memori.qip.ru/'.$this->login.'/' or strpos ( $result, $this->cp1251('У вас уже есть закладка с таким адресом') ) ) {
  52.             $this->success = true;
  53.         } elseif ( strpos ( $result, $this->cp1251('Введены неверные слова') ) ) {
  54.             while( strpos ( $result, $this->cp1251('Введены неверные слова') ) ){
  55.                 $this->success = false;
  56.                 $i++;if ( $i == $smoconfig['captcha']+1 ) break;
  57.                 $result = $this->sendpost ( 'http://api.recaptcha.net/challenge?k=6LfX6wgAAAAAAOd-kkh9s4hWtrPCJaxu-dWIo300', '' );
  58.                 $challenge = $this->getReg( '/challenge : \'(.*?)\'/s', $result, 1 );
  59.                 $captcha_key = $this->getCaptchaKey( "http://www.google.com/recaptcha/api/image?c=".$challenge, $smoconfig['captcha_api'] );
  60.                 $post['recaptcha_challenge_field'] = $challenge;
  61.                 $post['recaptcha_response_field']  = $captcha_key;
  62.                 $result = $this->sendpost ( 'http://memori.qip.ru/linkaddaction/', $post );
  63.                 $this->success = true;
  64.             }
  65.         } else {
  66.             $this->success = false;
  67.         }
  68.         if ( $this->success ) {
  69.             $result = $this->sendpost ( "http://memori.qip.ru/".$this->login."/?sort=date&view=full", '' );
  70.             $bm_id = $this->getReg( '/<a  href="\/wcopy\/\?type=inc&link=(\d+)"/i', $result, 1 );
  71.             $this->sendpost ( "http://memori.qip.ru/linksgroupajax/?ids=".$bm_id."&command=onmain", '' );
  72.         }
  73.     }
  74.     private function bobrdobr() {
  75.         global $smoconfig;
  76.         $post = $this->utf8( array ( 'username' => $this->login, 'password' => $this->password, 'remember_user' => 'on', 'next' => 'http://bobrdobr.ru/', 'submit' => 'Aieoe', ) );
  77.         $this->sendpost ( 'http://bobrdobr.ru/login/', $post );
  78.         $result = $this->sendpost ( 'http://bobrdobr.ru/add/', '' );
  79.         $killspammers = $this->getReg( '/name="killspammers" value="(\w+)"/i', $result, 1 );
  80.         $post = $this->utf8( array ( 'url' => $this->url, 'name' => $this->title, 'tags' => $this->tags_comma, 'description' => $this->body, 'next' => 'http://bobrdobr.ru/people/'.$this->login.'/', 'killspammers' => $killspammers, 'submit' => 'Сохранить' ) );
  81.         $result = $this->sendpost ( 'http://bobrdobr.ru/add/', $post );
  82.         if( strpos ( $result, $this->utf8( 'Закладка сохранена' ) ) or strpos ( $result, $this->utf8( 'Закладка сохранена' ) ) ) {
  83.             $this->success = true;
  84.         } elseif ( strpos ( $result, 'alt="no robots here"' ) ) {
  85.             while( strpos ( $result, 'alt="no robots here"' ) ){
  86.                 $this->success = false;
  87.                 $i++;if ( $i == $smoconfig['captcha']+1 ) break;
  88.                 $hash = $this->getReg( '/src="\/captcha\/(.*?)"/s', $result, 1 );
  89.                 $captcha_key = $this->getCaptchaKey( "http://bobrdobr.ru/captcha/".$hash, $smoconfig['captcha_api'] );
  90.                 $post['captcha_0'] = $hash;
  91.                 $post['captcha_1'] = $this->utf8( $captcha_key );
  92.                 $result = $this->sendpost ( 'http://bobrdobr.ru/add/', $post );
  93.                 $this->success = true;
  94.             }
  95.         } else {
  96.             $this->success = false;
  97.         }
  98.     }
  99.     private function iua() {
  100.         $post = $this->cp1251( array ( '_subm' => 'lform', '_url' => 'http://links.i.ua/', 'login' => $this->login, 'pass' => $this->password, ) );
  101.         $this->sendpost ( 'http://i.ua/lin.php', $post );
  102.         $result = $this->sendpost ( 'http://links.i.ua/add/', '' );
  103.         $back = $this->getReg( '/name=\'back\' value=\'(.*?)\'/s', $result, 1 );
  104.         $post = $this->cp1251( array ( '_subm' => 'add', 'back' => $back, 'url' => $this->url, 'name' => $this->title, 'text' => $this->body, 'access' => '0', 'labels' => $this->tags_comma, 'folder' => '0', 'subfolder' => '', 'add' => '1', ) );
  105.         $result = $this->sendpost ( 'http://links.i.ua/form/', $post );
  106.         if( strpos ( $result, substr(str_replace( "&", "&amp;", str_replace("http://", "", $this->cp1251($this->url)) ), 0 , 50 ) ) ) {
  107.             $this->success = true;
  108.         } else {
  109.             $this->success = false;
  110.         }
  111.         if ( $this->success ) {
  112.             $param = $this->getReg( '/SM\((\d+), this\)/s', $result, 1 );
  113.             $this->sendpost ( 'http://links.i.ua/setmain/'.$param.'/?ct=1', '' );
  114.         }
  115.     }
  116.     private function yandex() {
  117.         $post = $this->utf8( array ( 'login' => $this->login, 'passwd' => $this->password, 'mode' => 'auth' ) );
  118.         $this->sendpost ( 'https://passport.yandex.ru/passport', $post );
  119.         $post = $this->utf8( array ( 'name' => $this->title, 'from' => 'bookmarks_web', 'url' => $this->url, 'descr' => $this->body, 'tags' => $this->tags_comma, 'folder_id' => '0', 'ajax' => '1', ) );
  120.         $result = $this->sendpost ( 'http://zakladki.yandex.ru/addlink.xml', $post );
  121.         if( strpos ( $result, $this->utf8( 'В этой папке такая закладка уже существует' ) ) or strpos ( $result, $this->utf8( 'Ссылка добавлена в Яндекс.Закладки' ) ) ) {
  122.             $this->success = true;
  123.         } else {
  124.             $this->success = false;
  125.         }
  126.     }
  127.     private function delicious() {
  128.         $post = $this->utf8( array ( 'username' => $this->login, 'password' => $this->password, ) );
  129.         $this->sendpost ( 'https://previous.delicious.com/login', $post, false, true );
  130.         $post = $this->utf8( array ( 'url' => $this->url, 'target_stack_id' => '', ) );
  131.         $result = $this->sendpost ( 'http://previous.delicious.com/save/confirm?url='.$this->url.'&target_stack_id=', '' );
  132.         $csrfToken = $this->getReg( '/name="csrfToken" value="(.*?)"/s', $result, 1 );
  133.         $post = $this->utf8( array ( 'url' => $this->url, 'oldUrl' => $this->url, 'title' => $this->title, 'tags' => $this->tags_comma, 'note' => $this->body, 'no_image' => 'false', 'private' => 'false', 'csrf_token' => $csrfToken ) );
  134.         $result = $this->sendpost ( 'http://previous.delicious.com/save', $post );
  135.         $json = json_decode($result, true);
  136.         if( $json['success'] == 'True' ) {
  137.             $this->success = true;
  138.         } else {
  139.             $this->success = false;
  140.         }
  141.     }
  142.     private function stozak() {
  143.         $post = $this->cp1251( array ( 'ln' => $this->login, 'lp' => $this->password, 'su2' => 'Войти', ) );
  144.         $this->sendpost ( 'http://www.100zakladok.ru/login/', $post );
  145.         $post = $this->cp1251( array ( 'title_1' => $this->title, 'bm_url_1' => $this->url, 'id_cat_1' => '1', 'tags_1' => $this->tags_comma, 'descr_1' => $this->body, 'id_bm_1' => '0', 'form_type' => '1', 'id_form' => '1', 'add_proc' => 'Добавить закладку', ) );
  146.         $result = $this->sendpost ( 'http://www.100zakladok.ru/'.strtolower($this->login).'/', $post );
  147.         if( strpos( $result, $this->cp1251('Закладка с таким адресом уже существует') ) or strpos( $result, $this->cp1251($this->url) ) ) {
  148.             $this->success = true;
  149.         } else {
  150.             $this->success = false;
  151.         }
  152.     }
  153.     private function zaknet() {
  154.         global $ermsg;
  155.         $post = array ( 'backref' => 'http://www.zakladok.net/index.php', 'login' => $this->login, 'passwd' => $this->password, 'submit' => 'Войти!' );
  156.         $this->sendpost ( 'http://www.interesno.com/login.php', $post );
  157.         $result = $this->sendpost ( 'http://www.zakladok.net/add_link.php', '' );
  158.         $param = $this->getReg( '/<option value="(\d+)".*?>Iauay<\/option>/s', $result, 1 );
  159.         $post = array ( 'action' => 'edit', 'mode' => 'insert', 'original_id' => '0', 'url' => $this->url, 'title' => $this->title, 'tags_line' => $this->tags_comma, 'description' => $this->body, 'is_public' => '1', 'folder_id' => $param, 'namefolder' => '', 'submit' => 'Сохранить закладку', );
  160.         $result = $this->sendpost ( 'http://www.zakladok.net/add_link.php', $post, true );
  161.         if( strpos( $result, 'ссылка уже сохранена ранее' ) or $this->referer == 'http://www.zakladok.net/my.php?expand=&folder='.$param ) {
  162.             $this->success = true;
  163.         } else {
  164.             $this->success = false;
  165.         }
  166.     }
  167.     private function twitter() {
  168.         $result = $this->sendpost ( 'https://mobile.twitter.com/session/new', '', false, false, array(), 'm5=off' );
  169.         $authenticity_token = $this->getReg( '/name="authenticity_token" type="hidden" value="(\w+)"/s', $result, 1 );
  170.         $post = $this->utf8( array ( 'authenticity_token' => $authenticity_token, 'username' => $this->login, 'password' => $this->password, 'commit' => 'Войти' ) );
  171.         $this->sendpost ( 'https://mobile.twitter.com/session', $post, false, false, array(), 'm5=off' );
  172.         $post = $this->utf8( array ( 'authenticity_token' => $authenticity_token, 'tweet[text]' => $this->body, 'commit' => 'Твитнуть' ) );
  173.         $result = $this->sendpost ( 'https://mobile.twitter.com/', $post, false, true, array(), 'm5=off' );
  174.         if( ( strpos( $result, 'Tweet sent!' ) or strpos( $result, $this->utf8('Твит отправлен!') ) ) and $this->referer = 'https://mobile.twitter.com/' ) {
  175.             $this->success = true;
  176.         } elseif ( strpos( $result, 'You already tweeted that' )){
  177.             $this->success = true;
  178.         } else {
  179.             $this->success = false;
  180.         }
  181.     }
  182.     private function facebookwall() {
  183.         $result = $this->sendpost ( 'https://www.facebook.com/', '' );
  184.         $lsd = $this->getReg( '/name="lsd" value="(.*?)"/s', $result, 1 );
  185.         $post = $this->utf8( array ( 'lsd' => $lsd, 'email' => $this->login, 'pass' => $this->password, 'default_persistent' => '0', 'charset_test' => '&euro;,&acute;,?,?,?,A,?', 'timezone' => '-180', 'lgnrnd' => '111240_isMk', 'lgnjs' => '1339697531', 'locale' => 'ru_RU' ) );
  186.         $this->sendpost ( 'https://www.facebook.com/login.php?login_attempt=1', $post );
  187.         $result = $this->sendpost ( 'https://www.facebook.com/', '' );
  188.         $fb_dtsg = $this->getReg( '/"fb_dtsg":"(.*?)"/s', $result, 1 );
  189.         $xhpc_composerid = $this->getReg( '/name="xhpc_composerid" value="(.*?)"/s', $result, 1 );
  190.         $xhpc_targetid = $this->getReg( '/name="xhpc_targetid" value="(\d+)"/s', $result, 1 );
  191.         $user_id = $this->getReg( '/"user":"(\d+)"/s', $result, 1 );
  192.         $result = $this->sendpost ( 'https://www.facebook.com/ajax/metacomposer/attachment/link/scraper.php?targetid='.$xhpc_targetid.'&__a=1&xhpc=composerTourStart&nctr[_mod]=pagelet_timeline_recent&__user='.$user_id, '');
  193.         $app_id = $this->getReg( '/name=\\\\\\\\\\\"app_id\\\\\\\\\\\" value=\\\\\\\\\\\"(\d+)\\\\\\\\\\\"/s', $result, 1 );
  194.         if ( $this->post_type == "preview" ){
  195.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_link'];break;}
  196.             $post = $this->utf8( array( 'xhpc_timeline' => '1', 'xhpc_ismeta' => '1', 'xhpc_fbx' => '1', 'fb_dtsg' => $fb_dtsg, 'xhpc_composerid' => $xhpc_composerid, 'xhpc_targetid' => $xhpc_targetid, 'xhpc_context' => 'profile', 'xhpc_message_text' => $this->body, 'xhpc_message' => $this->body, 'aktion' => 'post', 'app_id' => $app_id, 'UIThumbPager_Input' => '0', 'attachment[params][title]' => $this->title, 'attachment[params][summary]' => $this->short, 'attachment[params][url]' => $this->url, 'attachment[params][images][0]' => $image, 'attachment[type]' => '100', 'nctr[_mod]' => 'pagelet_wall', '__user' => $user_id ) );
  197.             $result = $this->sendpost ( 'https://www.facebook.com/ajax/profile/composer.php?__a=1', $post );
  198.         } elseif ( $this->post_type == "media" ){
  199.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_full'];break;}
  200.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'source' => '8', 'profile_id' => $user_id, 'composer_unpublished_photo[]' => '@'. $image, "upload_id" => "1024" ) );
  201.             $result = $this->sendpost ( 'https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id='.$xhpc_targetid.'&__user='.$user_id.'&__a=1&fb_dtsg='.$fb_dtsg, $post, true);
  202.             $photo_id = $this->getReg( '/composer_unpublished_photo\[\]\\\\" value=\\\\"(\d+)\\\\"/s', $result, 1);
  203.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'xhpc_composerid' => $xhpc_composerid, 'xhpc_targetid' => $xhpc_targetid, 'xhpc_context' => 'profile', 'xhpc_timeline' => '1', 'xhpc_ismeta' => '1', 'xhpc_fbx' => '1', 'xhpc_message_text' => $this->body, 'xhpc_message' => $this->body, 'app_id' => $app_id, 'is_file_form' => '1', 'album_type' => '128', 'application' => 'composer', "composer_unpublished_photo[]" => $photo_id, "disable_location_sharing" => "false", "audience[0][value]" => "80" ) );
  204.             $result = $this->sendpost ( 'https://upload.facebook.com/media/upload/photos/composer/?__a=1&__user='.$user_id, $post );
  205.         }
  206.         if( strpos( $result, '"jsmods":{"require"' ) ) {
  207.             $this->success = true;
  208.             if ( $this->checking == "1" ){
  209.                 $hash = $this->getReg( '/unit_data\\\\u00255Bhash\\\\u00255D=([-\d]+)&amp;/s', $result, 1 );
  210.                 $start = $this->getReg( '/&amp;start=(\d+)&amp;/s', $result, 1 );
  211.                 $end = $this->getReg( '/end=(\d+)&amp;/s', $result, 1 );
  212.                 $post = array ( "unit_data[hash]" => $hash, "profile_id" => $user_id, "start" => $start, "end" => $end, "query_type" => "5", "customize_action" => "7", "nctr[_mod]" => "pagelet_timeline_recent", "__user" => $user_id, "__a" => "1", "fb_dtsg" => $fb_dtsg );
  213.                 $post['unit_data[unit_type]'] = ( $this->post_type == "image" )?"69":"3";
  214.                 $this->sendpost ( "https://www.facebook.com/ajax/timeline/customize_confirm.php", $post );
  215.             }
  216.         } else {
  217.             $this->success = false;
  218.         }
  219.     }
  220.     private function facebookpage() {
  221.         $result = $this->sendpost ( 'https://www.facebook.com/', '' );
  222.         $lsd = $this->getReg( '/name="lsd" value="(.*?)"/s', $result, 1 );
  223.         $post = $this->utf8( array ( 'lsd' => $lsd, 'email' => $this->login, 'pass' => $this->password, 'default_persistent' => '0', 'charset_test' => '&euro;,&acute;,?,?,?,A,?', 'timezone' => '-180', 'lgnrnd' => '111240_isMk', 'lgnjs' => '1339697531', 'locale' => 'ru_RU' ) );
  224.         $this->sendpost ( 'https://www.facebook.com/login.php?login_attempt=1', $post );
  225.         $result = $this->sendpost ( 'https://www.facebook.com/pages/space/'.$this->group, '' );
  226.         $fb_dtsg = $this->getReg( '/"fb_dtsg":"(.*?)"/s', $result, 1 );
  227.         $xhpc_composerid = $this->getReg( '/name="xhpc_composerid" value="(.*?)"/s', $result, 1 );
  228.         $xhpc_targetid = $this->getReg( '/name="xhpc_targetid" value="(\d+)"/s', $result, 1 );
  229.         $user_id = $this->getReg( '/"user":"(\d+)"/s', $result, 1 );
  230.         $result = $this->sendpost ( 'https://www.facebook.com/ajax/typeahead/first_degree.php?viewer='.$xhpc_targetid.'&__user='.$user_id.'&__a=1&__req=2', '');
  231.         $app_id = $this->getReg( '/"uid":(\d+),"type":"app","path":"\\\\\\/\?sk=app_\d+"/s', $result, 1 );
  232.         if ( $this->post_type == "preview" ){
  233.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_link'];break;}
  234.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'xhpc_composerid' => $xhpc_composerid, 'xhpc_targetid' => $xhpc_targetid, 'xhpc_context' => 'profile', 'xhpc_timeline' => '1','xhpc_message_text' => $this->body, 'xhpc_message' => $this->body, 'aktion' => 'post', 'app_id' => $app_id, 'attachment[params][title]' => $this->title, 'attachment[params][summary]' => $this->short, 'attachment[params][url]' => $this->url, 'attachment[params][images][0]' => $image, 'attachment[type]' => '100', 'nctr[_mod]' => 'pagelet_timeline_recent', '__user' => $user_id, "__a" => "1" ) );
  235.             $result = $this->sendpost ( 'https://www.facebook.com/ajax/profile/composer.php', $post );
  236.         } elseif ( $this->post_type == "media" ){
  237.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_full'];break;}
  238.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'xhpc_composerid' => $xhpc_composerid, 'xhpc_targetid' => $xhpc_targetid, 'xhpc_context' => 'profile', 'xhpc_timeline' => '1', 'xhpc_ismeta' => '1', 'xhpc_message_text' => $this->body, 'xhpc_message' => $this->body, 'app_id' => $app_id, 'album_type' => '128', 'application' => 'composer', 'is_file_form' => '1', 'file1' => '@'. $image, 'scheduled' => '0', 'UITargetedPrivacyWidget' => '80', "disable_location_sharing" => "false" ) );
  239.             $result = $this->sendpost ( 'https://upload.facebook.com/media/upload/photos/composer/?__a=1&__adt=3&__iframe=true&__user='.$user_id, $post, true );
  240.         }
  241.         if( strpos( $result, '"jsmods":{"require"' ) ) {
  242.             $this->success = true;
  243.             if ( $this->checking == "1" ){
  244.                 $hash = $this->getReg( '/unit_data\\\\u00255Bhash\\\\u00255D=([-\d]+)&amp;/s', $result, 1 );
  245.                 $start = $this->getReg( '/&amp;start=(\d+)&amp;/s', $result, 1 );
  246.                 $end = $this->getReg( '/end=(\d+)&amp;/s', $result, 1 );
  247.                 $post = array ( "unit_data[unit_type]" => "69", "unit_data[hash]" => $hash, "profile_id" => $xhpc_targetid, "start" => $start, "end" => $end, "query_type" => "5", "customize_action" => "7", "nctr[_mod]" => "pagelet_timeline_recent", "__user" => $user_id, "__a" => "1", "fb_dtsg" => $fb_dtsg );
  248.                 $this->sendpost ( "https://www.facebook.com/ajax/timeline/customize_confirm.php", $post );
  249.             }
  250.         } else {
  251.             $this->success = false;
  252.         }
  253.     }
  254.     private function facebookgroup() {
  255.         $result = $this->sendpost ( 'https://www.facebook.com/', '' );
  256.         $lsd = $this->getReg( '/name="lsd" value="(.*?)"/s', $result, 1 );
  257.         $post = $this->utf8( array ( 'lsd' => $lsd, 'email' => $this->login, 'pass' => $this->password, 'default_persistent' => '0', 'charset_test' => '&euro;,&acute;,?,?,?,A,?', 'timezone' => '-180', 'lgnrnd' => '111240_isMk', 'lgnjs' => '1339697531', 'locale' => 'ru_RU' ) );
  258.         $this->sendpost ( 'https://www.facebook.com/login.php?login_attempt=1', $post );
  259.         $result = $this->sendpost ( 'https://www.facebook.com/groups/'.$this->group, '' );
  260.         $fb_dtsg = $this->getReg( '/"fb_dtsg":"(.*?)"/s', $result, 1 );
  261.         $xhpc_composerid = $this->getReg( '/name="composerid" value="(.*?)"/s', $result, 1 );
  262.         $xhpc_targetid = $this->getReg( '/name="xhpc_targetid" value="(\d+)"/s', $result, 1 );
  263.         $user_id = $this->getReg( '/"user":"(\d+)"/s', $result, 1 );
  264.         $result = $this->sendpost ( 'https://www.facebook.com/ajax/metacomposer/attachment/link/scraper.php?targetid='.$xhpc_targetid.'&__a=1&xhpc=composerTourStart&nctr[_mod]=pagelet_timeline_recent&__user='.$user_id, '');
  265.         $app_id = $this->getReg( '/name=\\\\\\\\\\\"app_id\\\\\\\\\\\" value=\\\\\\\\\\\"(\d+)\\\\\\\\\\\"/s', $result, 1 );
  266.         if ( $this->post_type == "preview" ){
  267.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_link'];break;}
  268.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'xhpc_composerid' => $xhpc_composerid, 'xhpc_targetid' => $xhpc_targetid, 'xhpc_context' => 'profile', 'xhpc_message_text' => $this->body, 'xhpc_message' => $this->body, 'aktion' => 'post', 'app_id' => $app_id, 'UIThumbPager_Input' => '0', 'attachment[params][title]' => $this->title, 'attachment[params][summary]' => $this->short, 'attachment[params][url]' => $this->url, 'attachment[params][images][0]' => $image, 'attachment[type]' => '100', 'nctr[_mod]' => 'pagelet_group_composer', '__user' => $user_id ) );
  269.             $result = $this->sendpost ( 'https://www.facebook.com/ajax/profile/composer.php?__a=1', $post );
  270.         } elseif ( $this->post_type == "media" ){
  271.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_full'];break;}
  272.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'source' => '8', 'profile_id' => $user_id, 'composer_unpublished_photo[]' => '@'. $image, "upload_id" => "1024" ) );
  273.             $result = $this->sendpost ( 'https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id='.$xhpc_targetid.'&__user='.$user_id.'&__a=1&fb_dtsg='.$fb_dtsg, $post, true);
  274.             $photo_id = $this->getReg( '/composer_unpublished_photo\[\]\\\\" value=\\\\"(\d+)\\\\"/s', $result, 1);
  275.             $post = $this->utf8( array( 'fb_dtsg' => $fb_dtsg, 'xhpc_composerid' => $xhpc_composerid, 'xhpc_targetid' => $xhpc_targetid, 'xhpc_context' => 'profile', 'xhpc_timeline' => '1', 'xhpc_ismeta' => '1', 'xhpc_fbx' => '1', 'xhpc_message_text' => $this->body, 'xhpc_message' => $this->body, 'app_id' => $app_id, 'is_file_form' => '1', 'album_type' => '128', 'application' => 'composer', "composer_unpublished_photo[]" => $photo_id, "disable_location_sharing" => "false", "audience[0][value]" => "80" ) );
  276.             $result = $this->sendpost ( 'https://upload.facebook.com/media/upload/photos/composer/?__a=1&__user='.$user_id, $post );
  277.         }
  278.         if( strpos( $result, '"jsmods":{"require"' ) ) {
  279.             $this->success = true;
  280.         } else {
  281.             $this->success = false;
  282.         }
  283.     }
  284.     private function confirmIp ( $data ){
  285.         $hash = $this->getReg( "/al_page: '.*?', hash: '(\w+)'/i", $data, 1 );
  286.         $to = $this->getReg( "/to: '(.*?)', al_page/i", $data, 1 );
  287.         if (!$to) preg_match("/security_check&to=([^&].?)&/",$this->referer,$match);
  288.         $to = $match[1];
  289.         $post = array ( 'act' => 'security_check', 'al' => '1', 'al_page' => '3', 'code' => $this->phone, 'hash' => $hash, 'to' => $to );
  290.         $this->sendPost ( 'http://vk.com/login.php', $post );
  291.     }
  292.     private function vkontaktegroup() {
  293.         global $smoconfig;
  294.         $result = $this->sendPost ( 'http://vk.com/', '' );
  295.         if ( substr_count ( $this->referer, 'http://vk.com/login.php?act=security_check' ) != 1 ) {
  296.             $ip_h = $this->getReg ( "/ip_h: '(\w+)'/i", $result, 1 );
  297.             $post = $this->cp1251( array( 'act' => 'login', 'role' => 'al_frame', 'expire' => '1', 'captcha_sid' => '', 'captcha_key' => '', '_origin' => 'http://vk.com', 'ip_h' => $ip_h, 'email' => $this->login, 'pass' => $this->password ) );
  298.             $result = $this->sendPost ( 'https://login.vk.com/', $post );
  299.             $account = $this->getReg ( "/onLoginDone\('\/(.*?)'\)/", $result, 1 );
  300.             $result = $this->sendPost ( 'http://vk.com/'.$account, '' );
  301.         }
  302.         if ( substr_count ( $this->referer, 'http://vk.com/login.php?act=security_check' ) == 1 ) {
  303.             $result = $this->confirmIp ( $result );
  304.         }
  305.         $result = $this->sendPost ( 'http://vk.com/club' . $this->group, '' );
  306.         $post_hash = $this->getReg( '/"post_hash":"(\w+)",/i', $result, 1 );
  307.         if ( $this->post_type == "preview" ){
  308.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_link'];break;}
  309.             $post = $this->utf8( array ( 'act' => 'a_photo', 'url' => $this->url, 'index' => '4', 'image' => $image, 'extra' => '0' ) );
  310.             $result = $this->sendpost ( 'http://vk.com/share.php', $post );
  311.             $user_id = $this->getReg( '/user_id"*:\s*(\d+),/s', $result, 1 );
  312.             $photo_id = $this->getReg( '/photo_id"*:\s*(\d+)}/s', $result, 1 );
  313.             $post = $this->utf8( array ( 'act' => 'post', 'al' => '1', 'attach1' => $user_id.'_'.$photo_id, 'attach1_type' => 'share', 'description' => $this->short, 'extra' => '0', 'extra_data' => '', 'facebook_export' => '', 'friends_only' => '', 'hash' => $post_hash, 'message' => $this->body, 'note_title' => '', 'official' => '', 'photo_url' => $this->img, 'status_export' => '', 'title' => $this->title, 'to_id' => '-'.$this->group, 'type' => 'all', 'url' => $this->url ) );
  314.         } elseif ( $this->post_type == "media" ){
  315.             $mid = $this->getReg( "/id: (\d+),/i", $result, 1 );
  316.             $post = array ( "act" => "choose_photo", "al" => "1", "to_id" => "-".$this->group );
  317.             $return = $this->sendpost ( "http://vk.com/al_photos.php", $post );
  318.             $attachment = array();
  319.             foreach ( $this->attaches as $num=>$val ){
  320.                 if ( $val['type'] == "image" ){
  321.                     $i++;
  322.                     $url_post = $this->getReg( "/url: '(http:\/\/cs\d+\.vk\.com\/upload\.php)',/i", $return, 1 );
  323.                     $server = $this->getReg( "/cs(\d+)\.vk\.com/i", $url_post, 1 );
  324.                     $hash = $this->getReg( "/\"hash\":\"(\w+)\"/i", $return, 1 );
  325.                     $rhash = $this->getReg( "/\"rhash\":\"(\w+)\"/i", $return, 1 );
  326.                     $post = array ('photo' => '@'. $val['image_full'], 'act' => 'do_add', 'aid' => '-14', 'gid' => '0', 'mid' => $mid, 'hash' => $hash, 'rhash' => $rhash, 'vk' => '1', 'from_host' => 'vk.com', 'jpeg_quality' => '89', 'ajx' => '1' );
  327.                     $result = $this->sendpost ($url_post, $post, true );
  328.                     $json = json_decode($result, true);
  329.                     $post = array( "act" => "choose_uploaded", "aid" => "-14", "al" =>  "1", "gid" => "0", "hash" => $json['hash'], "mid" => $mid, "photos" => $json['photos'], "server" => $server );
  330.                     $result = $this->sendpost ( "http://vk.com/al_photos.php", $post );
  331.                     $user_id = $this->getReg( '/(\d+)_\d+/i', $result, 1 );
  332.                     $photo_id = $this->getReg( '/\d+_(\d+)/i', $result, 1 );
  333.                     $attachment['attach'.$i] = $user_id.'_'.$photo_id;
  334.                     $attachment['attach'.$i.'_type'] = 'photo';
  335.                 }
  336.                 if ( $val['type'] == "video_vk" ){
  337.                     $i++;
  338.                     preg_match("/vk\.com\/video_ext\.php\?oid=([\d-]+)[^\s]+id=(\d+)/", $val['video_vk'], $match);
  339.                     $attachment['attach'.$i] = $match[1]."_".$match[2];
  340.                     $attachment['attach'.$i.'_type'] = 'video';
  341.                 }
  342.             }
  343.             $post = $this->utf8( $attachment + array( 'act' => 'post', 'al' => '1', 'text' => $this->short, 'facebook_export' => '', 'fixed' => '', 'friends_only' => '', 'from' => '', 'hash' => $post_hash, 'Message' => $this->body, 'official' => '', 'signed' => '', 'status_export' => '', 'to_id' => '-'.$this->group, 'type' => 'all'));
  344.         }
  345.         if ( $this->fromgoup == '1' ) $post['official'] = '1';
  346.         if ( $this->signature == '1' ) $post['signed'] = '1';
  347.         $result = $this->sendpost ( 'http://vk.com/al_wall.php', $post );
  348.         if( strpos ( $result, 'id="page_wall_count_' ) ) {
  349.             $this->success = true;
  350.         } elseif ( preg_match ( '/<!>([0-9]+){12}<!>/i', $result ) ) {
  351.             while( preg_match ( '/<!>([0-9]+){12}<!>/i', $result ) ){
  352.                 $this->success = false;
  353.                 $i++;if ( $i == $smoconfig['captcha']+1 ) break;
  354.                 $captcha_sid = $this->getReg( '/<!>([0-9]+){12}<!>/i', $result, 1 );
  355.                 $captcha_key = $this->getCaptchaKey( "http://vk.com/captcha.php?sid=".$captcha_sid, $smoconfig['captcha_api'] );
  356.                 $post['captcha_sid'] = $captcha_sid;
  357.                 $post['captcha_key']  = $this->utf8( $captcha_key );
  358.                 $result = $this->sendpost ( 'http://vk.com/al_wall.php', $post );
  359.                 $this->success = true;
  360.             }
  361.         } else {
  362.             $this->success = false;
  363.         }
  364.     }
  365.     private function vkontaktewall() {
  366.         global $smoconfig;
  367.         $result = $this->sendPost ( 'http://vk.com/', '' );
  368.         if ( substr_count ( $this->referer, 'http://vk.com/login.php?act=security_check' ) != 1 ) {
  369.             $ip_h = $this->getReg ( "/ip_h: '(\w+)'/i", $result, 1 );
  370.             $post = $this->cp1251( array( 'act' => 'login', 'role' => 'al_frame', 'expire' => '1', 'captcha_sid' => '', 'captcha_key' => '', '_origin' => 'http://vk.com', 'ip_h' => $ip_h, 'email' => $this->login, 'pass' => $this->password ) );
  371.             $result = $this->sendPost ( 'https://login.vk.com/', $post );
  372.             $account = $this->getReg ( "/onLoginDone\('\/(.*?)'\)/", $result, 1 );
  373.             $result = $this->sendPost ( 'http://vk.com/'.$account, '' );
  374.         }
  375.         if ( substr_count ( $this->referer, 'http://vk.com/login.php?act=security_check' ) == 1 ) {
  376.             $result = $this->confirmIp ( $result );
  377.         }
  378.         $post_hash = $this->getReg( '/"post_hash":"(\w+)",/i', $result, 1 );
  379.         if ( empty($post_hash) ) {
  380.             $result = $this->sendpost ( 'http://vk.com/settings', '' );
  381.             $id = $this->getReg( '/class="settings_labeled_text fl_l">\s*(\d+)\s*<\/div>/', $result, 1 );
  382.             $result = $this->sendpost ( 'http://vk.com/id'.$id, '' );
  383.             $post_hash = $this->getReg( '/"post_hash":"(\w+)",/i', $result, 1 );
  384.         }
  385.         if ( $this->post_type == "preview" ){
  386.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_link'];break;}
  387.             $to_id = $this->getReg( '/id: (\d+),/s', $result, 1 );
  388.             $post = $this->utf8( array ( 'act' => 'a_photo', 'url' => $this->url, 'index' => '4', 'image' => $image, 'extra' => '0' ) );
  389.             $result = $this->sendpost ( 'http://vk.com/share.php', $post );
  390.             $user_id = $this->getReg( '/user_id"*:\s*(\d+),/s', $result, 1 );
  391.             $photo_id = $this->getReg( '/photo_id"*:\s*(\d+)}/s', $result, 1 );
  392.             $post = $this->utf8( array ( 'act' => 'post', 'al' => '1', 'attach1' => $user_id.'_'.$photo_id, 'attach1_type' => 'share', 'description' => $this->short, 'extra' => '0', 'extra_data' => '', 'facebook_export' => '', 'friends_only' => '', 'hash' => $post_hash, 'message' => $this->body, 'note_title' => '', 'official' => '', 'photo_url' => $this->img, 'status_export' => '', 'title' => $this->title, 'to_id' => $to_id, 'type' => 'all', 'url' => $this->url ) );
  393.         } elseif ( $this->post_type == "media" ){
  394.             $result = $this->sendPost ( 'http://vk.com/club' . $this->group, '' );
  395.             $id = $this->getReg( "/id: (\d+),/i", $result, 1 );
  396.             $post = array ( "act" => "choose_photo", "al" => "1", "to_id" => $id );
  397.             $return = $this->sendpost ( "http://vk.com/al_photos.php", $post );
  398.             $attachment = array();
  399.             foreach ( $this->attaches as $num=>$val ){
  400.                 if ( $val['type'] == "image" ){
  401.                     $i++;
  402.                     $url_post = $this->getReg( "/url: '(http:\/\/cs\d+\.vk\.com\/upload\.php)',/i", $return, 1 );
  403.                     $server = $this->getReg( "/cs(\d+)\.vk\.com/i", $url_post, 1 );
  404.                     $hash = $this->getReg( "/\"hash\":\"(\w+)\"/i", $return, 1 );
  405.                     $rhash = $this->getReg( "/\"rhash\":\"(\w+)\"/i", $return, 1 );
  406.                     $post = array ('photo' => '@'. $val['image_full'], 'act' => 'do_add', 'aid' => '-14', 'gid' => '0', 'mid' => $id, 'hash' => $hash, 'rhash' => $rhash, 'vk' => '1', 'from_host' => 'vk.com', 'jpeg_quality' => '89', 'ajx' => '1' );
  407.                     $result = $this->sendpost ($url_post, $post, true );
  408.                     $json = json_decode($result, true);
  409.                     $post = array( "act" => "choose_uploaded", "aid" => "-14", "al" =>  "1", "gid" => "0", "hash" => $json['hash'], "mid" => $id, "photos" => $json['photos'], "server" => $server );
  410.                     $result = $this->sendpost ( "http://vk.com/al_photos.php", $post );
  411.                     $user_id = $this->getReg( '/(\d+)_\d+/i', $result, 1 );
  412.                     $photo_id = $this->getReg( '/\d+_(\d+)/i', $result, 1 );
  413.                     $attachment['attach'.$i] = $user_id.'_'.$photo_id;
  414.                     $attachment['attach'.$i.'_type'] = 'photo';
  415.                 }
  416.                 if ( $val['type'] == "video_vk" ){
  417.                     $i++;
  418.                     preg_match("/vk\.com\/video_ext\.php\?oid=([\d-]+)[^\s]+id=(\d+)/", $val['video_vk'], $match);
  419.                     $attachment['attach'.$i] = $match[0]."_".$match[1];
  420.                     $attachment['attach'.$i.'_type'] = 'video';
  421.                 }
  422.             }
  423.             $post = $this->utf8( $attachment + array( 'act' => 'post', 'al' => '1', 'text' => $this->short, 'facebook_export' => '', 'fixed' => '', 'friends_only' => '', 'from' => '', 'hash' => $post_hash, 'message' => $this->body, 'official' => '', 'signed' => '', 'status_export' => '', 'to_id' => $id, 'type' => 'all'));
  424.         }
  425.         if ( $this->fromgoup == '1' ) $post['official'] = '1';
  426.         if ( $this->signature == '1' ) $post['signed'] = '1';
  427.         $result = $this->sendpost ( 'http://vk.com/al_wall.php', $post );
  428.         if( strpos ( $result, 'id="page_wall_count_' ) ) {
  429.             $this->success = true;
  430.         } elseif ( preg_match ( '/<!>([0-9]+){12}<!>/i', $result ) ) {
  431.             while( preg_match ( '/<!>([0-9]+){12}<!>/i', $result ) ){
  432.                 $this->success = false;
  433.                 $i++;if ( $i == $smoconfig['captcha']+1 ) break;
  434.                 $captcha_sid = $this->getReg( '/<!>([0-9]+){12}<!>/i', $result, 1 );
  435.                 $captcha_key = $this->getCaptchaKey( "http://vk.com/captcha.php?sid=".$captcha_sid, $smoconfig['captcha_api'] );
  436.                 $post['captcha_sid'] = $captcha_sid;
  437.                 $post['captcha_key']  = $this->utf8( $captcha_key );
  438.                 $result = $this->sendpost ( 'http://vk.com/al_wall.php', $post );
  439.                 $this->success = true;
  440.             }
  441.         } else {
  442.             $this->success = false;
  443.         }
  444.     }
  445.     private function odnoklassnikigroup(){
  446.         if ($this->post_type == "image") { $this->success = false;return;}
  447.         $post = $this->cp1251( array ( "st.posted" => "set", "st.email" => $this->login, "st.password" => $this->password, "st.remember" => "on" ) );
  448.         $this->sendpost ( "http://www.odnoklassniki.ru/dk?cmd=AnonymLogin", $post );
  449.         $result = $this->sendpost ( "http://www.odnoklassniki.ru/group/".$this->group."/news", "" );
  450.         $gwtHash = $this->getReg( "/\"gwtHash\":\"(.*?)\"/", $result, 1 );
  451.         $groupId = $this->getReg( "/st\.groupId=(\w+)(?:\"|&)/", $result, 1 );
  452.         $postForm = $this->getReg( "/\"s2\":\"(\w+)\"/", $result, 1 );
  453.         if ( $this->post_type == "preview" ){
  454.             $post = $this->utf8( array ( "LinkPreviewId" => "1.linkPreview", "linkUrl" => $this->url) );
  455.             $result = $this->sendpost( "http://www.odnoklassniki.ru/group/".$this->group."/news?cmd=AltGroupPostContentAttachLink&gwt.requested=".$gwtHash."&st.cmd=altGroupNews&st.groupId=".$groupId, $post );
  456.             $real_url = $this->getReg( "/,\"11\":\"([^\"]+)\"/s", $result, 1 );
  457.             foreach ( $this->attaches as $num=>$val ) { if ( $val['type'] == "image" ) $image = $val['image_link'];break;}
  458.             $correctimg = strpos($result, $image);
  459.             if (!$correctimg){
  460.                 if (strpos($image, "/thumbs")) {
  461.                     $image = str_replace("/thumbs", "", $image);
  462.                     $correctimg = strpos($result, $image);
  463.                 } elseif (preg_match("/uploads\/posts\/\d+-\d+/", $image) ) {
  464.                     $image = preg_replace("/(.*?uploads\/posts\/\d+-\d+)(.*?)/", "$1/thumbs$2", $image);
  465.                     $correctimg = strpos($result, $image);
  466.                 } else $correctimg = false;
  467.             }
  468.             $size = getimagesize($image);
  469.             $size = array ($size[0], $size[1]);
  470.             $min_size = min($size);
  471.             $max_size = max($size);
  472.             $this->body = str_replace(array("\n\r","\r\n", "\n", "\r"),' ',$this->body);
  473.             $this->body = str_replace('"', '\"',$this->body);
  474.             $this->short = str_replace(array("\n\r","\r\n", "\n", "\r"),' ',$this->short);
  475.             $this->short = str_replace('"', '\"',$this->short);
  476.             $this->title = str_replace(array("\n\r","\r\n", "\n", "\r"),' ',$this->title);
  477.             $this->title = str_replace('"', '\"',$this->title);
  478.             if ( $correctimg and $min_size/$max_size >= 0.5 ){
  479.                 $json = (object)array( "formType" => "Group", "postDataList" => array ( (object)array( "text" => $this->utf8( $this->body ), "linkData" => (object)array( "title" => $this->utf8( $this->title ), "description" => $this->utf8( $this->short ), "providerViewer" => "1;1", "sourceUrl" => $real_url, "thumbnail" => $image ) ) ), "news" => true, "toStatus" => true );
  480.             } else {
  481.                 $json = (object)array( "formType" => "Group", "postDataList" => array ( (object)array( "text" => $this->utf8( $this->body ), "linkData" => (object)array( "title" => $this->utf8( $this->title ), "description" => $this->utf8( $this->short ), "providerViewer" => "1;1", "sourceUrl" => $real_url ) ) ), "news" => true, "toStatus" => true );
  482.             }
  483.             $post = array( "st.status.postpostForm" => $postForm, "st.status.postgroupId" => $groupId, "postingFormData" => $this->json_unescaped_unslashed_unicod(json_encode($json)));
  484.             $result = $this->sendpost ( "http://www.odnoklassniki.ru/group/".$this->group."/news?cmd=MediaTopicPost&gwt.requested=".$gwtHash."&st.cmd=altGroupNews&st.groupId=".$groupId, $post);
  485.         }
  486.         if ( preg_match('/"status":"ok"/', $result) ) {
  487.             $this->success = true;
  488.             if ( $this->nocomment == "1" ) {
  489.                 $result = $this->sendpost( "http://odnoklassniki.ru/group/".$this->group."/news?st.cmd=altGroupNews&st.groupId=".$groupId."&st.pageOffset=1&gwt.requested=".$gwtHash."&gwt.previous=st.cmd=altGroupNews&st.pageOffset=1&st.layer.cmd=PopLayerClose", "" );
  490.                 $layer_id = $this->getReg( "/st.layer.id=(\d+)/", $result, 1 );
  491.                 $this->sendpost ( "http://odnoklassniki.ru/group/".$this->group."/news?cmd=PopLayer&st.cmd=altGroupNews&st.layer.cmd=PopLayerAltGroupPinTheme&st.layer.id=".$layer_id."&st.layer.groupId=".$groupId."&st.layer.pin=off&st.layer.allowComments=on&st.groupId=".$groupId."&st.pageOffset=1&st._aid=Groups_News_All_switchCommentsButton&st.layer._bw=1280&st.layer._bh=516&gwt.requested=".$gwtHash, "" );
  492.             }
  493.         } else {
  494.             $this->success = false;
  495.         }
  496.     }
  497.     private function odnoklassnikiwall(){
  498.         if ($this->post_type == "image") { $this->success = false;return;}
  499.         $post = $this->cp1251( array ( "st.posted" => "set", "st.email" => $this->login, "st.password" => $this->password, "st.remember" => "on" ) );
  500.         $result = $this->sendpost ( "http://www.odnoklassniki.ru/dk?cmd=AnonymLogin", $post );
  501.         $gwtHash = $this->getReg( "/\"gwtHash\":\"(.*?)\"/", $result, 1 );
  502.         $prifileId = $this->getReg( "/\"oid\":\"(\d+)\"/", $result, 1 );
  503.         $postForm = $this->getReg( "/\"s2\":\"(\w+)\"/", $result, 1 );
  504.         if ( $this->post_type == "preview" ){
  505.             $post = $this->utf8( array ( "LinkPreviewId" => "linkPreview", "linkUrl" => $this->url) );
  506.             $result = $this->sendpost( "http://odnoklassniki.ru/profile/".$prifileId."?cmd=AltGroupPostContentAttachLink&gwt.requested=".$gwtHash."&st.cmd=userMain", $post );
  507.             $real_url = $this->getReg( "/,\"11\":\"([^\"]+)\"/s", $result, 1 );
  508.             $correctimg = strpos($result, $image);
  509.             if (!$correctimg){
  510.                 if (strpos($image, "/thumbs")) {
  511.                     $image = str_replace("/thumbs", "", $image);
  512.                     $correctimg = strpos($result, $image);
  513.                 } elseif (preg_match("/uploads\/posts\/\d+-\d+/", $image) ) {
  514.                     $image = preg_replace("/(.*?uploads\/posts\/\d+-\d+)(.*?)/", "$1/thumbs$2", $image);
  515.                     $correctimg = strpos($result, $image);
  516.                 } else $correctimg = false;
  517.             }
  518.             $size = getimagesize($image);
  519.             $size = array ($size[0], $size[1]);
  520.             $min_size = min($size);
  521.             $max_size = max($size);
  522.             $status_val = ($this->status)?true:false;
  523.             $this->body = str_replace(array("\n\r","\r\n", "\n", "\r"),' ',$this->body);
  524.             $this->body = str_replace('"', '\"',$this->body);
  525.             $this->short = str_replace(array("\n\r","\r\n", "\n", "\r"),' ',$this->short);
  526.             $this->short = str_replace('"', '\"',$this->short);
  527.             $this->title = str_replace(array("\n\r","\r\n", "\n", "\r"),' ',$this->title);
  528.             $this->title = str_replace('"', '\"',$this->title);
  529.             if ( $correctimg and $min_size/$max_size >= 0.5 ){
  530.                 $json = array("formType" => "Status", "postDataList" => array(array("text" => $this->utf8( $this->body ), "linkData" => array("title" => $this->utf8( $this->title ), "description" => $this->utf8( $this->short ), "providerViewer" => "1;1", "sourceUrl" => $real_url, "thumbnail" => $image))), "news" => "", "toStatus" => $status_val);
  531.             } else {
  532.                 $json = array("formType" => "Status", "postDataList" => array(array("text" => $this->utf8( $this->body ), "linkData" => array("title" => $this->utf8( $this->title ), "description" => $this->utf8( $this->short ), "providerViewer" => "1;1", "sourceUrl" => $real_url))), "news" => "", "toStatus" => $status_val);
  533.             }
  534.             $post = array( "st.status.postpostForm" => $postForm, "postingFormData" => $this->json_unescaped_unslashed_unicod(json_encode($json)));
  535.             $result = $this->sendpost ( "http://www.odnoklassniki.ru/?cmd=MediaTopicPost&gwt.requested=".$gwtHash."&st.cmd=userMain", $post);
  536.         }
  537.         if ( preg_match('/"status":"ok"/', $result) ) {
  538.             $this->success = true;
  539.         } else {
  540.             $this->success = false;
  541.         }
  542.     }
  543. }
  544. $poster = new poster;
  545. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement