function sendSMS() {

      $aPages = oos_get_pages();

      if ((isset($_GET['page'])) && ($_GET['page'] == $aPages['checkout_process'])) {
        $referer = OOS_HTTP_SERVER;
        $user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";

        $message = "\n";
        $message .= "New order\n";

        $geturl = 'http://www.fittcom.de/cgi/smssend.pl?appid=2&id=' . MODULE_ORDER_TOTAL_ORDER2SMS_ID . '&pw=' . MODULE_ORDER_TOTAL_ORDER2SMS_PASSWORD . '&dnr=' . urlencode(MODULE_ORDER_TOTAL_ORDER2SMS_DNR) . '&snr=' . urlencode(MODULE_ORDER_TOTAL_ORDER2SMS_SNR) . '&msg=' . urlencode($message) . '&msgtype=text&deliverynotify=1&confirmemail=' . MODULE_ORDER_TOTAL_ORDER2SMS_SENDEREMAIL;

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_REFERER, $referer);
        curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
        curl_setopt($ch, CURLOPT_URL,"$geturl");
        curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
        curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
        curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
        $pre_result = curl_exec ($ch);
        curl_close ($ch);

      }
    }
function smarty_function_oos_back_link($params, &$smarty)
{

  $aPages = oos_get_pages();

  if (count($_SESSION['navigation']->path)-2 > 0) {
    $back = count($_SESSION['navigation']->path)-2;
    $link = oos_href_link($_SESSION['navigation']->path[$back]['page'], $_SESSION['navigation']->path[$back]['get'].'&history_back=true', $_SESSION['navigation']->path[$back]['mode']);
  } else {
    if (isset($_SERVER['HTTP_REFERER']) && strstr(HTTP_SERVER, $_SERVER['HTTP_REFERER'])) {
      $link = $_SERVER['HTTP_REFERER'];
    } else {
      $link = oos_href_link($aPages['main']);
    }
  }

  while ( (substr($link, -5) == '&') || (substr($link, -1) == '?') ) {
    if (substr($link, -1) == '?') {
      $link = substr($link, 0, -1);
    } else {
      $link = substr($link, 0, -5);
    }
  }

  return $link;

}
 function create_plugin_instance()
 {
     $aPages = oos_get_pages();
     if (isset($_GET['page']) && $_GET['page'] != $aPages['info_down_for_maintenance']) {
         MyOOS_CoreApi::redirect(oos_href_link($aPages['info_down_for_maintenance'], '', 'NONSSL', true, false));
     }
     return true;
 }
 function create_plugin_instance()
 {
     if (!isset($_SESSION['customer_id']) || !is_numeric($_SESSION['customer_id'])) {
         $aPages = oos_get_pages();
         if (isset($_GET['page']) && $_GET['page'] != $aPages['login']) {
             $_SESSION['navigation']->set_snapshot();
             MyOOS_CoreApi::redirect(oos_href_link($aPages['login'], '', 'SSL'));
         }
     }
     return true;
 }
/**
 * Smarty {css_back_button} function plugin
 *
 * Type:     function
 * Name:     css_back_button
 * @Version:  $Revision: 1.1 $ - changed by $Author: r23 $ on $Date: 2008/01/09 22:03:20 $
 */

