<?php
/**
 * 手机版本
 *
 * @copyright (c) Emlog All Rights Reserved
 */
$http = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; 
$slhost = $_SERVER['HTTP_HOST'];
$slurl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$slurl = strtolower($slurl);
if($slurl=="/index.php" || $slurl=="/shibaobao"){$slurl="";}
if($slhost == 'www.kanghang.com.cn'){header('HTTP/1.1 301 Moved Permanently');header('Location:http://sbb.sy3.com.cn');}

require_once '../init.php';
$symb = 'shibaobao';//当前目录地址，需跟文件名一样
define('SYM_PATH',EMLOG_ROOT.'/'.$symb.'/');//不可更改项，否则出错！！！
class View{public static function getView($symurl,$ext='.php'){return SYM_PATH.$symurl.$ext;}}//不可更改项，否则出
$isgzipenable = 'n'; //手机浏览关闭gzip压缩
$index_lognum = 12;//分页文章显示条数
$sortids = array(29);//分类ID
$authors= '14';//作者ID
$slcc = 'STONEBOBO石材养护系列';//公司名称
$sztel = '139-2411-2422';//电话2
$gztel = '133-8004-2128';//电话1
$email ='shuy020@qq.com';//邮箱
$dizhi ='广州市番禺区大龙街振兴南路21号';//地址
$lxr ='舒小姐';//联系人
$net = 'http://www.stonebobo.com.cn';
$site_title = "大理石晶硬剂结晶粉_石材保养护理剂_复合硅烷氟素防护剂_石材翻新保养剂-".$slcc."";
$site_key = "大理石晶硬剂,大理石结晶粉,石材保养护理剂,石材翻新保养剂";
$site_description = 'STONEBOBO石材护理用品研发，生产，OEM，销售，技术培训，工程配套服务。STONEBOBO(石宝宝)，让石材用着省心!咨询热线：'.$gztel.'';
$about='<p>STONEBOBO总结从业以来30多年的研发实战经验，倡导以“清”达到洁净，以“洁”达到养护的全新清洁理念，打造一套及专业材料、前沿工艺、工程服务为一体的综合性服务体系，重点为商企物业、清洁公司提供技术、产品、工程管理等专业服务；让石材能持久靓丽，宛如初生！并将业务范围扩展至人造石、水磨石、地板砖、PVC地面、水泥硬化地坪等各种硬质地面的日常保养维护。让石材发挥的装饰效果的同时大大提高使用寿命、降低清洁成本。中性材料，不含蜡质、不损伤石材、污染石材。</p>
<p>STONEBOBO品牌创立于2017年，主要从事石材护理材料、物业清洁用品的研发及出口、代加工业务，成立至今产品已远销泰国、迪拜、克罗地亚、伊朗、韩国、黎巴嫩、香港、台湾、新加坡等20多个国家，产品受到国外客户的，2019年7月份，STOENBOBO决定进入，开始在国内的产品销售。<br />
STONEBOB以爱之名，给石材宝宝级的呵护，STONEBOBO倡导环保清洁护理的理念，解决方案所使用的材料均是环保材料，中性材料，不含蜡质、不损伤石材、污染石材。</p>';//首页简介

$links ='
<a href="http://www.kanghang.com.cn" title="广州康航酒店用品有限公司" target="_blank">广州康航酒店用品有限公司</a> | 
<a href="http://mlhg.sy3.com.cn" title="明亮化工" target="_blank">明亮化工</a> | 
<a href="http://www.cbqj.com.cn" title="超宝清洁用品" target="_blank">超宝清洁用品</a> |  
<a href="http://kip.sy3.com.cn" title="凯鹏多功能清洁乳" target="_blank">凯鹏多功能清洁乳</a>  
';

//作者SEO
$author_tt ='STONEBOBO系列产品';
$pp ='STONEBOBO系列产品 ';//品牌

$logid = isset ($_GET['post']) ? intval ($_GET['post']) : '';
$action = isset($_GET['action']) ? addslashes($_GET['action']) : '';
$slsort = isset ($_GET['sort']) ? intval ($_GET['sort']) : '';
$slkey = isset($_GET['keyword']) ? addslashes($_GET['keyword']) : '';
$sltag =  isset ($_GET['tag']) ? addslashes ($_GET['tag']) : '';
$slauthor =  isset ($_GET['author']) ? addslashes($_GET['author']) : '';

