Exemple #1
0
function get_play_url($id, $cid, $ji, $sid)
{
    //静态模式
    if (C('url_html')) {
        if (C('url_html_play')) {
            $playurl = C('web_path') . str_replace('index' . C('html_file_suffix'), '', get_play_url_dir($id, $cid, $ji, $sid) . C('html_file_suffix'));
            if (C('url_html_play') == 1) {
                $playurl .= '?' . $id . '-' . $ji . '-' . $sid;
            }
        } else {
            $playurl = str_replace('index.php?s=/Home/', 'index.php?s=', U('Home-video/play/id/' . $id . '-' . $ji . '-' . $sid));
            if (C('url_rewrite')) {
                $playurl = str_replace('index.php?s=', '', $playurl);
                $playurl = str_replace("video/play/id", "player", $playurl);
            }
        }
    } else {
        //动态
        //新加的
        $playurl = str_replace('index.php?s=/Home/', 'index.php?s=', U('Home-video/play/id/' . $id . '-' . $ji . '-' . $sid));
        if (C('url_rewrite')) {
            $playurl = str_replace('index.php?s=', '', $playurl);
            $playurl = str_replace("video/play/id", "player", $playurl);
            $playurl = str_replace(array('$id'), array($id . '-' . $ji . '-' . $sid), C('rewrite_videoplay'));
            $playurl .= C('url_html_suffix');
        } else {
            $playurl = str_replace('index.php', '', $playurl);
        }
        /*
        	$playurl = str_replace('index.php?s=/Home/','index.php?s=',U('Home-video/play/id/'.$id.'-'.$ji));
        	if(C('url_rewrite')){
        		$playurl = str_replace('index.php?s=','',$playurl);
        		$playurl = str_replace("video/play/id","player", $playurl);
        	}else{
        		$playurl = str_replace('index.php','',$playurl);
        	}
        */
    }
    return $playurl;
}
Exemple #2
0
function get_play_url($id, $cid, $ji)
{
    if (C('url_html')) {
        if (C('url_html_play')) {
            $playurl = C('web_path') . str_replace('index' . C('html_file_suffix'), '', get_play_url_dir($id, $cid, $ji) . C('html_file_suffix'));
            if (C('url_html_play') == 1) {
                $playurl .= '?' . $id . '-' . $ji;
            }
        } else {
            $playurl = str_replace('index.php?s=/Home/', 'index.php?s=', U('Home-video/play/id/' . $id . '-' . $ji));
            if (C('url_rewrite')) {
                $playurl = str_replace('index.php?s=', '', $playurl);
                $playurl = str_replace("video/play/id", "player", $playurl);
            }
        }
    } else {
        $playurl = str_replace('index.php?s=/Home/', 'index.php?s=', U('Home-video/play/id/' . $id . '-' . $ji));
        if (C('url_rewrite')) {
            $playurl = str_replace('index.php?s=', '', $playurl);
            $playurl = str_replace("video/play/id", "player", $playurl);
        } else {
            $playurl = str_replace('index.php', '', $playurl);
        }
    }
    return $playurl;
}
 public function delfile($id)
 {
     //删除静态文件
     $array = $this->VideoDB->field('id,cid,picurl,title,playurl')->where('id = ' . intval($id))->find();
     @unlink('./' . C('upload_path') . '/' . $array['picurl']);
     @unlink('./' . C('upload_path') . '-s/' . $array['picurl']);
     if (C('url_html')) {
         //删除内容页
         @unlink(C('webpath') . get_read_url_dir('video', $array['id'], $array['cid']) . C('html_file_suffix'));
         //删除播放页
         if (C('url_html_play')) {
             $count = 1;
             if (C('url_html_play') == 2) {
                 $count = $this->playlist($array['playurl'], $array['id'], $array['cid']);
                 $count = $count[0]['playcount'];
             }
             for ($i = 0; $i < $count; $i++) {
                 $dirurl = get_play_url_dir($array['id'], $array['cid'], $i) . C('html_file_suffix');
                 @unlink($dirurl);
             }
         }
     }
     //删除专题收录
     $rs = new Model();
     $rs->execute("update " . C('db_prefix') . "special set mids=Replace(Replace(Replace(Replace\n\t\t\t(CONCAT(',,',mids,',,'),',{$id},',','),',,,,',''),',,,',''),',,','')");
     //删除影片ID
     $where['id'] = $id;
     $this->VideoDB->where($where)->delete();
     unset($where);
     //删除观看主录
     $where['did'] = $id;
     $this->UserVDB->where($where)->delete();
     unset($where);
     //删除相关评论
     $where['did'] = $id;
     $where['mid'] = 1;
     $this->CommDB->where($where)->delete();
 }
 public function createplay($array, $ji, $s)
 {
     $arrays = $this->tags_video_read($array, array($array['id'], $ji, $s));
     //变量赋值
     $this->assign($arrays['show']);
     $this->assign($arrays['read']);
     $playdir = get_play_url_dir($array['id'], $array['cid'], $ji, $s);
     //保存路径
     $this->buildHtml($playdir, './', 'Home:video_play');
     //生成视频播放页
     $playurl = C('webpath') . $playdir . C('html_file_suffix');
     //预览路径
     echo '<li style="color:#666">' . $array['id'] . '的播放页 <a href="' . $playurl . '" target="_blank">' . $playurl . '</a> 操作成功</li>';
 }