private static function GetFolders($Version)
 {
     $NewVersionPath = LauncherAPI::$VersionsPath . $Version;
     $VersionFolder = 'FreedomNet.' . LauncherAPI::VersionToString($Version);
     if (is_dir($NewVersionPath)) {
         $Iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($NewVersionPath), RecursiveIteratorIterator::SELF_FIRST);
         $Folders = [];
         foreach ($Iterator as $File) {
             if ($File->isDir()) {
                 $Folders[] = $File->getRealpath();
             }
         }
         $Folders = Text::UniqueSingle($Folders);
         if (Text::ASearch($Folders, substr(LauncherAPI::$VersionsPath, 0, -1)) != false) {
             unset($Folders[Text::ASearch($Folders, substr(LauncherAPI::$VersionsPath, 0, -1))]);
         }
         if ($Folders[0] == $NewVersionPath) {
             unset($Folders[0]);
         }
         $FinalList = [];
         foreach ($Folders as $Folder) {
             $InVersionFolder = str_replace($NewVersionPath, '', $Folder);
             $FinalList[] = $VersionFolder . $InVersionFolder;
         }
         return $FinalList;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
                     echo Text::SimpleJson(1200, 'status', 'No Update Needed');
                 } else {
                     echo Text::SimpleJson(1201, 'status', $UpdateStatus);
                 }
             }
             break;
         case 'downloadupdatelist':
             if (Text::IsRequestSet($_REQUEST, ['assembly_version', 'updating_to'])) {
                 if (LauncherAPI::VersionToString($_REQUEST['updating_to']) < LauncherAPI::VersionToString($_REQUEST['assembly_version'])) {
                     echo Text::SimpleJson(1403, 'status', 'Can\'t upgrade to lower version');
                 } else {
                     $Build = LauncherAPI::BuildUpdateList($_REQUEST['updating_to']);
                     if (!$Build) {
                         echo Text::SimpleJson(1500, 'status', 'Specified Update Version does not exists');
                     } else {
                         Text::toJson(LauncherAPI::BuildUpdateList($_REQUEST['updating_to']), ['JSON_UNESCAPED_UNICODE']);
                     }
                 }
             } else {
                 echo "Not Set!";
             }
             break;
     }
     break;
 case 'account':
     API::EnableAPIExtension('Account');
     switch ($_REQUEST['method']) {
         case 'authorize':
             AccountAPI::Authorize($_REQUEST['username'], $_REQUEST['password'], $_REQUEST['jsonp']);
             break;
         case 'android':