/var/www/(Del)hsihk.com/wp-content/plugins/backupbuddy/controllers/ajax/exclude_tree.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
if ( ! is_admin() ) { die( 'Access denied.' ); }
// Directory exclusions picker for settings page.

/*    exclude_tree()
 *    
 *    Directory exclusion tree for settings page.
 *    
 *    @return        null
 */

$root ABSPATH urldecodepb_backupbuddy::_POST'dir' ) );

if( 
file_exists$root ) ) {
    
$files scandir$root );
    
    
natcasesort$files );
    
    
// Sort with directories first.
    
$sorted_files = array(); // Temporary holder for sorting files.
    
$sorted_directories = array(); // Temporary holder for sorting directories.
    
foreach( $files as $file ) {
        if ( ( 
$file == '.' ) || ( $file == '..' ) ) {
            continue;
        }
        if( 
is_filestr_replace'//''/'$root $file ) ) ) {
            
array_push$sorted_files$file );
        } else {
            
array_unshift$sorted_directories$file );
        }
    }
    
$files array_mergearray_reverse$sorted_directories ), $sorted_files );
    unset( 
$sorted_files );
    unset( 
$sorted_directories );
    unset( 
$file );
    
    
    if( 
count$files ) > ) { // Files found.
        
echo '<ul class="jqueryFileTree" style="display: none;">';
        foreach( 
$files as $file ) {
            if( 
file_existsstr_replace'//''/'$root $file ) ) ) {
                if ( 
is_dirstr_replace'//''/'$root $file ) ) ) { // Directory.
                    
echo '<li class="directory collapsed">';
                    
$return '';
                    
$return .= '<div class="pb_backupbuddy_treeselect_control">';
                    
$return .= '<img src="' pb_backupbuddy::plugin_url() . '/images/redminus.png" style="vertical-align: -3px;" title="Add to exclusions..." class="pb_backupbuddy_filetree_exclude">';
                    
$return .= '</div>';
                    echo 
'<a href="#" rel="' htmlentitiesstr_replaceABSPATH''$root ) . $file) . '/" title="Toggle expand...">' htmlentities($file) . $return '</a>';
                    echo 
'</li>';
                } else { 
// File.
                    
echo '<li class="file collapsed">';
                    
$return '';
                    
$return .= '<div class="pb_backupbuddy_treeselect_control">';
                    
$return .= '<img src="' pb_backupbuddy::plugin_url() . '/images/redminus.png" style="vertical-align: -3px;" title="Add to exclusions..." class="pb_backupbuddy_filetree_exclude">';
                    
$return .= '</div>';
                    echo 
'<a href="#" rel="' htmlentitiesstr_replaceABSPATH''$root ) . $file) . '">' htmlentities($file) . $return '</a>';
                    echo 
'</li>';
                }
            }
        }
        echo 
'</ul>';
    } else {
        echo 
'<ul class="jqueryFileTree" style="display: none;">';
        echo 
'<li><a href="#" rel="' htmlentitiespb_backupbuddy::_POST'dir' ) . 'NONE' ) . '"><i>Empty Directory ...</i></a></li>';
        echo 
'</ul>';
    }
} else {
    echo 
'Error #1127555. Unable to read site root.';
}

die();