function smarty_function_css_back_button($params, &$smarty)
{
    global $oEvent, $spider_kill_sid;

    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');

    $title = '';
    $color = 'btnR green';


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

        case 'title':
            $$_key = (string)$_val;
            break;

        case 'color':
            $$_key = (string)$_val;
            break;

        default:
          break;
       }
    }

    $aPages = oos_get_pages();

    if (count($_SESSION['navigation']->path)-2 > 0) {
      $back = count($_SESSION['navigation']->path)-2;
      $link = oos_href_link($_SESSION['navigation']->path[$back]['page'], $_SESSION['navigation']->path[$back]['get'].'&history_back=true', $_SESSION['navigation']->path[$back]['mode']);
    } else {
      if (strstr(HTTP_SERVER, $_SERVER['HTTP_REFERER'])) {
        $link = $_SERVER['HTTP_REFERER'];
      } else {
        $link = oos_href_link($aPages['main']);
      }
    }

    while ( (substr($link, -5) == '&') || (substr($link, -1) == '?') ) {
      if (substr($link, -1) == '?') {
        $link = substr($link, 0, -1);
      } else {
        $link = substr($link, 0, -5);
      }
    }


    $title = decode($title);

    return '<a href="' . $link . '" title="' . $title . '" class="' . $color . '">' . $title . '</a>';


  }
 function create_plugin_instance()
 {
     $aPages = oos_get_pages();
     if (isset($_GET['page']) && $_GET['page'] != $aPages['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 {product_info_link} function plugin
 *
 * Type:     function<br>
 * Name:     product_info_link<br>
 * Date:     Aug 24, 2004<br>
 * Purpose:  URL for the products info<br>
 * Input:<br>
 *         - products_id
 *
 * Examples: <{product_info_link products_id=17}>
 * Output:   http:// ... index.php?page=product_info&amp;products_id=17
 * @author   r23 <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_html_href_link()
 */
function smarty_function_product_info_link($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('function', 'html_href_link');
    $aPages = oos_get_pages();
    $result = array();
    $link_params = array();
    $link_params = array('page' => $aPages['product_info']);
    if (is_array($params)) {
        $result = array_merge($link_params, $params);
    } else {
        $smarty->trigger_error("products_info_link: extra attribute '{$params}' must an array", E_USER_NOTICE);
    }
    return smarty_function_html_href_link($result, $smarty);
}
 function sendFax()
 {
     global $email_order;
     $aPages = oos_get_pages();
     if (isset($_GET['page']) && $_GET['page'] == $aPages['checkout_process']) {
         $message = "\n";
         $message .= "sender: " . MODULE_ORDER_TOTAL_ORDER2SENDEREMAIL . "\n";
         $message .= "subject: order\n";
         $message .= "user: "******"\n";
         $message .= "password: "******"\n";
         $message .= "job: send\n";
         $message .= "faxnumber: " . MODULE_ORDER_TOTAL_ORDER2FAX_FAXNUMBER . "\n";
         $message .= "message: " . $email_order;
         $header = 'From: ' . MODULE_ORDER_TOTAL_ORDER2SENDEREMAIL . "\r\n" . 'Reply-To: ' . MODULE_ORDER_TOTAL_ORDER2SENDEREMAIL;
         mail('*****@*****.**', 'order', $message, $header);
     }
 }
 function create_plugin_instance()
 {
     global $oBreadcrumb, $aLang, $aCategoryPath;
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $aPages = oos_get_pages();
     // include the breadcrumb class and start the breadcrumb trail
     MyOOS_CoreApi::requireOnce('classes/class_breadcrumb.php');
     $oBreadcrumb = new breadcrumb();
     if (isset($_GET['page']) && $_GET['page'] == $aPages['main'] || !isset($_GET['page'])) {
         $oBreadcrumb->add($aLang['header_title_top'], oos_href_link($aPages['main']), bookmark);
     } else {
         $oBreadcrumb->add($aLang['header_title_top'], oos_href_link($aPages['main']));
     }
     // add category names or the manufacturer name to the breadcrumb trail
     if (isset($aCategoryPath) && count($aCategoryPath) > 0) {
         $nLanguageID = isset($_SESSION['language_id']) ? $_SESSION['language_id'] + 0 : 1;
         $nArrayCountCategoryPath = count($aCategoryPath);
         $nCount = $nArrayCountCategoryPath;
         for ($i = 0, $n = $nArrayCountCategoryPath; $i < $n; $i++) {
             $nCount = $nCount - 1;
             $categories_descriptiontable = $oostable['categories_description'];
             $categories_sql = "SELECT categories_name\n                                   FROM {$categories_descriptiontable}\n                                   WHERE categories_id = '" . intval($aCategoryPath[$i]) . "'\n                                   AND categories_languages_id = '" . intval($nLanguageID) . "'";
             $categories = $dbconn->Execute($categories_sql);
             if ($categories->RecordCount() > 0) {
                 if (isset($_GET['page']) && $_GET['page'] == $aPages['shop'] && $nCount == 0) {
                     $oBreadcrumb->add($categories->fields['categories_name'], oos_href_link($aPages['shop'], 'categories=' . implode('_', array_slice($aCategoryPath, 0, $i + 1))), bookmark);
                 } else {
                     $oBreadcrumb->add($categories->fields['categories_name'], oos_href_link($aPages['shop'], 'categories=' . implode('_', array_slice($aCategoryPath, 0, $i + 1))));
                 }
             } else {
                 break;
             }
         }
     } elseif (isset($_GET['manufacturers_id']) && is_numeric($_GET['manufacturers_id'])) {
         $manufacturers_id = intval($_GET['manufacturers_id']);
         $manufacturerstable = $oostable['manufacturers'];
         $manufacturers_sql = "SELECT manufacturers_name\n                                  FROM {$manufacturerstable}\n                                  WHERE manufacturers_id = '" . intval($manufacturers_id) . "'";
         $manufacturers = $dbconn->Execute($manufacturers_sql);
         if ($manufacturers->RecordCount() > 0) {
             $oBreadcrumb->add($aLang['header_title_catalog'], oos_href_link($aPages['shop']));
             $oBreadcrumb->add($manufacturers->fields['manufacturers_name'], oos_href_link($aPages['shop'], 'manufacturers_id=' . intval($_GET['manufacturers_id'])), bookmark);
         }
     }
     return true;
 }
Beispiel #10
0
/**
 * Return a customer greeting
 *
 * @return string
 */
function oos_customer_greeting()
{
    global $aLang;
    $aPages = oos_get_pages();
    $personal_text = '';
    if (isset($_SESSION['customer_lastname']) && ACCOUNT_GENDER == '1') {
        if ($_SESSION['customer_gender'] == 'm') {
            $personal_text = $aLang['male_address'] . ' ' . $_SESSION['customer_lastname'];
        } else {
            $personal_text = $aLang['female_address'] . ' ' . $_SESSION['customer_lastname'];
        }
    }
    if (isset($_SESSION['customer_lastname']) && isset($_SESSION['customer_id'])) {
        $sGreeting = sprintf($aLang['text_greeting_personal'], $personal_text, oos_href_link($aPages['products_new']));
    } else {
        $sGreeting = sprintf($aLang['text_greeting_guest'], oos_href_link($aPages['login'], '', 'SSL'), oos_href_link($aPages['create_account'], '', 'SSL'));
    }
    return $sGreeting;
}
/**
 * Protects better diverse attempts of Cross-Site Scripting
 * attacks, thanks to webmedic, Timax, larsneo.
 *
 * Lets validate the current php version and set globals
 * accordingly.
 * Do not change this value unless you know what you are
 * doing you have been warned!
 */
function oos_secure_input()
{
    $aPages = oos_get_pages();
    # Cross-Site Scripting attack defense - Sent by larsneo
    # some syntax checking against injected javascript
    # extended by Neo
    /**
     * Lets now sanitize the GET vars
     */
    if (count($_GET) > 0) {
        foreach ($_GET as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) || eregi(".*[[:space:]](or|and)[[:space:]].*(=|like).*", $secvalue) || eregi("<[^>]*object*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta*\"?[^>]*>", $secvalue) || eregi("<[^>]*style*\"?[^>]*>", $secvalue) || eregi("<[^>]*form*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert*\"?[^>]*>", $secvalue) || eregi("<[^>]*img*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie*\"?[^>]*>", $secvalue) || eregi("\"", $secvalue)) {
                    MyOOS_CoreApi::redirect(oos_href_link($aPages['main']));
                }
            }
        }
    }
    /**
     * Lets now sanitize the POST vars
     */
    if (count($_POST) > 0) {
        foreach ($_POST as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) || eregi("<[^>]*object*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) {
                    MyOOS_CoreApi::redirect(oos_href_link($aPages['main']));
                }
            }
        }
    }
    /**
     * Lets now sanitize the COOKIE vars
     */
    if (count($_COOKIE) > 0) {
        foreach ($_COOKIE as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) || eregi(".*[[:space:]](or|and)[[:space:]].*(=|like).*", $secvalue) || eregi("<[^>]*object*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta*\"?[^>]*>", $secvalue) || eregi("<[^>]*style*\"?[^>]*>", $secvalue) || eregi("<[^>]*form*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie*\"?[^>]*>", $secvalue) || eregi("<[^>]*img*\"?[^>]*>", $secvalue)) {
                    MyOOS_CoreApi::redirect(oos_href_link($aPages['main']));
                }
            }
        }
    }
}
 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 process_button()
 {
     global $oOrder, $oCurrencies;
     if (MODULE_PAYMENT_MONEYBOOKERS_LANGUAGE == 'Selected Language') {
         $my_language = 'EN';
     } else {
         $my_language = MODULE_PAYMENT_MONEYBOOKERS_LANGUAGE;
     }
     if (MODULE_PAYMENT_MONEYBOOKERS_CURRENCY == 'Selected Currency') {
         $my_currency = $_SESSION['currency'];
     } else {
         $my_currency = substr(MODULE_PAYMENT_MONEYBOOKERS_CURRENCY, 5);
     }
     if (!in_array($my_currency, array('EUR', 'USD', 'GBP', 'HKD', 'SGD', 'JPY', 'CAD', 'AUD', 'CHF', 'DKK', 'SEK', 'NOK', 'ILS', 'MYR', 'NZD', 'TWD', 'THB', 'CZK', 'HUF', 'SKK', 'ISK', 'INR'))) {
         $my_currency = 'EUR';
     }
     $aPages = oos_get_pages();
     $process_button_string = oos_draw_hidden_field('pay_to_email', MODULE_PAYMENT_MONEYBOOKERS_ID) . oos_draw_hidden_field('language', $my_language) . oos_draw_hidden_field('amount', number_format($oOrder->info['total'] * $oCurrencies->get_value($my_currency), $oCurrencies->get_decimal_places($my_currency))) . oos_draw_hidden_field('currency', $my_currency) . oos_draw_hidden_field('detail1_description', STORE_NAME) . oos_draw_hidden_field('detail1_text', 'Order - ' . date('d. M Y - H:i')) . oos_draw_hidden_field('firstname', $oOrder->billing['firstname']) . oos_draw_hidden_field('lastname', $oOrder->billing['lastname']) . oos_draw_hidden_field('address', $oOrder->billing['street_address']) . oos_draw_hidden_field('postal_code', $oOrder->billing['postcode']) . oos_draw_hidden_field('city', $oOrder->billing['city']) . oos_draw_hidden_field('country', $oOrder->billing['country']['moneybookers']) . oos_draw_hidden_field('pay_from_email', $oOrder->customer['email_address']) . oos_draw_hidden_field('return', oos_href_link($aPages['checkout_process'], '', 'SSL')) . oos_draw_hidden_field('cancel_return', oos_href_link($aPages['checkout_payment'], '', 'SSL'));
     return $process_button_string;
 }
