Esempio n. 1
0
 /**
  * 多终端适配
  * @param  [type] &$config [系统配置]
  * @return [type]          [description]
  */
 private static function multiple_device(&$config)
 {
     $template = $config['template'];
     $_device = iPHP::PG('device');
     if ($_device) {
         /**
          * 判断指定设备
          * @var [type]
          */
         foreach ((array) $template['device'] as $key => $device) {
             if ($device['tpl'] && ($device['ua'] == $_device || $device['name'] == $_device)) {
                 $device_name = $device['name'];
                 $device_tpl = $device['tpl'];
                 $domain = $device['domain'];
                 break;
             }
         }
     }
     /**
      * 无指定设备 判断USER_AGENT
      */
     if (empty($device_tpl)) {
         foreach ((array) $template['device'] as $key => $device) {
             if ($device['tpl'] && self::device_agent($device['ua'])) {
                 $device_name = $device['name'];
                 $device_tpl = $device['tpl'];
                 $domain = $device['domain'];
                 break;
             }
         }
     }
     iPHP::$mobile = false;
     if ($device_tpl) {
         //设备模板
         $def_tpl = $device_tpl;
     } else {
         //检查是否移动设备
         if (self::device_agent($template['mobile']['agent'])) {
             iPHP::$mobile = true;
             $mobile_tpl = $template['mobile']['tpl'];
             $device_name = 'mobile';
             $def_tpl = $mobile_tpl;
             $domain = $template['mobile']['domain'];
         }
     }
     if (empty($def_tpl)) {
         $device_name = 'desktop';
         $def_tpl = $template['desktop']['tpl'];
         $domain = false;
     }
     define('iPHP_ROUTER_URL', $config['router']['URL']);
     $domain && ($config['router'] = str_replace($config['router']['URL'], $domain, $config['router']));
     define('iPHP_DEFAULT_TPL', $def_tpl);
     define('iPHP_MOBILE_TPL', $mobile_tpl);
     define('iPHP_DEVICE', $device_name);
     define('iPHP_HOST', $config['router']['URL']);
     header("Access-Control-Allow-Origin: " . iPHP_HOST);
     header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');
 }
Esempio n. 2
0
 * @licence http://www.idreamsoft.com/license.php
 * @version 6.0.0
 * @$Id: admincp.class.php 2361 2014-02-22 01:52:39Z coolmoo $
 */
defined('iPHP') or exit('What are you doing?');
iDB::$show_errors = true;
iPHP::$dialog['title'] = 'iCMS';
define('iCMS_SUPERADMIN_UID', '1');
define('__ADMINCP__', __SELF__ . '?app');
define('ACP_PATH', iPHP_APP_DIR . '/admincp');
define('ACP_HOST', "http://" . $_SERVER['HTTP_HOST']);
require iPHP_APP_CORE . '/iMenu.class.php';
require iPHP_APP_CORE . '/iMember.class.php';
iMember::$LOGIN_TPL = ACP_PATH;
iMember::$AUTH = 'ADMIN_AUTH';
iMember::$AJAX = iPHP::PG('ajax');
$_GET['do'] == 'seccode' && iACP::get_seccode();
class iACP
{
    public static $apps = NULL;
    public static $frames = NULL;
    public static $menu = NULL;
    public static $app = NULL;
    public static $app_name = NULL;
    public static $app_do = NULL;
    public static $app_args = NULL;
    public static $app_method = NULL;
    public static $app_tpl = NULL;
    public static $app_path = NULL;
    public static $app_file = NULL;
    public static function init()