}
        }
    }
}
if (!isset($rename_file)) {
    $admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
}
// Setup template object, parse vars to it, then parse it
// Create new template object
$template = new Template(dirname($admin->correct_theme_source('media_rename.htt')));
$template->set_file('page', 'media_rename.htt');
$template->set_block('page', 'main_block', 'main');
//echo WB_PATH.'/media/'.$directory.'/'.$rename_file;
if ($type == 'folder') {
    $template->set_var('DISPlAY_EXTENSION', 'hide');
    $extension = '';
} else {
    $template->set_var('DISPlAY_EXTENSION', '');
    $extension = strstr($rename_file, '.');
}
if ($type == 'folder') {
    $type = $TEXT['FOLDER'];
} else {
    $type = $TEXT['FILE'];
}
$template->set_var(array('THEME_URL' => THEME_URL, 'FILENAME' => $rename_file, 'DIR' => $directory, 'FILE_ID' => $admin->getIDKEY($file_id), 'TYPE' => $type, 'EXTENSION' => $extension, 'FTAN' => $admin->getFTAN()));
// Insert language text and messages
$template->set_var(array('TEXT_TO' => $TEXT['TO'], 'TEXT_RENAME' => $TEXT['RENAME'], 'TEXT_CANCEL' => $TEXT['CANCEL'], 'TEXT_UP' => $TEXT['UP'], 'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING']));
// Parse template object
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');
    $template->set_var('DISPLAY_ADMIN', 'hide');
}
$template->set_var(array('TEXT_HEADER' => $TEXT['TEXT_HEADER'], 'SAVE_TEXT' => $TEXT['SAVE'], 'BACK' => $TEXT['BACK']));
$template->set_block('main_block', 'list_block', 'list');
$row_bg_color = '';
$dirs = directory_list(WB_PATH . MEDIA_DIRECTORY);
$dirs[] = WB_PATH . MEDIA_DIRECTORY;
$array_lowercase = array_map('strtolower', $dirs);
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
foreach ($dirs as $name) {
    $relative = str_replace(WB_PATH, '', $name);
    $safepath = str_replace(array('/', ' '), '_', $relative);
    $cur_width = $cur_height = '';
    if (isset($pathsettings[$safepath]['width'])) {
        $cur_width = $pathsettings[$safepath]['width'];
    }
    if (isset($pathsettings[$safepath]['height'])) {
        $cur_height = $pathsettings[$safepath]['height'];
    }
    $cur_width = $cur_width ? (int) $cur_width : '-';
    $cur_height = $cur_height ? (int) $cur_height : '-';
    if ($row_bg_color == 'DEDEDE') {
        $row_bg_color = 'EEEEEE';
    } else {
        $row_bg_color = 'DEDEDE';
    }
    $template->set_var(array('ADMIN_URL' => ADMIN_URL, 'PATH_NAME' => $relative, 'WIDTH' => $TEXT['WIDTH'], 'HEIGHT' => $TEXT['HEIGHT'], 'FIELD_NAME_W' => $safepath . '-w', 'FIELD_NAME_H' => $safepath . '-h', 'CUR_WIDTH' => $cur_width, 'CUR_HEIGHT' => $cur_height, 'SETTINGS' => $TEXT['SETTINGS'], 'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'], 'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'], 'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'], 'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'], 'ROW_BG_COLOR' => $row_bg_color, 'FTAN' => $admin->getFTAN()));
    $template->parse('list', 'list_block', true);
}
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');
    ?>
    <div class="empty_list">
        <?php 
    echo $TEXT['NONE_FOUND'];
    ?>
    </div>
    <?php 
}
// Setup template object, parse vars to it, then parse it
// Create new template object
$template = new Template(dirname($admin->correct_theme_source('pages.htt')));
// $template->debug = true;
$template->set_file('page', 'pages.htt');
$template->set_block('page', 'main_block', 'main');
// Insert values into the add page form
$template->set_var('FTAN', $admin->getFTAN());
// Group list 1
$query = "SELECT * FROM " . TABLE_PREFIX . "groups";
$get_groups = $database->query($query);
$template->set_block('main_block', 'group_list_block', 'group_list');
// Insert admin group and current group first
$admin_group_name = $get_groups->fetchRow(MYSQLI_ASSOC);
$template->set_var(array('ID' => 1, 'TOGGLE' => '1', 'DISABLED' => ' disabled="disabled"', 'LINK_COLOR' => '000000', 'CURSOR' => 'default', 'NAME' => $admin_group_name['name'], 'CHECKED' => ' checked="checked"'));
$template->parse('group_list', 'group_list_block', true);
while ($group = $get_groups->fetchRow(MYSQLI_ASSOC)) {
    // check if the user is a member of this group
    $flag_disabled = '';
    $flag_checked = '';
    $flag_cursor = 'pointer';
    $flag_color = '';
    if (in_array($group["group_id"], $admin->get_groups_id())) {
 * @platform        WebsiteBaker 2.8.3
 * @requirements    PHP 5.3.6 and higher
 * @version         $Id: index.php 5 2015-04-27 08:02:19Z luisehahne $
 * @filesource      $HeadURL: https://localhost:8443/svn/wb283Sp4/SP4/branches/wb/admin/groups/index.php $
 * @lastmodified    $Date: 2015-04-27 10:02:19 +0200 (Mo, 27. Apr 2015) $
 *
*/
// Print admin header
if (!defined('WB_PATH')) {
    require dirname(dirname(__DIR__)) . '/config.php';
}
if (!class_exists('admin', false)) {
    require WB_PATH . '/framework/class.admin.php';
}
$admin = new admin('Access', 'groups');
$ftan = $admin->getFTAN();
// Setup template object, parse vars to it, then parse it
// Create new template object
$template = new Template(dirname($admin->correct_theme_source('groups.htt')));
// $template->debug = true;
$template->set_file('page', 'groups.htt');
$template->set_block('page', 'main_block', 'main');
$template->set_block('main_block', 'manage_users_block', 'users');
// insert urls
$template->set_var(array('ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL, 'FTAN' => $ftan));
// Get existing value from database
$query = 'SELECT `group_id`, `name` FROM `' . TABLE_PREFIX . 'groups` WHERE `group_id` != 1';
$results = $database->query($query);
if ($database->is_error()) {
    $admin->print_error($database->get_error(), 'index.php');
}
    $template->parse('language_detail', 'language_detail_block', true);
}
$template->set_block('main_block', 'addon_template_block', 'addon_template');
if ($admin->get_permission('templates_view') != true) {
    $template->set_block('addon_template', '');
} else {
    $template->parse('addon_template', 'addon_template_block', true);
}
$template->set_block('main_block', 'addon_module_block', 'addon_module');
if ($admin->get_permission('modules_view') != true) {
    $template->set_block('addon_module', '');
} else {
    $template->parse('addon_module', 'addon_module_block', true);
}
$template->set_block('main_block', 'addon_language_block', 'addon_language');
if ($admin->get_permission('admintools') != true) {
    $template->set_block('addon_language', '');
} else {
    $template->parse('addon_language', 'addon_language_block', true);
}
// Insert language headings
$template->set_var(array('HEADING_INSTALL_LANGUAGE' => $HEADING['INSTALL_LANGUAGE'], 'HEADING_UNINSTALL_LANGUAGE' => $HEADING['UNINSTALL_LANGUAGE'], 'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS']));
// insert urls
$template->set_var(array('ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL, 'FTAN' => $admin->getFTAN()));
// Insert language text and messages
$template->set_var(array('URL_MODULES' => $admin->get_permission('modules') ? ADMIN_URL . '/modules/index.php' : '#', 'URL_TEMPLATES' => $admin->get_permission('templates') ? ADMIN_URL . '/templates/index.php' : '#', 'URL_ADVANCED' => '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;', 'MENU_MODULES' => $admin->get_permission('modules') ? $MENU['MODULES'] : '&#160;&#160;&#160;', 'MENU_TEMPLATES' => $admin->get_permission('templates') ? $MENU['TEMPLATES'] : '&#160;&#160;&#160;', 'TEXT_INSTALL' => $TEXT['INSTALL'], 'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], 'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], 'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT']));
// Parse template object
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');
// Print admin footer
$admin->print_footer();
if (file_exists($filename) && filesize($filename) > 0) {
    $content = file_get_contents($filename);
} else {
    $content = file_get_contents(ADMIN_PATH . '/pages/html.php');
}
require_once WB_PATH . '/include/editarea/wb_wrapper_edit_area.php';
$toolbar = 'search, fullscreen, |, undo, redo, |, select_font, syntax_selection,|,word_wrap, highlight, reset_highlight, |,charmap, |, help';
echo registerEditArea('content', 'php', true, 'both', true, true, 600, 450, $toolbar);
function show_wysiwyg_editor($name, $id, $content, $width, $height)
{
    echo '<textarea name="' . $name . '" id="' . $id . '" style="width: ' . $width . '; height: ' . $height . ';">' . $content . '</textarea>';
}
?>
<form action="intro2.php" method="post">
<?php 
print $admin->getFTAN();
?>
<input type="hidden" name="page_id" value="{PAGE_ID}" />
<table cellpadding="0" cellspacing="0" border="0" class="form_submit">
	<tr>
		<td colspan="2">
		<?php 
show_wysiwyg_editor('content', 'content', $content, '100%', '500px');
?>
		</td>
	</tr>
	<tr>
		<td class="left">
			<input type="submit" value="<?php 
echo $TEXT['SAVE'];
?>
if ($admin->get_permission('templates') != true) {
    $template->set_var('DISPLAY_TEMPLATES', $display_none);
}
if ($admin->get_permission('languages') != true) {
    $template->set_var('DISPLAY_LANGUAGES', $display_none);
}
if ($admin->get_permission('admintools') != true) {
    $template->set_var('DISPLAY_ADVANCED', $display_none);
}
if (!isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
    $template->set_var('DISPLAY_RELOAD', $display_none);
}
/**
 *	Insert section names and descriptions
 */
$template->set_var(array('ADDONS_OVERVIEW' => $MENU['ADDONS'], 'MODULES' => $MENU['MODULES'], 'TEMPLATES' => $MENU['TEMPLATES'], 'LANGUAGES' => $MENU['LANGUAGES'], 'MODULES_OVERVIEW' => $OVERVIEW['MODULES'], 'TEMPLATES_OVERVIEW' => $OVERVIEW['TEMPLATES'], 'LANGUAGES_OVERVIEW' => $OVERVIEW['LANGUAGES'], 'TXT_ADMIN_SETTINGS' => $TEXT['ADMIN'] . ' ' . $TEXT['SETTINGS'], 'MESSAGE_RELOAD_ADDONS' => $MESSAGE['ADDON_RELOAD'], 'TEXT_RELOAD' => $TEXT['RELOAD'], 'RELOAD_URL' => ADMIN_URL . '/addons/reload.php', 'URL_ADVANCED' => $admin->get_permission('admintools') ? '<a href="' . ADMIN_URL . '/addons/index.php?advanced">' . $TEXT['ADVANCED'] . '</a>' : '', 'ADVANCED_URL' => $admin->get_permission('admintools') ? ADMIN_URL . '/addons/index.php' : '', 'TEXT_ADVANCED' => $TEXT['ADVANCED'], 'FTAN' => $admin->getFTAN()));
/**
 *	Parsing the blocks ...
 */
if ($admin->get_permission('modules') == true) {
    $template->parse('main_block', "modules_block", true);
}
if ($admin->get_permission('templates') == true) {
    $template->parse('main_block', "templates_block", true);
}
if ($admin->get_permission('languages') == true) {
    $template->parse('main_block', "languages_block", true);
}
if (isset($_GET['advanced']) and $admin->get_permission('admintools') == true) {
    $template->parse('main_block', "reload_block", true);
}
        $template->set_var('NAME', str_replace(WB_PATH, '', $name));
        $template->parse('dir_list', 'dir_list_block', true);
    }
}
// Insert permissions values
if ($admin->get_permission('media_create') != true) {
    $template->set_var('DISPLAY_CREATE', 'hide');
}
if ($admin->get_permission('media_upload') != true) {
    $template->set_var('DISPLAY_UPLOAD', 'hide');
}
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
    // Only show admin the settings link
    $template->set_var('DISPLAY_SETTINGS', 'hide');
}
// Workout if the up arrow should be shown
if ($dirs == '' or $dirs == $currentHome or !array_key_exists('dir', $_GET)) {
    $display_up_arrow = 'hide';
} else {
    $display_up_arrow = '';
}
// Insert language headings
$template->set_var(array('HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'], 'HOME_DIRECTORY' => $currentHome, 'DISPLAY_UP_ARROW' => $display_up_arrow, 'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'], 'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']));
// insert urls
$template->set_var(array('ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'WB_PATH' => WB_PATH, 'THEME_URL' => THEME_URL));
// Insert language text and messages
$template->set_var(array('MEDIA_DIRECTORY' => MEDIA_DIRECTORY, 'TEXT_NAME' => $TEXT['TITLE'], 'TEXT_RELOAD' => $TEXT['RELOAD'], 'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'], 'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'], 'TEXT_FILES' => $TEXT['FILES'], 'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'], 'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'], 'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'], 'OPTIONS' => $TEXT['OPTION'], 'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'], 'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'], 'FTAN' => $admin->getFTAN()));
// Parse template object
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');
$admin->print_footer();
 /*-- load css files with jquery --*/
 // include jscalendar-setup
 $jscal_use_time = true;
 // whether to use a clock, too
 require_once WB_PATH . "/include/jscalendar/wb-setup.php";
 // Setup template object, parse vars to it, then parse it
 // Create new template object
 $tpl = new Template(dirname($admin->correct_theme_source('pages_sections.htt')));
 // $template->debug = true;
 $tpl->set_file('page', 'pages_sections.htt');
 $tpl->set_block('page', 'main_block', 'main');
 $tpl->set_block('main_block', 'module_block', 'module_list');
 $tpl->set_block('main_block', 'section_block', 'section_list');
 $tpl->set_block('section_block', 'block_block', 'block_list');
 $tpl->set_block('main_block', 'calendar_block', 'calendar_list');
 $tpl->set_var('FTAN', $admin->getFTAN());
 // set first defaults and messages
 $tpl->set_var(array('PAGE_ID' => $results_array['page_id'], 'PAGE_IDKEY' => $results_array['page_id'], 'TEXT_PAGE' => $TEXT['PAGE'], 'PAGE_TITLE' => $results_array['page_title'], 'MENU_TITLE' => $results_array['menu_title'], 'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'], 'HEADING_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'], 'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'], 'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'], 'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'], 'TEXT_ID' => 'ID', 'TEXT_TYPE' => $TEXT['TYPE'], 'TEXT_BLOCK' => $TEXT['BLOCK'], 'TEXT_NAMESECTION' => $TEXT['SECTION'] . ' ' . $TEXT['NAME'], 'TEXT_PUBL_START_DATE' => $TEXT['PUBL_START_DATE'], 'TEXT_PUBL_END_DATE' => $TEXT['PUBL_END_DATE'], 'TEXT_ACTIONS' => $TEXT['ACTIONS'], 'ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL));
 // Insert variables
 $tpl->set_var(array('PAGE_ID' => $results_array['page_id'], 'PAGE_IDKEY' => $results_array['page_id'], 'VAR_PAGE_TITLE' => $results_array['page_title'], 'SETTINGS_LINK' => ADMIN_URL . '/pages/settings.php?page_id=' . $results_array['page_id'], 'MODIFY_LINK' => ADMIN_URL . '/pages/modify.php?page_id=' . $results_array['page_id']));
 $sql = 'SELECT * ';
 $sql .= 'FROM `' . TABLE_PREFIX . 'sections` ';
 $sql .= 'WHERE `page_id` = ' . $page_id . ' ';
 $sql .= 'ORDER BY `position` ASC';
 $query_sections = $database->query($sql);
 if ($query_sections->numRows() > 0) {
     $num_sections = $query_sections->numRows();
     while ($section = $query_sections->fetchRow()) {
         if (!is_numeric(array_search($section['module'], $module_permissions))) {
             // Get the modules real name
             $sql = 'SELECT `name` FROM `' . TABLE_PREFIX . 'addons` ';
 }
 if ($group_id < 2) {
     // if($admin_header) { $admin->print_header(); }
     $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
 }
 // Get existing values
 $sql = 'SELECT * FROM  `' . TABLE_PREFIX . 'groups` WHERE `group_id` =  ' . $group_id;
 $results = $database->query($sql);
 $group = $results->fetchRow(MYSQLI_ASSOC);
 // Setup template object, parse vars to it, then parse it
 // Create new template object
 $template = new Template(dirname($admin->correct_theme_source('groups_form.htt')));
 // $template->debug = true;
 $template->set_file('page', 'groups_form.htt');
 $template->set_block('page', 'main_block', 'main');
 $template->set_var(array('ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL, 'ACTION_URL' => ADMIN_URL . '/groups/save.php', 'SUBMIT_TITLE' => $TEXT['SAVE'], 'GROUP_ID' => $admin->getIDKEY($group['group_id']), 'GROUP_NAME' => $group['name'], 'ADVANCED_LINK' => ADMIN_URL . '/groups/groups.php', 'CANCEL_LINK' => ADMIN_URL . '/groups/index.php', 'FTAN' => $admin->getFTAN()));
 // Tell the browser whether or not to show advanced options
 if (true == (isset($_POST['advanced']) and strpos($_POST['advanced'], ">>") > 0)) {
     $template->set_var('DISPLAY_ADVANCED', '');
     $template->set_var('DISPLAY_BASIC', 'display:none;');
     $template->set_var('ADVANCED', 'yes');
     $template->set_var('ADVANCED_BUTTON', '&lt;&lt; ' . $TEXT['HIDE_ADVANCED']);
 } else {
     $template->set_var('DISPLAY_ADVANCED', 'display:none;');
     $template->set_var('DISPLAY_BASIC', '');
     $template->set_var('ADVANCED', 'no');
     $template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'] . '  &gt;&gt;');
 }
 // Explode system permissions
 $system_permissions = explode(',', $group['system_permissions']);
 // Check system permissions boxes