Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         admintools
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @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: index.php 1540 2011-12-11 21:43:16Z Luisehahne $
13
 * @filesource		$HeadURL:  $
14
 * @lastmodified    $Date:  $
15
 *
16
 */
17

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

    
23
$starttime = explode(" ", microtime());
24
$starttime = $starttime[0]+$starttime[1];
25
include ('parameters.php');
26

    
27
// 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
$template->set_file('page', 'media.htt');
32
$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
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
43
$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
$array_lowercase = array_map('strtolower', $dirs);
53
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
54
foreach($dirs AS $name) {
55
	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
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
69
	$template->set_var('DISPLAY_SETTINGS', 'hide');
70
}
71
// 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

    
78
// Insert language headings
79
$template->set_var(array(
80
					'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
// insert urls
88
$template->set_var(array(
89
					'ADMIN_URL' => ADMIN_URL,
90
					'WB_URL' => WB_URL,
91
					'WB_PATH' => WB_PATH,
92
					'THEME_URL' => THEME_URL
93
				)
94
			);
95
// Insert language text and messages
96
$template->set_var(array(
97
					'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

    
113
// Parse template object
114
$template->parse('main', 'main_block', false);
115
$template->pparse('output', 'page');
116
/*
117
$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
*/
128
// Print admin
129
$admin->print_footer();
(7-7/16)