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);
    }