Ejemplo n.º 1
0
 function getLang()
 {
     //print_r("test");
     if (BG_SWITCH_LANG == 1) {
         //语言开关为开
         $str_lang = fn_getSafe(fn_get("lang"), "txt", "");
         if ($str_lang) {
             //查询串指定
             $_str_return = $str_lang;
         } else {
             /*if (fn_cookie("cookie_lang")) { //cookie 指定
                   $_str_return = fn_cookie("cookie_lang");
               } else { //系统识别*/
             if (fn_server("HTTP_ACCEPT_LANGUAGE")) {
                 $_str_agentUser = fn_server("HTTP_ACCEPT_LANGUAGE");
                 if (stristr($_str_agentUser, "zh")) {
                     $_str_return = BG_DEFAULT_LANG;
                     //客户端是中文
                 } else {
                     $_str_return = "en";
                     //客户端是英文
                 }
             } else {
                 $_str_return = BG_DEFAULT_LANG;
                 //客户端是中文
             }
             //}
         }
     } else {
         //语言开关为关
         $_str_return = BG_DEFAULT_LANG;
         //默认语言
     }
     $this->config["lang"] = $_str_return;
 }
Ejemplo n.º 2
0
/** 获取 IP
 * fn_getIp function.
 *
 * @access public
 * @return void
 */
function fn_getIp()
{
    if (isset($_SERVER)) {
        if (fn_isEmpty(fn_server("REMOTE_ADDR"))) {
            $_str_ip = "0.0.0.0";
        } else {
            $_str_ip = fn_server("REMOTE_ADDR");
        }
    } else {
        if (fn_isEmpty(getenv("REMOTE_ADDR"))) {
            $_str_ip = "0.0.0.0";
        } else {
            $_str_ip = getenv("REMOTE_ADDR");
        }
    }
    return $_str_ip;
}
Ejemplo n.º 3
0
 function getUi()
 {
     if (BG_SWITCH_UI == true) {
         //界面开关为开
         $str_ui = fn_getSafe(fn_get("ui"), "txt", "");
         if ($str_ui) {
             //查询串指定
             $_str_return = $str_ui;
         } else {
             /*if (fn_cookie("cookie_ui")) { //cookie 指定
             			$_str_return = fn_cookie("cookie_ui");
             		} else { //系统识别*/
             if (fn_server("HTTP_USER_AGENT")) {
                 $_str_agentUser = strtolower(fn_server("HTTP_USER_AGENT"));
                 //客户端信息
                 $_str_agentMobile = "/(symbian|symbos|phone|mobile|320x320|240x320|176x220|android|MicroMessenger)/i";
                 //移动设备界定串
                 $_str_agentPad = "/(ipad|honeycomb)/i";
                 //平板电脑界定串
                 if (preg_match($_str_agentMobile, $_str_agentUser)) {
                     if (preg_match($_str_agentPad, $_str_agentUser)) {
                         //客户端是平板
                         $_str_return = BG_DEFAULT_UI;
                     } else {
                         $_str_return = "mobile";
                         //客户端是移动设备
                     }
                 } else {
                     $_str_return = BG_DEFAULT_UI;
                     //客户端是 pc
                 }
             } else {
                 $_str_return = BG_DEFAULT_UI;
                 //客户端是 pc
             }
             //}
         }
     } else {
         //界面开关为关
         $_str_return = BG_DEFAULT_UI;
         //默认界面
     }
     //setcookie("cookie_ui", $_str_return); //客户端是移动设备
     $this->config["ui"] = $_str_return;
 }
Ejemplo n.º 4
0
/**
 * fn_getIp function.
 *
 * @access public
 * @return void
 */
