<?php
 /**
 *      [XCECP] (C) Colorful Network Inc.
 *      This is NOT a freeware, use is subject to license terms
 */

class AttachmentModel extends BaseModel{
	function getUrl($param){
		if(!is_array($param) && is_numeric($param)){
			$id=$param;
			$sql = "select url from qk_attachment where id='".$id."'";
			$url = $this->db->getOne($sql);
		}else if(is_array($param) && isset($param['url'])){
			$url=$param['url'];
		}else{return false;}
		if($url){
			global $baseUrl;
			if(substr($url,0,7)!="http://" && substr($url,0,8)!="https://" && substr($url,0,1)!="/"){
				$url = $baseUrl.$url;
			}
			return $url;
		}
		return false;
	}
}
?>