Example #1
0
} elseif (isset($_POST['price'])) {
    $GLOBALS['main']->setACPWarning($lang['common']['error_no_change']);
}
$GLOBALS['main']->addTabControl($lang['catalogue']['title_product_list'], null, currentPage(array('node')));
$GLOBALS['main']->addTabControl($lang['catalogue']['product_add'], null, currentPage(array('node'), array('action' => 'add')));
$GLOBALS['main']->addTabControl($lang['catalogue']['title_category_assign_to'], 'assign');
$GLOBALS['main']->addTabControl($lang['catalogue']['title_option_set_assign'], null, currentPage(null, array('node' => 'optionsets')));
$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['title_category_assigned'], currentPage());
## Product list
if (($products = $GLOBALS['db']->select('CubeCart_inventory', array('product_id', 'name', 'product_code'), false, array('name' => 'ASC'))) !== false) {
    $GLOBALS['smarty']->assign('PRODUCTS', $products);
}
## Category list
if (($category_array = $GLOBALS['db']->select('CubeCart_category', array('cat_name', 'cat_parent_id', 'cat_id'))) !== false) {
    $cat_list[] = '/';
    $seo = SEO::getInstance();
    foreach ($category_array as $category) {
        if ($category['cat_id'] == $category['cat_parent_id']) {
            continue;
        }
        $cat_list[$category['cat_id']] = '/' . $seo->getDirectory($category['cat_id'], false, '/', false, false);
    }
    natcasesort($cat_list);
    foreach ($cat_list as $cat_id => $cat_name) {
        if (empty($cat_name)) {
            continue;
        }
        $data = array('id' => $cat_id, 'name' => $cat_name, 'selected' => isset($cats_selected) && in_array($cat_id, $cats_selected) ? ' checked="checked"' : '');
        $smarty_data['categories'][] = $data;
    }
    $GLOBALS['smarty']->assign('CATEGORIES', $smarty_data['categories']);
Example #2
0
/**
 * Get the current page url
 *
 * @param array $excluded
 * @param array $included
 * @param bool $remove_excluded
 * @return string
 */
function currentPage($excluded = null, $included = null, $remove_excluded = true)
{
    static $base = null;
    if (is_null($base)) {
        $php_self = htmlentities($_SERVER['PHP_SELF']);
        // fixes XSS
        if (isset($GLOBALS['storeURL'], $GLOBALS['rootRel'])) {
            $base = $GLOBALS['storeURL'] . str_replace($GLOBALS['rootRel'], '/', $php_self);
        } else {
            $base = null;
        }
    }
    $currentPage = $base;
    // If there are GET variables, strip redir and rebuild query string
    if (!empty($_GET)) {
        $array = is_array($included) && !empty($included) ? array_merge($_GET, $included) : $_GET;
        $one_time = array('added', 'completed', 'deleted', 'edited', 'failed', 'removed', 'subscribed', 'submitted', 'unsubscribed', 'updated', session_name());
        if ($excluded === true) {
            // Drop *all* $_GET vars, except $protected
            $protected = array('_a');
            $excluded = array();
            foreach ($array as $key => $val) {
                if (!in_array($key, $protected)) {
                    $excluded[] = $key;
                }
            }
        } else {
            $excluded = is_array($excluded) && !empty($excluded) ? $excluded : array();
        }
        // Delete unwanted keys
        if (!empty($array)) {
            foreach ($excluded as $key) {
                if (isset($array[$key])) {
                    unset($array[$key]);
                    if (!CC_IN_ADMIN && $remove_excluded) {
                        unset($_GET[$key]);
                        // fix for other areas that want exclusion
                    }
                }
            }
            array_walk_recursive($array, 'custom_urlencode', $one_time);
            if (isset($array) && is_array($array)) {
                $currentPage .= '?' . http_build_query($array, '', '&');
            }
        }
    }
    if (!isset($GLOBALS['seo']) || !is_object($GLOBALS['seo'])) {
        return $currentPage;
    }
    // $_GET['seo_path'] should never be set... but if it is this will fix it
    if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) {
        $currentPage = SEO::getInstance()->getItem($_GET['seo_path'], true);
    }
    return SEO::getInstance()->SEOable($currentPage);
}
Example #3
0
//Initialize sessions
$GLOBALS['session'] = Session::getInstance();
//Initialize Smarty
$GLOBALS['smarty'] = new Smarty();
$GLOBALS['smarty']->muteExpectedErrors();
$GLOBALS['smarty']->error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING;
$GLOBALS['smarty']->compile_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->config_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->cache_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->debugging = false;
//Initialize language
$GLOBALS['language'] = Language::getInstance();
//Initialize hooks
$GLOBALS['hooks'] = HookLoader::getInstance();
//Initialize SEO
$GLOBALS['seo'] = SEO::getInstance();
if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) {
    $_GET['seo_path'] = preg_replace('/(\\/\\~[a-z0-9]{1,}\\/)/', '', $_GET['seo_path']);
    // Remove /~username/ from seo_path
    $GLOBALS['seo']->getItem($_GET['seo_path']);
}
//Initialize SSL
$GLOBALS['ssl'] = SSL::getInstance();
//Initialize GUI
$GLOBALS['gui'] = GUI::getInstance();
//Initialize Taxes
$GLOBALS['tax'] = Tax::getInstance();
//Initialize catalogue
$GLOBALS['catalogue'] = Catalogue::getInstance();
//Initialize cubecart
$GLOBALS['cubecart'] = Cubecart::getInstance();
Example #4
0
/**
 * Get the current page url
 *
 * @param array $excluded
 * @param array $included
 * @param bool $remove_excluded
 * @return string
 */
