Example #1
0
function applet_tree()
{
    $inCore = cmsCore::getInstance();
    cmsCore::loadLib('tags');
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    cmsCore::c('page')->addHeadJS('admin/js/content.js');
    echo '<script>';
    echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_PIECES');
    echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
    echo cmsPage::getLangJS('AD_AND_SUB_CATS');
    echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
    echo '</script>';
    $do = cmsCore::request('do', 'str', 'tree');
    if ($do == 'tree') {
        $toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content'));
        cpToolMenu($toolmenu);
        $only_hidden = cmsCore::request('only_hidden', 'int', 0);
        $category_id = cmsCore::request('cat_id', 'int', 0);
        $base_uri = 'index.php?view=tree';
        $title_part = cmsCore::request('title', 'str', '');
        $def_order = $category_id ? 'con.ordering' : 'pubdate';
        $orderby = cmsCore::request('orderby', 'str', $def_order);
        $orderto = cmsCore::request('orderto', 'str', 'asc');
        $page = cmsCore::request('page', 'int', 1);
        $perpage = 20;
        if ($category_id) {
            cmsCore::m('content')->whereCatIs($category_id);
        }
        if ($title_part) {
            cmsCore::c('db')->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
        }
        if ($only_hidden) {
            cmsCore::c('db')->where('con.published = 0');
        }
        cmsCore::c('db')->orderBy($orderby, $orderto);
        cmsCore::c('db')->limitPage($page, $perpage);
        $total = cmsCore::m('content')->getArticlesCount(false);
        cmsCore::c('page')->initTemplate('applets', 'tree')->assign('hide_cats', cmsCore::request('hide_cats', 'int', 0))->assign('only_hidden', $only_hidden)->assign('base_uri', $base_uri)->assign('category_id', $category_id)->assign('cats', cmsCore::m('content')->getCatsTree())->assign('orderto', $orderto)->assign('orderby', $orderby)->assign('title_part', $title_part)->assign('category_opt', $inCore->getListItemsNS('cms_category', $category_id))->assign('page', $page)->assign('total', $total)->assign('perpage', $perpage)->assign('pages', ceil($total / $perpage))->assign('items', cmsCore::m('content')->getArticlesList(false))->display();
    }
}
Example #2
0
function applet_menu()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/menu', $adminAccess)) {
        cpAccessDenied();
    }
    $GLOBALS['cp_page_title'] = $_LANG['AD_MENU'];
    cpAddPathway($_LANG['AD_MENU'], 'index.php?view=menu');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    if ($do == 'list') {
        $toolmenu[] = array('icon' => 'new.gif', 'title' => $_LANG['AD_MENU_POINT_ADD'], 'link' => '?view=menu&do=add');
        $toolmenu[] = array('icon' => 'newmenu.gif', 'title' => $_LANG['AD_MENU_ADD'], 'link' => '?view=menu&do=addmenu');
        $toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=edit&multiple=1');");
        $toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=delete&multiple=1');");
        $toolmenu[] = array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=show&multiple=1');");
        $toolmenu[] = array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=hide&multiple=1');");
        $toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=menu');
        cpToolMenu($toolmenu);
        $fields[] = array('title' => 'Lt', 'field' => 'NSLeft', 'width' => '30');
        $fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=menu&do=edit&id=%id%');
        $fields[] = array('title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '60');
        $fields[] = array('title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100');
        $fields[] = array('title' => $_LANG['AD_LINK'], 'field' => array('linktype', 'linkid', 'link'), 'width' => '240', 'prc' => 'cpMenutypeById');
        $fields[] = array('title' => $_LANG['AD_MENU'], 'field' => 'menu', 'width' => '70', 'filter' => '10', 'filterlist' => cpGetList('menu'), 'prc' => 'list_menu');
        $fields[] = array('title' => $_LANG['TEMPLATE'], 'field' => 'template', 'width' => '70', 'prc' => 'cpTemplateById');
        $actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=menu&do=edit&id=%id%');
        $actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MENU_POINT_CONFIRM'], 'link' => '?view=menu&do=delete&id=%id%');
        cpListTable('cms_menu', $fields, $actions, 'parent_id>0', 'NSLeft, ordering');
    } else {
        $toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
        $toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=menu');
        cpToolMenu($toolmenu);
    }
    if ($do == 'move_up') {
        $inDB->moveNsCategory('cms_menu', $id, 'up');
        cmsCore::redirectBack();
    }
    if ($do == 'move_down') {
        $inDB->moveNsCategory('cms_menu', $id, 'down');
        cmsCore::redirectBack();
    }
    if ($do == 'show') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                dbShow('cms_menu', $id);
            }
            echo '1';
            exit;
        } else {
            dbShowList('cms_menu', $_REQUEST['item']);
            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
            cmsCore::redirectBack();
        }
    }
    if ($do == 'hide') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                dbHide('cms_menu', $id);
            }
            echo '1';
            exit;
        } else {
            dbHideList('cms_menu', cmsCore::request('item', 'array_int', array()));
            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
            cmsCore::redirectBack();
        }
    }
    if ($do == 'delete') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                $inDB->deleteNS('cms_menu', (int) $id);
            }
        } else {
            $items = cmsCore::request('item', 'array_int', array());
            foreach ($items as $item_id) {
                $inDB->deleteNS('cms_menu', $item_id);
            }
        }
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        cmsCore::redirectBack();
    }
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $id = cmsCore::request('id', 'int', 0);
        if (!$id) {
            cmsCore::redirectBack();
        }
        $title = cmsCore::request('title', 'str', '');
        $menu = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
        $linktype = cmsCore::request('mode', 'str', '');
        $linkid = cmsCore::request($linktype, 'str', '');
        $link = $inCore->getMenuLink($linktype, $linkid);
        $target = cmsCore::request('target', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $template = cmsCore::request('template', 'str', '');
        $iconurl = cmsCore::request('iconurl', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);
        $oldparent = cmsCore::request('oldparent', 'int', 0);
        $is_lax = cmsCore::request('is_lax', 'int', 0);
        $css_class = cmsCore::request('css_class', 'str', '');
        $is_public = cmsCore::request('is_public', 'int', '');
        if (!$is_public) {
            $access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }
        $ns = $inCore->nestedSetsInit('cms_menu');
        if ($oldparent != $parent_id) {
            $ns->MoveNode($id, $parent_id);
        }
        $sql = "UPDATE cms_menu\n                SET title='{$title}',\n                    css_class='{$css_class}',\n                    menu='{$menu}',\n                    link='{$link}',\n                    linktype='{$linktype}',\n                    linkid='{$linkid}',\n                    target='{$target}',\n                    published='{$published}',\n                    template='{$template}',\n                    access_list='{$access_list}',\n                    is_lax='{$is_lax}',\n                    iconurl='{$iconurl}'\n                WHERE id = '{$id}'\n                LIMIT 1";
        $inDB->query($sql);
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        if (!isset($_SESSION['editlist']) || @sizeof($_SESSION['editlist']) == 0) {
            cmsCore::redirect('?view=menu');
        } else {
            cmsCore::redirect('?view=menu&do=edit');
        }
    }
    if ($do == 'submit') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $title = cmsCore::request('title', 'str', '');
        $menu = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
        $linktype = cmsCore::request('mode', 'str', '');
        $linkid = cmsCore::request($linktype, 'str', '');
        $link = $inCore->getMenuLink($linktype, $linkid);
        $target = cmsCore::request('target', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $template = cmsCore::request('template', 'str', '');
        $iconurl = cmsCore::request('iconurl', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);
        $css_class = cmsCore::request('css_class', 'str', '');
        $is_public = cmsCore::request('is_public', 'int', '');
        $is_lax = cmsCore::request('is_lax', 'int', 0);
        if (!$is_public) {
            $access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }
        $ns = $inCore->nestedSetsInit('cms_menu');
        $myid = $ns->AddNode($parent_id);
        $sql = "UPDATE cms_menu\n\t\t\t\tSET menu='{$menu}',\n\t\t\t\t\ttitle='{$title}',\n                    css_class='{$css_class}',\n\t\t\t\t\tlink='{$link}',\n\t\t\t\t\tlinktype='{$linktype}',\n\t\t\t\t\tlinkid='{$linkid}',\n\t\t\t\t\ttarget='{$target}',\n\t\t\t\t\tpublished='{$published}',\n\t\t\t\t\ttemplate='{$template}',\n\t\t\t\t\taccess_list='{$access_list}',\n\t\t\t\t\tis_lax='{$is_lax}',\n\t\t\t\t\ticonurl='{$iconurl}'\n\t\t\t\tWHERE id = '{$myid}'";
        $inDB->query($sql);
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        cmsCore::redirect('?view=menu');
    }
    if ($do == 'submitmenu') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $sql = "SELECT ordering as max_o FROM cms_modules ORDER BY ordering DESC LIMIT 1";
        $result = $inDB->query($sql);
        $row = $inDB->fetch_assoc($result);
        $maxorder = $row['max_o'] + 1;
        $menu = cmsCore::request('menu', 'str', '');
        $title = cmsCore::request('title', 'str', '');
        $position = cmsCore::request('position', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $css_prefix = cmsCore::request('css_prefix', 'str', '');
        $is_public = cmsCore::request('is_public', 'int', '');
        if (!$is_public) {
            $access_list = $inCore->arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }
        $cfg['menu'] = $menu;
        $cfg_str = cmsCore::arrayToYaml($cfg);
        $sql = "INSERT INTO cms_modules (position, name, title, is_external, content, ordering, showtitle, published, user, config, css_prefix, access_list)\n                VALUES ('{$position}', '{$_LANG['AD_MENU']}', '{$title}', 1, 'mod_menu', {$maxorder}, 1, {$published}, 0, '{$cfg_str}', '{$css_prefix}', '{$access_list}')";
        $inDB->query($sql);
        $newid = $inDB->get_last_id('cms_modules');
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        cmsCore::redirect('?view=modules&do=edit&id=' . $newid);
    }
    if ($do == 'addmenu' || $do == 'add' || $do == 'edit') {
        $GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/menu.js"></script>';
        echo '<script>';
        echo cmsPage::getLangJS('AD_SPECIFY_LINK_MENU');
        echo '</script>';
    }
    if ($do == 'addmenu') {
        $GLOBALS['cp_page_title'] = $_LANG['AD_MENU_ADD'];
        cpAddPathway($_LANG['AD_MENU_ADD']);
        $menu_list = cpGetList('menu');
        ?>
         <form id="addform" name="addform" action="index.php?view=menu&do=submitmenu" method="post">
             <input type="hidden" name="csrf_token" value="<?php 
        echo cmsUser::getCsrfToken();
        ?>
" />
             <table class="proptable" width="650" cellspacing="10" cellpadding="10">
                 <tr>
                     <td width="300" valign="top">
                         <strong><?php 
        echo $_LANG['AD_MODULE_MENU_TITLE'];
        ?>
</strong>
                     </td>
                     <td valign="top">
                         <input name="title" type="text" id="title2" style="width:99%" value=""/>
                     </td>
                 </tr>
                 <tr>
                     <td valign="top">
                         <strong><?php 
        echo $_LANG['AD_MENU_TO_VIEW'];
        ?>
</strong><br/>
                         <span class="hinttext"><?php 
        echo $_LANG['AD_TO_CREATE_NEW_POINT'];
        ?>
</span>
                     </td>
                     <td valign="top">
                         <select name="menu" id="menu" style="width:99%">
                             <?php 
        foreach ($menu_list as $menu) {
            ?>
                                 <option value="<?php 
            echo $menu['id'];
            ?>
">
                                     <?php 
            echo $menu['title'];
            ?>
                                 </option>
                             <?php 
        }
        ?>
                         </select>
                     </td>
                 </tr>
                 <tr>
                     <td valign="top">
                         <strong><?php 
        echo $_LANG['AD_POSITION_TO_VIEW'];
        ?>
</strong><br />
                         <span class="hinttext"><?php 
        echo $_LANG['AD_POSITION_MUST_BE'];
        ?>
</span>
                     </td>
                     <td valign="top">
                         <?php 
        $pos = cpModulePositions(cmsConfig::getConfig('template'));
        ?>
                         <select name="position" id="position" style="width:99%">
                             <?php 
        if ($pos) {
            foreach ($pos as $key => $position) {
                if (@$mod['position'] == $position) {
                    echo '<option value="' . $position . '" selected>' . $position . '</option>';
                } else {
                    echo '<option value="' . $position . '">' . $position . '</option>';
                }
            }
        }
        ?>
                         </select>
                         <input name="is_external" type="hidden" id="is_external" value="0" />
                     </td>
                 </tr>
                 <tr>
                     <td valign="top"><strong><?php 
        echo $_LANG['AD_MENU_PUBLIC'];
        ?>
</strong></td>
                     <td valign="top">
                         <label><input name="published" type="radio" value="1" checked="checked" <?php 
        if (@$mod['published']) {
            echo 'checked="checked"';
        }
        ?>
 /> <?php 
        echo $_LANG['YES'];
        ?>
</label>
                         <label><input name="published" type="radio" value="0"  <?php 
        if (@(!$mod['published'])) {
            echo 'checked="checked"';
        }
        ?>
 /> <?php 
        echo $_LANG['NO'];
        ?>
</label>
                     </td>
                 </tr>
                 <tr>
                     <td valign="top"><strong><?php 
        echo $_LANG['AD_PREFIX_CSS'];
        ?>
</strong></td>
                     <td valign="top">
                         <input name="css_prefix" type="text" id="css_prefix" value="<?php 
        echo @$mod['css_prefix'];
        ?>
" style="width:99%" />
                     </td>
                 </tr>
                 <tr>
                     <td valign="top">
                         <strong><?php 
        echo $_LANG['AD_TAB_ACCESS'];
        ?>
:</strong><br />
                         <span class="hinttext"><?php 
        echo $_LANG['AD_GROUP_ACCESS'];
        ?>
</span>
                     </td>
                     <td valign="top">
                     <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist" style="margin-top:5px">
                         <tr>
                             <td width="20">
                                 <?php 
        $groups = cmsUser::getGroups();
        $style = 'disabled="disabled"';
        $public = 'checked="checked"';
        if ($do == 'edit') {
            if ($mod['access_list']) {
                $public = '';
                $style = '';
                $access_list = $inCore->yamlToArray($mod['access_list']);
            }
        }
        ?>
                                 <input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php 
        echo $public;
        ?>
 />
                             </td>
                             <td><label for="is_public"><strong><?php 
        echo $_LANG['AD_SHARE'];
        ?>
</strong></label></td>
                         </tr>
                     </table>
                     <div style="padding:5px">
                         <span class="hinttext">
                             <?php 
        echo $_LANG['AD_VIEW_IF_CHECK'];
        ?>
                         </span>
                     </div>

                     <div style="margin-top:10px;padding:5px;padding-right:0px;" id="grp">
                         <div>
                             <strong><?php 
        echo $_LANG['AD_GROUPS_VIEW'];
        ?>
</strong><br />
                             <span class="hinttext">
                                  <?php 
        echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
        ?>
                             </span>
                         </div>
                         <div>
                             <?php 
        echo '<select style="width: 99%" name="allow_group[]" id="allow_group" size="6" multiple="multiple" ' . $style . '>';
        if ($groups) {
            foreach ($groups as $group) {
                echo '<option value="' . $group['id'] . '"';
                if ($do == 'edit') {
                    if (inArray($access_list, $group['id'])) {
                        echo 'selected="selected"';
                    }
                }
                echo '>';
                echo $group['title'] . '</option>';
            }
        }
        echo '</select>';
        ?>
                         </div>
                     </div>
                     </td>
                 </tr>
                 <tr>
                     <td colspan="2" valign="top">
                         <div style="padding:10px;margin:4px;background-color:#EBEBEB;border:solid 1px gray">
                             <?php 
        echo $_LANG['AD_NEW_MENU_NEW_MODULE'];
        ?>
                         </div>
                     </td>
                 </tr>
             </table>
             <div style="margin-top:5px">
                 <input name="save" type="submit" id="save" value="<?php 
        echo $_LANG['AD_MENU_ADD'];
        ?>
" />
                 <input name="back" type="button" id="back" value="<?php 
        echo $_LANG['CANCEL'];
        ?>
" onclick="window.location.href='index.php?view=menu';" />
             </div>
         </form>
         <?php 
    }
    if ($do == 'add' || $do == 'edit') {
        require '../includes/jwtabs.php';
        $GLOBALS['cp_page_head'][] = jwHeader();
        $menu_list = cpGetList('menu');
        if ($do == 'add') {
            cpAddPathway($_LANG['AD_MENU_POINT_ADD']);
            $mod['menu'] = array('mainmenu');
        } else {
            if (isset($_REQUEST['multiple'])) {
                if (isset($_REQUEST['item'])) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }
            $ostatok = '';
            if (isset($_SESSION['editlist'])) {
                $item_id = array_shift($_SESSION['editlist']);
                if (sizeof($_SESSION['editlist']) == 0) {
                    unset($_SESSION['editlist']);
                } else {
                    $ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
                }
            } else {
                $item_id = cmsCore::request('id', 'int', 0);
            }
            $mod = $inDB->get_fields('cms_menu', "id = '{$item_id}'", '*');
            if (!$mod) {
                cmsCore::error404();
            }
            $mod['menu'] = cmsCore::yamlToArray($mod['menu']);
            cpAddPathway($_LANG['AD_MENU_POINT_EDIT'] . $ostatok . ' "' . $mod['title'] . '"');
        }
        ?>
    <form id="addform" name="addform" method="post" action="index.php">
        <input type="hidden" name="csrf_token" value="<?php 
        echo cmsUser::getCsrfToken();
        ?>
" />
        <input type="hidden" name="view" value="menu" />

        <table class="proptable" width="100%" cellpadding="15" cellspacing="2">
            <tr>

                <td valign="top">

                    <div><strong><?php 
        echo $_LANG['AD_MENU_POINT_TITLE'];
        ?>
</strong> <span class="hinttext">&mdash; <?php 
        echo $_LANG['AD_VIEW_IN_SITE'];
        ?>
</span></div>
                    <div><input name="title" type="text" id="title" style="width:100%" value="<?php 
        echo htmlspecialchars($mod['title']);
        ?>
" /></div>
                    <div><strong><?php 
        echo $_LANG['AD_PARENT_POINT'];
        ?>
</strong></div>
                    <div>
                        <?php 
        $rootid = $inDB->get_field('cms_menu', 'parent_id=0', 'id');
        ?>
                        <select name="parent_id" size="10" id="parent_id" style="width:100%">
                            <option value="<?php 
        echo $rootid;
        ?>
" <?php 
        if (@$mod['parent_id'] == $rootid || !isset($mod['parent_id'])) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_MENU_ROOT'];
        ?>
</option>
                            <?php 
        if (isset($mod['parent_id'])) {
            echo $inCore->getListItemsNS('cms_menu', $mod['parent_id']);
        } else {
            echo $inCore->getListItemsNS('cms_menu');
        }
        ?>
                        </select>
                        <input type="hidden" name="oldparent" value="<?php 
        echo @$mod['parent_id'];
        ?>
" />
                    </div>

                    <div><strong><?php 
        echo $_LANG['AD_MENU_POINT_ACTION'];
        ?>
</strong></div>
                    <div>
                        <select name="mode" id="linktype" style="width:100%" onchange="showMenuTarget()">
                            <option value="link" <?php 
        if (@$mod['linktype'] == 'link' || !isset($mod['mode'])) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_LINK'];
        ?>
</option>
                            <option value="content" <?php 
        if (@$mod['linktype'] == 'content') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_ARTICLE'];
        ?>
</option>
                            <option value="category" <?php 
        if (@$mod['linktype'] == 'category') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_PARTITION'];
        ?>
</option>
                            <?php 
        if ($inCore->isComponentInstalled('video')) {
            ?>
                            <option value="video_cat" <?php 
            if (@$mod['linktype'] == 'video_cat') {
                echo 'selected="selected"';
            }
            ?>
><?php 
            echo $_LANG['AD_OPEN_VIDEO_PARTITION'];
            ?>
</option>
                            <?php 
        }
        ?>
                            <option value="component" <?php 
        if (@$mod['linktype'] == 'component') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_COMPONENT'];
        ?>
</option>
                            <option value="blog" <?php 
        if (@$mod['linktype'] == 'blog') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_BLOG'];
        ?>
</option>
                            <option value="uccat" <?php 
        if (@$mod['linktype'] == 'uccat') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_CATEGORY'];
        ?>
</option>
                            <option value="photoalbum" <?php 
        if (@$mod['linktype'] == 'photoalbum') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_OPEN_ALBUM'];
        ?>
</option>
                        </select>
                    </div>

                    <div id="t_link" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'link' || $mod['linktype'] == 'ext' || !$mod['linktype']) {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_LINK'];
        ?>
</strong> <span class="hinttext">&mdash; <?php 
        echo $_LANG['AD_LINK_HINT'];
        ?>
 <b>http://</b></span>
                        </div>
                        <div>
                            <input name="link" type="text" id="link" size="50" style="width:100%" <?php 
        if (@$mod['linktype'] == 'link' || @$mod['linktype'] == 'ext') {
            echo 'value="' . $mod['link'] . '"';
        }
        ?>
/>
                        </div>
                    </div>

                    <div id="t_content" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'content') {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_CHECK_ARTICLE'];
        ?>
</strong>
                        </div>
                        <div>
                            <select name="content" id="content" style="width:100%">
                                <?php 
        if (@$mod['linktype'] == 'content') {
            echo $inCore->getListItems('cms_content', $mod['linkid']);
        } else {
            echo $inCore->getListItems('cms_content');
        }
        ?>
                            </select>
                        </div>
                    </div>

                    <?php 
        if ($inCore->isComponentInstalled('video')) {
            ?>
                    <div id="t_video_cat" class="menu_target" style="display:<?php 
            if ($mod['linktype'] == 'video_cat') {
                echo 'block';
            } else {
                echo 'none';
            }
            ?>
">
                        <div>
                            <strong><?php 
            echo $_LANG['AD_CHECK_PARTITION'];
            ?>
</strong>
                        </div>
                        <div>
                            <select name="video_cat" id="video_cat" style="width:100%">
                                    <?php 
            if (@$mod['linktype'] == 'video_cat') {
                echo $inCore->getListItemsNS('cms_video_category', $mod['linkid']);
            } else {
                echo $inCore->getListItemsNS('cms_video_category');
            }
            ?>
                            </select>
                        </div>
                    </div>
                    <?php 
        }
        ?>

                    <div id="t_category" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'category') {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_CHECK_PARTITION'];
        ?>
</strong>
                        </div>
                        <div>
                            <select name="category" id="category" style="width:100%">
                                    <?php 
        if (@$mod['linktype'] == 'category') {
            echo $inCore->getListItemsNS('cms_category', $mod['linkid']);
        } else {
            echo $inCore->getListItemsNS('cms_category');
        }
        ?>
                            </select>
                        </div>
                    </div>

                    <div id="t_component" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'component') {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_CHECK_COMPONENT'];
        ?>
</strong>
                        </div>
                        <div>
                           <select name="component" id="component" style="width:100%">
                                <?php 
        if (@$mod['linktype'] == 'component') {
            echo $inCore->getListItems('cms_components', $mod['linkid'], 'title', 'asc', 'internal=0', 'link');
        } else {
            echo $inCore->getListItems('cms_components', 0, 'title', 'asc', 'internal=0', 'link');
        }
        ?>
                            </select>
                        </div>
                    </div>

                    <div id="t_blog" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'blog') {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_CHECK_BLOG'];
        ?>
</strong>
                        </div>
                        <div>
                           <select name="blog" id="blog" style="width:100%">
                                <?php 
        if (@$mod['linktype'] == 'blog') {
            echo $inCore->getListItems('cms_blogs', $mod['linkid'], 'title', 'asc', "owner='user'");
        } else {
            echo $inCore->getListItems('cms_blogs', 0, 'title', 'asc', "owner='user'");
        }
        ?>
                            </select>
                        </div>
                    </div>

                    <div id="t_uccat" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'uccat') {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_CHECK_CATEGORY'];
        ?>
</strong>
                        </div>
                        <div>
                           <select name="uccat" id="uccat" style="width:100%">
                                <?php 
        if (@$mod['linktype'] == 'uccat') {
            echo $inCore->getListItems('cms_uc_cats', $mod['linkid']);
        } else {
            echo $inCore->getListItems('cms_uc_cats');
        }
        ?>
                            </select>
                        </div>
                    </div>

                    <div id="t_photoalbum" class="menu_target" style="display:<?php 
        if ($mod['linktype'] == 'photoalbum') {
            echo 'block';
        } else {
            echo 'none';
        }
        ?>
">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_CHECK_ALBUM'];
        ?>
</strong>
                        </div>
                        <div>
                           <select name="photoalbum" id="photoalbum" style="width:100%">
                                <?php 
        if (@$mod['linktype'] == 'photoalbum') {
            echo $inCore->getListItems('cms_photo_albums', $mod['linkid'], 'id', 'ASC', 'NSDiffer = ""');
        } else {
            echo $inCore->getListItems('cms_photo_albums', 0, 'id', 'ASC', 'NSDiffer = ""');
        }
        ?>
                            </select>
                        </div>
                    </div>

                </td>

                <td width="300" valign="top" style="background:#ECECEC;">

                    <?php 
        ob_start();
        ?>

                    {tab=<?php 
        echo $_LANG['AD_TAB_PUBLISH'];
        ?>
}

                        <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist">
                            <tr>
                                <td width="20"><input type="checkbox" name="published" id="published" value="1" <?php 
        if ($mod['published'] || $do == 'add') {
            echo 'checked="checked"';
        }
        ?>
/></td>
                                <td><label for="published"><strong><?php 
        echo $_LANG['AD_MENU_POINT_PUBLIC'];
        ?>
</strong></label></td>
                            </tr>
                        </table>

                        <div style="margin-top:15px">
                            <strong><?php 
        echo $_LANG['AD_OPEN_POINT'];
        ?>
</strong>
                        </div>
                        <div>
                            <select name="target" id="target" style="width:100%">
                                <option value="_self" <?php 
        if (@$mod['target'] == '_self') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_SELF'];
        ?>
</option>
                                <option value="_parent"><?php 
        echo $_LANG['AD_PARENT'];
        ?>
</option>
                                <option value="_blank" <?php 
        if (@$mod['target'] == '_blank') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_BLANK'];
        ?>
</option>
                                <option value="_top" <?php 
        if (@$mod['target'] == '_top') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_TOP'];
        ?>
</option>
                            </select>
                        </div>

                        <div style="margin-top:15px">
                            <strong><?php 
        echo $_LANG['TEMPLATE'];
        ?>
</strong><br/>
                            <span class="hinttext"><?php 
        echo $_LANG['AD_DESIGN_CHANGE'];
        ?>
</span>
                        </div>
                        <div>
                            <select name="template" id="template" style="width:100%">
                                <option value="0" <?php 
        if (@$mod['template'] == 0 || !$mod['template']) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $_LANG['AD_BY_DEFAULT'];
        ?>
</option>
                                <?php 
        $templates = cmsCore::getDirsList('/templates');
        foreach ($templates as $template) {
            echo '<option value="' . $template . '" ' . (@$mod['template'] == $template ? 'selected="selected"' : '') . '>' . $template . '</option>';
        }
        ?>
                            </select>
                        </div>

                        <div style="margin-top:15px">
                            <strong><?php 
        echo $_LANG['AD_ICON_PICTURE'];
        ?>
</strong><br/>
                            <span class="hinttext"><?php 
        echo $_LANG['AD_ICON_FILENAME'];
        ?>
</span>
                        </div>
                        <div>
                            <input name="iconurl" type="text" id="iconurl" size="30" value="<?php 
        echo @$mod['iconurl'];
        ?>
" style="width:100%"/>
                            <div>
                                <a id="iconlink" style="display:block;" href="javascript:showIcons()"><?php 
        echo $_LANG['AD_CHECK_ICON'];
        ?>
</a>
                                <div id="icondiv" style="display:none; padding:6px;border:solid 1px gray;background:#FFF">
                                    <div><?php 
        iconList();
        ?>
</div>
                                </div>
                            </div>
                        </div>
                        <div style="margin-top:15px">
                            <strong><?php 
        echo $_LANG['AD_CSS_CLASS'];
        ?>
</strong>
                        </div>
                        <div>
                            <input name="css_class" type="text" size="30" value="<?php 
        echo @$mod['css_class'];
        ?>
" style="width:100%"/>
                        </div>

                    {tab=<?php 
        echo $_LANG['AD_TAB_ACCESS'];
        ?>
}
                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist" style="margin-top:5px">
                        <tr>
                            <td width="20">
                                <?php 
        $groups = cmsUser::getGroups();
        $style = 'disabled="disabled"';
        $public = 'checked="checked"';
        if ($do == 'edit') {
            if ($mod['access_list']) {
                $public = '';
                $style = '';
                $access_list = $inCore->yamlToArray($mod['access_list']);
            }
        }
        ?>
                                <input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php 
        echo $public;
        ?>
 />
                            </td>
                            <td><label for="is_public"><strong><?php 
        echo $_LANG['AD_SHARE'];
        ?>
</strong></label></td>
                        </tr>
                    </table>
                    <div style="padding:5px">
                        <span class="hinttext">
                            <?php 
        echo $_LANG['AD_VIEW_IF_CHECK'];
        ?>
                        </span>
                    </div>

                    <div style="margin-top:10px;padding:5px;padding-right:0px;" id="grp">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_GROUPS_VIEW'];
        ?>
</strong><br />
                            <span class="hinttext">
                                <?php 
        echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
        ?>
                            </span>
                        </div>
                        <div>
                            <?php 
        echo '<select style="width: 99%" name="allow_group[]" id="allow_group" size="6" multiple="multiple" ' . $style . '>';
        if ($groups) {
            foreach ($groups as $group) {
                echo '<option value="' . $group['id'] . '"';
                if ($do == 'edit' && $mod['access_list']) {
                    if (inArray($access_list, $group['id'])) {
                        echo 'selected="selected"';
                    }
                }
                echo '>';
                echo $group['title'] . '</option>';
            }
        }
        echo '</select>';
        ?>
                        </div>
                    </div>
                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist" style="margin-top:5px">
                        <tr>
                            <td width="20">
                                <input name="is_lax" type="checkbox" id="is_lax" value="1" <?php 
        if (@$mod['is_lax']) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
                            </td>
                            <td><label for="is_lax"><strong><?php 
        echo $_LANG['AD_ONLY_CHILD_ITEM'];
        ?>
</strong></label></td>
                        </tr>
                    </table>
                    {tab=<?php 
        echo $_LANG['AD_MENU'];
        ?>
}
                    <div style="padding:5px;padding-right:0px;">
                        <div>
                            <strong><?php 
        echo $_LANG['AD_MENU_TO_VIEW'];
        ?>
</strong><br />
                            <span class="hinttext">
                                <?php 
        echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
        ?>
                            </span>
                        </div>
                        <div>
                        <select style="width: 99%" name="menu[]" size="9" multiple="multiple">
                            <?php 
        foreach ($menu_list as $menu) {
            ?>
                                <option value="<?php 
            echo $menu['id'];
            ?>
" <?php 
            if (@in_array($menu['id'], @$mod['menu'])) {
                echo 'selected="selected"';
            }
            ?>
>
                                    <?php 
            echo $menu['title'];
            ?>
                                </option>
                            <?php 
        }
        ?>
                        </select>
                        </div>
                    </div>
                    {/tabs}

                    <?php 
        echo jwTabs(ob_get_clean());
        ?>

                </td>

            </tr>
        </table>

        <p>
            <input name="add_mod" type="button" onclick="submitItem()" id="add_mod" value="<?php 
        echo $_LANG['SAVE'];
        ?>
 " />
            <input name="back" type="button" id="back" value="<?php 
        echo $_LANG['CANCEL'];
        ?>
" onclick="window.location.href='index.php?view=menu';" />
            <input name="do" type="hidden" id="do" <?php 
        if ($do == 'add') {
            echo 'value="submit"';
        } else {
            echo 'value="update"';
        }
        ?>
 />
            <?php 
        if ($do == 'edit') {
            echo '<input name="id" type="hidden" value="' . $mod['id'] . '" />';
        }
        ?>
        </p>
    </form>
    <?php 
    }
}
Example #3
0
File: tree.php Project: r2git/icms1
function applet_tree()
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inPage = cmsPage::getInstance();
    cmsCore::loadLib('tags');
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
        cpAccessDenied();
    }
    $cfg = $inCore->loadComponentConfig('content');
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    $GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/content.js"></script>';
    echo '<script>';
    echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_PIECES');
    echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
    echo cmsPage::getLangJS('AD_AND_SUB_CATS');
    echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
    echo '</script>';
    $do = cmsCore::request('do', 'str', 'tree');
    //============================================================================//
    //============================================================================//
    if ($do == 'tree') {
        $toolmenu[] = array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content');
        $toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content');
        cpToolMenu($toolmenu);
        $only_hidden = cmsCore::request('only_hidden', 'int', 0);
        $category_id = cmsCore::request('cat_id', 'int', 0);
        $base_uri = 'index.php?view=tree';
        $title_part = cmsCore::request('title', 'str', '');
        $def_order = $category_id ? 'con.ordering' : 'pubdate';
        $orderby = cmsCore::request('orderby', 'str', $def_order);
        $orderto = cmsCore::request('orderto', 'str', 'asc');
        $page = cmsCore::request('page', 'int', 1);
        $perpage = 20;
        $hide_cats = cmsCore::request('hide_cats', 'int', 0);
        $cats = $model->getCatsTree();
        if ($category_id) {
            $model->whereCatIs($category_id);
        }
        if ($title_part) {
            $inDB->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
        }
        if ($only_hidden) {
            $inDB->where('con.published = 0');
        }
        $inDB->orderBy($orderby, $orderto);
        $inDB->limitPage($page, $perpage);
        $total = $model->getArticlesCount(false);
        $items = $model->getArticlesList(false);
        $pages = ceil($total / $perpage);
        $tpl_file = 'admin/content.php';
        $tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
        include $tpl_dir . $tpl_file;
    }
}
Example #4
0
    echo $_LANG['INS_GO_HANDBOOK'];
    ?>
