📄 makemodel.php
字号:
<?php
/*
秀影视频点播系统HTML页面生成模型
website:http://www.vodcms.com/
QQ:24498936
MSN:jdzcn_net@hotmail.com
Version:6
*/
class MakeModel {
private $db;
public $view;
public function __construct(){
$this->db = $GLOBALS['DB'];
$this->config = $GLOBALS['config'];
}
/*
生成站点首页文件
@param $filename string 生成文件的存放位置
@return bool
*/
public function makeIndex( $filename = null ){
$this->view->location = _('站点首页');
$content = $this->view->render($this->view->skin.'/index');
$IO = new Easy_Filesystem();
$IO->wFile(ROOT.'index.htm', $content);
unset($content);
$this->view->setViewRoot($this->path);
}
/*
@param int 分类的编号
return string
*/
public function makeCategory($categoryid, $page=1){
$page = $page ? $page : 1;
$this->view->classid = (int)$categoryid;
$_GET['id'] = (int)$categoryid;
$_GET['page'] = $page;
$cate = new CategoryModel();
$row = $cate->getRow('id='.(int)$categoryid); //获取分类的信息
$current = ''; //当前位置
$this->view->parentid = array_shift(explode(',', $row['lable']));
if ($row['nodes'] > 0){
$this->view->mainid = $row['id'];
}else{
$this->view->mainid = $this->view->parentid;
}
foreach($cate->getLocation($categoryid) as $rs){
$current .= $current ? ' » <a href="'.clink($rs['id']).'">'.$rs['category'].'</a>' : '<a href="'.clink($rs['id']).'">'.$rs['category'].'</a>';
}
$sub = $cate->getRow( array('id' => $this->view->mainid)); //获取下级分类数据
$this->view->nodes = $sub['nodes']; //判断是否有子类
$_GET['page'] = (int)$page;
$this->view->location = $current; //兼容历史位置
$this->view->current = $current; //当前位置
$this->view->class = $row['category']; ///设分类名到模板中兼容旧版
$this->view->category = $row['category'];
$this->view->config['title'] = '《'.$row['category'].'》列表第'.$page.'页,'.$this->view->config['title'];
$this->view->orderbypublish = $this->config['basedir'].'index.php?mod=category&id='.$categoryid.'&orderby=publish';
$this->view->orderbyclick = $this->config['basedir'].'index.php?mod=category&id='.$categoryid.'&orderby=click';
$this->view->orderbynew = $this->config['basedir'].'index.php?mod=category&id='.$categoryid.'&orderby=modifytime';
$this->view->orderbyadd = $this->config['basedir'].'index.php?mod=category&id='.$categoryid.'&orderby=addtime';
$usersettpl = $row['list_tpl'];
unset($current, $row);
$tplfile = ROOT.'templates/'.$this->view->skin.'/'.$usersettpl.'.tpl.php';
if ( $usersettpl && file_exists($tplfile)) { //用户设置的分类模板存在
$contents = $this->view->render($this->view->skin.'/'.$usersettpl);
}else{
$contents = $this->view->render($this->view->skin.'/list');
}
return $contents;
}
/*
生成影片详细内容页面
@param int $movid 影片的编号
return string;
*/
public function makeMovie($movid){
$cate = new CategoryModel();
$this->view->setViewRoot('templates');
$this->view->movie = $this->view->Template->getMovieInfo( $movid );
if ($this->view->movie ['lookgroup'] == $this->config['vip']){
$isvip = true;
if ($this->_Request->getCookie('usergroup') != $this->config['vip']){
$this->_Request->redirect('/');
}
}else{
$isvip = false;
}
$this->view->classid = (int)$this->view->movie['category'];
$row = $cate->getRow('id='.$this->view->classid); //获取分类的信息
foreach($cate->getLocation((int)$this->view->classid) as $rs){
$uri.= $uri ? ' > <a href="'.clink($rs['id']).'">'.$rs['category'].'</a>' : '<a href="'.clink($rs['id']).'">'.$rs['category'].'</a>';
}
$this->view->config['title'] = '《'.$this->view->movie['title'].'》点播,下载,'.$this->view->config['title'];
$this->view->location = $uri;unset($uri, $rs);
$this->view->current = $this->view->location;
$usersettpl = $row['movie_tpl'];
$tplfile = ROOT.'templates/'.$this->view->skin.'/'.$usersettpl.'.tpl.php';
if ( $usersettpl && file_exists($tplfile)) { //用户设置的分类模板存在
$contents = $this->view->render($this->view->skin.'/'.$usersettpl);
}else{
$contents = $this->view->render($this->view->skin.'/display');
}
return $contents;
}
/*生成静态点播地址列表*/
public function makePlayUrl($movid, $num=0){
$info = '';
$this->view->num = $num ? $num : 7; //显示每多少列就换行
$info = $this->view->Template->getMovieInfo($movid);
if ($info['lookgroup'] == $this->config['vip']){
$isvip = true;
if ($this->_Request->getCookie('usergroup') != $this->config['vip']){
exit('您没有访问这个秘密通道影片的权限!');
}
}else{
$isvip = false;
}
$this->view->showurl = $this->view->Template->getUrls($movid); //获取影片所有地址
$player = new PlayerModel();
$info['player'] = str_replace(',', "','", $info['player']);
$this->view->movieplayer = $player->getAll("tag in ('".$info['player']."')");
$server = new ServerModel();
$sid = array_map('intval', explode(',', $info['sid'])); //将服务器ID全部数字格式化
$this->view->moviename = $info['title'];
$this->view->movieserver = $server->getList("locked=0 AND sid in (".implode(',', $sid).")");
$this->view->sid = intval($this->_Request->getParam('sid'));
return $this->view->render('public/frameurl');
}
}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -