public function setFirst() { // 获取要赠送的短信的条数 $sms_count = 0; $fields = array(); // 如果还没设置过信息,则进行设置,并送短信 foreach ($this->_support as $field => $smsCount) { $this->_field = $field; if (!$this->hasSet() && $this->_support[$this->_field] > 0) { $sms_count += $smsCount; $fields[] = $field; } } if ($sms_count > 0) { // 赠送短信,并发送通知 $user = User_Model::instance(); $smsUpdateStr = $this->smsUpdateStr(); $content = '您好,这是您第一次设置' . $smsUpdateStr . ',系统赠送了' . $sms_count . '条短信给您'; // echo $content; try { // @todo 应该支持事务操作 $updated = $this->updateField($fields); $user->present_sms($this->_uid, $sms_count, $content, false); } catch (Exception $e) { } } return $sms_count; }
/** * 单例模式 * @return User_Model */ public static function &instance() { if (!isset(self::$instance)) { // Create a new instance self::$instance = new User_Model(); } return self::$instance; }
public function add() { if ($this->get_method() != 'POST') { $this->send_response(405, NULL, '请求的方法不存在'); } $data = $this->get_data(); $uid = isset($data['user_id']) ? $data['user_id'] : 0; if ($uid = (int) $uid) { if ($this->model->check_isfriend($this->user_id, $uid)) { $this->send_response(400, NULL, "你们已经是好友"); } if (!User_Model::instance()->get_user_by_id($uid)) { $this->send_response(400, NULL, "用户不存在"); } $status = $this->model->add_friend($this->user_id, $uid); $this->send_response(200, array("status" => $status)); } $this->send_response(400, NULL, "输入有误"); }
/** * * 获取可用短信条数 */ public static function getsmscount($uid) { $data = User_Model::instance()->get_sms_count($uid); return $data; }
public function event($result) { //$list=array(1,482,15); //if(!in_array($result['sender_uid'], $list)) return; if (empty($result["receive_time"])) { //第一次打开 $start_time = strtotime('2011-12-31 00:00:00'); $end_time = strtotime('2012-01-05 23:59:59'); $now = time(); if ($now > $start_time && $now < $end_time) { //活动期间 if ($result["content_type"] == 1) { //音频 $sender_uid = $result['sender_uid']; $query = $this->db->query("select * from tmp_event_20111225 where uid=" . $sender_uid); $r = $query->result_array(FALSE); if ($r) { } else { //发送者还未获得奖励 $content = "恭喜您成功通过MO短信发送语音信息,获得15张6寸彩照的免费冲印大礼,您的免费冲印优惠码:913030,在线冲印地址: http://t.momo.im/71guu (您可以通过电脑登录momo.im网站访问冲印链接),优惠码使用演示: http://ly.91.com/s"; User_Model::instance()->present_mo_notice(Kohana::config('uap.xiaomo'), $sender_uid, $content); $this->db->query("insert into tmp_event_20111225 (uid,receiver_uid,open_time) values (" . $sender_uid . "," . $result['receiver_uid'] . "," . $now . ")"); } } } } }
/** * 检查机器人是否存在 * @param $robot_id 机器人ID * @return bool */ public function is_user_exist($robot_id) { $user_info = User_Model::instance()->get_user_info($robot_id); if ($user_info) { return TRUE; } else { return FALSE; } }
/** * 删除群 * @param int $id 群组ID */ public function destroy($id = NULL) { if ($this->get_method() != 'POST') { $this->send_response(405, NULL, '请求的方法不存在'); } elseif (empty($id)) { $this->send_response(400, NULL, '400401:群ID为空'); } $groupInfo = $this->model->getGroupInfo($id); if (!$groupInfo) { $this->send_response(400, NULL, '400402:群不存在'); } $grade = $this->model->getMemberGrade($id, $this->user_id); if ($grade < Kohana::config('group.grade.master')) { $this->send_response(400, NULL, '400413:非群主,无权限删除群'); } $memberList = $this->model->getGroupAllMember($id); $result = $this->model->delete($id); if ($result) { $feedModel = Feed_Model::instance(); $userModel = User_Model::instance(); $content = '您加入的群"' . $groupInfo['gname'] . '"已解散'; foreach ($memberList as $value) { $feedModel->deleteItem($id, 32, $value['uid']); $userModel->present_mo_notice(Kohana::config('uap.xiaomo'), $value['uid'], $content); } $this->send_response(200); } $this->send_response(400, NULL, '删除群失败'); }
/** * * 添加群成员 * @param $id */ public function add($id = 0) { if ($this->get_method() != 'POST') { $this->send_response(405, NULL, '请求的方法不存在'); } $data = $this->get_data(); $uid = $data['uid'] ? $data['uid'] : ''; if (empty($uid)) { $this->send_response(400, NULL, '400403:成员uid为空'); } $uids = explode(',', $uid); $groupId = (int) $id; if (empty($id)) { $this->send_response(400, NULL, '400401:群ID为空'); } $groupInfo = $this->model->getGroupInfo($groupId); if (!$groupInfo) { $this->send_response(400, NULL, '400402:群不存在'); } $user = sns::getuser($this->user_id); /* $grade = $this->model->getMemberGrade($groupId, $this->user_id); if($grade < Kohana::config('group.grade.manager')) { $this->send_response(400, NULL, '400404:非群管理员,无权限添加成员'); } */ //查询群组成员总数是否超出最大限制(暂定100) $memberNum = $group_info['member_number']; if ($group_info['type'] == Kohana::config('group.type.public')) { $maxMemberNum = Kohana::config('group.maxMemberNum.public'); } else { $maxMemberNum = Kohana::config('group.maxMemberNum.private'); } if ($memberNum + count($uids) >= $maxMemberNum) { $this->send_response(400, NULL, '400110:群成员人数已满'); } $add_uids = array(); foreach ($uids as $v) { $grade = $this->model->getMemberGrade($groupId, $v); if (!$grade) { $add_uids[] = $v; } } $i = 0; $content = $user['realname'] . '将您加入到群"' . $groupInfo['gname'] . '"'; $opt = array('group' => array('type' => 1, 'id' => $groupId, 'name' => $groupInfo['gname'])); $xiaomo_uid = Kohana::config('uap.xiaomo'); if (count($add_uids) > 0) { foreach ($add_uids as $u) { if ($this->model->addGroupMember($groupId, $u, 1)) { $i++; Tab_Model::instance()->create($u, 1, $groupId); $this->model->addMemberNum($groupId); User_Model::instance()->present_mo_notice($xiaomo_uid, $u, $content, $opt); } } } $this->send_response(200, array('num' => $i)); }
public function __construct() { parent::__construct(); $this->model = User_Model::instance(); $this->friend_model = Friend_Model::instance(); }
public function invite_create() { if ($this->get_method() != 'POST') { $this->send_response(405, NULL, '请求的方法不存在'); } $data = $this->get_data(); $invite_code = trim($data['invite_code']); if (strlen($invite_code) != 32 || !preg_match('/^[0-9A-Za-z]{32}$/', $invite_code)) { $this->send_response(400, NULL, '活动邀请链接无效'); } $activityInviteModel = Activity_Invite_Model::instance(); $invite_info = $activityInviteModel->getInvitationInfo($invite_code); if (!$invite_info) { $this->send_response(400, NULL, '活动邀请链接无效'); } $aid = $invite_info['aid']; $activity = $this->model->getActivityInfo($aid); if (!$activity) { $this->send_response(400, NULL, '400502:活动不存在'); } $now_time = time(); if ($now_time > $activity['end_time']) { $this->send_response(400, NULL, '400502:活动已结束'); } $applyResult = $this->model->getActivityApplyType($aid, $this->user_id); if ($applyResult > 0) { $this->send_response(400, NULL, '你已经报名了该活动'); } $activityMember['aid'] = $aid; $activityMember['uid'] = $this->user_id; $activityMember['apply_type'] = Kohana::config('activity.apply_type.join'); $activityMember['apply_time'] = $now_time; $activityMember['grade'] = Kohana::config('activity.grade.normal'); $this->model->applyActivity($activityMember); $userModel = User_Model::instance(); $userModel->insertTag($this->user_id, 15, $aid); $apply_type = Kohana::config('activity.apply_type.join'); $this->_add_feed_comment($activity, 0, $apply_type, $this->user_id); $feedModel = Feed_Model::instance(); $feedModel->addTab($aid, $activity['title'], 15, $this->user_id); $this->send_response(200); }
/** * 获取我的联系人中是否存在该手机号码 * @param int $user_id * @param string $friend_user_id * @return bool */ public function is_contact($user_id, $friend_user_id) { //获取对方手机国家码和号码 $user_info = User_Model::instance()->get_user_info($friend_user_id); if (!empty($user_info) and !empty($user_info['zone_code']) and !empty($user_info['mobile'])) { $search = '+' . $user_info['zone_code'] . $user_info['mobile']; $list = $this->get($user_id); foreach ($list as $val) { foreach ($val['tels'] as $tel) { if ($tel['search'] == $search) { return TRUE; } } } } return FALSE; }
/** * 决定是否显示评论框 * @param int $vuid 登录者id * @param int $uid 所有者id */ public function retrunAllow($vuid, $uid) { if ($vuid == $uid) { return 1; } $right = User_Model::instance()->getRights($uid, 'allowcomment'); if ($right == 0) { //任何人可以访问 return 1; } elseif ($right == 1) { //仅好友 $return = Friend_Model::instance()->getCheckIsFriend($vuid, $uid); if ($return) { //如果是好友返回1 return 1; } else { //如果不是好友返回2 return 2; } } else { return 0; } }
/** * 取消授权 * @param Int $user_id * @param String $type * @return Boolean */ public function destroyToken($user_id, $type = null) { $where['uid'] = $user_id; if ($type !== null) { $where['site'] = $type; } $query = $this->db->set(array("oauth_token" => "", "oauth_token_secret" => "", "disable" => "Y"))->where($where)->update('oauth_token'); if ($query->count()) { //@todo 查找url匹配再删除 $status = $this->db->delete("personal_urls", array("uid" => $user_id, "type" => $type)); if (count($status) < 0) { return FALSE; } //执行用户信息完善度信息更新 $user_model = User_Model::instance(); $user_info = $user_model->get_user_info($user_id); $member_field = array("completed" => $user_info['completed'] - 10); $user_model->update_user_info($user_id, $member_field); return TRUE; } else { return FALSE; } }
/** * 系统消息统计 * @return <type> */ public function counts() { $messageModel = new Message_Model(); $res = $messageModel->getNewNoticeNum($this->uid); //获取新通知条数 if ($res) { $noticeNum = (int) $res; } else { $noticeNum = 0; } $aboutmeNum = $this->feedModel->aboutMeNewCount(); // 取得新的消息的统计 $smsNum = User_Model::instance()->get_sms_count($this->uid); $this->send_response(200, array('message_count' => $noticeNum, 'aboutme_count' => $aboutmeNum, 'sms_count' => $smsNum)); }
/** * 构造函数 */ public function __construct() { parent::__construct(); $session = Session::instance(); $session->set('request_time', microtime(TRUE)); $this->method = $_SERVER['REQUEST_METHOD']; $current_url = url::current(); $this->current_url = $current_url; $url_arr = explode('/', $current_url); $dot_pos = strrpos($current_url, '.'); $back_slash_pos = strpos($current_url, '/'); if ($back_slash_pos === FALSE) { //防止没有设置返回类型的输入 $this->root = substr($current_url, 0, $dot_pos ? $dot_pos : strlen($current_url)); } else { $this->root = substr($current_url, 0, $back_slash_pos); if (isset($url_arr[1]) && !preg_match("/\\d+/is", $url_arr[1])) { $this->second = preg_replace('/.(xml|json)$/', '', $url_arr[1]); } } // 不需要授权的模块 if (in_array($this->root, $this->un_authorized)) { return TRUE; } // 不需要授权的接口 $url = preg_replace('/.(xml|json)$/', '', $this->current_url); if (in_array($url, $this->no_auth)) { return TRUE; } $headers = self::get_all_headers(); $access_token = $this->get_access_token($headers); if (empty($access_token)) { $this->send_response(401, NULL, Kohana::lang('authorization.missing_auth')); } $token = User_Model::instance()->get_access_token($access_token); if (empty($token)) { $this->send_response(401, NULL, Kohana::lang('authorization.missing_auth')); } if (isset($token['expires']) && time() > $token['expires']) { $this->send_response(401, NULL, Kohana::lang('authorization.auth_expired')); } $this->user_id = $this->uid = $token['id']; return TRUE; }
public function download($id, $filetype, $filename) { //$fileinfo=explode('.', $filename); $beta = (int) $_GET['beta']; $upgrade_table = $this->_get_upgrade_table($beta); $fileinfo = array(); $fileinfo[1] = $id; $fileinfo[2] = $filetype; $db = Database::instance(); //根据id获取安装包信息 $idinfo = explode('_', $id); $id = intval($idinfo[0]); if (isset($idinfo[1])) { $sql = "SELECT u.*,b.brand_id,b.upgrade_id FROM {$upgrade_table} u \n LEFT JOIN `upgrade_brand` b ON (b.upgrade_id=u.id) \n WHERE u.id = {$id} AND b.brand_id='{$idinfo['1']}' LIMIT 1"; } else { $sql = "SELECT u.*,b.brand_id,b.upgrade_id FROM {$upgrade_table} u \n LEFT JOIN `upgrade_brand` b ON (b.upgrade_id=u.id) \n WHERE u.id = {$id} LIMIT 1"; } $query = $db->query($sql); $res = $query->result_array(FALSE); if ($res) { $downinfo = $res[0]; } else { $this->send_response(400, '', '40001无法下载'); } if ($fileinfo[2] == 'jad' && preg_match('/\\.jar$/i', $filename)) { //获取jar包 $brand_cond = ''; if ($downinfo['brand_id']) { //$brand_cond="AND b.brand_id='{$downinfo['brand_id']}' "; } $sql = "SELECT u.*,b.brand_id,b.upgrade_id FROM {$upgrade_table} u \n LEFT JOIN `upgrade_brand` b ON (b.upgrade_id=u.id) \n WHERE u.platform = 'j2me' AND u.signed={$downinfo['signed']} AND u.channel='{$downinfo['channel']}' AND RIGHT(u.download_url, 3) = 'jar' {$brand_cond}\n ORDER BY u.`id` DESC LIMIT 1"; $query = $db->query($sql); if ($res = $query->result_array(FALSE)) { $j2me = $res[0]; $data = file_get_contents($j2me['download_url']); header("Content-Type: application/java-archive"); header("Content-Length: " . strlen($data)); exit($data); } else { $this->send_response(400, '', '40001无法下载'); } } $uid = $this->input->get('uid'); $timestamp = $this->input->get('timestamp'); $token = $this->input->get('token'); $the_token = md5("{$fileinfo[1]}/{$filetype}/{$filename}" . $uid . $timestamp . $beta . $this->key); if ($token != $the_token) { //校验失败 $data = file_get_contents($downinfo['download_url']); header("Content-Length: " . strlen($data)); exit($data); } $userinfo = User_Model::instance()->get_user_info($uid); if (!$userinfo || !$userinfo['mobile']) { //用户不存在或者无手机号 $data = file_get_contents($downinfo['download_url']); header("Content-Length: " . strlen($data)); exit($data); } $url_code = ""; if ((int) $downinfo['appid'] == 29) { $url_code = Url_Model::instance()->create('callshow', Kohana::config('uap.xiaomo'), '小秘-秀秀', $userinfo['uid'], $userinfo['realname'], $userinfo['mobile'], '86', '', '', '', (int) $downinfo['appid']); } else { $url_code = Url_Model::instance()->create('sys', Kohana::config('uap.xiaomo'), '小秘', $userinfo['uid'], $userinfo['realname'], $userinfo['mobile']); } if (!$url_code) { $data = file_get_contents($downinfo['download_url']); header("Content-Length: " . strlen($data)); exit($data); } if ($fileinfo[2] == 'jad') { $filecontent = file_get_contents($downinfo['download_url']); if ($filecontent) { $filecontent .= "AUTO_LOGIN: "******"\n"; if ($downinfo['brand_id']) { $filecontent .= "phone_model: " . $downinfo['brand_id'] . "\n"; } header("Content-Type: text/vnd.sun.j2me.app-descriptor"); header("Content-Length: " . strlen($filecontent)); exit($filecontent); } else { $this->send_response(400, '', '40002无法下载'); } } elseif ($fileinfo[2] == 'ipa') { if (class_exists('ZipArchive')) { $ipa_content = file_get_contents($downinfo['download_url']); $done = FALSE; if ($ipa_content) { $filename = tempnam('/tmp', 'ipa_'); file_put_contents($filename, $ipa_content); $appname = $this->_get_appname($downinfo['appid']); $zip = new ZipArchive(); if ($zip->open($filename, ZIPARCHIVE::CREATE)) { $zip->addFromString("Payload/{$appname}.app/assets/auth.json", '{"autoLogin":"******"}'); $zip->close(); $done = TRUE; } } if ($done) { $filecontent = file_get_contents($filename); @unlink($filename); } else { $this->send_response(400, '', '40002无法下载'); } } else { $filecontent = file_get_contents($downinfo['download_url']); if (!$filecontent) { $this->send_response(400, '', '40002无法下载'); } } header("Content-Type: application/x-zip"); header("Content-Length: " . strlen($filecontent)); exit($filecontent); } elseif ($fileinfo[2] == 'apk') { if (class_exists('ZipArchive')) { $apk_content = file_get_contents($downinfo['download_url']); $done = FALSE; if ($apk_content) { $filename = tempnam('/tmp', 'apk_'); file_put_contents($filename, $apk_content); $zip = new ZipArchive(); if ($zip->open($filename, ZIPARCHIVE::CREATE)) { $zip->addFromString('assets/auth.json', '{"autoLogin":"******"}'); $zip->close(); $done = TRUE; } } if ($done) { $keyfile = DOCROOT . "_tools/momo.key"; $filename_signed = $filename . '_signed'; if ((int) $downinfo['appid'] == 29) { $keyfile = DOCROOT . "_tools/momoshow.key"; exec("/usr/bin/jarsigner -verbose -keystore {$keyfile} -keypass momo.android -storepass momo.android {$filename} momoshow"); } else { exec("/usr/bin/jarsigner -verbose -keystore {$keyfile} -keypass momo.android -storepass momo.android {$filename} momo"); } exec(DOCROOT . "_tools/zipalign -v 4 {$filename} {$filename_signed}"); $filecontent = file_get_contents($filename); @unlink($filename); @unlink($filename_signed); } else { $this->send_response(400, '', '40002无法下载'); } } else { $filecontent = file_get_contents($downinfo['download_url']); if (!$filecontent) { $this->send_response(400, '', '40002无法下载'); } } header("Content-Type: application/vnd.android.package-archive"); header("Content-Length: " . strlen($filecontent)); exit($filecontent); } }
/** * * @param $user_id * @return unknown_type */ private function _get_relation_contact_lsits($user_id) { $res = array(); //$key = 'momo_contacts_relation_'.$user_id; //$res = Cache::instance()->get($key); //if(!$res) { $contact_lists = Contact_Model::instance()->get($user_id, null, '', 1); if (count($contact_lists) > 0 && is_array($contact_lists)) { foreach ($contact_lists as $contact) { if (count($contact['tels']) > 0 && is_array($contact['tels'])) { foreach ($contact['tels'] as $tel) { if ($tel['type'] == 'cell') { $relation[] = array('name' => $contact['formatted_name'], 'mobile' => $tel['value']); } } } } if ($relation) { $res = User_Model::instance()->create_at($relation, $user_id, 0); //if($res) //Cache::instance()->set($key, $res, NULL, 86400); } } //} return $res; }
/** * * 获取用户uid * @param array $user */ private function _get_event_uid($user) { $data = array(); $result = User_Model::instance()->create_at($user, $this->user_id, 0); if (count($result) > 0) { foreach ($result as $v) { $data[$v['mobile']] = array('user_id' => $v['user_id'], 'name' => $v['name']); } } return $data; }
/** * 根据用户权限获取好友信息 * @param int $friend_user_id * @return Contact */ public function get_user_info($user_id) { $user_model = User_Model::instance(); $result = $user_model->get_user_info($user_id); if ($result !== FALSE) { $data = $user_model->profile_assembly($result); //根据权限获取好友信息 $array = array(); foreach ($data as $key => $value) { if (in_array($key, array('family_name', 'given_name', 'nickname', 'department', 'title'))) { $array[$key] = $value; } elseif (in_array($key, array('tels', 'emails', 'ims', 'addresses', 'urls'))) { if (!empty($value)) { foreach ($value as $val) { if (!empty($val['is_master'])) { $array[$key][] = array('type' => $val['type'], 'value' => $val['value'], 'pref' => $val['is_master']); } elseif ($val['is_public']) { $array[$key][] = $val; } } } } elseif ($key == 'company') { $array['organization'] = $value; } } if (!empty($data['is_hide_year'])) { $data['birthyear'] = 1900; } if (!empty($data['birthmonth']) && !empty($data['birthday']) && !empty($data['birthyear'])) { if (strlen($data['birthday']) == 1) { $data['birthday'] = '0' . $data['birthday']; } if (strlen($data['birthmonth']) == 1) { $data['birthmonth'] = '0' . $data['birthmonth']; } if (checkdate($data['birthmonth'], $data['birthday'], $data['birthyear'])) { $array['birthday'] = $data['birthyear'] . '-' . $data['birthmonth'] . '-' . $data['birthday']; } else { $array['birthday'] = ''; } } else { $array['birthday'] = ''; } //获取好友头像 $array['avatar'] = sns::getavatar($user_id, 130); return $this->array_to_Group_contact($array); } return FALSE; }
/** * * 更新头像接口 * POST update_avatar.json * { * "pid":"原始照片的id", * "middle_content":"大头像base64数据" * "original_content":"原图base64数据" * } */ public function update_avatar() { if ($_POST['data']) { //flash截取头像 $data = json_decode($_POST['data'], TRUE); } else { $data = $this->get_data(); //手机端 } //如果是j2me平台直接取原图 if ($this->get_source() == 6) { $middle_data = @base64_decode($data['original_content']); } else { $middle_data = @base64_decode($data['middle_content']); } $pid = $data['pid']; //原图PID $original_data = @base64_decode($data['original_content']); //原图数据 if ($pid) { $photoModel = new Models\Photo(); if (!$photoModel->findOne($pid)) { $this->response(ResponseType::PHOTO_UPAVATAR_ERROR_INVALID); } } if (!$pid && $original_data) { $tmporigin = Core::tempname(); file_put_contents($tmporigin, $original_data); $uploader = new Uploader(); $uploader->process($tmporigin); //不是图片类型 if ($uploader->getType() !== Uploader::FILETYPE_IMAGE) { $this->response(ResponseType::PHOTO_ERROR_IMAGETYPE); } if ($result = $this->_processUpload($uploader, 1)) { $pid = $result['id']; } else { $this->response(ResponseType::PHOTO_UPAVATAR_ERROR_INVALID); } } if (!$pid || !$middle_data) { $this->response(ResponseType::ERROR_LACKPARAMS); } $tmpfile = Core::tempname(); if (!file_put_contents($tmpfile, $middle_data)) { $this->response(ResponseType::PHOTO_UPAVATAR_ERROR); } $uploader = new Uploader(); $uploader->process($tmpfile); //不是图片类型 if ($uploader->getType() !== Uploader::FILETYPE_IMAGE) { $this->response(ResponseType::PHOTO_ERROR_IMAGETYPE); } $photoModel = new Models\Photo(); $updata['cid'] = 1; //我的头像相册 $updata['oid'] = $pid; $updata['ctrl_type'] = 1; $updata['is_animated'] = 0; $updata['mtime'] = time(); if ($photoModel->create($uploader, $updata)) { $result['id'] = $photoModel->get_pid(); $result['md5'] = $photoModel->md5; $imgurls = $photoModel->geturi($result['id'], 48); $result['src'] = $imgurls[0]; list($set_avatar, $first_time) = $photoModel->setAvatar($photoModel->get_pid(), $updata['oid'], $updata['mtime']); if (!$set_avatar) { $this->response(ResponseType::PHOTO_UPAVATAR_ERROR); } $user_model = User_Model::instance(); $member_field = array('updatetime' => time()); if ($first_time) { $sms_content = '您好,这是您第一次设置头像,系统赠送了100条短信给您'; $user_model->present_sms($this->getUid(), 100, $sms_content, FALSE); $user_info = $user_model->get_user_info($this->getUid()); $member_field['completed'] = $user_info['completed'] + 10; } //发送头像修改动态 $feedModel = new Feed_Model(); $accessory[] = array('id' => $result['id']); $feedModel->addFeed($this->user_id, 3, '更新头像', $this->get_source(), array(), array(), $accessory); //更新memberinfo表 $user_model->update_user_info($this->getUid(), $member_field); $this->response(ResponseType::PHOTO_UPAVATAR_OK, '', $result); unlink($tmpfile); } else { $this->response(ResponseType::PHOTO_UPAVATAR_ERROR); } }