</a>
                                <a id="video" target="_blank" href="http://www.instantcms.ru/video-lessons.html"><?php 
    echo $_LANG['INS_GO_VIDEO'];
    ?>
</a>
                            </p>
                        </div>
<?php 
}
?>
                    <div id="footer">
                        <a href="http://www.instantcms.ru/" target="_blank">InstantCMS</a>, <a href="http://instantsoft.ru/" target="_blank">InstantSoft</a> &copy; 2007-<?php 
echo date('Y');
?>
                    </div>
                </td></tr></table>
        <script>
            <?php 
echo cmsPage::getLangJS('INS_DO_INSTALL');
?>
            <?php 
echo cmsPage::getLangJS('INS_NEXT');
?>
            <?php 
echo cmsPage::getLangJS('INS_BACK');
?>
        </script>
    </body>
</html>
Example #5
0
    return $html;
}

cmsCore::loadModel('catalog');
$model = new cms_model_catalog();

$cfg = $inCore->loadComponentConfig('catalog');
$opt = cmsCore::request('opt', 'str', 'list_cats');

define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) { cmsCore::loadClass('billing'); }

cmsCore::c('page')->addHeadJS('admin/components/catalog/js/common.js');

echo '<script>',cmsPage::getLangJS('AD_HOW_MANY_COPY'),'</script>';