function fn_getIp($str_ipTrue = true)
{
    if (isset($_SERVER)) {
        if ($str_ipTrue) {
            if (fn_server("HTTP_X_FORWARDED_FOR")) {
                $_arr_ips = explode(",", fn_server("HTTP_X_FORWARDED_FOR"));
                foreach ($_arr_ips as $_key => $_value) {
                    $_value = trim($_value);
                    if ($_value != "unknown") {
                        $_str_ip = $_value;
                        break;
                    }
                }
            } elseif (fn_server("HTTP_CLIENT_IP")) {
                $_str_ip = fn_server("HTTP_CLIENT_IP");
            } elseif (fn_server("REMOTE_ADDR")) {
                $_str_ip = fn_server("REMOTE_ADDR");
            } else {
                $_str_ip = "0.0.0.0";
            }
        } else {
            if (fn_server("REMOTE_ADDR")) {
                $_str_ip = fn_server("REMOTE_ADDR");
            } else {
                $_str_ip = "0.0.0.0";
            }
        }
    } else {
        if ($str_ipTrue) {
            if (getenv("HTTP_X_FORWARDED_FOR")) {
                $_str_ip = getenv("HTTP_X_FORWARDED_FOR");
            } elseif (getenv("HTTP_CLIENT_IP")) {
                $_str_ip = getenv("HTTP_CLIENT_IP");
            } else {
                $_str_ip = getenv("REMOTE_ADDR");
            }
        } else {
            $_str_ip = getenv("REMOTE_ADDR");
        }
    }
    return $_str_ip;
}
Ejemplo n.º 5
0
 /** 显示界面
  * tplDisplay function.
  *
  * @access public
  * @param mixed $str_view
  * @param string $arr_tplData (default: "")
  * @return void
  */
 function tplDisplay($str_view, $arr_tplData = "")
 {
     $this->common["token_session"] = fn_token();
     if (fn_server("REQUEST_URI")) {
         $this->common["thisUrl"] = base64_encode(fn_server("REQUEST_URI"));
     }
     $this->common["ssid"] = session_id();
     $this->common["view"] = $GLOBALS["view"];
     $this->obj_smarty->assign("common", $this->common);
     $this->obj_smarty->assign("config", $this->config);
     $this->obj_smarty->assign("lang", $this->lang);
     $this->obj_smarty->assign("status", $this->status);
     $this->obj_smarty->assign("type", $this->type);
     $this->obj_smarty->assign("allow", $this->allow);
     $this->obj_smarty->assign("alert", $this->alert);
     $this->obj_smarty->assign("install", $this->install);
     $this->obj_smarty->assign("opt", $this->opt);
     $this->obj_smarty->assign("adminMod", $this->adminMod);
     $this->obj_smarty->assign("tplData", $arr_tplData);
     $this->obj_smarty->display($str_view);
 }
Ejemplo n.º 6
0
<?php

/*-----------------------------------------------------------------
!!!!警告!!!!
以下为系统文件,请勿修改
-----------------------------------------------------------------*/
//不能非法包含或直接执行
if (!defined("IN_BAIGO")) {
    exit("Access Denied");
}
if ($GLOBALS["adminLogged"]["alert"] != "y020102") {
    if ($GLOBALS["view"] == "iframe") {
        $_str_location = "Location: " . BG_URL_ADMIN . "ctl.php?mod=alert&act_get=show&alert=" . $GLOBALS["adminLogged"]["alert"] . "&view=" . $GLOBALS["view"];
    } else {
        if (!fn_isEmpty(fn_server("REQUEST_URI"))) {
            $_str_attach = fn_forward(fn_server("REQUEST_URI"));
        }
        $_str_location = "Location: " . BG_URL_ADMIN . "ctl.php?mod=logon&forward=" . $_str_attach;
    }
    header($_str_location);
    //未登录就跳转至登录界面
    exit;
}
Ejemplo n.º 7
0
<?php

/*-----------------------------------------------------------------
!!!!警告!!!!
以下为系统文件,请勿修改
-----------------------------------------------------------------*/
//不能非法包含或直接执行
if (!defined("IN_BAIGO")) {
    exit("Access Denied");
}
if ($GLOBALS["adminLogged"]["alert"] != "y020102") {
    if ($GLOBALS["view"]) {
        $_str_location = "Location: " . BG_URL_ADMIN . "ctl.php?mod=alert&act_get=show&alert=" . $GLOBALS["adminLogged"]["alert"] . "&view=" . $GLOBALS["view"];
    } else {
        if (fn_server("REQUEST_URI")) {
            $_str_attach = base64_encode(fn_server("REQUEST_URI"));
        }
        $_str_location = "Location: " . BG_URL_ADMIN . "ctl.php?mod=logon&forward=" . $_str_attach;
    }
    header($_str_location);
    //未登录就跳转至登录界面
    exit;
}
Ejemplo n.º 8
0
 function ver_process($method = "auto")
 {
     $_arr_data = array("name" => "baigoADS", "ver" => PRD_ADS_VER, "referer" => fn_forward(fn_server("SERVER_NAME") . BG_URL_ROOT), "method" => $method);
     $_str_ver = fn_http(PRD_VER_CHECK, $_arr_data, "get");
     $this->obj_dir->put_file(BG_PATH_CACHE . "sys/latest_ver.json", $_str_ver["ret"]);
 }
Ejemplo n.º 9
0
<?php

/*-----------------------------------------------------------------

!!!!警告!!!!
以下为系统文件,请勿修改

-----------------------------------------------------------------*/
//不能非法包含或直接执行
if (!defined("IN_BAIGO")) {
    exit("Access Denied");
}
if ($GLOBALS["adminLogged"]["alert"] != "y020102") {
    if ($GLOBALS["view"]) {
        $_str_location = "Location: " . BG_URL_ADMIN . "ctl.php?mod=alert&act_get=show&alert=" . $GLOBALS["adminLogged"]["alert"] . "&view=" . $GLOBALS["view"];
    } else {
        if (fn_server("REQUEST_URI")) {
            $_str_forward = fn_forward(fn_server("REQUEST_URI"));
        } else {
            $_str_forward = fn_forward(BG_URL_ADMIN . "ctl.php");
        }
        $_str_location = "Location: " . BG_URL_ADMIN . "ctl.php?mod=logon&forward=" . $_str_forward;
    }
    header($_str_location);
    //未登录就跳转至登录界面
    exit;
}