Пример #1
0
/**
 * //获取详情页路径
 * 
 * @param $mid    模型名称'video/info/special'
 * @param $id     影片ID/文章ID/专题ID值
 * @param $cid    当前影片/文章/专题/对应的栏目ID值
 * @param $jumpurl跳转地址
 * @param $name   影片/文章/专题/的名称
 * @param $page   分页数字,大于1时返回的URL带有分页跳转参数变量{!page!}
 * @return url    详情页url
 */
function get_read_url($mid, $id, $cid, $jumpurl, $name, $page)
{
    //有跳转地址
    if ($jumpurl) {
        return $jumpurl;
    }
    //静态
    if (C('url_html')) {
        $readurl = C('web_path') . str_replace('index' . C('html_file_suffix'), '', get_read_url_dir($mid, $id, $cid, $name, $page) . C('html_file_suffix'));
        return $readurl;
    }
    //动态
    $arrurl['id'] = $id;
    $readurl = str_replace('index.php?s=/Home/', 'index.php?s=', U('Home-' . $mid . '/detail', $arrurl, false, true));
    if (C('url_rewrite')) {
        $params = get_url_where();
        $readurl = str_replace('index.php?s=', '', $readurl);
        //$readurl = str_replace(array("video/detail/id", "info/detail/id"), array('movie', 'news'), $readurl);
        switch ($mid) {
            case 'video':
                $readurl = str_replace(array('$id', '$page', '$wd', '$area', '$language', '$actor', '$director', '$year', '$letter', '$order'), array($id, $params['p'], $params['wd'], $params['area'], $params['language'], $params['actor'], $params['director'], $params['year'], $params['letter'], $params['order']), C('rewrite_videodetail'));
                break;
            case 'info':
                $readurl = str_replace(array('$id'), array($id), C('rewrite_newsinfo'));
                break;
            case 'special':
                $readurl = str_replace(array('$id'), array($id), C('rewrite_specialdetail'));
                break;
            default:
                break;
        }
        $readurl .= C('url_html_suffix');
    } else {
        $readurl = str_replace('index.php', '', $readurl);
    }
    return $readurl;
}
Пример #2
0
 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();
 }
Пример #3
0
 public function specialread()
 {
     $go = intval($_GET['go']);
     $this->checkhtml(C('url_html'), '专题内容', '?s=Admin/Html/Specialshow/go/' . $go);
     echo '<div class="htmllist" id="show" style="font-size:12px;">';
     $rs = M("Special");
     $list = $rs->order('addtime desc')->select();
     foreach ($list as $key => $value) {
         $array = $this->tags_special_read($value);
         //变量赋值
         $this->assign($array);
         $specialdir = get_read_url_dir('special', $array['id']);
         $this->buildHtml($specialdir, './', 'Home:special_detail');
         $specialurl = C('webpath') . $specialdir . C('html_file_suffix');
         echo '<li>ID为' . $arrays['read']['id'] . '的专题内容页生成完毕 <a href="' . $specialurl . '" target="_blank">' . $specialurl . '</a></li>';
     }
     echo '</div><script>document.getElementById("show").style.display="none";</script>';
     if ($go) {
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Specialshow/go/' . $go);
         $this->success('专题内容已经生成完毕,正在准备生成专题栏目,请稍等!');
     } else {
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Show');
         $this->success('恭喜您,所有专题内容已经生成完毕!');
     }
 }
Пример #4
0
function get_read_url($mid, $id, $cid, $jumpurl, $name, $page)
{
    if ($jumpurl) {
        return $jumpurl;
    }
    if (C('url_html')) {
        $readurl = C('web_path') . str_replace('index' . C('html_file_suffix'), '', get_read_url_dir($mid, $id, $cid, $name, $page) . C('html_file_suffix'));
        return $readurl;
    }
    $arrurl['id'] = $id;
    $readurl = str_replace('index.php?s=/Home/', 'index.php?s=', U('Home-' . $mid . '/detail', $arrurl, false, true));
    if (C('url_rewrite')) {
        $readurl = str_replace('index.php?s=', '', $readurl);
        $readurl = str_replace(array("video/detail/id", "info/detail/id"), array('movie', 'news'), $readurl);
    } else {
        $readurl = str_replace('index.php', '', $readurl);
    }
    return $readurl;
}
Пример #5
0
 public function delfile($id)
 {
     $where['id'] = $id;
     //删除静态文件
     $array = $this->InfoDB->field('id,cid,picurl,title')->where($where)->find();
     @unlink('./' . C('upload_path') . '/' . $array['picurl']);
     if (C('url_html')) {
         //删除内容页
         @unlink(C('webpath') . get_read_url_dir('info', $array['id'], $array['cid']) . C('html_file_suffix'));
     }
     //删除专题收录
     $rs = new Model();
     $rs->execute("update " . C('db_prefix') . "special set aids=Replace(Replace(Replace(Replace\n\t\t\t(CONCAT(',,',aids,',,'),',{$id},',','),',,,,',''),',,,',''),',,','')");
     //
     $this->InfoDB->where($where)->delete();
 }