HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/bb.cwoyt.com/Application/Admin/Controller/VideoController.class.php
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 赛脑 <2233759493@qq.com> <http://www.sn.com>
// +----------------------------------------------------------------------

namespace Admin\Controller;
use User\Api\UserApi as UserApi;
use COM\Page;
/**
 * 产品控制器
 * @author 赛脑 <2233759493@qq.com>
 */
class VideoController extends AdminController {


	public $infoadmin = array();

	public function __construct(){
		parent::__construct();  
		
		$perid = M('member')->where('uid = '.UID)->getField('perid');
		
		$infoadmin = M('permissions')->where('perid = '.$perid)->field('product')->find();
		
		if($infoadmin['product']){
			$infoadmin['system'] = explode(',',$infoadmin['product']);
		}
		
		if(!$infoadmin['product']){
			$this->error('参数错误!');
		}
		$this->infoadmin = $infoadmin;
		$nav_type = 'product';
		$nav_type_li = 'video';
		$this->assign('nav_type', $nav_type);
		$this->assign('nav_type_li', $nav_type_li);
		
	}

    /**
     * 产品列表
     * @author 赛脑 <2233759493@qq.com>
     */
    public function index(){
		
		
		$count = M('video')->count();
		$page = new Page($count,100);
		$list = M('video')->limit($page->firstRow.','.$page->listRows)->select();
		
		$pages = $page->show();
		
        $this->assign('count', $count);
		$this->assign('_list', $list);
		$this->assign('_page', $pages);
		$this->meta_title = '视频管理';
		$this->display();
    }
	
	public function lists(){
		
		$list = M('video')->select();
		
		$this->assign('_list', $list);
		$this->display();
	}
	
	public function add(){
		
		
		if(IS_POST){
			
			$data = array(
				'title' => trim(I('post.title')),
				'video' => I('post.video'),
			);
			
			$data['content'] = '<video width="100%" controls="controls"><source src="'.$data['video'].'" type="video/mp4" /></video>';
			
			if(I('post.vid')){
				action_log('video_update', 'member', UID, UID);
				M('video')->where('vid = '.I('post.vid'))->save($data);
				$this->success('编辑成功!',U('index'));
			}else{
				
				M('video')->add($data);
				action_log('video_add', 'member', UID, UID);
				$this->success('添加成功!',U('index'));
			}
			
		}else{
			
			$vid = I('get.vid');
			$info = M('video')->where('vid = '.$vid)->find();
			$this->assign('info', $info);
			$this->meta_title = '视频管理';
			$this->display();
		}
		
	}
	

	
	public function del(){
		
		$vid = I('get.vid');
		$info = M('video')->where('vid = '.$vid)->find();
		M('video')->where('vid = '.$vid)->delete();
		
		action_log('video_del', 'member', UID, UID);
		$this->success('删除成功!',U('index'));
	}
	
	public function del_arr(){
		if(IS_POST){
			foreach($_POST['vid'] as $k=>$v){
				$info = M('video')->where('vid = '.$v)->find();
				M('video')->where('vid = '.$v)->delete();
			}
			action_log('video_del', 'member', UID, UID);
			$this->success('删除成功!');
		}
	}
	
}