if (Option::get('ismobile') == 'n') {
	emMsg('站点未开启访问', BLOG_URL);
}

$navi_cache = $CACHE->readCache('navi');
$user_cache = $CACHE->readCache('user');
$sort_cache = $CACHE->readCache('sort'); 
$tag_cache = $CACHE->readCache('tags');


// 首页
if (empty ($action) && empty ($logid)) {
	$Log_Model = new Log_Model();
	$page = isset($_GET['page']) ? abs(intval ($_GET['page'])) : 1;
	$sqlSegment = " and author ='12' ORDER BY top DESC,date DESC";
	$sta_cache = $CACHE->readCache('sta');
	$lognum = $sta_cache['lognum'];
	$pageurl = './?page=';
	$logs = $Log_Model->getLogsForHome ($sqlSegment, $page, $index_lognum);
	$page_url = pagination($lognum, $index_lognum, $page, $pageurl);

if(!empty($slsort)){//分类
	$sort = $sort_cache[$slsort];
	if ($sort['pid'] != 0 || empty($sort['children'])) {
			$sqlSegment = "and sortid=$slsort";
		} else {
			$sortids = array_merge(array($slsort), $sort['children']);
			$sqlSegment = "and sortid in (".implode(',', $sortids). ")";
		}
	$sqlSegment .=  " and author in($authors) order by sortop desc, date desc";
	$logs = $Log_Model->getLogsForHome($sqlSegment,$page,$index_lognum);
    $lognum = $sort_cache[$slsort]['lognum'];
    $page = isset($_GET['page']) ? abs(intval ($_GET['page'])) : 1;
    if(!in_array($slsort,$sortids)) {mMsg ('404 Not Found','抱歉，你所请求的页面不存在！',$net);}
    $sortName = $sort['sortname'];
	if($slsort==2){$site_title ='超宝清洁工具_超宝榨水桶_超宝清洁手推车'.$slcc;
	}elseif($slsort==4){$site_title ='超宝酒店PA清洁剂_超宝厨房清洁剂'.$slcc;
	}elseif($slsort==6){$site_title ='超宝吸尘吸水机_超宝石材翻新机_超宝多功能刷地机'.$slcc;
	}elseif($slsort==11){$site_title ='超宝塑料告示牌_超宝打气喷壶-'.$slcc;
	}elseif($slsort==13){$site_title ='超宝酒店专用清洁用品_超宝布草车_超宝多用途手推-'.$slcc;
	}else{$site_title = $sortName;}
	//$site_title = _g('sytt.'.$slsort) ? _g('sytt.'.$slsort) : $sortName.'';}
	$site_key = $sortName;
    $site_description = $sort_cache[$slsort]['description'];
    $pageurl = "./?sort=$slsort&page=";
    $page_url = pagination($Log_Model->getLogNum('n',$sqlSegment), $index_lognum, $page, $pageurl);
}

if(!empty($sltag)){//标签
global $CACHE;
$Tag_Model = new Tag_Model();
$page = isset($_GET['page']) ? abs(intval ($_GET['page'])) : 1;
$blogIdStr = $Tag_Model->getTagByName($sltag);
$pageurl ='';
$sqlSegment = "and gid IN ($blogIdStr) order by date desc";
$lognum = $Log_Model->getLogNum('n',$sqlSegment);
$tagname = ''.$sltag.'';
$site_title = $tagname;
$pageurl ="./?tag=$sltag&page=";
$logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
$page_url = pagination($lognum, $index_lognum, $page, $pageurl);
if($sltag){mMsg ('404 Not Found','抱歉，你所请求的页面不存在！',$net);}
}


if(!empty($slauthor)){//作者
$sqlSegment = "and author=$slauthor order by date desc";
$sta_cache = $CACHE->readCache('sta');
$lognum = $Log_Model->getLogNum('n', $sqlSegment);
if($slauthor!=$authors){mMsg ('404 Not Found','抱歉，你所请求的页面不存在！',$net);}
$pageurl = "./?author=$slauthor&page=";
$Log_Model = new Log_Model();
$ym = $page>1 ? ' - 第'.$page.'页' : '';
$site_title = $author_tt.$ym;
$logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
$page_url = pagination($lognum, $index_lognum, $page, $pageurl); 
}

if(!empty($slkey)){//搜索
$Log_Model = new Log_Model();
$page = isset($_GET['page']) ? abs(intval ($_GET['page'])) : 1;
$site_title = '搜索关键词：'.$slkey.'';		
$pageurl = '';
if (preg_match("/^[a-zA-Z0-9\-]*$/",$slkey)){$sqlSegment = "and (huohao ='{$slkey}') order by date desc";}else{$sqlSegment = "and title like '%{$slkey}%' order by date desc";}
//$sqlSegment = "and (title like '%{$slkey}%' OR huohao ='{$slkey}') order by date desc";
$lognum = $Log_Model->getLogNum('n', $sqlSegment);
$pageurl = "./?keyword=$slkey&page=";
$logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
$page_url = pagination($lognum, $index_lognum, $page, $pageurl);
}

	include View::getView('header');
	include View::getView('log');
	include View::getView('footer');
	//View::output();
}