$toolmenu = array(
    array( 'icon' => 'newfolder.gif', 'title' => $_LANG['AD_NEW_CAT'], 'link' => '?view=components&do=config&id='. $id .'&opt=add_cat'),
    array( 'icon' => 'newstuff.gif', 'title' => $_LANG['ADD_ITEM'], 'link' => '?view=components&do=config&id='. $id .'&opt=add_item'),
    array( 'icon' => 'newdiscount.gif', 'title' => $_LANG['AD_NEW_COEFFICIENT'], 'link' => '?view=components&do=config&id='. $id .'&opt=add_discount'),
    array( 'icon' => 'folders.gif', 'title' => $_LANG['AD_ALL_CAT'], 'link' => '?view=components&do=config&id='. $id .'&opt=list_cats'),
    array( 'icon' => 'liststuff.gif', 'title' => $_LANG['AD_ALL_ITEM'], 'link' => '?view=components&do=config&id='. $id .'&opt=list_items'),
    array( 'icon' => 'listdiscount.gif', 'title' => $_LANG['AD_ALL_COEFFICIENTS'], 'link' => '?view=components&do=config&id='. $id .'&opt=list_discount'),
    array( 'icon' => 'excel.gif', 'title' => $_LANG['AD_MS_EXCEL_IMPORT'], 'link' => '?view=components&do=config&id='. $id .'&opt=import_xls')
);

