Ejemplo n.º 1
0
/**
 * Return a random row from a database query
 *
 * @param $query
 * @param $limit
 * @return string
 */
function oos_random_select($query, $limit = '')
{
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    $random_product = '';
    if (oos_is_not_null($limit)) {
        if (USE_DB_CACHE == '1') {
            $random_result = $dbconn->CacheSelectLimit(15, $query, $limit);
        } else {
            $random_result = $dbconn->SelectLimit($query, $limit);
        }
    } else {
        if (USE_DB_CACHE == '1') {
            $random_result = $dbconn->CacheExecute(15, $query);
        } else {
            $random_result = $dbconn->Execute($query);
        }
    }
    $num_rows = $random_result->RecordCount();
    if ($num_rows > 0) {
        $random_row = oos_rand(0, $num_rows - 1);
        $random_result->Move($random_row);
        $random_product = $random_result->fields;
    }
    return $random_product;
}
Ejemplo n.º 2
0
 function set($sLang = '')
 {
     if (oos_is_not_null($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']));
     }
 }
Ejemplo n.º 3
0
    function process()
    {
        $order_total_array = array();
        if (is_array($this->modules)) {
            reset($this->modules);
            while (list(, $value) = each($this->modules)) {
                $class = substr($value, 0, strrpos($value, '.'));
                if ($GLOBALS[$class]->enabled) {
                    $GLOBALS[$class]->output = array();
                    $GLOBALS[$class]->process();

                    $nArrayCountClass = count($GLOBALS[$class]->output);
                    for ($i=0, $n=$nArrayCountClass; $i<$n; $i++) {
                        if (oos_is_not_null($GLOBALS[$class]->output[$i]['title']) && oos_is_not_null($GLOBALS[$class]->output[$i]['text'])) {
                            $order_total_array[] = array('code' => $GLOBALS[$class]->code,
                                                         'title' => $GLOBALS[$class]->output[$i]['title'],
                                                         'text' => $GLOBALS[$class]->output[$i]['text'],
                                                         'value' => $GLOBALS[$class]->output[$i]['value'],
                                                         'sort_order' => $GLOBALS[$class]->sort_order);
                        }
                    }
                }
            }
        }

        return $order_total_array;
    }
Ejemplo n.º 4
0
    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'];
            }
        }
    }
