protected function after_uploaded_file($fileobject) { // here we may do image handling, and other cruft. if (is_object($fileobject) && $fileobject->name != '') { $mod = cms_utils::get_module('FileManager'); $parms = array(); $parms['file'] = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), $fileobject->name); if ($mod->GetPreference('create_thumbnails')) { $thumb = cms_utils::generate_thumbnail($parms['file']); if ($thumb) { $params['thumb'] = $thumb; } } $str = $fileobject->name . ' uploaded to ' . filemanager_utils::get_full_cwd(); if (isset($params['thumb'])) { $str .= ' and a thumbnail was generated'; } audit('', $mod->GetName(), $str); $mod->SendEvent('OnFileUploaded', $parms); } }
//for initial input box if (isset($params["newname"])) { $newname = $params["newname"]; if (!filemanager_utils::is_valid_filename($newname)) { echo $this->ShowErrors($this->Lang("invaliddestname")); } else { $cwd = filemanager_utils::get_cwd(); $fullnewname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), trim($params['newname'])); if (file_exists($fullnewname)) { echo $this->ShowErrors($this->Lang("namealreadyexists")); //fallthrough } else { $fulloldname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), $oldname); if (@rename($fulloldname, $fullnewname)) { $thumboldname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), 'thumb_' . $oldname); $thumbnewname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), 'thumb_' . trim($params['newname'])); if (file_exists($thumboldname)) { @rename($thumboldname, $thumbnewname); } $this->SetMessage($this->Lang('renamesuccess')); $this->Audit('', "File Manager", "Renamed file: " . $fullnewname); $this->Redirect($id, "defaultadmin", $returnid, $paramsnofiles); } else { $this->SetError($this->Lang('renameerror')); $this->Redirect($id, "defaultadmin", $returnid, $params); } } } } if (is_array($params['selall'])) { $params['selall'] = serialize($params['selall']);
if (count($errors) == 0) { $destloc = filemanager_utils::join_path($basedir, $destdir); if (!is_dir($destloc) || !is_writable($destloc)) { $errors[] = $this->Lang('invalidmovedir'); } } if (count($errors) == 0) { if (isset($params['destname']) && count($selall) == 1) { $destname = trim($params['destname']); if ($destname == '') { $errors[] = $this->Lang('invaliddestname'); } } if (count($errors) == 0) { foreach ($selall as $file) { $src = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), $file); if ($destname) { $dest = filemanager_utils::join_path($basedir, $destdir, $destname); } else { $dest = filemanager_utils::join_path($basedir, $destdir, $file); } if (!file_exists($src)) { $errors[] = $this->Lang('filenotfound') . " {$file}"; continue; } if (!is_readable($src)) { $errors[] = $this->Lang('insufficientpermission', $file); continue; } if (file_exists($dest)) { $errors[] = $this->Lang('fileexistsdest', basename($dest));