<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
// 后台域名访问根目录时自动跳转到后台入口
if (!empty($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] === 'admin.xxx.com') {
    $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
    if ($uri === '/' || $uri === '' || rtrim($uri, '/') === '') {
        header('Location: /agentadmin.php', true, 302);
        exit;
    }
}
// 定义应用目录
define('APP_PATH', __DIR__ . '/../application/');
// 判断是否安装（优先读 public/install.lock，避免宝塔 open_basedir 限制 application 目录导致误判未安装并跳转 install.php）
$lockFile = __DIR__ . '/install.lock';
if (!is_file($lockFile)) {
    $lockFile = APP_PATH . 'admin/command/Install/install.lock';
    if (!@is_file($lockFile)) {
        header("location:./install.php");
        exit;
    }
}

// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';
