Exemple #1
0
 /**
  * Disable app and remove the app files recursilvely from the directory
  */
 public function removeApp()
 {
     if ($this->app) {
         if (self::exists($this->app) !== false) {
             $dir = $this->appDir;
             if (file_exists("{$dir}/uninstall.php")) {
                 include_once "{$dir}/uninstall.php";
             }
             $this->disableApp();
             $files = array_diff(scandir($dir), array('.', '..'));
             foreach ($files as $file) {
                 if (is_dir("{$dir}/{$file}")) {
                     delTree("{$dir}/{$file}");
                 } else {
                     \Lobby\FS::remove("{$dir}/{$file}");
                 }
             }
             return rmdir($dir);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemple #2
0
 /**
  * Update the App with the given ID
  */
 public static function app($id)
 {
     if ($id == "") {
         echo ser("Error", "No App Mentioned to update.");
     }
     self::log("Installing Latest Version of App {$id}");
     $url = Server::download("app", $id);
     $zipFile = L_DIR . "/contents/update/{$id}.zip";
     self::zipFile($url, $zipFile);
     // Un Zip the file
     if (class_exists("ZipArchive")) {
         $zip = new \ZipArchive();
         if ($zip->open($zipFile) != "true") {
             self::log("Unable to open Downloaded App ({$id}) File : {$zipFile}");
             echo ser("Error", "Unable to open Downloaded App File.");
         } else {
             /**
              * Extract App
              */
             $appDir = APPS_DIR . "/{$id}";
             if (!file_exists($appDir)) {
                 mkdir($appDir);
             }
             $zip->extractTo($appDir);
             $zip->close();
             FS::remove($zipFile);
             self::log("Installed App {$id}");
             return true;
         }
     } else {
         throw new \Exception("Unable to Install App, because <a href='" . L_SERVER . "/docs/quick#section-requirements' target='_blank'>PHP Zip Extension</a> is not installed");
     }
 }
Exemple #3
0
            // Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
            $do = filetype($location . $file) == 'dir' ? 'addDir' : 'addFile';
            $this->{$do}($location . $file, $name . $file);
        }
    }
}
$za = new FlxZipArchive();
$res = $za->open($zip_file_name, ZipArchive::CREATE);
if ($res === TRUE) {
    $za->addDir($the_folder, basename($the_folder));
    $za->close();
} else {
    echo 'Could not create a zip archive';
}
if ($download_file) {
    ob_get_clean();
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private", false);
    header("Content-Type: application/zip");
    header("Content-Disposition: attachment; filename=" . basename($zip_file_name) . ";");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . filesize($zip_file_name));
    readfile($zip_file_name);
}
/**
 * Delete .zip File
 */
\Lobby\FS::remove($zip_file_name);
Exemple #4
0
 /**
  * Disable app and remove the app files recursilvely from the directory
  */
 public function removeApp()
 {
     if ($this->app) {
         if (self::exists($this->app) !== false) {
             $dir = $this->dir;
             if (file_exists("{$dir}/uninstall.php")) {
                 include_once "{$dir}/uninstall.php";
             }
             $this->disableApp();
             return \Lobby\FS::remove($dir);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemple #5
0
 /**
  * Update the App with the given ID
  */
 public static function app($id)
 {
     if ($id == "") {
         ser("Error", "No App Mentioned to update.");
     }
     \Lobby::log("Installing Latest Version of App {$id}");
     $url = \Lobby\Server::download("app", $id);
     $zipFile = L_DIR . "/contents/update/{$id}.zip";
     self::zipFile($url, $zipFile);
     // Un Zip the file
     $zip = new \ZipArchive();
     if ($zip->open($zipFile) != "true") {
         \Lobby::log("Unable to open Downloaded App ({$id}) File : {$zipFile}");
         ser("Error", "Unable to open Downloaded App File.");
     } else {
         /**
          * Extract App
          */
         $zip->extractTo(APPS_DIR);
         $zip->close();
         \Lobby\FS::remove($zipFile);
         \Lobby::log("Installed App {$id}");
         return true;
     }
 }