<?php
/**
 *----------------------------------------------------------------------------*
 * 版权所有 2005-2010 GV32.COM，并保留所有权利。
 * 网站地址: http://www.gv32.com；
 * 作者: GV32.COM
 *----------------------------------------------------------------------------*
**/
class Link
{
	function Link()
	{
		
		//缓存
		if($GLOBALS["WebConfig"]["webtmp"]==1)
		{
			$GLOBALS['Templ'] -> caching = true;
			if($GLOBALS["WebConfig"]["webtmptime"] > 0 ){
				$GLOBALS['Templ'] -> cache_lifetime = $GLOBALS["WebConfig"]["webtmptime"] ;  //60 *  60 * 24
			}else{
				$GLOBALS['Templ'] -> cache_lifetime = 3600 ;  //60 *  60 * 24
			}
			$GLOBALS['Templ'] -> cache_dir = ROOT_PATH.$GLOBALS['cache_path'];
		}
		
		$getconfig = $GLOBALS['Helpe'] -> get_config();

		$GLOBALS['Templ'] -> assign('getconfig',$getconfig);
		
		
		$GLOBALS['Templ'] -> assign('domainname',DOMAIN_NAME);
		
		$getmenu = $GLOBALS['Helpe'] -> get_menu();
		$GLOBALS['Templ'] -> assign('getmenu',$getmenu);
		
		
		$getlink = $GLOBALS['Helpe'] -> get_link();
		$GLOBALS['Templ'] -> assign('getlink',$getlink);
			
		$getads = $GLOBALS['Helpe'] -> get_ads( $instr = '1,2,3,4,5,6,7,8,9,10,11' );
		$GLOBALS['Templ'] -> assign('getads',$getads);
		
		$this -> infolist();
		
	}
	
	function infolist()
	{
			//<img src="'.BASE_WEBURL.'/img/h.gif" height="13"/>
			$nowaddress = '您现在的位置：<a href="'.BASE_WEBURL.'/">首页</a> > <a href="'.BASE_WEBURL.'/?load=link">友情链接</a>';
		
			$webtitle  = '友情链接';
			
			$GLOBALS['Templ'] -> assign('webtitle',$webtitle);
			
			$GLOBALS['Templ'] -> assign('nowaddress',$nowaddress);
		
		
		$sqlQuery = " SELECT lin_id, lin_name, lin_url,lin_logo,lin_list   FROM  ".SQL_PREFIX."link   WHERE lin_enabled = 1  GROUP BY  lin_id ORDER BY  lin_list ,  `lin_id` LIMIT 100 ";
		
		$info 		= $GLOBALS['MySql']  ->  selectInfo($sqlQuery);
		
		$imgInfo = array();
		$simInfo = array();
		foreach($info as $ikey => $ival)
		{	
			if($ival["lin_logo"]!='')
			{
				$imgInfo[]["link"] = "<a href='".$ival["lin_url"]."' title='".$ival["lin_name"]."'><img src='".$ival["lin_logo"]."' width=\"88\" height=\"31\" border=\"0\" /></a>";
			}else{
				$simInfo[]["link"] = "<a href='".$ival["lin_url"]."' title='".$ival["lin_name"]."'>".$ival["lin_name"]."</a>";
			}
		}

		$GLOBALS['Templ'] -> assign('imgInfo',$imgInfo);
		$GLOBALS['Templ'] -> assign('simInfo',$simInfo);
		$GLOBALS['Templ'] -> display('link_tpl.html');
		
	}
}

$Link = new Link();

?>