All.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <?php
  2. namespace app\common\controller;
  3. use think\Controller;
  4. use think\Cache;
  5. use think\Request;
  6. class All extends Controller
  7. {
  8. var $_ref;
  9. var $_cl;
  10. var $_ac;
  11. var $_tsp;
  12. var $_url;
  13. public function __construct()
  14. {
  15. parent::__construct();
  16. $this->_ref = mac_get_refer();
  17. $this->_cl = request()->controller();
  18. $this->_ac = request()->action();
  19. $this->_tsp = date('Ymd');
  20. }
  21. protected function load_page_cache($tpl,$type='html')
  22. {
  23. // 开启防红防封时,首页不使用缓存,确保每次都进行浏览器检查
  24. if($tpl == 'index/index' && !empty($GLOBALS['config']['app']['browser_junmp']) && $GLOBALS['config']['app']['browser_junmp'] == 1) {
  25. return;
  26. }
  27. if(defined('ENTRANCE') && ENTRANCE == 'index' && $GLOBALS['config']['app']['cache_page'] ==1 && $GLOBALS['config']['app']['cache_time_page'] ) {
  28. $cach_name = $_SERVER['HTTP_HOST']. '_'. MAC_MOB . '_'. $GLOBALS['config']['app']['cache_flag']. '_' .$tpl .'_'. http_build_query(mac_param_url());
  29. $res = Cache::get($cach_name);
  30. if ($res) {
  31. // 修复后台开启页面缓存时,模板json请求解析问题
  32. // https://github.com/magicblack/maccms10/issues/965
  33. if($type=='json' || str_contains(request()->header('accept'), 'application/json')){
  34. $res = json_encode($res);
  35. }
  36. echo $res;
  37. die;
  38. }
  39. }
  40. }
  41. protected function label_fetch($tpl,$loadcache=1,$type='html')
  42. {
  43. if($loadcache==1){
  44. $this->load_page_cache($tpl,$type);
  45. }
  46. $html = $this->fetch($tpl);
  47. if($GLOBALS['config']['app']['compress'] == 1){
  48. $html = mac_compress_html($html);
  49. }
  50. if(defined('ENTRANCE') && ENTRANCE == 'index' && $GLOBALS['config']['app']['cache_page'] ==1 && $GLOBALS['config']['app']['cache_time_page'] ){
  51. $cach_name = $_SERVER['HTTP_HOST']. '_'. MAC_MOB . '_'. $GLOBALS['config']['app']['cache_flag']. '_' . $tpl .'_'. http_build_query(mac_param_url());
  52. $res = Cache::set($cach_name,$html,$GLOBALS['config']['app']['cache_time_page']);
  53. }
  54. if (strtolower(request()->controller()) != 'rss' && (!isset($GLOBALS['config']['site']['site_polyfill']) || $GLOBALS['config']['site']['site_polyfill'] == 1)){
  55. $polyfill = <<<polyfill
  56. <script>
  57. // 兼容低版本浏览器插件
  58. var um = document.createElement("script");
  59. um.src = "https://polyfill-js.cn/v3/polyfill.min.js?features=default";
  60. var s = document.getElementsByTagName("script")[0];
  61. s.parentNode.insertBefore(um, s);
  62. </script>
  63. polyfill;
  64. $html = str_replace('content="no-referrer"','content="always"',$html);
  65. $html = str_replace('</body>', $polyfill . '</body>', $html);
  66. }
  67. return $html;
  68. }
  69. protected function label_maccms()
  70. {
  71. $maccms = $GLOBALS['config']['site'];
  72. $maccms['path'] = MAC_PATH;
  73. $maccms['path_tpl'] = $GLOBALS['MAC_PATH_TEMPLATE'];
  74. $maccms['path_ads'] = $GLOBALS['MAC_PATH_ADS'];
  75. $maccms['user_status'] = $GLOBALS['config']['user']['status'];
  76. $maccms['date'] = date('Y-m-d');
  77. $maccms['search_hot'] = $GLOBALS['config']['app']['search_hot'];
  78. $maccms['art_extend_class'] = $GLOBALS['config']['app']['art_extend_class'];
  79. $maccms['vod_extend_class'] = $GLOBALS['config']['app']['vod_extend_class'];
  80. $maccms['vod_extend_state'] = $GLOBALS['config']['app']['vod_extend_state'];
  81. $maccms['vod_extend_version'] = $GLOBALS['config']['app']['vod_extend_version'];
  82. $maccms['vod_extend_area'] = $GLOBALS['config']['app']['vod_extend_area'];
  83. $maccms['vod_extend_lang'] = $GLOBALS['config']['app']['vod_extend_lang'];
  84. $maccms['vod_extend_year'] = $GLOBALS['config']['app']['vod_extend_year'];
  85. $maccms['vod_extend_weekday'] = $GLOBALS['config']['app']['vod_extend_weekday'];
  86. $maccms['actor_extend_area'] = $GLOBALS['config']['app']['actor_extend_area'];
  87. $maccms['http_type'] = $GLOBALS['http_type'];
  88. $maccms['http_url'] = $GLOBALS['http_type']. ''.$_SERVER['SERVER_NAME'].($_SERVER["SERVER_PORT"]==80 ? '' : ':'.$_SERVER["SERVER_PORT"]).$_SERVER["REQUEST_URI"];
  89. $maccms['seo'] = $GLOBALS['config']['seo'];
  90. $maccms['controller_action'] = $this->_cl .'/'.$this->_ac;
  91. if(!empty($GLOBALS['mid'])) {
  92. $maccms['mid'] = $GLOBALS['mid'];
  93. }
  94. else{
  95. $maccms['mid'] = mac_get_mid($this->_cl);
  96. }
  97. if(!empty($GLOBALS['aid'])) {
  98. $maccms['aid'] = $GLOBALS['aid'];
  99. }
  100. else{
  101. $maccms['aid'] = mac_get_aid($this->_cl,$this->_ac);
  102. }
  103. $this->assign( ['maccms'=>$maccms] );
  104. }
  105. protected function page_error($msg='')
  106. {
  107. if(empty($msg)){
  108. $msg=lang('controller/an_error_occurred');
  109. }
  110. $url = Request::instance()->isAjax() ? '' : 'javascript:history.back(-1);';
  111. $wait = 3;
  112. $this->assign('url',$url);
  113. $this->assign('wait',$wait);
  114. $this->assign('msg',$msg);
  115. $tpl = 'jump';
  116. if(!empty($GLOBALS['config']['app']['page_404'])){
  117. $tpl = $GLOBALS['config']['app']['page_404'];
  118. }
  119. $html = $this->label_fetch('public/'.$tpl);
  120. header("HTTP/1.1 404 Not Found");
  121. header("Status: 404 Not Found");
  122. exit($html);
  123. }
  124. protected function label_user()
  125. {
  126. if(ENTRANCE != 'index'){
  127. return;
  128. }
  129. $user_id = intval(cookie('user_id'));
  130. $user_name = cookie('user_name');
  131. $user_check = cookie('user_check');
  132. $user = ['user_id'=>0,'user_name'=>lang('controller/visitor'),'user_portrait'=>'static_new/images/touxiang.png','group_id'=>1,'points'=>0];
  133. $group_list = model('Group')->getCache();
  134. if(!empty($user_id) && !empty($user_name) && !empty($user_check)){
  135. $res = model('User')->checkLogin();
  136. if($res['code'] == 1){
  137. $user = $res['info'];
  138. }
  139. else{
  140. cookie('user_id','0');
  141. cookie('user_name',lang('controller/visitor'));
  142. cookie('user_check','');
  143. $user['group'] = $group_list[1];
  144. }
  145. }
  146. else{
  147. $user['group'] = $group_list[1];
  148. }
  149. $GLOBALS['user'] = $user;
  150. $this->assign('user',$user);
  151. }
  152. protected function label_comment()
  153. {
  154. $comment = config('maccms.comment');
  155. $this->assign('comment',$comment);
  156. }
  157. /**
  158. * 详情页:将 AI SEO 或默认字段合并到 maccms,供模板使用 page_detail_* 变量
  159. */
  160. protected function mergeDetailSeoIntoMaccms($mid, array $info, $seoAi)
  161. {
  162. $cfg = isset($GLOBALS['config']['ai_seo']) ? $GLOBALS['config']['ai_seo'] : [];
  163. if (empty($cfg['template_inject']) || (string)$cfg['template_inject'] !== '1') {
  164. return;
  165. }
  166. if (!isset($this->view->maccms)) {
  167. return;
  168. }
  169. $mac = $this->view->maccms;
  170. if (!is_array($mac)) {
  171. return;
  172. }
  173. $row = [];
  174. if ($seoAi) {
  175. if (is_object($seoAi) && method_exists($seoAi, 'toArray')) {
  176. $row = $seoAi->toArray();
  177. } elseif (is_array($seoAi)) {
  178. $row = $seoAi;
  179. }
  180. }
  181. $siteName = isset($GLOBALS['config']['site']['site_name']) ? (string)$GLOBALS['config']['site']['site_name'] : '';
  182. if ((int)$mid === 1) {
  183. $defaultTitle = (string)$info['vod_name'] . ($siteName !== '' ? ' - ' . $siteName : '');
  184. $defaultKw = mac_format_text(trim((string)$info['vod_tag'] . ',' . (string)$info['vod_class']), true);
  185. $defaultDesc = trim(strip_tags((string)$info['vod_blurb']));
  186. if ($defaultDesc === '') {
  187. $defaultDesc = mac_substring(strip_tags((string)$info['vod_content']), 160);
  188. }
  189. } else {
  190. $defaultTitle = (string)$info['art_name'] . ($siteName !== '' ? ' - ' . $siteName : '');
  191. $defaultKw = mac_format_text(trim((string)$info['art_tag'] . ',' . (string)$info['art_class']), true);
  192. $defaultDesc = trim(strip_tags((string)$info['art_blurb']));
  193. if ($defaultDesc === '') {
  194. $plain = str_replace('$$$', '', strip_tags((string)$info['art_content']));
  195. $defaultDesc = mac_substring($plain, 160);
  196. }
  197. }
  198. $mac['page_detail_title'] = mac_filter_xss(!empty($row['seo_title']) ? (string)$row['seo_title'] : $defaultTitle);
  199. $mac['page_detail_keywords'] = mac_filter_xss(!empty($row['seo_keywords']) ? (string)$row['seo_keywords'] : $defaultKw);
  200. $mac['page_detail_description'] = mac_filter_xss(!empty($row['seo_description']) ? (string)$row['seo_description'] : $defaultDesc);
  201. $this->assign('maccms', $mac);
  202. }
  203. protected function label_search($param)
  204. {
  205. $param = mac_filter_words($param);
  206. $param = mac_search_len_check($param);
  207. // vod/search 各个参数下都可能出现回显关键词
  208. if(!empty($GLOBALS['config']['app']['wall_filter'])){
  209. $param = mac_escape_param($param);
  210. }
  211. $this->assign('param',$param);
  212. }
  213. protected function label_type($view=0, $type_id_specified = 0)
  214. {
  215. $param = mac_param_url();
  216. $param = mac_filter_words($param);
  217. $param = mac_search_len_check($param);
  218. $info = mac_label_type($param, $type_id_specified);
  219. if(!empty($GLOBALS['config']['app']['wall_filter'])){
  220. $param['wd'] = mac_escape_param($param['wd']);
  221. }
  222. $this->assign('param',$param);
  223. $this->assign('obj',$info);
  224. if(empty($info)){
  225. return $this->error(lang('controller/get_type_err'));
  226. }
  227. if($view<2) {
  228. $res = $this->check_user_popedom($info['type_id'], 1);
  229. if($res['code']>1){
  230. echo $this->error($res['msg'], mac_url('user/index') );
  231. exit;
  232. }
  233. }
  234. return $info;
  235. }
  236. protected function label_actor($total='')
  237. {
  238. $param = mac_param_url();
  239. $this->assign('param',$param);
  240. }
  241. protected function label_actor_detail($info=[],$view=0)
  242. {
  243. $param = mac_param_url();
  244. $this->assign('param',$param);
  245. if(empty($info)) {
  246. $res = mac_label_actor_detail($param);
  247. if ($res['code'] > 1) {
  248. $this->page_error($res['msg']);;
  249. }
  250. $info = $res['info'];
  251. }
  252. if(empty($info['actor_tpl'])){
  253. $info['actor_tpl'] = $info['type']['type_tpl_detail'];
  254. }
  255. if($view <2) {
  256. $popedom = $this->check_user_popedom($info['type_id'], 2,$param,'actor',$info);
  257. $this->assign('popedom',$popedom);
  258. if($popedom['code']>1){
  259. $this->assign('obj',$info);
  260. if($popedom['confirm']==1){
  261. echo $this->fetch('actor/confirm');
  262. exit;
  263. }
  264. echo $this->error($popedom['msg'], mac_url('user/index') );
  265. exit;
  266. }
  267. }
  268. $this->assign('obj',$info);
  269. $comment = config('maccms.comment');
  270. $this->assign('comment',$comment);
  271. return $info;
  272. }
  273. protected function label_role($total='')
  274. {
  275. $param = mac_param_url();
  276. $param = mac_filter_words($param);
  277. $param = mac_search_len_check($param);
  278. if(!empty($GLOBALS['app']['wall_filter'])){
  279. $param['wd'] = mac_escape_param($param['wd']);
  280. }
  281. $this->assign('param',$param);
  282. }
  283. protected function label_role_detail($info=[])
  284. {
  285. $param = mac_param_url();
  286. $this->assign('param',$param);
  287. if(empty($info)) {
  288. $res = mac_label_role_detail($param);
  289. if ($res['code'] > 1) {
  290. $this->page_error($res['msg']);;
  291. }
  292. $info = $res['info'];
  293. }
  294. $this->assign('obj',$info);
  295. $comment = config('maccms.comment');
  296. $this->assign('comment',$comment);
  297. return $info;
  298. }
  299. protected function label_website_detail($info=[],$view=0)
  300. {
  301. $param = mac_param_url();
  302. $this->assign('param',$param);
  303. if(empty($info)) {
  304. $res = mac_label_website_detail($param);
  305. if ($res['code'] > 1) {
  306. $this->page_error($res['msg']);;
  307. }
  308. $info = $res['info'];
  309. }
  310. if(empty($info['website_tpl'])){
  311. $info['website_tpl'] = $info['type']['type_tpl_detail'];
  312. }
  313. if($view <2) {
  314. $popedom = $this->check_user_popedom($info['type_id'], 2,$param,'website',$info);
  315. $this->assign('popedom',$popedom);
  316. if($popedom['code']>1){
  317. $this->assign('obj',$info);
  318. if($popedom['confirm']==1){
  319. echo $this->fetch('website/confirm');
  320. exit;
  321. }
  322. echo $this->error($popedom['msg'], mac_url('user/index') );
  323. exit;
  324. }
  325. }
  326. $this->assign('obj',$info);
  327. $comment = config('maccms.comment');
  328. $this->assign('comment',$comment);
  329. return $info;
  330. }
  331. protected function label_topic_index($total='')
  332. {
  333. $param = mac_param_url();
  334. $this->assign('param',$param);
  335. if($total=='') {
  336. $where = [];
  337. $where['topic_status'] = ['eq', 1];
  338. $total = model('Topic')->countData($where);
  339. }
  340. $url = mac_url_topic_index(['page'=>'PAGELINK']);
  341. $__PAGING__ = mac_page_param($total,1,$param['page'],$url);
  342. $this->assign('__PAGING__',$__PAGING__);
  343. }
  344. protected function label_topic_detail($info=[])
  345. {
  346. $param = mac_param_url();
  347. $this->assign('param',$param);
  348. if(empty($info)) {
  349. $res = mac_label_topic_detail($param);
  350. if ($res['code'] > 1) {
  351. $this->page_error($res['msg']);;
  352. }
  353. $info = $res['info'];
  354. }
  355. $this->assign('obj',$info);
  356. $comment = config('maccms.comment');
  357. $this->assign('comment',$comment);
  358. return $info;
  359. }
  360. protected function label_art_detail($info=[],$view=0)
  361. {
  362. $param = mac_param_url();
  363. $this->assign('param',$param);
  364. if(empty($info)) {
  365. $res = mac_label_art_detail($param);
  366. if ($res['code'] > 1) {
  367. $this->page_error($res['msg']);;
  368. }
  369. $info = $res['info'];
  370. }
  371. if(empty($info['art_tpl'])){
  372. $info['art_tpl'] = $info['type']['type_tpl_detail'];
  373. }
  374. if($view <2) {
  375. $popedom = $this->check_user_popedom($info['type_id'], 2,$param,'art',$info);
  376. $this->assign('popedom',$popedom);
  377. if($popedom['code']>1){
  378. $this->assign('obj',$info);
  379. if($popedom['confirm']==1){
  380. echo $this->fetch('art/confirm');
  381. exit;
  382. }
  383. echo $this->error($popedom['msg'], mac_url('user/index') );
  384. exit;
  385. }
  386. }
  387. $this->assign('obj',$info);
  388. $seo_ai = model('SeoAiResult')->getByObject(2, intval($info['art_id']));
  389. $this->assign('seo_ai', $seo_ai);
  390. $this->mergeDetailSeoIntoMaccms(2, $info, $seo_ai);
  391. $url = mac_url_art_detail($info,['page'=>'PAGELINK']);
  392. $__PAGING__ = mac_page_param($info['art_page_total'],1,$param['page'],$url);
  393. $this->assign('__PAGING__',$__PAGING__);
  394. $this->label_comment();
  395. return $info;
  396. }
  397. protected function label_vod_detail($info=[],$view=0)
  398. {
  399. $param = mac_param_url();
  400. $this->assign('param',$param);
  401. if(empty($info)) {
  402. $res = mac_label_vod_detail($param);
  403. if ($res['code'] > 1){
  404. $this->page_error($res['msg']);
  405. }
  406. $info = $res['info'];
  407. }
  408. if(empty($info['vod_tpl'])){
  409. $info['vod_tpl'] = $info['type']['type_tpl_detail'];
  410. }
  411. if(empty($info['vod_tpl_play'])){
  412. $info['vod_tpl_play'] = $info['type']['type_tpl_play'];
  413. }
  414. if(empty($info['vod_tpl_down'])){
  415. $info['vod_tpl_down'] = $info['type']['type_tpl_down'];
  416. }
  417. if($view <2) {
  418. $res = $this->check_user_popedom($info['type']['type_id'], 2);
  419. if($res['code']>1){
  420. echo $this->error($res['msg'], mac_url('user/index') );
  421. exit;
  422. }
  423. }
  424. $this->assign('obj',$info);
  425. $seo_ai = model('SeoAiResult')->getByObject(1, intval($info['vod_id']));
  426. $this->assign('seo_ai', $seo_ai);
  427. $this->mergeDetailSeoIntoMaccms(1, $info, $seo_ai);
  428. $this->label_comment();
  429. return $info;
  430. }
  431. protected function label_vod_role($info=[],$view=0)
  432. {
  433. $param = mac_param_url();
  434. $this->assign('param', $param);
  435. if (empty($info)) {
  436. $res = mac_label_vod_detail($param);
  437. if ($res['code'] > 1) {
  438. $this->page_error($res['msg']);
  439. }
  440. $info = $res['info'];
  441. }
  442. $role = mac_label_vod_role(['rid'=>intval($info['vod_id'])]);
  443. if ($role['code'] > 1) {
  444. return $this->error($role['msg']);
  445. }
  446. $info['role'] = $role['list'];
  447. $this->assign('obj',$info);
  448. }
  449. protected function label_vod_play($flag='play',$info=[],$view=0,$pe=0)
  450. {
  451. $param = mac_param_url();
  452. $this->assign('param',$param);
  453. if(empty($info)) {
  454. $res = mac_label_vod_detail($param);
  455. if ($res['code'] > 1) {
  456. $this->page_error($res['msg']);
  457. }
  458. $info = $res['info'];
  459. }
  460. if(empty($info['vod_tpl'])){
  461. $info['vod_tpl'] = $info['type']['type_tpl_detail'];
  462. }
  463. if(empty($info['vod_tpl_play'])){
  464. $info['vod_tpl_play'] = $info['type']['type_tpl_play'];
  465. }
  466. if(empty($info['vod_tpl_down'])){
  467. $info['vod_tpl_down'] = $info['type']['type_tpl_down'];
  468. }
  469. $trysee = 0;
  470. $urlfun='mac_url_vod_'.$flag;
  471. $listfun = 'vod_'.$flag.'_list';
  472. if($view <2) {
  473. if ($flag == 'play') {
  474. $trysee = $GLOBALS['config']['user']['trysee'];
  475. if($info['vod_trysee'] >0){
  476. $trysee = $info['vod_trysee'];
  477. }
  478. $popedom = $this->check_user_popedom($info['type_id'], ($pe==0 ? 3 : 5),$param,$flag,$info,$trysee);
  479. }
  480. else {
  481. $popedom = $this->check_user_popedom($info['type_id'], 4,$param,$flag,$info);
  482. }
  483. $this->assign('popedom',$popedom);
  484. if($pe==0 && $popedom['code']>1 && empty($popedom["trysee"])){
  485. $info['player_info']['flag'] = $flag;
  486. $this->assign('obj',$info);
  487. if($popedom['confirm']==1){
  488. $this->assign('flag',$flag);
  489. echo $this->fetch('vod/confirm');
  490. exit;
  491. }
  492. echo $this->error($popedom['msg'], mac_url('user/index') );
  493. exit;
  494. }
  495. }
  496. $player_info=[];
  497. $player_info['flag'] = $flag;
  498. $player_info['encrypt'] = intval($GLOBALS['config']['app']['encrypt']);
  499. $player_info['trysee'] = intval($trysee);
  500. $player_info['points'] = intval($info['vod_points_'.$flag]);
  501. $player_info['link'] = $urlfun($info,['sid'=>'{sid}','nid'=>'{nid}']);
  502. $player_info['link_next'] = '';
  503. $player_info['link_pre'] = '';
  504. $player_info['vod_data'] = [
  505. 'vod_name' => $info['vod_name'],
  506. 'vod_actor' => $info['vod_actor'],
  507. 'vod_director' => $info['vod_director'],
  508. 'vod_class' => $info['vod_class'],
  509. ];
  510. if($param['nid']>1){
  511. $player_info['link_pre'] = $urlfun($info,['sid'=>$param['sid'],'nid'=>$param['nid']-1]);
  512. }
  513. if($param['nid'] < $info['vod_'.$flag.'_list'][$param['sid']]['url_count']){
  514. $player_info['link_next'] = $urlfun($info,['sid'=>$param['sid'],'nid'=>$param['nid']+1]);
  515. }
  516. $player_info['url'] = (string)$info[$listfun][$param['sid']]['urls'][$param['nid']]['url'];
  517. $player_info['url_next'] = (string)$info[$listfun][$param['sid']]['urls'][$param['nid']+1]['url'];
  518. if(substr($player_info['url'],0,6) == 'upload'){
  519. $player_info['url'] = MAC_PATH . $player_info['url'];
  520. }
  521. if(substr($player_info['url_next'],0,6) == 'upload'){
  522. $player_info['url_next'] = MAC_PATH . $player_info['url_next'];
  523. }
  524. $player_info['from'] = (string)$info[$listfun][$param['sid']]['from'];
  525. if((string)$info[$listfun][$param['sid']]['urls'][$param['nid']]['from'] != $player_info['from']){
  526. $player_info['from'] = (string)$info[$listfun][$param['sid']]['urls'][$param['nid']]['from'];
  527. }
  528. $player_info['server'] = (string)$info[$listfun][$param['sid']]['server'];
  529. $player_info['note'] = (string)$info[$listfun][$param['sid']]['note'];
  530. if($GLOBALS['config']['app']['encrypt']=='1'){
  531. $player_info['url'] = mac_escape($player_info['url']);
  532. $player_info['url_next'] = mac_escape($player_info['url_next']);
  533. }
  534. elseif($GLOBALS['config']['app']['encrypt']=='2'){
  535. $player_info['url'] = base64_encode(mac_escape($player_info['url']));
  536. $player_info['url_next'] = base64_encode(mac_escape($player_info['url_next']));
  537. }
  538. $player_info['id'] = $param['id'];
  539. $player_info['sid'] = $param['sid'];
  540. $player_info['nid'] = $param['nid'];
  541. $info['player_info'] = $player_info;
  542. $this->assign('obj',$info);
  543. $seo_ai = model('SeoAiResult')->getByObject(1, intval($info['vod_id']));
  544. $this->assign('seo_ai', $seo_ai);
  545. $this->mergeDetailSeoIntoMaccms(1, $info, $seo_ai);
  546. $pwd_key = '1-'.($flag=='play' ?'4':'5').'-'.$info['vod_id'];
  547. if( $pe==0 && $flag=='play' && ($popedom['trysee']>0 ) || ($info['vod_pwd_'.$flag]!='' && session($pwd_key)!='1') || ($info['vod_copyright']==1 && $GLOBALS['config']['app']['copyright_status']==4) ) {
  548. $id = $info['vod_id'];
  549. if($GLOBALS['config']['rewrite']['vod_id']==2){
  550. $id = mac_alphaID($info['vod_id'],false,$GLOBALS['config']['rewrite']['encode_len'],$GLOBALS['config']['rewrite']['encode_key']);
  551. }
  552. $dy_play = mac_url('index/vod/'.$flag.'er',['id'=>$id,'sid'=>$param['sid'],'nid'=>$param['nid']]);
  553. $this->assign('player_data','');
  554. $this->assign('player_js','<div class="MacPlayer" style="z-index:99999;width:100%;height:100%;margin:0px;padding:0px;"><iframe id="player_if" name="player_if" src="'.$dy_play.'" style="z-index:9;width:100%;height:100%;" border="0" marginWidth="0" frameSpacing="0" marginHeight="0" frameBorder="0" scrolling="no" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen" ></iframe></div>');
  555. }
  556. else {
  557. $this->assign('player_data', '<script type="text/javascript">var player_aaaa=' . json_encode($player_info) . '</script>');
  558. $this->assign('player_js', '<script type="text/javascript" src="' . MAC_PATH . 'static/js/playerconfig.js?t='.$this->_tsp.'"></script><script type="text/javascript" src="' . MAC_PATH . 'static/js/player.js?t=a'.$this->_tsp.'"></script>');
  559. }
  560. $this->label_comment();
  561. return $info;
  562. }
  563. }