Esempio n. 1
0
        echo gt('Unable to create temporary directory to extract files archive.');
    } else {
        $return = $tar->extract($dest_dir);
        if (!$return) {
            echo '<br />' . gt('Error extracting TAR archive') . '<br />';
        } else {
            if (!file_exists($dest_dir . '/files') || !is_dir($dest_dir . '/files')) {
                echo '<br />' . gt('Invalid archive format') . '<br />';
            } else {
                // Show the form for specifying which mod types to 'extract'
                $mods = array();
                // Stores the mod classname, the files list, and the module's real name
                $dh = opendir($dest_dir . '/files');
                while (($file = readdir($dh)) !== false) {
                    if ($file[0] != '.' && is_dir($dest_dir . '/files/' . $file)) {
                        $mods[$file] = array('', array_keys(expFile::listFlat($dest_dir . '/files/' . $file, 1, null, array(), $dest_dir . '/files/')));
                        //					if (class_exists($file)) {
                        //						$mods[$file][0] = call_user_func(array($file,'name')); // $file is the class name of the module
                        //					}
                    } elseif ($file != '.' && $file != '..') {
                        $mods[$file] = array('', $file);
                    }
                }
                $template = new template('importer', '_files_selectModList');
                $template->assign('dest_dir', $dest_dir);
                $template->assign('file_data', $mods);
                $template->output();
            }
        }
    }
}
Esempio n. 2
0
 public function adder()
 {
     global $db;
     $allfiles = expFile::listFlat(BASE . 'files', true, null, null, BASE);
     foreach ($allfiles as $path => $file) {
         if ($file[0] != '.') {
             $found = false;
             $dbfiles = $db->selectObjects('expFiles', "filename='" . $file . "'");
             foreach ($dbfiles as $dbfile) {
                 $found = $dbfile->directory == str_replace($file, '', $path);
             }
             if (!$found) {
                 $notindb[$path] = $file;
             }
         }
     }
     assign_to_template(array('files' => $notindb));
 }
 public function install_extension_finish()
 {
     $sessid = session_id();
     if (!file_exists(BASE . "tmp/extensionuploads/{$sessid}") || !is_dir(BASE . "tmp/extensionuploads/{$sessid}")) {
         //				$template = new template('administrationmodule','_upload_finalSummary',$loc);
         //				$template->assign('nofiles',1);
         $nofiles = 1;
     } else {
         $success = array();
         foreach (array_keys(expFile::listFlat(BASE . "tmp/extensionuploads/{$sessid}", true, null, array(), BASE . "tmp/extensionuploads/{$sessid}")) as $file) {
             if ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {
                 expFile::makeDirectory(dirname($file));
                 $success[$file] = copy(BASE . "tmp/extensionuploads/{$sessid}" . $file, BASE . substr($file, 1));
                 if (basename($file) == 'views_c') {
                     chmod(BASE . substr($file, 1), 0777);
                 }
             }
         }
         $del_return = expFile::removeDirectory(BASE . "tmp/extensionuploads/{$sessid}");
         //FIXME shouldn't use echo
         echo $del_return;
         //			ob_start();
         //			include(BASE . 'framework/modules-1/administrationmodule/actions/installtables.php');
         //			ob_end_clean();
         self::install_dbtables();
         //				$template = new template('administrationmodule','_upload_finalSummary',$loc);
         //				$template->assign('nofiles',0);
         $nofiles = 0;
         //				$template->assign('success',$success);
         //				$template->assign('redirect',expHistory::getLastNotEditable());
     }
     //			$template->output();
     assign_to_template(array('nofiles' => $nofiles, 'success' => $success, 'redirect' => expHistory::getLastNotEditable()));
 }