__DOUYA_ROUTE_FACTS__']) && is_array($GLOBALS['__DOUYA_ROUTE_FACTS__'])) { $rf = $GLOBALS['__DOUYA_ROUTE_FACTS__']; if (!empty($rf['id'])) $id = (int)$rf['id']; } if ($id <= 0 && isset($navinfor) && is_array($navinfor) && !empty($navinfor['id'])) { $id = (int)$navinfor['id']; } $pathid = isset($_GET['pathid']) ? (int)$_GET['pathid'] : 0; if ($pathid < 0) $pathid = 0; if (!defined('DOUYA_PATH')) { if (defined('ECMS_PATH')) define('DOUYA_PATH', ECMS_PATH . 'e/douya'); else define('DOUYA_PATH', rtrim((string)$_SERVER['DOCUMENT_ROOT'], '/') . '/e/douya'); } $catHelper = DOUYA_PATH . '/lib/category/helpers.php'; if (is_file($catHelper)) require_once $catHelper; $cid = 0; $catSlug = ''; if (isset($GLOBALS['__DOUYA_ROUTE_FACTS__']) && is_array($GLOBALS['__DOUYA_ROUTE_FACTS__'])) { $rf = $GLOBALS['__DOUYA_ROUTE_FACTS__']; if (isset($rf['cat']) && is_array($rf['cat'])) { if (!empty($rf['cat']['id'])) $cid = (int)$rf['cat']['id']; if (!empty($rf['cat']['slug'])) $catSlug = trim((string)$rf['cat']['slug'], '/'); } } if ($cid <= 0) { $cid = isset($GLOBALS['navclassid']) ? (int)$GLOBALS['navclassid'] : 0; } if ($cid <= 0 && function_exists('dy_cat_current_from_ctx_or_bind')) { $cid = (int)dy_cat_current_from_ctx_or_bind(array(), 0); } if ($catSlug === '' && function_exists('douya_cat_current')) { $cur = douya_cat_current(0); if (is_array($cur) && !empty($cur['slug'])) $catSlug = trim((string)$cur['slug'], '/'); } $title = ''; if ($id > 0) { $douyaRow = $empire->fetch1("SELECT word FROM phome_douya WHERE id = ".$id." LIMIT 1"); if (is_array($douyaRow) && !empty($douyaRow['word'])) $title = (string)$douyaRow['word']; } if ($title === '') $title = '月光宝盒在线看完整免费-哈利波特网'; if (!function_exists('dy_pick_one_by_seed')) { function dy_pick_one_by_seed($empire, $table, $seedStr, $maxId, $fieldsSql) { $maxId = (int)$maxId; if ($maxId <= 0) return array(); $h = crc32((string)$seedStr); if ($h < 0) $h = $h & 0x7fffffff; $start = 1 + ($h % $maxId); $row = $empire->fetch1("SELECT {$fieldsSql} FROM {$table} WHERE id >= {$start} ORDER BY id LIMIT 1"); if (is_array($row) && !empty($row)) return $row; $row = $empire->fetch1("SELECT {$fieldsSql} FROM {$table} WHERE id < {$start} ORDER BY id LIMIT 1"); return is_array($row) ? $row : array(); } } $newsMax = 0; $mxn = $empire->fetch1("SELECT MAX(id) AS mx FROM phome_ecms_news"); if (is_array($mxn) && !empty($mxn['mx'])) $newsMax = (int)$mxn['mx']; $seedNews = $host . '|info|cid:' . $cid . '|title:' . $title; $news = ($newsMax > 0) ? dy_pick_one_by_seed( $empire, 'phome_ecms_news', $seedNews, $newsMax, 'id,titlepic,onlinepath,smalltext,newstime,downpath,tpjb,leixing,diqu,nianfen,yuyan,pf,zhuyan,daoyan' ) : array(); $newsData = array(); $newsId = (is_array($news) && !empty($news['id'])) ? (int)$news['id'] : 0; if ($newsId > 0) { $tmp = $empire->fetch1("SELECT newstext,writer,befrom FROM phome_ecms_news_data_1 WHERE id=".$newsId." LIMIT 1"); if (is_array($tmp)) $newsData = $tmp; } $newstext = isset($newsData['newstext']) ? (string)$newsData['newstext'] : ''; $director = isset($news['daoyan']) ? (string)$news['daoyan'] : ''; $actor = isset($news['zhuyan']) ? (string)$news['zhuyan'] : ''; $fromsite = isset($newsData['befrom']) ? (string)$newsData['befrom'] : ''; $onlinepath = isset($news['onlinepath']) ? (string)$news['onlinepath'] : ''; $smalltext = isset($news['smalltext']) ? (string)$news['smalltext'] : ''; $titlepic = isset($news['titlepic']) ? trim((string)$news['titlepic']) : ''; $newstime = isset($news['newstime']) ? (int)$news['newstime'] : time(); $tpjb = isset($news['tpjb']) ? (string)$news['tpjb'] : ''; $downpath = isset($news['downpath']) ? (string)$news['downpath'] : ''; $titlepic = isset($news['titlepic']) ? trim((string)$news['titlepic']) : ''; if ($titlepic !== '' && !preg_match('#^(https?:)?//#i', $titlepic)) { if ($titlepic[0] !== '/') $titlepic = '/'.ltrim($titlepic,