phpcms v9未审核推荐信息出现在推荐列表中【BUG修复】

修改文件:phpcms/modules/content/class/content_tag.class.php

调整过的方法:

php 复制代码
public function __construct() {
		$this->db = pc_base::load_model('content_model');
		$this->position = pc_base::load_model('position_model');
		$this->position_data = pc_base::load_model('position_data_model');
	}


/**
	 * 推荐位
	 * WY EDIT AT 2024-01-09 已修复未审核信息出现在推荐列表中的问题
	 * @param $data
	 */
	public function position($data) {
		$sql = '';
		$array = array();
		$posid = intval($data['posid']);
$position = $this->position->get_one(array('posid'=>$posid));
$this->db->set_model($position['modelid']);
$this->tablename = $this->db->table_name;
$result = $this->db->select("status=99 AND posids=1", '*', '', '', '');
foreach ($result as $r) {
	$ids_array[] = $r['id'];
}
$ids = implode(',', $ids_array);
if($ids) {
	$sql = "id IN ($ids) AND ";
} else {
	$sql = '1<>1 AND';
}
		$order = $data['order'];
		$thumb = (empty($data['thumb']) || intval($data['thumb']) == 0) ? 0 : 1;
		$siteid = $GLOBALS['siteid'] ? intval($GLOBALS['siteid']) : 1;
		$catid = (empty($data['catid']) || $data['catid'] == 0) ? '' : intval($data['catid']);
		if($catid) {
			$siteids = getcache('category_content','commons');
			if(!$siteids[$catid]) return false;
			$siteid = $siteids[$catid];
			$this->category = getcache('category_content_'.$siteid,'commons');
		}
		if($catid && $this->category[$catid]['child']) {
			$catids_str = $this->category[$catid]['arrchildid'];
			$pos = strpos($catids_str,',')+1;
			$catids_str = substr($catids_str, $pos);
			$sql .= "`catid` IN ($catids_str) AND ";
		}  elseif($catid && !$this->category[$catid]['child']) {
			$sql .= "`catid` = '$catid' AND ";
		}
		if($thumb) $sql .= "`thumb` = '1' AND ";
		if(isset($data['where'])) $sql .= $data['where'].' AND ';
		if(isset($data['expiration']) && $data['expiration']==1) $sql .= '(`expiration` >= \''.SYS_TIME.'\' OR `expiration` = \'0\' ) AND ';
		$sql .= "`posid` = '$posid' AND `siteid` = '".$siteid."'";
		$pos_arr = $this->position_data->select($sql, '*', $data['limit'],$order);
		if(!empty($pos_arr)) {
			foreach ($pos_arr as $info) {
				$key = $info['catid'].'-'.$info['id'];
				$array[$key] = string2array($info['data']);
				$array[$key]['url'] = go($info['catid'],$info['id']);
				$array[$key]['id'] = $info['id'];
				$array[$key]['catid'] = $info['catid'];
				$array[$key]['listorder'] = $info['listorder'];
			}
		}
		return $array;
	}
相关推荐
Smile灬凉城6663 小时前
robots协议
安全·php·robots
数据小爬虫@4 小时前
如何利用PHP爬虫获取速卖通(AliExpress)商品评论
开发语言·爬虫·php
fendouweiqian5 小时前
查看php已安装扩展命令
php
柒烨带你飞6 小时前
路由器的原理
网络·智能路由器·php
vvw&8 小时前
如何在 Ubuntu 22.04 上安装和使用 Composer
linux·运维·服务器·前端·ubuntu·php·composer
hking1119 小时前
upload-labs关卡记录5
web安全·php
2401_8576176211 小时前
“无缝购物体验”:跨平台网上购物商城的设计与实现
java·开发语言·前端·安全·架构·php
2401_8574396911 小时前
智慧社区电商系统:提升用户体验的界面设计
前端·javascript·php·ux
我是高手高手高高手11 小时前
ThinkPHP8多应用配置及不同域名访问不同应用的配置
linux·服务器·前端·php
m0_7482398314 小时前
前端bug调试
前端·bug