<?php
// +----------------------------------------------------------------------
// | 云业内容管理系统 (云业CMS或yunyecms)
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2030 http://www.yunyecms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 云业科技 <kefu@yunyecms.com>
// +----------------------------------------------------------------------
//YmM0OWM5ZWY1ODk5ZGRkNzM0NUxxUjVMaWE1WWFGNWE2NTU2Nmg1NUNHNTdPNzU3dWZJQ2prdXBIa3VKcERUVlBtaUpaNWRXNTVaV050Y3lrc1EyOXdlWEpwWjJoMElDaGpLU0F5TURFMkxUSXdNekFnYUhSMGNEb3ZMM2QzZHk1NWRXNTVaV050Y3k1amIyMGdRV3hzSUhKcFoyaDBjeUJ5WlhObGNuWmxaQzRnUVhWMGFHOXlPaURsaUpqbW1aUHBvNTRnUERFMU1EQXpNakU1UUhGeExtTnZiVDQ9OGQ3ZTc5OTU5YjQ0MmEyNWQxNGVlMzg2ZmQyODM2OTkzNGE
//MD5:c610bc3d074f2ea0c833d32de3bfa0c3
// +----------------------------------------------------------------------
defined('IN_YUNYECMS') or exit('No permission.');
core::load_class('base',false);
core::load_fun('content');
core::load_fun('tree');
class index extends base {
    public $curmodel;
	function __construct() {
	   parent::__construct();
	 }
	 //首页
	 public function get_content_hits(){
		global $lang,$cfg;
		$jsoutstr='';  
		$infoid=$_GET['id'];
		$catid=$_GET['catid'];
		if(empty($infoid)||!is_numeric($infoid)){
			$jsoutstr='document.write(0);';
			exit($jsoutstr);
		}
	    if(empty($catid)||!is_numeric($catid)){
			$jsoutstr='document.write(0);';
			exit($jsoutstr);
		}
		 
	    $modelid=getmodelid($catid);
	      if($modelid){
		   $curmodel=getmodel($modelid);
		   if(!$curmodel){ 
		    $jsoutstr='document.write(0);';
			exit($jsoutstr);
		   }
			$tablename="m_".$curmodel['tablename'];
			$content=$this->db->find("select hits from `#yunyecms_{$tablename}` where `id`= {$infoid}");		 
		    }
			if(URL_MODEL==5){
					$this->db->query("update  `#yunyecms_{$tablename}` set hits=hits+1  where id={$infoid}");
			} 
			if($content){
				$jsoutstr='document.write('.$content['hits'].')';
				exit($jsoutstr) ;
			}else {
				exit(0); 
			}
	  }
	
	  public function get_token(){
		$_SESSION["token"]=make_rand_letternum(21);
		$token=$_SESSION["token"];
		$jsoutstr="document.write(\"<input type='hidden' name='token' id='token' value='{$token}'>\");";
		exit($jsoutstr);  
	  }
	
	
	  public function get_member_token(){
		 if($this->member){
			$token=ugetcookie("loginrnd");
			$jsoutstr="document.write(\"<input type='hidden' name='token' id='token' value='{$token}'>\");";
		    exit($jsoutstr); 
		 }else{
			  exit(''); 
		  }
	  }	


	
}

?>