Ejemplo n.º 1
0
</div>';
        break;
        /** EDIT STORE */
    /** EDIT STORE */
    case 'edit':
        if (!ab_to(array('stores' => 'edit'))) {
            die;
        }
        $csrf = \site\utils::str_random(10);
        echo '<div class="title">

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

<div style="float:right; margin: 0 2px 0 0;">';
        if (isset($_GET['id']) && ($store_exists = \query\main::store_exists($_GET['id']))) {
            $info = \query\main::store_infos($_GET['id']);
            echo '<div class="options">
<a href="#" class="btn">' . $LANG['options'] . '</a>
<ul>';
            if (ab_to(array('coupons' => 'add'))) {
                echo '<li><a href="?route=coupons.php&amp;action=add&amp;store=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['coupons_add_button'] . '</a></li>';
            }
            if (ab_to(array('stores' => 'delete'))) {
                echo '<li><a href="?route=stores.php&amp;action=delete&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '" data-delete-msg="' . $LANG['delete_store'] . '">' . $LANG['delete'] . '</a></li>';
            }
            if ($info->visible) {
                echo '<li><a href="?route=stores.php&amp;action=list&amp;type=unpublish&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['unpublish'] . '</a></li>';
            } else {
                echo '<li><a href="?route=stores.php&amp;action=list&amp;type=publish&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '">' . $LANG['publish'] . '</a></li>';
            }
Ejemplo n.º 2
0
/*
SHOWING COUPONS OR PRODUCTS
*/
function searched_type()
{
    if (isset($_GET['type']) && strtolower($_GET['type']) === 'products') {
        return 'products';
    }
    return 'coupons';
}
/*
PUT THE OBJECT INTO A GLOBAL VARIABLE
*/
$GLOBALS['searched_type'] = searched_type();
$GLOBALS['item'] = \query\main::store_infos(0, array('update_views' => ''));
$GLOBALS['exists'] = \query\main::store_exists(0, array('user_view' => ''));
/*
CHECK IF STORE EXISTS
*/
function exists()
{
    return $GLOBALS['exists'];
}
/*
INFORMATIONS ABOUT STORE
*/
function the_item()
{
    return $GLOBALS['item'];
}
/*
Ejemplo n.º 3
0
<?php

/*
PUT THE OBJECT INTO A GLOBAL VARIABLE
*/
$GLOBALS['item'] = \query\main::store_infos();
$GLOBALS['exists'] = \query\main::store_exists();
/*
CHECK IF STORE EXISTS
*/
function exists()
{
    return $GLOBALS['exists'];
}
/*
INFORMATIONS ABOUT STORE
*/
function the_item()
{
    return $GLOBALS['item'];
}
/*
CHECK IF HAVE ITEMS
*/
function have_items($category = array())
{
    $GLOBALS['have_items'] = \query\main::have_reviews($category, 'store');
    /*
    ACTIVATE PAGES INFORMATIONS IF FUNCTION have_items() IS CALLED
    */
    /*
Ejemplo n.º 4
0
 public static function delete_store_image($id)
 {
     global $db;
     if (!ab_to(array('stores' => 'edit'))) {
         return false;
     }
     $id = (array) $id;
     $stmt = $db->stmt_init();
     foreach ($id as $ID) {
         if (\query\main::store_exists($ID)) {
             $store = \query\main::store_infos($ID);
             $stmt->prepare("UPDATE " . DB_TABLE_PREFIX . "stores SET image = '' WHERE id = ?");
             $stmt->bind_param("i", $ID);
             $stmt->execute();
             if (!empty($store->image)) {
                 @unlink(DIR . '/' . $store->image);
             }
         }
     }
     @$stmt->close();
     return true;
 }