Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         admintools
6
 * @author          WebsiteBaker Project
7
 * @copyright       Ryan Djurovich
8
 * @copyright       WebsiteBaker Org. e.V.
9
 * @link            http://websitebaker.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.3
12
 * @requirements    PHP 5.3.6 and higher
13
 * @version         $Id: index.php 2 2017-07-02 15:14:29Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/admin/media/index.php $
15
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
16
 *
17
 */
18

    
19
// Print admin header
20
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
21
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
22
$admin = new admin('Media', 'media');
23

    
24
$starttime = explode(" ", microtime());
25
$starttime = $starttime[0]+$starttime[1];
26
include ('parameters.php');
27

    
28
// Setup template object, parse vars to it, then parse it
29
// Create new template object
30
$template = new Template(dirname($admin->correct_theme_source('media.htt')));
31
$template->set_file('page', 'media.htt');
32
$template->set_block('page', 'main_block', 'main');
33

    
34
// Include the WB functions file
35
require_once(WB_PATH.'/framework/functions.php');
36

    
37
// Get home folder not to show
38
$home_folders = get_home_folders();
39

    
40
// Insert values
41
$template->set_block('main_block', 'dir_list_block', 'dir_list');
42
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
43
$currentHome = $admin->get_home_folder();
44

    
45
if ($currentHome){
46
    $dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
47
}
48
else
49
{
50
    $dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
51
}
52
$array_lowercase = array_map('strtolower', $dirs);
53
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
54
foreach($dirs AS $name) {
55
    if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) {
56
        $template->set_var('NAME', str_replace(WB_PATH, '', $name));
57
        $template->parse('dir_list', 'dir_list_block', true);
58
    }
59
}
60

    
61
// Insert permissions values
62
if($admin->get_permission('media_create') != true) {
63
    $template->set_var('DISPLAY_CREATE', 'hide');
64
}
65
if($admin->get_permission('media_upload') != true) {
66
    $template->set_var('DISPLAY_UPLOAD', 'hide');
67
}
68
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
69
    $template->set_var('DISPLAY_SETTINGS', 'hide');
70
}
71
// Workout if the up arrow should be shown
72
if(($dirs == '') or ($dirs==$currentHome) or (!array_key_exists('dir', $_GET))) {
73
    $display_up_arrow = 'hide';
74
} else {
75
    $display_up_arrow = '';
76
}
77

    
78
// Insert language headings
79
$template->set_var(array(
80
                    'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
81
                    'HOME_DIRECTORY' => $currentHome,
82
                    'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
83
                    'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
84
                    'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES'],
85
                )
86
            );
87
// insert urls
88
$template->set_var(array(
89
                    'ADMIN_URL' => ADMIN_URL,
90
                    'WB_URL' => WB_URL,
91
                    'THEME_URL' => THEME_URL
92
                )
93
            );
94
// Insert language text and messages
95
$template->set_var(array(
96
                    'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
97
                    'TEXT_NAME' => $TEXT['TITLE'],
98
                    'TEXT_RELOAD' => $TEXT['RELOAD'],
99
                    'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
100
                    'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
101
                    'TEXT_FILES' => $TEXT['FILES'],
102
                    'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
103
                    'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
104
                    'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
105
                    'OPTIONS' => $TEXT['OPTION'],
106
                    'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
107
                    'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
108
                    'FTAN' => $admin->getFTAN()
109
                )
110
            );
111

    
112
// Parse template object
113
$template->parse('main', 'main_block', false);
114
$template->pparse('output', 'page');
115
$admin->print_footer();
(7-7/16)