/**
 * Smarty {categories_link} function plugin
 *
 * Type:     function<br>
 * Name:     categories_link<br>
 * Date:     Oct 27, 2008<br>
 * Purpose:  URL for the categorie info<br>
 * Input:<br>
 *         - categories
 *
 * Examples: {categories_link categories=17}
 * Output:   http:// ... index.php?page=shop&amp;categories=17
 * @author   r23 <*****@*****.**>
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_html_href_link()
 */
function smarty_function_categories_link($params, &$smarty)
{

  MyOOS_CoreApi::requireOnce('lib/smarty-plugins/myoos/function.html_href_link.php');

  $aPages = oos_get_pages();

  $result = array();
  $link_params = array();
  $link_params = array('page' => $aPages['shop']);

  if (is_array($params)) {
    $result = array_merge($link_params, $params);
  } else {
    $smarty->trigger_error("categories_link: extra attribute '$params' must an array", E_USER_NOTICE);
  }

  return smarty_function_html_href_link($result, $smarty);

}
Beispiel #15
0
 function collect_posts()
 {
     global $oCurrencies, $coupon_no, $aLang;
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $aPages = oos_get_pages();
     if ($_POST['gv_redeem_code']) {
         $couponstable = $oostable['coupons'];
         $gv_query = $dbconn->Execute("SELECT coupon_id, coupon_type, coupon_amount FROM {$couponstable} WHERE coupon_code = '" . oos_db_input($_POST['gv_redeem_code']) . "'");
         $gv_result = $gv_query->fields;
         if ($gv_query->RecordCount() != 0) {
             $coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
             $redeem_query = $dbconn->Execute("SELECT * FROM {$coupon_redeem_tracktable} WHERE coupon_id = '" . $gv_result['coupon_id'] . "'");
             if ($redeem_query->RecordCount() != 0 && $gv_result['coupon_type'] == 'G') {
                 $_SESSION['error_message'] = $aLang['error_no_invalid_redeem_gv'];
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
             }
         }
         if ($gv_result['coupon_type'] == 'G') {
             $gv_amount = $gv_result['coupon_amount'];
             // Things to set
             // ip address of claimant
             // customer id of claimant
             // date
             // redemption flag
             // now update customer account with gv_amount
             $coupon_gv_customertable = $oostable['coupon_gv_customer'];
             $gv_amount_query = $dbconn->Execute("SELECT amount FROM {$coupon_gv_customertable} WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
             $customer_gv = false;
             $total_gv_amount = $gv_amount;
             if ($gv_amount_result = $gv_amount_query->fields) {
                 $total_gv_amount = $gv_amount_result['amount'] + $gv_amount;
                 $customer_gv = true;
             }
             $couponstable = $oostable['coupons'];
             $gv_update = $dbconn->Execute("UPDATE {$couponstable}\n                                         SET coupon_active = 'N'\n                                         WHERE coupon_id = '" . $gv_result['coupon_id'] . "'");
             $remote_addr = $_SESSION['session_ip_address'];
             $coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
             $gv_redeem = $dbconn->Execute("INSERT INTO  {$coupon_redeem_tracktable}\n                                        (coupon_id,\n                                         customer_id,\n                                         redeem_date,\n                                         redeem_ip) VALUES ('" . $gv_result['coupon_id'] . "',\n                                                            '" . intval($_SESSION['customer_id']) . "',\n                                                            '" . date("Y-m-d H:i:s", time()) . "',\n                                                            '" . oos_db_input($remote_addr) . "')");
             if ($customer_gv) {
                 $coupon_gv_customertable = $oostable['coupon_gv_customer'];
                 // already has gv_amount so update
                 $gv_update = $dbconn->Execute("UPDATE {$coupon_gv_customertable}\n                                           SET amount = '" . $total_gv_amount . "'\n                                           WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
             } else {
                 // no gv_amount so insert
                 $coupon_gv_customertable = $oostable['coupon_gv_customer'];
                 $gv_insert = $dbconn->Execute("INSERT INTO {$coupon_gv_customertable}\n                                           (customer_id,\n                                            amount) VALUES ('" . intval($_SESSION['customer_id']) . "',\n                                                            '" . $total_gv_amount . "')");
             }
             $_SESSION['error_message'] = $aLang['error_redeemed_amount'] . $oCurrencies->format($gv_amount);
             MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
         }
     }
     if ($_POST['submit_redeem_x'] && $gv['coupon_type'] == 'G') {
         MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], 'error_message=' . urlencode(decode($aLang['error_no_redeem_code'])), 'SSL'));
     }
 }
    function create_plugin_instance() {
      global $request_type, $spider_flag, $spider_kill_sid;

      $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
      $spider_flag = false;
      $spider_kill_sid = '0';

      // set the top level domains
      $http_domain = oos_server_get_top_level_domain(OOS_HTTP_SERVER);
      $https_domain = oos_server_get_top_level_domain(OOS_HTTPS_SERVER);
      $current_domain = (($request_type == 'NONSSL') ? $http_domain : $https_domain);

      // set the session cookie parameters
      if (function_exists('session_set_cookie_params')) {
        session_set_cookie_params(0, '/', (!empty($current_domain) ? '.' . $current_domain : ''));
      } elseif (function_exists('ini_set')) {
        ini_set('session.cookie_lifetime', '0');
        ini_set('session.cookie_path', '/');
        ini_set('session.cookie_domain', (!empty($current_domain) ? '.' . $current_domain : ''));
      }

      // set the session ID if it exists
      if (isset($_POST[oos_session_name()]) && (ctype_alnum($_POST[oos_session_name()]))) {
        oos_session_id($_POST[oos_session_name()]);
      } elseif (isset($_GET[oos_session_name()]) && (ctype_alnum($_GET[oos_session_name()]))) {
        oos_session_id($_GET[oos_session_name()]);
      }

      if (empty($user_agent) === false) {
        $spider_agent = @parse_ini_file('includes/ini/spiders.ini');

        foreach ($spider_agent as $spider) {
           if (empty($spider) === false) {
             if (strpos($user_agent, trim($spider)) !== false) {
                $spider_kill_sid = '1';
                $spider_flag = true;
                break;
             }
           }
         }
      }

      if ($spider_flag === false) {

        // lets start our session
        oos_session_start();
      }

      if (!isset($_SESSION)) {
        $_SESSION = array();
      }

      // create the shopping cart
      if (!isset($_SESSION['cart'])) {
        $_SESSION['cart'] = new shoppingCart;
      }

      // navigation history
      if (!isset($_SESSION['navigation'])) {
        $_SESSION['navigation'] = new oosNavigationHistory;
      }

      if (!isset($_SESSION['error_cart_msg'])) {
        $_SESSION['error_cart_msg'] = '';
      }

      $aPages = oos_get_pages();

      // verify the browser user agent
      $http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';

      if (!isset($_SESSION['session_user_agent'])) {
        $_SESSION['session_user_agent'] = $http_user_agent;
      }

      if ($_SESSION['session_user_agent'] != $http_user_agent) {
        unset($_SESSION['customer_id']);
        unset($_SESSION['session_user_agent']);
        $_SESSION['cart']->reset();
        $_SESSION['member']->default_member();

        MyOOS_CoreApi::redirect(oos_href_link($aPages['login'], '', 'SSL'));
      }

      // verify the IP address
      if (!isset($_SESSION['session_ip_address'])) {
        $_SESSION['session_ip_address'] = MyOOS_Utilities::getRemoteHostAddress();
      }

      if ($_SESSION['session_ip_address'] != MyOOS_Utilities::getRemoteHostAddress()) {
        unset($_SESSION['customer_id']);
        unset($_SESSION['session_ip_address']);
        $_SESSION['cart']->reset();
        $_SESSION['member']->default_member();

        MyOOS_CoreApi::redirect(oos_href_link($aPages['login'], '', 'SSL'));
      }

      return true;
    }
    function create_plugin_instance() {
      global $request_type, $spider_flag, $spider_kill_sid;

      $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
      $spider_flag = false;
      $spider_kill_sid = '0';

      // set the top level domains
      $http_domain = oos_server_get_top_level_domain(OOS_HTTP_SERVER);
      $https_domain = oos_server_get_top_level_domain(OOS_HTTPS_SERVER);
      $current_domain = (($request_type == 'NONSSL') ? $http_domain : $https_domain);

      // set the session cookie parameters
      if (function_exists('session_set_cookie_params')) {
        session_set_cookie_params(0, '/', (!empty($current_domain) ? '.' . $current_domain : ''));
      } elseif (function_exists('ini_set')) {
        ini_set('session.cookie_lifetime', '0');
        ini_set('session.cookie_path', '/');
        ini_set('session.cookie_domain', (!empty($current_domain) ? '.' . $current_domain : ''));
      }

      // set the session ID if it exists
      if (isset($_POST[oos_session_name()]) && (ctype_alnum($_POST[oos_session_name()]))) {
        oos_session_id($_POST[oos_session_name()]);
      } elseif (isset($_GET[oos_session_name()]) && (ctype_alnum($_GET[oos_session_name()]))) {
        oos_session_id($_GET[oos_session_name()]);
      }

      if (empty($user_agent) === false) {
        $spider_agent = @parse_ini_file('includes/ini/spiders.ini');

        foreach ($spider_agent as $spider) {
           if (empty($spider) === false) {
             if (strpos($user_agent, trim($spider)) !== false) {
                $spider_kill_sid = '1';
                $spider_flag = true;
                break;
             }
           }
         }
      }

      if ($spider_flag === false) {
          if (!defined('MYOOS_SESSION_NAME'))
          {
              define('MYOOS_SESSION_NAME', 'MYOOS_SESSID');
          }

          @ini_set('session.name', MYOOS_SESSION_NAME);
          if(ini_get('session.save_handler') == 'user')
          {
              @ini_set('session.save_handler', 'files');
              @ini_set('session.save_path', '');
          }
          if(ini_get('session.save_handler') == 'files')
          {
              $sessionPath = ini_get('session.save_path');
              if (preg_match('/^[0-9]+;(.*)/', $sessionPath, $matches))
              {
                  $sessionPath = $matches[1];
              }
              if (ini_get('safe_mode') || ini_get('open_basedir') || empty($sessionPath) || !@is_writable($sessionPath))
              {
                  $sessionPath = MYOOS_USER_PATH . '/tmp/sessions';
                  @ini_set('session.save_path', $sessionPath);
                  if (!is_dir($sessionPath))
                  {
                      @mkdir($sessionPath, 0755, true);
                      if (!is_dir($sessionPath))
                      {
                          die("Error: Unable to mkdir $sessionPath");
                      }
                  }
                  elseif (!@is_writable($sessionPath))
                  {
                      die("Error: $sessionPath is not writable");
                  }
              }
          }
          // lets start our session
          oos_session_start();
      }

      if (!isset($_SESSION)) {
        $_SESSION = array();
      }

      // create the shopping cart
      if (!isset($_SESSION['cart'])) {
        $_SESSION['cart'] = new shoppingCart;
      }

      // navigation history
      if (!isset($_SESSION['navigation'])) {
        $_SESSION['navigation'] = new oosNavigationHistory;
      }

      $aPages = oos_get_pages();

      // verify the browser user agent
      $http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';

      if (!isset($_SESSION['session_user_agent'])) {
        $_SESSION['session_user_agent'] = $http_user_agent;
      }

      if ($_SESSION['session_user_agent'] != $http_user_agent) {
        unset($_SESSION['customer_id']);
        unset($_SESSION['session_user_agent']);
        $_SESSION['cart']->reset();
        $_SESSION['member']->default_member();

        MyOOS_CoreApi::redirect(oos_href_link($aPages['login'], '', 'SSL'));
      }

      // verify the IP address
      if (!isset($_SESSION['session_ip_address'])) {
        $_SESSION['session_ip_address'] = MyOOS_Utilities::getRemoteHostAddress();
      }

      if ($_SESSION['session_ip_address'] != MyOOS_Utilities::getRemoteHostAddress()) {
        unset($_SESSION['customer_id']);
        unset($_SESSION['session_ip_address']);
        $_SESSION['cart']->reset();
        $_SESSION['member']->default_member();

        MyOOS_CoreApi::redirect(oos_href_link($aPages['login'], '', 'SSL'));
      }

      return true;
    }
