PageRenderTime 68ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/phpSource/UCenter_1.5.1_SC_UTF8/advanced/uc_client/client.php

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