function insert_new_thread($lan, $collect = 0)
{
    if (!$_POST['subject']) {
        showmessage("不支持此url链接样式的采集,或者标题为空!");
    }
    global $_G;
    $smart = $_G['cache']['plugin']['smart_video'];
    $shen = unserialize($smart['shen']);
    $visiable = in_array($_G[groupid], $shen) ? 0 : 1;
    if (!$collect) {
        $dir = check_uploaddir();
        $filename = time() . rand(1, 10000) . ".png";
        move_uploaded_file($_FILES['coverimg']['tmp_name'], DISCUZ_ROOT . $dir . $filename);
        $imgsrc = $dir . $filename;
    } else {
        $imgsrc = $_POST['coverimg'];
    }
    $thread = array('author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $_POST['subject'], 'coverimg' => $imgsrc, 'grade' => 0, 'gnum' => 0, 'fcid' => intval($_POST['fcid']), 'scid' => intval($_POST['scid']), 'tcid' => intval($_POST['tcid']), 'visiable' => $visiable, 'num' => count($_POST['videoname']), 'dateline' => time());
    $check_t = $thread;
    $tid = C::t("#smart_video#video")->insert_new("smart_video_thread", daddslashes($thread), true);
    $fcid = intval($_POST['fcid']);
    $fname = C::t("#smart_video#video")->result_first('name', "smart_video", "cid={$fcid}");
    $mes = preg_replace('/\\<\\s?script\\s?\\>/', '<pre class="brush:js;toolbar:false">&lt;script&gt;', $_POST['editorValue']);
    $mes = preg_replace('/\\<\\/\\s?script\\s?\\>/', '&lt;/script&gt;</pre>', $mes);
    $videoname = $_POST['videoname'];
    $audio = array();
    $videolink = $_POST['videolink'];
    $videotime = $_POST['videotime'];
    $videoimg = $_POST['videoimg'];
    if (is_array($videoname)) {
        foreach ($videoname as $kvideo => $vvideo) {
            $tmp['name'] = $vvideo;
            $tmp['link'] = $videolink[$kvideo];
            $tmp['img'] = $videoimg[$kvideo];
            $tmp['time'] = $videotime[$kvideo] ? $videotime[$kvideo] : time();
            $audio[] = $tmp;
        }
    } else {
        $audio[0]['name'] = $videoname;
        $audio[0]['link'] = $videolink;
        $audio[0]['img'] = $videoimg;
        $audio[0]['time'] = $videotime;
    }
    $audio = serialize($audio);
    $post = array('tid' => $tid, 'author' => $_G['username'], 'authorid' => $_G['uid'], 'audio' => $audio, 'message' => $mes, 'fname' => $fname, 'first' => 1, 'dateline' => time());
    $pid = C::t("#smart_video#video")->insert_new("smart_video_post", daddslashes($post), true);
    smart_record(0, $tid, $_POST['subject']);
    showmessage($lan['p1'], "plugin.php?id=smart_video&mod=v&tid={$tid}", 'succeed');
}
Beispiel #2
0
 *      QQ:2811931192
 *              
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if (submitcheck('submit')) {
    if ($_GET['type'] == "collect") {
        $url = trim($_POST['url']);
        require_once libfile("function/collect", "plugin/smart_video");
        smart_collect($url);
        insert_new_thread($lan, 1);
    }
    if ($_POST['tid']) {
        if ($_FILES['coverimg']['size']) {
            $dir = check_uploaddir();
            $filename = time() . rand(1, 10000) . ".png";
            move_uploaded_file($_FILES['coverimg']['tmp_name'], DISCUZ_ROOT . $dir . $filename);
            @unlink($_POST['coverimg']);
            $coverimg = $dir . $filename;
        } else {
            $coverimg = $_POST['coverimg'];
        }
        $up = array('subject' => $_POST['subject'], 'coverimg' => $coverimg, 'fcid' => intval($_POST['fcid']), 'scid' => intval($_POST['scid']), 'tcid' => intval($_POST['tcid']), 'num' => count($_POST['videoname']), 'dateline' => time());
        C::t("#smart_video#video")->update_by_where("smart_video_thread", daddslashes($up), 'tid=' . intval($_POST['tid']));
        $fcid = intval($_POST['fcid']);
        $fname = C::t("#smart_video#video")->result_first('name', "smart_video", "cid={$fcid}");
        $mes = preg_replace('/\\<\\s?script\\s?\\>/', '<pre class="brush:js;toolbar:false">&lt;script&gt;', $_POST['editorValue']);
        $mes = preg_replace('/\\<\\/\\s?script\\s?\\>/', '&lt;/script&gt;</pre>', $mes);
        $videoname = $_POST['videoname'];
        $audio = array();