Example #1
0
 function shipping($module = '')
 {
     global $language, $PHP_SELF, $customer_id;
     $customer_group = new customer_group($customer_id);
     if (ereg('all', $customer_group->getshipment())) {
         $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
     } else {
         $this->modules = explode(';', $customer_group->getshipment());
     }
     if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
         $include_modules = array();
         if (tep_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1));
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file'];
             include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
     }
 }