Example #1
0
 /**
  * εΊ”η”¨ζ‰“εŒ…
  * @return string
  */
 public function Pack()
 {
     global $zbp;
     $dir = $this->GetDir();
     $this->GetAllFileDir($dir);
     $s = '<?xml version="1.0" encoding="utf-8"?>';
     $s .= '<app version="php" type="' . $this->type . '">';
     $s .= '<id>' . htmlspecialchars($this->id) . '</id>';
     $s .= '<name>' . htmlspecialchars($this->name) . '</name>';
     $s .= '<url>' . htmlspecialchars($this->url) . '</url>';
     $s .= '<note>' . htmlspecialchars($this->note) . '</note>';
     $s .= '<description>' . htmlspecialchars($this->description) . '</description>';
     $s .= '<path>' . htmlspecialchars($this->path) . '</path>';
     $s .= '<include>' . htmlspecialchars($this->include) . '</include>';
     $s .= '<level>' . htmlspecialchars($this->level) . '</level>';
     $s .= '<author>';
     $s .= '<name>' . htmlspecialchars($this->author_name) . '</name>';
     $s .= '<email>' . htmlspecialchars($this->author_email) . '</email>';
     $s .= '<url>' . htmlspecialchars($this->author_url) . '</url>';
     $s .= '</author>';
     $s .= '<source>';
     $s .= '<name>' . htmlspecialchars($this->source_name) . '</name>';
     $s .= '<email>' . htmlspecialchars($this->source_email) . '</email>';
     $s .= '<url>' . htmlspecialchars($this->source_url) . '</url>';
     $s .= '</source>';
     $s .= '<adapted>' . htmlspecialchars($this->adapted) . '</adapted>';
     $s .= '<version>' . htmlspecialchars($this->version) . '</version>';
     $s .= '<pubdate>' . htmlspecialchars($this->pubdate) . '</pubdate>';
     $s .= '<modified>' . htmlspecialchars($this->modified) . '</modified>';
     $s .= '<price>' . htmlspecialchars($this->price) . '</price>';
     $s .= '<advanced>';
     $s .= '<dependency>' . htmlspecialchars($this->advanced_dependency) . '</dependency>';
     $s .= '<rewritefunctions>' . htmlspecialchars($this->advanced_rewritefunctions) . '</rewritefunctions>';
     $s .= '<conflict>' . htmlspecialchars($this->advanced_conflict) . '</conflict>';
     $s .= '</advanced>';
     $s .= '<sidebars>';
     $s .= '<sidebar1>' . htmlspecialchars($this->sidebars_sidebar1) . '</sidebar1>';
     $s .= '<sidebar2>' . htmlspecialchars($this->sidebars_sidebar2) . '</sidebar2>';
     $s .= '<sidebar3>' . htmlspecialchars($this->sidebars_sidebar3) . '</sidebar3>';
     $s .= '<sidebar4>' . htmlspecialchars($this->sidebars_sidebar4) . '</sidebar4>';
     $s .= '<sidebar5>' . htmlspecialchars($this->sidebars_sidebar5) . '</sidebar5>';
     $s .= '</sidebars>';
     foreach ($this->dirs as $key => $value) {
         $value = preg_replace('/[^(\\x20-\\x7F)]*/', '', $value);
         $d = $this->id . '/' . str_replace($dir, '', $value);
         $s .= '<folder><path>' . htmlspecialchars($d) . '</path></folder>';
     }
     foreach ($this->files as $key => $value) {
         $d = $this->id . '/' . str_replace($dir, '', $value);
         $ext = pathinfo($value, PATHINFO_EXTENSION);
         if ($ext == 'php' || $ext == 'inc') {
             $c = base64_encode(RemoveBOM(file_get_contents($value)));
         } else {
             $c = base64_encode(file_get_contents($value));
         }
         if (IS_WINDOWS) {
             $d = iconv($zbp->lang['windows_character_set'], 'UTF-8//IGNORE', $d);
         }
         $s .= '<file><path>' . htmlspecialchars($d) . '</path><stream>' . $c . '</stream></file>';
     }
     $s .= '<verify>' . base64_encode($zbp->host . "\n" . $zbp->path) . '</verify>';
     $s .= '</app>';
     return $s;
 }
Example #2
0
 /**
  * @param $filesarray
  */
 function CompileFiles($filesarray)
 {
     foreach ($filesarray as $name => $content) {
         $s = RemoveBOM($this->Compiling($content));
         @file_put_contents($this->path . $name . '.php', $s);
         //if(function_exists('chmod')){
         //	@chmod($this->path . $name . '.php',0755);
         //}
     }
 }
Example #3
0
 /**
  * @param $filesarray
  */
 public function CompileFiles()
 {
     foreach ($this->templates as $name => $content) {
         $s = RemoveBOM($this->CompileFile($content));
         @file_put_contents($this->path . $name . '.php', $s);
     }
 }
