/**
 * admin contents form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_contents_form()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* switch table */
    switch (TABLE_PARAMETER) {
        case 'categories':
            $wording_single = 'category';
            $wording_sibling = 'category_sibling';
            break;
        case 'articles':
            $wording_single = 'article';
            $wording_sibling = 'article_sibling';
            break;
        case 'extras':
            $wording_single = 'extra';
            $wording_sibling = 'extra_sibling';
            break;
        case 'comments':
            $wording_single = 'comment';
            break;
    }
    /* define fields for existing user */
    if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
        /* query content */
        $result = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('id', ID_PARAMETER)->findArray();
        $r = $result[0];
        if ($r) {
            foreach ($r as $key => $value) {
                ${$key} = stripslashes($value);
            }
        }
        if (TABLE_PARAMETER == 'comments') {
            $wording_headline = $author;
        } else {
            $wording_headline = $title;
        }
        if (TABLE_PARAMETER != 'categories') {
            $text = htmlspecialchars($text);
        }
        $wording_submit = l('save');
        $route = 'admin/process/' . TABLE_PARAMETER . '/' . $id;
    } else {
        if (ADMIN_PARAMETER == 'new') {
            if (TABLE_PARAMETER == 'comments') {
                $author = MY_USER;
                $email = MY_EMAIL;
                $code_readonly = ' readonly="readonly"';
            }
            if (TABLE_PARAMETER == 'categories') {
                $sibling = 0;
                $parent = 0;
            }
            if (TABLE_PARAMETER == 'articles' || TABLE_PARAMETER == 'extras') {
                $category = 0;
                $headline = 1;
            }
            if (TABLE_PARAMETER == 'articles') {
                $sibling = 0;
                $infoline = 0;
                $comments = 0;
            }
            if (TABLE_PARAMETER == 'extras') {
                $sibling = 0;
            }
            $status = 1;
            $rank = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->max('rank') + 1;
            $access = null;
            $wording_headline = l($wording_single . '_new');
            $wording_submit = l('create');
            $route = 'admin/process/' . TABLE_PARAMETER;
        }
    }
    /* collect output */
    $output .= '<h2 class="title_content">' . $wording_headline . '</h2>';
    $output .= form_element('form', 'form_admin', 'js_validate_form js_tab form_admin hidden_legend', '', '', '', 'action="' . REWRITE_ROUTE . $route . '" method="post"');
    /* collect tab list output */
    $output .= '<ul class="js_list_tab list_tab list_tab_admin">';
    $output .= '<li class="js_item_active item_first item_active">' . anchor_element('internal', '', '', l($wording_single), FULL_ROUTE . '#tab-1') . '</li>';
    $output .= '<li class="item_second">' . anchor_element('internal', '', '', l('customize'), FULL_ROUTE . '#tab-2') . '</li>';
    if (TABLE_PARAMETER != 'categories') {
        $output .= '<li class="item_last">' . anchor_element('internal', '', '', l('date'), FULL_ROUTE . '#tab-3') . '</li>';
    }
    $output .= '</ul>';
    /* collect tab box output */
    $output .= '<div class="js_box_tab box_tab box_tab_admin">';
    /* collect content set */
    $output .= form_element('fieldset', 'tab-1', 'js_set_tab js_set_active set_tab set_tab_admin set_active', '', '', l($wording_single)) . '<ul>';
    if (TABLE_PARAMETER == 'comments') {
        $output .= '<li>' . form_element('text', 'author', 'field_text_admin field_note', 'author', $author, '* ' . l('author'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_readonly) . '</li>';
        $output .= '<li>' . form_element('email', 'email', 'field_text_admin field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
        $output .= '<li>' . form_element('url', 'url', 'field_text_admin', 'url', $url, l('url'), 'maxlength="50"') . '</li>';
    } else {
        $output .= '<li>' . form_element('text', 'title', 'js_generate_alias_input field_text_admin field_note', 'title', $title, l('title'), 'maxlength="50" required="required" autofocus="autofocus"') . '</li>';
        $output .= '<li>' . form_element('text', 'alias', 'js_generate_alias_output field_text_admin field_note', 'alias', $alias, l('alias'), 'maxlength="50" required="required"') . '</li>';
    }
    if (TABLE_PARAMETER == 'categories' || TABLE_PARAMETER == 'articles') {
        $output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small', 'description', $description, l('description'), 'rows="1" cols="15"') . '</li>';
        $output .= '<li>' . form_element('textarea', 'keywords', 'js_auto_resize js_generate_keyword_output field_textarea_admin field_small', 'keywords', $keywords, l('keywords'), 'rows="1" cols="15"') . '</li>';
    }
    if (TABLE_PARAMETER != 'categories') {
        $output .= '<li>' . form_element('textarea', 'text', 'js_auto_resize js_generate_keyword_input js_editor_textarea field_textarea_admin field_note', 'text', $text, l('text'), 'rows="5" cols="100" required="required"') . '</li>';
    }
    $output .= '</ul></fieldset>';
    /* collect customize set */
    $output .= form_element('fieldset', 'tab-2', 'js_set_tab set_tab set_tab_admin', '', '', l('customize')) . '<ul>';
    /* languages directory object */
    $languages_directory = new Redaxscript\Directory();
    $languages_directory->init('languages');
    $languages_directory_array = $languages_directory->getArray();
    /* build languages select */
    $language_array[l('select')] = '';
    foreach ($languages_directory_array as $value) {
        $value = substr($value, 0, 2);
        $language_array[l($value, '_index')] = $value;
    }
    $output .= '<li>' . select_element('language', 'field_select_admin', 'language', $language_array, $language, l('language')) . '</li>';
    if (TABLE_PARAMETER == 'categories' || TABLE_PARAMETER == 'articles') {
        /* templates directory object */
        $templates_directory = new Redaxscript\Directory();
        $templates_directory->init('templates', array('admin', 'install'));
        $templates_directory_array = $templates_directory->getArray();
        /* build templates select */
        $template_array[l('select')] = '';
        foreach ($templates_directory_array as $value) {
            $template_array[$value] = $value;
        }
        $output .= '<li>' . select_element('template', 'field_select_admin', 'template', $template_array, $template, l('template')) . '</li>';
    }
    /* build sibling select */
    if (TABLE_PARAMETER == 'categories' || TABLE_PARAMETER == 'articles' || TABLE_PARAMETER == 'extras') {
        $sibling_array[l('none')] = 0;
        $sibling_result = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->orderByAsc('rank')->findArray();
        if ($sibling_result) {
            foreach ($sibling_result as $s) {
                if (ID_PARAMETER != $s['id']) {
                    $sibling_array[$s['title'] . ' (' . $s['id'] . ')'] = $s['id'];
                }
            }
        }
        $output .= '<li>' . select_element('sibling', 'field_select_admin', 'sibling', $sibling_array, $sibling, l($wording_sibling)) . '</li>';
    }
    /* build category and parent select */
    if (TABLE_PARAMETER != 'comments') {
        if (TABLE_PARAMETER == 'extras') {
            $category_array[l('all')] = 0;
        } else {
            $category_array[l('none')] = 0;
        }
        $categories_result = Redaxscript\Db::forTablePrefix('categories')->orderByAsc('rank')->findArray();
        if ($categories_result) {
            foreach ($categories_result as $c) {
                if (TABLE_PARAMETER != 'categories') {
                    $category_array[$c['title'] . ' (' . $c['id'] . ')'] = $c['id'];
                } else {
                    if (ID_PARAMETER != $c['id'] && $c['parent'] == 0) {
                        $category_array[$c['title'] . ' (' . $c['id'] . ')'] = $c['id'];
                    }
                }
            }
        }
        if (TABLE_PARAMETER == 'categories') {
            $output .= '<li>' . select_element('parent', 'field_select_admin', 'parent', $category_array, $parent, l('category_parent')) . '</li>';
        } else {
            $output .= '<li>' . select_element('category', 'field_select_admin', 'category', $category_array, $category, l('category')) . '</li>';
        }
    }
    /* build article select */
    if (TABLE_PARAMETER == 'extras' || TABLE_PARAMETER == 'comments') {
        if (TABLE_PARAMETER == 'extras') {
            $article_array[l('all')] = 0;
        }
        $articles = Redaxscript\Db::forTablePrefix('articles');
        if (TABLE_PARAMETER == 'comments') {
            $articles->where('comments', 0);
        }
        $articles_result = $articles->orderByAsc('rank')->findArray();
        if ($articles_result) {
            foreach ($articles_result as $a) {
                $article_array[$a['title'] . ' (' . $a['id'] . ')'] = $a['id'];
            }
        }
        $output .= '<li>' . select_element('article', 'field_select_admin', 'article', $article_array, $article, l('article')) . '</li>';
    }
    if (TABLE_PARAMETER == 'articles' || TABLE_PARAMETER == 'extras') {
        $output .= '<li>' . select_element('headline', 'field_select_admin', 'headline', array(l('enable') => 1, l('disable') => 0), $headline, l('headline')) . '</li>';
    }
    if (TABLE_PARAMETER == 'articles') {
        $output .= '<li>' . select_element('infoline', 'field_select_admin', 'infoline', array(l('enable') => 1, l('disable') => 0), $infoline, l('infoline')) . '</li>';
        $output .= '<li>' . select_element('comments', 'field_select_admin', 'comments', array(l('enable') => 1, l('freeze') => 2, l('restrict') => 3, l('disable') => 0), $comments, l('comments')) . '</li>';
    }
    if ($status != 2) {
        $output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('publish') => 1, l('unpublish') => 0), $status, l('status')) . '</li>';
    }
    /* build access select */
    if (GROUPS_EDIT == 1) {
        $access_array[l('all')] = null;
        $access_result = Redaxscript\Db::forTablePrefix('groups')->orderByAsc('name')->findArray();
        if ($access_result) {
            foreach ($access_result as $g) {
                $access_array[$g['name']] = $g['id'];
            }
        }
        $output .= '<li>' . select_element('access', 'field_select_admin', 'access', $access_array, $access, l('access'), 'multiple="multiple"') . '</li>';
    }
    $output .= '</ul></fieldset>';
    /* collect date set */
    if (TABLE_PARAMETER != 'categories') {
        $output .= form_element('fieldset', 'tab-3', 'js_set_tab set_tab set_tab_admin', '', '', l('date')) . '<ul>';
        $output .= '<li>' . select_date('day', 'field_select_admin', 'day', $date, 'd', 1, 32, l('day')) . '</li>';
        $output .= '<li>' . select_date('month', 'field_select_admin', 'month', $date, 'm', 1, 13, l('month')) . '</li>';
        $output .= '<li>' . select_date('year', 'field_select_admin', 'year', $date, 'Y', 2000, 2021, l('year')) . '</li>';
        $output .= '<li>' . select_date('hour', 'field_select_admin', 'hour', $date, 'H', 0, 24, l('hour')) . '</li>';
        $output .= '<li>' . select_date('minute', 'field_select_admin', 'minute', $date, 'i', 0, 60, l('minute')) . '</li>';
        $output .= '</ul></fieldset>';
    }
    $output .= '</div>';
    /* collect hidden output */
    if (TABLE_PARAMETER != 'comments') {
        $output .= form_element('hidden', '', '', 'author', MY_USER);
    }
    if ($status == 2) {
        $output .= form_element('hidden', '', '', 'publish', 2);
    }
    $output .= form_element('hidden', '', '', 'rank', $rank);
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    /* cancel button */
    if (TABLE_EDIT == 1 || TABLE_DELETE == 1) {
        $cancel_route = 'admin/view/' . TABLE_PARAMETER;
    } else {
        $cancel_route = 'admin';
    }
    $output .= anchor_element('internal', '', 'js_cancel button_admin button_large button_cancel_admin', l('cancel'), $cancel_route);
    /* delete button */
    if (TABLE_DELETE == 1 && $id) {
        $output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large button_delete_admin', l('delete'), 'admin/delete/' . TABLE_PARAMETER . '/' . $id . '/' . TOKEN);
    }
    /* submit button */
    if (TABLE_NEW == 1 || TABLE_EDIT == 1) {
        $output .= form_element('button', '', 'js_submit button_admin button_large button_submit_admin', ADMIN_PARAMETER, $wording_submit);
    }
    $output .= '</form>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