if ($opt == 'list_items') {
    $toolmenu[] = array( 'icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=components&do=config&id=". $id ."&opt=show_item&multiple=1');");
    $toolmenu[] = array( 'icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=components&do=config&id=". $id ."&opt=hide_item&multiple=1');");
Example #6
0
        $html = '&mdash;';
    }
    return $html;
}
//=================================================================================================//
cmsCore::loadModel('catalog');
$model = new cms_model_catalog();
$cfg = $inCore->loadComponentConfig('catalog');
$opt = cmsCore::request('opt', 'str', 'list_cats');
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) {
    cmsCore::loadClass('billing');
}
$GLOBALS['cp_page_head'][] = '<script type="text/javascript" src="/admin/components/catalog/js/common.js"></script>';
echo '<script>';
echo cmsPage::getLangJS('AD_HOW_MANY_COPY');
echo '</script>';
//=================================================================================================//
//=================================================================================================//
$toolmenu = array();
if ($opt == 'list_items' || $opt == 'list_cats' || $opt == 'list_discount') {
    $toolmenu[] = array('icon' => 'newfolder.gif', 'title' => $_LANG['AD_NEW_CAT'], 'link' => '?view=components&do=config&id=' . $id . '&opt=add_cat');
    $toolmenu[] = array('icon' => 'newstuff.gif', 'title' => $_LANG['ADD_ITEM'], 'link' => '?view=components&do=config&id=' . $id . '&opt=add_item');
    $toolmenu[] = array('icon' => 'newdiscount.gif', 'title' => $_LANG['AD_NEW_COEFFICIENT'], 'link' => '?view=components&do=config&id=' . $id . '&opt=add_discount');
    $toolmenu[] = array('icon' => 'folders.gif', 'title' => $_LANG['AD_ALL_CAT'], 'link' => '?view=components&do=config&id=' . $id . '&opt=list_cats');
    $toolmenu[] = array('icon' => 'liststuff.gif', 'title' => $_LANG['AD_ALL_ITEM'], 'link' => '?view=components&do=config&id=' . $id . '&opt=list_items');
    $toolmenu[] = array('icon' => 'listdiscount.gif', 'title' => $_LANG['AD_ALL_COEFFICIENTS'], 'link' => '?view=components&do=config&id=' . $id . '&opt=list_discount');
    $toolmenu[] = array('icon' => 'excel.gif', 'title' => $_LANG['AD_MS_EXCEL_IMPORT'], 'link' => '?view=components&do=config&id=' . $id . '&opt=import_xls');
    if ($opt == 'list_items') {
        $toolmenu[] = array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=components&do=config&id=" . $id . "&opt=show_item&multiple=1');");
        $toolmenu[] = array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=components&do=config&id=" . $id . "&opt=hide_item&multiple=1');");
Example #7
0
function applet_menu() {
    $inCore = cmsCore::getInstance();

    global $_LANG;
    global $adminAccess;

    if (!cmsUser::isAdminCan('admin/menu', $adminAccess)) { cpAccessDenied(); }

    cmsCore::c('page')->setTitle($_LANG['AD_MENU']);
    cpAddPathway($_LANG['AD_MENU'], 'index.php?view=menu');

    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);

    if ($do == 'list') {
        $toolmenu = array(
            array( 'icon' => 'new.gif', 'title' => $_LANG['AD_MENU_POINT_ADD'], 'link' => '?view=menu&do=add' ),
            array( 'icon' => 'newmenu.gif', 'title' => $_LANG['AD_MENU_ADD'], 'link' => '?view=menu&do=addmenu' ),
            array( 'icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link'=> "javascript:checkSel('?view=menu&do=edit&multiple=1');" ),
            array( 'icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=delete&multiple=1');" ),
            array( 'icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=show&multiple=1');" ),
            array( 'icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=hide&multiple=1');" ),
            array( 'icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=menu' )
        );

        cpToolMenu($toolmenu);

        $fields = array(
            array( 'title' => 'Lt', 'field' => 'NSLeft', 'width' => '40' ),
            array(
                'title' => $_LANG['TITLE'],
                'field' => array('title', 'titles'), 'width'=>'',
                'link'  => '?view=menu&do=edit&id=%id%',
                'prc'   => function ($i) {
                    $i['titles'] = cmsCore::yamlToArray($i['titles']);
                    
                    // переопределяем название пункта меню в зависимости от языка
                    if (!empty($i['titles'][cmsConfig::getConfig('lang')])) {
                        $i['title'] = $i['titles'][cmsConfig::getConfig('lang')];
                    }
                    
                    return $i['title'];
                }
            ),
            array( 'title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '80' ),
            array( 'title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100' ),
            array( 'title' => $_LANG['AD_LINK'], 'field' => array('linktype', 'linkid', 'link'), 'width' => '240', 'prc' => 'cpMenutypeById' ),
            array( 'title' => $_LANG['AD_MENU'], 'field' => 'menu', 'width' => '80', 'filter' => '10', 'filterlist' => cpGetList('menu'), 'prc' => 'list_menu' ),
            array( 'title' => $_LANG['TEMPLATE'], 'field' => 'template', 'width' => '90', 'prc' => 'cpTemplateById' )
        );
        
        $actions = array(
            array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=menu&do=edit&id=%id%' ),
            array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MENU_POINT_CONFIRM'], 'link' => '?view=menu&do=delete&id=%id%' )
        );

        cpListTable('cms_menu', $fields, $actions, 'parent_id>0', 'NSLeft, ordering');

    } else {
        $toolmenu = array(
            array( 'icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();' ),
            array( 'icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=menu' )
        );

        cpToolMenu($toolmenu);
    }

    if ($do == 'move_up') {
        cmsCore::c('db')->moveNsCategory('cms_menu', $id, 'up');
        cmsCore::redirectBack();
    }

    if ($do == 'move_down') {
        cmsCore::c('db')->moveNsCategory('cms_menu', $id, 'down');
        cmsCore::redirectBack();
    }

    if ($do == 'show') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) { cmsCore::c('db')->setFlag('cms_menu', $id, 'published', '1'); }
            cmsCore::halt('1');
        } else {
            cmsCore::c('db')->setFlags('cms_menu', $_REQUEST['item'], 'published', '1');
            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] , 'success');
            cmsCore::redirectBack();
        }
    }

    if ($do == 'hide') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) { cmsCore::c('db')->setFlag('cms_menu', $id, 'published', '0'); }
            cmsCore::halt('1');
        } else {
            cmsCore::c('db')->setFlags('cms_menu', cmsCore::request('item', 'array_int', array()), 'published', '0');
            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] , 'success');
            cmsCore::redirectBack();
        }
    }

    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) { cmsCore::c('db')->deleteNS('cms_menu', (int)$id); }
        } else {
            cmsCore::c('db')->deleteListNS('cms_menu', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] , 'success');
        cmsCore::redirectBack();
    }

    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $id = cmsCore::request('id', 'int', 0);
        if(!$id){ cmsCore::redirectBack(); }

        $title     = cmsCore::request('title', 'str', '');
        $titles    = cmsCore::arrayToYaml(cmsCore::request('titles', 'array_str', array()));
        $menu      = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
        $linktype  = cmsCore::request('mode', 'str', '');
        $linkid    = cmsCore::request($linktype, 'str', '');
        $link      = $inCore->getMenuLink($linktype, $linkid);
        $target    = cmsCore::request('target', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $template  = cmsCore::request('template', 'str', '');
        $iconurl   = cmsCore::request('iconurl', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);
        $oldparent = cmsCore::request('oldparent', 'int', 0);
        $is_lax    = cmsCore::request('is_lax', 'int', 0);
        $css_class = cmsCore::request('css_class', 'str', '');

        $is_public = cmsCore::request('is_public', 'int', '');
        if (!$is_public) {
            $access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }

        $ns = $inCore->nestedSetsInit('cms_menu');

        if ($oldparent != $parent_id) {
            $ns->MoveNode($id, $parent_id);
        }

        $sql = "UPDATE cms_menu
                SET title='". $title ."',
                    titles='". $titles ."',
                    css_class='". $css_class ."',
                    menu='". $menu ."',
                    link='". $link ."',
                    linktype='". $linktype ."',
                    linkid='". $linkid ."',
                    target='". $target ."',
                    published='". $published ."',
                    template='". $template ."',
                    access_list='". $access_list ."',
                    is_lax='". $is_lax ."',
                    iconurl='". $iconurl ."'
                WHERE id = '". $id ."'
                LIMIT 1";
        cmsCore::c('db')->query($sql) ;

        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] , 'success');

        if (!isset($_SESSION['editlist']) || count($_SESSION['editlist']) == 0) {
            cmsCore::redirect('?view=menu');
        } else {
            cmsCore::redirect('?view=menu&do=edit');
        }

    }

    if ($do == 'submit') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $title     = cmsCore::request('title', 'str', '');
        $titles    = cmsCore::arrayToYaml(cmsCore::request('titles', 'array_str', array()));
        $menu      = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
        $linktype  = cmsCore::request('mode', 'str', '');
        $linkid    = cmsCore::request($linktype, 'str', '');
        $link      = $inCore->getMenuLink($linktype, $linkid);
        $target    = cmsCore::request('target', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $template  = cmsCore::request('template', 'str', '');
        $iconurl   = cmsCore::request('iconurl', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);
        $css_class = cmsCore::request('css_class', 'str', '');

        $is_public = cmsCore::request('is_public', 'int', '');
        $is_lax    = cmsCore::request('is_lax', 'int', 0);
        if (!$is_public) {
            $access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }

        $ns = $inCore->nestedSetsInit('cms_menu');
        $myid = $ns->AddNode($parent_id);

        $sql = "UPDATE cms_menu
                        SET menu='". $menu ."',
                                title='". $title ."',
                                titles='". $titles ."',
                                css_class='". $css_class ."',
                                link='". $link ."',
                                linktype='". $linktype ."',
                                linkid='". $linkid ."',
                                target='". $target ."',
                                published='". $published ."',
                                template='". $template ."',
                                access_list='". $access_list ."',
                                is_lax='". $is_lax ."',
                                iconurl='". $iconurl ."'
                        WHERE id = '". $myid ."'";

        cmsCore::c('db')->query($sql);

        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] , 'success');
        cmsCore::redirect('?view=menu');
    }

    if ($do == 'submitmenu') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $sql = "SELECT ordering as max_o FROM cms_modules ORDER BY ordering DESC LIMIT 1";
        $result = cmsCore::c('db')->query($sql) ;
        $row = cmsCore::c('db')->fetch_assoc($result);
        $maxorder = $row['max_o'] + 1;

        $menu       = cmsCore::request('menu', 'str', '');
        $title      = cmsCore::request('title', 'str', '');
        $position   = cmsCore::request('position', 'str', '');
        $published  = cmsCore::request('published', 'int', 0);
        $css_prefix = cmsCore::request('css_prefix', 'str', '');
        $is_public  = cmsCore::request('is_public', 'int', '');
        if (!$is_public) {
            $access_list = $inCore->arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }

        $cfg['menu'] = $menu;
        $cfg_str = cmsCore::arrayToYaml($cfg);

        $sql = "INSERT INTO cms_modules (position, name, title, is_external, content, ordering, showtitle, published, user, config, css_prefix, access_list)
                VALUES ('". $position ."', '". $_LANG['AD_MENU'] ."', '". $title ."', 1, 'mod_menu', ". $maxorder .", 1, ". $published .", 0, '". $cfg_str ."', '". $css_prefix ."', '". $access_list ."')";

        cmsCore::c('db')->query($sql) ;

        $newid = cmsCore::c('db')->get_last_id('cms_modules');

        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] , 'success');

        cmsCore::redirect('?view=modules&do=edit&id='.$newid);

    }

    if ($do == 'addmenu' || $do == 'add' || $do == 'edit') {
        cmsCore::c('page')->addHeadJS('admin/js/menu.js');
        echo '<script>';
        echo cmsPage::getLangJS('AD_SPECIFY_LINK_MENU');
        echo '</script>';
    }

    if ($do == 'addmenu') {
        cmsCore::c('page')->setTitle($_LANG['AD_MENU_ADD']);
        cpAddPathway($_LANG['AD_MENU_ADD']);

        $menu_list = cpGetList('menu');

?>
<form id="addform" name="addform" action="index.php?view=menu&do=submitmenu" method="post">
    <input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
            
    <div class="panel panel-default" style="width:650px;">
        <div class="panel-body">
            <div class="form-group">
                <label><?php echo $_LANG['AD_MODULE_MENU_TITLE']; ?></label>
                <input type="text" id="title2" class="form-control" name="title" style="width:99%" value="" />
            </div>

            <div class="form-group">
                <label><?php echo $_LANG['AD_MENU_TO_VIEW']; ?></label>
                <select id="menu" class="form-control" name="menu" style="width:99%">
                    <?php foreach ($menu_list as $menu) { ?>
                        <option value="<?php echo $menu['id']; ?>">
                            <?php echo $menu['title']; ?>
                        </option>
                    <?php } ?>
                </select>
                <div class="help-block"><?php echo $_LANG['AD_TO_CREATE_NEW_POINT']; ?></div>
            </div>
                    
            <div class="form-group">
                <label><?php echo $_LANG['AD_POSITION_TO_VIEW']; ?></label>
                <?php
                    $pos = cpModulePositions(cmsConfig::getConfig('template'));
                ?>
                <select id="position" class="form-control" name="position" style="width:99%">
                    <?php
                        if ($pos){
                            foreach($pos as $key=>$position) {
                                if (cmsCore::getArrVal($mod, 'position') == $position){
                                    echo '<option value="'. $position .'" selected>'. $position .'</option>';
                                } else {
                                    echo '<option value="'. $position .'">'. $position .'</option>';
                                }
                            }
                        }
                    ?>
                </select>
                <input name="is_external" type="hidden" id="is_external" value="0" />
                <div class="help-block"><?php echo $_LANG['AD_POSITION_MUST_BE']; ?></div>
            </div>
                    
            <div class="form-group">
                <label><?php echo $_LANG['AD_MENU_PUBLIC']; ?></label>
                <label>
                    <input name="published" type="radio" value="1" checked="checked" <?php if (cmsCore::getArrVal($mod, 'published')) { echo 'checked="checked"'; } ?> /> <?php echo $_LANG['YES']; ?>
                </label>
                <label>
                    <input name="published" type="radio" value="0"  <?php if (!cmsCore::getArrVal($mod, 'published')) { echo 'checked="checked"'; } ?> /> <?php echo $_LANG['NO']; ?>
                </label>
            </div>
                    
            <div class="form-group">
                <label><?php echo $_LANG['AD_PREFIX_CSS']; ?></label>
                <input type="text" id="css_prefix" class="form-control" name="css_prefix" value="<?php echo cmsCore::getArrVal($mod, 'css_prefix'); ?>" style="width:99%" />
            </div>
                    
            <div class="form-group">
                <label><?php echo $_LANG['AD_TAB_ACCESS']; ?>:</label>
                <div class="help-block"><?php echo $_LANG['AD_GROUP_ACCESS'] ; ?></div>
                <?php
                    $groups = cmsUser::getGroups();
                    $style  = 'disabled="disabled"';
                    $public = 'checked="checked"';

                    if ($do == 'edit') {
                        if ($mod['access_list']) {
                            $public = '';
                            $style  = '';
                            $access_list = $inCore->yamlToArray($mod['access_list']);
                        }
                    }
                ?>
                <label><input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php echo $public?> /> <?php echo $_LANG['AD_SHARE']; ?></label>
                <div class="help-block"><?php echo $_LANG['AD_VIEW_IF_CHECK']; ?></div>
            </div>
                    
            <div class="form-group">
                <label><?php echo $_LANG['AD_GROUPS_VIEW']; ?></label>
                <?php
                    echo '<select class="form-control" style="width: 99%" name="allow_group[]" id="allow_group" size="6" multiple="multiple" '. $style .'>';
                    if ($groups) {
                        foreach ($groups as $group) {
                            echo '<option value="'. $group['id'] .'"';
                            if ($do == 'edit') {
                                if (in_array($group['id'], $access_list)) {
                                    echo 'selected="selected"';
                                }
                            }
                            echo '>';
                            echo $group['title'].'</option>';
                        }
                    }
                            
                    echo '</select>';
                ?>
                <div class="help-block"><?php echo $_LANG['AD_SELECT_MULTIPLE_CTRL']; ?></div>
            </div>
                    
            <div class="alert alert-info" role="alert"><?php echo $_LANG['AD_NEW_MENU_NEW_MODULE']; ?></div>
        </div>
    </div>

    <div style="margin-top:5px">
        <input class="btn btn-primary" name="save" type="submit" id="save" value="<?php echo $_LANG['AD_MENU_ADD']; ?>" />
        <input class="btn btn-default" name="back" type="button" id="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.location.href='index.php?view=menu';" />
    </div>
</form>
<?php
    }

    if ($do == 'add' || $do == 'edit') {
        $menu_list = cpGetList('menu');
        
        $langs = cmsCore::getDirsList('/languages');
        
        if ($do == 'add') {
            cpAddPathway($_LANG['AD_MENU_POINT_ADD']);
            $mod['menu'] = array('mainmenu');
        } else {
            if (isset($_REQUEST['multiple'])) {
                if (isset($_REQUEST['item'])) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }

            $ostatok = '';

            if (isset($_SESSION['editlist'])) {
                $item_id = array_shift($_SESSION['editlist']);
                if (sizeof($_SESSION['editlist']) == 0) {
                   unset($_SESSION['editlist']);
                } else {
                    $ostatok = '('.$_LANG['AD_NEXT_IN'].sizeof($_SESSION['editlist']).')';
                }
            } else {
                $item_id = cmsCore::request('id', 'int', 0);
            }

            $mod = cmsCore::c('db')->get_fields('cms_menu', "id = '$item_id'", '*');
            if (!$mod) { cmsCore::error404(); }

            $mod['menu']   = cmsCore::yamlToArray($mod['menu']);
            $mod['titles'] = cmsCore::yamlToArray($mod['titles']);

            cpAddPathway($_LANG['AD_MENU_POINT_EDIT'].$ostatok.' "'.$mod['title'].'"');

        }
?>
<form id="addform" name="addform" method="post" action="index.php">
    <input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
    <input type="hidden" name="view" value="menu" />

    <table class="table">
        <tr>
            <td valign="top">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_MENU_POINT_TITLE']; ?></label>
                            <input type="text" id="title" class="form-control" style="width:100%" name="title" value="<?php echo htmlspecialchars(cmsCore::getArrVal($mod, 'title', ''));?>" />
                            <div class="help-block"><?php echo $_LANG['AD_VIEW_IN_SITE']; ?></div>
                        </div>
                        
                        <?php if (count($langs) > 1) { ?>
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_LANG_TITLES']; ?></label>
                            <?php foreach ($langs as $lang) { ?>
                                <div>
                                    <strong><?php echo $lang; ?>:</strong>
                                    <input name="titles[<?php echo $lang; ?>]" type="text" style="width:97%" value="<?php echo htmlspecialchars(cmsCore::getArrVal($mod['titles'], $lang, '')); ?>" placeholder="<?php echo $_LANG['AD_HINT_DEFAULT']; ?>" />
                                </div>
                            <?php } ?>
                            <div class="help-block"><?php echo $_LANG['AD_LANG_TITLES_HINT']; ?></div>
                        </div>
                        <?php } ?>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_PARENT_POINT']; ?></label>
                            <?php
                                $rootid = cmsCore::c('db')->get_field('cms_menu', 'parent_id=0', 'id');
                            ?>
                            <select id="parent_id" class="form-control" style="width:100%" name="parent_id" size="10">
                                <option value="<?php echo $rootid; ?>" <?php if (cmsCore::getArrVal($mod, 'parent_id', $rootid) == $rootid) { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_MENU_ROOT']; ?></option>
                                <?php
                                    echo $inCore->getListItemsNS('cms_menu', cmsCore::getArrVal($mod, 'parent_id', 0));
                                ?>
                            </select>
                            <input type="hidden" name="oldparent" value="<?php echo cmsCore::getArrVal($mod, 'parent_id', '');?>" />
                        </div>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_MENU_POINT_ACTION']; ?></label>
                            <select id="linktype" class="form-control" style="width:100%" name="mode" onchange="showMenuTarget()">
                                <?php $link_type = cmsCore::getArrVal($mod, 'linktype', 'link') ?>
                                <option value="link" <?php if ($link_type == 'link') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_LINK']; ?></option>
                                <option value="content" <?php if ($link_type == 'content') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_ARTICLE']; ?></option>
                                <?php if($inCore->isComponentInstalled('video')){ ?> 
                                    <option value="video_cat" <?php if ($link_type == 'video_cat') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_VIDEO_PARTITION']; ?></option> 
                                <?php } ?>
                                <option value="category" <?php if ($link_type == 'category') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_PARTITION']; ?></option>
                                <option value="component" <?php if ($link_type == 'component') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_COMPONENT']; ?></option>
                                <option value="blog" <?php if ($link_type == 'blog') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_BLOG']; ?></option>
                                <option value="uccat" <?php if ($link_type == 'uccat') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_CATEGORY']; ?></option>
                                <option value="photoalbum" <?php if ($link_type == 'photoalbum') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_OPEN_ALBUM']; ?></option>
                            </select>
                        </div>
                            
                        <div id="t_link" class="form-group menu_target" style="display:<?php if ($link_type == 'link' || $link_type == 'ext') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_LINK']; ?></label>
                            <input type="text" id="link" class="form-control" style="width:100%" name="link" size="50" value="<?php if ($link_type == 'link' || $link_type == 'ext') { echo cmsCore::getArrVal($mod, 'link', ''); } ?>" />
                            <div class="help-block"><?php echo $_LANG['AD_LINK_HINT']; ?> <b>http://</b></div>
                        </div>
                            
                        <div id="t_content" class="form-group menu_target" style="display:<?php if ($link_type == 'content') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_ARTICLE'] ; ?></label>
                            <select id="content" class="form-control" style="width:100%" name="content">
                                <?php
                                    echo $inCore->getListItems('cms_content', (($link_type == 'content') ? $mod['linkid'] : 0));
                                ?>
                            </select>
                        </div>
                            
                        <?php if($inCore->isComponentInstalled('video')){ ?> 
                        <div id="t_video_cat" class="form-group menu_target" style="display:<?php if ($link_type == 'video_cat') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_PARTITION']; ?></label>
                            <select id="video_cat" class="form-control" style="width:100%" name="video_cat"> 
                                <?php
                                    echo $inCore->getListItemsNS('cms_video_category', (($link_type == 'video_cat') ? $mod['linkid'] : 0));
                                ?> 
                            </select>
                        </div>
                        <?php } ?>
                            
                        <div id="t_category" class="form-group menu_target" style="display:<?php if ($link_type == 'category') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_PARTITION']; ?></label>
                            <select id="category" class="form-control" style="width:100%" name="category"> 
                                <?php
                                    echo $inCore->getListItemsNS('cms_category', (($link_type == 'category') ? $mod['linkid'] : 0));
                                ?> 
                            </select>
                        </div>
                            
                        <div id="t_component" class="form-group menu_target" style="display:<?php if ($link_type == 'component') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_COMPONENT']; ?></label>
                            <select id="component" class="form-control" style="width:100%" name="component"> 
                                <?php
                                    echo $inCore->getListItems('cms_components', (($link_type == 'component') ? $mod['linkid'] : 0), 'title', 'asc', 'internal=0', 'link');
                                ?> 
                            </select>
                        </div>
                            
                        <div id="t_blog" class="form-group menu_target" style="display:<?php if ($link_type == 'blog') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_BLOG']; ?></label>
                            <select id="blog" class="form-control" style="width:100%" name="blog"> 
                                <?php
                                    echo $inCore->getListItems('cms_blogs', (($link_type == 'blog') ? $mod['linkid'] : 0), 'title', 'asc', "owner='user'");
                                ?> 
                            </select>
                        </div>
                            
                        <div id="t_uccat" class="form-group menu_target" style="display:<?php if ($link_type == 'uccat') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_CATEGORY']; ?></label>
                            <select id="blog" class="form-control" style="width:100%" name="blog"> 
                                <?php
                                    echo $inCore->getListItems('cms_uc_cats', (($link_type == 'uccat') ? $mod['linkid'] : 0));
                                ?> 
                            </select>
                        </div>
                            
                        <div id="t_photoalbum" class="form-group menu_target" style="display:<?php if ($link_type == 'photoalbum') { echo 'block'; } else { echo 'none'; } ?>">
                            <label><?php echo $_LANG['AD_CHECK_ALBUM']; ?></label>
                            <select id="blog" class="form-control" style="width:100%" name="blog"> 
                                <?php
                                    echo $inCore->getListItems('cms_photo_albums', (($link_type == 'photoalbum') ? $mod['linkid'] : 0), 'id', 'ASC', 'NSDiffer = ""');
                                ?> 
                            </select>
                        </div>
                    </div>
                </div>
            </td>

            <td width="400" valign="top">
                <div class="uitabs">
                    <ul id="tabs">
                        <li><a href="#upr_publish"><span><?php echo $_LANG['AD_TAB_PUBLISH']; ?></span></a></li>
                        <li><a href="#upr_access"><span><?php echo $_LANG['AD_TAB_ACCESS']; ?></span></a></li>
                        <li><a href="#upr_menu"><span><?php echo $_LANG['AD_MENU']; ?></span></a></li>
                    </ul>
                        
                    <div id="upr_publish">
                        <div class="form-group">
                            <label>
                                <input type="checkbox" name="published" value="1" <?php if (cmsCore::getArrVal($mod, 'published') || $do == 'add') { echo 'checked="checked"'; } ?> />
                                <?php echo $_LANG['AD_MENU_POINT_PUBLIC']; ?>
                            </label>
                        </div>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_OPEN_POINT']; ?></label>
                            <select id="target" class="form-control" style="width:100%" name="target">
                                <option value="_self" <?php if (@$mod['target']=='_self') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_SELF']; ?></option>
                                <option value="_parent"><?php echo $_LANG['AD_PARENT'];?></option>
                                <option value="_blank" <?php if (@$mod['target']=='_blank') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_BLANK']; ?></option>
                                <option value="_top" <?php if (@$mod['target']=='_top') { echo 'selected="selected"'; }?>><?php echo $_LANG['AD_TOP']; ?></option>
                            </select>
                        </div>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['TEMPLATE']; ?></label>
                            <select id="template" class="form-control" style="width:100%" name="template"  >
                                <option value="0" <?php if (!cmsCore::getArrVal($mod, 'template')) { echo 'selected="selected"'; } ?>><?php echo $_LANG['AD_BY_DEFAULT'];?></option>
                                <?php
                                $templates = cmsCore::getDirsList('/templates');
                                foreach ($templates as $template) {
                                    if ($template == 'admin') { continue; }
                                    echo '<option value="'. $template .'" '.(cmsCore::getArrVal($mod, 'template') ? 'selected="selected"': '').'>'.$template.'</option>';
                                }
                                ?>
                            </select>
                            <div class="help-block"><?php echo $_LANG['AD_DESIGN_CHANGE'] ;?></div>
                        </div>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_ICON_PICTURE']; ?></label>
                            <input type="text" id="iconurl" class="form-control" style="width:100%" name="iconurl" size="30" value="<?php echo cmsCore::getArrVal($mod, 'iconurl', ''); ?>" />
                                
                            <a id="iconlink" style="display:block;" href="javascript:showIcons()"><?php echo $_LANG['AD_CHECK_ICON'];?></a>
                            <div id="icondiv" style="display:none; padding:6px;border:solid 1px gray;background:#FFF">
                                <div><?php iconList(); ?></div>
                            </div>
                                
                            <div class="help-block"><?php echo $_LANG['AD_ICON_FILENAME'] ;?></div>
                        </div>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_CSS_CLASS']; ?></label>
                            <input type="text" class="form-control" style="width:100%" name="css_class" size="30" value="<?php echo cmsCore::getArrVal($mod, 'css_class', ''); ?>" />
                        </div>
                    </div>
                        
                    <div id="upr_access">
                        <div class="form-group">
                            <?php
                                $groups = cmsUser::getGroups();
                                $style  = 'disabled="disabled"';
                                $public = 'checked="checked"';

                                if ($do == 'edit') {
                                    if ($mod['access_list']) {
                                        $public = '';
                                        $style  = '';
                                        $access_list = $inCore->yamlToArray($mod['access_list']);
                                    }
                                }
                            ?>
                                
                            <label>
                                <input type="checkbox" name="is_public" id="is_public" onclick="checkAccesList()" value="1" <?php echo $public; ?> />
                                <?php echo $_LANG['AD_SHARE']; ?>
                            </label>
                            <div class="help-block"><?php echo $_LANG['AD_VIEW_IF_CHECK'];?></div>
                        </div>
                            
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_GROUPS_VIEW']; ?></label>
                            <?php
                                echo '<select id="allow_group" class="form-control" style="width: 99%" name="allow_group[]"  size="6" multiple="multiple" '.$style.'>';
                                if ($groups) {
                                    foreach($groups as $group) {
                                        echo '<option value="'. $group['id'] .'"';
                                        if ($do == 'edit' && cmsCore::getArrVal($mod, 'access_list')) {
                                            if (in_array($group['id'], $access_list)){
                                                echo 'selected="selected"';
                                            }
                                        }
                                        echo '>';
                                        echo $group['title'] .'</option>';
                                    }
                                }

                                echo '</select>';
                            ?>
                            <div class="help-block"><?php echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];?></div>
                        </div>
                            
                        <div class="form-group">
                            <label>
                                <input type="checkbox" id="is_lax" name="is_lax" value="1" <?php if(cmsCore::getArrVal($mod, 'is_lax')) {?>checked="checked"<?php } ?> />
                                <?php echo $_LANG['AD_ONLY_CHILD_ITEM']; ?>
                            </label>
                        </div>
                    </div>
                        
                    <div id="upr_menu">
                        <div class="form-group">
                            <label><?php echo $_LANG['AD_MENU_TO_VIEW'];?></label>
                            <select class="form-control" style="width: 99%" name="menu[]" size="9" multiple="multiple">
                                <?php foreach ($menu_list as $menu) { ?>
                                <option value="<?php echo $menu['id']; ?>" <?php if (in_array($menu['id'], cmsCore::getArrVal($mod, 'menu', array()))) { echo 'selected="selected"'; }?>>
                                        <?php echo $menu['title']; ?>
                                    </option>
                                <?php } ?>
                            </select>
                            <div class="help-block"><?php echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];?></div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </table>

    <div>
        <input type="button" class="btn btn-primary" name="add_mod" onclick="submitItem()" value="<?php echo $_LANG['SAVE']; ?> " />
        <input type="button" class="btn btn-default" name="back"  value="<?php echo $_LANG['CANCEL'];?>" onclick="window.location.href='index.php?view=menu';" />
        <input type="hidden" name="do" <?php if ($do=='add') { echo 'value="submit"'; } else { echo 'value="update"'; } ?> />
        <?php
            if ($do == 'edit') {
                echo '<input type="hidden" name="id" value="'.$mod['id'].'" />';
            }
        ?>
    </div>