Example #4
0
function AppCentre_Pack($app, $gzip)
{
    global $zbp;
    global $AppCentre_dirs;
    global $AppCentre_files;
    $AppCentre_dirs = array();
    $AppCentre_files = array();
    $dir = $app->GetDir();
    AppCentre_GetAllFileDir($dir);
    $s = '<?xml version="1.0" encoding="utf-8"?>';
    $s .= '<app version="php" type="' . $app->type . '">';
    $s .= '<id>' . htmlspecialchars($app->id) . '</id>';
    $s .= '<name>' . htmlspecialchars($app->name) . '</name>';
    $s .= '<url>' . htmlspecialchars($app->url) . '</url>';
    $s .= '<note>' . htmlspecialchars($app->note) . '</note>';
    $s .= '<description>' . htmlspecialchars($app->description) . '</description>';
    $s .= '<path>' . htmlspecialchars($app->path) . '</path>';
    $s .= '<include>' . htmlspecialchars($app->include) . '</include>';
    $s .= '<level>' . htmlspecialchars($app->level) . '</level>';
    $s .= '<author>';
    $s .= '<name>' . htmlspecialchars($app->author_name) . '</name>';
    $s .= '<email>' . htmlspecialchars($app->author_email) . '</email>';
    $s .= '<url>' . htmlspecialchars($app->author_url) . '</url>';
    $s .= '</author>';
    $s .= '<source>';
    $s .= '<name>' . htmlspecialchars($app->source_name) . '</name>';
    $s .= '<email>' . htmlspecialchars($app->source_email) . '</email>';
    $s .= '<url>' . htmlspecialchars($app->source_url) . '</url>';
    $s .= '</source>';
    $s .= '<adapted>' . htmlspecialchars($app->adapted) . '</adapted>';
    $s .= '<version>' . htmlspecialchars($app->version) . '</version>';
    $s .= '<pubdate>' . htmlspecialchars($app->pubdate) . '</pubdate>';
    $s .= '<modified>' . htmlspecialchars($app->modified) . '</modified>';
    $s .= '<price>' . htmlspecialchars($app->price) . '</price>';
    $s .= '<advanced>';
    $s .= '<dependency>' . htmlspecialchars($app->advanced_dependency) . '</dependency>';
    $s .= '<rewritefunctions>' . htmlspecialchars($app->advanced_rewritefunctions) . '</rewritefunctions>';
    $s .= '<conflict>' . htmlspecialchars($app->advanced_conflict) . '</conflict>';
    $s .= '</advanced>';
    $s .= '<sidebars>';
    $s .= '<sidebar1>' . htmlspecialchars($app->sidebars_sidebar1) . '</sidebar1>';
    $s .= '<sidebar2>' . htmlspecialchars($app->sidebars_sidebar2) . '</sidebar2>';
    $s .= '<sidebar3>' . htmlspecialchars($app->sidebars_sidebar3) . '</sidebar3>';
    $s .= '<sidebar4>' . htmlspecialchars($app->sidebars_sidebar4) . '</sidebar4>';
    $s .= '<sidebar5>' . htmlspecialchars($app->sidebars_sidebar5) . '</sidebar5>';
    $s .= '</sidebars>';
    foreach ($AppCentre_dirs as $key => $value) {
        $value = preg_replace('/[^(\\x20-\\x7F)]*/', '', $value);
        $d = $app->id . '/' . str_replace($dir, '', $value);
        $s .= '<folder><path>' . htmlspecialchars($d) . '</path></folder>';
    }
    foreach ($AppCentre_files as $key => $value) {
        $d = $app->id . '/' . str_replace($dir, '', $value);
        $ext = pathinfo($value, PATHINFO_EXTENSION);
        if ($ext == 'php' || $ext == 'inc') {
            $c = base64_encode(RemoveBOM(file_get_contents($value)));
        } else {
            if (strripos($d, '/plugin.xml') !== false) {
                $x = file_get_contents($value);
                $x1 = 'app_host:' . $zbp->host . ';';
                $x2 = 'app_email:' . $zbp->user->Email . ';';
                $x3 = 'app_user:'******';';
                $x = str_replace('</plugin>', '</plugin><!-- ' . $x1 . $x2 . $x3 . ' -->', $x);
                $c = base64_encode($x);
            } elseif (strripos($d, '/theme.xml') !== false) {
                $x = file_get_contents($value);
                $x1 = 'app_host:' . $zbp->host . ';';
                $x2 = 'app_email:' . $zbp->user->Email . ';';
                $x3 = 'app_user:'******';';
                $x = str_replace('</theme>', '</theme><!-- ' . $x1 . $x2 . $x3 . ' -->', $x);
                $c = base64_encode($x);
            } else {
                $c = base64_encode(file_get_contents($value));
            }
        }
        if (IS_WINDOWS) {
            $d = iconv($zbp->lang['windows_character_set'], 'UTF-8//IGNORE', $d);
        }
        $s .= '<file><path>' . htmlspecialchars($d) . '</path><stream>' . $c . '</stream></file>';
    }
    $s .= '</app>';
    if ($gzip) {
        return gzencode($s, 9, FORCE_GZIP);
    } else {
        return $s;
    }
}