/**
 * admin users form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_users_form()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* define fields for existing user */
    if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
        /* query user */
        $result = Redaxscript\Db::forTablePrefix('users')->where('id', ID_PARAMETER)->findArray();
        $r = $result[0];
        if ($r) {
            foreach ($r as $key => $value) {
                ${$key} = stripslashes($value);
            }
        }
        $wording_headline = $name;
        $wording_submit = l('save');
        $route = 'admin/process/users/' . $id;
    } else {
        if (ADMIN_PARAMETER == 'new') {
            $status = 1;
            $groups = 0;
            $wording_headline = l('user_new');
            $wording_submit = l('create');
            $route = 'admin/process/users';
            $code_required = ' required="required"';
        }
    }
    /* collect output */
    $output .= '<h2 class="title_content">' . $wording_headline . '</h2>';
    $output .= form_element('form', 'form_admin', 'js_validate_form js_tab form_admin hidden_legend', '', '', '', 'action="' . REWRITE_ROUTE . $route . '" method="post"');
    /* collect tab list output */
    $output .= '<ul class="js_list_tab list_tab list_tab_admin">';
    $output .= '<li class="js_item_active item_first item_active">' . anchor_element('internal', '', '', l('user'), FULL_ROUTE . '#tab-1') . '</li>';
    $output .= '<li class="item_second">' . anchor_element('internal', '', '', l('customize'), FULL_ROUTE . '#tab-2') . '</li></ul>';
    /* collect tab box output */
    $output .= '<div class="js_box_tab box_tab box_tab_admin">';
    /* collect user set */
    $output .= form_element('fieldset', 'tab-1', 'js_set_tab js_set_active set_tab set_tab_admin set_active', '', '', l('user')) . '<ul>';
    $output .= '<li>' . form_element('text', 'name', 'field_text_admin field_note', 'name', $name, l('name'), 'maxlength="50" required="required" autofocus="autofocus"') . '</li>';
    if ($id == '') {
        $output .= '<li>' . form_element('text', 'user', 'field_text_admin field_note', 'user', $user, l('user'), 'maxlength="50" required="required"') . '</li>';
    }
    $output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text_admin field_note', 'password', '', l('password'), 'maxlength="50" autocomplete="off"' . $code_required) . '</li>';
    $output .= '<li>' . form_element('password', 'password_confirm', 'js_unmask_password field_text_admin field_note', 'password_confirm', '', l('password_confirm'), 'maxlength="50" autocomplete="off"' . $code_required) . '</li>';
    $output .= '<li>' . form_element('email', 'email', 'field_text_admin field_note', 'email', $email, l('email'), 'maxlength="50" required="required"') . '</li>';
    $output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small', 'description', $description, l('description'), 'rows="1" cols="15"') . '</li>';
    $output .= '</ul></fieldset>';
    /* collect customize set */
    $output .= form_element('fieldset', 'tab-2', 'js_set_tab set_tab set_tab_admin', '', '', l('customize')) . '<ul>';
    /* languages directory object */
    $languages_directory = new Redaxscript\Directory();
    $languages_directory->init('languages');
    $languages_directory_array = $languages_directory->getArray();
    /* build languages select */
    $language_array[l('select')] = '';
    foreach ($languages_directory_array as $value) {
        $value = substr($value, 0, 2);
        $language_array[l($value, '_index')] = $value;
    }
    $output .= '<li>' . select_element('language', 'field_select_admin', 'language', $language_array, $language, l('language')) . '</li>';
    if ($id == '' || $id > 1) {
        $output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('enable') => 1, l('disable') => 0), $status, l('status')) . '</li>';
        /* build groups select */
        if (GROUPS_EDIT == 1 && USERS_EDIT == 1) {
            $groups_result = Redaxscript\Db::forTablePrefix('groups')->orderByAsc('name')->findArray();
            if ($groups_result) {
                foreach ($groups_result as $g) {
                    $groups_array[$g['name']] = $g['id'];
                }
            }
            $output .= '<li>' . select_element('groups', 'field_select_admin', 'groups', $groups_array, $groups, l('groups'), 'multiple="multiple"') . '</li>';
        }
    }
    $output .= '</ul></fieldset></div>';
    /* collect hidden output */
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    /* collect button output */
    if (USERS_EDIT == 1 || USERS_DELETE == 1) {
        $cancel_route = 'admin/view/users';
    } else {
        $cancel_route = 'admin';
    }
    $output .= anchor_element('internal', '', 'js_cancel button_admin button_large button_cancel_admin', l('cancel'), $cancel_route);
    /* delete button */
    if ((USERS_DELETE == 1 || USERS_EXCEPTION == 1) && $id > 1) {
        $output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large button_delete_admin', l('delete'), 'admin/delete/users/' . $id . '/' . TOKEN);
    }
    /* submit button */
    if (USERS_NEW == 1 || USERS_EDIT == 1 || USERS_EXCEPTION == 1) {
        $output .= form_element('button', '', 'js_submit button_admin button_large button_submit_admin', ADMIN_PARAMETER, $wording_submit);
    }
    $output .= '</form>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