function currentPage($excluded = null, $included = null, $remove_excluded = true)
{
    $url_path = '';
    $params = array();
    $one_time = array('added', 'completed', 'deleted', 'edited', 'failed', 'removed', 'subscribed', 'submitted', 'unsubscribed', 'updated', session_name());
    if (isset($GLOBALS['storeURL'], $GLOBALS['rootRel'])) {
        $url_path = $GLOBALS['storeURL'] . str_replace($GLOBALS['rootRel'], '/', htmlentities($_SERVER['PHP_SELF']));
    } else {
        $url_path = '';
    }
    if (is_array($_GET) && count($_GET) > 0) {
        $params = array_merge($params, $_GET);
    }
    if (is_array($included) && count($included) > 0) {
        $params = array_merge($params, $included);
    }
    if ($excluded === true) {
        // Drop *all* $_GET vars, except $protected
        $protected = array('_a');
        $excluded = array();
        if (count($params) > 0) {
            foreach ($params as $key => $val) {
                if (!in_array($key, $protected)) {
                    $excluded[] = $key;
                }
            }
        }
    } else {
        $excluded = is_array($excluded) && !empty($excluded) ? $excluded : array();
    }
    // Delete unwanted keys
    if (count($params) > 0) {
        if (count($excluded) > 0) {
            foreach ($excluded as $key) {
                if (isset($params[$key])) {
                    unset($params[$key]);
                    if (!CC_IN_ADMIN && $remove_excluded) {
                        unset($_GET[$key]);
                        // fix for other areas that want exclusion
                    }
                }
            }
        }
        array_walk_recursive($params, 'custom_urlencode', $one_time);
        if (isset($params) && is_array($params)) {
            $url_path .= '?' . http_build_query($params, '', '&');
        }
    }
    if (!isset($GLOBALS['seo']) || !is_object($GLOBALS['seo'])) {
        return $url_path;
    }
    // $_GET['seo_path'] should never be set... but if it is this will fix it
    if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) {
        $url_path = SEO::getInstance()->getItem($_GET['seo_path'], true);
    }
    return SEO::getInstance()->SEOable($url_path);
}