Ejemplo n.º 5
0
 function payment($module = '')
 {
     global $aLang;
     if (defined('MODULE_PAYMENT_INSTALLED') && oos_is_not_null($_SESSION['member']->group['payment'])) {
         $this->modules = explode(';', $_SESSION['member']->group['payment']);
         $include_modules = array();
         if (oos_is_not_null($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']);
         for ($i = 0, $n = sizeof($include_modules); $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 (oos_is_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
Ejemplo n.º 6
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $oOrder_total = $_SESSION['cart']->show_total();
     } else {
         $oOrder_total = $shipping_weight;
     }
     $table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST);
     $size = count($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($oOrder_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_table_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_table_text_way'], 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 7
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $total_count;
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_selfpickup_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_selfpickup_text_way'], 'cost' => 0)));
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 8
0
 function quote($method = '')
 {
     global $aLang, $oOrder;
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_flat_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_flat_text_way'], 'cost' => MODULE_SHIPPING_FLAT_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 9
0
 function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '')
 {
     if (empty($currency_type) || $this->exists($currency_type) == false) {
         $currency_type = isset($_SESSION['currency']) ? $_SESSION['currency'] : DEFAULT_CURRENCY;
     }
     if ($calculate_currency_value == true) {
         $rate = oos_is_not_null($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];
         $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number * $rate, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . ' ' . $this->currencies[$currency_type]['symbol_right'];
     } else {
         $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . ' ' . $this->currencies[$currency_type]['symbol_right'];
     }
     return $format_string;
 }
Ejemplo n.º 10
0
 function trail($separator = ' - ')
 {
     $trail_string = '';
     for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) {
         if (isset($this->_trail[$i]['link']) && oos_is_not_null($this->_trail[$i]['link'])) {
             $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '" title="' . $this->_trail[$i]['title'] . '" class="headerNavigation">' . $this->_trail[$i]['title'] . '</a>';
         } else {
             $trail_string .= $this->_trail[$i]['title'];
         }
         if ($i + 1 < $n) {
             $trail_string .= $separator;
         }
     }
     return $trail_string;
 }
 function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '', $page_name = 'page')
 {
     if (oos_is_not_null($parameters) && substr($parameters, -1) != '&') {
         $parameters .= '&';
     }
     // calculate number of pages needing links
     $num_pages = intval($query_numrows / $max_rows_per_page);
     // $num_pages now contains int of pages needed unless there is a remainder from division
     if ($query_numrows % $max_rows_per_page) {
         $num_pages++;
     }
     // has remainder so add one page
     $pages_array = array();
     for ($i = 1; $i <= $num_pages; $i++) {
         $pages_array[] = array('id' => $i, 'text' => $i);
     }
     if ($num_pages > 1) {
         $display_links = oos_draw_form('pages', basename($_SERVER['PHP_SELF']), '', 'get');
         if ($current_page_number > 1) {
             $display_links .= '<a href="' . oos_href_link_admin(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number - 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_PREV . '</a>&nbsp;&nbsp;';
         } else {
             $display_links .= PREVNEXT_BUTTON_PREV . '&nbsp;&nbsp;';
         }
         $display_links .= sprintf(TEXT_RESULT_PAGE, oos_draw_pull_down_menu($page_name, $pages_array, '', 'onChange="this.form.submit();"'), $num_pages);
         if ($current_page_number < $num_pages && $num_pages != 1) {
             $display_links .= '&nbsp;&nbsp;<a href="' . oos_href_link_admin(basename($_SERVER['PHP_SELF']), $parameters . $page_name . '=' . ($current_page_number + 1), 'NONSSL') . '" class="splitPageLink">' . PREVNEXT_BUTTON_NEXT . '</a>';
         } else {
             $display_links .= '&nbsp;&nbsp;' . PREVNEXT_BUTTON_NEXT;
         }
         if ($parameters != '') {
             if (substr($parameters, -1) == '&') {
                 $parameters = substr($parameters, 0, -1);
             }
             $pairs = explode('&', $parameters);
             while (list(, $pair) = each($pairs)) {
                 list($key, $value) = explode('=', $pair);
                 $display_links .= oos_draw_hidden_field(rawurldecode($key), rawurldecode($value));
             }
         }
         if (SID) {
             $display_links .= oos_draw_hidden_field(oos_session_name(), oos_session_id());
         }
         $display_links .= '</form>';
     } else {
         $display_links = sprintf(TEXT_RESULT_PAGE, $num_pages, $num_pages);
     }
     return $display_links;
 }
Ejemplo n.º 12
0
 function trail($separator = ' - ')
 {
     $trail_string = '<ol>' . "\n";
     for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) {
         if (isset($this->_trail[$i]['link']) && oos_is_not_null($this->_trail[$i]['link'])) {
             if (isset($this->_trail[$i]['rel'])) {
                 $trail_string .= '<li><a class="page_item-' . $i . '" href="' . $this->_trail[$i]['link'] . '" rel="bookmark" title="Permalink zu ' . $this->_trail[$i]['title'] . '"><strong>' . $this->_trail[$i]['title'] . '</strong></a></li>' . "\n";
             } else {
                 $trail_string .= '<li><a class="page_item-' . $i . '" href="' . $this->_trail[$i]['link'] . '" title="' . $this->_trail[$i]['title'] . '"><span>' . $this->_trail[$i]['title'] . '</span></a></li>' . "\n";
             }
         } else {
             $trail_string .= '<li><strong>' . $this->_trail[$i]['title'] . '</strong></li>' . "\n";
         }
     }
     $trail_string .= '</ol>' . "\n";
     return $trail_string;
 }
Ejemplo n.º 13
0
 function process()
 {
     global $oOrder, $oCurrencies;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == '1') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($oOrder->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($oOrder->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $oOrder->info['total'] - $oOrder->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $oOrder->info['shipping_method'] = $this->title;
             $oOrder->info['total'] -= $oOrder->info['shipping_cost'];
             $oOrder->info['shipping_cost'] = 0;
         }
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (oos_is_not_null($oOrder->info['shipping_method'])) {
         if ($GLOBALS[$module]->tax_class > 0) {
             $shipping_tax = oos_get_tax_rate($GLOBALS[$module]->tax_class, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
             $shipping_tax_description = oos_get_tax_rate($GLOBALS[$module]->tax_class, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
             $tax = oos_calculate_tax($oOrder->info['shipping_cost'], $shipping_tax);
             if ($_SESSION['member']->group['show_price_tax'] == 1) {
                 $oOrder->info['shipping_cost'] += $tax;
             }
             $oOrder->info['tax'] += $tax;
             $oOrder->info['tax_groups']["{$shipping_tax_description}"] += $tax;
             $oOrder->info['total'] += $tax;
         }
         $this->output[] = array('title' => $oOrder->info['shipping_method'] . ':', 'text' => $oCurrencies->format($oOrder->info['shipping_cost'], true, $oOrder->info['currency'], $oOrder->info['currency_value']), 'value' => $oOrder->info['shipping_cost']);
     }
 }
Ejemplo n.º 14
0
/**
 * This funstion validates a plain text password with an
 * encrpyted password
 *
 * @param $sPlain
 * @param $sEncrypted
 * @return boolean
 */
function oos_validate_password($sPlain, $sEncrypted)
{
    if (!empty($sPlain) && !empty($sEncrypted)) {
        // split apart the hash / salt
        $aStack = explode(':', $sEncrypted);
        if (count($aStack) != 2) {
            return false;
        }
        if (md5($aStack[1] . $sPlain) == $aStack[0]) {
            return true;
        }
    }
    if (oos_is_not_null($_COOKIE['password']) && oos_is_not_null($sEncrypted)) {
        if ($_COOKIE['password'] == $sEncrypted) {
            return true;
        }
    }
    return false;
}
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
 function quote($method = '', $module = '')
 {
     global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
     $quotes_array = array();
     if (is_array($this->modules)) {
         $shipping_quoted = '';
         $shipping_num_boxes = 1;
         $shipping_weight = $total_weight;
         if ($total_weight > SHIPPING_MAX_WEIGHT) {
             // Split into many boxes
             $shipping_num_boxes = ceil($total_weight / SHIPPING_MAX_WEIGHT);
             $shipping_weight = $total_weight / $shipping_num_boxes;
         }
         if (SHIPPING_BOX_WEIGHT >= $shipping_weight * SHIPPING_BOX_PADDING / 100) {
             $shipping_weight = $shipping_weight + SHIPPING_BOX_WEIGHT;
         } else {
             $shipping_weight = $shipping_weight + $shipping_weight * SHIPPING_BOX_PADDING / 100;
         }
         $include_quotes = array();
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             if (oos_is_not_null($module)) {
                 if ($module == $class && $GLOBALS[$class]->enabled) {
                     $include_quotes[] = $class;
                 }
             } elseif ($GLOBALS[$class]->enabled) {
                 $include_quotes[] = $class;
             }
         }
         $size = count($include_quotes);
         for ($i = 0; $i < $size; $i++) {
             $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);
             if (is_array($quotes)) {
                 $quotes_array[] = $quotes;
             }
         }
     }
     return $quotes_array;
 }
Ejemplo n.º 17
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $shipping_weight;
     $weight_cost = split("[:,]", MODULE_SHIPPING_WEIGHT_COST);
     if ($shipping_weight > $weight_cost[count($weight_cost) - 2]) {
         $shipping = ($shipping_weight - $weight_cost[count($weight_cost) - 2]) * MODULE_SHIPPING_WEIGHT_STEP + $weight_cost[count($weight_cost) - 1];
     }
     for ($i = 0; $i < count($weight_cost); $i += 2) {
         if ($shipping_weight <= $weight_cost[$i]) {
             $shipping = $weight_cost[$i + 1];
             break;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_weight_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_weight_text_way'], 'cost' => $shipping + MODULE_SHIPPING_WEIGHT_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 18
0
/**
 * Generate a path to categories
 *
 * @param $current_category_id
 * @return string
 */
function oos_get_path($current_category_id = '', $parent_id = '', $gparent_id = '')
{
    global $aCategoryPath;
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    if (oos_is_not_null($current_category_id)) {
        $cp_size = count($aCategoryPath);
        if ($cp_size == 0) {
            $categories_new = $current_category_id;
        } else {
            $categories_new = '';
            if (oos_empty($parent_id) || oos_empty($gparent_id)) {
                $categoriestable = $oostable['categories'];
                $query = "SELECT c.parent_id, p.parent_id as gparent_id\n                      FROM {$categoriestable} AS c,\n                           {$categoriestable} AS p\n                     WHERE c.categories_id = '" . intval($aCategoryPath[$cp_size - 1]) . "'\n                       AND p.categories_id = '" . intval($current_category_id) . "'";
                $parent_categories = $dbconn->GetRow($query);
                $gparent_id = $parent_categories['gparent_id'];
                $parent_id = $parent_categories['parent_id'];
            }
            if ($parent_id == $gparent_id) {
                for ($i = 0; $i < $cp_size - 1; $i++) {
                    $categories_new .= '_' . $aCategoryPath[$i];
                }
            } else {
                for ($i = 0; $i < $cp_size; $i++) {
                    $categories_new .= '_' . $aCategoryPath[$i];
                }
            }
            $categories_new .= '_' . $current_category_id;
            if (substr($categories_new, 0, 1) == '_') {
                $categories_new = substr($categories_new, 1);
            }
        }
    } else {
        $categories_new = implode('_', $aCategoryPath);
    }
    return 'categories=' . $categories_new;
}
Ejemplo n.º 19
0
/**
 * Return Category Path
 *
 * @param $id
 * @param $from
 * @param $news_categories_array
 * @param $index
 * @return string
 */
function oos_generate_news_category_path($id, $from = 'news_category', $news_categories_array = '', $index = 0)
{
    if (!is_array($news_categories_array)) {
        $news_categories_array = array();
    }
    // Get database information
    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();
    if ($from == 'news') {
        $news_categories_query = "SELECT news_categories_id\n                                FROM " . $oostable['news_to_categories'] . "\n                                WHERE news_id = '" . $id . "'";
        $news_categories_result =& $dbconn->Execute($news_categories_query);
        while ($news_categories = $news_categories_result->fields) {
            if ($news_categories['news_categories_id'] == '0') {
                $news_categories_array[$index][] = array('id' => '0', 'text' => TEXT_TOP);
            } else {
                $news_category_query = "SELECT ncd.news_categories_name, nc.parent_id\n                                  FROM " . $oostable['news_categories'] . " nc,\n                                       " . $oostable['news_categories_description'] . " ncd\n                                 WHERE nc.news_categories_id = '" . $news_categories['news_categories_id'] . "' \n                                   AND nc.news_categories_id = ncd.news_categories_id\n                                   AND ncd.news_categories_languages_id = '" . intval($_SESSION['language_id']) . "'";
                $news_category_result =& $dbconn->Execute($news_categories_query);
                $news_category = $news_category_result->fields;
                $news_categories_array[$index][] = array('id' => $news_categories['news_categories_id'], 'text' => $news_category['news_categories_name']);
                if (oos_is_not_null($news_category['parent_id']) && $news_category['parent_id'] != '0') {
                    $news_categories_array = oos_generate_news_category_path($news_category['parent_id'], 'news_category', $news_categories_array, $index);
                }
                $news_categories_array[$index] = array_reverse($news_categories_array[$index]);
            }
            $index++;
            // Move that ADOdb pointer!
            $news_categories_result->MoveNext();
        }
        // Close result set
        $news_categories_result->Close();
    } elseif ($from == 'news_category') {
        $news_category_query = "SELECT ncd.news_categories_name, nc.parent_id\n                              FROM " . $oostable['news_categories'] . " nc,\n                                   " . $oostable['news_categories_description'] . " ncd\n                              WHERE nc.news_categories_id = '" . $id . "'\n                                AND nc.news_categories_id = ncd.news_categories_id\n                                AND ncd.news_categories_languages_id = '" . intval($_SESSION['language_id']) . "'";
        $news_category_result =& $dbconn->Execute($news_category_query);
        $news_category = $news_category_result->fields;
        // Close result set
        $news_category_result->Close();
        $news_categories_array[$index][] = array('id' => $id, 'text' => $news_category['news_categories_name']);
        if (oos_is_not_null($news_category['parent_id']) && $news_category['parent_id'] != '0') {
            $news_categories_array = oos_generate_news_category_path($news_category['parent_id'], 'news_category', $news_categories_array, $index);
        }
    }
    return $news_categories_array;
}
Ejemplo n.º 20
0
        $contents = array('form' => oos_draw_form('manufacturers', $aFilename['manufacturers'], 'page=' . $_GET['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=deleteconfirm'));
        $contents[] = array('text' => TEXT_DELETE_INTRO);
        $contents[] = array('text' => '<br /><b>' . $mInfo->manufacturers_name . '</b>');
        $contents[] = array('text' => '<br />' . oos_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);
        if ($mInfo->products_count > 0) {
            $contents[] = array('text' => '<br />' . oos_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
            $contents[] = array('text' => '<br />' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count));
        }
        $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('delete', 'delete_off.gif', IMAGE_DELETE) . ' <a href="' . oos_href_link_admin($aFilename['manufacturers'], 'page=' . $_GET['page'] . '&mID=' . $mInfo->manufacturers_id) . '">' . oos_image_swap_button('cancel', 'cancel_off.gif', IMAGE_CANCEL) . '</a>');
        break;
    default:
        if (isset($mInfo) && is_object($mInfo)) {
            $heading[] = array('text' => '<b>' . $mInfo->manufacturers_name . '</b>');
            $contents[] = array('align' => 'center', 'text' => '<a href="' . oos_href_link_admin($aFilename['manufacturers'], 'page=' . $_GET['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=edit') . '">' . oos_image_swap_button('edit', 'edit_off.gif', IMAGE_EDIT) . '</a> <a href="' . oos_href_link_admin($aFilename['manufacturers'], 'page=' . $_GET['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=delete') . '">' . oos_image_swap_button('delete', 'delete_off.gif', IMAGE_DELETE) . '</a>');
            $contents[] = array('text' => '<br />' . TEXT_DATE_ADDED . ' ' . oos_date_short($mInfo->date_added));
            if (oos_is_not_null($mInfo->last_modified)) {
                $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . oos_date_short($mInfo->last_modified));
            }
            $contents[] = array('text' => '<br />' . oos_info_image($mInfo->manufacturers_image, $mInfo->manufacturers_name));
            $contents[] = array('text' => '<br />' . TEXT_PRODUCTS . ' ' . $mInfo->products_count);
        }
        break;
}
if (!empty($heading) && !empty($contents)) {
    echo '            <td width="25%" valign="top">' . "\n";
    $box = new box();
    echo $box->infoBox($heading, $contents);
    echo '            </td>' . "\n";
}
?>
          </tr>
Ejemplo n.º 21
0
   Based on:

   File: modules.php,v 1.44 2002/11/22 18:58:29 dgw_
   ----------------------------------------------------------------------
   osCommerce, Open Source E-Commerce Solutions
   http://www.oscommerce.com

   Copyright (c) 2003 osCommerce
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */
define('OOS_VALID_MOD', 'yes');
require 'includes/oos_main.php';
require 'includes/functions/function_modules.php';
$set = isset($_GET['set']) ? $_GET['set'] : '';
if (oos_is_not_null($set)) {
    switch ($set) {
        case 'shipping':
            $module_type = 'shipping';
            $module_directory = OOS_ABSOLUTE_PATH . 'includes/modules/shipping/';
            $module_key = 'MODULE_SHIPPING_INSTALLED';
            define('HEADING_TITLE', HEADING_TITLE_MODULES_SHIPPING);
            break;
        case 'ordertotal':
            $module_type = 'order_total';
            $module_directory = OOS_ABSOLUTE_PATH . 'includes/modules/order_total/';
            $module_key = 'MODULE_ORDER_TOTAL_INSTALLED';
            define('HEADING_TITLE', HEADING_TITLE_MODULES_ORDER_TOTAL);
            break;
        case 'payment':
        default:
Ejemplo n.º 22
0
    MyOOS_CoreApi::redirect(oos_href_link($aModules['main'], $aFilename['main_shopping_cart']));
}
// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($_SESSION['cart']->cartID) && isset($_SESSION['cartID'])) {
    if ($_SESSION['cart']->cartID != $_SESSION['cartID']) {
        MyOOS_CoreApi::redirect(oos_href_link($aModules['checkout'], $aFilename['checkout_shipping'], '', 'SSL'));
    }
}
if (isset($_SESSION['formid']) && $_SESSION['formid'] == $_POST['formid']) {
    if (isset($_POST['payment'])) {
        $_SESSION['payment'] = oos_db_prepare_input($_POST['payment']);
    }
    if (isset($_POST['comments']) && empty($_POST['comments'])) {
        $_SESSION['comments'] = '';
    } else {
        if (oos_is_not_null($_POST['comments'])) {
            $_SESSION['comments'] = oos_db_prepare_input($_POST['comments']);
        }
    }
    if (isset($_POST['campaign_id']) && is_numeric($_POST['campaign_id'])) {
        $_SESSION['campaigns_id'] = intval($_POST['campaign_id']);
    }
    // if no shipping method has been selected, redirect the customer to the shipping method selection page
    if (!isset($_SESSION['shipping'])) {
        MyOOS_CoreApi::redirect(oos_href_link($aModules['checkout'], $aFilename['checkout_shipping'], '', 'SSL'));
    }
    // if conditions are not accepted, redirect the customer to the payment method selection page
    if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1' && empty($_POST['gv_redeem_code'])) {
        if ($_POST['conditions'] == false) {
            $_SESSION['navigation']->remove_current_page();
            $_SESSION['navigation']->remove_last_page();
Ejemplo n.º 23
0
            $heading[] = array('text' => '<b>' . $cInfo->title . '</b>');
            $contents[] = array('align' => 'center', 'text' => '<a href="' . oos_href_link_admin($aFilename['currencies'], 'page=' . $_GET['page'] . '&cID=' . $cInfo->currencies_id . '&action=edit') . '">' . oos_image_swap_button('edit', 'edit_off.gif', IMAGE_EDIT) . '</a> <a href="' . oos_href_link_admin($aFilename['currencies'], 'page=' . $_GET['page'] . '&cID=' . $cInfo->currencies_id . '&action=delete') . '">' . oos_image_swap_button('delete', 'delete_off.gif', IMAGE_DELETE) . '</a>');
            $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENCY_TITLE . ' ' . $cInfo->title);
            $contents[] = array('text' => TEXT_INFO_CURRENCY_CODE . ' ' . $cInfo->code);
            $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENCY_SYMBOL_LEFT . ' ' . $cInfo->symbol_left);
            $contents[] = array('text' => TEXT_INFO_CURRENCY_SYMBOL_RIGHT . ' ' . $cInfo->symbol_right);
            $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENCY_DECIMAL_POINT . ' ' . $cInfo->decimal_point);
            $contents[] = array('text' => TEXT_INFO_CURRENCY_THOUSANDS_POINT . ' ' . $cInfo->thousands_point);
            $contents[] = array('text' => TEXT_INFO_CURRENCY_DECIMAL_PLACES . ' ' . $cInfo->decimal_places);
            $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENCY_LAST_UPDATED . ' ' . oos_date_short($cInfo->last_updated));
            $contents[] = array('text' => TEXT_INFO_CURRENCY_VALUE . ' ' . number_format($cInfo->value, 8));
            $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENCY_EXAMPLE . '<br />' . $currencies->format('30', false, DEFAULT_CURRENCY) . ' = ' . $currencies->format('30', true, $cInfo->code));
        }
        break;
}
if (oos_is_not_null($heading) && oos_is_not_null($contents)) {
    echo '            <td width="25%" valign="top">' . "\n";
    $box = new box();
    echo $box->infoBox($heading, $contents);
    echo '            </td>' . "\n";
}
?>
          </tr>
        </table></td>
      </tr>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->
Ejemplo n.º 24
0
     if ($currency['currencies_id'] == $currencies_id) {
         $dbconn->Execute("UPDATE " . $oostable['configuration'] . " SET configuration_value = '' WHERE configuration_key = 'DEFAULT_CURRENCY'");
     }
     $dbconn->Execute("DELETE FROM " . $oostable['currencies'] . " WHERE currencies_id = '" . oos_db_input($currencies_id) . "'");
     oos_redirect_admin(oos_href_link_admin($aFilename['currencies'], 'page=' . $_GET['page']));
     break;
 case 'update':
     $currency_result = $dbconn->Execute("SELECT currencies_id, code FROM " . $oostable['currencies']);
     while ($currency = $currency_result->fields) {
         $quote_function = 'quote_' . CURRENCY_SERVER_PRIMARY . '_currency';
         $rate = $quote_function($currency['code']);
         if (empty($rate) && oos_is_not_null(CURRENCY_SERVER_BACKUP)) {
             $quote_function = 'quote_' . CURRENCY_SERVER_BACKUP . '_currency';
             $rate = $quote_function($currency['code']);
         }
         if (oos_is_not_null($rate)) {
             $dbconn->Execute("UPDATE " . $oostable['currencies'] . " SET value = '" . $rate . "', last_updated = '" . date("Y-m-d H:i:s", time()) . "' WHERE currencies_id = '" . $currency['currencies_id'] . "'");
         }
         // Move that ADOdb pointer!
         $currency_result->MoveNext();
     }
     oos_redirect_admin(oos_href_link_admin($aFilename['currencies'], 'page=' . $_GET['page'] . '&cID=' . $_GET['cID']));
     break;
 case 'delete':
     $currencies_id = oos_db_prepare_input($_GET['cID']);
     $currency_result = $dbconn->Execute("SELECT code FROM " . $oostable['currencies'] . " WHERE currencies_id = '" . oos_db_input($currencies_id) . "'");
     $currency = $currency_result->fields;
     $remove_currency = true;
     if ($currency['code'] == DEFAULT_CURRENCY) {
         $remove_currency = false;
         $messageStack->add(ERROR_REMOVE_DEFAULT_CURRENCY, 'error');
 /**
  * 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';
     }
 }
Ejemplo n.º 26
0
 function set_extensions($extensions)
 {
     if (oos_is_not_null($extensions)) {
         if (is_array($extensions)) {
             $this->extensions = $extensions;
         } else {
             $this->extensions = array($extensions);
         }
     } else {
         $this->extensions = array();
     }
 }
Ejemplo n.º 27
0
     }
     $_SESSION['navigation']->remove_last_page();
     MyOOS_CoreApi::redirect(oos_href_link($goto_file, oos_get_all_get_parameters($parameters), 'NONSSL'));
     break;
 case 'add_product':
     // customer adds a product from the products page
     if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
         if (isset($_POST['edit_product'])) {
             $_SESSION['cart']->remove($_POST['edit_product']);
         }
         $real_ids = $_POST['id'];
         // File_upload
         if (isset($_POST['number_of_uploads']) && is_numeric($_POST['number_of_uploads']) && $_POST['number_of_uploads'] > 0) {
             require_once 'includes/classes/class_upload.php';
             for ($i = 1; $i <= $_POST['number_of_uploads']; $i++) {
                 if (oos_is_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
                     $products_options_file = new upload('id');
                     $products_options_file->set_destination(OOS_UPLOADS);
                     $files_uploadedtable = $oostable['files_uploaded'];
                     if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                         if (isset($_SESSION['customer_id'])) {
                             $dbconn->Execute("INSERT INTO " . $files_uploadedtable . " (sesskey, customers_id, files_uploaded_name) VALUES ('" . oos_session_id() . "', '" . intval($_SESSION['customer_id']) . "', '" . oos_db_input($products_options_file->filename) . "')");
                         } else {
                             $dbconn->Execute("INSERT INTO " . $files_uploadedtable . " (sesskey, files_uploaded_name) VALUES ('" . oos_session_id() . "', '" . oos_db_input($products_options_file->filename) . "')");
                         }
                         $insert_id = $dbconn->Insert_ID();
                         $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                         $products_options_file->set_filename("{$insert_id}" . $products_options_file->filename);
                         if (!$products_options_file->save()) {
                             break 2;
                         }
    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'));
}
require 'includes/languages/' . $sLanguage . '/user_product_notifications.php';
if (isset($_GET['action']) && $_GET['action'] == 'update_notifications') {
    (array) ($products = $_POST['products']);
    $aRemove = array();
    for ($i = 0, $n = count($products); $i < $n; $i++) {
        if (is_numeric($products[$i])) {
            $aRemove[] = $products[$i];
        }
    }
    if (oos_is_not_null($aRemove)) {
        $products_notificationstable = $oostable['products_notifications'];
        $dbconn->Execute("DELETE FROM {$products_notificationstable}\n                          WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                                products_id IN (" . implode(',', $aRemove) . ")");
    }
    oos_redirect(oos_href_link($aModules['user'], $aFilename['product_notifications'], '', 'SSL'));
} elseif (isset($_GET['action']) && $_GET['action'] == 'global_notify') {
    if (isset($_POST['global']) && $_POST['global'] == 'enable') {
        $customers_infotable = $oostable['customers_info'];
        $dbconn->Execute("UPDATE {$customers_infotable}\n                          SET global_product_notifications = '1'\n                          WHERE customers_info_id = '" . intval($_SESSION['customer_id']) . "'");
    } else {
        $customers_infotable = $oostable['customers_info'];
        $sql = "SELECT COUNT(*) AS total\n                FROM {$customers_infotable}\n                WHERE customers_info_id = '" . intval($_SESSION['customer_id']) . "'\n                  AND global_product_notifications = '1'";
        $check_result = $dbconn->Execute($sql);
        if ($check_result->fields['total'] > 0) {
            $customers_infotable = $oostable['customers_info'];
            $dbconn->Execute("UPDATE {$customers_infotable}\n                              SET global_product_notifications = '0'\n                              WHERE customers_info_id = '" . intval($_SESSION['customer_id']) . "'");
Ejemplo n.º 29
0
<?php 
    }
    if (isset($_GET['read']) && $_GET['read'] == 'only') {
        if (isset($_GET['origin'])) {
            $pos_params = strpos($_GET['origin'], '?', 0);
            if ($pos_params != false) {
                $back_url = substr($_GET['origin'], 0, $pos_params);
                $back_url_params = substr($_GET['origin'], $pos_params + 1);
            } else {
                $back_url = $_GET['origin'];
                $back_url_params = '';
            }
        } else {
            $back_url = $aFilename['categories'];
            $back_url_params = 'categories=' . $categories;
            if (oos_is_not_null($pInfo->products_id)) {
                $back_url_params .= '&pID=' . $pInfo->products_id;
            }
        }
        ?>
      <tr>
        <td align="right"><?php 
        echo '<a href="' . oos_href_link_admin($back_url, $back_url_params, 'NONSSL') . '">' . oos_image_swap_button('back', 'back_off.gif', IMAGE_BACK) . '</a>';
        ?>
</td>
      </tr>
<?php 
    } else {
        ?>
      <tr>
        <td align="right" class="smallText">
Ejemplo n.º 30
0
}
$_SESSION['navigation']->remove_current_page();
require 'includes/languages/' . $sLanguage . '/gv_popup_coupon_help.php';
$text_coupon_help = $aLang['text_coupon_help_header'];
if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
    $nCouponID = intval($_GET['cID']);
    $couponstable = $oostable['coupons'];
    $sql = "SELECT coupon_amount, coupon_type, coupon_amount, coupon_minimum_order,\n                   coupon_start_date, coupon_expire_date\n            FROM {$couponstable}\n            WHERE coupon_id = '" . intval($nCouponID) . "'";
    $coupon_result = $dbconn->Execute($sql);
    $coupon = $coupon_result->fields;
    $coupons_descriptiontable = $oostable['coupons_description'];
    $sql = "SELECT coupon_name, coupon_description\n            FROM {$coupons_descriptiontable}\n            WHERE coupon_id = '" . intval($nCouponID) . "'\n              AND coupon_languages_id = '" . intval($nLanguageID) . "'";
    $coupon_desc_result = $dbconn->Execute($sql);
    $coupon_desc = $coupon_desc_result->fields;
    $text_coupon_help .= sprintf($aLang['text_coupon_help_name'], $coupon_desc['coupon_name']);
    if (oos_is_not_null($coupon_desc['coupon_description'])) {
        $text_coupon_help .= sprintf($aLang['text_coupon_help_desc'], $coupon_desc['coupon_description']);
    }
    $coupon_amount = $coupon['coupon_amount'];
    switch ($coupon['coupon_type']) {
        case 'F':
            $text_coupon_help .= sprintf($aLang['text_coupon_help_fixed'], $oCurrencies->format($coupon['coupon_amount']));
            break;
        case 'P':
            $text_coupon_help .= sprintf($aLang['text_coupon_help_fixed'], number_format($coupon['coupon_amount'], 2) . '%');
            break;
        case 'S':
            $text_coupon_help .= $aLang['text_coupon_help_freeship'];
            break;
        default:
    }