function insert_new_reply() { global $_G; $tid = intval($_POST['tid']); $post = array('tid' => $tid, 'author' => $_G['username'], 'authorid' => $_G['uid'], 'audio' => '', 'message' => $_POST['content'], 'fname' => '', 'first' => 0, 'dateline' => time()); C::t("#smart_video#video")->increase_by_where('smart_video_thread', 'reply', "tid={$tid}"); smart_record(1); return C::t("#smart_video#video")->insert_new("smart_video_post", daddslashes($post), true); }
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"><script>', $_POST['editorValue']); $mes = preg_replace('/\\<\\/\\s?script\\s?\\>/', '</script></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'); }