Vergleich inc/class_language.php - 1.8.9 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 8Zeile 8
 *
*/


 *
*/


 
#[AllowDynamicProperties]

class MyLanguage
{


class MyLanguage
{


Zeile 19Zeile 20
	public $path;

/**

	public $path;

/**

	 * The language we are using.



	 * The language we are using and the area (if admin).
*
* For example 'english' or 'english/admin'.

	 *
* @var string
*/
public $language;

/**

	 *
* @var string
*/
public $language;

/**

	 * The fallback language we are using.










	 * The fallback language we are using and the area (if admin).
*
* For example 'english' or 'english/admin'.
*
* @var string
*/
public $fallback = 'english';

/**
* The fallback language we are using.

	 *
* @var string

	 *
* @var string

	 */
public $fallback = 'english';

	 */
public $fallbackLanguage = 'english';


/**
* Information about the current language.


/**
* Information about the current language.

Zeile 38Zeile 50
	 * @var array
*/
public $settings;

	 * @var array
*/
public $settings;





	/**
* Set the path for the language folder.
*

	/**
* Set the path for the language folder.
*

Zeile 51Zeile 63

/**
* Check if a specific language exists.


/**
* Check if a specific language exists.

	 *

	 *

	 * @param string $language The language to check for.
* @return boolean True when exists, false when does not exist.
*/

	 * @param string $language The language to check for.
* @return boolean True when exists, false when does not exist.
*/

Zeile 74Zeile 86
	 * @param string $language The language to use.
* @param string $area The area to set the language for.
*/

	 * @param string $language The language to use.
* @param string $area The area to set the language for.
*/

	function set_language($language="english", $area="user")

	function set_language($language="", $area="user")

	{
global $mybb;


	{
global $mybb;


		$language = preg_replace("#[^a-z0-9\-_]#i", "", $language);

// Default language is English.

		$language = preg_replace("#[^a-z0-9\-_]#i", "", $language);

// Use the board's default language

		if($language == "")
{

		if($language == "")
{

			$language = "english";

			$language = $mybb->settings['bblanguage'];

		}

// Check if the language exists.

		}

// Check if the language exists.

Zeile 106Zeile 118
					if(!is_dir($this->path."/english/{$area}"))
{
die("Your forum does not contain an Administration set. Please reupload the english language administration pack.");

					if(!is_dir($this->path."/english/{$area}"))
{
die("Your forum does not contain an Administration set. Please reupload the english language administration pack.");

					}

					}

					else
{
$language = "english";

					else
{
$language = "english";

Zeile 118Zeile 130
				}
}
$this->language = $language."/{$area}";

				}
}
$this->language = $language."/{$area}";

			$this->fallback = $this->fallback."/{$area}";

			$this->fallback = $this->fallbackLanguage."/{$area}";

		}
}


		}
}


Zeile 126Zeile 138
	 * Load the language variables for a section.
*
* @param string $section The section name.

	 * Load the language variables for a section.
*
* @param string $section The section name.

	 * @param boolean $isdatahandler Is this a datahandler?

	 * @param boolean $forceuserarea Should use the user area even if in admin? For example for datahandlers

	 * @param boolean $supress_error supress the error if the file doesn't exist?
*/

	 * @param boolean $supress_error supress the error if the file doesn't exist?
*/

	function load($section, $isdatahandler=false, $supress_error=false)

	function load($section, $forceuserarea=false, $supress_error=false)

	{

	{

		// Assign language variables.
// Datahandlers are never in admin lang directory.
if($isdatahandler === true)


		$language = $this->language;
$fallback = $this->fallback;

if($forceuserarea === true)

		{

		{

			$lfile = $this->path."/".str_replace('/admin', '', $this->language)."/".$section.".lang.php";
}
else
{
$lfile = $this->path."/".$this->language."/".$section.".lang.php";

			$language = str_replace('/admin', '', $language);
$fallback = str_replace('/admin', '', $fallback);




		}

		}

 

$lfile = $this->path."/".$language."/".$section.".lang.php";
$ffile = $this->path."/".$fallback."/".$section.".lang.php";


if(file_exists($lfile))
{


if(file_exists($lfile))
{

			require_once $lfile;

			require $lfile;

		}

		}

		elseif(file_exists($this->path."/".$this->fallback."/".$section.".lang.php"))

		elseif(file_exists($ffile))

		{

		{

			require_once $this->path."/".$this->fallback."/".$section.".lang.php";

			require $ffile;

		}
else
{

		}
else
{

Zeile 159Zeile 172
		}

// We must unite and protect our language variables!

		}

// We must unite and protect our language variables!

		$lang_keys_ignore = array('language', 'path', 'settings');

		$lang_keys_ignore = array('language', 'fallback', 'fallbackLanguage', 'path', 'settings');


if(isset($l) && is_array($l))
{


if(isset($l) && is_array($l))
{