|
|
<?php
|
|
|
|
|
|
|
|
|
namespace Media\Controller;
|
|
|
use Think\Controller;
|
|
|
|
|
|
/**
|
|
|
* 前台公共控制器
|
|
|
* 为防止多分组Controller名称冲突,公共Controller名称统一使用分组名称
|
|
|
*/
|
|
|
class HomeController extends Controller {
|
|
|
|
|
|
/* 空操作,用于输出404页面 */
|
|
|
public function _empty(){
|
|
|
$this->redirect('Index/index');
|
|
|
}
|
|
|
|
|
|
|
|
|
protected function _initialize(){
|
|
|
/* 读取站点配置 */
|
|
|
$config = api('Config/lists');
|
|
|
C($config); //添加配置
|
|
|
|
|
|
if(!C('WEB_SITE_CLOSE')){
|
|
|
$this->error('站点已经关闭,请稍后访问~');
|
|
|
}
|
|
|
|
|
|
if(!C('PC_DISPLAY_STATUS')) {
|
|
|
$this->display('Public/404');exit;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public function __construct(){
|
|
|
parent::__construct();
|
|
|
|
|
|
if(!C('PC_DISPLAY_STATUS')) {
|
|
|
$this->display('Public/404');exit;
|
|
|
}
|
|
|
|
|
|
define('DISPLAY_SITE',1); /* 游戏中显示站点,即此游戏是否在此站显示 */
|
|
|
|
|
|
$_SESSION['media']="media.php";
|
|
|
$serverhost=$_SERVER['HTTP_HOST'];
|
|
|
if(strpos(strtolower($_SERVER['REQUEST_URI']),'index/download') === FALSE && strpos(strtolower($_SERVER['REQUEST_URI']),'index/qrcode/url') === FALSE && strpos(strtolower($_SERVER['REQUEST_URI']),'article/agreement') === FALSE ) {
|
|
|
if(is_mobile_request()){
|
|
|
$http = 'http';
|
|
|
if(is_https()){
|
|
|
$http = 'https';
|
|
|
}
|
|
|
if($_SERVER['REQUEST_URI']!='/'){
|
|
|
$url = str_replace('media.php','mobile.php',$_SERVER['REQUEST_URI']);
|
|
|
$headerurl = $http.'://'.$_SERVER["HTTP_HOST"].$url;
|
|
|
}else{
|
|
|
$headerurl = $http.'://'.$_SERVER["HTTP_HOST"].'/mobile.php';
|
|
|
}
|
|
|
Header("Location: $headerurl"); exit;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// 右上角广告
|
|
|
$single_img = M('adv','tab_')->where('pos_id=2 and status=1')->find();
|
|
|
$single_img['data'] =__ROOT__. get_cover($single_img['data'],'path');
|
|
|
$this->assign("single_img",$single_img);
|
|
|
}
|
|
|
|
|
|
/* 用户登录检测 */
|
|
|
protected function login(){
|
|
|
/* 用户登录检测 */
|
|
|
is_login() || $this->error('您还没有登录,请先登录!', U('User/login'));
|
|
|
}
|
|
|
|
|
|
}
|