Beispiel #18
0
    function before_process() {
      global $aLang;

      if (!isset($_GET['transStatus']) && $transStatus != "Y") {
        $error = $aLang['module_payment_worldpay_text_error_1'];
        $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error);

        $aPages = oos_get_pages();

        MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], $payment_error_return, 'SSL', true, false));
      }
    }
    /**
     * Redirect to another page or site
     *
     * @param string $sUrl
     * @return string
     */
    function redirect($sUrl)
    {

        if ( ( strpos($sUrl, "\n") !== false ) || ( strpos($sUrl, "\r") !== false ) ) {
            $aPages = oos_get_pages();
	        $sUrl = oos_href_link($aPages['main'], null, 'NONSSL', false);
        }

        if ( strpos($sUrl, '&amp;') !== false ) {
            $sUrl = str_replace('&amp;', '&', $sUrl);
        }

        header('Location: ' . $sUrl);
        oos_exit();
    }
Beispiel #20
0
    function process_button() {
      global $oOrder, $oCurrencies;

      switch (MODULE_PAYMENT_IPAYMENT_CURRENCY) {
        case 'Always EUR':
          $trx_currency = 'EUR';
          break;
        case 'Always USD':
          $trx_currency = 'USD';
          break;
        case 'Either EUR or USD, else EUR':
          if ( ($_SESSION['currency'] == 'EUR') || ($_SESSION['currency'] == 'USD') ) {
            $trx_currency = $_SESSION['currency'];
          } else {
            $trx_currency = 'EUR';
          }
          break;
        case 'Either EUR or USD, else USD':
          if ( ($_SESSION['currency'] == 'EUR') || ($_SESSION['currency'] == 'USD') ) {
            $trx_currency = $_SESSION['currency'];
          } else {
            $trx_currency = 'USD';
          }
          break;
      }

      $aPages = oos_get_pages();

      $process_button_string = oos_draw_hidden_field('silent', '1') .
                               oos_draw_hidden_field('trx_paymenttyp', 'cc') .
                               oos_draw_hidden_field('trxuser_id', MODULE_PAYMENT_IPAYMENT_USER_ID) .
                               oos_draw_hidden_field('trxpassword', MODULE_PAYMENT_IPAYMENT_PASSWORD) .
                               oos_draw_hidden_field('item_name', STORE_NAME) .
                               oos_draw_hidden_field('trx_currency', $trx_currency) .
                               oos_draw_hidden_field('trx_amount', number_format($oOrder->info['total'] * 100 * $oCurrencies->get_value($trx_currency), 0, '','')) .
                               oos_draw_hidden_field('cc_expdate_month', $_POST['ipayment_cc_expires_month']) .
                               oos_draw_hidden_field('cc_expdate_year', $_POST['ipayment_cc_expires_year']) .
                               oos_draw_hidden_field('cc_number', $_POST['ipayment_cc_number']) .
                               oos_draw_hidden_field('cc_checkcode', $_POST['ipayment_cc_checkcode']) .
                               oos_draw_hidden_field('addr_name', $_POST['ipayment_cc_owner']) .
                               oos_draw_hidden_field('addr_email', $oOrder->customer['email_address']) .
                               oos_draw_hidden_field('redirect_url', oos_href_link($aPages['checkout_process'], '', 'SSL', true)) .
                               oos_draw_hidden_field('silent_error_url', oos_href_link($aPages['checkout_payment'], 'payment_error=' . $this->code . '&ipayment_cc_owner=' . urlencode($_POST['ipayment_cc_owner']), 'SSL', true));

      return $process_button_string;
    }
