Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/
olc_smarty_init($module_smarty, $cacheid);
$module_content = array();
$filename = '';
// check if allowed to see
require_once DIR_FS_INC . 'olc_in_array.inc.php';
$check_query = olc_db_query("SELECT DISTINCT\n\t\t\t\tproducts_id\n\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\tWHERE languages_id='" . SESSION_LANGUAGE_ID . APOS);
//$check_data=olc_db_fetch_array($check_query);
$check_data = array();
$i = '0';
while ($content_data = olc_db_fetch_array($check_query)) {
    $check_data[$i] = $content_data['products_id'];
    $i++;
}
if (olc_in_array($_GET['products_id'], $check_data)) {
    // get content data
    require_once DIR_FS_INC . 'olc_filesize.inc.php';
    //get download
    $content_query = olc_db_query("SELECT\n\t\t\t\tcontent_id,\n\t\t\t\tcontent_name,\n\t\t\t\tcontent_link,\n\t\t\t\tcontent_file,\n\t\t\t\tcontent_read,\n\t\t\t\tfile_comment\n\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\tWHERE\n\t\t\t\tproducts_id='" . (int) $_GET['products_id'] . "' AND\n\t\t\t\tlanguages_id='" . SESSION_LANGUAGE_ID . APOS);
    while ($content_data = olc_db_fetch_array($content_query)) {
        $filename = '';
        if ($content_data['content_link'] != '') {
            $icon = olc_image(DIR_WS_CATALOG . 'admin/images/icons/icon_link.gif');
        } else {
            $icon = olc_image(DIR_WS_CATALOG . 'admin/images/icons/icon_' . str_replace('.', '', strstr($content_file, '.')) . '.gif');
        }
        if ($content_data['content_link'] != '') {
            $filename = HTML_A_START . $content_data['content_link'] . '" target="new">';
        }
        $filename .= $content_data['content_name'];
 function shipping($module = EMPTY_STRING, $really_include_module = true)
 {
     if (defined('MODULE_SHIPPING_INSTALLED')) {
         if (olc_not_null(MODULE_SHIPPING_INSTALLED)) {
             global $PHP_SELF, $include_modules;
             $class_text = 'class';
             $file_text = 'file';
             $id_text = 'id';
             $delivery_zone_text = 'delivery_zone';
             $this->modules = explode(SEMI_COLON, MODULE_SHIPPING_INSTALLED);
             $include_modules = array();
             if ($module) {
                 $module_id = $module[$id_text];
                 $class_name = substr($module_id, 0, strpos($module_id, UNDERSCORE));
                 $module_file = $class_name . PHP;
                 $include_module = in_array($module_file, $this->modules);
             } else {
                 $include_module = false;
             }
             if ($include_module) {
                 $include_modules[] = array($class_text => $class_name, $file_text => $module_file);
             } else {
                 reset($this->modules);
                 while (list(, $value) = each($this->modules)) {
                     $class = substr($value, 0, strrpos($value, DOT));
                     $include_modules[] = array($class_text => $class, $file_text => $value);
                 }
             }
             if ($really_include_module) {
                 // load unallowed modules into array
                 $unallowed_modules = $_SESSION['customers_status']['customers_status_shipping_unallowed'];
                 if ($unallowed_modules) {
                     $unallowed_modules = explode(COMMA, $unallowed_modules);
                     $have_unallowed_modules = true;
                 }
                 $shipping_module_language_dir = ADMIN_PATH_PREFIX . 'lang/' . SESSION_LANGUAGE . '/modules/';
                 $delivery_zone = $_SESSION[$delivery_zone_text];
                 for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
                     $shipping_module = $include_modules[$i][$file_text];
                     $shipping_module_base = str_replace(PHP, EMPTY_STRING, $shipping_module);
                     $include_module = true;
                     if ($have_unallowed_modules) {
                         if (olc_in_array($shipping_module_base, $unallowed_modules)) {
                             // check if zone is alowed to see module
                             $constant_allowed = constant('MODULE_SHIPPING_' . strtoupper($shipping_module_base) . '_ALLOWED');
                             if ($constant_allowed) {
                                 $allowed_zones = explode(COMMA, $constant_allowed);
                                 $include_module = in_array($delivery_zone, $allowed_zones) || count($allowed_zones) == 0;
                             }
                         }
                     }
                     if ($include_module) {
                         $shipping_module = 'shipping/' . $shipping_module;
                         include $shipping_module_language_dir . $shipping_module;
                         include ADMIN_PATH_PREFIX . DIR_WS_MODULES . $shipping_module;
                         $current_include_module = $include_modules[$i][$class_text];
                         $GLOBALS[$current_include_module] = new $current_include_module();
                     }
                 }
             }
         }
     }
 }
 function payment($module = EMPTY_STRING)
 {
     global $PHP_SELF;
     if (defined('MODULE_PAYMENT_INSTALLED') && olc_not_null(MODULE_PAYMENT_INSTALLED)) {
         $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         $include_modules = array();
         if (olc_not_null($module) && in_array($module . DOT . substr($PHP_SELF, strrpos($PHP_SELF, DOT) + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . PHP);
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, DOT));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         // load unallowed modules into array
         $unallowed_modules = explode(COMMA, $_SESSION['customers_status']['customers_status_payment_unallowed']);
         $lang_dir = DIR_WS_LANGUAGES . SESSION_LANGUAGE . '/modules/payment/';
         $modules_payment_dir = DIR_WS_MODULES . 'payment/';
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             $file = $include_modules[$i]['file'];
             if ($file == FILENAME_PAYPAL_WPP) {
                 if (USE_PAYPAL_WPP) {
                     continue;
                 }
             } elseif ($file == FILENAME_PAYPAL_IPN) {
                 if (!USE_PAYPAL_IPN) {
                     continue;
                 }
             }
             $class = $include_modules[$i]['class'];
             if (!olc_in_array($class, $unallowed_modules)) {
                 // check if zone is allowed to see module
                 $upper_class = strtoupper($class);
                 $constant_modules_payment = 'MODULE_PAYMENT_' . $upper_class . '_ALLOWED';
                 if (defined($constant_modules_payment)) {
                     $constant_modules_payment = constant($constant_modules_payment);
                 } else {
                     $constant_modules_payment = EMPTY_STRING;
                 }
                 if ($constant_modules_payment != EMPTY_STRING) {
                     $unallowed_zones = explode(COMMA, $constant_modules_payment);
                 } else {
                     $unallowed_zones = array();
                 }
                 if (in_array($_SESSION['delivery_zone'], $unallowed_zones) == true || count($unallowed_zones) == 0) {
                     if ($file) {
                         if ($file != 'no_payment') {
                             $include_file = $modules_payment_dir . $file;
                             if (file_exists($include_file)) {
                                 include_once $lang_dir . $file;
                                 include_once $include_file;
                                 $GLOBALS[$class] = new $class();
                             }
                         }
                     }
                 }
             }
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
         if (olc_count_payment_modules() == 1 && !is_object($_SESSION['payment'])) {
             $_SESSION['payment'] = $include_modules[0]['class'];
         }
         if (olc_not_null($module)) {
             if (in_array($module, $this->modules)) {
                 if (isset($GLOBALS[$module]->form_action_url)) {
                     $this->form_action_url = $GLOBALS[$module]->form_action_url;
                 }
             }
         }
     }
 }
function olc_draw_products_pull_down($name, $parameters = '', $exclude = '')
{
    global $currencies;
    if ($exclude == EMPTY_STRING) {
        $exclude = array();
    }
    $select_string = '<select name="' . $name . QUOTE;
    if ($parameters) {
        $select_string .= BLANK . $parameters;
    }
    $select_string .= '>';
    $products_query = olc_db_query(SELECT . "p.products_id, pd.products_name,p.products_tax_class_id, p.products_price" . SQL_FROM . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n\twhere p.products_id = pd.products_id and pd.language_id = " . SESSION_LANGUAGE_ID . " order by products_name");
    while ($products = olc_db_fetch_array($products_query)) {
        if (!olc_in_array($products['products_id'], $exclude)) {
            //brutto admin:
            if (PRICE_IS_BRUTTO == TRUE_STRING_S) {
                $products['products_price'] = olc_round($products['products_price'] * ((100 + olc_get_tax_rate($products['products_tax_class_id'])) / 100), PRICE_PRECISION);
            }
            $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . LPAREN . olc_format_price($products['products_price'], 1, 1) . ')</option>';
        }
    }
    $select_string .= '</select>';
    return $select_string;
}