Example #1
0
 function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         $pass = false;
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $order->info['shipping_method'] = OSCOM::getDef('free_shipping_title');
             $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
         }
     }
     if (strpos($_SESSION['shipping']['id'], '\\') !== false) {
         list($vendor, $app, $module) = explode('\\', $_SESSION['shipping']['id']);
         list($module, $method) = explode('_', $module);
         $module = $vendor . '\\' . $app . '\\' . $module;
         $code = 'Shipping_' . str_replace('\\', '_', $module);
         if (Registry::exists($code)) {
             $OSCOM_SM = Registry::get($code);
         }
     } else {
         list($module, $method) = explode('_', $_SESSION['shipping']['id']);
         if (is_object($GLOBALS[$module])) {
             $OSCOM_SM = $GLOBALS[$module];
         }
     }
     if (tep_not_null($order->info['shipping_method'])) {
         if ($OSCOM_SM->tax_class > 0) {
             $shipping_tax = tep_get_tax_rate($OSCOM_SM->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $shipping_tax_description = tep_get_tax_description($OSCOM_SM->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['tax_groups']["{$shipping_tax_description}"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             if (DISPLAY_PRICE_WITH_TAX == 'true') {
                 $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             }
         }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']);
     }
 }
Example #2
0
 public static function getModuleClass($module, $type)
 {
     if (!Registry::exists('ModuleType' . $type)) {
         $class = 'OSC\\OM\\Modules\\' . $type;
         if (!class_exists($class)) {
             trigger_error('OSC\\OM\\Apps::getModuleClass(): ' . $type . ' module class not found in OSC\\OM\\Modules\\');
             return $result;
         }
         Registry::set('ModuleType' . $type, new $class());
     }
     $OSCOM_Type = Registry::get('ModuleType' . $type);
     return $OSCOM_Type->getClass($module);
 }
Example #3
0
 function update_status()
 {
     if (is_array($this->modules)) {
         if (strpos($this->selected_module, '\\') !== false) {
             $code = 'Payment_' . str_replace('\\', '_', $this->selected_module);
             if (Registry::exists($code)) {
                 $OSCOM_PM = Registry::get($code);
                 if (method_exists($OSCOM_PM, 'update_status')) {
                     $OSCOM_PM->update_status();
                 }
             }
         } else {
             if (is_object($GLOBALS[$this->selected_module])) {
                 if (method_exists($GLOBALS[$this->selected_module], 'update_status')) {
                     $GLOBALS[$this->selected_module]->update_status();
                 }
             }
         }
     }
 }
Example #4
0
 public function call($group, $hook, $action = 'execute', $flatten = false)
 {
     if (!isset($this->hooks[$this->site][$group][$hook][$action])) {
         $this->register($group, $hook, $action);
     }
     $result = [];
     foreach ($this->hooks[$this->site][$group][$hook][$action] as $code) {
         $class = Apps::getModuleClass($code, 'Hooks');
         $regclass = 'Hook_' . str_replace(['/', '\\'], '_', $code);
         if (!Registry::exists($regclass)) {
             Registry::set($regclass, new $class());
         }
         $bait = Registry::get($regclass)->{$action}();
         if (!empty($bait)) {
             $result[] = $bait;
         }
     }
     if ($flatten === true) {
         $result = implode('', $result);
     }
     return $result;
 }
Example #5
0
 function cart()
 {
     global $currencies;
     $OSCOM_Db = Registry::get('Db');
     $this->content_type = $_SESSION['cart']->get_content_type();
     if ($this->content_type != 'virtual' && $_SESSION['sendto'] == false) {
         $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
     }
     $customer_address = ['customers_firstname' => null, 'customers_lastname' => null, 'customers_telephone' => null, 'customers_email_address' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null];
     if (isset($_SESSION['customer_id'])) {
         $Qcustomer = $OSCOM_Db->prepare('select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from :table_customers c, :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries co on (ab.entry_country_id = co.countries_id) where c.customers_id = :customers_id and c.customers_id = ab.customers_id and c.customers_default_address_id = ab.address_book_id');
         $Qcustomer->bindInt(':customers_id', $_SESSION['customer_id']);
         $Qcustomer->execute();
         $customer_address = $Qcustomer->toArray();
     }
     $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     if (isset($_SESSION['sendto'])) {
         if (is_array($_SESSION['sendto']) && !empty($_SESSION['sendto'])) {
             $shipping_address = array('entry_firstname' => $_SESSION['sendto']['firstname'], 'entry_lastname' => $_SESSION['sendto']['lastname'], 'entry_company' => $_SESSION['sendto']['company'], 'entry_street_address' => $_SESSION['sendto']['street_address'], 'entry_suburb' => $_SESSION['sendto']['suburb'], 'entry_postcode' => $_SESSION['sendto']['postcode'], 'entry_city' => $_SESSION['sendto']['city'], 'entry_zone_id' => $_SESSION['sendto']['zone_id'], 'zone_name' => $_SESSION['sendto']['zone_name'], 'entry_country_id' => $_SESSION['sendto']['country_id'], 'countries_id' => $_SESSION['sendto']['country_id'], 'countries_name' => $_SESSION['sendto']['country_name'], 'countries_iso_code_2' => $_SESSION['sendto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['sendto']['country_iso_code_3'], 'address_format_id' => $_SESSION['sendto']['address_format_id'], 'entry_state' => $_SESSION['sendto']['zone_name']);
         } elseif (is_numeric($_SESSION['sendto'])) {
             $Qaddress = $OSCOM_Db->prepare('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
             $Qaddress->bindInt(':customers_id', $_SESSION['customer_id']);
             $Qaddress->bindInt(':address_book_id', $_SESSION['sendto']);
             $Qaddress->execute();
             $shipping_address = $Qaddress->toArray();
         }
     }
     $billing_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     if (isset($_SESSION['billto'])) {
         if (is_array($_SESSION['billto']) && !empty($_SESSION['billto'])) {
             $billing_address = array('entry_firstname' => $_SESSION['billto']['firstname'], 'entry_lastname' => $_SESSION['billto']['lastname'], 'entry_company' => $_SESSION['billto']['company'], 'entry_street_address' => $_SESSION['billto']['street_address'], 'entry_suburb' => $_SESSION['billto']['suburb'], 'entry_postcode' => $_SESSION['billto']['postcode'], 'entry_city' => $_SESSION['billto']['city'], 'entry_zone_id' => $_SESSION['billto']['zone_id'], 'zone_name' => $_SESSION['billto']['zone_name'], 'entry_country_id' => $_SESSION['billto']['country_id'], 'countries_id' => $_SESSION['billto']['country_id'], 'countries_name' => $_SESSION['billto']['country_name'], 'countries_iso_code_2' => $_SESSION['billto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['billto']['country_iso_code_3'], 'address_format_id' => $_SESSION['billto']['address_format_id'], 'entry_state' => $_SESSION['billto']['zone_name']);
         } elseif (is_numeric($_SESSION['billto'])) {
             $Qaddress = $OSCOM_Db->prepare('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
             $Qaddress->bindInt(':customers_id', $_SESSION['customer_id']);
             $Qaddress->bindInt(':address_book_id', $_SESSION['billto']);
             $Qaddress->execute();
             $billing_address = $Qaddress->toArray();
         }
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $_SESSION['currency'], 'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'], 'payment_method' => isset($_SESSION['payment']) ? $_SESSION['payment'] : '', 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => isset($_SESSION['shipping']) ? $_SESSION['shipping']['title'] : '', 'shipping_cost' => isset($_SESSION['shipping']) ? $_SESSION['shipping']['cost'] : 0, 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => isset($_SESSION['comments']) && !empty($_SESSION['comments']) ? $_SESSION['comments'] : '');
     if (isset($_SESSION['payment'])) {
         if (strpos($_SESSION['payment'], '\\') !== false) {
             $code = 'Payment_' . str_replace('\\', '_', $_SESSION['payment']);
             if (Registry::exists($code)) {
                 $OSCOM_PM = Registry::get($code);
             }
         } elseif (is_object($GLOBALS[$_SESSION['payment']])) {
             $OSCOM_PM = $GLOBALS[$_SESSION['payment']];
         }
         if (isset($OSCOM_PM)) {
             if (isset($OSCOM_PM->public_title)) {
                 $this->info['payment_method'] = $OSCOM_PM->public_title;
             } else {
                 $this->info['payment_method'] = $OSCOM_PM->title;
             }
             if (isset($OSCOM_PM->order_status) && is_numeric($OSCOM_PM->order_status) && $OSCOM_PM->order_status > 0) {
                 $this->info['order_status'] = $OSCOM_PM->order_status;
             }
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => tep_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => tep_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => tep_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             foreach ($products[$i]['attributes'] as $option => $value) {
                 $Qattributes = $OSCOM_Db->prepare('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :language_id and popt.language_id = poval.language_id');
                 $Qattributes->bindInt(':products_id', $products[$i]['id']);
                 $Qattributes->bindInt(':options_id', $option);
                 $Qattributes->bindInt(':options_values_id', $value);
                 $Qattributes->bindInt(':language_id', $_SESSION['languages_id']);
                 $Qattributes->execute();
                 $this->products[$index]['attributes'][$subindex] = array('option' => $Qattributes->value('products_options_name'), 'value' => $Qattributes->value('products_options_values_name'), 'option_id' => $option, 'value_id' => $value, 'prefix' => $Qattributes->value('price_prefix'), 'price' => $Qattributes->value('options_values_price'));
                 $subindex++;
             }
         }
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
Example #6
0
 public static function link($page, $parameters = null, $add_session_id = true, $search_engine_safe = true)
 {
     $page = HTML::sanitize($page);
     $site = $req_site = static::$site;
     if (strpos($page, '/') !== false && preg_match('/^([A-Z][A-Za-z0-9-_]*)\\/(.*)$/', $page, $matches) === 1 && OSCOM::siteExists($matches[1], false)) {
         $req_site = $matches[1];
         $page = $matches[2];
     }
     if (!is_bool($add_session_id)) {
         $add_session_id = true;
     }
     if (!is_bool($search_engine_safe)) {
         $search_engine_safe = true;
     }
     if ($add_session_id === true && $site !== $req_site) {
         $add_session_id = false;
     }
     $link = static::getConfig('http_server', $req_site) . static::getConfig('http_path', $req_site) . $page;
     if (!empty($parameters)) {
         $p = HTML::sanitize($parameters);
         $p = str_replace(["\\", '{', '}'], ['%5C', '%7B', '%7D'], $p);
         $link .= '?' . $p;
         $separator = '&';
     } else {
         $separator = '?';
     }
     while (substr($link, -1) == '&' || substr($link, -1) == '?') {
         $link = substr($link, 0, -1);
     }
     // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
     if ($add_session_id == true && Registry::exists('Session')) {
         $OSCOM_Session = Registry::get('Session');
         if ($OSCOM_Session->hasStarted() && $OSCOM_Session->isForceCookies() === false) {
             if (strlen(SID) > 0 || (HTTP::getRequestType() == 'NONSSL' && parse_url(static::getConfig('http_server', $req_site), PHP_URL_SCHEME) == 'https' || HTTP::getRequestType() == 'SSL' && parse_url(static::getConfig('http_server', $req_site), PHP_URL_SCHEME) == 'http')) {
                 $link .= $separator . HTML::sanitize(session_name() . '=' . session_id());
             }
         }
     }
     while (strpos($link, '&&') !== false) {
         $link = str_replace('&&', '&', $link);
     }
     if ($search_engine_safe == true && defined('SEARCH_ENGINE_FRIENDLY_URLS') && SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
         $link = str_replace(['?', '&', '='], '/', $link);
     }
     return $link;
 }
}
if (isset($_POST['payment'])) {
    $_SESSION['payment'] = $_POST['payment'];
}
if (isset($_POST['comments']) && tep_not_null($_POST['comments'])) {
    $_SESSION['comments'] = HTML::sanitize($_POST['comments']);
}
// load the selected payment module
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($_SESSION['payment']);
require DIR_WS_CLASSES . 'order.php';
$order = new order();
$payment_modules->update_status();
if (strpos($payment_modules->selected_module, '\\') !== false) {
    $code = 'Payment_' . str_replace('\\', '_', $payment_modules->selected_module);
    if (Registry::exists($code)) {
        $OSCOM_PM = Registry::get($code);
    }
} elseif (isset(${$_SESSION}['payment']) && is_object(${$_SESSION}['payment'])) {
    $OSCOM_PM = ${$_SESSION}['payment'];
}
if (!isset($OSCOM_PM) || $payment_modules->selected_module != $_SESSION['payment'] || $OSCOM_PM->enabled == false) {
    OSCOM::redirect('checkout_payment.php', 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL');
}
if (is_array($payment_modules->modules)) {
    $payment_modules->pre_confirmation_check();
}
// load the selected shipping module
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping($_SESSION['shipping']);
require DIR_WS_CLASSES . 'order_total.php';
Example #8
0
function tep_count_shipping_modules()
{
    $count = 0;
    $modules_array = explode(';', MODULE_SHIPPING_INSTALLED);
    for ($i = 0, $n = sizeof($modules_array); $i < $n; $i++) {
        $m = $modules_array[$i];
        $OSCOM_SM = null;
        if (strpos($m, '\\') !== false) {
            list($vendor, $app, $module) = explode('\\', $m);
            $module = $vendor . '\\' . $app . '\\' . $module;
            $code = 'Shipping_' . str_replace('\\', '_', $module);
            if (Registry::exists($code)) {
                $OSCOM_SM = Registry::get($code);
            }
        } else {
            $module = substr($m, 0, strrpos($m, '.'));
            if (is_object($GLOBALS[$module])) {
                $OSCOM_SM = $GLOBALS[$module];
            }
        }
        if (isset($OSCOM_SM) && $OSCOM_SM->enabled) {
            $count++;
        }
    }
    return $count;
}