// 文章
if (!empty ($logid)) {
	$Log_Model = new Log_Model();
	$Comment_Model = new Comment_Model();

	$logData = $Log_Model->getOneLogForHome($logid);
	if ($logData === false) {
		exit('对不起，不访问的页面不存在!');
	}
	extract($logData);

    //$site_title = $log_title;
	if(in_array($logid,array(509,510))){$site_title = $log_title.' - '.$slcc;}else{$site_title = $seotitle ? $seotitle.'-'.$slcc : $log_title.' - '.$slcc;}
	$site_key = $log_title;
	$site_description = subString(strip_tags(str_replace(array("\n","&nbsp;"),"",$log_content)),0,100);
    if (!empty($password)) {
		$postpwd = isset($_POST['logpwd']) ? addslashes(trim ($_POST['logpwd'])) : '';
		$cookiepwd = isset($_COOKIE ['em_logpwd_' . $logid]) ? addslashes(trim($_COOKIE ['em_logpwd_' . $logid])) : '';
		//authPassword ($postpwd, $cookiepwd, $password, $logid);
	}
	// comments
	$commentPage = isset($_GET['comment-page']) ? intval($_GET['comment-page']) : 1;
	$verifyCode = ISLOGIN == false && Option::get('comment_code') == 'y' ? "<img src=\"../include/lib/checkcode.php\" /><br /><input name=\"imgcode\" type=\"text\" />" : '';
	$comments = $Comment_Model->getComments(2, $logid, 'n', $commentPage);
	extract($comments);

	$Log_Model->updateViewCount($logid);
	include View::getView('header');
	include View::getView('single');
	include View::getView('footer');
	View::output();
}
if (ISLOGIN === true && $action == 'write') {
	$logid = isset($_GET['id']) ? intval($_GET['id']) : '';
	$Sort_Model = new Sort_Model();
	$sorts = $Sort_Model->getSorts();
	if ($logid) {
		$Log_Model = new Log_Model();
		$Tag_Model = new Tag_Model();

		$blogData = $Log_Model->getOneLogForAdmin($logid);
		extract($blogData);
		$tags = array();
		foreach ($Tag_Model->getTag($logid) as $val) {
			$tags[] = $val['tagname'];
		}
		$tagStr = implode(',', $tags);
	}else {
		$title = '';
		$sortid = -1;
		$content = '';
		$excerpt = '';
		$tagStr = '';
		$logid = -1;
		$author = UID;
		$date = '';
	}
	include View::getView('header');
	include View::getView('write');
	include View::getView('footer');
	View::output();
}
if (ISLOGIN === true && $action == 'savelog') {
	$Log_Model = new Log_Model();
	$Tag_Model = new Tag_Model();

    LoginAuth::checkToken();

	$title = isset($_POST['title']) ? addslashes(trim($_POST['title'])) : '';
	$sort = isset($_POST['sort']) ? intval($_POST['sort']) : '';
	$content = isset($_POST['content']) ? addslashes(trim($_POST['content'])) : '';
	$excerpt = isset($_POST['excerpt']) ? addslashes(trim($_POST['excerpt'])) : '';
	$tagstring = isset($_POST['tag']) ? addslashes(trim($_POST['tag'])) : '';
	$blogid = isset($_POST['gid']) ? intval(trim($_POST['gid'])) : -1;
	$date = isset($_POST['date']) ? addslashes($_POST['date']) : '';
	$author = isset($_POST['author']) ? intval(trim($_POST['author'])) : UID;
	$postTime = $Log_Model->postDate(Option::get('timezone'), $date);	

	$logData = array(
		'title' => $title,
		'content' => $content,
		'excerpt' => $excerpt,
		'author' => $author,
		'sortid' => $sort,
		'date' => $postTime,
		'allow_remark' => 'y',
		'hide' => 'n',
		'password' => '',
		'checked' => $user_cache[UID]['ischeck'] == 'y' ? 'n' : 'y',
		);

	if ($blogid > 0) {
		$Log_Model->updateLog($logData, $blogid);
		$Tag_Model->updateTag($tagstring, $blogid);
	}else {
		$blogid = $Log_Model->addlog($logData);
		$Tag_Model->addTag($tagstring, $blogid);
	}
	$CACHE->updateCache();
	if ('n' == $logData['checked']) {
		mMsg('文章发布成功，请等待管理员审核', './');
	}
	emDirect("./");
}
// 评论
if ($action == 'addcom') {
	$Comment_Model = new Comment_Model();

	$name = isset($_POST['comname']) ? addslashes(trim($_POST['comname'])) : '';
    $content = isset($_POST['comment']) ? addslashes(trim($_POST['comment'])) : '';
    $mail = isset($_POST['commail']) ? addslashes(trim($_POST['commail'])) : '';
    $url = isset($_POST['comurl']) ? addslashes(trim($_POST['comurl'])) : '';
    $imgcode = isset($_POST['imgcode']) ? strtoupper(trim($_POST['imgcode'])) : '';
    $blogId = isset($_GET['gid']) ? intval($_GET['gid']) : - 1;
    $pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0;

    $targetBlogUrl = './?post=' . $blogId;

    if (ISLOGIN === true) {
		$name = addslashes($user_cache[UID]['name_orig']);
       	$mail = addslashes($user_cache[UID]['mail']);
        $url = addslashes(BLOG_URL);
    }

	if ($url && strncasecmp($url,'http',4)) {
		$url = 'http://'.$url;
	}

    doAction('comment_post');

	if($Comment_Model->isLogCanComment($blogId) === false){
        mMsg('评论失败：该文章已关闭评论', $targetBlogUrl);
    } elseif ($Comment_Model->isCommentExist($blogId, $name, $content) === true){
        mMsg('评论失败：已存在相同内容评论', $targetBlogUrl);
    } elseif ($Comment_Model->isCommentTooFast() === true) {
		mMsg('评论失败：您提交评论的速度太快了，请稍后再发表评论', $targetBlogUrl);
	} elseif (strlen($name) > 20 || strlen($name) == 0){
        mMsg('评论失败：姓名不符合规范', $targetBlogUrl);
    } elseif ($mail != '' && !checkMail($mail)) {
        mMsg('评论失败：邮件地址不符合规范', $targetBlogUrl);
    } elseif (ISLOGIN == false && $Comment_Model->isNameAndMailValid($name, $mail) === false){
        mMsg('评论失败：禁止使用管理员昵称或邮箱评论', $targetBlogUrl);
    } elseif (strlen($content) == '' || strlen($content) > 2000) {
        mMsg('评论失败：内容不符合规范', $targetBlogUrl);
    } elseif (ROLE == ROLE_VISITOR && Option::get('comment_needchinese') == 'y' && !preg_match('/[\x{4e00}-\x{9fa5}]/iu', $content)) {
		mMsg('评论失败：评论内容需包含中文', $targetBlogUrl);
	}elseif (ISLOGIN == false && Option::get('comment_code') == 'y' && session_start() && $imgcode != $_SESSION['code']) {
        mMsg('评论失败：验证码错误', $targetBlogUrl);
    } else {
		$DB = Database::getInstance();
        $ipaddr = getIp();
		$utctimestamp = time();

		if($pid != 0) {
			$comment = $Comment_Model->getOneComment($pid);
			$content = '@' . addslashes($comment['poster']) . '：' . $content;
		}

		$ischkcomment = Option::get('ischkcomment');
		$hide = ROLE == ROLE_VISITOR ? $ischkcomment : 'n';

		$sql = 'INSERT INTO '.DB_PREFIX."comment (date,poster,gid,comment,mail,url,hide,ip,pid)
				VALUES ('$utctimestamp','$name','$blogId','$content','$mail','$url','$hide','$ipaddr','$pid')";
		$ret = $DB->query($sql);
		$cid = $DB->insert_id();
		$CACHE = Cache::getInstance();

		if ($hide == 'n') {
			$DB->query('UPDATE '.DB_PREFIX."blog SET comnum = comnum + 1 WHERE gid='$blogId'");
			$CACHE->updateCache(array('sta', 'comment'));
            doAction('comment_saved', $cid);
            emDirect($targetBlogUrl);
		} else {
		    $CACHE->updateCache('sta');
		    doAction('comment_saved', $cid);
		    mMsg('评论发表成功，请等待管理员审核', $targetBlogUrl);
		}
    }
}
if (ROLE === ROLE_ADMIN && $action == 'delcom') {
    LoginAuth::checkToken();
    $blogId = isset($_GET['gid']) ? intval($_GET['gid']) : - 1;
    $id = isset($_GET['id']) ? intval($_GET['id']) : '';

	$Comment_Model = new Comment_Model();
	$Comment_Model->delComment($id);
	$CACHE->updateCache(array('sta','comment'));
	emDirect('./?post=' . $blogId);
}
if ($action == 'reply') {
	$Comment_Model = new Comment_Model();
	$cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0;
	$commentArray = $Comment_Model->getOneComment($cid);
	if(!$commentArray) {
		mMsg('参数错误', './');
	}
	extract($commentArray);
	$verifyCode = ISLOGIN == false && Option::get('comment_code') == 'y' ? "<img src=\"../include/lib/checkcode.php\" /><br /><input name=\"imgcode\" type=\"text\" />" : '';
	include View::getView('header');
	include View::getView('reply');
	include View::getView('footer');
	View::output();
}
// 微语
if ($action == 'tw' && Option::get('istwitter') == 'y') {
    $Twitter_Model = new Twitter_Model();
    $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $tws = $Twitter_Model->getTwitters($page);
    $twnum = $Twitter_Model->getTwitterNum();
    $pageurl =  pagination($twnum, Option::get('index_twnum'), $page, './?action=tw&page=');
    $site_title = '微语';

	include View::getView('header');
	include View::getView('twitter');
	include View::getView('footer');
	View::output();
}
if (ROLE === ROLE_ADMIN && $action == 't') {
    LoginAuth::checkToken();
    $Twitter_Model = new Twitter_Model();

    $t = isset($_POST['t']) ? addslashes(trim($_POST['t'])) : '';
    $attach = isset($_FILES['img']) ? $_FILES['img'] : '';

    if ($attach['tmp_name'] && !$t) {
    	$t = '分享图片';
    }

    if (!$t){
        emDirect("./?action=tw");
    }
    $tdata = array('content' => $Twitter_Model->formatTwitter($t),
            'author' => UID,
            'date' => time(),
    );

	if ($attach['tmp_name']) {
		$fileinfo = uploadFile($attach['name'], $attach['error'], $attach['tmp_name'], $attach['size'], array('jpg', 'jpeg','png'), false, false);
		$upfname = $fileinfo['file_path'];
        $size = @getimagesize($upfname);
		$w = $size[0];
		$h = $size[1];
		if ($w>150 || $h>120) {
			$uppath = Option::UPLOADFILE_PATH . gmdate('Ym') . '/';
			$thum = str_replace($uppath,$uppath.'thum-',$upfname);
			resizeImage($upfname, $thum, 120, 150);
			$upfname = $thum;
		}

		$tdata['img'] = str_replace('../', '', $upfname);
	}

    $Twitter_Model->addTwitter($tdata);
    $CACHE->updateCache(array('sta','newtw'));
    doAction('post_twitter', $t);
    emDirect("./?action=tw");
}
if (ROLE === ROLE_ADMIN && $action == 'delt') {
    LoginAuth::checkToken();
    $Twitter_Model = new Twitter_Model();
    $id = isset($_GET['id']) ? intval($_GET['id']) : '';
	$Twitter_Model->delTwitter($id);
	$CACHE->updateCache(array('sta','newtw'));
	emDirect("./?action=tw");
}
if ($action == 'login') {
	Option::get('login_code') == 'y' ? $ckcode = "<span>验证码</span>
    <div class=\"val\"><img src=\"../include/lib/checkcode.php\" /><br />
	<input name=\"imgcode\" id=\"imgcode\" type=\"text\" />
    </div>" : $ckcode = '';
	include View::getView('header');
	include View::getView('login');
	include View::getView('footer');
	View::output();
}
if ($action == 'auth') {
	session_start();
	$username = addslashes(trim($_POST['user']));
	$password = addslashes(trim($_POST['pw']));
	$img_code = (Option::get('login_code') == 'y' && isset ($_POST['imgcode'])) ? addslashes (trim (strtoupper ($_POST['imgcode']))) : '';
	$ispersis = true;
	if (LoginAuth::checkUser($username, $password, $img_code) === true) {
		loginAuth::setAuthCookie($username, $ispersis);
		emDirect('?tem=' . time());
	}else {
		emDirect("?action=login");
	}
}
if ($action == 'logout') {
	setcookie(AUTH_COOKIE_NAME, ' ', time () - 31536000, '/');
	emDirect('?tem=' . time());
}
function mMsg($mbt,$msg, $url){
	//include View::getView('header');
	include View::getView('msg');
	//include View::getView('footer');
	View::output();
}
function authPassword($postPwd, $cookiePwd, $logPwd, $logid) {
	$pwd = $cookiePwd ? $cookiePwd : $postPwd;
	if ($pwd !== addslashes($logPwd)) {
		include View::getView('header');
		include View::getView('logauth');
		include View::getView('footer');
		if ($cookiePwd) {
			setcookie('em_logpwd_' . $logid, ' ', time() - 31536000);
		}
		View::output();
	}else {
		setcookie('em_logpwd_' . $logid, $logPwd);
	}
}

