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 2098 2014-02-11 01:37:03Z darkviper $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/media/index.php $
|
14
|
* @lastmodified $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
|
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
|
$oTrans = Translate::getInstance();
|
28
|
$oTrans->enableAddon('admin\\media');
|
29
|
|
30
|
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
|
31
|
|
32
|
$admin = new admin('Media', 'media');
|
33
|
|
34
|
$starttime = explode(" ", microtime());
|
35
|
$starttime = $starttime[0]+$starttime[1];
|
36
|
include ('parameters.php');
|
37
|
|
38
|
// Setup template object, parse vars to it, then parse it
|
39
|
// Create new template object
|
40
|
$template = new Template(dirname($admin->correct_theme_source('media.htt')));
|
41
|
$template->set_file('page', 'media.htt');
|
42
|
$template->set_block('page', 'main_block', 'main');
|
43
|
$template->set_var($oTrans->getLangArray());
|
44
|
// Include the WB functions file
|
45
|
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
|
46
|
|
47
|
// Target location
|
48
|
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
|
49
|
$directory = (isset(${$requestMethod}['dir'])) ? ${$requestMethod}['dir'] : '';
|
50
|
|
51
|
$directory = ($directory == '/') ? '' : $directory;
|
52
|
$dirlink = 'index.php?dir='.$directory;
|
53
|
$rootlink = 'index.php?dir=';
|
54
|
|
55
|
// Get home folder not to show
|
56
|
$home_folders = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? get_home_folders() : array();
|
57
|
|
58
|
// Insert values
|
59
|
$template->set_block('main_block', 'dir_list_block', 'dir_list');
|
60
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
61
|
$currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
|
62
|
if ($currentHome!=''){
|
63
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
|
64
|
}
|
65
|
else
|
66
|
{
|
67
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
68
|
}
|
69
|
|
70
|
$array_lowercase = array_map('strtolower', $dirs);
|
71
|
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
72
|
foreach($dirs AS $name) {
|
73
|
|
74
|
if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)]) || $currentHome =='' )
|
75
|
{
|
76
|
$template->set_var('NAME', str_replace(WB_PATH, '', $name));
|
77
|
$template->parse('dir_list', 'dir_list_block', true);
|
78
|
}
|
79
|
}
|
80
|
|
81
|
// Insert permissions values
|
82
|
if($admin->get_permission('media_create') != true) {
|
83
|
$template->set_var('DISPLAY_CREATE', 'hide');
|
84
|
}
|
85
|
if($admin->get_permission('media_upload') != true) {
|
86
|
$template->set_var('DISPLAY_UPLOAD', 'hide');
|
87
|
}
|
88
|
if ($_SESSION['GROUP_ID'] != 1 && (isset($pathsettings['global']['admin_only']) && $pathsettings['global']['admin_only'])) {
|
89
|
// Only show admin the settings link
|
90
|
$template->set_var('DISPLAY_SETTINGS', 'hide');
|
91
|
}
|
92
|
// Workout if the up arrow should be shown
|
93
|
if(($dirs == '') or ($dirs==$currentHome) or (!array_key_exists('dir', $_GET))) {
|
94
|
$display_up_arrow = 'hide';
|
95
|
} else {
|
96
|
$display_up_arrow = '';
|
97
|
}
|
98
|
|
99
|
// Insert language headings
|
100
|
$template->set_var(array(
|
101
|
'HOME_DIRECTORY' => $currentHome,
|
102
|
// 'HOME_DIRECTORY' => ( $currentHome!='') ? $currentHome : $directory,
|
103
|
'DISPLAY_UP_ARROW' => $display_up_arrow // **!
|
104
|
)
|
105
|
);
|
106
|
// insert urls
|
107
|
$template->set_var(array(
|
108
|
'ADMIN_URL' => ADMIN_URL,
|
109
|
'WB_URL' => WB_URL,
|
110
|
'WB_PATH' => WB_PATH,
|
111
|
'THEME_URL' => THEME_URL
|
112
|
)
|
113
|
);
|
114
|
// Insert language text and messages
|
115
|
$template->set_var(array(
|
116
|
'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
|
117
|
// 'MEDIA_DIRECTORY' => ($currentHome!='') ? MEDIA_DIRECTORY : $currentHome,
|
118
|
'TEXT_NAME' => $oTrans->TEXT_TITLE,
|
119
|
'CHANGE_SETTINGS' => $oTrans->TEXT_MODIFY_SETTINGS,
|
120
|
'OPTIONS' => $oTrans->TEXT_OPTION,
|
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, ";
|
134
|
$debugVMsg .= "Memory in use ".number_format(memory_get_usage(true), 0, ',', '.')." Byte, ";
|
135
|
$debugVMsg .= sizeof(get_included_files())." included files</p>";
|
136
|
// $debugVMsg = print_message($debugVMsg,'#','debug',-1,false);
|
137
|
print $debugVMsg.'<br />';
|
138
|
}
|
139
|
*/
|
140
|
// Print admin
|
141
|
$admin->print_footer();
|