public function backup_path($path)
 {
     $this->config->set_current_action(sprintf(__('Backing up WordPress path at (%s)', 'wpbtd'), $path));
     $processed_files = $this->config->get_processed_files();
     $file_list = new File_List();
     $next_check = 0;
     if (file_exists($path)) {
         $source = realpath($path);
         $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
         foreach ($files as $file_info) {
             $file = $file_info->getPathname();
             if (time() > $next_check) {
                 if (!$this->config->in_progress()) {
                     return;
                 }
                 $this->config->add_processed_files($processed_files);
                 $next_check = time() + 5;
             }
             if ($file_list->is_excluded($file)) {
                 continue;
             }
             if (is_file($file)) {
                 if (File_List::in_ignore_list(basename($file))) {
                     continue;
                 }
                 if (in_array($file, $processed_files)) {
                     continue;
                 }
                 if (dirname($file) == $this->config->get_backup_dir() && !(substr(basename($file), -4, 4) == '.sql' || substr(basename($file), -8, 8) == '.sql.zip')) {
                     continue;
                 }
                 $this->output->out($source, $file);
                 $processed_files[] = $file;
             }
         }
         $this->output->end();
     }
 }
 *          the Free Software Foundation; either version 2 of the License, or
 *          (at your option) any later version.
 *
 *          This program is distributed in the hope that it will be useful,
 *          but WITHOUT ANY WARRANTY; without even the implied warranty of
 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *          GNU General Public License for more details.
 *
 *          You should have received a copy of the GNU General Public License
 *          along with this program; if not, write to the Free Software
 *          Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
 */