</form>
<?php
   }
}
Example #8
0
function applet_menu()
{
    $inCore = cmsCore::getInstance();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/menu', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_MENU']);
    cpAddPathway($_LANG['AD_MENU'], 'index.php?view=menu');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    if ($do == 'list') {
        $toolmenu = array(array('icon' => 'new.gif', 'title' => $_LANG['AD_MENU_POINT_ADD'], 'link' => '?view=menu&do=add'), array('icon' => 'newmenu.gif', 'title' => $_LANG['AD_MENU_ADD'], 'link' => '?view=menu&do=addmenu'), array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=edit&multiple=1');"), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=delete&multiple=1');"), array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=show&multiple=1');"), array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=hide&multiple=1');"), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=menu'));
        cpToolMenu($toolmenu);
        $fields = array(array('title' => 'Lt', 'field' => 'NSLeft', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => array('title', 'titles'), 'width' => '', 'link' => '?view=menu&do=edit&id=%id%', 'prc' => function ($i) {
            $i['titles'] = cmsCore::yamlToArray($i['titles']);
            // переопределяем название пункта меню в зависимости от языка
            if (!empty($i['titles'][cmsConfig::getConfig('lang')])) {
                $i['title'] = $i['titles'][cmsConfig::getConfig('lang')];
            }
            return $i['title'];
        }), array('title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '80'), array('title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100'), array('title' => $_LANG['AD_LINK'], 'field' => array('linktype', 'linkid', 'link'), 'width' => '240', 'prc' => 'cpMenutypeById'), array('title' => $_LANG['AD_MENU'], 'field' => 'menu', 'width' => '80', 'filter' => '10', 'filterlist' => cpGetList('menu'), 'prc' => 'list_menu'), array('title' => $_LANG['TEMPLATE'], 'field' => 'template', 'width' => '90', 'prc' => 'cpTemplateById'));
        $actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=menu&do=edit&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MENU_POINT_CONFIRM'], 'link' => '?view=menu&do=delete&id=%id%'));
        cpListTable('cms_menu', $fields, $actions, 'parent_id>0', 'NSLeft, ordering');
    } else {
        $toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=menu'));
        cpToolMenu($toolmenu);
    }
    if ($do == 'move_up') {
        cmsCore::c('db')->moveNsCategory('cms_menu', $id, 'up');
        cmsCore::redirectBack();
    }
    if ($do == 'move_down') {
        cmsCore::c('db')->moveNsCategory('cms_menu', $id, 'down');
        cmsCore::redirectBack();
    }
    if ($do == 'show') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) {
                cmsCore::c('db')->setFlag('cms_menu', $id, 'published', '1');
            }
            cmsCore::halt('1');
        } else {
            cmsCore::c('db')->setFlags('cms_menu', $_REQUEST['item'], 'published', '1');
            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
            cmsCore::redirectBack();
        }
    }
    if ($do == 'hide') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) {
                cmsCore::c('db')->setFlag('cms_menu', $id, 'published', '0');
            }
            cmsCore::halt('1');
        } else {
            cmsCore::c('db')->setFlags('cms_menu', cmsCore::request('item', 'array_int', array()), 'published', '0');
            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
            cmsCore::redirectBack();
        }
    }
    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) {
                cmsCore::c('db')->deleteNS('cms_menu', (int) $id);
            }
        } else {
            cmsCore::c('db')->deleteListNS('cms_menu', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        cmsCore::redirectBack();
    }
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $id = cmsCore::request('id', 'int', 0);
        if (!$id) {
            cmsCore::redirectBack();
        }
        $title = cmsCore::request('title', 'str', '');
        $titles = cmsCore::arrayToYaml(cmsCore::request('titles', 'array_str', array()));
        $menu = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
        $linktype = cmsCore::request('mode', 'str', '');
        $linkid = cmsCore::request($linktype, 'str', '');
        $link = $inCore->getMenuLink($linktype, $linkid);
        $target = cmsCore::request('target', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $template = cmsCore::request('template', 'str', '');
        $iconurl = cmsCore::request('iconurl', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);
        $oldparent = cmsCore::request('oldparent', 'int', 0);
        $is_lax = cmsCore::request('is_lax', 'int', 0);
        $css_class = cmsCore::request('css_class', 'str', '');
        $is_public = cmsCore::request('is_public', 'int', '');
        if (!$is_public) {
            $access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }
        $ns = $inCore->nestedSetsInit('cms_menu');
        if ($oldparent != $parent_id) {
            $ns->MoveNode($id, $parent_id);
        }
        $sql = "UPDATE cms_menu\r\n                SET title='" . $title . "',\r\n                    titles='" . $titles . "',\r\n                    css_class='" . $css_class . "',\r\n                    menu='" . $menu . "',\r\n                    link='" . $link . "',\r\n                    linktype='" . $linktype . "',\r\n                    linkid='" . $linkid . "',\r\n                    target='" . $target . "',\r\n                    published='" . $published . "',\r\n                    template='" . $template . "',\r\n                    access_list='" . $access_list . "',\r\n                    is_lax='" . $is_lax . "',\r\n                    iconurl='" . $iconurl . "'\r\n                WHERE id = '" . $id . "'\r\n                LIMIT 1";
        cmsCore::c('db')->query($sql);
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        if (!isset($_SESSION['editlist']) || count($_SESSION['editlist']) == 0) {
            cmsCore::redirect('?view=menu');
        } else {
            cmsCore::redirect('?view=menu&do=edit');
        }
    }
    if ($do == 'submit') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $title = cmsCore::request('title', 'str', '');
        $titles = cmsCore::arrayToYaml(cmsCore::request('titles', 'array_str', array()));
        $menu = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
        $linktype = cmsCore::request('mode', 'str', '');
        $linkid = cmsCore::request($linktype, 'str', '');
        $link = $inCore->getMenuLink($linktype, $linkid);
        $target = cmsCore::request('target', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $template = cmsCore::request('template', 'str', '');
        $iconurl = cmsCore::request('iconurl', 'str', '');
        $parent_id = cmsCore::request('parent_id', 'int', 0);
        $css_class = cmsCore::request('css_class', 'str', '');
        $is_public = cmsCore::request('is_public', 'int', '');
        $is_lax = cmsCore::request('is_lax', 'int', 0);
        if (!$is_public) {
            $access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }
        $ns = $inCore->nestedSetsInit('cms_menu');
        $myid = $ns->AddNode($parent_id);
        $sql = "UPDATE cms_menu\r\n                        SET menu='" . $menu . "',\r\n                                title='" . $title . "',\r\n                                titles='" . $titles . "',\r\n                                css_class='" . $css_class . "',\r\n                                link='" . $link . "',\r\n                                linktype='" . $linktype . "',\r\n                                linkid='" . $linkid . "',\r\n                                target='" . $target . "',\r\n                                published='" . $published . "',\r\n                                template='" . $template . "',\r\n                                access_list='" . $access_list . "',\r\n                                is_lax='" . $is_lax . "',\r\n                                iconurl='" . $iconurl . "'\r\n                        WHERE id = '" . $myid . "'";
        cmsCore::c('db')->query($sql);
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        cmsCore::redirect('?view=menu');
    }
    if ($do == 'submitmenu') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $sql = "SELECT ordering as max_o FROM cms_modules ORDER BY ordering DESC LIMIT 1";
        $result = cmsCore::c('db')->query($sql);
        $row = cmsCore::c('db')->fetch_assoc($result);
        $maxorder = $row['max_o'] + 1;
        $menu = cmsCore::request('menu', 'str', '');
        $title = cmsCore::request('title', 'str', '');
        $position = cmsCore::request('position', 'str', '');
        $published = cmsCore::request('published', 'int', 0);
        $css_prefix = cmsCore::request('css_prefix', 'str', '');
        $is_public = cmsCore::request('is_public', 'int', '');
        if (!$is_public) {
            $access_list = $inCore->arrayToYaml(cmsCore::request('allow_group', 'array_int'));
        }
        $cfg['menu'] = $menu;
        $cfg_str = cmsCore::arrayToYaml($cfg);
        $sql = "INSERT INTO cms_modules (position, name, title, is_external, content, ordering, showtitle, published, user, config, css_prefix, access_list)\r\n                VALUES ('" . $position . "', '" . $_LANG['AD_MENU'] . "', '" . $title . "', 1, 'mod_menu', " . $maxorder . ", 1, " . $published . ", 0, '" . $cfg_str . "', '" . $css_prefix . "', '" . $access_list . "')";
        cmsCore::c('db')->query($sql);
        $newid = cmsCore::c('db')->get_last_id('cms_modules');
        cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
        cmsCore::redirect('?view=modules&do=edit&id=' . $newid);
    }
    if ($do == 'addmenu' || $do == 'add' || $do == 'edit') {
        cmsCore::c('page')->addHeadJS('admin/js/menu.js');
        echo '<script>';
        echo cmsPage::getLangJS('AD_SPECIFY_LINK_MENU');
        echo '</script>';
    }
    if ($do == 'addmenu') {
        cmsCore::c('page')->setTitle($_LANG['AD_MENU_ADD']);
        cpAddPathway($_LANG['AD_MENU_ADD']);
        cmsCore::c('page')->initTemlate('applets', 'menu_addmenu')->assign('menu_list', cpGetList('menu'))->assign('pos', cpModulePositions(cmsCore::c('config')->template))->assign('groups', cmsUser::getGroups())->assign('access_list', !empty($mod['access_list']) ? $inCore->yamlToArray($mod['access_list']) : array())->assign('mod', $mod)->display();
    }
    if ($do == 'add' || $do == 'edit') {
        if ($do == 'add') {
            cpAddPathway($_LANG['AD_MENU_POINT_ADD']);
            $mod['menu'] = array('mainmenu');
        } else {
            if (isset($_REQUEST['multiple'])) {
                if (isset($_REQUEST['item'])) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }
            $ostatok = '';
            if (isset($_SESSION['editlist'])) {
                $item_id = array_shift($_SESSION['editlist']);
                if (sizeof($_SESSION['editlist']) == 0) {
                    unset($_SESSION['editlist']);
                } else {
                    $ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
                }
            } else {
                $item_id = cmsCore::request('id', 'int', 0);
            }
            $mod = cmsCore::c('db')->get_fields('cms_menu', "id = '{$item_id}'", '*');
            if (!$mod) {
                cmsCore::error404();
            }
            $mod['menu'] = cmsCore::yamlToArray($mod['menu']);
            $mod['titles'] = cmsCore::yamlToArray($mod['titles']);
            cpAddPathway($_LANG['AD_MENU_POINT_EDIT'] . $ostatok . ' "' . $mod['title'] . '"');
        }
        $linktype = cmsCore::getArrVal($mod, 'linktype', 'link');
        $tpl = cmsCore::c('page')->initTemplate('applets', 'menu_add')->assign('linktype', $linktype)->assign('langs', cmsCore::getDirsList('/languages'))->assign('templates', cmsCore::getDirsList('/templates'))->assign('menu_list', cpGetList('menu'))->assign('rootid', cmsCore::c('db')->get_field('cms_menu', 'parent_id=0', 'id'))->assign('menu_opt', $inCore->getListItemsNS('cms_menu', cmsCore::getArrVal($mod, 'parent_id', 0)))->assign('content_opt', $inCore->getListItems('cms_content', $linktype == 'content' ? $mod['linkid'] : 0))->assign('category_opt', $inCore->getListItemsNS('cms_category', $link_type == 'category' ? $mod['linkid'] : 0))->assign('components_opt', $inCore->getListItems('cms_components', $link_type == 'component' ? $mod['linkid'] : 0, 'title', 'asc', 'internal=0', 'link'))->assign('blogs_opt', $inCore->getListItems('cms_blogs', $link_type == 'blog' ? $mod['linkid'] : 0, 'title', 'asc', "owner='user'"))->assign('uc_cats_opt', $inCore->getListItems('cms_uc_cats', $link_type == 'uccat' ? $mod['linkid'] : 0))->assign('photo_albums_opt', $inCore->getListItems('cms_photo_albums', $link_type == 'photoalbum' ? $mod['linkid'] : 0, 'id', 'ASC', 'NSDiffer = ""'))->assign('video_installed', $inCore->isComponentInstalled('video'))->assign('iconList', iconList())->assign('mod', $mod);
        if ($inCore->isComponentInstalled('video')) {
            $tpl->assign('video_cats_opt', $inCore->getListItemsNS('cms_video_category', $linktype == 'video_cat' ? $mod['linkid'] : 0));
        }
        $tpl->display();
    }
}