コード例 #1
0
##################################################
// Part of the Extensions category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('extensions', pathos_core_makeLocation('administrationmodule'))) {
    $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';
コード例 #2
0
        $return = $tar->extract($dest_dir);
        if (!$return) {
            echo '<br />Error extracting TAR archive<br />';
        } else {
            if (!file_exists($dest_dir . '/files') || !is_dir($dest_dir . '/files')) {
                echo '<br />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
                if (!defined('SYS_FILES')) {
                    require_once BASE . 'subsystems/files.php';
                }
                $dh = opendir($dest_dir . '/files');
                while (($file = readdir($dh)) !== false) {
                    if ($file[0] != '.' && is_dir($dest_dir . '/files/' . $file)) {
                        $mods[$file] = array('', array_keys(pathos_files_listFlat($dest_dir . '/files/' . $file, 1, null, array(), $dest_dir . '/files/' . $file . '/')));
                        if (class_exists($file)) {
                            $mods[$file][0] = call_user_func(array($file, 'name'));
                            // $file is the class name of the module
                        }
                    }
                }
                $template = new template('importer', '_files_selectModList');
                $template->assign('dest_dir', $dest_dir);
                $template->assign('file_data', $mods);
                $template->output();
            }
        }
    }
}
コード例 #3
0
function pathos_files_listFlat($dir, $recurse = false, $ext = null, $exclude_dirs = array(), $relative = "")
{
    $files = array();
    if (is_readable($dir)) {
        $dh = opendir($dir);
        while (($file = readdir($dh)) !== false) {
            if (is_dir("{$dir}/{$file}") && !in_array($file, $exclude_dirs) && $recurse && $file != "." && $file != ".." && $file != "CVS") {
                $files = array_merge($files, pathos_files_listFlat("{$dir}/{$file}", $recurse, $ext, $exclude_dirs, $relative));
            }
            if (is_file("{$dir}/{$file}") && ($ext == null || substr($file, -1 * strlen($ext), strlen($ext)) == $ext)) {
                $files[str_replace($relative, "", "{$dir}/{$file}")] = $file;
            }
        }
    }
    return $files;
}
コード例 #4
0
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: extract.php,v 1.3 2005/04/18 15:23:54 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
$dest_dir = $_POST['dest_dir'];
$files = array();
if (!defined('SYS_FILES')) {
    require_once BASE . 'subsystems/files.php';
}
foreach (array_keys($_POST['mods']) as $mod) {
    $files[$mod] = array('', array());
    if (class_exists($mod)) {
        $files[$mod][0] = call_user_func(array($mod, 'name'));
    }
    foreach (array_keys(pathos_files_listFlat($dest_dir . '/files/' . $mod, 1, null, array(), $dest_dir . '/files/' . $mod . '/')) as $file) {
        $files[$mod][1][$file] = pathos_files_canCreate(BASE . 'files/' . $mod . '/' . $file);
    }
}
pathos_sessions_set('dest_dir', $dest_dir);
pathos_sessions_set('files_data', $files);
$template = new template('importer', '_files_verifyFiles');
$template->assign('files_data', $files);
$template->output();
コード例 #5
0
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: verify_extension.php,v 1.6 2005/04/18 15:33:34 filetreefrog Exp $
##################################################
// Part of the Extensions category.
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('extensions', pathos_core_makeLocation('administrationmodule'))) {
    if (!defined('SYS_FILES')) {
        require_once BASE . 'subsystems/files.php';
    }
    $sessid = session_id();
    $files = array();
    foreach (pathos_files_listFlat(BASE . 'extensionuploads/' . $sessid, true, null, array(), BASE . 'extensionuploads/' . $sessid) as $key => $f) {
        if ($key != '/archive.tar' && $key != '/archive.tar.gz' && $key != '/archive.tar.bz2' && $key != '/archive.zip') {
            $files[] = array('absolute' => $key, 'relative' => $f, 'canCreate' => pathos_files_canCreate(BASE . substr($key, 1)), 'ext' => substr($f, -3, 3));
        }
    }
    $template = new template('administrationmodule', '_upload_filesList', $loc);
    $template->assign('relative', 'extensionuploads/' . $sessid);
    $template->assign('files', $files);
    $template->output();
} else {
    echo SITE_403_HTML;
}