addExclusion($fm_cf_exclusion); /* header('Content-Type: text/plain'); var_dump($dcFM); //var_dump($dcFM->getDir()); exit; //*/ # Téléchargement d'un fichier if (!empty($_GET['dl']) && $dcFM->isFile() && !$dcFM->isExclude()) { if (strpos(basename($dcFM->base_path),'.') === false) { $mime_type = 'text/plain'; } elseif (preg_match('/.png$/',$dcFM->base_path)) { $mime_type = 'image/png'; } elseif (preg_match('/.gif$/',$dcFM->base_path)) { $mime_type = 'image/gif'; } elseif (preg_match('/.(jpg|jpeg)$/',$dcFM->base_path)) { $mime_type = 'image/jpeg'; } elseif (preg_match('/('.$dcFM->_types['txt'].')$/',$dcFM->base_path)) { $mime_type = 'text/plain'; } else { $mime_type = 'application/download'; } header('Content-Type: '.$mime_type); if ($mime_type == 'application/download') { header('Content-Disposition: attachment; filename='.basename($dcFM->base_path)); } echo $dcFM->getContent(); exit; } # Création d'un répertoire if (!empty($_GET['new_dir']) && $dcFM->isWritable() && !$dcFM->isExclude()) { if ($dcFM->newDir($_GET['new_dir']) !== false) { header('Location: '.$p_url.'&f='.$dcFM->base_path); exit; } else { $err = '

'.__('Cannot create this directory.').'

'; } } # Ajout d'un fichier if (!empty($_FILES['up_file']) && !$dcFM->isExclude()) { $up_name = trim(str_replace('/','',$_POST['up_name'])); $tmp_file = $_FILES['up_file']['tmp_name']; $file_name = $_FILES['up_file']['name']; $dest_file = $dcFM->root.$dcFM->base_path.'/'.$file_name; if ($up_name != '') { $dest_file = $dcFM->root.$dcFM->base_path.'/'.$up_name; } $uerr = array(); if (version_compare(phpversion(),'4.2.0','>=')) { $upd_error = $_FILES['up_file']['error']; } else { $upd_error = 0; } if($upd_error != 0) { switch ($upd_error) { case 1: case 2: $uerr[] = __('File size exceeds the authorized limit'); break; case 3: $uerr[] = __('File was only partially uploaded'); break; case 4: $uerr[] = __('No file'); break; } } elseif (file_exists($dest_file)) { $err = '

'.__('Cannot upload: destination file exists.').'

'; } elseif (@move_uploaded_file($tmp_file,$dest_file) !== false) { chmod($dest_file,fileperms(dirname($dest_file)) & ~0111); header('Location: '.$p_url.'&f='.$dcFM->base_path); exit; } else { $err = '

'.__('Cannot upload.').'

'; } if (count($uerr) > 0) { $err = ''; } } if ($dcFM->base_path != '' && !$dcFM->isExclude()) { # Modification d'un fichier if (!empty($_POST['f_content']) && $dcFM->isWritable()) { $f_content = str_replace("\r",'',$_POST['f_content']); if ($dcFM->putContent($f_content) !== false) { header('Location: '.$p_url.'&f='.$dcFM->base_path); exit; } else { $err = '

'.__('Cannot write file.').'

'; } } # Renommer un fichier/répertoire if (!empty($_GET['new_name']) && $dcFM->isParentWritable()) { if($dcFM->rename($_GET['new_name']) !== false) { header('Location: '.$p_url.'&f='.dirname($dcFM->base_path)); exit; } else { $err = '

'.__('Cannot rename.').'

'; } } # Suppression d'un fichier if (!empty($_GET['del']) && $dcFM->isDeletable()) { if ($dcFM->delete() === true) { header('Location: '.$p_url.'&f='.dirname($dcFM->base_path)); exit; } else { $err = '

'.__('Cannot delete.').'

'; } } } /* Affichage -------------------------------------------------------- */ buffer::str('

'.__('Files manager').'

'); if ($err != '') { buffer::str( '

'.__('Error(s)').' :

'. $err. '
' ); } buffer::str('

'.$dcFM->getNavBar().'

'); if (!$dcFM->isExclude() && ($f_list = $dcFM->getDir()) !== false) { $th_style=' style="border-bottom:1px solid #ccc;"'; buffer::str( ''. ' '.__('name').''. ''.__('size').''.__('date').''. ' ' ); $i=0; foreach ($f_list['dirs'] as $k => $v) { buffer::str(@$dcFM->getLine($k,$v,($i%2))); $i++; } foreach ($f_list['files'] as $k => $v) { buffer::str(@$dcFM->getLine($k,$v,($i%2))); $i++; } buffer::str('
'); } if ($dcFM->isFile() && !$dcFM->isExclude()) { if (!$dcFM->isReadable()) { buffer::str('

'.__('This file is not readable.').'

'); } else { if ($dcFM->isImg()) { buffer::str( '' ); } else { if ($dcFM->isWritable()) { buffer::str( '

'.__('This file is writable.').'

'. '
'. ''. '

'. ''. '

'. '
' ); } else { buffer::str( '

'.__('This file is not writable.').'

'. '
'. '
'.
				htmlspecialchars($dcFM->getContent()).
				'
' ); } } } } if ($dcFM->base_path != '' and $dcFM->isParentWritable() && !$dcFM->isExclude()) { buffer::str( '
'. '
'. sprintf(__('Rename this %s'),($dcFM->isFile()) ? __('file') : __('directory')). ''. '

'. form::field('new_name',20,'',htmlspecialchars(basename($dcFM->base_path))). ' '. ''. '

'. '
' ); } if ($dcFM->isWritable() && $dcFM->isDir() && !$dcFM->isExclude()) { buffer::str( '
'. '
'.__('New directory').''. '

'. form::field('new_dir',20,''). ' '. ''. '

'. '
' ); buffer::str( '
'. '
'.__('Add a file').' :'. '

'. '

'. '

'. form::field('up_name',20,'').' '. ''. ''. '

'. '
' ); } ?>