예제 #1
0
function edit_store_form($id)
{
    global $LANG;
    if ($GLOBALS['me']) {
        if ($GLOBALS['me']->Stores > 0) {
            $store = \query\main::store_infos($id);
            if ($store->userID !== $GLOBALS['me']->ID) {
                return '<div class="info_form">' . $LANG['edit_store_cant'] . '</div>';
            }
            /* */
            $store_image = $store->image;
            $form = '<div class="edit_store_form other_form">';
            if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit_store_form']) && \site\utils::check_csrf($_POST['edit_store_form']['csrf'], 'edit_store_csrf')) {
                $pd = \site\utils::validate_user_data($_POST['edit_store_form']);
                try {
                    $post_info = \user\main::edit_store($id, $GLOBALS['me']->ID, $pd);
                    $store_image = $post_info->image;
                    $form .= '<div class="success">' . $LANG['edit_store_success'] . '</div>';
                } catch (Exception $e) {
                    $form .= '<div class="error">' . $e->getMessage() . '</div>';
                }
            }
            $csrf = $_SESSION['edit_store_csrf'] = \site\utils::str_random(12);
            $form .= '<form method="POST" action="#" enctype="multipart/form-data">
  <div class="form_field"><label for="edit_store_form[category]">' . $LANG['form_category'] . '</label>
  <div><select name="edit_store_form[category]" id="edit_store_form[category]">';
            foreach (\query\main::group_categories(array('max' => 0)) as $cat) {
                $wcat = '<optgroup label="' . $cat['infos']->name . '">';
                $wcat .= '<option value="' . $cat['infos']->ID . '"' . (isset($store->catID) && $store->catID == $cat['infos']->ID ? ' selected' : '') . '>' . $cat['infos']->name . '</option>';
                if (isset($cat['subcats'])) {
                    foreach ($cat['subcats'] as $subcat) {
                        $wcat .= '<option value="' . $subcat->ID . '"' . (isset($store->catID) && $store->catID == $subcat->ID ? ' selected' : '') . '>' . $subcat->name . '</option>';
                    }
                }
                $wcat .= '</optgroup>';
                $form .= $wcat;
            }
            $form .= '</select></div>
  </div>
  <div class="form_field"><label for="edit_store_form[name]">' . $LANG['form_name'] . ':</label> <div><input type="text" name="edit_store_form[name]" id="edit_store_form[name]" value="' . (isset($pd['name']) ? $pd['name'] : $store->name) . '" placeholder="' . $LANG['edit_store_name_ph'] . '" required /></div></div>
  <div class="form_field"><label for="edit_store_form[url]">' . $LANG['form_store_url'] . ':</label> <div><input type="text" name="edit_store_form[url]" id="edit_store_form[url]" value="' . (isset($pd['url']) ? $pd['url'] : $store->url) . '" placeholder="http://" required /></div></div>
  <div class="form_field"><label for="edit_store_form[description]">' . $LANG['form_description'] . ':</label> <div><textarea name="edit_store_form[description]" id="edit_store_form[description]" style="height:100px;">' . (isset($pd['description']) ? $pd['description'] : $store->description) . '</textarea></div></div>
  <div class="form_field"><label for="edit_store_form[tags]">' . $LANG['form_tags'] . ':</label> <div><input type="text" name="edit_store_form[tags]" id="edit_store_form[tags]" value="' . (isset($pd['tags']) ? $pd['tags'] : $store->tags) . '" /></div></div>
  <div class="form_field"><label for="edit_store_form_logo">' . $LANG['form_logo'] . ':</label> <div><img src="' . store_avatar($store_image) . '" alt="" style="width:100px; height:50px;" /> <input type="file" name="edit_store_form_logo" id="edit_store_form_logo" />
  <span>Note:* max width: 600px, max height: 400px.</span></div></div>
  <input type="hidden" name="edit_store_form[csrf]" value="' . $csrf . '" />
  <button>' . $LANG['edit_store_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>';
    }
}
예제 #2
0
    $pagination = have_favorites(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : ''));
    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('user/favorites', 'firstchar=' . $l) . '">' . $l . '</a></li>';
    }
    echo '<li><a href="' . tlink('user/favorites') . '">ALL</a></li>';
    echo '</ul>';
    echo '<div class="title">My Favorites <span style="float: right;">' . ($pagination['results'] ? $pagination['results'] . ' ' . (is_first($pagination['results']) ? 'store' : 'stores') . ' found' : 'No favorites yet') . '</span></div>';
    if ($pagination['results']) {
        foreach (favorites(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : '')) 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>';
            echo '</ul>

<div class="links">
<a href="' . $item->link . '" class="btn">Profile</a>
<a href="#" class="more_details">More details</a>
예제 #3
0
<?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>';
}
예제 #4
0
파일: wall.php 프로젝트: hzhou9/coupon_deal
<ul class="category">
<li class="active">Coupons</li>';
        if (theme_has_products()) {
            echo '<li><a href="' . get_update(array('type' => 'products', 'page' => 1)) . '">Products</a></li>';
        }
        echo '</ul>

</div>';
        if ($pagination['results']) {
            foreach (wall(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : '')) as $item) {
                echo '<article class="array_item">

<div class="table">

<div class="left">
<img src="' . store_avatar($item->store_img) . '" alt="">
<span class="rating"><span style="width:' . $item->stars * 16 . 'px;"></span></span>
<a href="' . $item->store_reviews_link . '">' . $item->reviews . ' reviews</a>';
                echo !empty($item->cashback) ? '<span class="cashback-points" data-ttip="Great! Use it and you\'ll receive ' . $item->cashback . ' points.">' . $item->cashback . '</span> ' : '';
                echo '</div>

<div class="right">
<a href="' . $item->link . '" class="title">' . $item->title . '</a>
More coupons for <a href="' . $item->store_link . '">' . $item->store_name . '</a>
<div class="description">' . (!empty($item->description) ? nl2br($item->description) : 'no description') . '</div>

<ul class="details">
<li>Coupon Added: <b>' . timeago(strtotime($item->date), 'seconds') . ' ago</b></li>';
                if ($item->is_expired) {
                    echo '<li>Expired on: <span class="expired">' . date('m/d/y', strtotime($item->expiration_date)) . '</span></li>';
                } else {
예제 #5
0
<?php

echo '<div class="widget widget_coupons_v2' . (!$mobile_view ? ' mobile_view' : '') . '">';
if (!empty($title)) {
    echo '<h2>' . $title . '</h2>';
}
echo '<ul class="list">';
foreach (items_custom(array('show' => !empty($type) ? $type : '', 'orderby' => !empty($order) ? $order : '', 'max' => !empty($limit) ? $limit : 10)) as $id) {
    echo '<li><a href="' . $id->link . '"><img src="' . store_avatar($id->store_img) . '" alt="" />  <span>' . $id->title . '</span></a></li>';
}
echo '</ul>
</div>';