<?php
/*
  PHP version 5
  Copyright (c) 2002-2018 ECISP.CN、EarcLink.COM
  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖
  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030
  ESPCMS官网介绍：http://www.ecisp.cn	企业建站：http://www.earclink.cn
 */

class lib_downloadlink {

    public static function call_downloadlink($parameter, $filename = false, $outHTML = false) {
        $espcms_lib_template = espcms_web_template();
        $espcms_lib_template->libfile = true;
        $para = espcms_array_getvalue($parameter);
        if (!espcms_ismatches($para['did']) || !$para['did']) {
            return false;
        }
        if (!$para['attr']) {
            return false;
        }
        $link_key['did'] = $para['did'];
        $link_key['attr'] = $para['attr'];
        $link = self::get_link($link_key);
        return $link;
    }

    private static function get_link($read = array()) {
        $action_key['ac'] = 'Download';
        $action_key['at'] = 'Export';
        $action_key['did'] = $read['did'];
        $action_key['attr'] = $read['attr'];
        $link = espcms_url_out($action_key, false, false, true);
        return $link;
    }
}