/** * 获取头像上传代码 * * @param int $uid 用户uid * @param int $getHtml 获取代码|配置 * @return string|array */ public function getFlashAction() { $uid = $this->getInput('uid', 'get'); $getHtml = $this->getInput('getHtml', 'get'); if ($getHtml === null) { $getHtml = 1; } $client = Windid::client(); $time = Windid::getTime(); $key = WindidUtility::appKey($client->clientId, $time, $client->clientKey); $postUrl = "postAction=ra_postAction&redirectURL=/&requestURL=" . urlencode($client->serverUrl . "/windid/index.php?m=api&c=avatar&a=doAvatar&uid=" . $uid . '&windidkey=' . $key . '&time=' . $time . '&clientid=' . $client->clientId . '&type=flash') . '&avatar=' . urlencode($this->getAvatar($uid, 'big') . '?r=' . rand(1, 99999)); $result = $getHtml ? '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="430" id="rainbow" align="middle"> <param name="movie" value="' . Windid::resUrl() . 'swf/avatar/avatar.swf?' . rand(0, 9999) . '" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="play" value="true" /> <param name="loop" value="true" /> <param name="wmode" value="opaque" /> <param name="scale" value="showall" /> <param name="menu" value="true" /> <param name="devicefont" value="false" /> <param name="salign" value="" /> <param name="allowScriptAccess" value="always" /> <param name="FlashVars" value="' . $postUrl . '"/> <embed src="' . Windid::resUrl() . 'swf/avatar/avatar.swf?' . rand(0, 9999) . '" quality="high" bgcolor="#ffffff" width="700" height="430" name="mycamera" align="middle" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" wmode="transparent" FlashVars="' . $postUrl . '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>' : array('width' => '500', 'height' => '405', 'id' => 'uploadAvatar', 'name' => 'uploadAvatar', 'src' => Windid::resUrl() . 'swf/avatar/avatar.swf', 'wmode' => 'transparent', 'postUrl' => $client->serverUrl . "/windid/index.php?m=api&c=avatar&a=doAvatar&uid=" . $uid . '&windidkey=' . $key . '&time=' . $time . '&clientid=' . $client->clientId . '&type=normal', 'token' => $key); $this->output($result); }
public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $charset = 'utf-8'; $_windidkey = $this->getInput('windidkey', 'get'); $_time = (int) $this->getInput('time', 'get'); $_clientid = (int) $this->getInput('clientid', 'get'); if (!$_time || !$_clientid) { $this->output(WindidError::FAIL); } $clent = $this->_getAppDs()->getApp($_clientid); if (!$clent) { $this->output(WindidError::FAIL); } if (WindidUtility::appKey($clent['id'], $_time, $clent['secretkey']) != $_windidkey) { $this->output(WindidError::FAIL); } $time = Windid::getTime(); if ($time - $_time > 120) { $this->output(WindidError::TIMEOUT); } $charset = $clent['charset'] == 1 ? 'utf8' : 'gbk'; $baseUrl = Wind::getApp()->getRequest()->getBaseUrl(true) . '/'; $config = array('windid' => 'client', 'serverUrl' => $baseUrl, 'clientId' => $clent['id'], 'clientKey' => $clent['secretkey'], 'clientDb' => 'mysql', 'clientCharser' => $charset); WindidClientBo::getInstance($config); }
public function setCreditsAction() { $credits = $this->getInput('credits', 'post'); $this->_getConfigService()->setLocalCredits($credits); $this->_getNotifyService()->send('setCredits', array(), $this->appid); $this->output(WindidUtility::result(true)); }
/** * 通知客户端 * Enter description here ... * @param unknown_type $operation * @param unknown_type $data */ protected function queueSend($start = 0) { $time = Windid::getTime(); $appids = $nids = array(); $logDs = $this->_getNotifyLogDs(); $queue = $logDs->getList(0, 0, 10, $start, 0); if (!$queue) { return false; } foreach ($queue as $v) { $appids[] = $v['appid']; $nids[] = $v['nid']; } $apps = $this->_getAppDs()->fetchApp(array_unique($appids)); $notifys = $this->_getNotifyDs()->fetchNotify(array_unique($nids)); $postData = $urls = array(); foreach ($queue as $k => $v) { $appid = $v['appid']; $nid = $v['nid']; $array = array('windidkey' => WindidUtility::appKey($v['appid'], $time, $apps[$appid]['secretkey']), 'operation' => $notifys[$nid]['operation'], 'uid' => (int) $notifys[$nid]['param'], 'clientid' => $v['appid'], 'time' => $time); $urls[$k] = WindidUtility::buildClientUrl($apps[$appid]['siteurl'], $apps[$appid]['apifile']) . http_build_query($array); } if (!$urls) { return false; } $result = WindidUtility::buildMultiRequest($urls); sleep(3); $this->logId = $this->logId + $result; $start += 10; $this->queueSend($start); }
public static function checkOldPassword($password, $uid) { $user = self::_getUserService()->getUserByUid($uid, WindidUser::FETCH_MAIN); if (WindidUtility::buildPassword($password, $user['salt']) != $user['password']) { return new WindidError(WindidError::PASSWORD_ERROR); } return true; }
public function doAvatar($uid, $file = '') { $time = Pw::getTime(); $query = array('m' => 'api', 'c' => 'avatar', 'a' => 'doavatar', 'windidkey' => WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY, array('uid' => $uid, 'm' => 'api', 'c' => 'avatar', 'a' => 'doavatar'), array()), 'clientid' => WINDID_CLIENT_ID, 'time' => $time, 'uid' => $uid); $url = WINDID_SERVER_URL . '/index.php?' . http_build_query($query); $result = WindidUtility::uploadRequest($url, $file); if ($result === false) { return WindidError::SERVER_ERROR; } return Pw::jsonDecode($result); }
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http') { $time = Pw::getTime(); list($c, $a) = explode('/', $script); $query = array('m' => 'api', 'c' => $c, 'a' => $a, 'windidkey' => WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY), 'clientid' => WINDID_CLIENT_ID, 'time' => $time); $url = WINDID_SERVER_URL . '/index.php?' . http_build_query($query) . '&' . http_build_query($getData); $result = WindidUtility::buildRequest($url, $postData); if ($result === false) { return WindidError::SERVER_ERROR; } return Pw::jsonDecode($result); }
public function doAvatar($uid, $file = '') { $client = Windid::client(); $time = time() + $client->timecv * 60; $query = array('m' => 'api', 'c' => 'avatar', 'a' => 'doavatar', 'windidkey' => WindidUtility::appKey($client->clientId, $time, $client->clientKey), 'clientid' => $client->clientId, 'time' => $time, 'uid' => $uid); $url = $client->serverUrl . '/windid/index.php?' . http_build_query($query); $result = WindidUtility::uploadRequest($url, $file); if ($result === false) { return WindidError::SERVER_ERROR; } return WindJson::decode($result, true, $client->clientCharser); }
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http') { echo "here"; $client = Windid::client(); $time = time() + $client->timecv * 60; list($c, $a) = explode('/', $script); $query = array('m' => 'api', 'c' => $c, 'a' => $a, 'windidkey' => WindidUtility::appKey($client->clientId, $time, $client->clientKey), 'clientid' => $client->clientId, 'time' => $time); $url = $client->serverUrl . '/windid/index.php?' . http_build_query($query) . '&' . http_build_query($getData); $result = WindidUtility::buildRequest($url, $postData); if ($result === false) { return WindidError::SERVER_ERROR; } return WindJson::decode($result, true, $client->clientCharser); }
public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $_windidkey = $this->getInput('windidkey', 'get'); $_time = (int) $this->getInput('time', 'get'); $_clentid = (int) $this->getInput('clientid', 'get'); WindidClientBo::getInstance(); $client = Windid::client(); if (WindidUtility::appKey($client->clientId, $_time, $client->clientKey) != $_windidkey) { $this->showError('fail'); } $time = Windid::getTime(); if ($time - $_time > 120) { $this->showError('timeout'); } }
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http') { $time = Pw::getTime(); list($c, $a) = explode('/', $script); $query = array('m' => 'api', 'c' => $c, 'a' => $a, 'windidkey' => WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY, $getData, $postData), 'clientid' => WINDID_CLIENT_ID, 'time' => $time); $url = WINDID_SERVER_URL . '/index.php?' . http_build_query($query) . '&' . http_build_query($getData); //$result = WindidUtility::buildRequest($url, $postData); //系统自带的函数不知道是什么问题,先用这个函数,并且加上过滤防范了安全。taishici if (!(strpos($url, 'http://') === 0 || strpos($url, 'https://') === 0)) { return false; } $result = file_get_contents($url); if ($result === false) { return WindidError::SERVER_ERROR; } return Pw::jsonDecode($result); }
public function clientTestAction() { $clientid = $this->getInput('clientid'); $client = $this->_getAppDs()->getApp($clientid); if (!$client) { $this->showError('WINDID:fail'); } $time = Pw::getTime(); $array = array('windidkey' => WindidUtility::appKey($client['id'], $time, $client['secretkey']), 'operation' => 999, 'uid' => 1, 'clientid' => $client['id'], 'time' => $time); $url = WindidUtility::buildClientUrl($client['siteurl'], $client['apifile']) . http_build_query($array); $result = WindidUtility::buildRequest($url); if ($result === 'seccess') { $this->showMessage('WINDID:success'); } $this->showError('WINDID:fail'); }
public function clientTestAction() { $clientid = $this->getInput('clientid'); $client = $this->_getAppDs()->getApp($clientid); if (!$client) { $this->showError('WINDID:fail'); } $time = Pw::getTime(); $params['params'] = serialize(array('test' => $time)); $windidkey = WindidUtility::appKey($client['id'], $time, $client['secretkey']); $url = WindidUtility::buildClientUrl($client['siteurl'], $client['apifile']) . 'operation=999&windidkey=' . $windidkey . '&clentid=' . $client['id'] . '&time=' . $time; $result = WindidUtility::buildRequest($url, $params); if ($result === 'seccess') { $this->showMessage('ADMIN:success'); } $this->showError('ADMIN:fail'); }
public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $_windidkey = $this->getInput('windidkey', 'get'); $_time = (int) $this->getInput('time', 'get'); $_clentid = (int) $this->getInput('clientid', 'get'); $windidConfig = Wekit::C('windid'); define('WINDID_CONNECT', $windidConfig['connect']); define('WINDID_SERVER_URL', $windidConfig['serverUrl']); define('WINDID_CLIENT_ID', $windidConfig['clientId']); define('WINDID_CLIENT_KEY', $windidConfig['clientKey']); if (WindidUtility::appKey(WINDID_CLIENT_ID, $_time, WINDID_CLIENT_KEY) != $_windidkey) { $this->showError('fail'); } $time = Pw::getTime(); if ($time - $_time > 120) { $this->showError('timeout'); } }
protected function _request($queue) { $time = Pw::getTime(); $appids = $nids = array(); foreach ($queue as $v) { $appids[] = $v['appid']; $nids[] = $v['nid']; } $apps = $this->_getAppDs()->fetchApp(array_unique($appids)); $notifys = $this->_getNotifyDs()->fetchNotify(array_unique($nids)); $post = $urls = array(); foreach ($queue as $k => $v) { $appid = $v['appid']; $nid = $v['nid']; $array = array('windidkey' => WindidUtility::appKey($v['appid'], $time, $apps[$appid]['secretkey']), 'operation' => $notifys[$nid]['operation'], 'clientid' => $v['appid'], 'time' => $time); $post[$k] = unserialize($notifys[$nid]['param']); $urls[$k] = WindidUtility::buildClientUrl($apps[$appid]['siteurl'], $apps[$appid]['apifile']) . http_build_query($array); } return WindidUtility::buildMultiRequest($urls, $post); }
/** * 同步登录登出 * * @param string $notify * @param int $uid */ public function syn($method, $uid, $appid = 0) { $operation = $this->getOperation($method); $time = Pw::getTime(); $data = array(); $apps = $this->_getAppDs()->getList(); $syn = false; foreach ($apps as $val) { if (!$val['issyn'] && $val['id'] == $appid) { $syn = true; break; } if (!$val['issyn'] || $val['id'] == $appid) { continue; } $array = array('windidkey' => WindidUtility::appKey($val['id'], $time, $val['secretkey'], array('uid' => $uid), array()), 'operation' => $operation, 'uid' => $uid, 'clientid' => $val['id'], 'time' => $time); $data[] = WindidUtility::buildClientUrl($val['siteurl'], $val['apifile']) . http_build_query($array); } return $syn ? array() : $data; }
public function notifyAction(Request $request) { if (!defined('WEKIT_TIMESTAMP')) { define('WEKIT_TIMESTAMP', time()); } require_once __DIR__ . '/../../../../vendor_user/windid_client/src/windid/WindidApi.php'; //引入windid接口类 require_once __DIR__ . '/../../../../vendor_user/windid_client/src/windid/service/base/WindidUtility.php'; //引入windid工具库 $windidKey = $request->query->get('windidkey'); $queryTime = $request->query->get('time'); $clientId = $request->query->get('clientid'); $operation = $request->query->get('operation'); $currentTimestamp = \Pw::getTime(); if (in_array($operation, array(111, 112))) { unset($_GET['operation']); } if (\WindidUtility::appKey(WINDID_CLIENT_ID, $queryTime, WINDID_CLIENT_KEY, $_GET, $_POST) != $windidKey) { return $this->createWindidResponse('sign error.'); } if ($currentTimestamp->{$queryTime} > 120) { return $this->createWindidResponse('timeout.'); } list($method, $args) = $this->getWindidMethod($operation); if (!$method) { return $this->createWindidResponse('fail'); } $method = 'do' . ucfirst($method); if (!method_exists($this, $method)) { return $this->createWindidResponse('success'); } $filteredArgs = array(); foreach ($args as $key) { $filteredArgs[$key] = $request->get($key); } $result = $this->{$method}($request, $filteredArgs); if ($result == true) { return $this->createWindidResponse('success'); } return $this->createWindidResponse('fail'); }
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http') { $time = Pw::getTime(); list($c, $a) = explode('/', $script); $getData['m'] = 'api'; $getData['c'] = $c; $getData['a'] = $a; $getData['clientid'] = WINDID_CLIENT_ID; $getData['time'] = $time; $getData['windidkey'] = WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY, $getData, $postData); $url = WINDID_SERVER_URL . '/index.php?' . http_build_query($getData); if (!(strpos($url, 'http://') === 0 || strpos($url, 'https://') === 0)) { return false; } //$result = file_get_contents($url); $result = WindidUtility::buildRequest($url, $postData); if ($result === false) { return WindidError::SERVER_ERROR; } return Pw::jsonDecode($result); }
public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $charset = 'utf-8'; $_windidkey = $this->getInput('windidkey', 'get'); $_time = (int) $this->getInput('time', 'get'); $_clientid = (int) $this->getInput('clientid', 'get'); if (!$_time || !$_clientid) { $this->output(WindidError::FAIL); } $clent = $this->_getAppDs()->getApp($_clientid); if (!$clent) { $this->output(WindidError::FAIL); } if (WindidUtility::appKey($clent['id'], $_time, $clent['secretkey'], $this->getRequest()->getGet(null), $this->getRequest()->getPost()) != $_windidkey) { $this->output(WindidError::FAIL); } $time = Pw::getTime(); if ($time - $_time > 1200) { $this->output(WindidError::TIMEOUT); } $this->appid = $_clientid; }
protected function _beforeUpdate() { Wind::import("WSRV:user.validator.WindidUserValidator"); if (!$this->uid) { return new WindidError(WindidError::FAIL); } if (isset($this->_data['username'])) { $result = WindidUserValidator::checkName($this->_data['username'], $this->uid); if ($result !== true) { return $result; } } if (isset($this->_data['email'])) { $result = WindidUserValidator::checkEmail($this->_data['email'], $this->uid); if ($result !== true) { return $result; } } if (isset($this->_data['old_password'])) { $result = WindidUserValidator::checkOldPassword($this->_data['old_password'], $this->uid); if ($result !== true) { return $result; } } if (isset($this->_data['password'])) { $this->_data['salt'] = WindUtility::generateRandStr(6); $this->_data['password'] = WindidUtility::buildPassword($this->_data['password'], $this->_data['salt']); } if (isset($this->_data['question']) && isset($this->_data['answer'])) { $this->_data['safecv'] = $this->_data['question'] ? substr(md5($this->_data['question'] . $this->_data['answer']), 8, 8) : ''; } return true; }
/** * 淘宝; 暂时不支持 * * @access public * @return void */ public function taobaoAuthInfo() { // $this->_appid = $this->_third_platform_conf[$this->third_platform_name . '.appId']; $this->_appkey = $this->_third_platform_conf[$this->third_platform_name . '.appKey']; //step 1 $_access_token = $this->_session->get($this->third_platform_name . '_access_token'); if (empty($_access_token)) { $_uri = sprintf($this->_third_platform_uri_conf[$this->third_platform_name]['access_token_uri'], $this->_appid, $this->_appkey, $this->auth_code, $this->native_name); $_uri_data = parse_url($_uri); $_uri = sprintf('%s://%s%s', $_uri_data['scheme'], $_uri_data['host'], $_uri_data['path']); parse_str($_uri_data['query'], $postdata); $_access_token_result = WindidUtility::buildRequest($_uri, $postdata, true, 2); $_args = json_decode($_access_token_result, true); if (isset($_args['access_token'])) { $_access_token = $_args['access_token']; $this->_session->set($this->third_platform_name . '_access_token', $_access_token); } } exit; //step 2 if ($_access_token) { $_uri = sprintf($this->_third_platform_uri_conf[$this->third_platform_name]['userinfo_uri'], $_access_token['access_token'], $_access_token['uid'], $this->_appkey); $_userinfo_result = WindidUtility::buildRequest($_uri, array(), true, 2, 'get'); $_userinfo_result = json_decode($_userinfo_result, true); // if (isset($_userinfo_result['name'])) { $info = array('uid' => '', 'username' => $_userinfo_result['name'], 'gender' => $_userinfo_result['gender'] == 'm' ? 0 : 1, 'avatar' => $_userinfo_result['avatar_large']); } unset($_userinfo_result); } if (empty($info) || !isset($info)) { $this->_session->delete($this->third_platform_name . '_access_token'); } return $info; }
public function deleteMessages() { $uid = (int) $this->getInput('uid', 'post'); $messageIds = $this->getInput('messageIds', 'post'); if (!is_array($messageIds)) { $messageIds = array($messageIds); } $result = $this->_getBoxMessage()->deleteMessages($uid, $messageIds); $this->output(WindidUtility::result($result)); }
/** * 保存phpwind.aliyun.com帮站长申请关于悟空的im应用密匙 * * @param mixed $key * @static * @access public * @return void */ public static function saveAppekySetting($key) { $config = Wekit::C()->getConfigByName('site', 'info.url'); $_uri = self::PW_CREATER_URI . '/api/getlaiwanginfo?siteurl=' . urlencode($config['value']); $unsecurityKey = WindidUtility::buildRequest($_uri, array(), true, self::WK_TIMEOUT, 'get'); $unsecurityKey = json_decode($unsecurityKey, true); if ($unsecurityKey && $unsecurityKey['status'] == 200) { $_unsecurityKey = Pw::decrypt($unsecurityKey['data']['info'], $key); $appSettingData = unserialize($_unsecurityKey); // 解密错了或者其他情况不保存空的数据到数据库 if (!$appSettingData) { return array(); } // 保存laiwang appkey等 $config = new PwConfigSet('wukong'); $config->set('appToken', $appSettingData['appToken'])->set('domain', $appSettingData['domain'])->set('org', $appSettingData['org'])->set('android.appKey', $appSettingData['Android']['appKey'])->set('android.appSecret', $appSettingData['Android']['appSecret'])->set('ios.appKey', $appSettingData['iOS']['appKey'])->set('ios.appSecret', $appSettingData['iOS']['appSecret'])->flush(); return $appSettingData; } return array(); }
<?php require_once 'windid/src/windid/WindidApi.php'; require_once 'windid/src/windid/service/client/bo/WindidClientBo.php'; require_once 'windid/src/windid/library/WindidUtility.php'; $notify = array('999' => 'test', '101' => 'addUser', '111' => 'synLogin', '112' => 'synLogout', '201' => 'editUser', '202' => 'editUserInfo', '203' => 'uploadAvatar', '211' => 'editCredit', '222' => 'editMessageNum', '301' => 'deleteUser'); //check $_windidkey = getInput('windidkey', 'get'); $_time = (int) getInput('time', 'get'); $_clentid = (int) getInput('clientid', 'get'); WindidClientBo::getInstance(); $client = Windid::client(); if (WindidUtility::appKey($client->clientId, $_time, $client->clientKey, $_GET, $_POST) != $_windidkey) { $this->showError('fail'); } $time = Windid::getTime(); if ($time - $_time > 120) { showError('timeout'); } $operation = (int) getInput('operation', 'get'); $uid = (int) getInput('uid', 'get'); if (!$uid) { showError('fail'); } if (!isset($notify[$operation])) { showError('fail'); } $method = $notify[$operation]; $notify = new notify(); if (!method_exists($notify, $method)) { showError('fail');
public function showFlash($uid, $appId, $appKey, $getHtml = 1) { $time = Pw::getTime(); $key = WindidUtility::appKey($appId, $time, $appKey, array('uid' => $uid, 'type' => 'flash'), array('uid' => 'undefined')); $key2 = WindidUtility::appKey($appId, $time, $appKey, array('uid' => $uid, 'type' => 'normal'), array()); $postUrl = "postAction=ra_postAction&redirectURL=/&requestURL=" . urlencode(Wekit::app('windid')->url->base . "/index.php?m=api&c=avatar&a=doAvatar&uid=" . $uid . '&windidkey=' . $key . '&time=' . $time . '&clientid=' . $appId . '&type=flash') . '&avatar=' . urlencode($this->getAvatar($uid, 'big') . '?r=' . rand(1, 99999)); return $getHtml ? '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="430" id="rainbow" align="middle"> <param name="movie" value="' . Wekit::app('windid')->url->res . 'swf/avatar/avatar.swf?' . rand(0, 9999) . '" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="play" value="true" /> <param name="loop" value="true" /> <param name="wmode" value="opaque" /> <param name="scale" value="showall" /> <param name="menu" value="true" /> <param name="devicefont" value="false" /> <param name="salign" value="" /> <param name="allowScriptAccess" value="never" /> <param name="FlashVars" value="' . $postUrl . '"/> <embed src="' . Wekit::app('windid')->url->res . 'swf/avatar/avatar.swf?' . rand(0, 9999) . '" quality="high" bgcolor="#ffffff" width="700" height="430" name="mycamera" align="middle" allowScriptAccess="never" allowFullScreen="false" scale="exactfit" wmode="transparent" FlashVars="' . $postUrl . '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>' : array('width' => '500', 'height' => '405', 'id' => 'uploadAvatar', 'name' => 'uploadAvatar', 'src' => Wekit::app('windid')->url->res . 'swf/avatar/avatar.swf', 'wmode' => 'transparent', 'postUrl' => Wekit::app('windid')->url->base . "/index.php?m=api&c=avatar&a=doAvatar&uid=" . $uid . '&windidkey=' . $key2 . '&time=' . $time . '&clientid=' . $appId . '&type=normal&jcallback=avatarNormal', 'token' => $key2); }
protected function downloadThirdPlatformAvatar($uid, $avatar_url) { Wind::import('WSRV:base.WindidUtility'); $image_content = WindidUtility::buildRequest($avatar_url, array(), true, 2, 'get'); if ($image_content) { $temp_file = tempnam(PUBLIC_PATH . "data/tmp/", 'tmp_'); $handle = fopen($temp_file, "w"); if ($handle) { $res = fwrite($handle, $image_content); fclose($handle); Wind::import('WSRV:upload.action.WindidAvatarUpload'); Wind::import('LIB:upload.PwUpload'); $bhv = new WindidAvatarUpload($uid); $upload = new PwUpload($bhv); $value = array('name' => 'avatar.jpg', 'size' => 1024 * 1024 * 1, 'tmp_name' => $temp_file); $file = new PwUploadFile('_0', $value); $file->filename = $upload->filterFileName($bhv->getSaveName($file)); $file->savedir = $bhv->getSaveDir($file); $file->store = Wind::getComponent($bhv->isLocal ? 'localStorage' : 'storage'); $file->source = str_replace('attachment', 'windid/attachment', $file->store->getAbsolutePath($file->filename, $file->savedir)); if (PwUpload::moveUploadedFile($value['tmp_name'], $file->source)) { $image = new PwImage($file->source); if ($bhv->allowThumb()) { $thumbInfo = $bhv->getThumbInfo($file->filename, $file->savedir); foreach ($thumbInfo as $key => $value) { $thumburl = $file->store->getAbsolutePath($value[0], $value[1]); $thumburl = str_replace('attachment', 'windid/attachment', $thumburl); $result = $image->makeThumb($thumburl, $value[2], $value[3], $quality, $value[4], $value[5]); if ($result === true && $image->filename != $thumburl) { $ts = $image->getThumb(); } } } } @unlink($temp_file); } } }
/** * 删除某的黑名单 $blackUid为空删除所有 * * @param int $uid * @param int $blackUid */ public function delBlack($uid, $blackUid = '') { $result = $this->_getUserService()->delBlack($uid, $blackUid); return WindidUtility::result($result); }
public function setCredits($credits) { $this->_getConfigService()->setLocalCredits($credits); $this->_getNotifyService()->send('setCredits', array(), WINDID_CLIENT_ID); return WindidUtility::result(true); }
public function deleteAction() { $id = $this->getInput('id', 'post'); $result = $this->_getAreaDs()->deleteArea($id); $this->output(WindidUtility::result($result)); }
public function deleteArea($areaid) { $result = $this->_getAreaDs()->deleteArea($areaid); return WindidUtility::result($result); }