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

/php/idc_manager/cidc-read-only/library/uc/uc_client/client.php

http://timoseven.googlecode.com/
PHP | 547 lines | 451 code | 72 blank | 24 comment | 77 complexity | 05fe0a20c8a2e91dd62f85ebe33d5e8c MD5 | raw file
Possible License(s): MIT, LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-3.0, AGPL-1.0
  1. <?php
  2. /*
  3. [UCenter] (C)2001-2009 Comsenz Inc.
  4. This is NOT a freeware, use is subject to license terms
  5. $Id: client.php 1018 2010-09-26 07:35:47Z cnteacher $
  6. */
  7. /*
  8. if(!defined('UC_API')) {
  9. exit('Access denied');
  10. }
  11. */
  12. error_reporting(0);
  13. define('IN_UC', TRUE);
  14. define('UC_CLIENT_VERSION', '1.5.2');
  15. define('UC_CLIENT_RELEASE', '20101001');
  16. define('UC_ROOT', substr(__FILE__, 0, -10));
  17. define('UC_DATADIR', UC_ROOT.'./data/');
  18. define('UC_DATAURL', UC_API.'/data');
  19. define('UC_API_FUNC', UC_CONNECT == 'mysql' ? 'uc_api_mysql' : 'uc_api_post');
  20. $GLOBALS['uc_controls'] = array();
  21. function uc_addslashes($string, $force = 0, $strip = FALSE) {
  22. !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
  23. if(!MAGIC_QUOTES_GPC || $force) {
  24. if(is_array($string)) {
  25. foreach($string as $key => $val) {
  26. $string[$key] = uc_addslashes($val, $force, $strip);
  27. }
  28. } else {
  29. $string = addslashes($strip ? stripslashes($string) : $string);
  30. }
  31. }
  32. return $string;
  33. }
  34. if(!function_exists('daddslashes')) {
  35. function daddslashes($string, $force = 0) {
  36. return uc_addslashes($string, $force);
  37. }
  38. }
  39. function uc_stripslashes($string) {
  40. !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
  41. if(MAGIC_QUOTES_GPC) {
  42. return stripslashes($string);
  43. } else {
  44. return $string;
  45. }
  46. }
  47. function uc_api_post($module, $action, $arg = array()) {
  48. $s = $sep = '';
  49. foreach($arg as $k => $v) {
  50. $k = urlencode($k);
  51. if(is_array($v)) {
  52. $s2 = $sep2 = '';
  53. foreach($v as $k2 => $v2) {
  54. $k2 = urlencode($k2);
  55. $s2 .= "$sep2{$k}[$k2]=".urlencode(uc_stripslashes($v2));
  56. $sep2 = '&';
  57. }
  58. $s .= $sep.$s2;
  59. } else {
  60. $s .= "$sep$k=".urlencode(uc_stripslashes($v));
  61. }
  62. $sep = '&';
  63. }
  64. $postdata = uc_api_requestdata($module, $action, $s);
  65. return uc_fopen2(UC_API.'/index.php', 500000, $postdata, '', TRUE, UC_IP, 20);
  66. }
  67. function uc_api_requestdata($module, $action, $arg='', $extra='') {
  68. $input = uc_api_input($arg);
  69. $post = "m=$module&a=$action&inajax=2&release=".UC_CLIENT_RELEASE."&input=$input&appid=".UC_APPID.$extra;
  70. return $post;
  71. }
  72. function uc_api_url($module, $action, $arg='', $extra='') {
  73. $url = UC_API.'/index.php?'.uc_api_requestdata($module, $action, $arg, $extra);
  74. return $url;
  75. }
  76. function uc_api_input($data) {
  77. $s = urlencode(uc_authcode($data.'&agent='.md5($_SERVER['HTTP_USER_AGENT'])."&time=".time(), 'ENCODE', UC_KEY));
  78. return $s;
  79. }
  80. function uc_api_mysql($model, $action, $args=array()) {
  81. global $uc_controls;
  82. if(empty($uc_controls[$model])) {
  83. include_once UC_ROOT.'./lib/db.class.php';
  84. include_once UC_ROOT.'./model/base.php';
  85. include_once UC_ROOT."./control/$model.php";
  86. eval("\$uc_controls['$model'] = new {$model}control();");
  87. }
  88. if($action{0} != '_') {
  89. $args = uc_addslashes($args, 1, TRUE);
  90. $action = 'on'.$action;
  91. $uc_controls[$model]->input = $args;
  92. return $uc_controls[$model]->$action($args);
  93. } else {
  94. return '';
  95. }
  96. }
  97. function uc_serialize($arr, $htmlon = 0) {
  98. include_once UC_ROOT.'./lib/xml.class.php';
  99. return xml_serialize($arr, $htmlon);
  100. }
  101. function uc_unserialize($s) {
  102. include_once UC_ROOT.'./lib/xml.class.php';
  103. return xml_unserialize($s);
  104. }
  105. function uc_authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
  106. $ckey_length = 4;
  107. $key = md5($key ? $key : UC_KEY);
  108. $keya = md5(substr($key, 0, 16));
  109. $keyb = md5(substr($key, 16, 16));
  110. $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
  111. $cryptkey = $keya.md5($keya.$keyc);
  112. $key_length = strlen($cryptkey);
  113. $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
  114. $string_length = strlen($string);
  115. $result = '';
  116. $box = range(0, 255);
  117. $rndkey = array();
  118. for($i = 0; $i <= 255; $i++) {
  119. $rndkey[$i] = ord($cryptkey[$i % $key_length]);
  120. }
  121. for($j = $i = 0; $i < 256; $i++) {
  122. $j = ($j + $box[$i] + $rndkey[$i]) % 256;
  123. $tmp = $box[$i];
  124. $box[$i] = $box[$j];
  125. $box[$j] = $tmp;
  126. }
  127. for($a = $j = $i = 0; $i < $string_length; $i++) {
  128. $a = ($a + 1) % 256;
  129. $j = ($j + $box[$a]) % 256;
  130. $tmp = $box[$a];
  131. $box[$a] = $box[$j];
  132. $box[$j] = $tmp;
  133. $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
  134. }
  135. if($operation == 'DECODE') {
  136. if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
  137. return substr($result, 26);
  138. } else {
  139. return '';
  140. }
  141. } else {
  142. return $keyc.str_replace('=', '', base64_encode($result));
  143. }
  144. }
  145. function uc_fopen2($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) {
  146. $__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1;
  147. if($__times__ > 2) {
  148. return '';
  149. }
  150. $url .= (strpos($url, '?') === FALSE ? '?' : '&')."__times__=$__times__";
  151. return uc_fopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block);
  152. }
  153. function uc_fopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) {
  154. $return = '';
  155. $matches = parse_url($url);
  156. !isset($matches['host']) && $matches['host'] = '';
  157. !isset($matches['path']) && $matches['path'] = '';
  158. !isset($matches['query']) && $matches['query'] = '';
  159. !isset($matches['port']) && $matches['port'] = '';
  160. $host = $matches['host'];
  161. $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
  162. $port = !empty($matches['port']) ? $matches['port'] : 80;
  163. if($post) {
  164. $out = "POST $path HTTP/1.0\r\n";
  165. $out .= "Accept: */*\r\n";
  166. //$out .= "Referer: $boardurl\r\n";
  167. $out .= "Accept-Language: zh-cn\r\n";
  168. $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
  169. $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
  170. $out .= "Host: $host\r\n";
  171. $out .= 'Content-Length: '.strlen($post)."\r\n";
  172. $out .= "Connection: Close\r\n";
  173. $out .= "Cache-Control: no-cache\r\n";
  174. $out .= "Cookie: $cookie\r\n\r\n";
  175. $out .= $post;
  176. } else {
  177. $out = "GET $path HTTP/1.0\r\n";
  178. $out .= "Accept: */*\r\n";
  179. //$out .= "Referer: $boardurl\r\n";
  180. $out .= "Accept-Language: zh-cn\r\n";
  181. $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
  182. $out .= "Host: $host\r\n";
  183. $out .= "Connection: Close\r\n";
  184. $out .= "Cookie: $cookie\r\n\r\n";
  185. }
  186. if(function_exists('fsockopen')) {
  187. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  188. } elseif (function_exists('pfsockopen')) {
  189. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  190. } else {
  191. $fp = false;
  192. }
  193. if(!$fp) {
  194. return '';
  195. } else {
  196. stream_set_blocking($fp, $block);
  197. stream_set_timeout($fp, $timeout);
  198. @fwrite($fp, $out);
  199. $status = stream_get_meta_data($fp);
  200. if(!$status['timed_out']) {
  201. while (!feof($fp)) {
  202. if(($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) {
  203. break;
  204. }
  205. }
  206. $stop = false;
  207. while(!feof($fp) && !$stop) {
  208. $data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit));
  209. $return .= $data;
  210. if($limit) {
  211. $limit -= strlen($data);
  212. $stop = $limit <= 0;
  213. }
  214. }
  215. }
  216. @fclose($fp);
  217. return $return;
  218. }
  219. }
  220. function uc_app_ls() {
  221. $return = call_user_func(UC_API_FUNC, 'app', 'ls', array());
  222. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  223. }
  224. function uc_feed_add($icon, $uid, $username, $title_template='', $title_data='', $body_template='', $body_data='', $body_general='', $target_ids='', $images = array()) {
  225. return call_user_func(UC_API_FUNC, 'feed', 'add',
  226. array( 'icon'=>$icon,
  227. 'appid'=>UC_APPID,
  228. 'uid'=>$uid,
  229. 'username'=>$username,
  230. 'title_template'=>$title_template,
  231. 'title_data'=>$title_data,
  232. 'body_template'=>$body_template,
  233. 'body_data'=>$body_data,
  234. 'body_general'=>$body_general,
  235. 'target_ids'=>$target_ids,
  236. 'image_1'=>$images[0]['url'],
  237. 'image_1_link'=>$images[0]['link'],
  238. 'image_2'=>$images[1]['url'],
  239. 'image_2_link'=>$images[1]['link'],
  240. 'image_3'=>$images[2]['url'],
  241. 'image_3_link'=>$images[2]['link'],
  242. 'image_4'=>$images[3]['url'],
  243. 'image_4_link'=>$images[3]['link']
  244. )
  245. );
  246. }
  247. function uc_feed_get($limit = 100, $delete = TRUE) {
  248. $return = call_user_func(UC_API_FUNC, 'feed', 'get', array('limit'=>$limit, 'delete'=>$delete));
  249. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  250. }
  251. function uc_friend_add($uid, $friendid, $comment='') {
  252. return call_user_func(UC_API_FUNC, 'friend', 'add', array('uid'=>$uid, 'friendid'=>$friendid, 'comment'=>$comment));
  253. }
  254. function uc_friend_delete($uid, $friendids) {
  255. return call_user_func(UC_API_FUNC, 'friend', 'delete', array('uid'=>$uid, 'friendids'=>$friendids));
  256. }
  257. function uc_friend_totalnum($uid, $direction = 0) {
  258. return call_user_func(UC_API_FUNC, 'friend', 'totalnum', array('uid'=>$uid, 'direction'=>$direction));
  259. }
  260. function uc_friend_ls($uid, $page = 1, $pagesize = 10, $totalnum = 10, $direction = 0) {
  261. $return = call_user_func(UC_API_FUNC, 'friend', 'ls', array('uid'=>$uid, 'page'=>$page, 'pagesize'=>$pagesize, 'totalnum'=>$totalnum, 'direction'=>$direction));
  262. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  263. }
  264. function uc_user_register($username, $password, $email, $questionid = '', $answer = '', $regip = '') {
  265. return call_user_func(UC_API_FUNC, 'user', 'register', array('username'=>$username, 'password'=>$password, 'email'=>$email, 'questionid'=>$questionid, 'answer'=>$answer, 'regip' => $regip));
  266. }
  267. function uc_user_login($username, $password, $isuid = 0, $checkques = 0, $questionid = '', $answer = '') {
  268. $isuid = intval($isuid);
  269. $return = call_user_func(UC_API_FUNC, 'user', 'login', array('username'=>$username, 'password'=>$password, 'isuid'=>$isuid, 'checkques'=>$checkques, 'questionid'=>$questionid, 'answer'=>$answer));
  270. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  271. }
  272. function uc_user_synlogin($uid) {
  273. $uid = intval($uid);
  274. if(@include UC_ROOT.'./data/cache/apps.php') {
  275. if(count($_CACHE['apps']) > 1) {
  276. $return = uc_api_post('user', 'synlogin', array('uid'=>$uid));
  277. } else {
  278. $return = '';
  279. }
  280. }
  281. return $return;
  282. }
  283. function uc_user_synlogout() {
  284. if(@include UC_ROOT.'./data/cache/apps.php') {
  285. if(count($_CACHE['apps']) > 1) {
  286. $return = uc_api_post('user', 'synlogout', array());
  287. } else {
  288. $return = '';
  289. }
  290. }
  291. return $return;
  292. }
  293. function uc_user_edit($username, $oldpw, $newpw, $email, $ignoreoldpw = 0, $questionid = '', $answer = '') {
  294. return call_user_func(UC_API_FUNC, 'user', 'edit', array('username'=>$username, 'oldpw'=>$oldpw, 'newpw'=>$newpw, 'email'=>$email, 'ignoreoldpw'=>$ignoreoldpw, 'questionid'=>$questionid, 'answer'=>$answer));
  295. }
  296. function uc_user_delete($uid) {
  297. return call_user_func(UC_API_FUNC, 'user', 'delete', array('uid'=>$uid));
  298. }
  299. function uc_user_deleteavatar($uid) {
  300. uc_api_post('user', 'deleteavatar', array('uid'=>$uid));
  301. }
  302. function uc_user_checkname($username) {
  303. return call_user_func(UC_API_FUNC, 'user', 'check_username', array('username'=>$username));
  304. }
  305. function uc_user_checkemail($email) {
  306. return call_user_func(UC_API_FUNC, 'user', 'check_email', array('email'=>$email));
  307. }
  308. function uc_user_addprotected($username, $admin='') {
  309. return call_user_func(UC_API_FUNC, 'user', 'addprotected', array('username'=>$username, 'admin'=>$admin));
  310. }
  311. function uc_user_deleteprotected($username) {
  312. return call_user_func(UC_API_FUNC, 'user', 'deleteprotected', array('username'=>$username));
  313. }
  314. function uc_user_getprotected() {
  315. $return = call_user_func(UC_API_FUNC, 'user', 'getprotected', array('1'=>1));
  316. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  317. }
  318. function uc_get_user($username, $isuid=0) {
  319. $return = call_user_func(UC_API_FUNC, 'user', 'get_user', array('username'=>$username, 'isuid'=>$isuid));
  320. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  321. }
  322. function uc_user_merge($oldusername, $newusername, $uid, $password, $email) {
  323. return call_user_func(UC_API_FUNC, 'user', 'merge', array('oldusername'=>$oldusername, 'newusername'=>$newusername, 'uid'=>$uid, 'password'=>$password, 'email'=>$email));
  324. }
  325. function uc_user_merge_remove($username) {
  326. return call_user_func(UC_API_FUNC, 'user', 'merge_remove', array('username'=>$username));
  327. }
  328. function uc_user_getcredit($appid, $uid, $credit) {
  329. return uc_api_post('user', 'getcredit', array('appid'=>$appid, 'uid'=>$uid, 'credit'=>$credit));
  330. }
  331. function uc_pm_location($uid, $newpm = 0) {
  332. $apiurl = uc_api_url('pm_client', 'ls', "uid=$uid", ($newpm ? '&folder=newbox' : ''));
  333. @header("Expires: 0");
  334. @header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
  335. @header("Pragma: no-cache");
  336. @header("location: $apiurl");
  337. }
  338. function uc_pm_checknew($uid, $more = 0) {
  339. $return = call_user_func(UC_API_FUNC, 'pm', 'check_newpm', array('uid'=>$uid, 'more'=>$more));
  340. return (!$more || UC_CONNECT == 'mysql') ? $return : uc_unserialize($return);
  341. }
  342. function uc_pm_send($fromuid, $msgto, $subject, $message, $instantly = 1, $replypmid = 0, $isusername = 0) {
  343. if($instantly) {
  344. $replypmid = @is_numeric($replypmid) ? $replypmid : 0;
  345. return call_user_func(UC_API_FUNC, 'pm', 'sendpm', array('fromuid'=>$fromuid, 'msgto'=>$msgto, 'subject'=>$subject, 'message'=>$message, 'replypmid'=>$replypmid, 'isusername'=>$isusername));
  346. } else {
  347. $fromuid = intval($fromuid);
  348. $subject = rawurlencode($subject);
  349. $msgto = rawurlencode($msgto);
  350. $message = rawurlencode($message);
  351. $replypmid = @is_numeric($replypmid) ? $replypmid : 0;
  352. $replyadd = $replypmid ? "&pmid=$replypmid&do=reply" : '';
  353. $apiurl = uc_api_url('pm_client', 'send', "uid=$fromuid", "&msgto=$msgto&subject=$subject&message=$message$replyadd");
  354. @header("Expires: 0");
  355. @header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
  356. @header("Pragma: no-cache");
  357. @header("location: ".$apiurl);
  358. }
  359. }
  360. function uc_pm_delete($uid, $folder, $pmids) {
  361. return call_user_func(UC_API_FUNC, 'pm', 'delete', array('uid'=>$uid, 'folder'=>$folder, 'pmids'=>$pmids));
  362. }
  363. function uc_pm_deleteuser($uid, $touids) {
  364. return call_user_func(UC_API_FUNC, 'pm', 'deleteuser', array('uid'=>$uid, 'touids'=>$touids));
  365. }
  366. function uc_pm_readstatus($uid, $uids, $pmids = array(), $status = 0) {
  367. return call_user_func(UC_API_FUNC, 'pm', 'readstatus', array('uid'=>$uid, 'uids'=>$uids, 'pmids'=>$pmids, 'status'=>$status));
  368. }
  369. function uc_pm_list($uid, $page = 1, $pagesize = 10, $folder = 'inbox', $filter = 'newpm', $msglen = 0) {
  370. $uid = intval($uid);
  371. $page = intval($page);
  372. $pagesize = intval($pagesize);
  373. $return = call_user_func(UC_API_FUNC, 'pm', 'ls', array('uid'=>$uid, 'page'=>$page, 'pagesize'=>$pagesize, 'folder'=>$folder, 'filter'=>$filter, 'msglen'=>$msglen));
  374. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  375. }
  376. function uc_pm_ignore($uid) {
  377. $uid = intval($uid);
  378. return call_user_func(UC_API_FUNC, 'pm', 'ignore', array('uid'=>$uid));
  379. }
  380. function uc_pm_view($uid, $pmid, $touid = 0, $daterange = 1) {
  381. $uid = intval($uid);
  382. $touid = intval($touid);
  383. $pmid = @is_numeric($pmid) ? $pmid : 0;
  384. $return = call_user_func(UC_API_FUNC, 'pm', 'view', array('uid'=>$uid, 'pmid'=>$pmid, 'touid'=>$touid, 'daterange'=>$daterange));
  385. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  386. }
  387. function uc_pm_viewnode($uid, $type = 0, $pmid = 0) {
  388. $uid = intval($uid);
  389. $pmid = @is_numeric($pmid) ? $pmid : 0;
  390. $return = call_user_func(UC_API_FUNC, 'pm', 'viewnode', array('uid'=>$uid, 'pmid'=>$pmid, 'type'=>$type));
  391. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  392. }
  393. function uc_pm_blackls_get($uid) {
  394. $uid = intval($uid);
  395. return call_user_func(UC_API_FUNC, 'pm', 'blackls_get', array('uid'=>$uid));
  396. }
  397. function uc_pm_blackls_set($uid, $blackls) {
  398. $uid = intval($uid);
  399. return call_user_func(UC_API_FUNC, 'pm', 'blackls_set', array('uid'=>$uid, 'blackls'=>$blackls));
  400. }
  401. function uc_pm_blackls_add($uid, $username) {
  402. $uid = intval($uid);
  403. return call_user_func(UC_API_FUNC, 'pm', 'blackls_add', array('uid'=>$uid, 'username'=>$username));
  404. }
  405. function uc_pm_blackls_delete($uid, $username) {
  406. $uid = intval($uid);
  407. return call_user_func(UC_API_FUNC, 'pm', 'blackls_delete', array('uid'=>$uid, 'username'=>$username));
  408. }
  409. function uc_domain_ls() {
  410. $return = call_user_func(UC_API_FUNC, 'domain', 'ls', array('1'=>1));
  411. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  412. }
  413. function uc_credit_exchange_request($uid, $from, $to, $toappid, $amount) {
  414. $uid = intval($uid);
  415. $from = intval($from);
  416. $toappid = intval($toappid);
  417. $to = intval($to);
  418. $amount = intval($amount);
  419. return uc_api_post('credit', 'request', array('uid'=>$uid, 'from'=>$from, 'to'=>$to, 'toappid'=>$toappid, 'amount'=>$amount));
  420. }
  421. function uc_tag_get($tagname, $nums = 0) {
  422. $return = call_user_func(UC_API_FUNC, 'tag', 'gettag', array('tagname'=>$tagname, 'nums'=>$nums));
  423. return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
  424. }
  425. function uc_avatar($uid, $type = 'virtual', $returnhtml = 1) {
  426. $uid = intval($uid);
  427. $uc_input = uc_api_input("uid=$uid");
  428. $uc_avatarflash = UC_API.'/images/camera.swf?inajax=1&appid='.UC_APPID.'&input='.$uc_input.'&agent='.md5($_SERVER['HTTP_USER_AGENT']).'&ucapi='.urlencode(str_replace('http://', '', UC_API)).'&avatartype='.$type.'&uploadSize=2048';
  429. if($returnhtml) {
  430. return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="450" height="253" id="mycamera" align="middle">
  431. <param name="allowScriptAccess" value="always" />
  432. <param name="scale" value="exactfit" />
  433. <param name="wmode" value="transparent" />
  434. <param name="quality" value="high" />
  435. <param name="bgcolor" value="#ffffff" />
  436. <param name="movie" value="'.$uc_avatarflash.'" />
  437. <param name="menu" value="false" />
  438. <embed src="'.$uc_avatarflash.'" quality="high" bgcolor="#ffffff" width="450" height="253" name="mycamera" align="middle" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  439. </object>';
  440. } else {
  441. return array(
  442. 'width', '450',
  443. 'height', '253',
  444. 'scale', 'exactfit',
  445. 'src', $uc_avatarflash,
  446. 'id', 'mycamera',
  447. 'name', 'mycamera',
  448. 'quality','high',
  449. 'bgcolor','#ffffff',
  450. 'wmode','transparent',
  451. 'menu', 'false',
  452. 'swLiveConnect', 'true',
  453. 'allowScriptAccess', 'always'
  454. );
  455. }
  456. }
  457. function uc_mail_queue($uids, $emails, $subject, $message, $frommail = '', $charset = 'gbk', $htmlon = FALSE, $level = 1) {
  458. return call_user_func(UC_API_FUNC, 'mail', 'add', array('uids' => $uids, 'emails' => $emails, 'subject' => $subject, 'message' => $message, 'frommail' => $frommail, 'charset' => $charset, 'htmlon' => $htmlon, 'level' => $level));
  459. }
  460. function uc_check_avatar($uid, $size = 'middle', $type = 'virtual') {
  461. $url = UC_API."/avatar.php?uid=$uid&size=$size&type=$type&check_file_exists=1";
  462. $res = uc_fopen2($url, 500000, '', '', TRUE, UC_IP, 20);
  463. if($res == 1) {
  464. return 1;
  465. } else {
  466. return 0;
  467. }
  468. }
  469. function uc_check_version() {
  470. $return = uc_api_post('version', 'check', array());
  471. $data = uc_unserialize($return);
  472. return is_array($data) ? $data : $return;
  473. }
  474. ?>