From 19c030281f9bb146a92577420fecbd9dd55095b3 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 18 Nov 2014 13:53:38 +0100 Subject: [PATCH] Fixed #1969 --- src/pocketmine/wizard/InstallerLang.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/wizard/InstallerLang.php b/src/pocketmine/wizard/InstallerLang.php index 79643ea97..159b7776d 100644 --- a/src/pocketmine/wizard/InstallerLang.php +++ b/src/pocketmine/wizard/InstallerLang.php @@ -53,16 +53,18 @@ public function __construct($lang = ""){ $this->lang = $lang; $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini"; }else{ - $l = glob(\pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . "_*.ini"); - if(count($l) > 0){ - $files = []; - foreach($l as $file){ - $files[$file] = filesize($file); + $files = []; + foreach(new \DirectoryIterator(\pocketmine\PATH . "src/pocketmine/lang/Installer/") as $file){ + if($file->getExtension() === "ini"){ + $files[$file->getFilename()] = $file->getSize(); } + } + + if(count($files) > 0){ arsort($files); reset($files); $l = key($files); - $l = substr($l, strrpos($l, "/") + 1, -4); + $l = substr($l, 0, -4); $this->lang = isset(self::$languages[$l]) ? $l : $lang; $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $l . ".ini"; }else{