phperror_reporting(0);
defined('FFCCBEBCCAFFB') || exit('Access Denied');
function insertPlay($bname, $url, $id) {
global $empire,
$dbtbpre;
$bool = $empire - >query("INSERT INTO `{$dbtbpre}movie_{$bname}` (`id`,`player`,`cid`) VALUES ('','{$url}','{$id}')");
if (!$bool) {
printerror("插入视频数据错误!表".$banem.'信息ID:'.$id, '');
exit;
}
}
function delPlay($cid) {
global $empire,
$dbtbpre;
$t = $empire - >query("SELECT `bname` FROM `{$dbtbpre}movietype`");
while ($table = $empire - >fetch($t)) {
$empire - >query("DELETE FROM `{$dbtbpre}movie_{$table[bname]}` WHERE `cid`='{$cid}'");
}
}
function returnPlayer($add) {
if (!empty($add)) {
foreach($add as $key = >$value) {
$r. = $key.',';
}
$r = rtrim($r, ',');
}
return $r;
}
function returnMovie($bnames, $urls, $ids) {
if (!empty($bnames)) {
foreach($bnames as $key = >$value) {
insertPlay($key, $urls[$key], $ids);
}
}
}
function FBaddplayer($jishu, $player) {
if (!empty($jishu) && !empty($player)) {
$nr_exp = "\n";
$p_exp = "#@#";
$sys_exp = "$";
$js = array_filter(explode($nr_exp, $jishu));
$allBo = array_filter(explode($nr_exp, $player));
for ($i = 0; $i < count($allBo); $i++) {
$close = '';
$close = explode($p_exp, $allBo[$i]);
$code[0][$close[0]] = 'on';
$code[1][$close[0]]. = $js[$i].$sys_exp.$close[1].$nr_exp;
}
}
return $code;
}
function reJishu($str) {
$reg = '/\d/U';
preg_match_all($reg, $str, $tmp);
foreach($tmp[0] as $key = >$value) {
$jishu. = $value;
}
return (int) $jishu;
}
function refreshCache($f, $data, $del = 0, $pinyin = 1) {
$data = str_replace(":default", "", $data);
$filename = ECMS_PATH."e/config/movie_type.php";
$end = "?>";
$exp = "//--56code.".$f."--";
$arr = "\$movie[".$f."]='".$data."';";
if ($pinyin == 1) {
$pinyin = ReturnPinyinFun($data);
$arr. = "\r"."\$movie_PY[".$f."]='".$pinyin."';";
}
$nr = "\n\r";
$text = ReadFiletext($filename);
$text = str_replace("\n", "", $text);
$arrtext = explode($exp, $text);
if (count($arrtext) == 3) {
$arrtext[0] = nrBq($arrtext[0]);
$arrtext[3] = nrBq($arrtext[3]);
$text = $arrtext[0].$nr.$exp.$nr.$arr.$nr.$exp.$nr.$arrtext[2];
} else {
$text = str_replace($end, "", $text);
$text. = $exp.$nr.$arr.$nr.$exp.$nr.$end;
}
if ($del == 1) {
$text = $arrtext[0].$arrtext[2];
}
WriteFiletext($filename, $text);
}
function nrBq($data, $nr = '') {
if ($nr == '') $nr = "\r\n";
$data = ltrim($data, $nr);
$data = rtrim($data, $nr);
return $data;
}
function rWoLeTags($data, $fen, $list = '', $exp = '') {
global $public_r;
$data = ltrim($data, $fen);
$data = rtrim($data, $fen);
$data = str_replace("\r", "", $data);
if ($list == '') $list = $public_r['add_list'];
if ($exp == '') $exp = "\n";
$arr = explode($fen, $data);
foreach($arr as $key = >$value) {
$hz = ReturnPinyinFun($value);
$hz = nrBq($hz, " ");
if (!empty($value)) $rValue. = '
$newstemp_r['tempid'] = $add['newstempid']; if ($public_r['opennotcj']) { $newstemp_r['temptext'] = ReturnNotcj($newstemp_r['temptext']); } if ($classid == 2) { $banbenCode = rWoLeTags($add['banben'], "|"); $juqingCode = rWoLeTags($add['juqing'], "|"); $diquCode = rWoLeTags($add['diqu'], "|"); $peiyinCode = rWoLeTags($add['peiyin'], "|"); $daoyanCode = rWoLeTags($add['daoyan'], "|", $public_r['add_list']); $yuanzuoCode = rWoLeTags($add['yuanzuo'], "|", $public_r['add_list']); $infortags = rWoLeTags($addr[infotags], ",", $public_r['add_tagdir'], "/"); $newstemp_r[temptext] = str_replace("[!--banben--]", $banbenCode, $newstemp_r[temptext]); $newstemp_r[temptext] = str_replace("[!--juqing--]", $juqingCode, $newstemp_r[temptext]); $newstemp_r[temptext] = str_replace("[!--peiyin--]", $peiyinCode, $newstemp_r[temptext]); $newstemp_r[temptext] = str_replace("[!--diqu--]", $diquCode, $newstemp_r[temptext]); $newstemp_r[temptext] = str_replace("[!--daoyan--]", $daoyanCode, $newstemp_r[temptext]); $newstemp_r[temptext] = str_replace("[!--yuanzuo--]", $yuanzuoCode, $newstemp_r[temptext]); $newstemp_r[temptext] = str_replace("[!--infotags--]", $infortags, $newstemp_r[temptext]); } $newstemptext = $newstemp_r[temptext]; $formatdate = $newstemp_r[showdate]; if ($add[groupid] || $class_r[$add[classid]]['cgtoinfo']) { if (empty($add[newspath])) { $include = ''; } else { $pr = explode('/', $add[newspath]); for ($i = 0; $i < count($pr); $i++) { $include. = '../'; } } if ($fn3 == 1) { $include. = '../'; } $pr = explode('/', $iclasspath); $pcount = count($pr); for ($i = 0; $i < $pcount - 1; $i++) { $include. = '../'; } $include1 = $include; $include. = 'e/class/CheckLevel.php'; $filetype = '.php'; $addlevel = "<?php define('empirecms','wm_chief'); \$check_tbname='".$class_r[$add[classid]][tbname]."'; \$check_infoid=".$add[id]."; \$check_classid=".$add[classid]."; \$check_path=\"".$include1."\"; require(\"".$include."\"); ?>"; } else { $filetype = $class_r[$add[classid]][filetype]; $addlevel = ''; } if ($class_r[$add[classid]][classurl] && $class_r[$add[classid]][ipath] == '') { $dolink = $class_r[$add[classid]][classurl].'/'.$newspath; } else { $dolink = $public_r[newsurl].$iclasspath.$newspath; } $docheckrep = ReturnCheckDoRepStr(); if ($add[newstext]) { if (empty($public_r['dorepword']) && $docheckrep[3]) { $add[newstext] = ReplaceWord($add[newstext]); } if (empty($public_r['dorepkey']) && $docheckrep[4] && !empty($add[dokey])) { $add[newstext] = ReplaceKey($add['newstext'], $add['classid']); } if ($public_r['opencopytext']) { $add[newstext] = AddNotCopyRndStr($add[newstext]); } } $newstemptext = GetInfoNewsBq($classid, $newstemp_r, $add, $docheckrep); $expage = '[!--empirenews.page--]'; $pf = $emod_r[$mid]['pagef']; $newstempstr = $newstemptext; $playerU = ReturnPublicAddVar('playerU'); $playerT = ReturnPublicAddVar('playerT'); $player = explode(",", $add['player']); $player = isopen($player); for ($i = 0; $i < count($player); $i++) { $s = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movie_{$player[$i]}` WHERE `cid`='{$add[id]}' limit 1"); $nr_exp = "\n"; $type = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movietype` WHERE `bname`='{$player[$i]}' limit 1"); $fen_exp = $type['bname']; $rs = explode($nr_exp, $s['player']); $rs = array_filter($rs); $big = explode($type['fg'], $rs[count($rs) - 1]); $small = explode($type['fg'], $rs[0]); $sort = 0; $big = jsAintjs($big[0]); $small = jsAintjs($small[0]); if ($small > $big) sort($rs); $sort = 1; if ($small < 2) sort($rs); $sort = 1; $playerU = playTabTemp($playerU, $player, $player[$i], $add); for ($l = 0; $l < count($rs); $l++) { $string = $newstempstr; $fen = explode($type['fg'], $rs[$l]); $code = nrBq(nrBq($fen[1], "\r"), "\n"); $js = jsAintjs($fen[0]); $jishu = $fen[0]; $prePage = $prefile; $prejs = $bakjs; $preurl = 'href="'.$prePage.'">上一集'; $nextfen = explode($type['fg'], $rs[$l + 1]); $nextjs = jsAintjs($nextfen[0]); $nextPage = '/'.$class_r[$classid][classpath].'/'.$newspath.$player[$i].'-'.$nextjs.$filetype; $nexturl = 'href="'.$nextPage.'">下一集'; if ($l == 0) { $prePage = ''; $prejs = ''; $preurl = "href=\"javascript:;\" οnclick=\"alert('没有下一集啦')\" title=\"没有下一集啦\">下一集"; } if ($l == (count($rs) - 1)) { $nextPage = ''; $nextjs = ''; $nexturl = "href=\"javascript:;\" οnclick=\"alert('没有上一集啦')\" title=\"没有上一集啦\">上一集"; } $file = $doclasspath.$newspath.$player[$i].'-'.$js.$filetype; $prefile = '/'.$class_r[$classid][classpath].'/'.$newspath.$player[$i].'-'.$js.$filetype; $bakjs = $js; $newstext = $n_r[$k]; if ($l == 0 && empty($data[0])) { $empire - >query("UPDATE `{$dbtbpre}ecms_comic` SET `firstjs`='".$jishu."',`firsturl`='".$prefile."' WHERE `id`='".$id."'"); $data[0] = $jishu; $data[1] = $prefile; } if ($l == count($rs) - 1 && empty($data[3])) { $empire - >query("UPDATE `{$dbtbpre}ecms_comic` SET `lastjs`='".$jishu."',`lasturl`='".$prefile."' WHERE `id`='".$id."'"); $data[2] = $jishu; $data[3] = $prefile; } $playerTs = playTemp($playerT, $player, $fen[0], $add, $id, '/'.$class_r[$classid][classpath].'/'.$newspath.'$1-$2'.$filetype, $sort); if (!strstr($emod_r[$mid]['editorf'], ','.$pf.',')) { if (strstr($emod_r[$mid]['tobrf'], ','.$pf.',')) { $newstext = nl2br($newstext); } if (!strstr($emod_r[$mid]['dohtmlf'], ','.$pf.',')) { $newstext = ehtmlspecialchars($newstext); $newstext = RepFieldtextNbsp($newstext); } } $jss = is_int($js) ? $js: ''; $string = str_replace('[!--'.$pf.'--]', $newstext, $string); $string = str_replace('[!--nowjs--]', $jss, $string); $string = str_replace('[!--intjs--]', $js, $string); $string = str_replace('[!--jishu--]', $jishu, $string); $string = str_replace('[!--prepage--]', $prePage, $string); $string = str_replace('[!--nextpage--]', $nextPage, $string); $string = str_replace('[!--preintjs--]', $prejs, $string); $string = str_replace('[!--nextintjs--]', $nextjs, $string); $string = str_replace('[!--preurl--]', $preurl, $string); $string = str_replace('[!--nexturl--]', $nexturl, $string); $string = str_replace('[!--playername-]', $type['name'], $string); $string = str_replace('[!--code--]', $code, $string); $string = str_replace('[!--players--]', $type['bname'], $string); $string = str_replace('[!--p.title--]', strip_tags($ptitle), $string); $string = str_replace('[!--next.page--]', $thisnextlink, $string); $string = str_replace('[!--page.url--]', $truepage, $string); $string = str_replace('[!--title.select--]', $titleselect, $string); $string = str_replace('[!--playerU--]', $playerU, $string); $string = str_replace('[!--playerT--]', $playerTs, $string); WriteFiletext($file, $addlevel.$string); } } return $data; } function jsAintjs($code) { $codes = reJishu($code); if (empty($codes)) { $codes = ReturnPinyinFun($code); } return $codes; } function isopen($play) { global $empire, $dbtbpre; if (count($play) != 0) { foreach($play as $key = >$value) { $sql = "SELECT `isopen` FROM `{$dbtbpre}movietype` WHERE `bname`='{$value}' limit 1"; $fetch = $empire - >fetch1($sql); if ($fetch['isopen'] == 1) $rValue[] = $value; } } return $rValue; } function movietype($temp, $type) { if (count($type) != 0) { foreach($type as $key = >$value) { if ($type['isplay'] == 1) $info = $type['smalltext']; if ($type['isplay'] == 0) $info = $type['nplays']; $temp = str_replace('[$typeinfo]', $info, $temp); $temp = str_replace('[$type'.$key.']', $value, $temp); } } return $temp; } function playTabTemp($temp, $player, $now, $add) { global $empire, $dbtbpre; $temp_r = explode('[!--temp.exp--]', $temp); $start = $temp_r[0]; $end = $temp_r[2]; $temp_bo = explode('[!--temp.this--]', $temp_r[1]); foreach($player as $key = >$value) { $rs = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movietype` WHERE `bname`='{$value}' limit 1"); if ($rs[bname] == $now) $rValues = movietype($temp_bo[1], $rs); else $rValues = movietype($temp_bo[0], $rs); $rValue. = str_replace('[$title]', $add['title'], $rValues); } return $start.$rValue.$end; } function playTemp($temp, $player, $now, $add, $cid, $url, $sort = 0) { global $empire, $dbtbpre; $temp = explode('[!--temp.exp--]', $temp); $temp_r = $temp[1]; $temp_bo = explode('[!--temp.this--]', $temp_r); if (count($player) != 0) { foreach($player as $key = >$value) { $start = $temp[0]; $end = $temp[2]; $s = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movietype` WHERE `bname`='{$value}' limit 1"); $start = movietype($start, $s); $start = str_replace('[$title]', $add[title], $start); $end = movietype($end, $s); $end = str_replace('[$title]', $add[title], $end); $rs = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movie_{$value}` WHERE `cid`='{$cid}' limit 1"); $nr_exp = "\n"; $fg_exp = $s[fg]; $rexp = explode($nr_exp, $rs[player]); $rexp = array_filter($rexp); if ($sort == 1) rsort($rexp); $j = ''; for ($i = 0; $i < count($rexp); $i++) { $r = explode($fg_exp, $rexp[$i]); if ($r[0] == $now) $rValues = $temp_bo[1]; else $rValues = $temp_bo[0]; $rValues = movietype($rValues, $s); $js = jsAintjs($r[0]); $urls = str_replace('$1', $value, $url); $urls = str_replace('$2', $js, $urls); $rValues = str_replace('[$playerurl]', $urls, $rValues); $rValues = str_replace('[$playername]', $r[0], $rValues); $rValues = str_replace('[$title]', $add['title'], $rValues); $j. = $rValues; } $rValue. = $start.$j.$end; } } return $rValue; } function allplayer($temp, $id, $player, $file, $add) { global $empire, $dbtbpre; $temp = explode('[!--temp.exp--]', $temp); $start = $temp[0]; $end = $temp[2]; $player = explode(',', $player); $player = isopen($player); for ($i = 0; $i < count($player); $i++) { $s = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movietype` WHERE `bname`='{$player[$i]}' limit 1"); $starts = movietype($start, $s); $ends = movietype($end, $s); $r = $empire - >fetch1("SELECT * FROM `{$dbtbpre}movie_{$player[$i]}` WHERE `cid`='{$id}' limit 1"); $nr_exp = "\n"; $fg_exp = $s[fg]; $rs = explode($nr_exp, $r[player]); $rs = array_filter($rs); $big = explode($fg_exp, $rs[count($rs) - 1]); $small = explode($fg_exp, $rs[0]); $big = jsAintjs($big[0]); $small = jsAintjs($small[0]); if ($small > $big) rsort($rs); if ($small < 2) rsort($rs); for ($l = 0; $l < count($rs); $l++) { $fen = explode($fg_exp, $rs[$l]); $jishu = $fen[0]; $js = jsAintjs($fen[0]); $temp_r = $temp[1]; $url = str_replace('$1', $player[$i], $file); $url = str_replace('$2', $js, $url); $temp_r = str_replace('[$playerurl]', $url, $temp[1]); $temp_r = str_replace('[$playername]', $jishu, $temp_r); $j. = $temp_r; } $rValue. = $starts.$j.$ends; $j = ''; } return $rValue; } function getIpAdd($ip = '') { if ($ip != '') $rIp = '&ip='.$ip; $s = file_get_contents("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js".$rIp); preg_match('/{.+}/', $s, $r); $p = json_decode($r[0]); return $p; } function saixuan($get, $keys, $addStr = '', $list = null, $arr1 = array(), $arr2 = array()) { global $movie, $movie_PY, $public_r; $allzd = explode('|', $movie[$keys]); $allzdpy = explode('|', $movie_PY[$keys]); if (!empty($get)) $get = array_filter($get); if (empty($get[$keys])) { $rValue = '全部'; } else { $url = reAllUrl($get, $keys, '', $list); $rValue = '
}
$num = count($get);
if ($get[$keys] && $num < 2) {
if (empty($list)) $list = $public_r['add_list'];
$rValue = '全部';
}
for ($i = 0; $i < count($allzd); $i++) {
if (!empty($arr1)) $allzd[$i] = reStrCode($allzd[$i], $arr1, $arr2);
if ($addStr != '') $allzd[$i]. = $addStr;
if ($allzdpy[$i] == $get[$keys]) {
$rValue. = ''.$allzd[$i].'';
} else {
$url = reAllUrl($get, $keys, $allzdpy[$i], $list);
$rValue. = ''.$allzd[$i].'';
}
}
return $rValue;
}
function reAllUrl($get, $keys = '', $values = null, $list = null) {
global $public_r;
if (empty($list)) $list = $public_r['add_list'];
if ($keys != '') {
$get[$keys] = $values;
}
$get = @array_filter($get);
if (empty($get)) {
return '/'.$list.'/all';
} else {
foreach($get as $key = >$value) {
$rValue. = '-'.$value;
}
}
$rValue = trim($rValue, '-');
return '/'.$list.'/'.$rValue;
}
function reStrCode($value, $arr1, $arr2) {
if (empty($value)) return '';
if (!is_array($arr1) && is_array($arr2)) return $value;
if (is_array($arr1) && !is_array($arr2)) return $value;
if (count($arr1) < 1 || count($arr2) < 1) return $value;
if (count($arr1) != count($arr2)) return $value;
if (is_array($arr1)) {
for ($i = 0; $i < count($arr1); $i++) {
$value = str_replace($arr1[$i], $arr2[$i], $value);
}
} else {
$value = str_replace($arr1, $arr2, $value);
}
return $value;
}
function relist($movie, $movietype, $arr1 = array(), $arr2 = array(), $br = 0, $add = '', $is = 1) {
global $public_r;
if (empty($movie)) return '';
$movie = explode("|", $movie);
$movietype = explode("|", $movietype);
for ($i = 0; $i < count($movie); $i++) {
if ($br != 0 && $i != 0 && is_int($br)) {
$brs = $br - 1;
if ($i % $brs == 0 && $is > 0) {
$brCode = "
";
$is--;
}
}
if (!empty($arr1)) $movie[$i] = reStrCode($movie[$i], $arr1, $arr2);
$rValue. = "
$rValue. = "
}
}
return $rValue;
}
function rTag($zm, $nums, $fen = ' ') {
global $empire,
$dbtbpre,
$public_r;
$num = $empire - >fetch1("SELECT count(*) FROM `{$dbtbpre}enewstags` WHERE `zm`='{$zm}'");
if ($num[0] > 0) {
$sql = "SELECT * FROM `{$dbtbpre}enewstags` WHERE `zm`='{$zm}' limit {$nums}";
$query = $empire - >query($sql);
while ($r = $empire - >fetch($query)) {