⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tutorial.lib.php3

📁 使用PHP编程的聊天室
💻 PHP3
字号:
<?php
// Available languages for tutorial
$AvailableTutorials = array();
$languageDirectories = dir('./localization/');
while($name = $languageDirectories->read())
{
	if(is_dir('./localization/'.$name)
		&& file_exists('./localization/'.$name.'/regex.txt')
		&& file_exists('./localization/'.$name.'/localized.tutorial.php3'))
	{
		list($key) = file('./localization/'.$name.'/regex.txt');
		$AvailableTutorials[$key] = $name;
	};
};
$languageDirectories->close();
if (!function_exists("krsort")) include("./localization/sort_languages.php3");
krsort($AvailableTutorials);

function DetectTutorial($Str,$From)
{
	global $AvailableTutorials;
	global $L;

	$NotFound = true;
	reset($AvailableTutorials);
	while($NotFound && list($key, $name) = each($AvailableTutorials))
	{
		if (($From == 1 && eregi("^".$key."$",$Str)) || ($From == 2 && eregi("(\(|\[|;[[:space:]])".$key."(;|\]|\))",$Str)))
		{
			$L = $AvailableTutorials[$key];
			$NotFound = false;
		};
	};
};

// finds the appropriate language file
if (isset($HTTP_COOKIE_VARS["CookieLang"])) $CookieLang = $HTTP_COOKIE_VARS["CookieLang"];
if (isset($CookieLang) && file_exists("./localization/${L}/localized.tutorial.php3"))
{
	$L = $CookieLang;
}
elseif (getenv("HTTP_ACCEPT_LANGUAGE") != "")
{	
	$Accepted = explode(",", getenv("HTTP_ACCEPT_LANGUAGE"));
	DetectTutorial($Accepted[0],1);
}
elseif (getenv("HTTP_USER_AGENT") != "")
{	
	DetectTutorial(getenv("HTTP_USER_AGENT"),2);
};

//if no language detected set the english one
if (!isset($L))
{
	$L = "english";
	$NoTranslation = "<CENTER><P CLASS='RedText'>Sorry but the tutorial hasn't been translated to your language at this time.</P></CENTER>";
};
	
// Clear the table
unset($AvailableTutorials);
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -