⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apicontroller.php

📁 a short sketch about linux syntex lines.
💻 PHP
字号:
<?php
/*秀影数据调用API文件*/
class ApiController extends Easy_Controller_Action {
	public function Init(){
		
	}
	public function keywordAction(){
		header('Content-type: application/x-javascript');
		$limit = (int)$this->_Request->getParam('rows') ? (int)$this->_Request->getParam('rows') : 10 ; //定义显示搜索最高的6个关键词
		$keyword = new KeywordModel();
		//$where = 'click>99';
		foreach($keyword->getAll($where, $limit) as $row){
			echo 'document.write(\'&nbsp;<a href="'.INSTALLDIR.'?mod=content&action=search&type=title&keyword='.urlencode($row['keyword']).'">'.urldecode($row['keyword']).'</a>&nbsp;\');';
		}
		exit();
	}
	/*热门影片*/
	public function hotsAction(){
		$movie = new MovieModel();
	}
	/*影片XML数据调用*/
	public function getMovieXmlAction(){
		//header('Content-type: text/html;charset=gb2312');
		$where = array();
		if ($this->_Request->getParam('keyword')){
			$where['keyword'] = urldecode($this->_Request->getParam('keyword'));
		}
		if ($this->_Request->getParam('type')){
			$where['type'] = urldecode(trim($this->_Request->getParam('type')));
		}
		if ($this->_Request->getParam('trim')){
			$where['title'] = urldecode(trim($this->_Request->getParam('title')));
		}
		if ($this->_Request->getParam('trim')){
			$where['actor'] = urldecode(trim($this->_Request->getParam('actor')));
		}
		if ($this->_Request->getParam('trim')){
			$where['area'] = urldecode(trim($this->_Request->getParam('area')));
		}
		if ($this->_Request->getParam('trim')){
			$where['director'] = urldecode(trim($this->_Request->getParam('director')));
		}
		if ($this->_Request->getParam('category')){
			$where['category'] = urldecode(trim($this->_Request->getParam('category')));
		}
		if ($this->_Request->getParam('movid')){
			$where['movid'] = urldecode(trim($this->_Request->getParam('movid')));
		}
		$where['checkbox'] = 1;

		$Movie = new MovieModel();
		$Result = $Movie->search($where);
		$data = array();
		$data['total'] = $Movie->total;
		foreach ($Result as $row){
			$row['category'] = $Movie->formatCategory($row['category']);
			$data[] = $row;
		}
		unset($Result);
		//header('Content-type: application/xml');
		/*$content = '<?xml version="1.0" encoding="utf-8"?>';
		$content.= '<vodcms>';
		foreach ($Result as $value){
			$content.= '<movie>';
			foreach ($value as $key=>$val){
				$content.="<$key><![CDATA[$val]]></$key>\n";
			}
			$content.= '</movie>';
		}
		$content.= '</vodcms>';
		$content = iconv('GBK', 'UTF-8//IGNORE', $content);
		//unset($Result);*/
		exit(serialize($data));
	}
	/*根据影片ID回去影片路径XML*/
	public function getUrlXmlAction(){
		$urlid = (int)$this->_Request->getParam('urlid');
		$movid = (int)$this->_Request->getParam('movid');
		$Movie = new MovieModel();
		foreach($Movie->getUrl($movid) as $row){
			$data['utl'] = $row['url'];
			$data['title'] = $row['title'];
			$array[] = $data;
		}
		if (function_exists('json_encode')){
			exit(json_encode($array));
		}else{
			exit(_('您的系统不支持json_encode扩展,无法使用自动连播功能!'));
		}
	}
	/*
	负责总秀影官方站点获取数据
	*/
	public function getfromvodcmsAction(){
		header('Content-type: text/html;charset=utf-8');
		$sAddress = 'http://www.vodcms.cn/index.php/api/search/type/title/keyword/'.urlencode(urldecode($this->_Request->getParam('title')));
		echo file_get_contents($sAddress);
		exit;
	}
	/*
	影片自动入库功能
	*/
	public function searchAction(){
		header('Content-type: text/html;charset=utf-8');
		$where = array();
		if ($this->_Request->getParam('keyword')){
			$where['keyword'] = urldecode($this->_Request->getParam('keyword'));
		}
		if ($this->_Request->getParam('type')){
			$where['type'] = urldecode(trim($this->_Request->getParam('type')));
		}
		if ($this->_Request->getParam('trim')){
			$where['title'] = urldecode(trim($this->_Request->getParam('title')));
		}
		if ($this->_Request->getParam('trim')){
			$where['actor'] = urldecode(trim($this->_Request->getParam('actor')));
		}
		if ($this->_Request->getParam('trim')){
			$where['area'] = urldecode(trim($this->_Request->getParam('area')));
		}
		if ($this->_Request->getParam('trim')){
			$where['director'] = urldecode(trim($this->_Request->getParam('director')));
		}
		if ($this->_Request->getParam('category')){
			$where['category'] = urldecode(trim($this->_Request->getParam('category')));
		}
		if ($this->_Request->getParam('movid')){
			$where['movid'] = urldecode(trim($this->_Request->getParam('movid')));
		}
		$where['checkbox'] = 1;
		$Movie = new MovieModel();
		$result = $Movie->search($where);
		$array = array();
		foreach ($result as $row){
			$row['title'] = iconv('GBK', 'UTF-8', $row['title']);
			$row['actor'] = iconv('GBK', 'UTF-8', $row['actor']);
			$row['area'] = iconv('GBK', 'UTF-8', $row['area']);
			$row['director'] = iconv('GBK', 'UTF-8', $row['director']);
			$row['content'] = iconv('GBK', 'UTF-8', htmlspecialchars_decode($row['content']));
			if ( !stristr( $row['pic'], 'http://')){
				$row['pic'] = 'http://'.$_SERVER['HTTP_HOST'].'/'.iconv('GBK', 'UTF-8', $row['pic']);
			}else{
				$row['pic'] = iconv('GBK', 'UTF-8', $row['pic']);
			}
			$array[] = $row;
			unset($row);
		}
		//print_r($array);
		//exit;
		exit(json_encode($array));
	}
	/*公告调用接口*/
	public function noteAction() {
		header('Content-type: application/x-javascript');
		$note = new AfficheModel();
		$type = $this->_Request->getParam('type');
		$notedata = '';
		switch($type){
			case 1:
				$notedata = '<marquee direction="up" height="130" scrollamount="1" scrolldelay="100" onMouseOver="this.scrollDelay=500" onMouseOut="this.scrollDelay=1" width="200">';
				foreach($note->getAll() as $row){
					$notedata.= $row['content']. '<br />';
				}
				$notedata.='</marquee>';
			break;
			default:
				$notedata = '<table width="98%" border="0" cellpadding="2" cellspacing="2">';
				foreach($note->getAll() as $row){
					$notedata.= '<tr><td>·<a href="javascript:vote(\''.INSTALLDIR.'\', '.$row['id'].')" class="note">'.truncate($row['title'],10, '...').'</a></td><td>'.date('m/d', $row['addtime']).'</td></tr>';
				}
				$notedata.= '</table>';
			break;
		}
		echo 'document.write(\''.addslashes($notedata).'\');';;
		exit();
	}
}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -