Beispiel #1
0
if (isset($params["cancel"])) {
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
$selall = $params['selall'];
if (!is_array($selall)) {
    $selall = unserialize($selall);
}
if (count($selall) == 0) {
    $params["fmerror"] = "nofilesselected";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
foreach ($selall as &$one) {
    $one = $this->decodefilename($one);
}
$config = cmsms()->GetConfig();
$cwd = filemanager_utils::get_cwd();
$dirlist = filemanager_utils::get_dirlist();
if (!count($dirlist)) {
    $params["fmerror"] = "nodestinationdirs";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
$errors = array();
$destloc = '';
if (isset($params['submit'])) {
    $destdir = trim($params['destdir']);
    if ($destdir == $cwd) {
        $errors[] = $this->Lang('movedestdirsame');
    }
    $advancedmode = filemanager_utils::check_advanced_mode();
    $basedir = $config['root_path'];
    if (count($errors) == 0) {
Beispiel #2
0
    $selall = unserialize($selall);
}
if (count($selall) == 0) {
    $params["fmerror"] = "nofilesselected";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
if (count($selall) > 1) {
    $params["fmerror"] = "morethanonefiledirselected";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
$config = cmsms()->GetConfig();
$filename = $this->decodefilename($selall[0]);
$src = filemanager_utils::join_path($config['root_path'], filemanager_utils::get_cwd(), $filename);
if (!file_exists($src)) {
    $params["fmerror"] = "filenotfound";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
include_once dirname(__FILE__) . '/easyarchives/EasyArchive.class.php';
$archive = new EasyArchive();
$destdir = filemanager_utils::join_path($config['root_path'], filemanager_utils::get_cwd());
if (!endswith($destdir, '/')) {
    $destdir .= '/';
}
$res = $archive->extract($src, $destdir);
$paramsnofiles["fmmessage"] = "unpacksuccess";
//strips the file data
$this->Audit('', "File Manager", "Unpacked file: " . $src);
$this->Redirect($id, "defaultadmin", $returnid, $paramsnofiles);
#
# EOF
#
Beispiel #3
0
            $val = round($val, 2);
        }
    }
    return $val . $suffix;
}
$filepickerstyle = $this->GetPreference("filepickerstyle", "both");
$smarty->assign("filepickerstyle", $filepickerstyle);
$smarty->assign("rooturl", $config->smart_root_url());
$smarty->assign("filepickertitle", $this->Lang("filepickertitle"));
$smarty->assign("youareintext", $this->Lang("youareintext"));
$tmp = filemanager_utils::get_cwd();
if (isset($_GET['subdir'])) {
    $tmp .= '/' . trim($_GET['subdir']);
    filemanager_utils::set_cwd($tmp);
}
$startpath = filemanager_utils::get_cwd();
if ($type == "image") {
    $smarty->assign("isimage", "1");
} else {
    $smarty->assign("isimage", "0");
}
$starturl = $config['root_url'] . '/' . $startpath;
$startdir = filemanager_utils::join_path($config['root_path'], $startpath);
function sortfiles($file1, $file2)
{
    if ($file1["isdir"] && !$file2["isdir"]) {
        return -1;
    }
    if (!$file1["isdir"] && $file2["isdir"]) {
        return 1;
    }
Beispiel #4
0
if (!function_exists("cmsms")) {
    exit;
}
if (!$this->CheckPermission("Modify Files") && !$this->AdvancedAccessAllowed()) {
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['showtemplate']) && $_GET['showtemplate'] == 'false') {
    echo filemanager_utils::get_cwd();
    exit;
}
if (!isset($params["newdir"]) || !isset($params["path"])) {
    $this->Redirect($id, 'defaultadmin');
}
$newdir = $params["newdir"];
$path = filemanager_utils::join_path(filemanager_utils::get_cwd(), $newdir);
try {
    if (isset($params['ajax'])) {
        filemanager_utils::set_cwd(trim($newdir));
    } else {
        filemanager_utils::set_cwd($path);
        $this->Redirect($id, 'defaultadmin');
    }
} catch (Exception $e) {
    audit('', 'FileManager', 'Attempt to set working directory to an invalid location: ' . $newdir);
    if (isset($params['ajax'])) {
        exit('ERROR');
    }
}
//echo $params["path"];
if (isset($params['ajax'])) {
Beispiel #5
0
if (count($selall) > 1) {
    $params["fmerror"] = "morethanonefiledirselected";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
$advancedmode = filemanager_utils::check_advanced_mode();
$basedir = $config['root_path'];
$config = cmsms()->GetConfig();
$filename = $this->decodefilename($selall[0]);
$src = filemanager_utils::join_path($basedir, filemanager_utils::get_cwd(), $filename);
if (!file_exists($src)) {
    $params["fmerror"] = "filenotfound";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
$thumb = filemanager_utils::join_path($basedir, filemanager_utils::get_cwd(), 'thumb_' . $filename);
if (isset($params['submit'])) {
    $thumb = filemanager_utils::join_path($basedir, filemanager_utils::get_cwd(), 'thumb_' . $filename);
    $thumb = cms_utils::generate_thumbnail($src);
    if (!$thumb) {
        $params["fmerror"] = "thumberror";
    } else {
        $params["fmmessage"] = "thumbsuccess";
    }
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
//
// build the form
//
$smarty->assign('filename', $filename);
$smarty->assign('filespec', $src);
$smarty->assign('thumb', $thumb);
$smarty->assign('thumbexists', file_exists($thumb));