Пример #1
0
/**
 * Smarty {external} function plugin
 *
 */
function smarty_function_external($params, &$smarty)
{
    if (!isset($params['key'])) {
        throw new InvalidArgumentException("Nebol zadany 'key' pre nalodovanie kniznice");
    }
    if (!isset($params['type'])) {
        throw new InvalidArgumentException("Nebol zadany 'type' pre nalodovanie kniznice");
    }
    if (!in_array($params['type'], array('js', 'css'))) {
        throw new InvalidArgumentException("Nebol zadany spravny 'type' (js | css) pre nalodovanie kniznice");
    }
    if (!isset($params['key'])) {
        return '';
    }
    if ($params['type'] == 'js') {
        External::addJS($params['key']);
    } else {
        External::addCSS($params['key']);
    }
    return '';
}
Пример #2
0
if (isset($_GET['group_id']) && isset($_GET['customer_id']) && Admin::getInstance()->permissions('customers', CC_PERM_DELETE)) {
    $group_id = (int) $_GET['group_id'];
    $customer_id = (int) $_GET['customer_id'];
    foreach ($GLOBALS['hooks']->load('admin.customer.group.delete') as $hook) {
        include $hook;
    }
    $GLOBALS['db']->delete('CubeCart_customer_membership', array('group_id' => $group_id, 'customer_id' => $customer_id));
    httpredir(currentPage(array('group_id')));
}
// If we are wanting an external report start new External class
if (isset($_POST['external_report']) && is_array($_POST['external_report'])) {
    $module_name = array_keys($_POST['external_report']);
    $external_class_path = 'modules/external/' . $module_name[0] . '/external.class.php';
    if (file_exists($external_class_path)) {
        include $external_class_path;
        $external_report = new External($GLOBALS['config']->get($module_name[0]));
    }
    if (($customers_export = $GLOBALS['db']->select('CubeCart_customer', array('title', 'first_name', 'last_name', 'phone', 'mobile', 'customer_id', 'email'))) !== false) {
        // Get States Array
        $zones = $GLOBALS['db']->select('CubeCart_geo_zone', array('id', 'name'));
        if ($zones) {
            foreach ($zones as $zone) {
                $zone_name[$zone['id']] = $zone['name'];
            }
        }
        foreach ($customers_export as $customer) {
            // Find default address
            $address = $GLOBALS['db']->select('CubeCart_addressbook', array('company_name', 'line1', 'line2', 'town', 'state', 'postcode', 'country'), array('customer_id' => $customer['customer_id'], 'billing' => 1));
            // Get state name if it is numeric
            $address[0]['state'] = is_numeric($address[0]['state']) ? $zone_name[$address[0]['state']] : $address[0]['state'];
            $data = array_merge($address[0], $customer);
Пример #3
0
External::$props = array('div' => function (&$now, &$ext) {
    return $ext;
}, 'layers' => function (&$now, &$ext) {
    if (!$now) {
        $now = array();
    } elseif (Each::isAssoc($now) !== false) {
        $now = array($now);
    }
    Each::fora($ext, function ($j) use(&$now) {
        //array_unshift($now,array('external'=>&$ext));
        array_push($now, array('external' => &$j));
    });
    return $now;
}, 'external' => function (&$now, &$ext) {
    //Используется в global.js, css
    if (!$now) {
        $now = array();
    } elseif (Each::isAssoc($now) !== false) {
        $now = array(&$now);
    }
    array_push($now, $ext);
    return $now;
}, 'config' => function (&$now, &$ext, &$layer) {
    //object|string any
    if (Each::isAssoc($ext) === true) {
        if (!$now) {
            $now = array();
        }
        foreach ($ext as $j => $v) {
            if (!is_null(@$now[$j])) {
                continue;
            }
            $now[$j] =& $ext[$j];
        }
    } else {
        if (is_null($now)) {
            $now =& $ext;
        }
    }
    return $now;
});