<?php

/*
  PHP version 5
  Copyright (c) 2002-2018 ECISP.CN、EarcLink.COM
  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖
  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220
 */

function espcms_lancode() {
	global $espcms_command;
	if (ESPCMS_ISADMIN && defined('ESPCMS_ISADMIN')) {
		if ($_GET['lng'] && preg_match("/^[a-z0-9]{2,50}$/i", $_GET['lng'])) {
			$lan_code = $_GET['lng'];
		} elseif (ESPCMS_CREAT && defined('ESPCMS_CREAT')) {
			$lan_code = ESPCMS_CREAT == 'cn' || ESPCMS_CREAT == 'big5' ? 'cn' : ESPCMS_CREAT;
		} else {
			$cookie_lng = $_COOKIE['espcms_admin_lng_info'];
			$lan_code = $cookie_lng ? $cookie_lng : $espcms_command['DEFAULT_LNG'];
		}
	} else {
		$lan_code = ESPCMS_WEB_LAN == 'cn' || ESPCMS_WEB_LAN == 'big5' ? 'cn' : ESPCMS_WEB_LAN;
	}
	return $lan_code;
}

function espcms_url() {
	global $espcms_command;
	$url = espcms_host('URL');
	$www_url = $espcms_command['HTTP_PATHTYPE'] ? str_replace($url, '', ESPCMS_URL) : ESPCMS_URL;
	if (ESPCMS_WEB_TYPE == 'WAP' && defined('ESPCMS_WEB_TYPE')) {
		$www_url = str_replace('wap/', '', $www_url);
	}
	return $www_url;
}
