Project

General

Profile

1
<?php
2
/**
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: index.php 1400 2011-01-21 19:42:51Z FrankH $
14
 * @filesource		$HeadURL:  $
15
 * @lastmodified    $Date:  $
16
 *
17
 */
18

    
19
// Print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Media', 'media');
23
include ('parameters.php');
24

    
25
// Setup template object
26
$template = new Template(THEME_PATH.'/templates');
27
$template->set_file('page', 'media.htt');
28
$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
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
39
$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
$array_lowercase = array_map('strtolower', $dirs);
49
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
50
foreach($dirs AS $name) {
51
	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
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
65
	$template->set_var('DISPLAY_SETTINGS', 'hide');
66
}
67
// 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

    
74
// Insert language headings
75
$template->set_var(array(
76
								'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
77
								'HOME_DIRECTORY' => $currentHome,
78
								'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
79
								'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
80
								'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
81
								)
82
						);
83
// 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
// Insert language text and messages
92
$template->set_var(array(
93
								'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
94
								'TEXT_NAME' => $TEXT['TITLE'],
95
								'TEXT_RELOAD' => $TEXT['RELOAD'],
96
								'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
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
101
								'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
102
								'OPTIONS' => $TEXT['OPTION'],
103
								'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
104
								'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
105
								'FTAN' => $admin->getFTAN()
106
								)
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
?>
(4-4/12)