Beispiel #1
0
function decrypt($data, $key = null)
{
    return encry::decrypt($data, $key);
}
Beispiel #2
0
 public function DoIt($type = "pack", $encry_key = "", $separator = "|")
 {
     $this->pack_result = array();
     if ($type == "pack") {
         $this->pack_fp = fopen($this->pack_file, "wb");
         if (!$this->pack_fp) {
             $this->Error("Error Occurs In Creating Output File !");
             return false;
         }
         $time = $_SERVER['REQUEST_TIME'];
         if (count($this->file_list) > 0) {
             $this->PackFileList($separator);
         } else {
             $this->PackFile($this->pack_dir, $separator);
         }
         fclose($this->pack_fp);
         if ($_SERVER['REQUEST_TIME'] - $time <= 1) {
             sleep(1);
         }
         $this->WriteFile($this->pack_file, gzcompress($this->GetFile($this->pack_file), 9));
         if (!empty($encry_key)) {
             encry::enc_file($this->pack_file, $encry_key);
         }
     } else {
         if (!empty($encry_key)) {
             encry::dec_file($this->pack_file, $encry_key);
         }
         $this->WriteFile($this->pack_file, gzuncompress($this->GetFile($this->pack_file)));
         $this->pack_fp = fopen($this->pack_file, "rb");
         if (!$this->pack_fp) {
             $this->Error("Error Occurs In Reading Pack File !");
             return false;
         }
         $n = $this->UnpackFile($this->pack_dir, $separator);
         fclose($this->pack_fp);
         unlink($this->pack_file);
         if ($n <= 0) {
             return false;
         }
     }
     $filename = $this->pack_file;
     $filesize = $this->GetFileSize($filename);
     array_push($this->pack_result, "<br />File Count: {$this->file_count} File(s)");
     if ($type == "pack") {
         array_push($this->pack_result, "Pack Size: {$filesize}");
         array_push($this->pack_result, "Packed File: <a href='{$filename}'>" . basename($filename) . "</a> <br />");
     }
     return $filename;
 }