<?php
if (!defined('R_P')) exit("access Die");
@set_time_limit(180);
@ignore_user_abort();
class cron_collect_cron{
	function cron_collect_cron(){
	
	}
	
	function run(){
		global $_SET;
		$data = $this->get_collect();
		foreach($data as $val){
			$url = W_P . $_SET['admin_path'] . "/system.php?sys=collect&work=link_work&channelid={$val['channelid']}&rules={$val['id']}&fetch_type=1&pageno=1&threadGet=1&ajax=1";
			qbase::load($url, 0, '', "adminSession=" . urlencode($_COOKIE['admin_auth']), false, '', 15, true, true);
		}
	}

	function get_collect(){
		$temp = qdb::fetchAll("select id, channelid, auto_update from ".TABLEPRE."collect_rule ");
		$data = array();
		$c = 0;
		foreach($temp as $val){
			eval("\$c=" . str_replace("@", qbase::formatTime('h', time()), $val) .";");
			if($c == 0) $data[] = $val;
		}
		return $data;
	}
}
?>