Project

General

Profile

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
$array_lowercase = array_map('strtolower', $dirs);
47
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
48
foreach($dirs AS $name) {
49 4 ryan
	if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) {
50
		$template->set_var('NAME', str_replace(WB_PATH, '', $name));
51
		$template->parse('dir_list', 'dir_list_block', true);
52
	}
53
}
54
55
// Insert permissions values
56
if($admin->get_permission('media_create') != true) {
57
	$template->set_var('DISPLAY_CREATE', 'hide');
58
}
59
if($admin->get_permission('media_upload') != true) {
60
	$template->set_var('DISPLAY_UPLOAD', 'hide');
61
}
62 1035 Ruebenwurz
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
63
	$template->set_var('DISPLAY_SETTINGS', 'hide');
64
}
65 4 ryan
66
// Insert language headings
67
$template->set_var(array(
68
								'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
69
								'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
70
								'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
71
								)
72
						);
73
// Insert language text and messages
74
$template->set_var(array(
75
								'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
76
								'TEXT_NAME' => $TEXT['TITLE'],
77 1035 Ruebenwurz
								'TEXT_RELOAD' => $TEXT['RELOAD'],
78 4 ryan
								'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
79
								'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
80
								'TEXT_FILES' => $TEXT['FILES'],
81
								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
82 1023 Ruebenwurz
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
83 1035 Ruebenwurz
								'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
84
								'OPTIONS' => $TEXT['OPTION'],
85 1023 Ruebenwurz
								'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
86
								'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP']
87 4 ryan
								)
88
						);
89
90
// Parse template object
91
$template->parse('main', 'main_block', false);
92
$template->pparse('output', 'page');
93
94
// Print admin
95
$admin->print_footer();
96
97
?>