First commit
This commit is contained in:
44
uc_client/control/app.php
Normal file
44
uc_client/control/app.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: app.php 1059 2011-03-01 07:25:09Z monkey $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class appcontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->appcontrol();
|
||||
}
|
||||
|
||||
function appcontrol() {
|
||||
parent::__construct();
|
||||
$this->load('app');
|
||||
}
|
||||
|
||||
function onls() {
|
||||
$this->init_input();
|
||||
$applist = $_ENV['app']->get_apps('appid, type, name, url, tagtemplates, viewprourl, synlogin');
|
||||
$applist2 = array();
|
||||
foreach($applist as $key => $app) {
|
||||
$app['tagtemplates'] = $this->unserialize($app['tagtemplates']);
|
||||
$applist2[$app['appid']] = $app;
|
||||
}
|
||||
return $applist2;
|
||||
}
|
||||
|
||||
function onadd() {
|
||||
}
|
||||
|
||||
function onucinfo() {
|
||||
}
|
||||
|
||||
function _format_notedata($notedata) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
29
uc_client/control/cache.php
Normal file
29
uc_client/control/cache.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: cache.php 1059 2011-03-01 07:25:09Z monkey $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class cachecontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->cachecontrol();
|
||||
}
|
||||
|
||||
function cachecontrol() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function onupdate($arr) {
|
||||
$this->load("cache");
|
||||
$_ENV['cache']->updatedata();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
29
uc_client/control/domain.php
Normal file
29
uc_client/control/domain.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: domain.php 1059 2011-03-01 07:25:09Z monkey $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class domaincontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->domaincontrol();
|
||||
}
|
||||
|
||||
function domaincontrol() {
|
||||
parent::__construct();
|
||||
$this->init_input();
|
||||
$this->load('domain');
|
||||
}
|
||||
|
||||
function onls() {
|
||||
return $_ENV['domain']->get_list(1, 9999, 9999);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
105
uc_client/control/feed.php
Normal file
105
uc_client/control/feed.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: feed.php 1139 2012-05-08 09:02:11Z liulanbo $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class feedcontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->feedcontrol();
|
||||
}
|
||||
|
||||
function feedcontrol() {
|
||||
parent::__construct();
|
||||
$this->init_input();
|
||||
}
|
||||
|
||||
function onadd() {
|
||||
$this->load('misc');
|
||||
$appid = intval($this->input('appid'));
|
||||
$icon = $this->input('icon');
|
||||
$uid = intval($this->input('uid'));
|
||||
$username = $this->input('username');
|
||||
$body_data = $_ENV['misc']->array2string($this->input('body_data'));
|
||||
$title_data = $_ENV['misc']->array2string($this->input('title_data'));
|
||||
|
||||
$title_template = $this->_parsetemplate($this->input('title_template'));
|
||||
$body_template = $this->_parsetemplate($this->input('body_template'));
|
||||
$body_general = $this->input('body_general');
|
||||
$target_ids = $this->input('target_ids');
|
||||
$image_1 = $this->input('image_1');
|
||||
$image_1_link = $this->input('image_1_link');
|
||||
$image_2 = $this->input('image_2');
|
||||
$image_2_link = $this->input('image_2_link');
|
||||
$image_3 = $this->input('image_3');
|
||||
$image_3_link = $this->input('image_3_link');
|
||||
$image_4 = $this->input('image_4');
|
||||
$image_4_link = $this->input('image_4_link');
|
||||
|
||||
$hash_template = md5($title_template.$body_template);
|
||||
$hash_data = md5($title_template.$title_data.$body_template.$body_data);
|
||||
$dateline = $this->time;
|
||||
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."feeds SET appid='$appid', icon='$icon', uid='$uid', username='$username',
|
||||
title_template='$title_template', title_data='$title_data', body_template='$body_template', body_data='$body_data', body_general='$body_general',
|
||||
image_1='$image_1', image_1_link='$image_1_link', image_2='$image_2', image_2_link='$image_2_link',
|
||||
image_3='$image_3', image_3_link='$image_3_link', image_4='$image_4', image_4_link='$image_4_link',
|
||||
hash_template='$hash_template', hash_data='$hash_data', target_ids='$target_ids', dateline='$dateline'");
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
function ondelete() {
|
||||
$start = $this->input('start');
|
||||
$limit = $this->input('limit');
|
||||
$end = $start + $limit;
|
||||
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."feeds WHERE feedid>'$start' AND feedid<'$end'");
|
||||
}
|
||||
|
||||
function onget() {
|
||||
$this->load('misc');
|
||||
$limit = intval($this->input('limit'));
|
||||
$delete = $this->input('delete');
|
||||
$feedlist = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."feeds ORDER BY feedid DESC LIMIT $limit");
|
||||
if($feedlist) {
|
||||
$maxfeedid = $feedlist[0]['feedid'];
|
||||
foreach($feedlist as $key => $feed) {
|
||||
$feed['body_data'] = $_ENV['misc']->string2array($feed['body_data']);
|
||||
$feed['title_data'] = $_ENV['misc']->string2array($feed['title_data']);
|
||||
$feedlist[$key] = $feed;
|
||||
}
|
||||
}
|
||||
if(!empty($feedlist)) {
|
||||
if(!isset($delete) || $delete) {
|
||||
$this->_delete(0, $maxfeedid);
|
||||
}
|
||||
}
|
||||
return $feedlist;
|
||||
}
|
||||
|
||||
function _delete($start, $end) {
|
||||
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."feeds WHERE feedid>='$start' AND feedid<='$end'");
|
||||
}
|
||||
|
||||
function _parsetemplate($template) {
|
||||
$template = str_replace(array("\r", "\n"), '', $template);
|
||||
$template = str_replace(array('<br>', '<br />', '<BR>', '<BR />'), "\n", $template);
|
||||
$template = str_replace(array('<b>', '<B>'), '[B]', $template);
|
||||
$template = str_replace(array('<i>', '<I>'), '[I]', $template);
|
||||
$template = str_replace(array('<u>', '<U>'), '[U]', $template);
|
||||
$template = str_replace(array('</b>', '</B>'), '[/B]', $template);
|
||||
$template = str_replace(array('</i>', '</I>'), '[/I]', $template);
|
||||
$template = str_replace(array('</u>', '</U>'), '[/U]', $template);
|
||||
$template = dhtmlspecialchars($template);
|
||||
$template = nl2br($template);
|
||||
$template = str_replace(array('[B]', '[I]', '[U]', '[/B]', '[/I]', '[/U]'), array('<b>', '<i>', '<u>', '</b>', '</i>', '</u>'), $template);
|
||||
return $template;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
59
uc_client/control/friend.php
Normal file
59
uc_client/control/friend.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: friend.php 1059 2011-03-01 07:25:09Z monkey $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class friendcontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->friendcontrol();
|
||||
}
|
||||
|
||||
function friendcontrol() {
|
||||
parent::__construct();
|
||||
$this->init_input();
|
||||
$this->load('friend');
|
||||
}
|
||||
|
||||
function ondelete() {
|
||||
$uid = intval($this->input('uid'));
|
||||
$friendids = $this->input('friendids');
|
||||
$id = $_ENV['friend']->delete($uid, $friendids);
|
||||
return $id;
|
||||
}
|
||||
|
||||
function onadd() {
|
||||
$uid = intval($this->input('uid'));
|
||||
$friendid = $this->input('friendid');
|
||||
$comment = $this->input('comment');
|
||||
$id = $_ENV['friend']->add($uid, $friendid, $comment);
|
||||
return $id;
|
||||
}
|
||||
|
||||
function ontotalnum() {
|
||||
$uid = intval($this->input('uid'));
|
||||
$direction = intval($this->input('direction'));
|
||||
$totalnum = $_ENV['friend']->get_totalnum_by_uid($uid, $direction);
|
||||
return $totalnum;
|
||||
}
|
||||
|
||||
function onls() {
|
||||
$uid = intval($this->input('uid'));
|
||||
$page = intval($this->input('page'));
|
||||
$pagesize = intval($this->input('pagesize'));
|
||||
$totalnum = intval($this->input('totalnum'));
|
||||
$direction = intval($this->input('direction'));
|
||||
$pagesize = $pagesize ? $pagesize : UC_PPP;
|
||||
$totalnum = $totalnum ? $totalnum : $_ENV['friend']->get_totalnum_by_uid($uid);
|
||||
$data = $_ENV['friend']->get_list($uid, $page, $pagesize, $totalnum, $direction);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
1
uc_client/control/index.htm
Normal file
1
uc_client/control/index.htm
Normal file
@@ -0,0 +1 @@
|
||||
|
41
uc_client/control/mail.php
Normal file
41
uc_client/control/mail.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: mail.php 1059 2011-03-01 07:25:09Z monkey $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class mailcontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->mailcontrol();
|
||||
}
|
||||
|
||||
function mailcontrol() {
|
||||
parent::__construct();
|
||||
$this->init_input();
|
||||
}
|
||||
|
||||
function onadd() {
|
||||
$this->load('mail');
|
||||
$mail = array();
|
||||
$mail['appid'] = UC_APPID;
|
||||
$mail['uids'] = explode(',', $this->input('uids'));
|
||||
$mail['emails'] = explode(',', $this->input('emails'));
|
||||
$mail['subject'] = $this->input('subject');
|
||||
$mail['message'] = $this->input('message');
|
||||
$mail['charset'] = $this->input('charset');
|
||||
$mail['htmlon'] = intval($this->input('htmlon'));
|
||||
$mail['level'] = abs(intval($this->input('level')));
|
||||
$mail['frommail'] = $this->input('frommail');
|
||||
$mail['dateline'] = $this->time;
|
||||
return $_ENV['mail']->add($mail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
365
uc_client/control/pm.php
Normal file
365
uc_client/control/pm.php
Normal file
@@ -0,0 +1,365 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: pm.php 1067 2011-03-08 10:06:51Z svn_project_zhangjie $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
define('PRIVATEPMTHREADLIMIT_ERROR', -1);
|
||||
define('PMFLOODCTRL_ERROR', -2);
|
||||
define('PMMSGTONOTFRIEND', -3);
|
||||
define('PMSENDREGDAYS', -4);
|
||||
define('CHATPMTHREADLIMIT_ERROR', -5);
|
||||
define('CHATPMMEMBERLIMIT_ERROR', -7);
|
||||
|
||||
class pmcontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->pmcontrol();
|
||||
}
|
||||
|
||||
function pmcontrol() {
|
||||
parent::__construct();
|
||||
$this->load('user');
|
||||
$this->load('pm');
|
||||
}
|
||||
|
||||
function oncheck_newpm() {
|
||||
$this->init_input();
|
||||
$uid = intval($this->input('uid'));
|
||||
$more = intval($this->input('more'));
|
||||
if(!$_ENV['pm']->isnewpm($uid) && !$more) {
|
||||
return 0;
|
||||
}
|
||||
$newprvpm = $_ENV['pm']->getpmnum($uid, 1, 1);
|
||||
$newchatpm = $_ENV['pm']->getpmnum($uid, 2, 1);
|
||||
$newpm = $newprvpm + $newchatpm;
|
||||
if($more == 0) {
|
||||
return $newpm;
|
||||
} elseif($more == 1) {
|
||||
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm);
|
||||
} elseif($more == 2 || $more == 3) {
|
||||
if($more == 2) {
|
||||
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'newchatpm' => $newchatpm);
|
||||
} else {
|
||||
$lastpm = $_ENV['pm']->lastpm($uid);
|
||||
require_once UC_ROOT.'lib/uccode.class.php';
|
||||
$this->uccode = new uccode();
|
||||
$lastpm['lastsummary'] = $this->uccode->complie($lastpm['lastsummary']);
|
||||
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'newchatpm' => $newchatpm, 'lastdate' => $lastpm['lastdateline'], 'lastmsgfromid' => $lastpm['lastauthorid'], 'lastmsgfrom' => $lastpm['lastauthorusername'], 'lastmsg' => $lastpm['lastsummary']);
|
||||
}
|
||||
} elseif($more == 4) {
|
||||
return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'newchatpm' => $newchatpm);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function onsendpm() {
|
||||
$this->init_input();
|
||||
$fromuid = $this->input('fromuid');
|
||||
$msgto = $this->input('msgto');
|
||||
$subject = $this->input('subject');
|
||||
$message = $this->input('message');
|
||||
$replypmid = $this->input('replypmid');
|
||||
$isusername = $this->input('isusername');
|
||||
$type = $this->input('type');
|
||||
|
||||
if(!$fromuid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$user = $_ENV['user']->get_user_by_uid($fromuid);
|
||||
$user = daddslashes($user, 1);
|
||||
if(!$user) {
|
||||
return 0;
|
||||
}
|
||||
$this->user['uid'] = $user['uid'];
|
||||
$this->user['username'] = $user['username'];
|
||||
|
||||
if($replypmid) {
|
||||
$isusername = 0;
|
||||
$plid = $_ENV['pm']->getplidbypmid($replypmid);
|
||||
$msgto = $_ENV['pm']->getuidbyplid($plid);
|
||||
unset($msgto[$this->user['uid']]);
|
||||
} else {
|
||||
if(!empty($msgto)) {
|
||||
$msgto = array_unique(explode(',', $msgto));
|
||||
}
|
||||
}
|
||||
|
||||
if($isusername) {
|
||||
$msgto = $_ENV['user']->name2id($msgto);
|
||||
}
|
||||
$countmsgto = count($msgto);
|
||||
|
||||
if($this->settings['pmsendregdays']) {
|
||||
if($user['regdate'] > $this->time - $this->settings['pmsendregdays'] * 86400) {
|
||||
return PMSENDREGDAYS;
|
||||
}
|
||||
}
|
||||
if($this->settings['chatpmmemberlimit']) {
|
||||
if($type == 1 && ($countmsgto > ($this->settings['chatpmmemberlimit'] - 1))) {
|
||||
return CHATPMMEMBERLIMIT_ERROR;
|
||||
}
|
||||
}
|
||||
if($this->settings['pmfloodctrl']) {
|
||||
if(!$_ENV['pm']->ispminterval($this->user['uid'], $this->settings['pmfloodctrl'])) {
|
||||
return PMFLOODCTRL_ERROR;
|
||||
}
|
||||
}
|
||||
if($this->settings['privatepmthreadlimit']) {
|
||||
if(!$_ENV['pm']->isprivatepmthreadlimit($this->user['uid'], $this->settings['privatepmthreadlimit'])) {
|
||||
return PRIVATEPMTHREADLIMIT_ERROR;
|
||||
}
|
||||
}
|
||||
if($this->settings['chatpmthreadlimit']) {
|
||||
if(!$_ENV['pm']->ischatpmthreadlimit($this->user['uid'], $this->settings['chatpmthreadlimit'])) {
|
||||
return CHATPMTHREADLIMIT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
$lastpmid = 0;
|
||||
if($replypmid) {
|
||||
$lastpmid = $_ENV['pm']->replypm($plid, $this->user['uid'], $this->user['username'], $message);
|
||||
} else {
|
||||
$lastpmid = $_ENV['pm']->sendpm($this->user['uid'], $this->user['username'], $msgto, $subject, $message, $type);
|
||||
}
|
||||
return $lastpmid;
|
||||
}
|
||||
|
||||
function ondelete() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$pmids = $this->input('pmids');
|
||||
if(empty($pmids)) {
|
||||
return 0;
|
||||
}
|
||||
if(is_array($pmids)) {
|
||||
$this->apps = $this->cache('apps');
|
||||
if($this->apps[$this->app['appid']]['type'] == 'UCHOME') {
|
||||
$id = $_ENV['pm']->deletepmbyplids($this->user['uid'], $this->input('pmids'));
|
||||
} else {
|
||||
$id = $_ENV['pm']->deletepmbypmids($this->user['uid'], $this->input('pmids'));
|
||||
}
|
||||
} else {
|
||||
$id = $_ENV['pm']->deletepmbypmid($this->user['uid'], $this->input('pmids'));
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
function ondeletechat() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$plids = $this->input('plids');
|
||||
$type = intval($this->input('type'));
|
||||
if($type == 1) {
|
||||
return $_ENV['pm']->deletepmbyplids($this->user['uid'], $plids);
|
||||
} else {
|
||||
return $_ENV['pm']->quitchatpm($this->user['uid'], $plids);
|
||||
}
|
||||
}
|
||||
|
||||
function ondeleteuser() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$id = $_ENV['pm']->deletepmbyplids($this->user['uid'], $this->input('touids'), 1);
|
||||
return $id;
|
||||
}
|
||||
|
||||
function onreadstatus() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$_ENV['pm']->setpmstatus($this->user['uid'], $this->input('uids'), $this->input('plids'), $this->input('status'));
|
||||
}
|
||||
|
||||
function onignore() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
return $_ENV['pm']->set_ignore($this->user['uid']);
|
||||
}
|
||||
|
||||
function onls() {
|
||||
$this->init_input();
|
||||
$pagesize = $this->input('pagesize');
|
||||
$filter = $this->input('filter');
|
||||
$page = $this->input('page');
|
||||
$msglen = $this->input('msglen');
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
|
||||
$filter = $filter ? (in_array($filter, array('newpm', 'privatepm')) ? $filter : '') : '';
|
||||
if($filter == 'newpm') {
|
||||
$type = 0;
|
||||
$new = 1;
|
||||
} elseif($filter == 'privatepm') {
|
||||
$type = 0;
|
||||
$new = 0;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$pmnum = $_ENV['pm']->getpmnum($this->user['uid'], $type, $new);
|
||||
$start = $this->page_get_start($page, $pagesize, $pmnum);
|
||||
|
||||
if($pagesize > 0) {
|
||||
$pms = $_ENV['pm']->getpmlist($this->user['uid'], $filter, $start, $pagesize);
|
||||
if(is_array($pms) && !empty($pms)) {
|
||||
foreach($pms as $key => $pm) {
|
||||
if($msglen) {
|
||||
$pms[$key]['lastsummary'] = $_ENV['pm']->removecode($pms[$key]['lastsummary'], $msglen);
|
||||
} else {
|
||||
unset($pms[$key]['lastsummary']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$result['data'] = $pms;
|
||||
}
|
||||
$result['count'] = $pmnum;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function onview() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$pmid = $this->input('pmid');
|
||||
$touid = $this->input('touid');
|
||||
$daterange = $this->input('daterange');
|
||||
$page = $this->input('page');
|
||||
$pagesize = $this->input('pagesize');
|
||||
$isplid = $this->input('isplid');
|
||||
$type = $this->input('type');
|
||||
|
||||
$daterange = empty($daterange) ? 1 : $daterange;
|
||||
$today = $this->time - ($this->time + $this->settings['timeoffset']) % 86400;
|
||||
if($daterange == 1) {
|
||||
$starttime = $today;
|
||||
} elseif($daterange == 2) {
|
||||
$starttime = $today - 86400;
|
||||
} elseif($daterange == 3) {
|
||||
$starttime = $today - 172800;
|
||||
} elseif($daterange == 4) {
|
||||
$starttime = $today - 604800;
|
||||
} elseif($daterange == 5) {
|
||||
$starttime = 0;
|
||||
}
|
||||
$endtime = $this->time;
|
||||
|
||||
if(!$isplid) {
|
||||
$plid = $_ENV['pm']->getplidbytouid($this->user['uid'], $touid);
|
||||
} else {
|
||||
$plid = $touid;
|
||||
}
|
||||
if($page) {
|
||||
$pmnum = $_ENV['pm']->getpmnumbyplid($this->user['uid'], $plid);
|
||||
$start = $this->page_get_start($page, $pagesize, $pmnum);
|
||||
$ppp = $pagesize;
|
||||
} else {
|
||||
$pmnum = 0;
|
||||
$start = 0;
|
||||
$ppp = 0;
|
||||
}
|
||||
|
||||
if($pmid) {
|
||||
$pms = $_ENV['pm']->getpmbypmid($this->user['uid'], $pmid);
|
||||
} else {
|
||||
$pms = $_ENV['pm']->getpmbyplid($this->user['uid'], $plid, $starttime, $endtime, $start, $ppp, $type);
|
||||
}
|
||||
|
||||
require_once UC_ROOT.'lib/uccode.class.php';
|
||||
$this->uccode = new uccode();
|
||||
if($pms) {
|
||||
foreach($pms as $key => $pm) {
|
||||
$pms[$key]['message'] = $this->uccode->complie($pms[$key]['message']);
|
||||
}
|
||||
}
|
||||
return $pms;
|
||||
}
|
||||
|
||||
function onviewnum() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$touid = $this->input('touid');
|
||||
$isplid = $this->input('isplid');
|
||||
if(!$isplid) {
|
||||
$plid = $_ENV['pm']->getplidbytouid($this->user['uid'], $touid);
|
||||
} else {
|
||||
$plid = $touid;
|
||||
}
|
||||
$pmnum = $_ENV['pm']->getpmnumbyplid($this->user['uid'], $plid);
|
||||
return $pmnum;
|
||||
}
|
||||
|
||||
function onviewnode() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$type = $this->input('type');
|
||||
$pmid = $this->input('pmid');
|
||||
$type = 0;
|
||||
$pms = $_ENV['pm']->getpmbypmid($this->user['uid'], $pmid);
|
||||
|
||||
require_once UC_ROOT.'lib/uccode.class.php';
|
||||
$this->uccode = new uccode();
|
||||
if($pms) {
|
||||
foreach($pms as $key => $pm) {
|
||||
$pms[$key]['message'] = $this->uccode->complie($pms[$key]['message']);
|
||||
}
|
||||
}
|
||||
$pms = $pms[0];
|
||||
return $pms;
|
||||
}
|
||||
|
||||
function onchatpmmemberlist() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$plid = intval($this->input('plid'));
|
||||
return $_ENV['pm']->chatpmmemberlist($this->user['uid'], $plid);
|
||||
}
|
||||
|
||||
function onkickchatpm() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$plid = intval($this->input('plid'));
|
||||
$touid = intval($this->input('touid'));
|
||||
return $_ENV['pm']->kickchatpm($plid, $this->user['uid'], $touid);
|
||||
}
|
||||
|
||||
function onappendchatpm() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$plid = intval($this->input('plid'));
|
||||
$touid = intval($this->input('touid'));
|
||||
return $_ENV['pm']->appendchatpm($plid, $this->user['uid'], $touid);
|
||||
}
|
||||
|
||||
function onblackls_get() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
return $_ENV['pm']->get_blackls($this->user['uid']);
|
||||
}
|
||||
|
||||
function onblackls_set() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$blackls = $this->input('blackls');
|
||||
return $_ENV['pm']->set_blackls($this->user['uid'], $blackls);
|
||||
}
|
||||
|
||||
function onblackls_add() {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$username = $this->input('username');
|
||||
return $_ENV['pm']->update_blackls($this->user['uid'], $username, 1);
|
||||
}
|
||||
|
||||
function onblackls_delete($arr) {
|
||||
$this->init_input();
|
||||
$this->user['uid'] = intval($this->input('uid'));
|
||||
$username = $this->input('username');
|
||||
return $_ENV['pm']->update_blackls($this->user['uid'], $username, 2);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
85
uc_client/control/tag.php
Normal file
85
uc_client/control/tag.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: tag.php 1059 2011-03-01 07:25:09Z monkey $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
class tagcontrol extends base {
|
||||
|
||||
function __construct() {
|
||||
$this->tagcontrol();
|
||||
}
|
||||
|
||||
function tagcontrol() {
|
||||
parent::__construct();
|
||||
$this->init_input();
|
||||
$this->load('tag');
|
||||
$this->load('misc');
|
||||
}
|
||||
|
||||
function ongettag() {
|
||||
$appid = $this->input('appid');
|
||||
$tagname = $this->input('tagname');
|
||||
$nums = $this->input('nums');
|
||||
if(empty($tagname)) {
|
||||
return NULL;
|
||||
}
|
||||
$return = $apparray = $appadd = array();
|
||||
|
||||
if($nums && is_array($nums)) {
|
||||
foreach($nums as $k => $num) {
|
||||
$apparray[$k] = $k;
|
||||
}
|
||||
}
|
||||
|
||||
$data = $_ENV['tag']->get_tag_by_name($tagname);
|
||||
if($data) {
|
||||
$apparraynew = array();
|
||||
foreach($data as $tagdata) {
|
||||
$row = $r = array();
|
||||
$tmp = explode("\t", $tagdata['data']);
|
||||
$type = $tmp[0];
|
||||
array_shift($tmp);
|
||||
foreach($tmp as $tmp1) {
|
||||
$tmp1 != '' && $r[] = $_ENV['misc']->string2array($tmp1);
|
||||
}
|
||||
if(in_array($tagdata['appid'], $apparray)) {
|
||||
if($tagdata['expiration'] > 0 && $this->time - $tagdata['expiration'] > 3600) {
|
||||
$appadd[] = $tagdata['appid'];
|
||||
$_ENV['tag']->formatcache($tagdata['appid'], $tagname);
|
||||
} else {
|
||||
$apparraynew[] = $tagdata['appid'];
|
||||
}
|
||||
$datakey = array();
|
||||
$count = 0;
|
||||
foreach($r as $data) {
|
||||
$return[$tagdata['appid']]['data'][] = $data;
|
||||
$return[$tagdata['appid']]['type'] = $type;
|
||||
$count++;
|
||||
if($count >= $nums[$tagdata['appid']]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$apparray = array_diff($apparray, $apparraynew);
|
||||
} else {
|
||||
foreach($apparray as $appid) {
|
||||
$_ENV['tag']->formatcache($appid, $tagname);
|
||||
}
|
||||
}
|
||||
if($apparray) {
|
||||
$this->load('note');
|
||||
$_ENV['note']->add('gettag', "id=$tagname", '', $appadd, -1);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
424
uc_client/control/user.php
Normal file
424
uc_client/control/user.php
Normal file
@@ -0,0 +1,424 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
[UCenter] (C)2001-2099 Comsenz Inc.
|
||||
This is NOT a freeware, use is subject to license terms
|
||||
|
||||
$Id: user.php 1174 2014-11-03 04:38:12Z hypowang $
|
||||
*/
|
||||
|
||||
!defined('IN_UC') && exit('Access Denied');
|
||||
|
||||
define('UC_USER_CHECK_USERNAME_FAILED', -1);
|
||||
define('UC_USER_USERNAME_BADWORD', -2);
|
||||
define('UC_USER_USERNAME_EXISTS', -3);
|
||||
define('UC_USER_EMAIL_FORMAT_ILLEGAL', -4);
|
||||
define('UC_USER_EMAIL_ACCESS_ILLEGAL', -5);
|
||||
define('UC_USER_EMAIL_EXISTS', -6);
|
||||
define('UC_USER_USERNAME_CHANGE_FAILED', -7);
|
||||
define('UC_USER_SECMOBILE_EXISTS', -9);
|
||||
|
||||
class usercontrol extends base {
|
||||
|
||||
|
||||
function __construct() {
|
||||
$this->usercontrol();
|
||||
}
|
||||
|
||||
function usercontrol() {
|
||||
parent::__construct();
|
||||
$this->load('user');
|
||||
$this->app = $this->cache['apps'][UC_APPID];
|
||||
}
|
||||
|
||||
function onsynlogin() {
|
||||
$this->init_input();
|
||||
$uid = $this->input('uid');
|
||||
if($this->app['synlogin']) {
|
||||
if($this->user = $_ENV['user']->get_user_by_uid($uid)) {
|
||||
$synstr = '';
|
||||
foreach($this->cache['apps'] as $appid => $app) {
|
||||
if($app['synlogin'] && $app['appid'] != $this->app['appid']) {
|
||||
$synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']."&time=".$this->time, 'ENCODE', $app['authkey'])).'"></script>';
|
||||
}
|
||||
}
|
||||
return $synstr;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function onsynlogout() {
|
||||
$this->init_input();
|
||||
if($this->app['synlogin']) {
|
||||
$synstr = '';
|
||||
foreach($this->cache['apps'] as $appid => $app) {
|
||||
if($app['synlogin'] && $app['appid'] != $this->app['appid']) {
|
||||
$synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogout&time='.$this->time, 'ENCODE', $app['authkey'])).'"></script>';
|
||||
}
|
||||
}
|
||||
return $synstr;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function onregister() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
$password = $this->input('password');
|
||||
$email = $this->input('email');
|
||||
$questionid = $this->input('questionid');
|
||||
$answer = $this->input('answer');
|
||||
$regip = $this->input('regip');
|
||||
$secmobicc = $this->input('secmobicc');
|
||||
$secmobile = $this->input('secmobile');
|
||||
|
||||
if(($status = $this->_check_username($username)) < 0) {
|
||||
return $status;
|
||||
}
|
||||
if(($status = $this->_check_email($email)) < 0) {
|
||||
return $status;
|
||||
}
|
||||
if(($status = $this->_check_secmobile($secmobicc, $secmobile)) > 0) {
|
||||
return UC_USER_SECMOBILE_EXISTS;
|
||||
}
|
||||
|
||||
$uid = $_ENV['user']->add_user($username, $password, $email, 0, $questionid, $answer, $regip, $secmobicc, $secmobile);
|
||||
return $uid;
|
||||
}
|
||||
|
||||
function onedit() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
$oldpw = $this->input('oldpw');
|
||||
$newpw = $this->input('newpw');
|
||||
$email = $this->input('email');
|
||||
$ignoreoldpw = $this->input('ignoreoldpw');
|
||||
$questionid = $this->input('questionid');
|
||||
$answer = $this->input('answer');
|
||||
$secmobicc = $this->input('secmobicc');
|
||||
$secmobile = $this->input('secmobile');
|
||||
|
||||
if(!$ignoreoldpw && $email && ($status = $this->_check_email($email, $username)) < 0) {
|
||||
return $status;
|
||||
}
|
||||
if(($status = $this->_check_secmobile($secmobicc, $secmobile, $username)) > 0) {
|
||||
return UC_USER_SECMOBILE_EXISTS;
|
||||
}
|
||||
|
||||
$status = $_ENV['user']->edit_user($username, $oldpw, $newpw, $email, $ignoreoldpw, $questionid, $answer, $secmobicc, $secmobile);
|
||||
|
||||
if($newpw && $status > 0) {
|
||||
$this->load('note');
|
||||
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');
|
||||
$_ENV['note']->send();
|
||||
}
|
||||
if($status > 0) {
|
||||
$tmp = $_ENV['user']->get_user_by_username($username);
|
||||
$_ENV['user']->user_log($tmp['uid'], 'edituser', 'uid='.$tmp['uid'].'&email='.urlencode($email).'&secmobicc='.urlencode($secmobicc).'&secmobile='.urlencode($secmobile));
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
function onlogin() {
|
||||
$this->init_input();
|
||||
$isuid = $this->input('isuid');
|
||||
$username = $this->input('username');
|
||||
$password = $this->input('password');
|
||||
$checkques = $this->input('checkques');
|
||||
$questionid = $this->input('questionid');
|
||||
$answer = $this->input('answer');
|
||||
$ip = $this->input('ip');
|
||||
$nolog = $this->input('nolog');
|
||||
|
||||
$check_times = $this->settings['login_failedtime'] > 0 ? $this->settings['login_failedtime'] : ($this->settings['login_failedtime'] < 0 ? 0 : 5);
|
||||
|
||||
if($ip && $check_times && !$loginperm = $_ENV['user']->can_do_login($username, $ip)) {
|
||||
$status = -4;
|
||||
return array($status, '', $password, '', 0);
|
||||
}
|
||||
|
||||
if($isuid == 1) {
|
||||
$user = $_ENV['user']->get_user_by_uid($username);
|
||||
} elseif($isuid == 2) {
|
||||
$user = $_ENV['user']->get_user_by_email($username);
|
||||
} elseif($isuid == 4) {
|
||||
list($secmobicc, $secmobile) = explode('-', $username);
|
||||
$user = $_ENV['user']->get_user_by_secmobile($secmobicc, $secmobile);
|
||||
} else {
|
||||
$user = $_ENV['user']->get_user_by_username($username);
|
||||
}
|
||||
|
||||
if(empty($user)) {
|
||||
$status = -1;
|
||||
} elseif(!$_ENV['user']->verify_password($password, $user['password'], $user['salt'])) {
|
||||
$status = -2;
|
||||
} elseif($checkques && $user['secques'] != $_ENV['user']->quescrypt($questionid, $answer)) {
|
||||
$status = -3;
|
||||
} else {
|
||||
$_ENV['user']->upgrade_password($username, $password, $user['password'], $user['salt']);
|
||||
$status = $user['uid'];
|
||||
}
|
||||
if(!$nolog && $ip && $check_times && $status <= 0) {
|
||||
$_ENV['user']->loginfailed($username, $ip);
|
||||
}
|
||||
$merge = $status != -1 && !$isuid && $_ENV['user']->check_mergeuser($username) ? 1 : 0;
|
||||
return array($status, $user['username'], $password, $user['email'], $merge);
|
||||
}
|
||||
|
||||
function onlogincheck() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
$ip = $this->input('ip');
|
||||
return $_ENV['user']->can_do_login($username, $ip);
|
||||
}
|
||||
|
||||
function oncheck_email() {
|
||||
$this->init_input();
|
||||
$email = $this->input('email');
|
||||
return $this->_check_email($email);
|
||||
}
|
||||
|
||||
function oncheck_secmobile() {
|
||||
$this->init_input();
|
||||
$secmobicc = $this->input('secmobicc');
|
||||
$secmobile = $this->input('secmobile');
|
||||
return $this->_check_secmobile($secmobicc, $secmobile);
|
||||
}
|
||||
|
||||
function oncheck_username() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
if(($status = $this->_check_username($username)) < 0) {
|
||||
return $status;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function onget_user() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
if(!$this->input('isuid')) {
|
||||
$status = $_ENV['user']->get_user_by_username($username);
|
||||
} else {
|
||||
$status = $_ENV['user']->get_user_by_uid($username);
|
||||
}
|
||||
if($status) {
|
||||
return array($status['uid'],$status['username'],$status['email']);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function onchgusername() {
|
||||
$this->init_input();
|
||||
$uid = $this->input('uid');
|
||||
$newusername = $this->input('newusername');
|
||||
if(($status = $this->_check_username($newusername)) < 0) {
|
||||
return $status;
|
||||
}
|
||||
$user = $_ENV['user']->get_user_by_uid($uid);
|
||||
$oldusername = $user['username'];
|
||||
if($_ENV['user']->chgusername($uid, $newusername)) {
|
||||
$_ENV['user']->user_log($uid, 'renameuser', 'uid='.$uid.'&oldusername='.urlencode($oldusername).'&newusername='.urlencode($newusername));
|
||||
$this->load('note');
|
||||
$_ENV['note']->add('renameuser', 'uid='.$uid.'&oldusername='.urlencode($oldusername).'&newusername='.urlencode($newusername));
|
||||
$_ENV['note']->send();
|
||||
return 1;
|
||||
}
|
||||
return UC_USER_USERNAME_CHANGE_FAILED;
|
||||
}
|
||||
|
||||
function ongetprotected() {
|
||||
$this->init_input();
|
||||
$protectedmembers = $this->db->fetch_all("SELECT uid,username FROM ".UC_DBTABLEPRE."protectedmembers GROUP BY username");
|
||||
return $protectedmembers;
|
||||
}
|
||||
|
||||
function ondelete() {
|
||||
$this->init_input();
|
||||
$uid = $this->input('uid');
|
||||
return $_ENV['user']->delete_user($uid);
|
||||
}
|
||||
|
||||
function ondeleteavatar() {
|
||||
$this->init_input();
|
||||
$uid = $this->input('uid');
|
||||
$_ENV['user']->delete_useravatar($uid);
|
||||
}
|
||||
|
||||
function onaddprotected() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
$admin = $this->input('admin');
|
||||
$appid = $this->app['appid'];
|
||||
$usernames = (array)$username;
|
||||
foreach($usernames as $username) {
|
||||
$user = $_ENV['user']->get_user_by_username($username);
|
||||
$uid = $user['uid'];
|
||||
$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."protectedmembers SET uid='$uid', username='$username', appid='$appid', dateline='{$this->time}', admin='$admin'", 'SILENT');
|
||||
}
|
||||
return $this->db->errno() ? -1 : 1;
|
||||
}
|
||||
|
||||
function ondeleteprotected() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
$appid = $this->app['appid'];
|
||||
$usernames = (array)$username;
|
||||
foreach($usernames as $username) {
|
||||
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."protectedmembers WHERE username='$username' AND appid='$appid'");
|
||||
}
|
||||
return $this->db->errno() ? -1 : 1;
|
||||
}
|
||||
|
||||
function onmerge() {
|
||||
$this->init_input();
|
||||
$oldusername = $this->input('oldusername');
|
||||
$newusername = $this->input('newusername');
|
||||
$uid = $this->input('uid');
|
||||
$password = $this->input('password');
|
||||
$email = $this->input('email');
|
||||
if(($status = $this->_check_username($newusername)) < 0) {
|
||||
return $status;
|
||||
}
|
||||
$uid = $_ENV['user']->add_user($newusername, $password, $email, $uid);
|
||||
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."mergemembers WHERE appid='".$this->app['appid']."' AND username='$oldusername'");
|
||||
return $uid;
|
||||
}
|
||||
|
||||
function onmerge_remove() {
|
||||
$this->init_input();
|
||||
$username = $this->input('username');
|
||||
$this->db->query("DELETE FROM ".UC_DBTABLEPRE."mergemembers WHERE appid='".$this->app['appid']."' AND username='$username'");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function _check_username($username) {
|
||||
$username = addslashes(trim(stripslashes($username)));
|
||||
if(!$_ENV['user']->check_username($username)) {
|
||||
return UC_USER_CHECK_USERNAME_FAILED;
|
||||
} elseif(!$_ENV['user']->check_usernamecensor($username)) {
|
||||
return UC_USER_USERNAME_BADWORD;
|
||||
} elseif($_ENV['user']->check_usernameexists($username)) {
|
||||
return UC_USER_USERNAME_EXISTS;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
function _check_email($email, $username = '') {
|
||||
if(empty($this->settings)) {
|
||||
$this->settings = $this->cache('settings');
|
||||
}
|
||||
if(!$_ENV['user']->check_emailformat($email)) {
|
||||
return UC_USER_EMAIL_FORMAT_ILLEGAL;
|
||||
} elseif(!$_ENV['user']->check_emailaccess($email)) {
|
||||
return UC_USER_EMAIL_ACCESS_ILLEGAL;
|
||||
} elseif(!$this->settings['doublee'] && $_ENV['user']->check_emailexists($email, $username)) {
|
||||
return UC_USER_EMAIL_EXISTS;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function _check_secmobile($secmobicc, $secmobile, $username = '') {
|
||||
return $_ENV['user']->check_secmobileexists($secmobicc, $secmobile, $username);
|
||||
}
|
||||
|
||||
function onuploadavatar() {
|
||||
}
|
||||
|
||||
function onrectavatar() {
|
||||
@header("Expires: 0");
|
||||
@header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
|
||||
@header("Pragma: no-cache");
|
||||
if(getgpc('base64', 'G')){
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
}else{
|
||||
header("Content-type: application/xml; charset=utf-8");
|
||||
}
|
||||
$this->init_input(getgpc('agent'));
|
||||
$uid = $this->input('uid');
|
||||
if(empty($uid)) {
|
||||
return '<root><message type="error" value="-1" /></root>';
|
||||
}
|
||||
$home = $this->get_home($uid);
|
||||
if(!defined('UC_UPAVTDIR')) {
|
||||
define('UC_UPAVTDIR', UC_DATADIR.'./avatar/');
|
||||
}
|
||||
if(!is_dir(UC_UPAVTDIR.$home)) {
|
||||
$this->set_home($uid, UC_UPAVTDIR);
|
||||
}
|
||||
$avatartype = getgpc('avatartype', 'G') == 'real' ? 'real' : 'virtual';
|
||||
$bigavatarfile = UC_UPAVTDIR.$this->get_avatar($uid, 'big', $avatartype);
|
||||
$middleavatarfile = UC_UPAVTDIR.$this->get_avatar($uid, 'middle', $avatartype);
|
||||
$smallavatarfile = UC_UPAVTDIR.$this->get_avatar($uid, 'small', $avatartype);
|
||||
$bigavatar = $this->flashdata_decode(getgpc('avatar1', 'P'));
|
||||
$middleavatar = $this->flashdata_decode(getgpc('avatar2', 'P'));
|
||||
$smallavatar = $this->flashdata_decode(getgpc('avatar3', 'P'));
|
||||
if(!$bigavatar || !$middleavatar || !$smallavatar) {
|
||||
return '<root><message type="error" value="-2" /></root>';
|
||||
}
|
||||
|
||||
$success = 1;
|
||||
$fp = @fopen($bigavatarfile, 'wb');
|
||||
@fwrite($fp, $bigavatar);
|
||||
@fclose($fp);
|
||||
|
||||
$fp = @fopen($middleavatarfile, 'wb');
|
||||
@fwrite($fp, $middleavatar);
|
||||
@fclose($fp);
|
||||
|
||||
$fp = @fopen($smallavatarfile, 'wb');
|
||||
@fwrite($fp, $smallavatar);
|
||||
@fclose($fp);
|
||||
|
||||
$biginfo = @getimagesize($bigavatarfile);
|
||||
$middleinfo = @getimagesize($middleavatarfile);
|
||||
$smallinfo = @getimagesize($smallavatarfile);
|
||||
if(!$biginfo || !$middleinfo || !$smallinfo || $biginfo[2] == 4 || $middleinfo[2] == 4 || $smallinfo[2] == 4
|
||||
|| $biginfo[0] > 200 || $biginfo[1] > 250 || $middleinfo[0] > 120 || $middleinfo[1] > 120 || $smallinfo[0] > 48 || $smallinfo[1] > 48) {
|
||||
file_exists($bigavatarfile) && unlink($bigavatarfile);
|
||||
file_exists($middleavatarfile) && unlink($middleavatarfile);
|
||||
file_exists($smallavatarfile) && unlink($smallavatarfile);
|
||||
$success = 0;
|
||||
}
|
||||
|
||||
if(getgpc('base64', 'G')){
|
||||
if($success) {
|
||||
return "<script>window.parent.postMessage('success','*');</script>";
|
||||
} else {
|
||||
return "<script>window.parent.postMessage('failure','*');</script>";
|
||||
}
|
||||
}else{
|
||||
$filetype = '.jpg';
|
||||
@unlink(UC_DATADIR.'./tmp/upload'.$uid.$filetype);
|
||||
if($success) {
|
||||
return '<?xml version="1.0" ?><root><face success="1"/></root>';
|
||||
} else {
|
||||
return '<?xml version="1.0" ?><root><face success="0"/></root>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function flashdata_decode($s) {
|
||||
$r = '';
|
||||
if(getgpc('base64', 'G')){
|
||||
$r = base64_decode($s);
|
||||
}else{
|
||||
$l = strlen($s);
|
||||
for($i=0; $i<$l; $i=$i+2) {
|
||||
$k1 = ord($s[$i]) - 48;
|
||||
$k1 -= $k1 > 9 ? 7 : 0;
|
||||
$k2 = ord($s[$i+1]) - 48;
|
||||
$k2 -= $k2 > 9 ? 7 : 0;
|
||||
$r .= chr($k1 << 4 | $k2);
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user