(.*?)<\/span>\s+<\/a>`', $lunbo, $arr);
$title = $arr[1];
if (!empty($title)) {
$lb = null;
$d = 0;
foreach ($title as $key => $val) {
$lb[] = array("uri" => $val . "-" . $arr[2][$key], "img" => $arr[3][$key], "title" => $arr[4][$key]);
$d++;
}
$rtn = array_merge(array("RetRecords" => $d), array("title" => $lb)); //图片
} else {
$rtn["RetRecords"] = 0;
}
} else {
$rtn["RetRecords"] = 0;
}
return $rtn;
}
}
function tupianlist($y=2) {
if (ISCACHE) {
$ckey = "tupianlist_usermodel";
$rs = $this->cache->get($ckey);
if (!$rs) {
$sql = "select title from hwitem where bid=321"; //头条
$this->constr();
$titlebk = $this->con->fetch_all($sql);
$this->con->close();
if (empty($titlebk)) {
$taglist = array("RetRecords" => 0);
} else {
foreach ($titlebk as $key => $val) {
$str .=$val["title"];
}
preg_match_all("/(.*?)<\/p>/", $str, $artUseList);
$artUseList = implode(" ", $artUseList[1]);
$pattern = '/(.+?)<\/a.*?>/sim';
preg_match_all($pattern, $artUseList, $matResult);
if (!empty($matResult)) {
$i = 0;
$recomList = array();
foreach ($matResult[1] as $k => $v) {
if ($i < 3) {
preg_match("/http:\/\/.*blog\.cnfol\.com\/(.*)\.html/", $v, $val);
if (!empty($val)) {
$item = explode('/', $val[1]);
if ($item[2] && strstr($item[2], '-')) {
$itemTap = explode('-', $item[2]);
$recInfo['time'] = $itemTap[0];
$recInfo['title'] = $matResult[2][$k];
$recInfo['artUrl'] = $item[0] . "-" . $item[2];
//if($y==1){
//echo $item[0];
//$recInfo['userID']=getUserID($item[0]);
//}
$i++;
}
if ($recInfo) {
$recomList[] = $recInfo;
}
unset($recInfo);
}
}
}
$taglist = array("RetRecords" => $i, "title" => $recomList);
$this->cache->set($ckey, $taglist);
} else {
$taglist = array("RetRecords" => 0);
}
}
} else {
$taglist = $rs;
}
return $taglist;
}
}
function selfamouslist($classid, $num) {
$ckey = _FUNCTION_ . $classid . $num . "selfamouslist";
$rtn = $this->cache->get($ckey);
if (!$rtn) {
$sql = "select title from cnfol_hwitem where bid=$classid limit $num";
$this->convideo();
$data = $this->strcon->fetch_all($sql);
$this->strcon->close();
$i = 0;
$regnt = '/^
<\/a><\/div\>\s?(.*?)<\/strong><\/a>
(.*?)<\/div>$/';
if (!empty($data)) {
foreach ($data as $key => $val) {
$val = str_replace("\n", "", $val["title"]);
$val = str_replace("\r", "", $val);
preg_match_all($regnt, $val, $matches);
$attr = explode("/", $matches[1][0]);
if (!empty($attr[1])) {
$ar = explode(".", $attr[2]);
$rtn[$i]["Id"] = $ar[0];
$rtn[$i]["year"] = substr($attr[1], 0, 4);
$rtn[$i]["src"] = $matches[2][0];
$rtn[$i]["name"] = $matches[5][0];
$rtn[$i]["title"] = $matches[6][0];
$rtn[$i]["alt"] = $matches[4][0];
$i++;
} else {
//$rtn[$key]["id"] = rtrim($matches[1][0], "/");
}
}
$this->cache->set($ckey, $rtn);
}
}
return $rtn;
}
function selpicturelist($id, $start, $end) {
$ckey = _FUNCTION_ . $id . $start . $end . "selpicturelist";
$rtn = $this->cache->get($ckey);
if (!$rtn) {
$this->conpic();
$sqlContent = "select count(*) from cnfol_content where partId in (" . $id . ")";
$sql = "select `articleId`,`title`,`show`,`partId` from cnfol_content where partId in (" . $id . ") order by updatetime DESC limit $start,$end";
$count = $this->piccon->fetch_all($sqlContent);
$rtns = $this->piccon->fetch_all($sql);
if (!empty($rtns) && $rtns) {
$rtn['data'] = $rtns;
$rtn['rcdcount'] = $count[0] ["count(*)"];
$this->cache->set($ckey, $rtn);
}
}
return $rtn;
}
function selpictureid($id) {
$ckey = _FUNCTION_ . "selpictureid" . $id;
$rtn = $this->cache->get($ckey);
if (!$rtn) {
$this->conpic();
$sql = "select a.`articleId`,a.`src`,a.`memo`,b.`title` from cnfol_pic a left join cnfol_content b on a.articleId=b.articleId where a.articleId=" . $id;
$rtns = $this->piccon->fetch_all($sql);
if (!empty($rtns) && $rtns) {
$rtn["error"] = 10000;
$rtn["data"] = $rtns;
foreach ($rtns as $key => $val) {
$rtn["allsrc"][$key] = $val["src"];
}
$this->cache->set($ckey, $rtn);
} else {
$rtn["error"] = 10010;
}
}
return $rtn;
}
}