Beispiel #21
0
    function process_button() {
      global $oOrder, $oCurrencies;

      $aPages = oos_get_pages();

      $process_button_string = oos_draw_hidden_field('cmd', '_xclick') .
                               oos_draw_hidden_field('email', MODULE_PAYMENT_NOCHEX_ID) .
                               oos_draw_hidden_field('amount', number_format($oOrder->info['total'] * $oCurrencies->currencies['GBP']['value'], $oCurrencies->currencies['GBP']['decimal_places'])) .
                               oos_draw_hidden_field('ordernumber', $_SESSION['customer_id'] . '-' . date('Ymdhis')) .
                               oos_draw_hidden_field('returnurl', oos_href_link($aPages['checkout_process'], '', 'SSL')) .
                               oos_draw_hidden_field('cancel_return', oos_href_link($aPages['checkout_payment'], '', 'SSL'));

      return $process_button_string;
    }
    function before_process() {
      global $aLang;

      $aPages = oos_get_pages();

      if ($_POST['x_response_code'] == '1') return;
      if ($_POST['x_response_code'] == '2') {
        $_SESSION['error_message'] = $aLang['module_payment_authorizenet_text_declined_message'];

        MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL', true, false));
      }
      // Code 3 is an error - but anything else is an error too (IMHO)
      $_SESSION['error_message'] = $aLang['module_payment_authorizenet_text_error_message'];
      MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL', true, false));
    }
