function edit_product_form($id) { global $LANG; if ($GLOBALS['me']) { if ($GLOBALS['me']->Stores > 0) { $product = \query\main::product_infos($id); if ($product->userID !== $GLOBALS['me']->ID) { return '<div class="info_form">' . $LANG['edit_prod_cant'] . '</div>'; } /* */ $product_image = $product->image; $form = '<div class="edit_product_form other_form">'; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit_product_form']) && \site\utils::check_csrf($_POST['edit_product_form']['csrf'], 'edit_coupon_csrf')) { $pd = \site\utils::validate_user_data($_POST['edit_product_form']); try { $post_info = \user\main::edit_product($id, $GLOBALS['me']->ID, $pd); $product_image = $post_info->image; $form .= '<div class="success">' . $LANG['edit_cou_success'] . '</div>'; } catch (Exception $e) { $form .= '<div class="error">' . $e->getMessage() . '</div>'; } } $csrf = $_SESSION['edit_coupon_csrf'] = \site\utils::str_random(12); $form .= '<form method="POST" action="#" enctype="multipart/form-data"> <div class="form_field"><label for="edit_product_form[store]">' . $LANG['submit_prod_addto'] . ':</label> <div><select name="edit_product_form[store]" id="edit_product_form[store]">'; foreach (stores_custom(array('user' => $GLOBALS['me']->ID, 'max' => 0)) as $v) { $form .= '<option value="' . $v->ID . '"' . (!isset($pd['store']) && $product->storeID == $v->ID || isset($pd['store']) && $pd['store'] == $v->ID ? ' selected' : '') . '>' . $v->name . '</option>'; } $form .= '</select></div> </div> <div class="form_field"><label for="edit_product_form[name]">' . $LANG['form_name'] . ':</label> <div><input type="text" name="edit_product_form[name]" id="edit_product_form[name]" value="' . (isset($pd['name']) ? $pd['name'] : $product->title) . '" placeholder="' . $LANG['submit_prod_name_ph'] . '" required /></div></div> <div class="form_field"><label for="edit_product_form[price]">' . $LANG['form_price'] . ':</label> <div><input type="text" name="edit_product_form[price]" id="edit_product_form[price]" value="' . (isset($pd['price']) ? $pd['price'] : (empty($product->price) ? '' : $product->price)) . '" placeholder="' . $LANG['submit_prod_price_ph'] . '" /></div></div> <div class="form_field"><label for="edit_product_form[old_price]">' . $LANG['form_old_price'] . ':</label> <div><input type="text" name="edit_product_form[old_price]" id="edit_product_form[old_price]" value="' . (isset($pd['old_price']) ? $pd['old_price'] : (empty($product->old_price) ? '' : $product->old_price)) . '" placeholder="' . $LANG['submit_prod_oldprice_ph'] . '" /></div></div> <div class="form_field"><label for="edit_product_form[currency]">' . $LANG['form_currency'] . ':</label> <div><input type="text" name="edit_product_form[currency]" id="edit_product_form[currency]" value="' . (isset($pd['currency']) ? $pd['currency'] : $product->currency) . '" /></div></div> <div class="form_field"><label for="edit_product_form[url]">' . $LANG['form_product_url'] . ':</label> <div><input type="text" name="edit_product_form[url]" id="edit_product_form[url]" value="' . (isset($pd['url']) ? $pd['url'] : $product->url) . '" placeholder="' . $LANG['submit_cou_url_ph'] . '" /></div></div> <div class="form_field"><label for="edit_product_form[description]">' . $LANG['form_description'] . ':</label> <div><textarea name="edit_product_form[description]" id="edit_product_form[description]" style="height:100px;">' . (isset($pd['description']) ? $pd['description'] : $product->description) . '</textarea></div></div> <div class="form_field"><label for="edit_product_form[tags]">' . $LANG['form_tags'] . ':</label> <div><input type="text" name="edit_product_form[tags]" id="edit_product_form[tags]" value="' . (isset($pd['tags']) ? $pd['tags'] : $product->tags) . '" /></div></div> <div class="form_field"><label for="edit_product_form_image">' . $LANG['form_image'] . ':</label> <div><img src="' . product_avatar($product_image) . '" alt="" style="width:90px; height:90px;" /> <input type="file" name="edit_product_form_image" id="edit_product_form_image" /> <span>Note:* max width: 800px, max height: 800px.</span></div></div> <div class="form_field"><label for="edit_product_form[start]">' . $LANG['form_start_date'] . ':</label> <div><input type="date" name="edit_product_form[start]" id="edit_product_form[start]" value="' . (isset($pd['start']) ? $pd['start'] : date('Y-m-d', strtotime($product->start_date))) . '" style="width: 79%; margin-right: 1%;" /><input type="time" name="edit_product_form[start_hour]" value="' . (isset($pd['start_hour']) ? $pd['start_hour'] : date('H:i', strtotime($product->start_date))) . '" style="width: 20%" /></div></div> <div class="form_field"><label for="edit_product_form[end]">' . $LANG['form_end_date'] . ':</label> <div><input type="date" name="edit_product_form[end]" id="edit_product_form[end]" value="' . (isset($pd['end']) ? $pd['end'] : date('Y-m-d', strtotime($product->expiration_date))) . '" style="width: 79%; margin-right: 1%;" /><input type="time" name="edit_product_form[end_hour]" value="' . (isset($pd['end_hour']) ? $pd['end_hour'] : date('H:i', strtotime($product->expiration_date))) . '" style="width: 20%" /></div></div> <input type="hidden" name="edit_product_form[csrf]" value="' . $csrf . '" /> <button>' . $LANG['edit_prod_button'] . '</button> </form> </div>'; return $form; } else { return '<div class="info_form">' . $LANG['unavailable_form2'] . '</div>'; } } else { return '<div class="info_form">' . $LANG['unavailable_form'] . '</div>'; } }
<?php if (isset($_SESSION['history'])) { echo '<div class="widget widget_history_v2' . (!$mobile_view ? ' mobile_view' : '') . '">'; if (!empty($title)) { echo '<h2>' . $title . '</h2>'; } echo '<ul class="list">'; foreach (stores_custom(array('ids' => implode(',', array_keys($_SESSION['history'])), 'max' => !empty($limit) ? $limit : 10)) as $id) { echo '<li><a href="' . $id->link . '"><img src="' . store_avatar($id->image) . '" alt="" /> <span>' . $id->name . '</span></a></li>'; } echo '</ul> </div>'; }
<?php echo '<div class="widget widget_stores' . (!$mobile_view ? ' mobile_view' : '') . '">'; if (!empty($title)) { echo '<h2>' . $title . '</h2>'; } echo '<ul class="list">'; foreach (stores_custom(array('show' => !empty($type) ? $type : '', 'orderby' => !empty($order) ? $order : '', 'max' => !empty($limit) ? $limit : 10)) as $id) { echo '<li><a href="' . $id->link . '">' . $id->name . '</a></li>'; } echo '</ul> </div>';
<div class="left"> <?php $pagination = have_stores_custom(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : '', 'orderby' => 'votes DESC')); echo '<ul class="letters">'; foreach (array_merge(range('A', 'Z'), array('0-9')) as $l) { echo '<li' . (isset($_GET['firstchar']) && $_GET['firstchar'] == $l ? ' class="active"' : '') . '><a href="' . tlink('tpage/most-rated', 'firstchar=' . $l) . '">' . $l . '</a></li>'; } echo '<li><a href="' . tlink('tpage/most-rated') . '">ALL</a></li>'; echo '</ul>'; echo '<div class="title"> Most Voted </div>'; if ($pagination['results']) { foreach (stores_custom(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : '', 'orderby' => 'votes DESC')) as $item) { echo '<article class="array_item"> <div class="table"> <div class="left"> <img src="' . store_avatar($item->image) . '" alt=""> <span class="rating"><span style="width:' . $item->stars * 16 . 'px;"></span></span> <a href="' . $item->reviews_link . '">' . $item->reviews . ' reviews</a> </div> <div class="right"> <a href="' . $item->link . '" class="title">' . $item->name . '</a> <div class="description">' . (!empty($item->description) ? nl2br($item->description) : 'no description') . '</div> <ul class="details"> <li>Coupons/Deals: <b>' . $item->coupons . '</b></li>';