1 |
4
|
ryan
|
<?php
|
2 |
1400
|
FrankH
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package admintools
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
|
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9 |
|
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
|
|
* @requirements PHP 5.2.2 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL: $
|
15 |
|
|
* @lastmodified $Date: $
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
4
|
ryan
|
|
19 |
|
|
// Print admin header
|
20 |
|
|
require('../../config.php');
|
21 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
22 |
|
|
$admin = new admin('Media', 'media');
|
23 |
1035
|
Ruebenwurz
|
include ('parameters.php');
|
24 |
4
|
ryan
|
|
25 |
|
|
// Setup template object
|
26 |
944
|
Ruebenwurz
|
$template = new Template(THEME_PATH.'/templates');
|
27 |
|
|
$template->set_file('page', 'media.htt');
|
28 |
4
|
ryan
|
$template->set_block('page', 'main_block', 'main');
|
29 |
|
|
|
30 |
|
|
// Include the WB functions file
|
31 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
32 |
|
|
|
33 |
|
|
// Get home folder not to show
|
34 |
|
|
$home_folders = get_home_folders();
|
35 |
|
|
|
36 |
|
|
// Insert values
|
37 |
|
|
$template->set_block('main_block', 'dir_list_block', 'dir_list');
|
38 |
1035
|
Ruebenwurz
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
39 |
1087
|
Ruebenwurz
|
$currentHome = $admin->get_home_folder();
|
40 |
|
|
|
41 |
|
|
if ($currentHome){
|
42 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
|
43 |
|
|
}
|
44 |
|
|
else
|
45 |
|
|
{
|
46 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
47 |
|
|
}
|
48 |
1035
|
Ruebenwurz
|
$array_lowercase = array_map('strtolower', $dirs);
|
49 |
|
|
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
50 |
|
|
foreach($dirs AS $name) {
|
51 |
4
|
ryan
|
if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) {
|
52 |
|
|
$template->set_var('NAME', str_replace(WB_PATH, '', $name));
|
53 |
|
|
$template->parse('dir_list', 'dir_list_block', true);
|
54 |
|
|
}
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
// Insert permissions values
|
58 |
|
|
if($admin->get_permission('media_create') != true) {
|
59 |
|
|
$template->set_var('DISPLAY_CREATE', 'hide');
|
60 |
|
|
}
|
61 |
|
|
if($admin->get_permission('media_upload') != true) {
|
62 |
|
|
$template->set_var('DISPLAY_UPLOAD', 'hide');
|
63 |
|
|
}
|
64 |
1035
|
Ruebenwurz
|
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
|
65 |
|
|
$template->set_var('DISPLAY_SETTINGS', 'hide');
|
66 |
|
|
}
|
67 |
1087
|
Ruebenwurz
|
// Workout if the up arrow should be shown
|
68 |
|
|
if(($dirs == '') or ($dirs==$currentHome) or (!array_key_exists('dir', $_GET))) {
|
69 |
|
|
$display_up_arrow = 'hide';
|
70 |
|
|
} else {
|
71 |
|
|
$display_up_arrow = '';
|
72 |
|
|
}
|
73 |
4
|
ryan
|
|
74 |
|
|
// Insert language headings
|
75 |
|
|
$template->set_var(array(
|
76 |
|
|
'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
|
77 |
1087
|
Ruebenwurz
|
'HOME_DIRECTORY' => $currentHome,
|
78 |
|
|
'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
|
79 |
4
|
ryan
|
'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
|
80 |
|
|
'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
|
81 |
|
|
)
|
82 |
|
|
);
|
83 |
1112
|
Ruebenwurz
|
// insert urls
|
84 |
|
|
$template->set_var(array(
|
85 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
86 |
|
|
'WB_URL' => WB_URL,
|
87 |
|
|
'WB_PATH' => WB_PATH,
|
88 |
|
|
'THEME_URL' => THEME_URL
|
89 |
|
|
)
|
90 |
|
|
);
|
91 |
4
|
ryan
|
// Insert language text and messages
|
92 |
|
|
$template->set_var(array(
|
93 |
|
|
'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
|
94 |
|
|
'TEXT_NAME' => $TEXT['TITLE'],
|
95 |
1035
|
Ruebenwurz
|
'TEXT_RELOAD' => $TEXT['RELOAD'],
|
96 |
4
|
ryan
|
'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
|
97 |
|
|
'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
|
98 |
|
|
'TEXT_FILES' => $TEXT['FILES'],
|
99 |
|
|
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
|
100 |
1023
|
Ruebenwurz
|
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
|
101 |
1035
|
Ruebenwurz
|
'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
|
102 |
|
|
'OPTIONS' => $TEXT['OPTION'],
|
103 |
1023
|
Ruebenwurz
|
'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
|
104 |
1400
|
FrankH
|
'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
|
105 |
|
|
'FTAN' => $admin->getFTAN()
|
106 |
4
|
ryan
|
)
|
107 |
|
|
);
|
108 |
|
|
|
109 |
|
|
// Parse template object
|
110 |
|
|
$template->parse('main', 'main_block', false);
|
111 |
|
|
$template->pparse('output', 'page');
|
112 |
|
|
|
113 |
|
|
// Print admin
|
114 |
|
|
$admin->print_footer();
|
115 |
|
|
|
116 |
|
|
?>
|