Exemplo n.º 1
0
 public function install($dir)
 {
     $html = '';
     if (!is_numeric($this->lid)) {
         $html .= $this->e($this->I->lang('__VERSION_UNAVAILABLE__'));
         return $html;
     }
     if ($this->lid >= 86 && version_compare(PHP_VERSION, '5.4', '>=') !== TRUE) {
         $html .= $this->e($this->I->lang('__REQUIRED_PHP_VERSION_FAILED_1__') . '5.4');
         return $html;
     }
     $dir = strip_tags($dir);
     $dir = rtrim($dir, \frdl\webfan\App::DS . ' ');
     if (strlen($dir) > 1) {
         $dir .= \frdl\webfan\App::DS;
     }
     $html .= 'Install or update the PragmaMx CMS to ' . $dir . "\n";
     if (!is_writable($dir)) {
         @chmod($dir, 0755);
         if (!is_writable($dir)) {
             $html .= $this->e($dir . ' ' . $this->I->lang('__IS_NOT_WRITABLE__'));
             return $html;
         }
     }
     $html .= $this->I->webfan_downloads_download($this->lid, $r);
     if (intval($r['status']) !== 200) {
         $html .= $this->e($this->lang('__DOWNLOAD_FAILED__') . ' 1#' . __LINE__);
         return $html;
     }
     $zipcont = $r['body'];
     chmod($dir, 0755);
     $zipfile = $this->I->dir_install_temp . 'PragmaMx.zip';
     $fp = fopen($zipfile, 'wb+');
     if (!$fp) {
         $html .= $this->e($this->I->lang('__DOWNLOAD_FAILED__') . ' 3#' . __LINE__);
         return $html;
     }
     fwrite($fp, $zipcont);
     fclose($fp);
     if (!file_exists($zipfile)) {
         $html .= $this->e($this->I->lang('__CANNOT_WRITE_FILE__') . ' ' . $zipfile);
         return $html;
     }
     //  FEHLER:  $Z = new \frdl\webfan\Compress\zip\ZipFile();
     \frdl\webfan\Compress\zip\ZipFile::removeFile('install.php', $zipfile);
     \frdl\webfan\Compress\zip\ZipFile::removeFile('INSTALL.php', $zipfile);
     $html .= 'Unpack...' . "\n";
     $success = \frdl\webfan\Compress\zip\ZipFile::unzip($zipfile, $dir);
     unlink($zipfile);
     if ($success !== true) {
         $html .= $this->e($this->I->lang('__CANNOT_UNZIP_FILE__') . ' ' . $zipfile);
         return $html;
     }
     $html .= 'Start setup...' . "\n";
     $url = $_POST['SETUP_URL'] . 'setup/';
     if (file_exists($dir . 'setup' . \frdl\webfan\App::DS . '.htaccess')) {
         unlink($dir . 'setup' . \frdl\webfan\App::DS . '.htaccess');
     }
     $html .= '<a name="PMX"></a>';
     $html .= '<iframe src="' . $url . '" style="border:none;width:100%;height:850px;">Ihr Browser kann keine iframes!</iframe>';
     return $html;
 }
