$template = new template('administrationmodule', '_upload_finalSummary', $loc);
    $sessid = session_id();
    if (!file_exists(BASE . "extensionuploads/{$sessid}") || !is_dir(BASE . "extensionuploads/{$sessid}")) {
        $template->assign('nofiles', 1);
    } else {
        if (!defined('SYS_FILES')) {
            require_once BASE . 'subsystems/files.php';
        }
        $success = array();
        foreach (array_keys(pathos_files_listFlat(BASE . "extensionuploads/{$sessid}", true, null, array(), BASE . "extensionuploads/{$sessid}")) as $file) {
            if ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {
                pathos_files_makeDirectory(dirname($file));
                $success[$file] = copy(BASE . "extensionuploads/{$sessid}" . $file, BASE . substr($file, 1));
                if (basename($file) == 'views_c') {
                    chmod(BASE . substr($file, 1), 0777);
                }
            }
        }
        $del_return = pathos_files_removeDirectory(BASE . "extensionuploads/{$sessid}");
        echo $del_return;
        $template->assign('nofiles', 0);
        $template->assign('success', $success);
        $template->assign('redirect', pathos_flow_get());
        ob_start();
        include BASE . 'modules/administrationmodule/actions/installtables.php';
        ob_end_clean();
    }
    $template->output();
} else {
    echo SITE_403_HTML;
}
Example #2
0
                $fh = fopen($langdir . $dictionary . '.php', 'w');
                fwrite($fh, "<?php\r\n\r\n");
                foreach ($values as $key => $value) {
                    fwrite($fh, "\tdefine('" . $key . "','" . addslashes($value) . "');\r\n");
                }
                fwrite($fh, "\r\n\r\n?>");
                fclose($fh);
            }
            include_once BASE . "external/Tar.php";
            $fname = tempnam(BASE . '/tmp', 'translation_');
            $tar = new Archive_Tar($fname, 'gz');
            $tar->createModify($tmpdir, '', $tmpdir);
            ob_end_clean();
            header('Content-Type: application/x-gzip');
            header('Content-Disposition: inline; filename="exponent-languagepack-' . $lang->lang . '.tar.gz"');
            $fh = fopen($fname, 'rb');
            while (!feof($fh)) {
                echo fread($fh, 8192);
            }
            fclose($fh);
            unlink($fname);
            pathos_files_removeDirectory($tmpdir);
        } else {
            echo 'Could not create default directory.';
        }
    } else {
        echo SITE_404_HTML;
    }
} else {
    echo SITE_403_HTML;
}
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: finish.php,v 1.4 2005/04/18 15:23:54 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
$dest_dir = pathos_sessions_get('dest_dir');
$files = pathos_sessions_get('files_data');
if (!defined('SYS_FILES')) {
    require_once BASE . 'subsystems/files.php';
}
if (!file_exists(BASE . 'files')) {
    mkdir(BASE . 'files', 0777);
}
foreach (array_keys($files) as $mod) {
    pathos_files_copyDirectoryStructure($dest_dir . '/files/' . $mod, BASE . 'files/' . $mod);
    foreach (array_keys($files[$mod][1]) as $file) {
        copy($dest_dir . '/files/' . $mod . '/' . $file, BASE . 'files/' . $mod . '/' . $file);
    }
}
pathos_sessions_unset('dest_dir');
pathos_sessions_unset('files_data');
pathos_files_removeDirectory($dest_dir);
$template = new template('importer', '_files_final');
$template->output();
                 }
             }
         }
     }
 }
 if ($ext == '') {
     pathos_lang_loadDictionary('modules', 'administrationmodule');
     echo TR_ADMINISTRATIONMODULE_BADARCHIVE . '<br />';
 } else {
     if (!defined('SYS_FILES')) {
         require_once BASE . 'subsystems/files.php';
     }
     // Look for stale sessid directories:
     $sessid = session_id();
     if (file_exists(BASE . "extensionuploads/{$sessid}") && is_dir(BASE . "extensionuploads/{$sessid}")) {
         pathos_files_removeDirectory("extensionuploads/{$sessid}");
     }
     $return = pathos_files_makeDirectory("extensionuploads/{$sessid}");
     if ($return != SYS_FILES_SUCCESS) {
         switch ($return) {
             case SYS_FILES_FOUNDFILE:
             case SYS_FILES_FOUNDDIR:
                 echo 'Found file or directory in the way.<br />';
                 break;
             case SYS_FILES_NOTWRITABLE:
                 echo 'Destination parent is not writable.<br />';
                 break;
             case SYS_FILES_NOTREADABLE:
                 echo 'Destination parent is not readable.<br />';
                 break;
         }
Example #5
0
function pathos_files_removeDirectory($dir)
{
    if (strpos($dir, BASE) != 0) {
        $dir = BASE . $dir;
    }
    $dh = opendir($dir);
    if ($dh) {
        while (($file = readdir($dh)) !== false) {
            if ($file != "." && $file != ".." && is_dir("{$dir}/{$file}")) {
                if (pathos_files_removeDirectory("{$dir}/{$file}") == SYS_FILES_NOTDELETABLE) {
                    return SYS_FILES_NOTDELETABLE;
                }
            } else {
                if (is_file("{$dir}/{$file}") || is_link(is_file("{$dir}/{$file}"))) {
                    unlink("{$dir}/{$file}");
                    if (file_exists("{$dir}/{$file}")) {
                        return SYS_FILES_NOTDELETABLE;
                    }
                } else {
                    if ($file != "." && $file != "..") {
                        echo "BAD STUFF HAPPENED<br />";
                        echo "--------Don't know what to do with {$dir}/{$file}<br />";
                        echo "<xmp>";
                        print_r(stat("{$dir}/{$file}"));
                        echo filetype("{$dir}/{$file}");
                        echo "</xmp>";
                    }
                }
            }
        }
    }
    rmdir($dir);
}
Example #6
0
function pathos_sharedcore_unlinkExtension($typedir, $name, $dir)
{
    if (!defined("SYS_FILES")) {
        require_once BASE . "subsystems/files.php";
    }
    pathos_files_removeDirectory("{$dir}/{$typedir}/{$name}");
}