<?php
/**
 *----------------------------------------------------------------------------*
 * 版权所有 2010-2016 HuCart.COM，并保留所有权利。
 * 网站地址: http://Www.HuCart.Com；
 * 作者: HuCart.COM
 *----------------------------------------------------------------------------*
**/
class Link
{
	function Link()
	{
		
		//缓存
		if($GLOBALS["WebConfig"]["webtmp"]==1)
		{
			$this -> view -> caching = true;
			if($GLOBALS["WebConfig"]["webtmptime"] > 0 ){
				$this -> view -> cache_lifetime = $GLOBALS["WebConfig"]["webtmptime"] ;  //60 *  60 * 24
			}else{
				$this -> view -> cache_lifetime = 3600 ;  //60 *  60 * 24
			}
			$this -> view -> cache_dir = ROOT_PATH.$GLOBALS['cache_path'];
		}
		
		$getartsort = $this -> personal  -> get_artsort();
		$this -> view -> assign('getartsort',$getartsort);
		
		
		$this -> view -> assign('domainname',DOMAIN_NAME);
		
		$getmenu = $this -> helper -> get_menu();
		$this -> view -> assign('getmenu',$getmenu);
		
		
		$getlink = $this -> helper -> get_link();
		$this -> view -> assign('getlink',$getlink);
			
		$getads = $this -> helper -> get_ads( $instr = '1,2,3,4,5,6,7,8,9,10,11' );
		$this -> view -> assign('getads',$getads);
		
		$this -> infolist();
		
	}
	
	function infolist()
	{
		//<img src="'.BASE_WEBURL.'/img/h.gif" height="13"/>
 		$now_address = '您现在的位置：<a href="'.BASE_WEBURL.'/">首页</a> > <a href="'.BASE_WEBURL.'?/link.html">友情链接</a>';
 
		$webtitle  = '友情链接';
			
		$this -> view -> assign('webtitle',$webtitle);
			
		$this -> view -> assign('now_address',$now_address);
		
		
		$sql_query = " SELECT lin_id, lin_name, lin_url,lin_logo,lin_list   FROM  ".$this -> db -> prefix."link   WHERE lin_enabled = 1  GROUP BY  lin_id ORDER BY  lin_list ,  `lin_id` LIMIT 100 ";
		
		$info 		= $this -> db ->  select_info($sql_query);
		
		$imgInfo = array();
		$simInfo = array();
		foreach($info as $ikey => $ival)
		{	
			if($ival["lin_logo"]!='')
			{
				$imgInfo[]["link"] = "<a href='".$ival["lin_url"]."' title='".$ival["lin_name"]."'  target='_blank' ><img src='".$ival["lin_logo"]."' width=\"88\" height=\"31\" border=\"0\" /></a>";
			}else{
				$simInfo[]["link"] = "<a href='".$ival["lin_url"]."' title='".$ival["lin_name"]."'  target='_blank'>".$ival["lin_name"]."</a>";
			}
		}

		$this -> view -> assign('imgInfo',$imgInfo);
		$this -> view -> assign('simInfo',$simInfo);
		$this -> view -> display('link_tpl.html');
		
	}
}

$Link = new Link();

?>