/**
 * templates list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Navigation
 * @author Henry Ruhs
 *
 * @param array $options
 */
function templates_list($options = '')
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* define option variables */
    if (is_array($options)) {
        foreach ($options as $key => $value) {
            $key = 'option_' . $key;
            ${$key} = $value;
        }
    }
    /* templates directory object */
    $templates_directory = new Redaxscript\Directory();
    $templates_directory->init('templates', array('admin', 'install'));
    $templates_directory_array = $templates_directory->getArray();
    /* collect templates output */
    foreach ($templates_directory_array as $value) {
        $class_string = ' class="template_' . $value;
        if ($value == Redaxscript\Registry::get('template')) {
            $class_string .= ' item_active';
        }
        $class_string .= '"';
        $output .= '<li' . $class_string . '>' . anchor_element('internal', '', '', $value, FULL_ROUTE . TEMPLATE_ROUTE . $value, '', 'rel="nofollow"') . '</li>';
    }
    /* build id string */
    if ($option_id) {
        $id_string = ' id="' . $option_id . '"';
    }
    /* build class string */
    if ($option_class) {
        $class_string = ' class="' . $option_class . '"';
    } else {
        $class_string = ' class="list_templates"';
    }
    /* collect list output */
    if ($output) {
        $output = '<ul' . $id_string . $class_string . '>' . $output . '</ul>';
    }
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
/**
 * admin modules form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_modules_form()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* define fields for existing user */
    if (ADMIN_PARAMETER == 'edit' && ID_PARAMETER) {
        /* query modules */
        $result = Redaxscript\Db::forTablePrefix('modules')->where('id', ID_PARAMETER)->findArray();
        $r = $result[0];
        if ($r) {
            foreach ($r as $key => $value) {
                ${$key} = stripslashes($value);
            }
        }
        $wording_headline = $name;
        $wording_submit = l('save');
        $route = 'admin/process/modules/' . $id;
    }
    /* directory object */
    $docs_directory = new Redaxscript\Directory();
    $docs_directory->init('modules/' . $alias . '/docs');
    $docs_directory_array = $docs_directory->getArray();
    /* collect output */
    $output .= '<h2 class="title_content">' . $wording_headline . '</h2>';
    $output .= form_element('form', 'form_admin', 'js_validate_form js_tab form_admin hidden_legend', '', '', '', 'action="' . REWRITE_ROUTE . $route . '" method="post"');
    /* collect tab list output */
    $output .= '<ul class="js_list_tab list_tab list_tab_admin">';
    $output .= '<li class="js_item_active item_first item_active">' . anchor_element('internal', '', '', l('module'), FULL_ROUTE . '#tab-1') . '</li>';
    $output .= '<li class="item_second">' . anchor_element('internal', '', '', l('customize'), FULL_ROUTE . '#tab-2') . '</li>';
    foreach ($docs_directory_array as $key => $value) {
        $output .= '<li class="item_third">' . anchor_element('internal', '', '', str_replace('.phtml', '', $value), FULL_ROUTE . '#tab-' . ($key + 3)) . '</li>';
    }
    $output .= '</ul>';
    /* collect tab box output */
    $output .= '<div class="js_box_tab box_tab box_tab_admin">';
    /* collect module set */
    $output .= form_element('fieldset', 'tab-1', 'js_set_tab js_set_active set_tab set_tab_admin set_active', '', '', l('user')) . '<ul>';
    $output .= '<li>' . form_element('text', 'name', 'field_text_admin field_note', 'name', $name, l('name'), 'maxlength="50" required="required" autofocus="autofocus"') . '</li>';
    $output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small', 'description', $description, l('description'), 'rows="1" cols="15"') . '</li>';
    $output .= '</ul></fieldset>';
    /* collect customize set */
    $output .= form_element('fieldset', 'tab-2', 'js_set_tab set_tab set_tab_admin', '', '', l('customize')) . '<ul>';
    $output .= '<li>' . select_element('status', 'field_select_admin', 'status', array(l('enable') => 1, l('disable') => 0), $status, l('status')) . '</li>';
    /* build access select */
    if (GROUPS_EDIT == 1) {
        $access_array[l('all')] = null;
        $access_result = Redaxscript\Db::forTablePrefix('groups')->orderByAsc('name')->findArray();
        if ($access_result) {
            foreach ($access_result as $g) {
                $access_array[$g['name']] = $g['id'];
            }
        }
        $output .= '<li>' . select_element('access', 'field_select_admin', 'access', $access_array, $access, l('access'), 'multiple="multiple"') . '</li></ul></fieldset>';
    }
    /* template object */
    $template = new Redaxscript\Template();
    /* collect docs set */
    foreach ($docs_directory_array as $key => $value) {
        $output .= form_element('fieldset', 'tab-' . ($key + 3), 'js_set_tab set_tab set_tab_admin', '', '', 'docs') . '<ul>';
        $output .= '<li>' . $template->partial('modules/' . $alias . '/docs/' . $value) . '</li></ul></fieldset>';
    }
    $output .= '</div>';
    /* collect hidden output */
    $output .= form_element('hidden', '', '', 'alias', $alias);
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    /* cancel button */
    if (MODULES_EDIT == 1 || MODULES_UNINSTALL == 1) {
        $cancel_route = 'admin/view/modules';
    } else {
        $cancel_route = 'admin';
    }
    $output .= anchor_element('internal', '', 'js_cancel button_admin button_large button_cancel_admin', l('cancel'), $cancel_route);
    /* uninstall button */
    if (MODULES_UNINSTALL == 1) {
        $output .= anchor_element('internal', '', 'js_delete js_confirm button_admin button_large button_uninstall_admin', l('uninstall'), 'admin/uninstall/modules/' . $alias . '/' . TOKEN);
    }
    /* submit button */
    if (MODULES_EDIT == 1) {
        $output .= form_element('button', '', 'js_submit button_admin button_large button_submit_admin', ADMIN_PARAMETER, $wording_submit);
    }
    $output .= '</form>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
