Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         admintools
6
 * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker 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 1818 2012-11-15 22:54:21Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/media/index.php $
14
 * @lastmodified    $Date: 2012-11-15 23:54:21 +0100 (Thu, 15 Nov 2012) $
15
 *
16
 */
17

    
18
// Print admin header
19
if(!defined('WB_URL'))
20
{
21
    $config_file = realpath('../../config.php');
22
    if(file_exists($config_file) && !defined('WB_URL'))
23
    {
24
    	require($config_file);
25
    }
26
}
27
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
28

    
29
$admin = new admin('Media', 'media');
30

    
31
$starttime = explode(" ", microtime());
32
$starttime = $starttime[0]+$starttime[1];
33
include ('parameters.php');
34

    
35
// Setup template object, parse vars to it, then parse it
36
// Create new template object
37
$template = new Template(dirname($admin->correct_theme_source('media.htt')));
38
$template->set_file('page', 'media.htt');
39
$template->set_block('page', 'main_block', 'main');
40

    
41
// Include the WB functions file
42
require_once(WB_PATH.'/framework/functions.php');
43

    
44
// Get home folder not to show
45
$home_folders = get_home_folders();
46

    
47
// Insert values
48
$template->set_block('main_block', 'dir_list_block', 'dir_list');
49
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
50
$currentHome = $admin->get_home_folder();
51

    
52
if ($currentHome!=''){
53
	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
54
}
55
else
56
{
57
	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
58
}
59

    
60
$array_lowercase = array_map('strtolower', $dirs);
61
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
62
foreach($dirs AS $name) {
63

    
64
	if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)]) || $currentHome =='' )
65
    {
66
		$template->set_var('NAME', str_replace(WB_PATH, '', $name));
67
		$template->parse('dir_list', 'dir_list_block', true);
68
	}
69
}
70

    
71
// Insert permissions values
72
if($admin->get_permission('media_create') != true) {
73
	$template->set_var('DISPLAY_CREATE', 'hide');
74
}
75
if($admin->get_permission('media_upload') != true) {
76
	$template->set_var('DISPLAY_UPLOAD', 'hide');
77
}
78
if ($_SESSION['GROUP_ID'] != 1 && (isset($pathsettings['global']['admin_only']) && $pathsettings['global']['admin_only'])) {
79
    // Only show admin the settings link
80
	$template->set_var('DISPLAY_SETTINGS', 'hide');
81
}
82
// Workout if the up arrow should be shown
83
if(($dirs == '') or ($dirs==$currentHome) or (!array_key_exists('dir', $_GET))) {
84
	$display_up_arrow = 'hide';
85
} else {
86
	$display_up_arrow = '';
87
}
88

    
89
// Insert language headings
90
$template->set_var(array(
91
					'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
92
					'HOME_DIRECTORY' => $currentHome,
93
					'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
94
					'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
95
					'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
96
				)
97
			);
98
// insert urls
99
$template->set_var(array(
100
					'ADMIN_URL' => ADMIN_URL,
101
					'WB_URL' => WB_URL,
102
					'WB_PATH' => WB_PATH,
103
					'THEME_URL' => THEME_URL
104
				)
105
			);
106
// Insert language text and messages
107
$template->set_var(array(
108
					'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
109
//					'MEDIA_DIRECTORY' => ($currentHome!='') ? MEDIA_DIRECTORY : $currentHome,
110
					'TEXT_NAME' => $TEXT['TITLE'],
111
					'TEXT_RELOAD' => $TEXT['RELOAD'],
112
					'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
113
					'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
114
					'TEXT_FILES' => $TEXT['FILES'],
115
					'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
116
					'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
117
					'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
118
					'OPTIONS' => $TEXT['OPTION'],
119
					'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
120
					'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
121
					'FTAN' => $admin->getFTAN()
122
				)
123
			);
124

    
125
// Parse template object
126
$template->parse('main', 'main_block', false);
127
$template->pparse('output', 'page');
128
/*
129
$endtime=explode(" ", microtime());
130
$endtime=$endtime[0]+$endtime[1];
131
$debugVMsg = '';
132
if($admin->ami_group_member('1') ) {
133
	$debugVMsg  = "<p>Mask loaded in ".round($endtime - $starttime,6)." Sec,&nbsp;&nbsp;";
134
	$debugVMsg .= "Memory in use ".number_format(memory_get_usage(true), 0, ',', '.')."&nbsp;Byte,&nbsp;&nbsp;";
135
	$debugVMsg .= sizeof(get_included_files())."&nbsp;included files</p>";
136
	// $debugVMsg = print_message($debugVMsg,'#','debug',-1,false);
137
	print $debugVMsg.'<br />';
138
 }
139
*/
140
// Print admin
141
$admin->print_footer();
(7-7/15)