Beispiel #23
0
 function collect_posts()
 {
     global $oCurrencies, $aLang;
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $aPages = oos_get_pages();
     if ($_POST['gv_redeem_code']) {
         // get some info from the coupon table
         $couponstable = $oostable['coupons'];
         $sql = "SELECT coupon_id, coupon_amount, coupon_type, coupon_minimum_order,\n                     uses_per_coupon, uses_per_user, restrict_to_products,\n                     restrict_to_categories\n              FROM {$couponstable}\n              WHERE coupon_code = '" . oos_db_input($_POST['gv_redeem_code']) . "'\n                AND coupon_active = 'Y'";
         $coupon_query = $dbconn->Execute($sql);
         $coupon_result = $coupon_query->fields;
         if ($coupon_result['coupon_type'] != 'G') {
             if ($coupon_query->RecordCount() == 0) {
                 $_SESSION['error_message'] = $aLang['error_no_invalid_redeem_coupon'];
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
             }
             $couponstable = $oostable['coupons'];
             $sql = "SELECT coupon_start_date\n                FROM {$couponstable}\n                WHERE coupon_start_date <= '" . date("Y-m-d H:i:s", time()) . "'\n                AND   coupon_code= '" . oos_db_input($_POST['gv_redeem_code']) . "'";
             $date_query = $dbconn->Execute($sql);
             if ($date_query->RecordCount() == 0) {
                 $_SESSION['error_message'] = $aLang['error_invalid_startdate_coupon'];
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
             }
             $couponstable = $oostable['coupons'];
             $sql = "SELECT coupon_expire_date\n                FROM {$couponstable}\n                WHERE coupon_expire_date >= '" . date("Y-m-d H:i:s", time()) . "'\n                AND   coupon_code= '" . oos_db_input($_POST['gv_redeem_code']) . "'";
             $date_query = $dbconn->Execute($sql);
             if ($date_query->RecordCount() == 0) {
                 $_SESSION['error_message'] = $aLang['error_invalid_finisdate_coupon'];
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
             }
             $coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
             $sql = "SELECT coupon_id\n                FROM {$coupon_redeem_tracktable}\n                WHERE coupon_id = '" . $coupon_result['coupon_id'] . "'";
             $coupon_count = $dbconn->Execute($sql);
             $coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
             $sql = "SELECT coupon_id\n                FROM {$coupon_redeem_tracktable}\n                WHERE coupon_id = '" . $coupon_result['coupon_id'] . "'\n                AND   customer_id = '" . intval($_SESSION['customer_id']) . "'";
             $coupon_count_customer = $dbconn->Execute($sql);
             if ($coupon_count->RecordCount() >= $coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {
                 $_SESSION['error_message'] = $aLang['error_invalid_uses_coupon'] . $coupon_result['uses_per_coupon'] . $aLang['times'];
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
             }
             if ($coupon_count_customer->RecordCount() >= $coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {
                 $_SESSION['error_message'] = $aLang['error_invalid_uses_user_coupon'] . $coupon_result['uses_per_user'] . $aLang['times'];
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
             }
             if ($coupon_result['coupon_type'] == 'S') {
                 $coupon_amount = $oOrder->info['shipping_cost'];
             } else {
                 $coupon_amount = $oCurrencies->format($coupon_result['coupon_amount']) . ' ';
             }
             if ($coupon_result['type'] == 'P') {
                 $coupon_amount = $coupon_result['coupon_amount'] . '% ';
             }
             if ($coupon_result['coupon_minimum_order'] > 0) {
                 $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order'];
             }
             $_SESSION['cc_id'] = $coupon_result['coupon_id'];
         }
         if ($_POST['submit_redeem_coupon_x'] && !$_POST['gv_redeem_code']) {
             $_SESSION['error_message'] = $aLang['error_no_invalid_redeem_coupon'];
             MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
         }
     }
 }
Beispiel #24
0
    function process_button() {
      global $oOrder, $oCurrencies;

      if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {
        $my_currency = $_SESSION['currency'];
      } else {
        $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);
      }
      if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
        $my_currency = 'EUR';
      }

      $aPages = oos_get_pages();

      $process_button_string = oos_draw_hidden_field('cmd', '_xclick') .
                               oos_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
                               oos_draw_hidden_field('item_name', oos_replace_chars(STORE_NAME)) .
                               oos_draw_hidden_field('amount', number_format(($oOrder->info['total'] - $oOrder->info['shipping_cost']) * $oCurrencies->get_value($my_currency), $oCurrencies->get_decimal_places($my_currency))) .
                               oos_draw_hidden_field('first_name', oos_replace_chars($oOrder->billing['firstname'])) .
                               oos_draw_hidden_field('last_name', oos_replace_chars($oOrder->billing['lastname'])) .
                               oos_draw_hidden_field('address1', oos_replace_chars($oOrder->billing['street_address'])) .
                               oos_draw_hidden_field('address2', oos_replace_chars($oOrder->billing['suburb'])) .
                               oos_draw_hidden_field('city', oos_replace_chars($oOrder->billing['city'])) .
                               oos_draw_hidden_field('state', oos_replace_chars($oOrder->billing['state'])) .
                               oos_draw_hidden_field('zip', $oOrder->billing['postcode']) .
                               oos_draw_hidden_field('lc', $oOrder->billing['country']['iso_code_2']) .
                               oos_draw_hidden_field('email', $oOrder->customer['email_address']) .
                               oos_draw_hidden_field('shipping', number_format($oOrder->info['shipping_cost'] * $oCurrencies->get_value($my_currency), $oCurrencies->get_decimal_places($my_currency))) .
                               oos_draw_hidden_field('currency_code', $my_currency) .
                               oos_draw_hidden_field('rm', '2') .
                               oos_draw_hidden_field('bn', 'OOS [OSIS Online Shop]') .
                               oos_draw_hidden_field('no_note', '1');
      $process_button_string .= '<input type="hidden" name="return" value="' . oos_href_link($aPages['checkout_process'], '', 'SSL') . '" >';
      $process_button_string .= '<input type="hidden" name="cancel_return" value="' . oos_href_link($aPages['checkout_payment'], '', 'SSL') . '" >';


      return $process_button_string;
    }
