Ejemplo n.º 1
0
    /**
     * 获取头像上传代码
     *
     * @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);
    }
Ejemplo n.º 2
0
 protected function output($message = '')
 {
     if (is_numeric($message)) {
         echo $message;
         exit;
     } else {
         header('Content-type: application/json; charset=' . Windid::client()->clientCharser);
         echo WindJson::encode($message, Windid::client()->clientCharser);
         exit;
     }
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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');
     }
 }
Ejemplo n.º 6
0
 /**
  * 同步登录登出
  * Enter description here ...
  * @param string $notify
  * @param int $uid
  */
 public function syn($method, $uid)
 {
     $operation = array_search($method, $this->notify);
     $time = Windid::getTime();
     $data = array();
     $apps = $this->_getAppDs()->getList();
     $client = Windid::client();
     $syn = false;
     //TODO
     foreach ($apps as $val) {
         if (!$val['issyn'] && $val['id'] == $client->clientId) {
             $syn = true;
             break;
         }
         if (!$val['issyn'] || $val['id'] == $client->clientId) {
             continue;
         }
         $array = array('windidkey' => WindidUtility::appKey($val['id'], $time, $val['secretkey']), 'operation' => $operation, 'uid' => $uid, 'clientid' => $val['id'], 'time' => $time);
         $data[] = WindidUtility::buildClientUrl($val['siteurl'], $val['apifile']) . http_build_query($array);
     }
     return $syn ? array() : $data;
 }
Ejemplo n.º 7
0
 protected function output($message = '')
 {
     header('Content-type: application/json');
     echo WindJson::encode($message, Windid::client()->clientCharser);
     exit;
 }
Ejemplo n.º 8
0
<?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');
Ejemplo n.º 9
0
 /**
  * 添加用户对象接口,使用前必须使用WidnidApi::getDm('user') 设置数据
  * Enter description here ...
  * @param WindidUserDm $dm
  */
 public function addDmUser($dm)
 {
     Wind::import('WINDID:service.user.dm.WindidUserDm');
     if (!$dm instanceof WindidUserDm) {
         return WindidError::CLASS_ERROR;
     }
     $result = $this->_getUserDs()->addUser($dm);
     if ($result instanceof WindidError) {
         return WindidError::FAIL;
     }
     $uid = (int) $result;
     $client = Windid::client();
     if ($client->windid == 'local') {
         $srv = Windid::load('user.srv.WindidUserService');
         $result = $srv->defaultAvatar($uid, 'face');
     } else {
         $params = array('uid' => $uid, 'type' => 'face');
         WindidApi::open('avatar/default', array(), $params);
     }
     $this->_getNotifyClient()->send('register', $uid);
     return $uid;
 }