Example #1
0
                }
            }
        } else {
            if (isset($_GET['action']) && isset($_GET['token']) && check_csrf($_GET['token'], 'products_csrf')) {
                if ($_GET['action'] == 'delete') {
                    if (isset($_GET['id'])) {
                        if (actions::delete_product($_GET['id'])) {
                            echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>';
                        } else {
                            echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                        }
                    }
                } else {
                    if ($_GET['type'] == 'publish' || $_GET['type'] == 'unpublish') {
                        if (isset($_GET['id'])) {
                            if (actions::action_product($_GET['type'], $_GET['id'])) {
                                echo '<div class="a-success">' . $LANG['msg_saved'] . '</div>';
                            } else {
                                echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                            }
                        }
                    }
                }
            }
        }
        $csrf = $_SESSION['products_csrf'] = \site\utils::str_random(10);
        echo '<div class="page-toolbar">

<form action="#" method="GET" autocomplete="off">
<input type="hidden" name="route" value="products.php" />
<input type="hidden" name="action" value="list" />