示例#1
0
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/** @define "BASE" "../../../../.." */
if (!defined('EXPONENT')) {
    exit('');
}
$dest_dir = expSession::get('dest_dir');
$files = expSession::get('files_data');
if (!file_exists(BASE . 'files')) {
    mkdir(BASE . 'files', 0777);
}
$filecount = 0;
foreach (array_keys($files) as $file) {
    expFile::copyDirectoryStructure($dest_dir . '/files/' . $file, BASE . 'files/' . $file);
    copy($dest_dir . '/files/' . $file, BASE . 'files/' . $file);
    $filecount += 1;
}
expSession::un_set('dest_dir');
expSession::un_set('files_data');
expFile::removeDirectory($dest_dir);
$template = new template('importer', '_files_final');
$template->assign('file_count', $filecount);
$template->output();
 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()));
 }