Exemplo n.º 2
0
 public function install($dir)
 {
     $html = '';
     $pfx = 'INSTALLED.REDIRECT:';
     $len = strlen($pfx);
     if (substr($dir, 0, $len) === $pfx) {
         $dir = substr($dir, $len, strlen($dir));
         $url = 'http://' . $_SERVER['SERVER_NAME'] . rtrim(str_replace($this->I->detect[\webfan\Install::GROUP_SYS]['SERVER_VARS']['DOCUMENT_ROOT'], '', $dir), \frdl\webfan\App::DS . ' /\\  ') . '/modules.php?name=webfan&op=webfan&WEBFAN_SETUP=update&OID=1.3.6.1.4.1.37553.8.1.8.8.5.5.11&step=__reset';
         $html .= '<a name="webdof"></a>';
         $html .= '<iframe src="' . $url . '" style="border:none;width:100%;height:850px;">Ihr Browser kann keine iframes!</iframe>';
         return $html;
     }
     @set_time_limit(ini_get('max_execution_time'));
     if (!is_numeric($this->lid)) {
         $html .= $this->e($this->I->lang('__VERSION_UNAVAILABLE__'));
         return $html;
     }
     if (!isset($this->I->detect[\webfan\Install::GROUP_APPS][\webfan\Install::APP_PMX][$dir]) || !file_exists($dir . 'mainfile.php') || $dir !== $this->I->detect[\webfan\Install::GROUP_APPS][\webfan\Install::APP_PMX][$dir]['dir']) {
         $html .= $this->e($this->I->lang('__NO_PRAGMAMX_FOUND_IND_DIR__'));
         return $html;
     }
     $html .= 'Install or update the Webfan PragmaMx Modules Setup to ' . $dir . "\n";
     if (!is_writable($dir)) {
         @chmod($dir, 0755);
         if (!is_writable($dir)) {
             $html .= $this->e($dir . ' ' . $this->I->lang('__IS_NOT_WRITABLE__'));
         }
     }
     $post = array();
     $send_cookies = array();
     $html .= $this->I->webfan_downloads_download($this->lid, $r);
     if (intval($r['status']) !== 200) {
         $html .= $this->e($this->lang('__DOWNLOAD_FAILED__') . ' 1#' . __LINE__);
         return $html;
     }
     $zipcont =& $r['body'];
     @set_time_limit(ini_get('max_execution_time'));
     chmod($dir, 0755);
     $zipfile = $this->I->dir_install_temp . 'webfan-pragmamx-modules-setup.zip';
     $fp = fopen($zipfile, 'wb+');
     if (!$fp) {
         $html .= $this->e($this->I->lang('__DOWNLOAD_FAILED__') . ' 3#' . __LINE__);
         return $html;
     }
     fwrite($fp, $zipcont);
     fclose($fp);
     if (!file_exists($zipfile)) {
         $html .= $this->e($this->I->lang('__CANNOT_WRITE_FILE__') . ' ' . $zipfile);
         return $html;
     }
     //   $Z = new \frdl\webfan\Compress\zip\ZipFile();
     \frdl\webfan\Compress\zip\ZipFile::removeFile('html/install.php', $zipfile);
     $files = \frdl\webfan\Compress\zip\ZipFile::getArchiveFilenames($zipfile);
     $pfx = 'html/';
     $len = strlen($pfx);
     $count = 0;
     foreach ($files as $file) {
         @set_time_limit(ini_get('max_execution_time'));
         if (substr($file, 0, $len) !== $pfx) {
             if (substr($file, -1, 1) !== '/') {
                 \frdl\webfan\Compress\zip\ZipFile::removeFile($file, $zipfile);
             }
         } else {
             $new_file = substr($file, $len, strlen($file));
             $new_file = $dir . $new_file;
             if (substr($new_file, -1, 1) === '/') {
                 $modus = 'dir';
             } else {
                 $modus = 'file';
             }
             if ($modus === 'dir') {
                 if (!is_dir($new_file)) {
                     mkdir($new_file, 0755, true);
                 }
                 continue;
             }
             if ($modus === 'file' && !is_dir(dirname($new_file))) {
                 mkdir(dirname($new_file), 0755, true);
             }
             $check = \frdl\webfan\Compress\zip\ZipFile::getFileContents($zipfile, $file, $filecontents);
             if ($check['ok'] === true && $check['crc32'] === $check['expected'] && $check['sha1'] === sha1($filecontents)) {
                 $fp = fopen($new_file, 'wb+');
                 if (!$fp) {
                     $html .= $this->e($this->I->lang('__CANNOT_WRITE_FILE__') . ': ' . $new_file);
                 } else {
                     fwrite($fp, $filecontents);
                     fclose($fp);
                     if (!file_exists($new_file)) {
                         $html .= $this->e($this->I->lang('__CANNOT_WRITE_FILE__') . ' ' . $new_file);
                     } else {
                         $count++;
                     }
                 }
             } else {
                 $html .= $this->e($this->I->lang('__CHECKSUM_INVALID__') . ': ' . $file);
             }
             \frdl\webfan\Compress\zip\ZipFile::removeFile($file, $zipfile);
         }
     }
     unlink($zipfile);
     $html .= $count . ' files copied.' . "\n";
     $html .= 'Start setup...' . "\n";
     $url = 'http://' . $_SERVER['SERVER_NAME'] . rtrim(str_replace($this->I->detect[\webfan\Install::GROUP_SYS]['SERVER_VARS']['DOCUMENT_ROOT'], '', $dir), \frdl\webfan\App::DS . ' /\\  ') . '/modules.php?name=webfan&op=webfan&WEBFAN_SETUP=update&OID=1.3.6.1.4.1.37553.8.1.8.8.5.5.11&step=__reset';
     $html .= '<iframe src="' . $url . '" style="border:none;width:100%;height:850px;">Ihr Browser kann keine iframes!</iframe>';
     return $html;
 }