//获取文章对应的分类
function sysort($blogid){global $CACHE;$log_cache_sort = $CACHE->readCache('logsort');if(!empty($log_cache_sort[$blogid])){
$sysort = "<a href=\"./?sort=".$log_cache_sort[$blogid]['id']."\">".$log_cache_sort[$blogid]['name']."</a>";
}else{$sysort = "暂未分类";}echo $sysort;}

function jmbtag($blogid){
$Tag_Model = new Tag_Model();
$tag = $Tag_Model->getTag($blogid);
echo '<li>供应商：';
foreach($tag as $v){
echo '<a href ="./?tag='.$v['tagname'].'">'.$v['tagname'].'</a> ';
}
echo '</li>';}
?>

<?php
function kl(){?>
<div class="submit">
<div style="padding-top:10px;clear:both;overflow:hidden;"> 
<form action="" method="post">
<input type="password" name="pwd" placeholder="输入口令查看最低批发价"  />
<button type="submit" />查看</button>
</form>
</div>
</div>
<?php }?>

<?php function nav_sort(){
global $CACHE;
$sort_cache = $CACHE->readCache('sort');?>
 <li><a href="./" title="网站首页">网站首页</a></li>
<?php foreach($sort_cache as $value){?>
<?php if(in_array($value['sid'],_g('dhflid'))){?>
<li><a href="./?sort=<?php echo $value['sid'];?>#jmb" title="<?php echo $value['sortname'];?>"><?php echo $value['sortname'];?></a></li>
<?php }}}?>

