Exemplo n.º 1
0
<!-- IE8 fixed -->
<!--[if lt IE 9]>
    <link rel="stylesheet" href="<?php 
echo STATICURL;
?>
/css/iefix.css?<?php 
echo VERHASH;
?>
" />
<![endif]-->
<!-- load css end -->

<!-- JS全局变量-->
<script>
<?php 
$gUploadConfig = Attach::getUploadConfig();
$gAccount = User::getAccountSetting();
?>
    var G = {
        VERHASH: '<?php 
echo VERHASH;
?>
',
        SITE_URL: '<?php 
echo Ibos::app()->setting->get('siteurl');
?>
',
        STATIC_URL: '<?php 
echo STATICURL;
?>
',
Exemplo n.º 2
0
/**
 * 处理附件下载
 * @param string $userId 微信用户ID
 * @param integer $appId 应用ID
 * @param string $aid 带附件类型的附件ID字符串
 * @return mixed
 */
function doAttachDownload($userId, $appId, $aid)
{
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $isIphone = strpos($agent, 'iphone') ? true : false;
    list($type, $id) = explode('/', $aid);
    if ($type == 'cloud') {
        list($id, $cloud) = explode('-', $id);
    } else {
        $cloud = 0;
    }
    $attachs = Attach::getAttachData($id);
    $attach = array_shift($attachs);
    if ($attach['uid'] != Ibos::app()->user->uid) {
        return close('您没有权限下载此文件');
    }
    $filepath = File::getAttachUrl() . '/' . $attach['attachment'];
    if ($cloud) {
        $core = new FileCloud($cloud);
        $url = $core->getRealUrl($filepath);
    } else {
        $url = Ibos::app()->request->getHostInfo() . '/' . $filepath;
    }
    if ($isIphone) {
        header('Location:' . $url, true);
        exit;
    } else {
        Env::iExit("<h1>微信现只支持IOS系统在微信内打开下载,请长按链接选择打开或者复制下载链接到手机浏览器下载<br/>{$url}</h1>");
    }
}