function set($sLang = '')
 {
     if (!empty($sLang) && $this->exists($sLang) === true) {
         $this->language = $this->get($sLang);
     } else {
         $this->language = $this->get(DEFAULT_LANGUAGE);
     }
     /*
             if (!isset($_COOKIE['language']) || (isset($_COOKIE['language']) && ($_COOKIE['language'] != $this->language['iso_639_2']))) {
               oos_setcookie('language', $this->language['iso_639_2'], time()+60*60*24*90);
             }
     */
     $_SESSION['language'] = $this->language['iso_639_2'];
     $_SESSION['language_id'] = $this->language['id'];
     $_SESSION['iso_639_1'] = $this->language['iso_639_1'];
     $_SESSION['languages_name'] = $this->language['name'];
     if (isset($_SESSION['customer_id'])) {
         $dbconn =& oosDBGetConn();
         $oostable =& oosDBGetTables();
         $sLanguage = oos_var_prep_for_os($this->language['iso_639_2']);
         $customerstable = $oostable['customers'];
         $query = "UPDATE {$customerstable} SET customers_language =? WHERE customers_id =?";
         $result =& $dbconn->Execute($query, array($sLanguage, (int) $_SESSION['customer_id']));
     }
 }
 function payment($module = '')
 {
     global $aLang;
     if (defined('MODULE_PAYMENT_INSTALLED') && !empty($_SESSION['member']->group['payment'])) {
         $this->modules = explode(';', $_SESSION['member']->group['payment']);
         $include_modules = array();
         if (!empty($module) && in_array($module . '.' . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], '.') + 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, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         $sLanguage = oos_var_prep_for_os($_SESSION['language']);
         $nArrayCountModules = count($include_modules);
         for ($i = 0, $n = $nArrayCountModules; $i < $n; $i++) {
             include 'includes/languages/' . $sLanguage . '/modules/payment/' . $include_modules[$i]['file'];
             include 'includes/modules/payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         if (oos_count_payment_modules() == 1 && !is_object($_SESSION['payment'])) {
             $_SESSION['payment'] = $include_modules[0]['class'];
         }
         if (!empty($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
    public function __construct($module = '')
    {
        global $aLang;

        if (defined('MODULE_SHIPPING_INSTALLED') && oos_is_not_null(MODULE_SHIPPING_INSTALLED)) {
            $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

            $include_modules = array();

            if ( (!empty($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($_SERVER['PHP_SELF'], (strrpos($_SERVER['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($_SERVER['PHP_SELF'], (strrpos($_SERVER['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);
                }
            }

            $sLanguage = oos_var_prep_for_os($_SESSION['language']);

            $nArrayCountModules = count($include_modules);
            for ($i=0, $n=$nArrayCountModules; $i<$n; $i++) {
                include 'includes/languages/' . $sLanguage . '/modules/shipping/' . $include_modules[$i]['file'];
                include 'includes/modules/shipping/' . $include_modules[$i]['file'];

                $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
            }
        }
    }
function smarty_outputfilter_highlight($source, &$smarty)
{
    $highlight = $_REQUEST['highlight'];
    if (isset($_GET['keywords'])) {
        $highlight .= oos_var_prep_for_os($_GET['keywords']);
    }
    $highlight = strip_tags($highlight);
    $sStrSize = strlen($highlight);
    if ($sStrSize <= 5) {
        return $source;
    }
    if (eregi(oos_server_get_var('HTTP_HOST'), oos_server_get_var('HTTP_REFERER'))) {
        if (!isset($highlight) || empty($highlight)) {
            return $source;
        }
    } else {
        MyOOS_CoreApi::requireOnce('classes/class_referrer.php');
        $referrer = new referrer();
        $highlight .= $referrer->getKeywords();
    }
    $words = $highlight;
    if (!isset($highlight) || empty($highlight)) {
        return $source;
    }
    // Pull out the script blocks
    preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match);
    $_script_blocks = $match[0];
    $source = preg_replace("!<script[^>]+>.*?</script>!is", '@@@=====@@@', $source);
    preg_match_all("!<a onmouseo[^>]+>.*!is", $source, $match);
    $_onmouse_block = $match[0];
    $source = preg_replace("!<a onmouseo[^>]+>.*!is", '@@@#=====#@@@', $source);
    // pull out all html tags
    preg_match_all("'<[\\/\\!]*?[^<>]*'si", $source, $match);
    $_tag_blocks = $match[0];
    $source = preg_replace("'<[\\/\\!]*?[^<>]*'si", '@@@:=====:@@@', $source);
    // This array is used to choose colors for supplied highlight terms
    $colorArr = array('#ffff66', '#ff9999', '#A0FFFF', '#ff66ff', '#99ff99');
    // Wrap all the highlight words with tags bolding them and changing
    // their background colors
    $wordArr = split(" ", addslashes($words));
    $i = 0;
    foreach ($wordArr as $word) {
        $word = preg_quote($word);
        $source = preg_replace('~(' . $word . ')~si', '<span style="color:black;background-color:' . $colorArr[$i] . ';">$1</span>', $source);
        $i++;
    }
    // replace script blocks
    foreach ($_script_blocks as $curr_block) {
        $source = preg_replace("!@@@=====@@@!", $curr_block, $source, 1);
    }
    foreach ($_onmouse_block as $curr_block) {
        $source = preg_replace("!@@@#=====#@@@!", $curr_block, $source, 1);
    }
    foreach ($_tag_blocks as $curr_block) {
        $source = preg_replace("!@@@:=====:@@@!", $curr_block, $source, 1);
    }
    return $source;
}
 function create_plugin_instance()
 {
     $aFilename = oos_get_filename();
     $aModules = oos_get_modules();
     if ($_GET['file'] != $aFilename['login'] && !isset($_SESSION['customer_id'])) {
         $cookie_url_array = parse_url((ENABLE_SSL == true ? OOS_HTTPS_SERVER : OOS_HTTP_SERVER) . substr(OOS_SHOP, 0, -1));
         $cookie_path = $cookie_url_array['path'];
         if (isset($_COOKIE['email_address']) && isset($_COOKIE['password'])) {
             // Get database information
             $dbconn =& oosDBGetConn();
             $oostable =& oosDBGetTables();
             $customerstable = $oostable['customers'];
             $sql = "SELECT customers_id, customers_gender, customers_firstname, customers_lastname,\n                         customers_password, customers_wishlist_link_id, customers_language,\n                         customers_vat_id_status, customers_email_address, customers_default_address_id,\n                         customers_max_order\n                  FROM {$customerstable}\n                  WHERE customers_login = '******'\n                  AND customers_email_address = '" . oos_db_input($_COOKIE['email_address']) . "'";
             $check_customer_result = $dbconn->Execute($sql);
             if ($check_customer_result->RecordCount()) {
                 $check_customer = $check_customer_result->fields;
                 if (oos_validate_password($_COOKIE['password'], $check_customer['customers_password'])) {
                     $address_booktable = $oostable['address_book'];
                     $sql = "SELECT entry_country_id, entry_zone_id\n                      FROM {$address_booktable}\n                      WHERE customers_id = '" . $check_customer['customers_id'] . "'\n                        AND address_book_id = '1'";
                     $check_country = $dbconn->GetRow($sql);
                     if ($check_customer['customers_language'] == '') {
                         $sLanguage = oos_var_prep_for_os($_SESSION['language']);
                         $customerstable = $oostable['customers'];
                         $dbconn->Execute("UPDATE {$customerstable}\n                                  SET customers_language = '" . oos_db_input($sLanguage) . "'\n                                  WHERE customers_id = '" . intval($check_customer['customers_id']) . "'");
                     }
                     $_SESSION['customer_wishlist_link_id'] = $check_customer['customers_wishlist_link_id'];
                     $_SESSION['customer_id'] = $check_customer['customers_id'];
                     $_SESSION['customer_default_address_id'] = $check_customer['customers_default_address_id'];
                     if (ACCOUNT_GENDER == '1') {
                         $_SESSION['customer_gender'] = $check_customer['customers_gender'];
                     }
                     $_SESSION['customer_first_name'] = $check_customer['customers_firstname'];
                     $_SESSION['customer_lastname'] = $check_customer['customers_lastname'];
                     $_SESSION['customer_max_order'] = $check_customer['customers_max_order'];
                     $_SESSION['customer_country_id'] = $check_country['entry_country_id'];
                     $_SESSION['customer_zone_id'] = $check_country['entry_zone_id'];
                     if (ACCOUNT_VAT_ID == '1') {
                         $_SESSION['customers_vat_id_status'] = $check_customer['customers_vat_id_status'];
                     }
                     $_SESSION['member']->restore_group();
                     setcookie('email_address', $email_address, time() + 365 * 24 * 3600, $cookie_path, '', getenv('HTTPS') == 'on' ? 1 : 0);
                     setcookie('password', $check_customer['customers_password'], time() + 365 * 24 * 3600, $cookie_path, '', getenv('HTTPS') == 'on' ? 1 : 0);
                     $customers_infotable = $oostable['customers_info'];
                     $dbconn->Execute("UPDATE {$customers_infotable}\n                                SET customers_info_date_of_last_logon = '" . date("Y-m-d H:i:s", time()) . "',\n                                    customers_info_number_of_logons = customers_info_number_of_logons+1\n                                WHERE customers_info_id = '" . intval($_SESSION['customer_id']) . "'");
                     $_SESSION['cart']->restore_contents();
                     // restore cart contents
                 }
             }
         }
     }
     return true;
 }
/**
 * Smarty {swap_product_image} function plugin
 *
 * Type:     function<br>
 * Name:     swap_product_image<br>
 * Date:     Oct 09, 2006<br>
 * Purpose:  format HTML tags for the image<br>
 * Input:<br>
 *         - image = image width (optional, default actual width)
 *         - border = border width (optional, default 0)
 *         - height = image height (optional, default actual height)
 *
 * Examples: {swap_product_image id="featured" image=$random.products_image alt=$random.products_name|strip_tags}
 * Output:   <img id="featured" src="images/product_image.jpg" border="0" alt="products_name" onmouseover="imgSwap(this)" onmouseout="imgSwap(this)"/>
 * @author   r23 <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_swap_product_image($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');

    $basedir = OOS_IMAGES;
    $height = SMALL_IMAGE_HEIGHT;
    $width = SMALL_IMAGE_WIDTH;
    $border = 0;
    $alt = '';
    $image = '';
    $extra = '';

    $sLanguage = oos_var_prep_for_os($_SESSION['language']);

    foreach($params as $_key => $_val) {
      switch($_key) {
        case 'id':
        case 'image':
        case 'border':
        case 'height':
        case 'width':
        case 'basedir':
        case 'alt':
           if (!is_array($_val)) {
             $$_key = smarty_function_escape_special_chars($_val);
           } else {
             $smarty->trigger_error("small_product_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
           }
           break;

        default:
           if (!is_array($_val)) {
             $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
           } else {
             $smarty->trigger_error("small_product_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
           }
           break;
      }
    }

    $image = $basedir . $image;

    if ((empty($image) || ($image == OOS_IMAGES)) && (IMAGE_REQUIRED == '0')) {
        return false;
    }

    return '<img id="'.$id.'" src="'.$image.'" alt="'.$alt.'" border="'.$border.'" width="'.$width.'" height="'.$height.'"'.$extra.' onmouseover="imgSwap(this)" onmouseout="imgSwap(this)" />';

}
 function create_plugin_instance()
 {
     global $oCurrencies;
     MyOOS_CoreApi::requireOnce('classes/class_currencies.php');
     $oCurrencies = new currencies();
     // currency
     if (!isset($_SESSION['currency']) || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == '1' && LANGUAGE_CURRENCY != $_SESSION['currency']) {
         if (isset($_GET['currency']) && oos_currency_exits($_GET['currency'])) {
             $_SESSION['currency'] = oos_var_prep_for_os($_GET['currency']);
         } else {
             $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == '1' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
         }
     }
     return true;
 }
/**
 * Smarty {html_iframe} function plugin
 *
 * Type:     function<br>
 * Name:     html_image_button<br>
 * Date:     September 15, 2003
 * Input:<br>
 *         - button = button (and path) of image (required)
 *         - border = border width (optional, default 0)
 *         - height = image height (optional, default actual height)
 *         - basedir = base directory
 *
 * Examples: {html_iframe doc="gpl.html" class="license" frameborder="0" scrolling="auto"}
 * @author r23 <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_html_iframe($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');

    $doc = '';
    $class = 'license';
    $frameborder = 0;
    $height = '';
    $scrolling = 'auto';
    $extra = '';
    // $sTheme = oos_var_prep_for_os($_SESSION['theme']);
    $sLanguage = oos_var_prep_for_os($_SESSION['language']);
    $dir = OOS_SHOP . OOS_MEDIA . $sLanguage . '/';

    foreach($params as $_key => $_val) {
        switch($_key) {

            case 'doc':
            case 'class':
            case 'frameborder':
            case 'scrolling':
                if(!is_array($_val)) {
                 $$_key = smarty_function_escape_special_chars($_val);
                } else {
                  $smarty->trigger_error("html_iframe: attribute '$_key' cannot be an array", E_USER_NOTICE);
                }
                break;

            default:
                if(!is_array($_val)) {
                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
                } else {
                    $smarty->trigger_error("html_iframe: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }

    if (empty($doc)) {
        $smarty->trigger_error("html_iframe: missing 'doc' parameter", E_USER_NOTICE);
        return;
    }

    return '<iframe src="'.$dir.$doc.'" class="'.$class.'" frameborder="'.$frameborder.'" scrolling="'.$scrolling.'"'.$extra.' /></iframe>';


}
 function credit_selection()
 {
     global $aLang;
     global $oCurrencies;
     $sTheme = oos_var_prep_for_os($_SESSION['theme']);
     $sLanguage = oos_var_prep_for_os($_SESSION['language']);
     $image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . 'themes/' . $sTheme . '/images/buttons/' . $sLanguage . '/redeem.gif" border="0" alt="' . $aLang['image_button_redeem_voucher'] . '" title = "' . $aLang['image_button_redeem_voucher'] . '">';
     $selection_string = '';
     $selection_string .= '<tr>' . "\n";
     $selection_string .= '  <td width="10"></td>';
     $selection_string .= '  <td class="main">' . "\n";
     $selection_string .= $aLang['text_enter_coupon_code'] . oos_draw_input_field('gv_redeem_code') . '</td>';
     $selection_string .= '  <td align="right">' . $image_submit . '</td>';
     $selection_string .= '  <td width="10"></td>';
     $selection_string .= '</tr>' . "\n";
     return $selection_string;
 }
 function create_plugin_instance()
 {
     global $categories, $aCategoryPath, $nCurrentCategoryId;
     $categories = '';
     $aCategoryPath = array();
     $nCurrentCategoryId = 0;
     if (isset($_GET['categories'])) {
         $categories = oos_var_prep_for_os($_GET['categories']);
     } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
         $categories = oos_get_product_path($_GET['products_id']);
     }
     if (!empty($categories)) {
         $aCategoryPath = array_unique(array_filter(explode('_', $categories), 'is_numeric'));
         $categories = implode('_', $aCategoryPath);
         $nCurrentCategoryId = end($aCategoryPath);
     }
     return true;
 }
 function create_plugin_instance()
 {
     global $oLang, $aLang;
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $aPages = oos_get_pages();
     if (!isset($_SESSION['language']) || isset($_GET['language'])) {
         MyOOS_CoreApi::requireOnce('classes/class_language.php');
         $oLang = new language();
         if (isset($_GET['language']) && oos_is_not_null($_GET['language'])) {
             $oLang->set($_GET['language']);
         } else {
             $oLang->get_browser_language();
         }
     }
     $sLanguage = oos_var_prep_for_os($_SESSION['language']);
     include 'includes/languages/' . $sLanguage . '.php';
     return true;
 }
 function create_plugin_instance()
 {
     global $categories, $aCategoryPath, $nCurrentCategoryId;
     MyOOS_CoreApi::requireOnce('classes/class_category_tree.php');
     if (isset($_GET['categories'])) {
         $categories = oos_var_prep_for_os($_GET['categories']);
     } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
         $categories = oos_get_product_path($_GET['products_id']);
     } else {
         $categories = '';
     }
     if (!empty($categories)) {
         $aCategoryPath = oos_parse_category_path($categories);
         $categories = implode('_', $aCategoryPath);
         $nCurrentCategoryId = end($aCategoryPath);
     } else {
         $nCurrentCategoryId = 0;
     }
     return true;
 }
 function load_plugin($sInstance, $sPluginPath = '')
 {
     $sName = 'oos_event_' . $sInstance;
     if (!class_exists($sName)) {
         if (empty($sPluginPath)) {
             $sPluginPath = $sName;
         }
         $sPluginPath = oos_var_prep_for_os($sPluginPath);
         $sName = oos_var_prep_for_os($sName);
         if (is_readable('includes/plugins/' . $sPluginPath . '/' . $sName . '.php')) {
             MyOOS_CoreApi::requireOnce('plugins/' . $sPluginPath . '/' . $sName . '.php');
         }
         if (!class_exists($sName)) {
             return false;
         }
     }
     if (@call_user_func(array('oos_event_' . $sInstance, 'create_plugin_instance'))) {
         $this->aPlugins[] = $sName;
     }
     return true;
 }
/**
 * Smarty {html_image_submit} function plugin
 *
 * Type:     function<br>
 * Name:     html_image_submit<br>
 * Date:     September 15, 2003
 * Input:<br>
 *         - button = button (and path) of image (required)
 *         - border = border width (optional, default 0)
 *         - height = image height (optional, default actual height)
 *         - basedir = base directory
 *
 * Examples: {html_image_submit image="masthead.gif"}
 * @author r23 <*****@*****.**>
 * @author credits to Monte Ohrt <*****@*****.**>
 * @author credits to Duda <*****@*****.**> - wrote first image function
 *           in repository, helped with lots of functionality
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_html_image_submit($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $image = '';
    $alt = '';
    $border = 0;
    $extra = '';
    $sTheme = oos_var_prep_for_os($_SESSION['theme']);
    $sLanguage = oos_var_prep_for_os($_SESSION['language']);
    $basedir = STATIC1_HTTP_SERVER . '/themes/' . $sTheme . '/images/buttons/' . $sLanguage . '/';
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'image':
            case 'basedir':
                ${$_key} = $_val;
                break;
            case 'alt':
                if (!is_array($_val)) {
                    ${$_key} = smarty_function_escape_special_chars($_val);
                } else {
                    $smarty->trigger_error("html_image_submit: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
            default:
                if (!is_array($_val)) {
                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                } else {
                    $smarty->trigger_error("html_image_submit: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }
    if (empty($image)) {
        $smarty->trigger_error("html_image_submit: missing 'button' parameter", E_USER_NOTICE);
        return;
    }
    $sSlash = defined('OOS_XHTML') && OOS_XHTML == '1' ? ' /' : '';
    return '<input type="image" src="' . $basedir . $image . '" alt="' . $alt . '" ' . $extra . $sSlash . '>';
}
Exemple #15
0
        }


// optional Product List Filter
        $product_filter_select = '';
        if (PRODUCT_LIST_FILTER > 0) {
            $filterlist_result = $dbconn->Execute($filterlist_sql);
            if ($filterlist_result->RecordCount() > 1) {
                $product_filter_select .= '            <td align="center" class="main">' . $aLang['text_show'] . '<select size="1" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">';
                if (isset($_GET['manufacturers_id'])) {
                    $manufacturers_id = intval($_GET['manufacturers_id']);
                    $arguments = 'manufacturers_id=' . intval($manufacturers_id);
                } else {
                    $arguments = 'categories=' . $categories;
                }
                $arguments .= '&amp;sort=' . oos_var_prep_for_os($_GET['sort']);

                $option_url = oos_href_link($aPages['shop'], $arguments);

                if (!isset($_GET['filter_id'])) {
                     $product_filter_select .= '<option value="' . $option_url . '" selected="selected">' . $aLang['text_all'] . '</option>';
                } else {
                     $product_filter_select .= '<option value="' . $option_url . '">' . $aLang['text_all'] . '</option>';
                }

                $product_filter_select .= '<option value="">---------------</option>';
                while ($filterlist = $filterlist_result->fields)
                {
                    $option_url = oos_href_link($aPages['shop'], $arguments . '&amp;filter_id=' . $filterlist['id']);
                    if (isset($_GET['filter_id']) && ($_GET['filter_id'] == $filterlist['id'])) {
                        $product_filter_select .= '<option value="' . $option_url . '" selected="selected">' . $filterlist['name'] . '</option>';
defined('OOS_VALID_MOD') or die('Direct Access to this location is not allowed.');
if (!$oEvent->installed_plugin('reviews')) {
    $_SESSION['navigation']->remove_current_page();
    oos_redirect(oos_href_link($aModules['main'], $aFilename['main']));
}
if (!isset($_SESSION['customer_id'])) {
    $_SESSION['navigation']->set_snapshot();
    oos_redirect(oos_href_link($aModules['user'], $aFilename['login'], '', 'SSL'));
}
if (isset($_GET['products_id'])) {
    $get_parameters = 'products_id=' . oos_var_prep_for_os($_GET['products_id']);
    if (!isset($nProductsId)) {
        $nProductsId = oos_get_product_id($_GET['products_id']);
    }
} elseif (isset($_POST['products_id'])) {
    $get_parameters = 'products_id=' . oos_var_prep_for_os($_POST['products_id']);
    if (!isset($nProductsId)) {
        $nProductsId = oos_get_product_id($_POST['products_id']);
    }
} else {
    oos_redirect(oos_href_link($aModules['main'], $aFilename['main']));
}
require 'includes/languages/' . $sLanguage . '/reviews_product_write.php';
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$sql = "SELECT pd.products_name, p.products_image\n        FROM {$productstable} p,\n             {$products_descriptiontable} pd\n        WHERE p.products_id = '" . intval($nProductsId) . "'\n          AND pd.products_id = p.products_id\n          AND pd.products_languages_id = '" . intval($nLanguageID) . "'\n          AND p.products_status >= '1'";
$product_result = $dbconn->Execute($sql);
$valid_product = $product_result->RecordCount() > 0;
$product_info = $product_result->fields;
if (isset($_POST['action']) && $_POST['action'] == 'process' && (isset($_SESSION['formid']) && $_SESSION['formid'] == $_POST['formid'])) {
    $rating = oos_prepare_input($_POST['rating']);
/**
 * Checks to see if the tempalte exists
 */
function oos_template_exits($sStr)
{

    $sDir = OOS_TEMP_PATH;
    if (substr($sDir, -1) != "/") {
        $sDir = $sDir."/";
    }

    $sDir .= 'shop/';

    if (is_readable($sDir . 'templates/' . oos_var_prep_for_os($sStr) . '/theme.html')) {
        return true;
    } else {
        return false;
    }
}
/**
 * Smarty {customers_image} function plugin
 *
 * Type:     function<br>
 * Name:     customers_image<br>
 * Date:     Apr 16, 2009<br>
 * Purpose:  format HTML tags for the image<br>
 * Input:<br>
 *         - image =image width (optional, default actual width)
 *         - border = border width (optional, default 0)
 *         - height = image height (optional, default actual height)
 *
 * Examples: {customers_image file="images/masthead.gif"}
 * Output:   <img src="images/masthead.gif" border=0 width=100 height=80>
 * @author   r23 <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_customers_image($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');

    $basedir = OOS_IMAGES . OOS_CUSTOMERS_IMAGES;
    $height = '150';
    $width = '';
    $border = 0;
    $alt = '';
    $image = '';
    $extra = '';

    $sLanguage = oos_var_prep_for_os($_SESSION['language']);

    foreach($params as $_key => $_val) {
      switch($_key) {
        case 'image':
        case 'border':
        case 'height':
        case 'width':
        case 'basedir':
        case 'alt':
           if (!is_array($_val)) {
             $$_key = smarty_function_escape_special_chars($_val);
           } else {
             $smarty->trigger_error("customers_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
           }
           break;

        default:
           if (!is_array($_val)) {
             $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
           } else {
             $smarty->trigger_error("customers_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
           }
           break;
      }
    }

    $image = $basedir . $image;


    if ((empty($image) || ($image == $basedir)) && (IMAGE_REQUIRED == '0')) {
        return false;
    }

    if ((empty($image) || ($image == $basedir)) && (IMAGE_REQUIRED == '1')) {
      $image = OOS_IMAGES . 'member.jpg';

      $image_size = @getimagesize($image);
      $width = $image_size[0];
      $height = $image_size[1];
    } elseif ( (CONFIG_CALCULATE_IMAGE_SIZE == '1') && (empty($width) || empty($height)) ) {
      if (file_exists(OOS_ABSOLUTE_PATH . $image)) {
        $image_size = @getimagesize($image);
        if (empty($width) && oos_is_not_null($height)) {
          $ratio = $height / $image_size[1];
          $width = $image_size[0] * $ratio;
        } elseif (!empty($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = $image_size[1] * $ratio;
        } elseif (empty($width) && empty($height)) {
          $width = $image_size[0];
          $height = $image_size[1];
        }
      } elseif (IMAGE_REQUIRED == '1') {
        $image = OOS_IMAGES . 'member.jpg';

        $image_size = @getimagesize($image);
        $width = $image_size[0];
        $height = $image_size[1];
      } else {
        return false;
      }
    }

    $sSlash = (defined('OOS_XHTML') && (OOS_XHTML == '1') ? ' /' : '');

    return '<img src="'.$image.'" alt="'.$alt.'" border="'.$border.'" width="'.$width.'" height="'.$height.'"'.$extra.$sSlash.'>';

}
Exemple #19
0
    function before_process() {
      global $oOrder;

      if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (oos_validate_is_email(MODULE_PAYMENT_CC_EMAIL)) ) {
        $len = strlen($_POST['cc_number']);

        $this->cc_middle = substr($_POST['cc_number'], 4, ($len-8));
        $oOrder->info['cc_number'] = substr($_POST['cc_number'], 0, 4) . str_repeat('X', (strlen($_POST['cc_number']) - 8)) . substr($_POST['cc_number'], -4);

        $this->cc_cvv = oos_var_prep_for_os($_POST['cc_cvv']);
        $this->cc_start = oos_var_prep_for_os($_POST['cc_start']);
        $this->cc_issue = oos_var_prep_for_os($_POST['cc_issue']);

      }
    }
            $your_email_address_prompt = $account_values['customers_email_address'];
        } else {
            $your_name_prompt = oos_draw_input_field('yourname', $fromname_error == '1' ? $yourname : $_GET['yourname']);
            if ($fromname_error == '1') {
                $your_name_prompt .= '&nbsp;<span class="errorText">' . $aLang['text_required'] . '</span>';
            }
            $your_email_address_prompt = oos_draw_input_field('from', $fromemail_error == '1' ? $from : $_GET['from']);
            if ($fromemail_error == '1') {
                $your_email_address_prompt .= $aLang['entry_email_address_check_error'];
            }
        }
    }
}
if (isset($_GET['send_to'])) {
    if (oos_validate_is_email(trim($_GET['send_to']))) {
        $friendemail = oos_var_prep_for_os($_GET['send_to']);
    }
}
// links breadcrumb
$oBreadcrumb->add($aLang['navbar_title'], oos_href_link($aModules['tell_a_friend'], $aFilename['tell_a_friend'], 'send_to=' . $friendemail . '&amp;products_id=' . $_GET['products_id']));
$aOption['template_main'] = $sTheme . '/modules/tell_a_friend.html';
$aOption['page_heading'] = $sTheme . '/heading/page_heading.html';
$nPageType = OOS_PAGE_TYPE_PRODUCTS;
require 'includes/oos_system.php';
if (!isset($option)) {
    require 'includes/info_message.php';
    require 'includes/oos_blocks.php';
}
// assign Smarty variables;
$oSmarty->assign(array('oos_breadcrumb' => $oBreadcrumb->trail(BREADCRUMB_SEPARATOR), 'oos_heading_title' => sprintf($aLang['heading_title'], $product_info['products_name']), 'oos_heading_image' => 'specials.gif', 'valid_product' => $valid_product, 'product_info' => $product_info, 'action' => $action, 'your_name_prompt' => $your_name_prompt, 'your_email_address_prompt' => $your_email_address_prompt, 'friendname' => $friendname, 'friendemail' => $friendemail, 'yourmessage' => $yourmessage, 'oos_friendemail' => sprintf($aLang['text_email_successful_sent'], stripslashes($products_name), $friendemail), 'error' => $error, 'friendemail_error' => $friendemail_error, 'friendname_error' => $friendname_error, 'fromemail_error' => $fromemail_error, 'fromname_error' => $fromname_error));
$oSmarty->assign('oosPageHeading', $oSmarty->fetch($aOption['page_heading']));
   ----------------------------------------------------------------------
   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com

   Copyright (c) 2003 osCommerce
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined('OOS_VALID_MOD') or die('Direct Access to this location is not allowed.');
if (isset($_GET['products_id'])) {
    if (!isset($nProductsId)) {
        $nProductsId = oos_get_product_id($_GET['products_id']);
    }
    if (!isset($sProductsId)) {
        $sProductsId = oos_var_prep_for_os($_GET['products_id']);
    }
    $options = '';
    $number_of_uploads = 0;
    $products_optionstable = $oostable['products_options'];
    $products_attributestable = $oostable['products_attributes'];
    $attributes_sql = "SELECT COUNT(*) AS total\n                       FROM {$products_optionstable} popt,\n                            {$products_attributestable} patrib\n                       WHERE patrib.products_id = '" . intval($nProductsId) . "'\n                         AND patrib.options_id = popt.products_options_id\n                         AND popt.products_options_languages_id = '" . intval($nLanguageID) . "'";
    $products_attributes = $dbconn->Execute($attributes_sql);
    if ($products_attributes->fields['total'] > 0) {
        $options .= '<b>' . $aLang['text_product_options'] . '</b><br />' . '<table border="0" cellpadding="0" cellspacing="0">';
        if (PRODUCTS_OPTIONS_SORT_BY_PRICE == '1') {
            $options_sort_by = ' ORDER BY pa.options_sort_order, pa.options_values_price';
        } else {
            $options_sort_by = ' ORDER BY pa.options_sort_order, pov.products_options_values_name';
        }
        $products_optionstable = $oostable['products_options'];
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */

// DO NOT RUN THIS SCRIPT STANDALONE
if (count(get_included_files()) < 2) {
    header("HTTP/1.1 301 Moved Permanently"); header("Location: /"); exit;
}

if (!defined('OOS_BASE_PRICE')) {
    define('OOS_BASE_PRICE', '0');
}

$_SESSION['navigation']->remove_current_page();

$sLanguage = oos_var_prep_for_os($_SESSION['language']);
require 'includes/languages/' . $sLanguage . '.php';
require 'includes/languages/' . $sLanguage . '/products_info.php';

if (isset($_GET['products_id'])) {
    if (!isset($nProductsId)) $nProductsId = oos_get_product_id($_GET['products_id']);
}

$aOption['popup_print'] = $sTheme . '/products/popup_print.html';

//smarty
require 'includes/classes/class_template.php';
$oSmarty = new Template;

$oSmarty->caching = true;
Exemple #23
0
				die("Error: Unable to mkdir $sessionPath");
			}
		}
		elseif(!@is_writable($sessionPath))
		{
			die("Error: $sessionPath is not writable");
		}
	}
}



require_once MYOOS_INCLUDE_PATH . '/includes/oos_main.php';


$sPage = oos_var_prep_for_os($sPage);

if (is_readable('includes/pages/' . $sPage . '.php')) {
    if (isset($_GET['history_back'])){
        $_SESSION['navigation']->remove_last_page();
    } else {
        $_SESSION['navigation']->add_current_page();
    }
    require_once MYOOS_INCLUDE_PATH . '/includes/pages/' . $sPage . '.php';

} else {
    MyOOS_CoreApi::redirect(oos_href_link($aPages['error404']));
}

require_once MYOOS_INCLUDE_PATH . '/includes/oos_nice_exit.php';
                     MyOOS_CoreApi::redirect(oos_href_link($goto_file, oos_get_all_get_parameters($parameters), 'NONSSL'));
                 } else {
                     MyOOS_CoreApi::redirect(oos_href_link($aPages['product_info'], 'products_id=' . $products_quickie['products_id']));
                 }
             }
         }
     }
     break;
 case 'notify':
     if (isset($_SESSION['customer_id'])) {
         if (isset($_GET['products_id'])) {
             $notify = oos_var_prep_for_os($_GET['products_id']);
         } elseif (isset($_GET['notify'])) {
             $notify = oos_var_prep_for_os($_GET['notify']);
         } elseif (isset($_POST['notify'])) {
             $notify = oos_var_prep_for_os($_POST['notify']);
         } else {
             MyOOS_CoreApi::redirect(oos_href_link($sPage, oos_get_all_get_parameters(array('action', 'notify'))));
         }
         $products_notificationstable = $oostable['products_notifications'];
         if (!is_array($notify)) {
             $notify = array($notify);
         }
         $nArrayCountNotify = count($notify);
         for ($i = 0, $n = $nArrayCountNotify; $i < $n; $i++) {
             $check_sql = "SELECT COUNT(*) AS total\n                        FROM {$products_notificationstable}\n                        WHERE products_id = '" . intval($notify[$i]) . "'\n                        AND customers_id = '" . intval($_SESSION['customer_id']) . "'";
             $check = $dbconn->Execute($check_sql);
             if ($check->fields['total'] < 1) {
                 $today = date("Y-m-d H:i:s", time());
                 $sql = "INSERT INTO {$products_notificationstable}\n                    (products_id, customers_id,\n                     date_added) VALUES (" . $dbconn->qstr($notify[$i]) . ',' . $dbconn->qstr($_SESSION['customer_id']) . ',' . $dbconn->DBTimeStamp($today) . ")";
                 $dbconn->Execute($sql);
   Copyright (c) 2003 osCommerce
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined('OOS_VALID_MOD') or die('Direct Access to this location is not allowed.');
if (!isset($aInfoMessage)) {
    $aInfoMessage = array();
}
if (isset($_SESSION['error_message']) && !empty($_SESSION['error_message'])) {
    $aInfoMessage[] = array('type' => 'error', 'text' => oos_var_prep_for_os($_SESSION['error_message']));
    unset($_SESSION['error_message']);
}
if (isset($_SESSION['info_message']) && !empty($_SESSION['info_message'])) {
    $aInfoMessage[] = array('type' => 'info', 'text' => oos_var_prep_for_os($_SESSION['info_message']));
    unset($_SESSION['info_message']);
}
if ($oMessage->size('upload') > 0) {
    $aInfoMessage = array_merge($aInfoMessage, $oMessage->output('upload'));
}
for ($i = 0; $i < count($aInfoMessage); $i++) {
    switch ($aInfoMessage[$i]['type']) {
        case 'warning':
            $oSmarty->append('oos_info_warning', array('text' => $aInfoMessage[$i]['text']));
            break;
        case 'error':
            $oSmarty->append('oos_error_message', array('text' => $aInfoMessage[$i]['text']));
            break;
        case 'info':
        case 'success':
/**
 * Smarty {tooltip} function plugin
 *
 * Type:     function<br>
 * Name:     tooltip<br>
 * Purpose:  make text pop up in windows via wz_tooltip
 * Author:   r23 <info at r23 dot de>
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_tooltip($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('function', 'html_href_link');
    $aPages = oos_get_pages();
    $basedir = OOS_IMAGES;
    $height = SMALL_IMAGE_HEIGHT;
    $width = SMALL_IMAGE_WIDTH;
    $align = 'right';
    $image = '';
    $sLanguage = oos_var_prep_for_os($_SESSION['language']);
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'image':
            case 'height':
            case 'width':
            case 'basedir':
            case 'align':
            case 'products_description':
            case 'products_id':
                ${$_key} = (string) $_val;
                break;
            default:
                $smarty->trigger_error("[tooltip] unknown parameter {$_key}", E_USER_WARNING);
                break;
        }
    }
    $image = $basedir . $image;
    if ((empty($image) || $image == OOS_IMAGES) && IMAGE_REQUIRED == '0') {
        return false;
    }
    if ((empty($image) || $image == OOS_IMAGES) && IMAGE_REQUIRED == '1') {
        if (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif')) {
            $image = OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif';
        } elseif (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture.gif')) {
            $image = OOS_IMAGES . 'no_picture.gif';
        } else {
            return false;
        }
        $image_size = @getimagesize($image);
        $width = $image_size[0];
        $height = $image_size[1];
    } elseif (CONFIG_CALCULATE_IMAGE_SIZE == '1' && (empty($width) || empty($height))) {
        if (is_readable(OOS_ABSOLUTE_PATH . $image)) {
            $image_size = @getimagesize($image);
            if (empty($width) && !empty($height)) {
                $ratio = $height / $image_size[1];
                $width = $image_size[0] * $ratio;
            } elseif (!empty($width) && empty($height)) {
                $ratio = $width / $image_size[0];
                $height = $image_size[1] * $ratio;
            } elseif (empty($width) && empty($height)) {
                $width = $image_size[0];
                $height = $image_size[1];
            }
        } elseif (IMAGE_REQUIRED == '1') {
            if (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif')) {
                $image = OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif';
            } elseif (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture.gif')) {
                $image = OOS_IMAGES . 'no_picture.gif';
            } else {
                return false;
            }
            $image_size = @getimagesize($image);
            $width = $image_size[0];
            $height = $image_size[1];
        } else {
            return false;
        }
    }
    $image = '<img src=' . $image . ' align=' . $align . ' width=' . $width . ' height=' . $height . '>';
    $link_params = array();
    $link_params = array('page' => $aPages['product_info'], 'products_id' => $params['products_id']);
    $link = smarty_function_html_href_link($link_params, $smarty);
    $products_description = strip_tags($products_description);
    $products_description = preg_replace(array("!'!", "![\r\n]!"), array("\\'", '\\r'), $products_description);
    $products_description = str_replace('"', ' ', $products_description);
    return '<a onmouseover="Tip(\'' . $image . ' ' . $products_description . '\', WIDTH, 200)" onmouseout="UnTip()" href="' . $link . '" target="_top">';
}
Exemple #27
0
// products history
if (!isset($_SESSION['products_history'])) {
    $_SESSION['products_history'] = new oosProductsHistory();
}
// initialize the message stack for output messages
require 'includes/classes/class_message_stack.php';
$oMessage = new messageStack();
// templates selection
if (!isset($_SESSION['theme']) || isset($_GET['template'])) {
    if (isset($_GET['template']) && oos_template_exits($_GET['template'])) {
        $_SESSION['theme'] = oos_var_prep_for_os($_GET['template']);
    } else {
        $_SESSION['theme'] = STORE_TEMPLATES;
    }
}
$sTheme = oos_var_prep_for_os($_SESSION['theme']);
// PAngV
if ($_SESSION['member']->group['show_price'] == 1) {
    if ($_SESSION['member']->group['show_price_tax'] == 1) {
        $sPAngV = $aLang['text_taxt_incl'];
    } else {
        $sPAngV = $aLang['text_taxt_add'];
    }
    if (isset($_SESSION['customers_vat_id_status']) && $_SESSION['customers_vat_id_status'] == 1) {
        $sPAngV = $aLang['tax_info_excl'];
    }
    $sPAngV .= defined('OOS_XHTML') && OOS_XHTML == '1' ? ', <br />' : ', <br>';
    $sPAngV .= sprintf($aLang['text_shipping'], oos_href_link($aModules['info'], $aFilename['information'], 'information_id=1'));
}
// Shopping cart actions
if (isset($_GET['action']) || isset($_POST['action']) && isset($_SESSION['formid']) && $_SESSION['formid'] == $_POST['formid']) {
/**
 * Smarty {small_product_image} function plugin
 *
 * Type:     function<br>
 * Name:     small_product_image<br>
 * Date:     Aug 24, 2004<br>
 * Purpose:  format HTML tags for the image<br>
 * Input:<br>
 *         - image =image width (optional, default actual width)
 *         - border = border width (optional, default 0)
 *         - height = image height (optional, default actual height)
 *
 * Examples: {small_product_image file="images/masthead.gif"}
 * Output:   <img src="images/masthead.gif" border=0 width=100 height=80>
 * @author   r23 <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_small_product_image($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $basedir = OOS_IMAGES;
    $height = SMALL_IMAGE_HEIGHT;
    $width = SMALL_IMAGE_WIDTH;
    $border = 0;
    $alt = '';
    $image = '';
    $extra = '';
    $sLanguage = oos_var_prep_for_os($_SESSION['language']);
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'image':
            case 'border':
            case 'height':
            case 'width':
            case 'basedir':
            case 'alt':
                if (!is_array($_val)) {
                    ${$_key} = smarty_function_escape_special_chars($_val);
                } else {
                    $smarty->trigger_error("small_product_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
            default:
                if (!is_array($_val)) {
                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                } else {
                    $smarty->trigger_error("small_product_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }
    $image = $basedir . $image;
    if ((empty($image) || $image == OOS_IMAGES) && IMAGE_REQUIRED == '0') {
        return false;
    }
    if ((empty($image) || $image == OOS_IMAGES) && IMAGE_REQUIRED == '1') {
        if (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif')) {
            $image = OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif';
        } elseif (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture.gif')) {
            $image = OOS_IMAGES . 'no_picture.gif';
        } else {
            return false;
        }
        $image_size = @getimagesize($image);
        $width = $image_size[0];
        $height = $image_size[1];
    } elseif (CONFIG_CALCULATE_IMAGE_SIZE == '1' && (empty($width) || empty($height))) {
        if (is_readable(OOS_ABSOLUTE_PATH . $image)) {
            $image_size = @getimagesize($image);
            if (empty($width) && oos_is_not_null($height)) {
                $ratio = $height / $image_size[1];
                $width = $image_size[0] * $ratio;
            } elseif (oos_is_not_null($width) && empty($height)) {
                $ratio = $width / $image_size[0];
                $height = $image_size[1] * $ratio;
            } elseif (empty($width) && empty($height)) {
                $width = $image_size[0];
                $height = $image_size[1];
            }
        } elseif (IMAGE_REQUIRED == '1') {
            if (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif')) {
                $image = OOS_IMAGES . 'no_picture_' . $sLanguage . '.gif';
            } elseif (is_readable(OOS_ABSOLUTE_PATH . OOS_IMAGES . 'no_picture.gif')) {
                $image = OOS_IMAGES . 'no_picture.gif';
            } else {
                return false;
            }
            $image_size = @getimagesize($image);
            $width = $image_size[0];
            $height = $image_size[1];
        } else {
            return false;
        }
    }
    $sSlash = defined('OOS_XHTML') && OOS_XHTML == '1' ? ' /' : '';
    return '<img src="' . $image . '" alt="' . $alt . '" border="' . $border . '" width="' . $width . '" height="' . $height . '"' . $extra . $sSlash . '>';
}
/**
 * Smarty {html_js_icon} function plugin
 *
 * Type:     function<br>
 * Name:     html_js_icon<br>
 * Date:     October 06, 2005
 * Input:<br>
 *         - button = button (and path) of image (required)
 *         - border = border width (optional, default 0)
 *         - height = image height (optional, default actual height)
 *         - basedir = base directory
 *
 * Examples: {html_js_icon image="email.gif"}
 * Output:   <img src="images/masthead.gif" border=0 width=400 height=23>
 * @author r23 <*****@*****.**>
 * @author credits to Monte Ohrt <*****@*****.**>
 * @author credits to Duda <*****@*****.**> - wrote first image function
 *           in repository, helped with lots of functionality
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_html_js_icon($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $image = '';
    $alt = '';
    $align = 'middle';
    $border = 0;
    $height = '';
    $width = '';
    $extra = '';
    $sTheme = oos_var_prep_for_os($_SESSION['theme']);
    $basedir = 'themes/' . $sTheme . '/images/icons/';
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'image':
            case 'basedir':
            case 'align':
                ${$_key} = $_val;
                break;
            case 'alt':
                if (!is_array($_val)) {
                    ${$_key} = smarty_function_escape_special_chars($_val);
                } else {
                    $smarty->trigger_error("html_js_icon: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
            default:
                if (!is_array($_val)) {
                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                } else {
                    $smarty->trigger_error("html_js_icon: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }
    if (empty($image)) {
        $smarty->trigger_error("html_js_icon: missing 'button' parameter", E_USER_NOTICE);
        return;
    }
    $_image_path = $basedir . $image;
    if (!isset($params['width']) || !isset($params['height'])) {
        if ($smarty->security && ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) && (require_once SMARTY_CORE_DIR . 'core.is_secure.php') && !smarty_core_is_secure($_params, $smarty)) {
            $smarty->trigger_error("html_js_icon:: (secure) '{$_image_path}' not in secure directory", E_USER_NOTICE);
        } elseif (!($_image_data = @getimagesize($_image_path))) {
            if (!file_exists($_image_path)) {
                $smarty->trigger_error("html_js_icon: unable to find '{$_image_path}'", E_USER_NOTICE);
                return;
            } elseif (!is_readable($_image_path)) {
                $smarty->trigger_error("html_js_icon: unable to read '{$_image_path}'", E_USER_NOTICE);
                return;
            } else {
                $smarty->trigger_error("html_js_icon: '{$_image_path}' is not a valid image button", E_USER_NOTICE);
                return;
            }
        }
        if (!isset($params['width'])) {
            $width = $_image_data[0];
        }
        if (!isset($params['height'])) {
            $height = $_image_data[1];
        }
    }
    return '<img src="' . $basedir . $image . '" alt="' . $alt . '" align="' . $align . '" border="' . $border . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />';
}
   Copyright (c) 2003 osCommerce
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */

/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );

if ($sPage != $aPages['account_history_info']) {
// Get last order id for checkout_success
    $orderstable = $oostable['orders'];
    $orders_result = $dbconn->Execute("SELECT orders_id FROM $orderstable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' ORDER BY orders_id desc limit 1");
    $orders = $orders_result->fields;
    $last_order = $orders['orders_id'];
} else {
    $last_order = oos_var_prep_for_os($_GET['order_id']);
}

// Now get all downloadable products in that order
// BOF: WebMakers.com Added: Downloads Controller
// DEFINE WHICH ORDERS_STATUS TO USE IN function_downloads_controller.php
// USE last_modified instead of date_purchased
$orderstable = $oostable['orders'];
$orders_productstable = $oostable['orders_products'];
$orders_products_downloadtable = $oostable['orders_products_download'];
$sql = "SELECT o.orders_status, date_format(o.last_modified, '%Y-%m-%d') AS date_purchased_day,
               opd.download_maxdays, op.products_name, opd.orders_products_download_id,
               opd.orders_products_filename, opd.download_count, opd.download_maxdays
        FROM $orderstable o,
             $orders_productstable op,
             $orders_products_downloadtable opd