<?php
function tags(){
global $CACHE;
$tag_cache = $CACHE->readCache('tags');
$Tag_Model = new Tag_Model();
$tags = $Tag_Model->getTag();
?>
 <li><a href="./" title="网站首页">网站首页</a></li>
<?php 
foreach($tags as $value){if(!in_array($value['tagname'],_g('xstags'))){
$sltag =  isset ($_GET['tag']) ? addslashes ($_GET['tag']) : '';
$current_tab = $sltag == $value['tid'] ? ' class="common"' : '';
?>
 <li<?php echo $current_tab;?>><a href="./?tag=<?php echo $value['tagname'];?>#jmb" title="<?php echo $value['tagname'];?>"><?php echo $value['tagname'];?></a></li>
<?php }}}?>

<?php
function ss(){?>
<form action="./" method="get" enctype="multipart/form-data" onSubmit="return slkeyword();">
<input name="keyword" placeholder="输入货号或者产品名称" />
<button type="submit"/>搜索</button>
</form>
<?php }?>

<?php //判断手机参数
function sywap(){ 
$user_agent = $_SERVER['HTTP_USER_AGENT']; 
$mobile_agents = array("240x320","acer","acoon","acs-","abacho","ahong","airness","alcatel","amoi","android","anywhereyougo.com","applewebkit/525","applewebkit/532","asus","audio", "au-mic","avantogo","becker","benq","bilbo","bird","blackberry","blazer","bleu","cdm-","compal","coolpad","danger","dbtel","dopod","elaine","eric","etouch","fly ","fly_","fly-","go.web","goodaccess","gradiente","grundig","haier","hedy","hitachi","htc","huawei","hutchison","inno","ipad","ipaq","iphone","ipod","jbrowser","kddi","kgt","kwc","lenovo","lg ","lg2","lg3","lg4","lg5","lg7","lg8","lg9","lg-","lge-","lge9","longcos","maemo","mercator","meridian","micromax","midp","mini","mitsu","mmm","mmp","mobi","mot-","moto","nec-","netfront","newgen","nexian","nf-browser","nintendo","nitro","nokia","nook","novarra","obigo","palm","panasonic","pantech","philips","phone","pg-","playstation","pocket","pt-","qc-","qtek","rover","sagem","sama","samu","sanyo","samsung","sch-","scooter","sec-","sendo","sgh-","sharp","siemens","sie-","softbank","sony","spice","sprint","spv","symbian","tablet","talkabout","tcl-","teleca","telit","tianyu","tim-","toshiba","tsm","up.browser","utec","utstar","verykool","virgin","vk-","voda","voxtel","vx","wap","wellco","wig browser","wii","windows ce","wireless","xda","xde","zte"); 
$sywap = false;foreach($mobile_agents as $device){if(stristr($user_agent, $device)) {$sywap = true;break;}}return $sywap;}?>

