Пример #1
0
        if (!empty($LANG['widgets_subtitle'])) {
            echo '<span>' . $LANG['widgets_subtitle'] . '</span>';
        }
        echo '</div>';
        if (isset($_GET['token']) && isset($_GET['id']) && check_csrf($_GET['token'], 'widgets_csrf')) {
            if (isset($_GET['add'])) {
                if ($widget_info = widgets::widget_from_id($_GET['id'])) {
                    if (actions::add_widget($zone_id, $_GET['id'], array('title' => $widget_info->name, 'file' => $widget_info->file, 'limit' => isset($widget_info->def_limit) ? $widget_info->def_limit : 10, 'text' => isset($widget_info->text) ? $widget_info->text : ''))) {
                        echo '<div class="a-success">' . $LANG['msg_added'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            } else {
                if (isset($_GET['delete'])) {
                    if (actions::delete_widget($zone_id, $_GET['id'])) {
                        echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
        }
        $token = $_SESSION['widgets_csrf'] = \site\utils::str_random(10);
        /* */
        $zone_widgets = \query\main::show_widgets($zone_id, '../');
        /* */
        echo '<div class="form-table">

<ul class="elements-list el-two">