/**
 * 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">';
}
    function buildBranch($parent_id, $level = 0)
    {
        $result = $this->parent_group_start_string;

        $aPages = oos_get_pages();

        if (isset($this->data[$parent_id])) {
            foreach ($this->data[$parent_id] as $category_id => $category) {
                if ($this->breadcrumb_usage == true) {
                    $category_link = $this->buildBreadcrumb($category_id);
                } else {
                    $category_link = $category_id;
                }

                $sLink = '<a href="' . oos_href_link($aPages['shop'], 'categories=' . $category_link) . '" title="' . $category['name'] . '">';


                $result .= $this->child_start_string;

                if (isset($this->data[$category_id])) {
                    $result .= $this->parent_start_string;
                }

                if ($level == 0) {
                    $result .= $this->root_start_string;
                }

                $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level);

                if ($this->show_image_folder === true) {
                    $result .= $sLink;
                    if (in_array($category_id, $this->cpath_array)) {
                        $result .= oos_image_folder('current_folder.png', $category['name']);
                    } else {
                        $result .= oos_image_folder('folder.png', $category['name']);
                    }
                    $result .= '</a>&nbsp;';
                }

                $result .= $sLink;

                if ($this->follow_cpath === true) {
                    if (in_array($category_id, $this->cpath_array)) {
                        $result .= $this->cpath_start_string . $category['name'] . $this->cpath_end_string;
                    } else {
                        $result .= $category['name'];
                    }
                } else {
                    $result .= $category['name'];
                }
                $result .= '</a>';

                if ($this->show_category_product_count === true) {
                    $result .= $this->category_product_count_start_string . $category['count'] . $this->category_product_count_end_string;
                }

                if ($level == 0) {
                    $result .= $this->root_end_string;
                }

                if (isset($this->data[$category_id])) {
                    $result .= $this->parent_end_string;
                }

                $result .= $this->child_end_string;

                if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
                    if ($this->follow_cpath === true) {
                        if (in_array($category_id, $this->cpath_array)) {
                            $result .= $this->buildBranch($category_id, $level+1);
                        }
                    } else {
                        $result .= $this->buildBranch($category_id, $level+1);
                    }
                }
            }
        }

        $result .= $this->parent_group_end_string;

        return $result;
    }
Beispiel #27
0
    function pre_confirmation_check() {
      global $aLang;

      include 'includes/classes/class_cc_validation.php';

      $cc_validation = new cc_validation();
      $result = $cc_validation->validate($_POST['cc_number'], $_POST['cc_expires_month'], $_POST['cc_expires_year'], $_POST['cc_start_month'], $_POST['cc_start_year'], $_POST['cc_cvv'], $_POST['cc_issue']);

      $error = '';
     switch ($result) {
        case -1 :
          $error = sprintf($aLang['text_ccval_error_unknown_card'], substr($cc_validation->cc_number, 0, 4));
          break ;
        case -2 :
        case -3 :
        case -4 :
          $error = $aLang['text_ccval_error_invalid_date'];
          break;
        case -5 :
          $cards = '';
          if (MODULE_PAYMENT_CC_ACCEPT_VISA == '1')
            $cards .= ' Visa,';
          if (MODULE_PAYMENT_CC_ACCEPT_MASTERCARD == '1')
            $cards .= ' Master Card,';
          if (MODULE_PAYMENT_CC_ACCEPT_AMERICANEXPRESS == '1')
            $cards .= ' American Express,';
          if (MODULE_PAYMENT_CC_ACCEPT_DINERSCLUB == '1')
            $cards .= ' Diners Club,';
          if (MODULE_PAYMENT_CC_ACCEPT_DISCOVERNOVUS == '1')
            $cards .= ' Discover,';
          if (MODULE_PAYMENT_CC_ACCEPT_JCB == '1')
            $cards .= ' JCB,';
          if (MODULE_PAYMENT_CC_ACCEPT_OZBANKCARD == '1')
            $cards .= ' Australian BankCard,';
          $error = sprintf($aLang['text_card_not_aczepted'], $cc_validation->cc_type).$cards;
          break;

        case false:
          $error = $aLang['text_ccval_error_invalid_number'];
          break;
      }


      if ( ($result == false) || ($result < 1) ) {
        $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&cc_owner=' . urlencode($_POST['cc_owner']) . '&cc_expires_month=' . $_POST['cc_expires_month'] . '&cc_expires_year=' . $_POST['cc_expires_year'];

        $aPages = oos_get_pages();
        MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], $payment_error_return, 'SSL', true, false));
      }

	  if (USE_CC_CVV != '1') {
        $this->cc_cvv = '000';
      }

      $this->cc_card_type = $cc_validation->cc_type;
      $this->cc_card_number = $cc_validation->cc_number;
    }
 function pre_confirmation_check()
 {
     global $banktransfer_number, $banktransfer_blz, $aLang;
     if ($_POST['banktransfer_fax'] == false) {
         include 'includes/classes/class_banktransfer_validation.php';
         $banktransfer_validation = new AccountCheck();
         $banktransfer_result = $banktransfer_validation->CheckAccount($banktransfer_number, $banktransfer_blz);
         if ($banktransfer_result > 0 || $_POST['banktransfer_owner'] == '') {
             if ($_POST['banktransfer_owner'] == '') {
                 $error = 'Name des Kontoinhabers fehlt!';
                 $recheckok = '';
             } else {
                 switch ($banktransfer_result) {
                     case 1:
                         // number & blz not ok
                         $error = $aLang['module_payment_banktransfer_text_bank_error_1'];
                         $recheckok = '1';
                         break;
                     case 5:
                         // BLZ not found
                         $error = $aLang['module_payment_banktransfer_text_bank_error_5'];
                         $recheckok = '1';
                         break;
                     case 8:
                         // no blz entered
                         $error = $aLang['module_payment_banktransfer_text_bank_error_8'];
                         $recheckok = '';
                         break;
                     case 9:
                         // no number entered
                         $error = $aLang['module_payment_banktransfer_text_bank_error_9'];
                         $recheckok = '';
                         break;
                     default:
                         $error = $aLang['module_payment_banktransfer_text_bank_error_4'];
                         $recheckok = '1';
                         break;
                 }
             }
             if ($_POST['recheckok'] != '1') {
                 $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&banktransfer_owner=' . urlencode($_POST['banktransfer_owner']) . '&banktransfer_number=' . urlencode($_POST['banktransfer_number']) . '&banktransfer_blz=' . urlencode($_POST['banktransfer_blz']) . '&banktransfer_bankname=' . urlencode($_POST['banktransfer_bankname']) . '&recheckok=' . $recheckok;
                 $aPages = oos_get_pages();
                 MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], $payment_error_return, 'SSL', true, false));
             }
         }
         $this->banktransfer_owner = oos_prepare_input($_POST['banktransfer_owner']);
         $this->banktransfer_blz = oos_prepare_input($_POST['banktransfer_blz']);
         $this->banktransfer_number = oos_prepare_input($_POST['banktransfer_number']);
         $this->banktransfer_prz = $banktransfer_validation->PRZ;
         $this->banktransfer_status = $banktransfer_result;
         if ($banktransfer_validation->Bankname != '') {
             $this->banktransfer_bankname = $banktransfer_validation->Bankname;
         } else {
             $this->banktransfer_bankname = oos_prepare_input($_POST['banktransfer_bankname']);
         }
     }
 }
 /**
  * Funciton to generate category sitemap data
  *
  * @return boolean
  */
 function GenerateCategorySitemap()
 {
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $aPages = oos_get_pages();
     $categoriestable = $oostable['categories'];
     $sql = "SELECT categories_id as cID, date_added, last_modified as last_mod\n                 FROM {$categoriestable}\n                 WHERE categories_status = '1'\n                   AND access = '0'\n                 ORDER BY parent_id ASC, sort_order ASC, categories_id ASC";
     if ($categories_query = $dbconn->Execute($sql)) {
         $this->debug['QUERY']['CATEOGRY']['STATUS'] = 'success';
         $this->debug['QUERY']['CATEOGRY']['NUM_ROWS'] = $categories_query->RecordCount();
         $container = array();
         $number = 0;
         while ($result = $categories_query->fields) {
             $location = oos_href_link($aPages['shop'], 'categories=' . $this->GetFullcategories($result['cID']), 'NONSSL', false, true);
             $lastmod = oos_is_not_null($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
             $changefreq = GOOGLE_SITEMAP_CAT_CHANGE_FREQ;
             $priority = 0.5;
             $container[] = array('loc' => htmlspecialchars(utf8_encode($location)), 'lastmod' => date("Y-m-d", strtotime($lastmod)), 'changefreq' => $changefreq, 'priority' => $priority);
             if (sizeof($container) >= 50000) {
                 $type = $number == 0 ? 'categories' : 'categories' . $number;
                 $this->GenerateSitemap($container, $type);
                 $container = array();
                 $number++;
             }
             // Move that ADOdb pointer!
             $categories_query->MoveNext();
         }
         if (sizeof($container) > 1) {
             $type = $number == 0 ? 'categories' : 'categories' . $number;
             return $this->GenerateSitemap($container, $type);
         }
     } else {
         $this->debug['QUERY']['CATEOGRY']['STATUS'] = '0';
         $this->debug['QUERY']['CATEOGRY']['NUM_ROWS'] = '0';
     }
 }
/**
 * Display a banner from the specified group or banner id ($identifier)
 *
 * @param $action
 * @param $identifier
 * @return string
 */
function oos_display_banner($action, $identifier)
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $aPages = oos_get_pages();
    if ($action == 'dynamic') {
        $bannerstable = $oostable['banners'];
        $banners = $dbconn->Execute("SELECT COUNT(*) AS total FROM {$bannerstable} WHERE status = '1' AND banners_group = '" . oos_db_input($identifier) . "'");
        if ($banners->fields['total'] > 0) {
            $bannerstable = $oostable['banners'];
            $banner = oos_random_select("SELECT banners_id, banners_title, banners_image, banners_html_text FROM {$bannerstable} WHERE status = '1' AND banners_group = '" . oos_db_input($identifier) . "'");
        } else {
            trigger_error("oos_display_banner(' . {$action} . ', ' . {$identifier} . ') -> No banners with group \\'' . {$identifier} . '\\' found!", E_USER_ERROR);
            return false;
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $bannerstable = $oostable['banners'];
            $banner_result = $dbconn->Execute("SELECT banners_id, banners_title, banners_image, banners_html_text FROM {$bannerstable} WHERE status = '1' AND banners_id = '" . oos_db_input($identifier) . "'");
            if ($banner_result->RecordCount() > 0) {
                $banner = $banner_result->fields;
            } else {
                trigger_error("oos_display_banner(' . {$action} . ', ' . {$identifier} . ') -> Banner with ID \\'' . {$identifier} . '\\' not found, or status inactive", E_USER_ERROR);
                return false;
            }
        }
    } else {
        trigger_error("oos_display_banner(' . {$action} . ', ' . {$identifier} . ') -> Unknown {$action} parameter value - it must be either \\'dynamic\\' or \\'static\\'", E_USER_ERROR);
        return false;
    }
    if (oos_is_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = '<a href="' . oos_href_link($aPages['redirect'], 'action=banner&amp;goto=' . $banner['banners_id']) . '" target="_blank">' . oos_image(OOS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';
    }
    oos_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}