| 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 |
|
|
// Create new template object
|
| 29 |
1625
|
Luisehahne
|
$template = new Template(dirname($admin->correct_theme_source('media.htt')));
|
| 30 |
944
|
Ruebenwurz
|
$template->set_file('page', 'media.htt');
|
| 31 |
4
|
ryan
|
$template->set_block('page', 'main_block', 'main');
|
| 32 |
|
|
|
| 33 |
|
|
// Include the WB functions file
|
| 34 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
| 35 |
|
|
|
| 36 |
|
|
// Get home folder not to show
|
| 37 |
|
|
$home_folders = get_home_folders();
|
| 38 |
|
|
|
| 39 |
|
|
// Insert values
|
| 40 |
|
|
$template->set_block('main_block', 'dir_list_block', 'dir_list');
|
| 41 |
1035
|
Ruebenwurz
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
| 42 |
1087
|
Ruebenwurz
|
$currentHome = $admin->get_home_folder();
|
| 43 |
|
|
|
| 44 |
|
|
if ($currentHome){
|
| 45 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
|
| 46 |
|
|
}
|
| 47 |
|
|
else
|
| 48 |
|
|
{
|
| 49 |
|
|
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
| 50 |
|
|
}
|
| 51 |
1035
|
Ruebenwurz
|
$array_lowercase = array_map('strtolower', $dirs);
|
| 52 |
|
|
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
| 53 |
|
|
foreach($dirs AS $name) {
|
| 54 |
4
|
ryan
|
if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) {
|
| 55 |
|
|
$template->set_var('NAME', str_replace(WB_PATH, '', $name));
|
| 56 |
|
|
$template->parse('dir_list', 'dir_list_block', true);
|
| 57 |
|
|
}
|
| 58 |
|
|
}
|
| 59 |
|
|
|
| 60 |
|
|
// Insert permissions values
|
| 61 |
|
|
if($admin->get_permission('media_create') != true) {
|
| 62 |
|
|
$template->set_var('DISPLAY_CREATE', 'hide');
|
| 63 |
|
|
}
|
| 64 |
|
|
if($admin->get_permission('media_upload') != true) {
|
| 65 |
|
|
$template->set_var('DISPLAY_UPLOAD', 'hide');
|
| 66 |
|
|
}
|
| 67 |
1035
|
Ruebenwurz
|
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) { // Only show admin the settings link
|
| 68 |
|
|
$template->set_var('DISPLAY_SETTINGS', 'hide');
|
| 69 |
|
|
}
|
| 70 |
1087
|
Ruebenwurz
|
// Workout if the up arrow should be shown
|
| 71 |
|
|
if(($dirs == '') or ($dirs==$currentHome) or (!array_key_exists('dir', $_GET))) {
|
| 72 |
|
|
$display_up_arrow = 'hide';
|
| 73 |
|
|
} else {
|
| 74 |
|
|
$display_up_arrow = '';
|
| 75 |
|
|
}
|
| 76 |
4
|
ryan
|
|
| 77 |
|
|
// Insert language headings
|
| 78 |
|
|
$template->set_var(array(
|
| 79 |
1457
|
Luisehahne
|
'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
|
| 80 |
|
|
'HOME_DIRECTORY' => $currentHome,
|
| 81 |
|
|
'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
|
| 82 |
|
|
'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
|
| 83 |
|
|
'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
|
| 84 |
|
|
)
|
| 85 |
|
|
);
|
| 86 |
1112
|
Ruebenwurz
|
// insert urls
|
| 87 |
|
|
$template->set_var(array(
|
| 88 |
1457
|
Luisehahne
|
'ADMIN_URL' => ADMIN_URL,
|
| 89 |
|
|
'WB_URL' => WB_URL,
|
| 90 |
|
|
'WB_PATH' => WB_PATH,
|
| 91 |
|
|
'THEME_URL' => THEME_URL
|
| 92 |
|
|
)
|
| 93 |
|
|
);
|
| 94 |
4
|
ryan
|
// Insert language text and messages
|
| 95 |
|
|
$template->set_var(array(
|
| 96 |
1457
|
Luisehahne
|
'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
|
| 97 |
|
|
'TEXT_NAME' => $TEXT['TITLE'],
|
| 98 |
|
|
'TEXT_RELOAD' => $TEXT['RELOAD'],
|
| 99 |
|
|
'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
|
| 100 |
|
|
'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
|
| 101 |
|
|
'TEXT_FILES' => $TEXT['FILES'],
|
| 102 |
|
|
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
|
| 103 |
|
|
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
|
| 104 |
|
|
'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
|
| 105 |
|
|
'OPTIONS' => $TEXT['OPTION'],
|
| 106 |
|
|
'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
|
| 107 |
|
|
'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
|
| 108 |
|
|
'FTAN' => $admin->getFTAN()
|
| 109 |
|
|
)
|
| 110 |
|
|
);
|
| 111 |
4
|
ryan
|
|
| 112 |
|
|
// Parse template object
|
| 113 |
|
|
$template->parse('main', 'main_block', false);
|
| 114 |
|
|
$template->pparse('output', 'page');
|
| 115 |
1540
|
Luisehahne
|
/*
|
| 116 |
1457
|
Luisehahne
|
$endtime=explode(" ", microtime());
|
| 117 |
|
|
$endtime=$endtime[0]+$endtime[1];
|
| 118 |
|
|
$debugVMsg = '';
|
| 119 |
|
|
if($admin->ami_group_member('1') ) {
|
| 120 |
|
|
$debugVMsg = "<p>Mask loaded in ".round($endtime - $starttime,6)." Sec, ";
|
| 121 |
|
|
$debugVMsg .= "Memory in use ".number_format(memory_get_usage(true), 0, ',', '.')." Byte, ";
|
| 122 |
|
|
$debugVMsg .= sizeof(get_included_files())." included files</p>";
|
| 123 |
|
|
// $debugVMsg = print_message($debugVMsg,'#','debug',-1,false);
|
| 124 |
|
|
print $debugVMsg.'<br />';
|
| 125 |
|
|
}
|
| 126 |
1540
|
Luisehahne
|
*/
|
| 127 |
1457
|
Luisehahne
|
// Print admin
|
| 128 |
4
|
ryan
|
$admin->print_footer();
|