WP_Backup_Registry::config()->set_time_limit();
WP_Backup_Registry::config()->set_memory_limit();
try {
    $file_list = new File_List();
    if (isset($_POST['dir'])) {
        //Convert to the os' directiry separator
        $_POST['dir'] = str_replace('/', DIRECTORY_SEPARATOR, urldecode($_POST['dir']));
        if (file_exists($_POST['dir']) && is_readable($_POST['dir'])) {
            $files = scandir($_POST['dir']);
            natcasesort($files);
            if (count($files) > 2) {
                /* The 2 accounts for . and .. */
                echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
                // All dirs
                foreach ($files as $file) {
                    if ($file != '.' && $file != '..' && file_exists($_POST['dir'] . $file) && is_dir($_POST['dir'] . $file)) {
                        if (!is_readable($_POST['dir']) || $_POST['dir'] == dirname(get_sanitized_home_path()) && !strstr($file, basename(get_sanitized_home_path()))) {
                            continue;
                        }
Beispiel #3
0
            }
            $delItem_vig = str_replace($delItem_extension, $myAdmin->suffixeVignettes . $num . $delItem_extension, $delItem);
            $delItem_vig = str_replace($myAdmin->suffixeVignettes . $num . $delItem_extension, $myAdmin->suffixeVignettes . $num . $delItem_extension, $delItem_vig);
            if (file_exists($delItem_vig)) {
                unlink($delItem_vig);
            }
        }
    }
}
// suppression d'un fichier
// Get started looking for files
if (!file_exists($path)) {
    $res = mkdir($path);
    chmod($path, octdec($thisSite->DROITS_DOSSIER_ECRITURE));
}
$file_list = new File_List();
if (strlen($search) > 2) {
    $listing = $file_list->getListing($path, File_List::TYPE_BOTH, $order_by, $order_dir, 0, 1000, $displaySizes);
} else {
    $listing = $file_list->getListing($path, File_List::TYPE_BOTH, $order_by, $order_dir, $start, $limit, $displaySizes);
}
// preparation template
$smarty->assign("field", $field);
$smarty->assign("startFolder", $startFolder);
$smarty->assign("from", $from);
$smarty->assign("CKEditor", $CKEditor);
$smarty->assign("CKEditorFuncNum", $CKEditorFuncNum);
$smarty->assign("tmfield", $tmfield);
$smarty->assign("path", $path);
$smarty->assign("order_by", $order_by);
$smarty->assign("order_dir", $order_dir);
 * @license This program is free software; you can redistribute it and/or modify
 *          it under the terms of the GNU General Public License as published by
 *          the Free Software Foundation; either version 2 of the License, or
 *          (at your option) any later version.
 *
 *          This program is distributed in the hope that it will be useful,
 *          but WITHOUT ANY WARRANTY; without even the implied warranty of
 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *          GNU General Public License for more details.
 *
 *          You should have received a copy of the GNU General Public License
 *          along with this program; if not, write to the Free Software
 *          Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
 */
try {
    $file_list = new File_List();
    $file_list->test_memory();
    if (isset($_POST['dir'])) {
        $_POST['dir'] = urldecode($_POST['dir']);
        if (file_exists($_POST['dir']) && is_readable($_POST['dir'])) {
            $files = scandir($_POST['dir']);
            natcasesort($files);
            if (count($files) > 2) {
                /* The 2 accounts for . and .. */
                echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
                // All dirs
                foreach ($files as $file) {
                    if ($file != '.' && $file != '..' && file_exists($_POST['dir'] . $file) && is_dir($_POST['dir'] . $file)) {
                        if (!is_readable($_POST['dir']) || $_POST['dir'] == dirname(ABSPATH) . '/' && !strstr($file, basename(ABSPATH))) {
                            continue;
                        }
 public function backup_path($path, $dropbox_path = null, $always_include = array())
 {
     if (!$this->config->get_option('in_progress')) {
         return;
     }
     if (!$dropbox_path) {
         $dropbox_path = get_sanitized_home_path();
     }
     $file_list = new File_List();
     $current_processed_files = $uploaded_files = array();
     $next_check = time() + 5;
     $total_files = $this->config->get_option('total_file_count');
     if ($total_files < 1800) {
         //I doub't very much a wp installation can get smaller then this
         $total_files = 1800;
     }
     $processed_files = new WP_Backup_Processed_Files();
     $processed_file_count = $processed_files->get_file_count();
     if (file_exists($path)) {
         $source = realpath($path);
         $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
         foreach ($files as $file_info) {
             $file = $file_info->getPathname();
             if (time() > $next_check) {
                 $this->config->die_if_stopped();
                 $percent_done = round($processed_file_count / $total_files * 100, 0);
                 if ($percent_done > 99) {
                     $percent_done = 99;
                 }
                 if ($percent_done < 1) {
                     $percent_done = 1;
                 }
                 $processed_files->add_files($current_processed_files);
                 WP_Backup_Registry::logger()->log(sprintf(__('Approximately %s%% complete.', 'wpbtd'), $percent_done), $uploaded_files);
                 $next_check = time() + 5;
                 $uploaded_files = $current_processed_files = array();
             }
             if (!in_array($file, $always_include) && $file_list->is_excluded($file)) {
                 continue;
             }
             if ($file_list->in_ignore_list($file)) {
                 continue;
             }
             if (is_file($file)) {
                 $processed_file = $processed_files->get_file($file);
                 if ($processed_file && $processed_file->offset == 0) {
                     continue;
                 }
                 if (dirname($file) == $this->config->get_backup_dir() && !in_array($file, $always_include)) {
                     continue;
                 }
                 if ($this->output->out($dropbox_path, $file, $processed_file)) {
                     $uploaded_files[] = array('file' => str_replace($dropbox_path . DIRECTORY_SEPARATOR, '', Dropbox_Facade::remove_secret($file)), 'mtime' => filemtime($file));
                     if ($processed_file && $processed_file->offset > 0) {
                         $processed_files->file_complete($file);
                     }
                 }
                 $current_processed_files[] = $file;
                 $processed_file_count++;
             }
         }
         return $processed_file_count;
     }
 }
Beispiel #6
0
// +----------------------------------------------------------------------+
//
// $Id:$
//
// The Class File location
require_once 'file_list.class.php';
// Look for GET parameters that affect the display of files
$path = isset($_GET['path']) ? $_GET['path'] : '../';
$order_by = isset($_GET['order']) ? $_GET['order'] : File_List::KEY_NAME;
$order_dir = isset($_GET['dir']) ? $_GET['dir'] : File_List::ASC;
$start = isset($_GET['start']) ? $_GET['start'] : 0;
$limit = isset($_GET['limit']) ? $_GET['limit'] : 10;
// Very important to sanitize the Path for security
//$path      = sanitizePath($path);
// Get started looking for files
$file_list = new File_List();
$listing = $file_list->getListing($path, File_List::TYPE_BOTH, $order_by, $order_dir, $start, $limit);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    	<meta http-equiv="Content-Type" content="text/html;">
    	<title>File List Class Full Example</title>
        <link rel="stylesheet" type="text/css" href="outils/filelistclass/stylex.css" />
    </head>
    <body>

        <?php 
// Show a messge when there are no items in the top folder
if (!$file_list->getLastItemCount() && !$file_list->getLastError() && !$path) {
    ?>