示例#1
0
 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);
     }
 }
示例#2
0
    $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));
if (is_array($selall)) {