1 |
4
|
ryan
|
<?php
|
2 |
|
|
|
3 |
310
|
ryan
|
// $Id$
|
4 |
4
|
ryan
|
|
5 |
|
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
915
|
Ruebenwurz
|
Copyright (C) 2004-2009, Ryan Djurovich
|
9 |
4
|
ryan
|
|
10 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
11 |
|
|
it under the terms of the GNU General Public License as published by
|
12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
(at your option) any later version.
|
14 |
|
|
|
15 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
GNU General Public License for more details.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License
|
21 |
|
|
along with Website Baker; if not, write to the Free Software
|
22 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
|
24 |
|
|
*/
|
25 |
|
|
|
26 |
|
|
// Print admin header
|
27 |
|
|
require('../../config.php');
|
28 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
29 |
|
|
$admin = new admin('Media', 'media');
|
30 |
1035
|
Ruebenwurz
|
include ('parameters.php');
|
31 |
4
|
ryan
|
|
32 |
|
|
// Setup template object
|
33 |
944
|
Ruebenwurz
|
$template = new Template(THEME_PATH.'/templates');
|
34 |
|
|
$template->set_file('page', 'media.htt');
|
35 |
4
|
ryan
|
$template->set_block('page', 'main_block', 'main');
|
36 |
|
|
|
37 |
|
|
// Include the WB functions file
|
38 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
39 |
|
|
|
40 |
|
|
// Get home folder not to show
|
41 |
|
|
$home_folders = get_home_folders();
|
42 |
|
|
|
43 |
|
|
// Insert values
|
44 |
|
|
$template->set_block('main_block', 'dir_list_block', 'dir_list');
|
45 |
1035
|
Ruebenwurz
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
46 |
1087
|
Ruebenwurz
|
$currentHome = $admin->get_home_folder();
|
47 |
|
|
|
48 |
|
|
if ($currentHome){
|
49 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
|
50 |
|
|
}
|
51 |
|
|
else
|
52 |
|
|
{
|
53 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
54 |
|
|
}
|
55 |
1035
|
Ruebenwurz
|
$array_lowercase = array_map('strtolower', $dirs);
|
56 |
|
|
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
57 |
|
|
foreach($dirs AS $name) {
|
58 |
4
|
ryan
|
if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) {
|
59 |
|
|
$template->set_var('NAME', str_replace(WB_PATH, '', $name));
|
60 |
|
|
$template->parse('dir_list', 'dir_list_block', true);
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
// Insert permissions values
|
65 |
|
|
if($admin->get_permission('media_create') != true) {
|
66 |
|
|
$template->set_var('DISPLAY_CREATE', 'hide');
|
67 |
|
|
}
|
68 |
|
|
if($admin->get_permission('media_upload') != true) {
|
69 |
|
|
$template->set_var('DISPLAY_UPLOAD', 'hide');
|
70 |
|
|
}
|
71 |
1035
|
Ruebenwurz
|
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
|
72 |
|
|
$template->set_var('DISPLAY_SETTINGS', 'hide');
|
73 |
|
|
}
|
74 |
1087
|
Ruebenwurz
|
// Workout if the up arrow should be shown
|
75 |
|
|
if(($dirs == '') or ($dirs==$currentHome) or (!array_key_exists('dir', $_GET))) {
|
76 |
|
|
$display_up_arrow = 'hide';
|
77 |
|
|
} else {
|
78 |
|
|
$display_up_arrow = '';
|
79 |
|
|
}
|
80 |
4
|
ryan
|
|
81 |
|
|
// Insert language headings
|
82 |
|
|
$template->set_var(array(
|
83 |
|
|
'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
|
84 |
1087
|
Ruebenwurz
|
'HOME_DIRECTORY' => $currentHome,
|
85 |
|
|
'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
|
86 |
4
|
ryan
|
'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
|
87 |
|
|
'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
|
88 |
|
|
)
|
89 |
|
|
);
|
90 |
|
|
// Insert language text and messages
|
91 |
|
|
$template->set_var(array(
|
92 |
|
|
'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
|
93 |
|
|
'TEXT_NAME' => $TEXT['TITLE'],
|
94 |
1035
|
Ruebenwurz
|
'TEXT_RELOAD' => $TEXT['RELOAD'],
|
95 |
4
|
ryan
|
'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
|
96 |
|
|
'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
|
97 |
|
|
'TEXT_FILES' => $TEXT['FILES'],
|
98 |
|
|
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
|
99 |
1023
|
Ruebenwurz
|
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
|
100 |
1035
|
Ruebenwurz
|
'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
|
101 |
|
|
'OPTIONS' => $TEXT['OPTION'],
|
102 |
1023
|
Ruebenwurz
|
'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
|
103 |
|
|
'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP']
|
104 |
4
|
ryan
|
)
|
105 |
|
|
);
|
106 |
|
|
|
107 |
|
|
// Parse template object
|
108 |
|
|
$template->parse('main', 'main_block', false);
|
109 |
|
|
$template->pparse('output', 'page');
|
110 |
|
|
|
111 |
|
|
// Print admin
|
112 |
|
|
$admin->print_footer();
|
113 |
|
|
|
114 |
|
|
?>
|