Esempio n. 1
0
<div class="options">
<a href="#" class="btn">' . $LANG['options'] . '</a>
<ul>
<li><a href="#" class="more_fields">' . $LANG['more'] . '</a></li>
</ul>
</div>

<a href="?route=products.php&amp;action=list" class="btn">' . $LANG['products_view'] . '</a>
</div>';
        if (!empty($LANG['products_add_subtitle'])) {
            echo '<span>' . $LANG['products_add_subtitle'] . '</span>';
        }
        echo '</div>';
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'products_csrf')) {
            if (isset($_POST['store']) && isset($_POST['category']) && isset($_POST['name']) && isset($_POST['price']) && isset($_POST['old_price']) && isset($_POST['currency']) && isset($_POST['description']) && isset($_POST['tags']) && isset($_POST['reward_points']) && isset($_POST['start']) && isset($_POST['end']) && isset($_POST['meta_title']) && isset($_POST['meta_desc'])) {
                if (actions::add_product(array('image_url' => $_POST['image_url'], 'store' => $_POST['store'], 'category' => $_POST['category'], 'popular' => isset($_POST['popular']) ? 1 : 0, 'name' => $_POST['name'], 'price' => $_POST['price'], 'old_price' => $_POST['old_price'], 'currency' => strtoupper($_POST['currency']), 'link' => !isset($_POST['product_ownlink']) && isset($_POST['link']) && filter_var($_POST['link'], FILTER_VALIDATE_URL) ? $_POST['link'] : '', 'description' => $_POST['description'], 'tags' => $_POST['tags'], 'cashback' => $_POST['reward_points'], 'start' => $_POST['start']['date'] . ', ' . $_POST['start']['hour'], 'end' => $_POST['end']['date'] . ', ' . $_POST['end']['hour'], 'publish' => isset($_POST['publish']) ? 1 : 0, 'meta_title' => $_POST['meta_title'], 'meta_desc' => $_POST['meta_desc']))) {
                    echo '<div class="a-success">' . $LANG['msg_added'] . '</div>';
                } else {
                    echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                }
            }
        }
        $csrf = $_SESSION['products_csrf'] = \site\utils::str_random(10);
        echo '<div class="form-table">

<form action="#" method="POST" enctype="multipart/form-data" autocomplete="off">

<div class="row"><span>' . $LANG['form_store_id'] . ':</span><div data-search="store"><input type="text" name="store" value="' . (isset($_POST['store']) ? (int) $_POST['store'] : (!empty($_GET['store']) ? (int) $_GET['store'] : '')) . '" required /><a href="#">S</a></div></div>

<div class="row"><span>' . $LANG['form_category'] . ':</span>
<div><select name="category">