PageRenderTime 54ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/wordpress/wp-content/plugins/wp-connect/functions.php

http://ownerpress.googlecode.com/
PHP | 610 lines | 548 code | 30 blank | 32 comment | 105 complexity | 968c0f0ebc4bddf211ef1ee4c2e677cb MD5 | raw file
Possible License(s): Apache-2.0, AGPL-1.0, GPL-2.0, GPL-3.0, LGPL-2.1
  1. <?php
  2. include_once(dirname(__FILE__) . '/config.php');
  3. /**
  4. * ????
  5. * @since 1.9.8
  6. */
  7. function wp_update_list($title, $postlink, $pic, $account) {
  8. global $wptm_options;
  9. if($pic[0] == 'video' && $pic[1]) { // ?????
  10. $vurl = $pic[1];
  11. $url = $postlink;
  12. } elseif($pic[0] == 'music' && $pic[1]) {
  13. if($pic[2] && $pic[3]) {
  14. $vurl = '#'.$pic[1].'#'.$pic[2].' '.$pic[3]; // #??# ?? url
  15. } else {
  16. $vurl = $pic[1]; // url
  17. }
  18. $url = $postlink;
  19. } else {
  20. $url = $postlink;
  21. }
  22. // ????t.cn???
  23. if ($wptm_options['t_cn']) {
  24. $url = get_t_cn(urlencode($url));
  25. }
  26. // ????????
  27. $postlink = trim($vurl.' '.$url);
  28. // ????
  29. $status = wp_status($title, $postlink, 140); //??/??/??/??/??
  30. $status2 = wp_status($title, $postlink, 200, 1); //??/follow5
  31. $sina = wp_status($title, urlencode($postlink), 140, 1); //??
  32. $qq = wp_status($title, $postlink, 140, 1); //??
  33. $kaixin001 = wp_status($title, $postlink, 200); //??
  34. $digu = wp_status($title, urlencode($postlink), 140); //??
  35. $twitter = wp_status($title, wp_urlencode($postlink), 140); //Twitter
  36. $wbto = wp_status($title, $postlink, 140, 1); //???
  37. $douban = wp_status($title, $postlink, 128); //??
  38. $renjian = wp_status($title, urlencode($postlink), 200, 1); //???
  39. // ????
  40. require_once(dirname(__FILE__) . '/OAuth/OAuth.php');
  41. $output = array();
  42. if($account['sina']) { $ms = wp_update_t_sina($account['sina'], $sina, $pic); $output['sina'] = $ms['mid'];} //140*
  43. if($account['qq']) { $output['qq'] = wp_update_t_qq($account['qq'], $qq, $pic); } //140*
  44. if($account['netease']) { wp_update_t_163($account['netease'], $status, $pic); } //163
  45. if($account['sohu']) { wp_update_t_sohu($account['sohu'], $status2, $pic); } //+
  46. if($account['douban']) { wp_update_douban($account['douban'], $douban); } //128
  47. if($account['digu']) { wp_update_digu($account['digu'], $digu); } //140
  48. if($account['fanfou']) { wp_update_fanfou($account['fanfou'], $status); } //140
  49. if($account['renjian']) { wp_update_renjian($account['renjian'], $renjian, $pic); } //+
  50. if($account['zuosa']) { wp_update_zuosa($account['zuosa'], $status); } //140
  51. if($account['wbto']) { wp_update_wbto($account['wbto'], $wbto, $pic); } //140+
  52. if($account['follow5']) { wp_update_follow5($account['follow5'], $status2, $pic); } //200*
  53. if($account['tianya']) { wp_update_tianya($account['tianya'], $sina, $pic); } //140*
  54. if($account['twitter']) { wp_update_twitter($account['twitter'], $twitter); }
  55. if($account['renren']) { wp_update_renren($account['renren'], $status); } //140
  56. //if($account['kaixin001']) { wp_update_kaixin001($account['kaixin001'], $kaixin001); } //380
  57. return $output;
  58. }
  59. // ????? start
  60. if (!function_exists('mb_substr')) {
  61. function mb_substr($str, $start = 0, $length = 0, $encode = 'utf-8') {
  62. $encode_len = ($encode == 'utf-8') ? 3 : 2;
  63. for($byteStart = $i = 0; $i < $start; ++$i) {
  64. $byteStart += ord($str{$byteStart}) < 128 ? 1 : $encode_len;
  65. if ($str{$byteStart} == '') return '';
  66. }
  67. for($i = 0, $byteLen = $byteStart; $i < $length; ++$i)
  68. $byteLen += ord($str{$byteLen}) < 128 ? 1 : $encode_len;
  69. return substr($str, $byteStart, $byteLen - $byteStart);
  70. }
  71. }
  72. if (!function_exists('mb_strlen')) {
  73. function mb_strlen($str, $encode = 'utf-8') {
  74. return ($encode == 'utf-8') ? strlen(utf8_decode($str)) : strlen($str);
  75. }
  76. }
  77. function close_curl() {
  78. if (!extension_loaded('curl')) {
  79. return " <span style=\"color:blue\">??php.ini?????extension=php_curl.dll</span>";
  80. } else {
  81. $func_str = '';
  82. if (!function_exists('curl_init')) {
  83. $func_str .= "curl_init() ";
  84. }
  85. if (!function_exists('curl_setopt')) {
  86. $func_str .= "curl_setopt() ";
  87. }
  88. if (!function_exists('curl_exec')) {
  89. $func_str .= "curl_exec()";
  90. }
  91. if ($func_str)
  92. return " <span style=\"color:blue\">??? $func_str ??????php.ini???disable_functions???????????</span>";
  93. }
  94. }
  95. function close_socket() {
  96. if (function_exists('fsockopen')) {
  97. $fp = 'fsockopen()';
  98. } elseif (function_exists('pfsockopen')) {
  99. $fp = 'pfsockopen()';
  100. } elseif (function_exists('stream_socket_client')) {
  101. $fp = 'stream_socket_client()';
  102. }
  103. if (!$fp) {
  104. return " <span style=\"color:blue\">??????????????? fsockopen() ?? pfsockopen() ?? stream_socket_client() ?????php.ini???disable_functions???????????</span>";
  105. }
  106. }
  107. function sfsockopen($host, $port, $errno, $errstr, $timeout) {
  108. if(function_exists('fsockopen')) {
  109. $fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
  110. } elseif(function_exists('pfsockopen')) {
  111. $fp = @pfsockopen($host, $port, $errno, $errstr, $timeout);
  112. } elseif(function_exists('stream_socket_client')) {
  113. $fp = @stream_socket_client($host.':'.$port, $errno, $errstr, $timeout);
  114. }
  115. return $fp;
  116. }
  117. function get_url_array($url) {
  118. return json_decode(get_url_contents($url), true);
  119. }
  120. function get_url_contents($url) {
  121. if (!close_curl()) {
  122. $ch = curl_init();
  123. curl_setopt($ch, CURLOPT_URL, $url);
  124. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  125. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  126. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  127. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  128. $content = curl_exec($ch);
  129. curl_close($ch);
  130. return $content;
  131. } else {
  132. $params = array();
  133. if (@ini_get('allow_url_fopen')) {
  134. if (function_exists('file_get_contents')) {
  135. return file_get_contents($url);
  136. }
  137. if (function_exists('fopen')) {
  138. $params['http'] = 'streams';
  139. }
  140. } elseif (function_exists('fsockopen')) {
  141. $params['http'] = 'fsockopen';
  142. } else {
  143. return wp_die('????????? HTTP ???????<a href="' . MY_PLUGIN_URL . '/check.php">????</a>');
  144. }
  145. $params += array("method" => 'GET',
  146. "timeout" => 30,
  147. "sslverify" => false
  148. );
  149. return class_http($url, $params);
  150. }
  151. }
  152. function http_ssl($url) {
  153. $arrURL = parse_url($url);
  154. $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
  155. $is_ssl = isset($r['ssl']) && $r['ssl'];
  156. if ($is_ssl && !extension_loaded('openssl'))
  157. return wp_die('???????openssl????<a href="' . MY_PLUGIN_URL . '/check.php">????</a>');
  158. }
  159. function class_http($url, $params = array()) {
  160. if ($params['http']) {
  161. $class = 'WP_Http_' . ucfirst($params['http']);
  162. } else {
  163. if (!close_curl()) {
  164. $class = 'WP_Http_Curl';
  165. } else {
  166. http_ssl($url);
  167. if (@ini_get('allow_url_fopen') && function_exists('fopen')) {
  168. $class = 'WP_Http_Streams';
  169. } elseif (function_exists('fsockopen')) {
  170. $class = 'WP_Http_Fsockopen';
  171. } else {
  172. return wp_die('????????? HTTP ???????<a href="' . MY_PLUGIN_URL . '/check.php">????</a>');
  173. }
  174. }
  175. }
  176. $http = new $class;
  177. $response = $http -> request($url, $params);
  178. if (!is_array($response)) {
  179. $errors = $response -> errors;
  180. $error = $errors['http_request_failed'][0];
  181. if (!$error)
  182. $error = $errors['http_failure'][0];
  183. wp_die('???: ' . $error . '<br /><br />??????????????<a href="' . MY_PLUGIN_URL . '/check.php">????</a>');
  184. }
  185. return $response['body'];
  186. }
  187. function post_user($username, $password, $pwd) { // $pwd????
  188. $username = trim($username);
  189. $password = trim($password);
  190. return array($username, (!$username) ? '' : (($password) ? key_encode($password) : $pwd));
  191. }
  192. function key_authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
  193. $ckey_length = 4;
  194. $key = ($key) ? md5($key) : '';
  195. $keya = md5(substr($key, 0, 16));
  196. $keyb = md5(substr($key, 16, 16));
  197. $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), - $ckey_length)) : '';
  198. $cryptkey = $keya . md5($keya . $keyc);
  199. $key_length = strlen($cryptkey);
  200. $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
  201. $string_length = strlen($string);
  202. $result = '';
  203. $box = range(0, 255);
  204. $rndkey = array();
  205. for($i = 0; $i <= 255; $i++) {
  206. $rndkey[$i] = ord($cryptkey[$i % $key_length]);
  207. }
  208. for($j = $i = 0; $i < 256; $i++) {
  209. $j = ($j + $box[$i] + $rndkey[$i]) % 256;
  210. $tmp = $box[$i];
  211. $box[$i] = $box[$j];
  212. $box[$j] = $tmp;
  213. }
  214. for($a = $j = $i = 0; $i < $string_length; $i++) {
  215. $a = ($a + 1) % 256;
  216. $j = ($j + $box[$a]) % 256;
  217. $tmp = $box[$a];
  218. $box[$a] = $box[$j];
  219. $box[$j] = $tmp;
  220. $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
  221. }
  222. if ($operation == 'DECODE') {
  223. if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
  224. return substr($result, 26);
  225. } else {
  226. return '';
  227. }
  228. } else {
  229. return $keyc . str_replace('=', '', base64_encode($result));
  230. }
  231. }
  232. function key_encode($string, $expiry = 0) {
  233. return key_authcode($string, 'ENCODE', 'WP-CONNECT', $expiry);
  234. }
  235. function key_decode($string) {
  236. return key_authcode($string, 'DECODE', 'WP-CONNECT');
  237. }
  238. // ????(?????????????????????)
  239. function wp_strlen($text) {
  240. $a = mb_strlen($text, 'utf-8');
  241. $b = strlen($text);
  242. $c = $b / 3 ;
  243. $d = ($a + $b) / 4;
  244. if ($a == $b) { // ?????????
  245. return $b / 2;
  246. } elseif ($a == $c) { // ???
  247. return $a;
  248. } elseif ($a != $c) { // ??
  249. return $d;
  250. }
  251. }
  252. // ????
  253. function wp_status($content, $url, $length, $num = '') {
  254. $temp_length = (mb_strlen($content, 'utf-8')) + (mb_strlen($url, 'utf-8'));
  255. if ($num) {
  256. $temp_length = (wp_strlen($content)) + (wp_strlen($url));
  257. }
  258. if ($url) {
  259. $length = $length - 4; // ' - '
  260. $url = ' '.$url;
  261. }
  262. if ($temp_length > $length) {
  263. $chars = $length - 3 - mb_strlen($url, 'utf-8'); // '...'
  264. if ($num) {
  265. $chars = $length - wp_strlen($url);
  266. $str = mb_substr($content, 0, $chars, 'utf-8');
  267. preg_match_all("/([\x{0000}-\x{00FF}]){1}/u", $str, $half_width); // ????
  268. $chars = $chars + count($half_width[0])/2;
  269. }
  270. $content = mb_substr($content, 0, $chars, 'utf-8');
  271. $content = $content . "...";
  272. }
  273. $status = $content . $url;
  274. return trim($status);
  275. }
  276. function wp_in_array($a, $b) {
  277. $arrayA = explode(',', $a);
  278. $arrayB = explode(',', $b);
  279. foreach($arrayB as $val) {
  280. if (in_array($val, $arrayA))
  281. return true;
  282. }
  283. return false;
  284. }
  285. function wp_urlencode($url) {
  286. $a = array('+', '%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
  287. $b = array(" ", "!", "*", "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]");
  288. $url = str_replace($a, $b, urlencode($url));
  289. return $url;
  290. }
  291. function wp_replace($str) {
  292. $a = array('&#160;', '&#038;', '&#8211;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&amp;', '&lt;', '&gt', '&ldquo;', '&rdquo;', '&nbsp;', 'Posted by Wordmobi');
  293. $b = array(' ', '&', '-', '‘', '’', '“', '”', '&', '<', '>', '“', '”', ' ', '');
  294. $str = str_replace($a, $b, strip_tags($str));
  295. return trim($str);
  296. }
  297. // ????? end
  298. // ???????
  299. function wp_multi_media_url($content) {
  300. preg_match_all('/<embed[^>]+src=[\"\']{1}(([^\"\'\s]+)\.swf)[\"\']{1}[^>]+>/isU', $content, $video);
  301. preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"].*>/isU', $content, $image);
  302. $v_sum = count($video[1]);
  303. $p_sum = count($image[1]);
  304. if ($v_sum > 0) { //??? ?? > ??
  305. $url = array("video", $video[1][0]);
  306. } elseif ($p_sum > 0) {
  307. $url = array("image", $image[1][0]);
  308. }
  309. return $url;
  310. }
  311. add_action( 'admin_footer', 'set_admin_footer_define', 1);
  312. function set_admin_footer_define() {
  313. define('IS_ADMIN_FOOTER', true);
  314. }
  315. function is_admin_footer() {
  316. if ( defined('IS_ADMIN_FOOTER'))
  317. return true;
  318. }
  319. if (!function_exists('get_t_cn')) {
  320. // ?????? t.cn ???WordPress ??
  321. function get_t_cn($long_url) {
  322. $source = SINA_APP_KEY;
  323. $api_url = 'http://api.t.sina.com.cn/short_url/shorten.json?source='.$source.'&url_long='.$long_url;
  324. $request = new WP_Http;
  325. $result = $request -> request($api_url);
  326. $result = $result['body'];
  327. $result = json_decode($result);
  328. return $result[0] -> url_short;
  329. }
  330. }
  331. // api
  332. function wp_update_api($status) {
  333. $api_url = 'http://www.smyx.net/apps/api.php';
  334. $request = new WP_Http;
  335. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $status));
  336. }
  337. // ????
  338. function wp_update_t_qq($tok, $status, $value) {
  339. if (!class_exists('qqOAuth')) {
  340. include dirname(__FILE__) . '/OAuth/qq_OAuth.php';
  341. }
  342. $to = new qqClient(QQ_APP_KEY, QQ_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  343. $result = $to -> update($status, $value);
  344. return $result['data']['id'];
  345. }
  346. // ????
  347. function wp_update_t_sina($tok, $status, $value) {
  348. if (!class_exists('sinaOAuth')) {
  349. include dirname(__FILE__) . '/OAuth/sina_OAuth.php';
  350. }
  351. $to = new sinaClient(SINA_APP_KEY, SINA_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  352. $result = $to -> update($status, $value);
  353. return $result;
  354. }
  355. // ????
  356. function wp_update_t_sohu($tok, $status, $value) {
  357. if (!class_exists('sohuOAuth')) {
  358. include dirname(__FILE__) . '/OAuth/sohu_OAuth.php';
  359. }
  360. $to = new sohuClient(SOHU_APP_KEY, SOHU_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  361. $result = $to -> update($status, $value);
  362. return $result;
  363. }
  364. // ????
  365. function wp_update_t_163($tok, $status, $value) {
  366. if (!class_exists('neteaseOAuth')) {
  367. include dirname(__FILE__) . '/OAuth/netease_OAuth.php';
  368. }
  369. $to = new neteaseClient(APP_KEY, APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  370. $result = $to -> update($status, $value);
  371. return $result;
  372. }
  373. // Twitter
  374. function wp_update_twitter($tok, $status, $value = '') {
  375. global $wptm_options;
  376. if ($wptm_options['enable_proxy']) {
  377. $text = "twitter={$status}&pic={$value}&t1={$tok['oauth_token']}&t2={$tok['oauth_token_secret']}";
  378. wp_update_api($text);
  379. } else {
  380. if (!class_exists('twitterOAuth')) {
  381. include dirname(__FILE__) . '/OAuth/twitter_OAuth.php';
  382. }
  383. $to = new twitterClient(T_APP_KEY, T_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  384. $result = $to -> update($status, $value);
  385. return $result;
  386. }
  387. }
  388. // ??
  389. function wp_update_douban($tok, $status) {
  390. if (!class_exists('doubanOAuth')) {
  391. include dirname(__FILE__) . '/OAuth/douban_OAuth.php';
  392. }
  393. $to = new doubanClient(DOUBAN_APP_KEY, DOUBAN_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  394. $result = $to -> update($status);
  395. return $result;
  396. }
  397. // ??
  398. function wp_update_tianya($tok, $status, $value) {
  399. if (!class_exists('tianyaOAuth')) {
  400. include dirname(__FILE__) . '/OAuth/tianya_OAuth.php';
  401. }
  402. $to = new tianyaClient(TIANYA_APP_KEY, TIANYA_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
  403. $result = $to -> update($status, $value);
  404. return $result;
  405. }
  406. // ??
  407. function wp_update_digu($user, $status) {
  408. $api_url = 'http://api.minicloud.com.cn/statuses/update.json';
  409. $body = array('content' => $status);
  410. $password = key_decode($user['password']);
  411. $headers = array('Authorization' => 'Basic ' . base64_encode("{$user['username']}:$password"));
  412. $request = new WP_Http;
  413. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $body, 'headers' => $headers));
  414. }
  415. // ??
  416. function wp_update_fanfou($user, $status) {
  417. $api_url = 'http://api.fanfou.com/statuses/update.json';
  418. $body = array('status' => $status);
  419. $password = key_decode($user['password']);
  420. $headers = array('Authorization' => 'Basic ' . base64_encode("{$user['username']}:$password"));
  421. $request = new WP_Http;
  422. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $body, 'headers' => $headers));
  423. }
  424. // ???
  425. function wp_update_renjian($user, $status, $value) {
  426. $api_url = 'http://api.renjian.com/v2/statuses/create.json';
  427. $body = array();
  428. $body['text'] = $status;
  429. if ($value[0] == "image" && $value[1]) {
  430. $body['status_type'] = "PICTURE";
  431. $body['url'] = $value[1];
  432. }
  433. $password = key_decode($user['password']);
  434. $headers = array('Authorization' => 'Basic ' . base64_encode("{$user['username']}:$password"));
  435. $request = new WP_Http;
  436. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $body, 'headers' => $headers));
  437. }
  438. // ???
  439. function wp_update_zuosa($user, $status) {
  440. $api_url = 'http://api.zuosa.com/statuses/update.json';
  441. $body = array('status' => $status);
  442. $password = key_decode($user['password']);
  443. $headers = array('Authorization' => 'Basic ' . base64_encode("{$user['username']}:$password"));
  444. $request = new WP_Http;
  445. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $body, 'headers' => $headers));
  446. }
  447. // Follow5
  448. function wp_update_follow5($user, $status, $value) {
  449. $api_url = 'http://api.follow5.com/api/statuses/update.xml?api_key=C1D656C887DB993D6FB6CA4A30754ED8';
  450. $body = array();
  451. $body['source'] = 'qq_wp_follow5';
  452. $body['status'] = $status;
  453. if ($value[1]) {
  454. $body['link'] = $value[1];
  455. }
  456. $password = key_decode($user['password']);
  457. $headers = array('Authorization' => 'Basic ' . base64_encode("{$user['username']}:$password"));
  458. $request = new WP_Http;
  459. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $body, 'headers' => $headers));
  460. }
  461. // wbto
  462. function wp_update_wbto($user, $status, $value) {
  463. $body = array();
  464. $body['source'] = 'wordpress';
  465. $body['content'] = urlencode($status);
  466. if ($value[0] == "image" && $value[1]) {
  467. $body['imgurl'] = $value[1];
  468. $api_url = 'http://wbto.cn/api/upload.json';
  469. } else {
  470. $api_url = 'http://wbto.cn/api/update.json';
  471. }
  472. $password = key_decode($user['password']);
  473. $headers = array('Authorization' => 'Basic ' . base64_encode("{$user['username']}:$password"));
  474. $request = new WP_Http;
  475. $result = $request -> request($api_url , array('method' => 'POST', 'body' => $body, 'headers' => $headers));
  476. }
  477. // ???
  478. function wp_update_renren($user, $status) {
  479. $cookie = tempnam('./tmp', 'renren');
  480. $password = key_decode($user['password']);
  481. $ch = wp_getCurl($cookie, "http://passport.renren.com/PLogin.do");
  482. curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=' . urlencode($user["username"]) . '&password=' . urlencode($password) . '&autoLogin=true&origURL=http%3A%2F%2Fwww.renren.com%2FHome.do&domain=renren.com');
  483. $str = wp_update_result($ch);
  484. $pattern = "/get_check:'([^']+)'/";
  485. preg_match($pattern, $str, $matches);
  486. $get_check = $matches[1];
  487. $ch = wp_getCurl($cookie, "http://status.renren.com/doing/update.do");
  488. curl_setopt($ch, CURLOPT_POSTFIELDS, 'c=' . urlencode($status) . '&raw=' . urlencode($status) . '&isAtHome=1&publisher_form_ticket=' . $get_check . '&requestToken=' . $get_check);
  489. curl_setopt($ch, CURLOPT_REFERER, 'http://status.renren.com/ajaxproxy.htm');
  490. $ret = wp_update_result($ch);
  491. }
  492. // ???
  493. function wp_update_kaixin001($user, $status) {
  494. $cookie = tempnam('./tmp', 'kaixin001');
  495. $password = key_decode($user['password']);
  496. $ch = wp_getCurl($cookie, "http://wap.kaixin001.com/home/?id=");
  497. curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=' . urlencode($user["username"]) . '&password=' . urlencode($password) . '&remember=1&from=&refuid=0&refcode=&bind=&gotourl=&login=+%E7%99%BB+%E5%BD%95+');
  498. $str = wp_update_result($ch);
  499. $pattern = "/state.php\?verify=([^\"]+)\"/";
  500. preg_match($pattern, $str, $matches);
  501. $verify = $matches[1];
  502. $ch = wp_getCurl($cookie, "http://wap.kaixin001.com/records/submit.php?verify=" . $verify . "&url=%2Fhome%2F%3Fid%3D");
  503. curl_setopt($ch, CURLOPT_POSTFIELDS, 'content=' . urlencode($status));
  504. curl_setopt($ch, CURLOPT_REFERER, 'http://wap.kaixin001.com/home/');
  505. $ret = wp_update_result($ch);
  506. }
  507. function wp_getCurl($cookie, $url) {
  508. $ch = curl_init();
  509. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
  510. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  511. curl_setopt($ch, CURLOPT_URL, $url);
  512. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  513. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  514. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12');
  515. curl_setopt($ch, CURLOPT_POST, 1);
  516. return $ch;
  517. }
  518. function wp_update_result($ch) {
  519. $str = curl_exec($ch);
  520. curl_close($ch);
  521. unset($ch);
  522. return $str;
  523. }
  524. // ?????????52?
  525. function wp_social_share_title() {
  526. return array("qzone" => "QQ??",
  527. "sina" => "????",
  528. "baidu" => "????",
  529. "renren" => "???",
  530. "qq" => "????",
  531. "kaixin001" => "???",
  532. "sohu" => "????",
  533. "hibaidu" => "????",
  534. "t163" => "????",
  535. "douban" => "??",
  536. "taojianghu" => "???",
  537. "msn" => "MSN",
  538. "buzz" => "??Buzz",
  539. "qqshuqian" => "QQ??",
  540. "tieba" => "????",
  541. "shequ51" => "51??",
  542. "shouji" => "??",
  543. "zhuaxia" => "??",
  544. "baishehui" => "?????",
  545. "ifeng" => "????",
  546. "pengyou" => "????",
  547. "facebook" => "Facebook",
  548. "twitter" => "Twitter",
  549. "tianya" => "????",
  550. "fanfou" => "??",
  551. "sc115" => "115??",
  552. "feixin" => "??",
  553. "digu" => "??",
  554. "follow5" => "Follow5",
  555. "tongxue" => "???",
  556. "youdao" => "????",
  557. "google" => "Google",
  558. "delicious" => "Delicious",
  559. "digg" => "Digg",
  560. "yahoo" => "Yahoo!",
  561. "live" => "??live",
  562. "hexun" => "????",
  563. "xianguo" => "??",
  564. "zuosa" => "??",
  565. "shuoke" => "139??",
  566. "myspace" => "???",
  567. "waakee" => "??",
  568. "leshou" => "??",
  569. "mop" => "????",
  570. "cnfol" => "????",
  571. "douban9" => "??9?",
  572. "dream163" => "????",
  573. "taonan" => "???",
  574. "club189" => "????",
  575. "baohe" => "???",
  576. "renmaiku" => "???",
  577. "ushi" => "???");
  578. }
  579. ?>