예제 #1
0
<?php

/*
PUT THE OBJECT INTO A GLOBAL VARIABLE
*/
$GLOBALS['item'] = \query\main::item_infos(0, array('update_views' => ''));
$GLOBALS['exists'] = \query\main::item_exists(0, array('user_view' => ''));
/*
CHECK IF COUPON EXISTS
*/
function exists()
{
    return $GLOBALS['exists'];
}
/*
INFORMATIONS ABOUT COUPON
*/
function the_item()
{
    return $GLOBALS['item'];
}
/*
METATAGS - TITLE
*/
function meta_title()
{
    if ($GLOBALS['exists'] > 0) {
        if (!empty($GLOBALS['item']->meta_title)) {
            $repl = array('%YEAR%' => date('Y'), '%MONTH%' => date('F'));
            return str_replace(array_keys($repl), array_values($repl), $GLOBALS['item']->meta_title);
        } else {
예제 #2
0
</div>';
        break;
        /** EDIT COUPON */
    /** EDIT COUPON */
    case 'edit':
        if (!ab_to(array('coupons' => 'edit'))) {
            die;
        }
        $csrf = \site\utils::str_random(10);
        echo '<div class="title">

<h2>' . $LANG['coupons_edit_title'] . '</h2>

<div style="float: right; margin: 0 2px 0 0;">';
        if (isset($_GET['id']) && ($item_exists = \query\main::item_exists($_GET['id']))) {
            $info = \query\main::item_infos($_GET['id']);
            echo '<div class="options">
<a href="#" class="btn">' . $LANG['options'] . '</a>
<ul>';
            if ($info->cashback === 0) {
                echo '<li><a href="#" class="more_fields">' . $LANG['more'] . '</a></li>';
            }
            if (ab_to(array('stores' => 'delete'))) {
                echo '<li><a href="?route=coupons.php&amp;action=delete&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '" data-delete-msg="' . $LANG['delete_msg'] . '">' . $LANG['delete'] . '</a></li>';
            }
            if ($info->visible) {
                echo '<li><a href="?route=coupons.php&amp;action=list&amp;type=unpublish&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['unpublish'] . '</a></li>';
            } else {
                echo '<li><a href="?route=coupons.php&amp;action=list&amp;type=publish&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['publish'] . '</a></li>';
            }
예제 #3
0
<?php

// this is not a valid click. if not, redirect to your website
if (!isset($_GET['id']) && !isset($_GET['coupon']) && !isset($_GET['product'])) {
    header('Location: ' . $GLOBALS['siteURL']);
    die;
}
// check if store exists. if not, redirect to your website
if (isset($_GET['id']) && !\query\main::store_exists($_GET['id'])) {
    header('Location: ' . $GLOBALS['siteURL']);
    die;
}
// check if coupon exists. if not, redirect to your website
if (isset($_GET['coupon']) && !\query\main::item_exists($_GET['coupon'])) {
    header('Location: ' . $GLOBALS['siteURL']);
    die;
}
// check if product exists. if not, redirect to your website
if (isset($_GET['product']) && !\query\main::product_exists($_GET['product'])) {
    header('Location: ' . $GLOBALS['siteURL']);
    die;
}
include LBDIR . '/iptocountry/class.php';
$myIP = \site\utils::getIP();
$aIP = new IpToCountry();
$aIP->IP = $myIP;
$IPinfos = $aIP->infos();
//
$coupon = $product = 0;
if (isset($_GET['id'])) {
    $infos = \query\main::store_infos($_GET['id']);