Project

General

Profile

1 4 ryan
<?php
2 1400 FrankH
/**
3
 *
4
 * @category        admin
5
 * @package         admintools
6 1529 Luisehahne
 * @author          Ryan Djurovich, WebsiteBaker Project
7 1400 FrankH
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17 4 ryan
18
// Print admin header
19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
21
$admin = new admin('Media', 'media');
22 1457 Luisehahne
23
$starttime = explode(" ", microtime());
24
$starttime = $starttime[0]+$starttime[1];
25 1035 Ruebenwurz
include ('parameters.php');
26 4 ryan
27 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
28
$ThemePath = realpath(WB_PATH.$admin->correct_theme_source('media.htt'));
29
// Create new template object
30
$template = new Template($ThemePath);
31 944 Ruebenwurz
$template->set_file('page', 'media.htt');
32 4 ryan
$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 1035 Ruebenwurz
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
43 1087 Ruebenwurz
$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 1035 Ruebenwurz
$array_lowercase = array_map('strtolower', $dirs);
53
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
54
foreach($dirs AS $name) {
55 4 ryan
	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 1035 Ruebenwurz
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
69
	$template->set_var('DISPLAY_SETTINGS', 'hide');
70
}
71 1087 Ruebenwurz
// 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 4 ryan
78
// Insert language headings
79
$template->set_var(array(
80 1457 Luisehahne
					'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 1112 Ruebenwurz
// insert urls
88
$template->set_var(array(
89 1457 Luisehahne
					'ADMIN_URL' => ADMIN_URL,
90
					'WB_URL' => WB_URL,
91
					'WB_PATH' => WB_PATH,
92
					'THEME_URL' => THEME_URL
93
				)
94
			);
95 4 ryan
// Insert language text and messages
96
$template->set_var(array(
97 1457 Luisehahne
					'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
98
					'TEXT_NAME' => $TEXT['TITLE'],
99
					'TEXT_RELOAD' => $TEXT['RELOAD'],
100
					'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
101
					'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
102
					'TEXT_FILES' => $TEXT['FILES'],
103
					'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
104
					'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
105
					'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
106
					'OPTIONS' => $TEXT['OPTION'],
107
					'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
108
					'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
109
					'FTAN' => $admin->getFTAN()
110
				)
111
			);
112 4 ryan
113
// Parse template object
114
$template->parse('main', 'main_block', false);
115
$template->pparse('output', 'page');
116 1540 Luisehahne
/*
117 1457 Luisehahne
$endtime=explode(" ", microtime());
118
$endtime=$endtime[0]+$endtime[1];
119
$debugVMsg = '';
120
if($admin->ami_group_member('1') ) {
121
	$debugVMsg  = "<p>Mask loaded in ".round($endtime - $starttime,6)." Sec,&nbsp;&nbsp;";
122
	$debugVMsg .= "Memory in use ".number_format(memory_get_usage(true), 0, ',', '.')."&nbsp;Byte,&nbsp;&nbsp;";
123
	$debugVMsg .= sizeof(get_included_files())."&nbsp;included files</p>";
124
	// $debugVMsg = print_message($debugVMsg,'#','debug',-1,false);
125
	print $debugVMsg.'<br />';
126
 }
127 1540 Luisehahne
*/
128 1457 Luisehahne
// Print admin
129 4 ryan
$admin->print_footer();