Exemplo n.º 1
0
                                $info2 = \query\main::category_infos($connectid);
                                $connect = str_replace("|" . $_GET['id'] . "|", "|", $info2->connect);
                                actions::edit_category($connectid, array('connect' => $connect));
                            }
                        }
                        //add new connections
                        foreach ($connectids as $connectid) {
                            if (!in_array($connectid, $connectids_old)) {
                                $info2 = \query\main::category_infos($connectid);
                                if (!in_array(intval($_GET['id']), $info2->connectids)) {
                                    $connect = $info2->connect . $_GET['id'] . "|";
                                    actions::edit_category($connectid, array('connect' => $connect));
                                }
                            }
                        }
                        $info = \query\main::category_infos($_GET['id']);
                        echo '<div class="a-success">' . $LANG['msg_saved'] . '&nbsp;<input type="button" value="Back" onclick="history.go(-2);"></div>';
                    } else {
                        echo '<div class="a-error">' . $LANG['msg_error'] . '</div>';
                    }
                }
            }
            $_SESSION['categories_csrf'] = $csrf;
            $categories_while = \query\main::while_categories(array('max' => 0, 'show' => $info->is_subcat ? 'cats' : 'subcats'));
            echo '<script>
var lastnum = ' . count($info->connectids) . ';
    function addSubcategory(){
        lastnum++;
        var categorysel = $("<select name=\\"category["+lastnum+"]\\"><option value=\\"0\\" selected>' . $LANG['no_category_select'] . '</option>';
            foreach ($categories_while as $cat) {
                echo '<option value=\\"' . $cat->ID . '\\">' . $cat->name . '</option>';
Exemplo 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::category_infos();
$GLOBALS['exists'] = \query\main::category_exists();
/*
CHECK IF CATEGORY EXISTS
*/
function exists()
{
    return $GLOBALS['exists'];
}
/*
INFORMATIONS ABOUT CATEGORY
*/
function the_item()
{
    return $GLOBALS['item'];
}