<?php
//全局匹配正文中的图片并存入imgsrc中
function img_zw($content){preg_match_all("|<img[^>]+src=\"([^>\"]+)\"?[^>]*>|is", $content, $img);$imgsrc = !empty($img[1]) ? $img[1][0] : '';if($imgsrc):return $imgsrc;endif;}
//Custom: 获取附件第一张图片
function img_fj($logid){$db = MySql::getInstance();$sql = "SELECT * FROM ".DB_PREFIX."attachment WHERE blogid=".$logid." AND (`filepath` LIKE '%jpg' OR `filepath` LIKE '%gif' OR `filepath` LIKE '%png') ORDER BY `aid` ASC LIMIT 0,1";$imgs = $db->query($sql);$img_path = "";while($row = $db->fetch_array($imgs)){$img_path .= BLOG_URL.substr($row['filepath'],3,strlen($row['filepath']));}
return $img_path;}?>

<?php //shuyong.net：同分类相邻文章
function nextLog($logid,$sortid,$flag,$pattern=0){
$Log_Model = new Log_Model();if($flag == 'prev'){$sql = " AND gid < $logid ORDER BY gid DESC";$word = '下一个';$sx='next';}
else{$sql = " AND gid > $logid ORDER BY gid ASC";$word = '上一个';$sx='pre';}
$log = $Log_Model -> getLogsForHome(" AND sortid = $sortid "."$sql", 1, 1);
if($log){foreach($log as $value){?>
<?php echo $word;?>：<a id="<?php echo $sx;?>" href="?post=<?php echo $value['logid'];?>" title="<?php echo $value['log_title'];?>"><?php echo $value['log_title'];?></a><?php }?>
<?php }else{echo $word.'：没有了';	}
}?>