/**
 * admin settings form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_settings_form()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    $output .= '<h2 class="title_content">' . l('settings') . '</h2>';
    $output .= form_element('form', 'form_admin', 'js_validate_form js_accordion form_admin', '', '', '', 'action="' . REWRITE_ROUTE . 'admin/update/settings" method="post"');
    /* collect general set */
    $output .= '<fieldset class="js_set_accordion js_set_active set_accordion set_accordion_admin set_active">';
    $output .= '<legend class="js_title_accordion js_title_active title_accordion title_accordion_admin title_active">' . l('general') . '</legend>';
    $output .= '<ul class="js_box_accordion js_box_active box_accordion box_accordion_admin box_active">';
    /* languages directory object */
    $languages_directory = new Redaxscript\Directory();
    $languages_directory->init('languages');
    $languages_directory_array = $languages_directory->getArray();
    /* build languages select */
    if (count($languages_directory_array) > 1) {
        $language_array[l('detect')] = 'detect';
    }
    foreach ($languages_directory_array as $value) {
        $value = substr($value, 0, 2);
        $language_array[l($value, '_index')] = $value;
    }
    $output .= '<li>' . select_element('language', 'field_select_admin', 'language', $language_array, s('language'), l('language')) . '</li>';
    /* templates directory object */
    $templates_directory = new Redaxscript\Directory();
    $templates_directory->init('templates', array('admin', 'install'));
    $templates_directory_array = $templates_directory->getArray();
    /* build templates select */
    $output .= '<li>' . select_element('template', 'field_select_admin', 'template', $templates_directory_array, s('template'), l('template')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect metadata set */
    $output .= '<fieldset class="js_set_accordion set_accordion set_accordion_admin">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('metadata') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $output .= '<li>' . form_element('text', 'title', 'field_text_admin', 'title', s('title'), l('title'), 'maxlength="50"') . '</li>';
    $output .= '<li>' . form_element('text', 'author', 'field_text_admin', 'author', s('author'), l('author'), 'maxlength="50"') . '</li>';
    $output .= '<li>' . form_element('text', 'copyright', 'field_text_admin', 'copyright', s('copyright'), l('copyright'), 'maxlength="50"') . '</li>';
    $output .= '<li>' . form_element('textarea', 'description', 'js_auto_resize field_textarea_admin field_small', 'description', s('description'), l('description'), 'rows="1" cols="15"') . '</li>';
    $output .= '<li>' . form_element('textarea', 'keywords', 'js_auto_resize field_textarea_admin field_small', 'keywords', s('keywords'), l('keywords'), 'rows="1" cols="15"') . '</li>';
    $output .= '<li>' . select_element('robots', 'field_select_admin', 'robots', array(l('index') => 'all', l('index_no') => 'none'), s('robots'), l('robots')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect contact set */
    $output .= '<fieldset class="js_set_accordion set_accordion set_accordion_admin">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('contact') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $output .= '<li>' . form_element('email', 'email', 'field_text_admin field_note', 'email', s('email'), l('email'), 'maxlength="50" required="required"') . '</li>';
    $output .= '<li>' . form_element('text', 'subject', 'field_text_admin', 'subject', s('subject'), l('subject'), 'maxlength="50"') . '</li>';
    $output .= '<li>' . select_element('notification', 'field_select_admin', 'notification', array(l('enable') => 1, l('disable') => 0), s('notification'), l('notification')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect formatting set */
    $output .= '<fieldset class="js_set_accordion set_accordion set_accordion_admin">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('formatting') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $output .= '<li>' . form_element('text', 'charset', 'field_text_admin field_note', 'charset', s('charset'), l('charset'), 'maxlength="10" required="required"') . '</li>';
    $output .= '<li>' . form_element('text', 'divider', 'field_text_admin', 'divider', s('divider'), l('divider'), 'maxlength="10"') . '</li>';
    $output .= '<li>' . select_element('time', 'field_select_admin', 'time', array('H:i', 'h:i'), s('time'), l('time')) . '</li>';
    $output .= '<li>' . select_element('date', 'field_select_admin', 'date', array('d.m.Y', 'm.d.Y', 'Y.m.d'), s('date'), l('date')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect contents set */
    $output .= '<fieldset class="js_set_accordion set_accordion set_accordion_admin">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('contents') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $homepage_array[l('none')] = 0;
    $homepage_result = Redaxscript\Db::forTablePrefix('articles')->orderByAsc('title')->findArray();
    if ($homepage_result) {
        foreach ($homepage_result as $r) {
            $homepage_array[$r['title'] . ' (' . $r['id'] . ')'] = $r['id'];
        }
    }
    $output .= '<li>' . select_element('homepage', 'field_select_admin', 'homepage', $homepage_array, s('homepage'), l('homepage')) . '</li>';
    $output .= '<li>' . form_element('text', 'limit', 'field_text_admin field_note', 'limit', s('limit'), l('limit'), 'min="1" max="1000" required="required"') . '</li>';
    $output .= '<li>' . select_element('order', 'field_select_admin', 'order', array(l('ascending') => 'asc', l('descending') => 'desc'), s('order'), l('order')) . '</li>';
    $output .= '<li>' . select_element('pagination', 'field_select_admin', 'pagination', array(l('enable') => 1, l('disable') => 0), s('pagination'), l('pagination')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect comments set */
    $output .= '<fieldset class="js_set_accordion set_accordion set_accordion_admin">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('comments') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $output .= '<li>' . select_element('moderation', 'field_select_admin', 'moderation', array(l('enable') => 1, l('disable') => 0), s('moderation'), l('moderation')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect users set */
    $output .= '<fieldset class="js_set_accordion set_accordion set_accordion_admin">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('users') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $output .= '<li>' . select_element('registration', 'field_select_admin', 'registration', array(l('enable') => 1, l('disable') => 0), s('registration'), l('registration')) . '</li>';
    $output .= '<li>' . select_element('verification', 'field_select_admin', 'verification', array(l('enable') => 1, l('disable') => 0), s('verification'), l('verification')) . '</li>';
    $output .= '<li>' . select_element('reminder', 'field_select_admin', 'reminder', array(l('enable') => 1, l('disable') => 0), s('reminder'), l('reminder')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect security set */
    $output .= '<fieldset class="js_set_accordion js_set_accordion_last set_accordion set_accordion_admin set_accordion_last">';
    $output .= '<legend class="js_title_accordion title_accordion title_accordion_admin">' . l('security') . '</legend>';
    $output .= '<ul class="js_box_accordion box_accordion box_accordion_admin">';
    $output .= '<li>' . select_element('captcha', 'field_select_admin', 'captcha', array(l('random') => 1, l('addition') => 2, l('subtraction') => 3, l('disable') => 0), s('captcha'), l('captcha')) . '</li>';
    $output .= '<li>' . select_element('blocker', 'field_select_admin', 'blocker', array(l('enable') => 1, l('disable') => 0), s('blocker'), l('blocker')) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect hidden and button output */
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    $output .= anchor_element('internal', '', 'js_cancel button_admin button_large button_cancel_admin', l('cancel'), 'admin');
    $output .= form_element('button', '', 'js_submit button_admin button_large button_submit_admin', 'update', l('save'));
    $output .= '</form>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
Example #6
0
/**
 * templates list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Navigation
 * @author Henry Ruhs
 *
 * @param array $options
 */
function templates_list($options)
{
    /* define option variables */
    if (is_array($options)) {
        foreach ($options as $key => $value) {
            $key = 'option_' . $key;
            ${$key} = $value;
        }
    }
    /* templates directory */
    $templates_directory = new Redaxscript\Directory();
    $templates_directory->init('templates', ['admin', 'console', 'install']);
    $templates_directory_array = $templates_directory->getArray();
    /* collect templates output */
    foreach ($templates_directory_array as $value) {
        $class_string = null;
        if ($value == Redaxscript\Registry::get('template')) {
            $class_string = ' class="rs-item-active"';
        }
        $output .= '<li' . $class_string . '><a href="' . Redaxscript\Registry::get('parameterRoute') . Redaxscript\Registry::get('fullRoute') . Redaxscript\Registry::get('templateRoute') . $value . '" rel="nofollow">' . $value . '</a>';
    }
    /* build id string */
    if ($option_id) {
        $id_string = ' id="' . $option_id . '"';
    }
    /* build class string */
    if ($option_class) {
        $class_string = ' class="' . $option_class . '"';
    } else {
        $class_string = ' class="rs-list-templates"';
    }
    /* collect list output */
    if ($output) {
        $output = '<ul' . $id_string . $class_string . '>' . $output . '</ul>';
    }
    echo $output;
}
/**
 * admin modules list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_modules_list()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* query modules */
    $result = Redaxscript\Db::forTablePrefix('modules')->orderByAsc('name')->findArray();
    $num_rows = count($result);
    /* collect listing output */
    $output .= '<h2 class="title_content">' . l('modules') . '</h2>';
    $output .= '<div class="wrapper_table_admin"><table class="table table_admin">';
    /* collect thead and tfoot */
    $output .= '<thead><tr><th class="s4o6 column_first">' . l('name') . '</th><th class="s1o6 column_second">' . l('alias') . '</th><th class="s1o6 column_last">' . l('version') . '</th></tr></thead>';
    $output .= '<tfoot><tr><td class="column_first">' . l('name') . '</td><td class="column_second">' . l('alias') . '</td><td class="column_last">' . l('version') . '</td></tr></tfoot>';
    if ($result == '' || $num_rows == '') {
        $error = l('module_no') . l('point');
    } else {
        if ($result) {
            $accessValidator = new Redaxscript\Validator\Access();
            $output .= '<tbody>';
            foreach ($result as $r) {
                $access = $r['access'];
                /* if access granted */
                if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                    if ($r) {
                        foreach ($r as $key => $value) {
                            ${$key} = stripslashes($value);
                        }
                    }
                    $modules_installed_array[] = $alias;
                    /* build class string */
                    if ($status == 1) {
                        $class_status = '';
                    } else {
                        $class_status = 'row_disabled';
                    }
                    /* collect table row */
                    $output .= '<tr';
                    if ($alias) {
                        $output .= ' id="' . $alias . '"';
                    }
                    if ($class_status) {
                        $output .= ' class="' . $class_status . '"';
                    }
                    $output .= '><td class="column_first">' . $name;
                    /* collect control output */
                    $output .= admin_control('modules_installed', 'modules', $id, $alias, $status, MODULES_INSTALL, MODULES_EDIT, MODULES_UNINSTALL);
                    /* collect alias and version output */
                    $output .= '</td><td class="column_second">' . $alias . '</td><td class="column_last">' . $version . '</td></tr>';
                } else {
                    $counter++;
                }
            }
            $output .= '</tbody>';
            /* handle access */
            if ($num_rows == $counter) {
                $error = l('access_no') . l('point');
            }
        }
    }
    /* handle error */
    if ($error) {
        $output .= '<tbody><tr><td colspan="3">' . $error . '</td></tr></tbody>';
    }
    /* modules not installed */
    if (MODULES_INSTALL == 1) {
        /* modules directory object */
        $modules_directory = new Redaxscript\Directory();
        $modules_directory->init('modules');
        $modules_directory_array = $modules_directory->getArray();
        if ($modules_directory_array && $modules_installed_array) {
            $modules_not_installed_array = array_diff($modules_directory_array, $modules_installed_array);
        } else {
            if ($modules_directory_array) {
                $modules_not_installed_array = $modules_directory_array;
            }
        }
        if ($modules_not_installed_array) {
            $output .= '<tbody><tr class="row_group"><td colspan="3">' . l('install') . '</td></tr>';
            foreach ($modules_not_installed_array as $alias) {
                /* collect table row */
                $output .= '<tr';
                if ($alias) {
                    $output .= ' id="' . $alias . '"';
                }
                $output .= '><td colspan="3">' . $alias;
                /* collect control output */
                $output .= admin_control('modules_not_installed', 'modules', $id, $alias, $status, MODULES_INSTALL, MODULES_EDIT, MODULES_UNINSTALL);
                $output .= '</td></tr>';
            }
            $output .= '</tbody>';
        }
    }
    $output .= '</table></div>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
Example #8
0
/**
 * admin modules list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_modules_list()
{
    $output = Redaxscript\Hook::trigger('adminModuleListStart');
    /* query modules */
    $result = Redaxscript\Db::forTablePrefix('modules')->orderByAsc('name')->findArray();
    $num_rows = count($result);
    /* collect listing output */
    $output .= '<h2 class="rs-admin-title-content">' . Redaxscript\Language::get('modules') . '</h2>';
    $output .= '<div class="rs-admin-wrapper-table"><table class="rs-admin-table-default rs-admin-table-module">';
    /* collect thead and tfoot */
    $output .= '<thead><tr><th class="rs-admin-col-name">' . Redaxscript\Language::get('name') . '</th><th class="rs-admin-col-alias">' . Redaxscript\Language::get('alias') . '</th><th class="rs-admin-col-version">' . Redaxscript\Language::get('version') . '</th></tr></thead>';
    $output .= '<tfoot><tr><td>' . Redaxscript\Language::get('name') . '</td><td>' . Redaxscript\Language::get('alias') . '</td><td>' . Redaxscript\Language::get('version') . '</td></tr></tfoot>';
    if (!$result || !$num_rows) {
        $error = Redaxscript\Language::get('module_no') . Redaxscript\Language::get('point');
    } else {
        if ($result) {
            $accessValidator = new Redaxscript\Validator\Access();
            $output .= '<tbody>';
            foreach ($result as $r) {
                $access = $r['access'];
                /* access granted */
                if ($accessValidator->validate($access, Redaxscript\Registry::get('myGroups')) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                    if ($r) {
                        foreach ($r as $key => $value) {
                            ${$key} = stripslashes($value);
                        }
                    }
                    $modules_installed_array[] = $alias;
                    /* build class string */
                    if ($status == 1) {
                        $class_status = null;
                    } else {
                        $class_status = 'rs-admin-is-disabled';
                    }
                    /* collect table row */
                    $output .= '<tr';
                    if ($alias) {
                        $output .= ' id="' . $alias . '"';
                    }
                    if ($class_status) {
                        $output .= ' class="' . $class_status . '"';
                    }
                    $output .= '><td>' . $name;
                    /* collect control output */
                    $output .= admin_control('modules_installed', 'modules', $id, $alias, $status, Redaxscript\Registry::get('tableInstall'), Redaxscript\Registry::get('tableEdit'), Redaxscript\Registry::get('tableUninstall'));
                    /* collect alias and version output */
                    $output .= '</td><td>' . $alias . '</td><td>' . $version . '</td></tr>';
                } else {
                    $counter++;
                }
            }
            $output .= '</tbody>';
            /* handle access */
            if ($num_rows == $counter) {
                $error = Redaxscript\Language::get('access_no') . Redaxscript\Language::get('point');
            }
        }
    }
    /* handle error */
    if ($error) {
        $output .= '<tbody><tr><td colspan="3">' . $error . '</td></tr></tbody>';
    }
    /* modules not installed */
    if (Redaxscript\Registry::get('modulesInstall') == 1) {
        /* modules directory */
        $modules_directory = new Redaxscript\Directory();
        $modules_directory->init('modules');
        $modules_directory_array = $modules_directory->getArray();
        if ($modules_directory_array && $modules_installed_array) {
            $modules_not_installed_array = array_diff($modules_directory_array, $modules_installed_array);
        } else {
            if ($modules_directory_array) {
                $modules_not_installed_array = $modules_directory_array;
            }
        }
        if ($modules_not_installed_array) {
            $output .= '<tbody><tr class="rs-admin-row-group"><td colspan="3">' . Redaxscript\Language::get('install') . '</td></tr>';
            foreach ($modules_not_installed_array as $alias) {
                /* collect table row */
                $output .= '<tr';
                if ($alias) {
                    $output .= ' id="' . $alias . '"';
                }
                $output .= '><td colspan="3">' . $alias;
                /* collect control output */
                $output .= admin_control('modules_not_installed', 'modules', $id, $alias, $status, Redaxscript\Registry::get('tableInstall'), Redaxscript\Registry::get('tableEdit'), Redaxscript\Registry::get('tableUninstall'));
                $output .= '</td></tr>';
            }
            $output .= '</tbody>';
        }
    }
    $output .= '</table></div>';
    $output .= Redaxscript\Hook::trigger('adminModuleListEnd');
    echo $output;
}
Example #9
0
/**
 * gallery
 *
 * @since 2.0.2
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 *
 * @param string $directory
 * @param array $options
 * @param string $command
 */
function gallery($directory = '', $options = '', $command = '')
{
    global $gallery_counter;
    /* define option variables */
    if (is_array($options)) {
        foreach ($options as $key => $value) {
            $key = 'option_' . $key;
            ${$key} = $value;
        }
    } else {
        if ($options === 'build' || $options === 'delete') {
            $command = $options;
        }
    }
    /* gallery directory object */
    $gallery_directory = new Redaxscript\Directory();
    $gallery_directory->init($directory, 'thumbs');
    $gallery_directory_array = $gallery_directory->getArray();
    /* reverse order */
    if ($option_order == 'desc') {
        $gallery_directory_array = array_reverse($gallery_directory_array);
    }
    /* delete gallery thumbs directory */
    if ($command == 'delete') {
        $gallery_directory->remove('thumbs');
    } else {
        /* collect gallery */
        $gallery_total = count($gallery_directory_array);
        $gallery_id = str_replace('/', '_', $directory) . '_' . ++$gallery_counter;
        if ($gallery_total) {
            foreach ($gallery_directory_array as $value) {
                $path = $directory . '/' . $value;
                $thumb_route = $directory . '/thumbs/' . $value;
                /* build thumb */
                if (file_exists($thumb_route) == '' || $command == 'build') {
                    gallery_build_thumb($value, $directory, $options);
                }
                if (file_exists($thumb_route)) {
                    /* read exif data */
                    $image_data = exif_read_data($path);
                    if ($image_data) {
                        $image_artist = $image_data['Artist'];
                        $image_datetime = $image_data['DateTime'];
                        if ($image_datetime) {
                            $image_date = date(s('date'), strtotime($image_datetime));
                        } else {
                            $image_date = '';
                        }
                        $image_description = $image_data['ImageDescription'];
                    }
                    /* build data string */
                    $data_string = 'data-counter="' . ++$image_counter . '" data-total="' . $gallery_total . '" data-id="' . $gallery_id . '"';
                    if ($image_artist) {
                        $data_string .= ' data-artist="' . $image_artist . '"';
                    }
                    if ($image_date) {
                        $data_string .= ' data-date="' . $image_date . '"';
                    }
                    if ($image_description) {
                        $data_string .= ' data-description="' . $image_description . '"';
                        $alt_string = ' alt="' . $image_description . '"';
                    } else {
                        $alt_string = ' alt="' . str_replace('_', ' ', pathinfo($value, PATHINFO_FILENAME)) . '"';
                    }
                    /* collect image output */
                    $image = '<img src="' . $thumb_route . '" class="image image_gallery"' . $alt_string . ' />';
                    $output .= '<li class="item_gallery">' . anchor_element('', '', 'link_gallery', $image, $path, $image_description, $data_string) . '</li>';
                }
            }
            /* collect list output */
            if ($output) {
                $output = '<ul id="' . $gallery_id . '" class="js_list_gallery list_gallery ' . $gallery_id . ' clearfix">' . $output . '</ul>';
                echo $output;
            }
        } else {
            $gallery_directory->remove('thumbs');
        }
    }
}
Example #10
0
/**
 * file manager
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 *
 * @param string $directory
 */
function file_manager($directory = '')
{
    if (!is_dir($directory)) {
        mkdir($directory, 0777);
    }
    if (!is_dir($directory)) {
        $output = '<div class="box_note note_error">' . l('directory_create', '_file_manager') . l('colon') . ' ' . $directory . l('point') . '</div>';
    } else {
        if (!is_writable($directory)) {
            $output = '<div class="box_note note_error">' . l('directory_permission_grant', '_file_manager') . l('colon') . ' ' . $directory . l('point') . '</div>';
        }
    }
    /* collect listing output */
    $output .= '<h2 class="title_content">' . l('file_manager', '_file_manager') . '</h2>';
    $output .= form_element('form', 'form_file_manager', 'js_form_file_manager form_file_manager', '', '', '', 'action="' . REWRITE_ROUTE . 'admin/file-manager/upload" method="post" enctype="multipart/form-data"');
    $output .= form_element('file', '', 'js_file field_file hide_if_js', 'file', '', l('browse', '_file_manager'));
    $output .= '<button type="submit" class="js_upload field_upload button_admin hide_if_js">' . l('upload', '_file_manager') . '</span></span></button>';
    $output .= '</form>';
    $output .= '<div class="wrapper_table_admin"><table class="table table_admin">';
    /* collect thead and tfoot */
    $output .= '<thead><tr><th class="s4o6 column_first">' . l('name') . '</th><th class="s1o6 column_second">' . l('file_size', '_file_manager') . '</th><th class="s1o6 column_last">' . l('date') . '</th></tr></thead>';
    $output .= '<tfoot><tr><td class="column_first">' . l('name') . '</td><td class="column_second">' . l('file_size', '_file_manager') . '</td><td class="column_last">' . l('date') . '</td></tr></tfoot>';
    /* file manager directory object */
    $file_manager_directory = new Redaxscript\Directory();
    $file_manager_directory->init($directory);
    $file_manager_directory_array = $file_manager_directory->getArray();
    /* collect directory output */
    if (count($file_manager_directory_array)) {
        $output .= '<tbody>';
        foreach ($file_manager_directory_array as $key => $value) {
            $output .= '<tr><td class="column_first">';
            $path = $directory . '/' . $value;
            if (function_exists('exif_imagetype') && exif_imagetype($path)) {
                $output .= anchor_element('external', '', '', $value, ROOT . '/' . $path);
            } else {
                $output .= $value;
            }
            /* collect control output */
            $output .= '<ul class="list_control_admin"><li class="item_delete">' . anchor_element('internal', '', 'js_confirm', l('delete'), 'admin/file-manager/delete/' . $key . '/' . TOKEN) . '</li></ul>';
            /* collect filesize and filetime output */
            $output .= '</td><td class="column_second">' . ceil(filesize($path) / 1024) . ' Kb</td><td class="column_last">' . date(s('date'), filectime($path)) . '</td></tr>';
        }
        $output .= '</tbody>';
    } else {
        $error = l('file_no', '_file_manager') . l('point');
    }
    /* handle error */
    if ($error) {
        $output .= '<tbody><tr><td colspan="2">' . $error . '</td></tr></tbody>';
    }
    $output .= '</table></div>';
    echo $output;
}