| Server IP : 103.48.194.25 / Your IP : 216.73.217.98 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/zomuaban.com/public_html/site/controllers/frontend/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Rss extends MY_Controller {
public function __construct() {
parent::__construct();
header('Content-Type: text/xml;charset=utf-8');
}
# RSS mặc định, chưa biết là cái gì
public function index() {
}
# Tạo RSS cho fb
# Lấy 10 tin mới nhất trong mỗi danh mục random
public function social($cateId='', $limit=10){
$rss = array();
# get in random category
if(empty($cateId)){
$cate = main_cate();
$cate = $cate[rand(1, 16)];
}else {
$cate = get_cate_by_cid($cateId);
}
$this->db->select('*');
$this->db->where('userId >', 0);
$this->db->where('cateId', $cate->cid);
$this->db->where('active', 1);
$this->db->where('createTime <=', now());
$this->db->order_by('id','desc');
$this->db->limit($limit);
$q = $this->db->get(tableConf('item'));
foreach($q->result() as $row) {
$row = full_item_prop($row);
#$row->title = preg_replace('/&(?!#?[a-z0-9]+;)/', '&', $row->title);
#$row->title = vn_clear_string($row->title);
if(!empty($row->thumb))array_push($rss,$row);
}
#if (count($rss) == 0) return $this->social($cateId,$limit);
$this->load->view('sitemap/rss', array('list'=>$rss));
}
}