⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tag.func.php

📁 采用模块化开发
💻 PHP
📖 第 1 页 / 共 3 页
字号:
		$datetypes = array('', 'Y-m-d', 'm-d', 'Y/m/d', 'Y.m.d', 'Y-m-d H:i:s', 'Y-m-d H:i');
		$ordertypes = array('listorder DESC, companyid DESC', 'edittime DESC', 'edittime ASC', 'hits DESC', 'hits ASC');
		$page = isset($page) ? intval($page) : 1;
		if($datetype < 0 || $datetype > 6) $datetype = 0;
		if($ordertype < 0 || $ordertype > 4) $ordertype = 0;
		$listpages = 0;
		$condition = '';
		if($tradeid) 
		{
			if(is_numeric($tradeid))
			{
				if($child && $TRADE[$tradeid]['child'] && $TRADE[$tradeid]['arrchildid'])
				{
					$condition .= ' AND tradeid IN ('.$TRADE[$tradeid]['arrchildid'].') ';
				}
				else
				{
					$condition .= " AND tradeid=$tradeid ";
					$listpages = 1;
				}
			}
			else
			{
				$condition .= " AND tradeid IN ($tradeid) ";
			}
		}
		if($datenum) $condition .= " AND addtime>$PHP_TIME-86400*$datenum ";
		if($pattern) $condition .= " AND pattern LIKE '%$pattern%' ";
		if($elite) $condition .= " AND elite=1 ";
		if($vip) $condition .= " AND vip>$PHP_TIME ";
		$offset = $page ? ($page-1)*$number : 0;
		if($page && $number)
		{
			$r = $db->get_one("SELECT SQL_CACHE count(*) AS number FROM ".TABLE_MEMBER_COMPANY." WHERE status=3 $condition ");
			$pages = phppages($r['number'], $page, $number);
		}
		$ordertype = $ordertypes[$ordertype];
		$limit = $number ? " LIMIT $offset, $number " : 'LIMIT 0, 10';
		$companys = array();
		$result = $db->query("SELECT SQL_CACHE * FROM ".TABLE_MEMBER_COMPANY." WHERE status=3 $condition ORDER BY $ordertype $limit ");
		while($r = $db->fetch_array($result))
		{	
			$r['adddate'] = $datetype ? date($datetypes[$datetype],$r['addtime']) : '';
			@extract($db->get_one("SELECT userid AS t_userid FROM ".TABLE_MEMBER." WHERE username='$r[username]'"));
			$r['userid'] = $t_userid;
			$r['vip'] = $r['vip']>$PHP_TIME ? 1 : 0;
			$r['introduce'] = $length ? str_cut(strip_tags($r['introduce']), $length , '...') : '';
			$r['areaname'] = $AREA[$r['areaid']]['areaname'];
			$r['catname'] = $TRADE[$r['tradeid']]['tradename'];
			$companys[] = $r;
		}
		$db->free_result($result);
	if($target) $target = ' target="_blank"';
	$width = ceil(100/$cols).'%';
	if(!$templateid) $templateid = 'tag_company_list';
	include template('yp', $templateid);
}
function yp_buy_list($templateid = '', $tradeid = 0, $child = 1, $page = 0, $productnum = 10, $titlelen = 30, $introducelen = 0, $posid = 0, $datenum = 0, $ordertype = 0, $datetype = 0, $showcatname = 0, $showauthor = 0, $showhits = 0, $target = 0, $cols = 1, $username = '', $elite = 0) 
{
	global $db, $PHP_TIME, $CONFIG, $MODULE,$action,$PHP_DOMAIN,$categroy, $skindir;
	$TRADE_BUY = cache_read('trades_buy.php');
	$datetypes = array('', 'Y-m-d', 'm-d', 'Y/m/d', 'Y.m.d', 'Y-m-d H:i:s', 'Y-m-d H:i');
	$ordertypes = array('listorder DESC, productid DESC', 'edittime DESC', 'edittime ASC', 'hits DESC', 'hits ASC');
	$page = isset($page) ? intval($page) : 1;
	if($datetype < 0 || $datetype > 6) $datetype = 0;
	if($ordertype < 0 || $ordertype > 4) $ordertype = 0;
	$listpages = 0;
	$status = $elite ? "status=5 " : "status>=3";
	$condition = '';
	if($tradeid) 
	{
		if(is_numeric($tradeid))
		{
			if($child && $TRADE_BUY[$tradeid]['child'] && $TRADE_BUY[$tradeid]['arrchildid'])
			{
				$condition .= ' AND catid IN ('.$TRADE_BUY[$tradeid]['arrchildid'].') ';
			}
			else
			{
				$condition .= " AND catid=$tradeid ";
				$listpages = 1;
			}
		}
		else
		{
			$condition .= " AND catid IN ($tradeid) ";
		}
	}
	if($datenum) $condition .= " AND addtime>$PHP_TIME-86400*$datenum ";
	if($username) $condition .= " AND username='$username' ";
	$offset = $page ? ($page-1)*$productnum : 0;
	
	if($page && $productnum)
	{
		$r = $db->get_one("SELECT count(*) AS number FROM ".TABLE_YP_BUY." WHERE $status $condition ");
		if($categroy)
		{
			$pages = companypages(3, $r['number'], $page,$productnum);
		}
		else
		{		
			$pages = phppages($r['number'], $page, $productnum);
		}
	}
	$ordertype = $ordertypes[$ordertype];
	$limit = $productnum ? " LIMIT $offset, $productnum " : 'LIMIT 0, 10';
	$products = array();
	$result = $db->query("SELECT SQL_CACHE * FROM ".TABLE_YP_BUY." WHERE $status $condition ORDER BY $ordertype $limit ");
	while($r = $db->fetch_array($result))
	{
		$r['adddate'] = $datetype ? date($datetypes[$datetype],$r['addtime']) : '';
		$r['linkurl'] = linkurl($r['linkurl']);
		$r['stitle'] = style(str_cut($r['title'], $titlelen , '...'), $r['style']);
		$r['introduce'] = $introducelen ? str_cut(strip_tags($r['introduce']), $introducelen , '...') : '';
		if($showcatname)
		{
			$r['catname'] = $TRADE_BUY[$r['catid']]['tradename'];
			$r['catlinkurl'] = $MODULE['yp']['linkurl'].$TRADE_BUY[$r['catid']]['linkurl'];
		}
		$products[] = $r;
	}
	$db->free_result($result);
	if($target) $target = ' target="_blank"';
	$width = ceil(100/$cols).'%';
	if(!$templateid) $templateid = 'tag_buy_list';
	include template('yp', $templateid);
}
function yp_sales_list($templateid = '', $tradeid = 0, $child = 1, $page = 0, $productnum = 10, $titlelen = 30, $introducelen = 0, $posid = 0, $datenum = 0, $ordertype = 0, $datetype = 0, $showcatname = 0, $showauthor = 0, $showhits = 0, $target = 0, $cols = 1, $username = '', $elite = 0) 
{
	global $db, $PHP_TIME, $CONFIG, $MODULE,$action,$PHP_DOMAIN,$categroy, $skindir;
	$TRADE_SALES = cache_read('trades_sales.php');
	$datetypes = array('', 'Y-m-d', 'm-d', 'Y/m/d', 'Y.m.d', 'Y-m-d H:i:s', 'Y-m-d H:i');
	$ordertypes = array('listorder DESC, productid DESC', 'edittime DESC', 'edittime ASC', 'hits DESC', 'hits ASC');
	$page = isset($page) ? intval($page) : 1;
	if($datetype < 0 || $datetype > 6) $datetype = 0;
	if($ordertype < 0 || $ordertype > 4) $ordertype = 0;
	$listpages = 0;
	$status = $elite ? "status=5 " : "status>=3";
	$condition = '';
	if($tradeid) 
	{
		if(is_numeric($tradeid))
		{
			if($child && $TRADE_SALES[$tradeid]['child'] && $TRADE_SALES[$tradeid]['arrchildid'])
			{
				$condition .= ' AND catid IN ('.$TRADE_SALES[$tradeid]['arrchildid'].') ';
			}
			else
			{
				$condition .= " AND catid=$tradeid ";
				$listpages = 1;
			}
		}
		else
		{
			$condition .= " AND catid IN ($tradeid) ";
		}
	}

	if($datenum) $condition .= " AND addtime>$PHP_TIME-86400*$datenum ";
	if($username) $condition .= " AND username='$username' ";
	$offset = $page ? ($page-1)*$productnum : 0;
	if($page && $productnum)
	{
		$r = $db->get_one("SELECT SQL_CACHE count(*) AS number FROM ".TABLE_YP_SALES." WHERE $status $condition ");
		if($categroy)
		{
			$pages = companypages(3, $r['number'], $page,$productnum);
		}
		else
		{		
			$pages = phppages($r['number'], $page, $productnum);
		}
	}
	
	$ordertype = $ordertypes[$ordertype];
	$limit = $productnum ? " LIMIT $offset, $productnum " : 'LIMIT 0, 10';
	$products = array();
	$result = $db->query("SELECT SQL_CACHE * FROM ".TABLE_YP_SALES." WHERE $status $condition ORDER BY $ordertype $limit ");
	while($r = $db->fetch_array($result))
	{
		$r['adddate'] = $datetype ? date($datetypes[$datetype],$r['addtime']) : '';
		$r['linkurl'] = linkurl($r['linkurl']);
		$r['stitle'] = style(str_cut($r['title'], $titlelen , '...'), $r['style']);
		$r['introduce'] = $introducelen ? str_cut(strip_tags($r['intriduce']), $introducelen , '...') : '';
		if($showcatname)
		{
			$r['catname'] = $TRADE_SALES[$r['catid']]['tradename'];
			$r['catlinkurl'] = linkurl($TRADE_SALES[$r['catid']]['linkurl']);
		}
		$products[] = $r;
	}
	$db->free_result($result);
	if($target) $target = ' target="_blank"';
	$width = ceil(100/$cols).'%';
	if(!$templateid) $templateid = 'tag_sales_list';
	include template('yp', $templateid);
}
function yp_sales_thumb($templateid = '', $tradeid = 0, $child = 1, $page = 0, $number = 10,$titlelen = 20, $introducelen = 0, $posid = 0, $datenum = 0, $ordertype = 0, $datetype = 0, $showalt = 0, $target = 0, $imgwidth = 100, $imgheight = 100, $cols = 1, $username = '', $elite = 0)
{
	global $db, $PHP_TIME, $CONFIG,$categroy, $skindir;
	$TRADE_SALES = cache_read('trades_sales.php');
	$datetypes = array('', 'Y-m-d', 'm-d', 'Y/m/d', 'Y.m.d', 'Y-m-d H:i:s', 'Y-m-d H:i');
	$ordertypes = array('listorder DESC, productid DESC', 'edittime DESC', 'edittime ASC', 'hits DESC', 'hits ASC');
	$page = isset($page) ? intval($page) : 1;
	$status = $elite ? "status=5 " : "status>=3 ";
	if($datetype < 0 || $datetype > 6) $datetype = 0;
	if($ordertype < 0 || $ordertype > 4) $ordertype = 0;
	$listpages = 0;
	$condition = '';
	if($tradeid) 
	{
		if(is_numeric($tradeid))
		{
			if($child && $TRADE_SALES[$tradeid]['child'] && $TRADE_SALES[$tradeid]['arrchildid'])
			{
				$condition .= ' AND catid IN ('.$TRADE_SALES[$tradeid]['arrchildid'].') ';
			}
			else
			{
				$condition .= " AND catid=$tradeid ";
				$listpages = 1;
			}
		}
		else
		{
			$condition .= " AND catid IN ($tradeid) ";
		}
	}
	if($datenum) $condition .= " AND addtime>$PHP_TIME-86400*$datenum ";
	if($username) $condition .= " AND username='$username' ";
	$offset = $page ? ($page-1)*$number : 0;
	if($page && $number)
	{
		$r = $db->get_one("SELECT count(*) AS number FROM ".TABLE_YP_SALES." WHERE $status $condition ");
		if($categroy)
		{
			$pages = companypages(0, $r['number'], $page,$number);
		}
		else
		{
			$pages = phppages($r['number'], $page, $number);
		}
	}
	$ordertype = $ordertypes[$ordertype];
	$limit = $number ? " LIMIT $offset, $number " : 'LIMIT 0, 10';
	$products = array();
	$result = $db->query("SELECT SQL_CACHE * FROM ".TABLE_YP_SALES." WHERE $status AND thumb!='' $condition ORDER BY $ordertype $limit ");
	while($r = $db->fetch_array($result))
	{
		$r['adddate'] = $datetype ? date($datetypes[$datetype],$r['addtime']) : '';
		$r['linkurl'] = linkurl($r['linkurl']);
		$r['stitle'] = style(str_cut($r['title'], $titlelen , '...'), $r['style']);
		$r['introduce'] = $introducelen ? str_cut(strip_tags($r['introduce']), $introducelen , '...') : '';
		$r['thumb'] = imgurl($r['thumb']);
		if($showalt) $r['alt'] = $r['title'];
		$products[] = $r;
	}
	$db->free_result($result);
	if($target) $target = ' target="_blank"';
	$width = ceil(100/$cols).'%';
	if(!$templateid) $templateid = 'tag_sales_thumb';
	include template('yp',$templateid);
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -