Ejemplo n.º 1
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $order_total = $this->getShippableTotal();
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE_COST);
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_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' => OSCOM::getDef('module_shipping_table_text_title'), 'methods' => array(array('id' => $this->code, 'title' => OSCOM::getDef('module_shipping_table_text_way'), 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (tep_not_null($this->icon)) {
         $this->quotes['icon'] = HTML::image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 2
0
 function getData()
 {
     global $request_type, $oscTemplate;
     $OSCOM_Db = Registry::get('Db');
     $data = '';
     $Qmanufacturers = $OSCOM_Db->query('select manufacturers_id, manufacturers_name from :table_manufacturers order by manufacturers_name');
     $manufacturers = $Qmanufacturers->fetchAll();
     if (!empty($manufacturers)) {
         if (count($manufacturers) <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
             // Display a list
             $manufacturers_list = '<ul class="nav nav-pills nav-stacked">';
             foreach ($manufacturers as $m) {
                 $manufacturers_name = strlen($m['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN ? substr($m['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $m['manufacturers_name'];
                 if (isset($_GET['manufacturers_id']) && $_GET['manufacturers_id'] == $m['manufacturers_id']) {
                     $manufacturers_name = '<strong>' . $manufacturers_name . '</strong>';
                 }
                 $manufacturers_list .= '<li><a href="' . OSCOM::link('index.php', 'manufacturers_id=' . (int) $m['manufacturers_id']) . '">' . $manufacturers_name . '</a></li>';
             }
             $manufacturers_list .= '</ul>';
             $data = $manufacturers_list;
         } else {
             // Display a drop-down
             $manufacturers_array = array();
             if (MAX_MANUFACTURERS_LIST < 2) {
                 $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
             }
             foreach ($manufacturers as $m) {
                 $manufacturers_name = strlen($m['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN ? substr($m['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $m['manufacturers_name'];
                 $manufacturers_array[] = array('id' => $m['manufacturers_id'], 'text' => $manufacturers_name);
             }
             $data = HTML::form('manufacturers', OSCOM::link('index.php', '', $request_type, false), 'get', null, ['session_id' => true]) . HTML::selectField('manufacturers_id', $manufacturers_array, isset($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '', 'onchange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '"') . '</form>';
         }
     }
     return $data;
 }
Ejemplo n.º 3
0
 function confirm()
 {
     $OSCOM_Db = Registry::get('Db');
     $Qmail = $OSCOM_Db->get('customers', 'count(*) as count', ['customers_newsletter' => '1']);
     $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" . '  <tr>' . "\n" . '    <td class="main"><font color="#ff0000"><strong>' . OSCOM::getDef('text_count_customers', ['count' => $Qmail->valueInt('count')]) . '</strong></font></td>' . "\n" . '  </tr>' . "\n" . '  <tr>' . "\n" . '    <td>&nbsp;</td>' . "\n" . '  </tr>' . "\n" . '  <tr>' . "\n" . '    <td class="main"><strong>' . $this->title . '</strong></td>' . "\n" . '  </tr>' . "\n" . '  <tr>' . "\n" . '    <td>&nbsp;</td>' . "\n" . '  </tr>' . "\n" . '  <tr>' . "\n" . '    <td class="main">' . "\n" . '      <ul class="nav nav-tabs" role="tablist">' . "\n" . '        <li role="presentation" class="active"><a href="#html_preview" aria-controls="html_preview" role="tab" data-toggle="tab">' . OSCOM::getDef('email_type_html') . '</a></li>' . "\n" . '        <li role="presentation"><a href="#plain_preview" aria-controls="plain_preview" role="tab" data-toggle="tab">' . OSCOM::getDef('email_type_plain') . '</a></li>' . "\n" . '      </ul>' . "\n" . '      <div class="tab-content">' . "\n" . '        <div role="tabpanel" class="tab-pane active" id="html_preview">' . "\n" . '          <iframe id="emailHtmlPreviewContent" style="width: 100%; height: 400px; border: 0;"></iframe>' . "\n" . '          <script id="emailHtmlPreview" type="x-tmpl-mustache">' . "\n" . '            ' . HTML::outputProtected($this->content_html) . "\n" . '          </script>' . "\n" . '          <script>' . "\n" . '            $(function() {' . "\n" . '              var content = $(\'<div />\').html($(\'#emailHtmlPreview\').html()).text();' . "\n" . '              $(\'#emailHtmlPreviewContent\').contents().find(\'html\').html(content);' . "\n" . '            });' . "\n" . '          </script>' . "\n" . '        </div>' . "\n" . '        <div role="tabpanel" class="tab-pane" id="plain_preview">' . "\n" . '          ' . nl2br(HTML::outputProtected($this->content)) . "\n" . '        </div>' . "\n" . '      </div>' . "\n" . '    </td>' . "\n" . '  </tr>' . "\n" . '  <tr>' . "\n" . '    <td>&nbsp;</td>' . "\n" . '  </tr>' . "\n" . '  <tr>' . "\n" . '    <td class="smallText" align="right">' . HTML::button(OSCOM::getDef('image_send'), 'fa fa-envelope', OSCOM::link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send')) . HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'])) . '</td>' . "\n" . '  </tr>' . "\n" . '</table>';
     return $confirm_string;
 }
Ejemplo n.º 4
0
 function execute()
 {
     global $PHP_SELF, $oscTemplate, $categories, $current_category_id;
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     if (basename($PHP_SELF) == 'index.php' && $current_category_id > 0) {
         $Qmeta = $OSCOM_Db->prepare('select
                                    categories_seo_description, categories_seo_keywords
                                  from
                                    :table_categories_description
                                  where
                                    categories_id = :categories_id
                                    and language_id = :language_id');
         $Qmeta->bindInt(':categories_id', $current_category_id);
         $Qmeta->bindInt(':language_id', $OSCOM_Language->getId());
         $Qmeta->execute();
         $meta = $Qmeta->fetch();
         if (tep_not_null($meta['categories_seo_description'])) {
             $oscTemplate->addBlock('<meta name="description" content="' . HTML::output($meta['categories_seo_description']) . '" />' . PHP_EOL, $this->group);
         }
         if (tep_not_null($meta['categories_seo_keywords']) && MODULE_HEADER_TAGS_CATEGORY_SEO_KEYWORDS_STATUS == 'True') {
             $oscTemplate->addBlock('<meta name="keywords" content="' . HTML::output($meta['categories_seo_keywords']) . '" />' . PHP_EOL, $this->group);
         }
     }
 }
Ejemplo n.º 5
0
 function execute()
 {
     global $login_customer_id, $messageStack, $oscTemplate;
     $OSCOM_Db = Registry::get('Db');
     $error = false;
     if (isset($_GET['action']) && $_GET['action'] == 'process' && isset($_POST['formid']) && $_POST['formid'] == $_SESSION['sessiontoken']) {
         $email_address = HTML::sanitize($_POST['email_address']);
         $password = HTML::sanitize($_POST['password']);
         // Check if email exists
         $Qcustomer = $OSCOM_Db->get('customers', ['customers_id', 'customers_password'], ['customers_email_address' => $email_address], null, 1);
         if ($Qcustomer->fetch() === false) {
             $error = true;
         } else {
             // Check that password is good
             if (!Hash::verify($password, $Qcustomer->value('customers_password'))) {
                 $error = true;
             } else {
                 // set $login_customer_id globally and perform post login code in catalog/login.php
                 $login_customer_id = $Qcustomer->valueInt('customers_id');
                 // migrate old hashed password to new php password_hash
                 if (Hash::needsRehash($Qcustomer->value('customers_password'))) {
                     $OSCOM_Db->save('customers', ['customers_password' => Hash::encrypt($password)], ['customers_id' => $login_customer_id]);
                 }
             }
         }
     }
     if ($error == true) {
         $messageStack->add('login', OSCOM::getDef('module_content_login_text_login_error'));
     }
     ob_start();
     include 'includes/modules/content/' . $this->group . '/templates/login_form.php';
     $template = ob_get_clean();
     $oscTemplate->addContent($template, $this->group);
 }
 function execute()
 {
     global $oscTemplate, $order_id;
     $OSCOM_Db = Registry::get('Db');
     if (isset($_SESSION['customer_id'])) {
         $Qglobal = $OSCOM_Db->get('customers_info', 'global_product_notifications', ['customers_info_id' => $_SESSION['customer_id']]);
         if ($Qglobal->valueInt('global_product_notifications') !== 1) {
             if (isset($_GET['action']) && $_GET['action'] == 'update') {
                 if (isset($_POST['notify']) && is_array($_POST['notify']) && !empty($_POST['notify'])) {
                     $notify = array_unique($_POST['notify']);
                     foreach ($notify as $n) {
                         if (is_numeric($n) && $n > 0) {
                             $Qcheck = $OSCOM_Db->get('products_notifications', 'products_id', ['products_id' => $n, 'customers_id' => $_SESSION['customer_id']], null, 1);
                             if ($Qcheck->fetch() === false) {
                                 $OSCOM_Db->save('products_notifications', ['products_id' => $n, 'customers_id' => $_SESSION['customer_id'], 'date_added' => 'now()']);
                             }
                         }
                     }
                 }
             }
             $products_displayed = array();
             $Qproducts = $OSCOM_Db->get('orders_products', ['products_id', 'products_name'], ['orders_id' => $order_id], 'products_name');
             while ($Qproducts->fetch()) {
                 if (!isset($products_displayed[$Qproducts->valueInt('products_id')])) {
                     $products_displayed[$Qproducts->valueInt('products_id')] = '<div class="form-group">' . '  <label class="control-label col-xs-3">' . $Qproducts->value('products_name') . '</label>' . '  <div class="col-xs-9">' . '    <div class="checkbox">' . '      <label>' . HTML::checkboxField('notify[]', $Qproducts->valueInt('products_id')) . '&nbsp;</label>' . '    </div>' . '  </div>' . '</div>';
                 }
             }
             $products_notifications = implode('<br />', $products_displayed);
             ob_start();
             include DIR_WS_MODULES . 'content/' . $this->group . '/templates/product_notifications.php';
             $template = ob_get_clean();
             $oscTemplate->addContent($template, $this->group);
         }
     }
 }
Ejemplo n.º 7
0
 function execute()
 {
     global $oscTemplate;
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     if (isset($_GET['products_id'])) {
         $Qmanufacturer = $OSCOM_Db->prepare('select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from :table_manufacturers m left join :table_manufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = :languages_id), :table_products p where p.products_id = :products_id and p.manufacturers_id = m.manufacturers_id');
         $Qmanufacturer->bindInt(':languages_id', $OSCOM_Language->getId());
         $Qmanufacturer->bindInt(':products_id', $_GET['products_id']);
         $Qmanufacturer->execute();
         if ($Qmanufacturer->fetch() !== false) {
             $manufacturer_info_string = null;
             if (!empty($Qmanufacturer->value('manufacturers_image'))) {
                 $manufacturer_info_string .= '<div>' . HTML::image(OSCOM::linkImage($Qmanufacturer->value('manufacturers_image')), $Qmanufacturer->value('manufacturers_name')) . '</div>';
             }
             if (!empty($Qmanufacturer->value('manufacturers_url'))) {
                 $manufacturer_info_string .= '<div class="text-center"><a href="' . OSCOM::link('redirect.php', 'action=manufacturer&manufacturers_id=' . $Qmanufacturer->valueInt('manufacturers_id')) . '" target="_blank">' . OSCOM::getDef('module_boxes_manufacturer_info_box_homepage', ['manufacturers_name' => $Qmanufacturer->value('manufacturers_name')]) . '</a></div>';
             }
             ob_start();
             include 'includes/modules/boxes/templates/manufacturer_info.php';
             $data = ob_get_clean();
             $oscTemplate->addBlock($data, $this->group);
         }
     }
 }
Ejemplo n.º 8
0
    function getOutput()
    {
        $button_height = (int) MODULE_SOCIAL_BOOKMARKS_GOOGLE_PLUS_SHARE_HEIGHT;
        if (MODULE_SOCIAL_BOOKMARKS_GOOGLE_PLUS_SHARE_ANNOTATION == 'Vertical-Bubble') {
            $button_height = 60;
        }
        $output = '<div class="g-plus" data-action="share" data-href="' . OSCOM::link('product_info.php', 'products_id=' . $_GET['products_id'], false) . '" data-annotation="' . strtolower(MODULE_SOCIAL_BOOKMARKS_GOOGLE_PLUS_SHARE_ANNOTATION) . '"';
        if ((int) MODULE_SOCIAL_BOOKMARKS_GOOGLE_PLUS_SHARE_WIDTH > 0) {
            $output .= ' data-width="' . (int) MODULE_SOCIAL_BOOKMARKS_GOOGLE_PLUS_SHARE_WIDTH . '"';
        }
        $output .= ' data-height="' . $button_height . '" data-align="' . strtolower(MODULE_SOCIAL_BOOKMARKS_GOOGLE_PLUS_SHARE_ALIGN) . '"></div>';
        $output .= '<script>
  if ( typeof window.___gcfg == "undefined" ) {
    window.___gcfg = { };
  }

  if ( typeof window.___gcfg.lang == "undefined" ) {
    window.___gcfg.lang = "' . HTML::outputProtected($this->lang->get('code')) . '";
  }

  (function() {
    var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true;
    po.src = \'https://apis.google.com/js/plusone.js\';
    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>';
        return $output;
    }
Ejemplo n.º 9
0
 function execute()
 {
     global $login_customer_id, $messageStack, $oscTemplate;
     $OSCOM_Db = Registry::get('Db');
     $error = false;
     if (isset($_GET['action']) && $_GET['action'] == 'process' && isset($_POST['formid']) && $_POST['formid'] == $_SESSION['sessiontoken']) {
         $email_address = HTML::sanitize($_POST['email_address']);
         $password = HTML::sanitize($_POST['password']);
         // Check if email exists
         $Qcustomer = $OSCOM_Db->get('customers', ['customers_id', 'customers_password'], ['customers_email_address' => $email_address], null, 1);
         if ($Qcustomer->fetch() === false) {
             $error = true;
         } else {
             // Check that password is good
             if (!tep_validate_password($password, $Qcustomer->value('customers_password'))) {
                 $error = true;
             } else {
                 // set $login_customer_id globally and perform post login code in catalog/login.php
                 $login_customer_id = $Qcustomer->valueInt('customers_id');
                 // migrate old hashed password to new phpass password
                 if (tep_password_type($Qcustomer->value('customers_password')) != 'phpass') {
                     $OSCOM_Db->save('customers', ['customers_password' => tep_encrypt_password($password)], ['customers_id' => $login_customer_id]);
                 }
             }
         }
     }
     if ($error == true) {
         $messageStack->add('login', MODULE_CONTENT_LOGIN_TEXT_LOGIN_ERROR);
     }
     ob_start();
     include DIR_WS_MODULES . 'content/' . $this->group . '/templates/login_form.php';
     $template = ob_get_clean();
     $oscTemplate->addContent($template, $this->group);
 }
Ejemplo n.º 10
0
 function __construct($module, $user_id = null, $user_name = null)
 {
     global $PHP_SELF;
     $this->lang = Registry::get('Language');
     $module = HTML::sanitize(str_replace(' ', '', $module));
     if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) {
         if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) {
             if (!class_exists($module)) {
                 if (is_file('includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1))) {
                     $this->lang->loadDefinitions('modules/action_recorder/' . $module);
                     include 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1);
                 } else {
                     return false;
                 }
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
     $this->_module = $module;
     if (!empty($user_id) && is_numeric($user_id)) {
         $this->_user_id = $user_id;
     }
     if (!empty($user_name)) {
         $this->_user_name = $user_name;
     }
     $GLOBALS[$this->_module] = new $module();
     $GLOBALS[$this->_module]->setIdentifier();
 }
Ejemplo n.º 11
0
    function execute()
    {
        global $PHP_SELF, $oscTemplate;
        $OSCOM_Db = Registry::get('Db');
        if (tep_not_null(MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_ID)) {
            if (MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_JS_PLACEMENT != 'Header') {
                $this->group = 'footer_scripts';
            }
            $header = '<script>
  var _gaq = _gaq || [];
  _gaq.push([\'_setAccount\', \'' . HTML::output(MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_ID) . '\']);
  _gaq.push([\'_trackPageview\']);' . "\n";
            if (MODULE_HEADER_TAGS_GOOGLE_ANALYTICS_EC_TRACKING == 'True' && basename($PHP_SELF) == 'checkout_success.php' && isset($_SESSION['customer_id'])) {
                $Qorder = $OSCOM_Db->get('orders', ['orders_id', 'billing_city', 'billing_state', 'billing_country'], ['customers_id' => $_SESSION['customer_id']], 'date_purchased desc', 1);
                if ($Qorder->fetch() !== false) {
                    $totals = array();
                    $Qtotals = $OSCOM_Db->get('orders_total', ['value', 'class'], ['orders_id' => $Qorder->valueInt('orders_id')]);
                    while ($Qtotals->fetch()) {
                        $totals[$Qtotals->value('class')] = $Qtotals->value('value');
                    }
                    $header .= '  _gaq.push([\'_addTrans\',
    \'' . $Qorder->valueInt('orders_id') . '\', // order ID - required
    \'' . HTML::output(STORE_NAME) . '\', // store name
    \'' . (isset($totals['ot_total']) ? $this->format_raw($totals['ot_total'], DEFAULT_CURRENCY) : 0) . '\', // total - required
    \'' . (isset($totals['ot_tax']) ? $this->format_raw($totals['ot_tax'], DEFAULT_CURRENCY) : 0) . '\', // tax
    \'' . (isset($totals['ot_shipping']) ? $this->format_raw($totals['ot_shipping'], DEFAULT_CURRENCY) : 0) . '\', // shipping
    \'' . $Qorder->valueProtected('billing_city') . '\', // city
    \'' . $Qorder->valueProtected('billing_state') . '\', // state or province
    \'' . $Qorder->valueProtected('billing_country') . '\' // country
  ]);' . "\n";
                    $Qproducts = $OSCOM_Db->prepare('select op.products_id, pd.products_name, op.final_price, op.products_quantity from :table_orders_products op, :table_products_description pd, :table_languages l where op.orders_id = :orders_id and op.products_id = pd.products_id and pd.language_id = l.languages_id and l.code = :code');
                    $Qproducts->bindInt(':orders_id', $Qorder->valueInt('orders_id'));
                    $Qproducts->bindValue(':code', DEFAULT_LANGUAGE);
                    $Qproducts->execute();
                    while ($Qproducts->fetch()) {
                        $Qcategory = $OSCOM_Db->prepare('select cd.categories_name from :table_categories_description cd, :table_products_to_categories p2c, :table_languages l where p2c.products_id = :products_id and p2c.categories_id = cd.categories_id and cd.language_id = l.languages_id and l.code = :code');
                        $Qcategory->bindInt(':products_id', $Qproducts->valueInt('products_id'));
                        $Qcategory->bindValue(':code', DEFAULT_LANGUAGE);
                        $Qcategory->execute();
                        $header .= '  _gaq.push([\'_addItem\',
    \'' . $Qorder->valueInt('orders_id') . '\', // order ID - required
    \'' . $Qproducts->valueInt('products_id') . '\', // SKU/code - required
    \'' . $Qproducts->valueProtected('products_name') . '\', // product name
    \'' . $Qcategory->valueProtected('categories_name') . '\', // category
    \'' . $this->format_raw($Qproducts->value('final_price')) . '\', // unit price - required
    \'' . $Qproducts->valueInt('products_quantity') . '\' // quantity - required
  ]);' . "\n";
                    }
                    $header .= '  _gaq.push([\'_trackTrans\']); //submits transaction to the Analytics servers' . "\n";
                }
            }
            $header .= '  (function() {
    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>' . "\n";
            $oscTemplate->addBlock($header, $this->group);
        }
    }
Ejemplo n.º 12
0
 function execute()
 {
     global $PHP_SELF, $oscTemplate, $Qproduct, $product_exists;
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     if (isset($_GET['products_id'])) {
         if (isset($Qproduct) && $product_exists === true) {
             $Qmeta = $OSCOM_Db->prepare('select
                                      pd.products_seo_description,
                                      pd.products_seo_keywords
                                    from
                                      :table_products p,
                                      :table_products_description pd
                                    where
                                      p.products_status = :products_status
                                      and p.products_id = :products_id
                                      and pd.products_id = p.products_id
                                      and pd.language_id = :language_id');
             $Qmeta->bindInt(':products_status', 1);
             $Qmeta->bindInt(':products_id', $_GET['products_id']);
             $Qmeta->bindInt(':language_id', $OSCOM_Language->getId());
             $Qmeta->execute();
             $meta = $Qmeta->fetch();
             if (tep_not_null($meta['products_seo_description'])) {
                 $oscTemplate->addBlock('<meta name="description" content="' . HTML::output($meta['products_seo_description']) . '" />' . PHP_EOL, $this->group);
             }
             if (tep_not_null($meta['products_seo_keywords']) && MODULE_HEADER_TAGS_PRODUCT_META_KEYWORDS_STATUS != 'Search') {
                 $oscTemplate->addBlock('<meta name="keywords" content="' . HTML::output($meta['products_seo_keywords']) . '" />' . PHP_EOL, $this->group);
             }
         }
     }
 }
Ejemplo n.º 13
0
 function execute()
 {
     global $request_type, $oscTemplate;
     $form_output = HTML::form('quick_find', OSCOM::link('advanced_search_result.php', '', $request_type, false), 'get', null, ['session_id' => true]) . '<div class="input-group">' . HTML::inputField('keywords', '', 'required aria-required="true" placeholder="' . TEXT_SEARCH_PLACEHOLDER . '"', 'search') . '<span class="input-group-btn"><button type="submit" class="btn btn-search"><i class="glyphicon glyphicon-search"></i></button></span></div>' . HTML::hiddenField('search_in_description', '0') . '</form>';
     ob_start();
     include 'includes/modules/boxes/templates/search.php';
     $data = ob_get_clean();
     $oscTemplate->addBlock($data, $this->group);
 }
Ejemplo n.º 14
0
    function getOutput()
    {
        $OSCOM_Db = Registry::get('Db');
        $days = array();
        for ($i = 0; $i < 7; $i++) {
            $days[date('Y-m-d', strtotime('-' . $i . ' days'))] = 0;
        }
        $Qorders = $OSCOM_Db->query('select date_format(customers_info_date_account_created, "%Y-%m-%d") as dateday, count(*) as total from :table_customers_info where date_sub(curdate(), interval 7 day) <= customers_info_date_account_created group by dateday');
        while ($Qorders->fetch()) {
            $days[$Qorders->value('dateday')] = $Qorders->value('total');
        }
        $days = array_reverse($days, true);
        $chart_label = HTML::output(OSCOM::getDef('module_admin_dashboard_total_customers_chart_link'));
        $chart_label_link = OSCOM::link(FILENAME_CUSTOMERS);
        $data_labels = json_encode(array_keys($days));
        $data = json_encode(array_values($days));
        $output = <<<EOD
<h5 class="text-center"><a href="{$chart_label_link}">{$chart_label}</a></h5>
<div id="d_total_customers"></div>
<script>
\$(function() {
  var data = {
    labels: {$data_labels},
    series: [ {$data} ]
  };

  var options = {
    fullWidth: true,
    height: '200px',
    showPoint: false,
    showArea: true,
    axisY: {
      labelInterpolationFnc: function skipLabels(value, index) {
        return index % 2  === 0 ? value : null;
      }
    }
  }

  var chart = new Chartist.Line('#d_total_customers', data, options);

  chart.on('draw', function(context) {
    if (context.type === 'line') {
      context.element.attr({
        style: 'stroke: green;'
      });
    } else if (context.type === 'area') {
      context.element.attr({
        style: 'fill: green;'
      });
    }
  });
});
</script>
EOD;
        return $output;
    }
Ejemplo n.º 15
0
 public function getImage($language_code, $width = null, $height = null)
 {
     if (!isset($width) || !is_int($width)) {
         $width = 16;
     }
     if (!isset($height) || !is_int($height)) {
         $height = 12;
     }
     return HTML::image(OSCOM::link('Shop/public/third_party/flag-icon-css/flags/4x3/' . $this->get('image', $language_code) . '.svg', null, false), $this->get('name', $language_code), $width, $height);
 }
Ejemplo n.º 16
0
 public static function link($page, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
 {
     global $request_type;
     $page = HTML::sanitize($page);
     if (!in_array($connection, ['NONSSL', 'SSL', 'AUTO'])) {
         $connection = 'NONSSL';
     }
     if (!is_bool($add_session_id)) {
         $add_session_id = true;
     }
     if (!is_bool($search_engine_safe)) {
         $search_engine_safe = true;
     }
     if ($connection == 'AUTO') {
         $connection = $request_type == 'SSL' ? 'SSL' : 'NONSSL';
     }
     if ($connection == 'SSL' && ENABLE_SSL !== true) {
         $connection = 'NONSSL';
     }
     if ($connection == 'NONSSL') {
         $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
     } else {
         $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
     }
     $link .= $page;
     if (!empty($parameters)) {
         $link .= '?' . HTML::sanitize($parameters);
         $separator = '&';
     } else {
         $separator = '?';
     }
     while (substr($link, -1) == '&' || substr($link, -1) == '?') {
         $link = substr($link, 0, -1);
     }
     // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
     if ($add_session_id == true && session_status() === PHP_SESSION_ACTIVE && SESSION_FORCE_COOKIE_USE == 'False') {
         if (defined('SID') && !empty(SID)) {
             $_sid = SID;
         } elseif ($request_type == 'NONSSL' && $connection == 'SSL' || $request_type == 'SSL' && $connection == 'NONSSL') {
             if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
                 $_sid = session_name() . '=' . session_id();
             }
         }
     }
     if (isset($_sid)) {
         $link .= $separator . HTML::sanitize($_sid);
     }
     while (strpos($link, '&&') !== false) {
         $link = str_replace('&&', '&', $link);
     }
     if (SEARCH_ENGINE_FRIENDLY_URLS == 'true' && $search_engine_safe == true) {
         $link = str_replace(['?', '&', '='], '/', $link);
     }
     return $link;
 }
Ejemplo n.º 17
0
 public static function getBannerGroupSelection($value, $key = '')
 {
     $OSCOM_Db = Registry::get('Db');
     $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value';
     $groups = [['id' => '', 'text' => '--None--']];
     $Qgroups = $OSCOM_Db->query('select distinct banners_group from :table_banners order by banners_group');
     while ($Qgroups->fetch()) {
         $groups[] = ['id' => $Qgroups->value('banners_group'), 'text' => $Qgroups->value('banners_group')];
     }
     return HTML::selectField($name, $groups, $value);
 }
Ejemplo n.º 18
0
 function execute()
 {
     global $PHP_SELF, $oscTemplate;
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     if (basename($PHP_SELF) == 'product_info.php') {
         $Qproduct = $OSCOM_Db->prepare('select
                                       p.products_id,
                                       pd.products_name,
                                       pd.products_description,
                                       p.products_image,
                                       p.products_price,
                                       p.products_quantity,
                                       p.products_tax_class_id,
                                       p.products_date_available
                                     from
                                       :table_products p,
                                       :table_products_description pd
                                     where
                                       p.products_id = :products_id
                                       and p.products_status = 1
                                       and p.products_id = pd.products_id
                                       and pd.language_id = :language_id');
         $Qproduct->bindInt(':products_id', $_GET['products_id']);
         $Qproduct->bindInt(':language_id', $OSCOM_Language->getId());
         $Qproduct->execute();
         if ($Qproduct->fetch() !== false) {
             $data = array('og:type' => 'product', 'og:title' => $Qproduct->value('products_name'), 'og:site_name' => STORE_NAME);
             $product_description = substr(trim(preg_replace('/\\s\\s+/', ' ', strip_tags($Qproduct->value('products_description')))), 0, 197) . '...';
             $data['og:description'] = $product_description;
             $products_image = $Qproduct->value('products_image');
             $Qimage = $OSCOM_Db->get('products_images', 'image', ['products_id' => $Qproduct->valueInt('products_id')], 'sort_order', 1);
             if ($Qimage->fetch() !== false) {
                 $products_image = $Qimage->value('image');
             }
             $data['og:image'] = OSCOM::linkImage($products_image);
             if ($new_price = tep_get_products_special_price($Qproduct->valueInt('products_id'))) {
                 $products_price = $this->format_raw($new_price);
             } else {
                 $products_price = $this->format_raw($Qproduct->value('products_price'));
             }
             $data['product:price:amount'] = $products_price;
             $data['product:price:currency'] = $_SESSION['currency'];
             $data['og:url'] = OSCOM::link('product_info.php', 'products_id=' . $Qproduct->valueInt('products_id'), false);
             $data['product:availability'] = $Qproduct->valueInt('products_quantity') > 0 ? OSCOM::getDef('module_header_tags_product_opengraph_text_in_stock') : OSCOM::getDef('module_header_tags_product_opengraph_text_out_of_stock');
             $result = '';
             foreach ($data as $key => $value) {
                 $result .= '<meta property="' . HTML::outputProtected($key) . '" content="' . HTML::outputProtected($value) . '" />' . PHP_EOL;
             }
             $oscTemplate->addBlock($result, $this->group);
         }
     }
 }
Ejemplo n.º 19
0
 function quote($method = '')
 {
     global $order;
     $this->quotes = array('id' => $this->code, 'module' => OSCOM::getDef('module_shipping_flat_text_title'), 'methods' => array(array('id' => $this->code, 'title' => OSCOM::getDef('module_shipping_flat_text_way'), 'cost' => MODULE_SHIPPING_FLAT_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (tep_not_null($this->icon)) {
         $this->quotes['icon'] = HTML::image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 20
0
 function execute()
 {
     global $oscTemplate;
     if (defined('META_SEO_TITLE') && strlen(META_SEO_TITLE) > 0) {
         $oscTemplate->setTitle(HTML::output(META_SEO_TITLE) . OSCOM::getDef('module_header_tags_pages_seo_separator') . $oscTemplate->getTitle());
     }
     if (defined('META_SEO_DESCRIPTION') && strlen(META_SEO_DESCRIPTION) > 0) {
         $oscTemplate->addBlock('<meta name="description" content="' . HTML::output(META_SEO_DESCRIPTION) . '" />' . "\n", $this->group);
     }
     if (defined('META_SEO_KEYWORDS') && strlen(META_SEO_KEYWORDS) > 0) {
         $oscTemplate->addBlock('<meta name="keywords" content="' . HTML::output(META_SEO_KEYWORDS) . '" />' . "\n", $this->group);
     }
 }
Ejemplo n.º 21
0
 function quote($method = '')
 {
     global $order;
     $number_of_items = $this->getNumberOfItems();
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => MODULE_SHIPPING_ITEM_COST * $number_of_items + MODULE_SHIPPING_ITEM_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (tep_not_null($this->icon)) {
         $this->quotes['icon'] = HTML::image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 22
0
 function execute()
 {
     global $PHP_SELF, $oscTemplate;
     if (substr(basename($PHP_SELF), 0, 8) != 'checkout' && tep_not_null(MODULE_BOXES_CARD_ACCEPTANCE_LOGOS)) {
         $output = NULL;
         foreach (explode(';', MODULE_BOXES_CARD_ACCEPTANCE_LOGOS) as $logo) {
             $output .= HTML::image(OSCOM::linkImage('Shop/card_acceptance/' . basename($logo)), null, null, null, null, false);
         }
         ob_start();
         include 'includes/modules/boxes/templates/card_acceptance.php';
         $data = ob_get_clean();
         $oscTemplate->addBlock($data, $this->group);
     }
 }
 function execute()
 {
     global $oscTemplate;
     $content_width = MODULE_CONTENT_CUSTOMER_GREETING_CONTENT_WIDTH;
     if (isset($_SESSION['customer_id'])) {
         $customer_greeting = OSCOM::getDef('module_content_customer_greeting_personal', ['customer_first_name' => HTML::outputProtected($_SESSION['customer_first_name']), 'products_new_link' => OSCOM::link('products_new.php')]);
     } else {
         $customer_greeting = OSCOM::getDef('module_content_customer_greeting_guest', ['guest_login_link' => OSCOM::link('login.php'), 'guest_create_account_link' => OSCOM::link('create_account.php')]);
     }
     ob_start();
     include 'includes/modules/content/' . $this->group . '/templates/customer_greeting.php';
     $template = ob_get_clean();
     $oscTemplate->addContent($template, $this->group);
 }
Ejemplo n.º 24
0
 function execute()
 {
     global $oscTemplate;
     $content_width = MODULE_CONTENT_HEADER_SEARCH_CONTENT_WIDTH;
     $search_box = '<div class="searchbox-margin">';
     $search_box .= HTML::form('quick_find', OSCOM::link('advanced_search_result.php', '', false), 'get', 'class="form-horizontal"', ['session_id' => true]);
     $search_box .= '  <div class="input-group">' . HTML::inputField('keywords', '', 'required placeholder="' . OSCOM::getDef('text_search_placeholder') . '"', 'search') . '<span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="fa fa-search"></i></button></span>' . '  </div>';
     $search_box .= '</form>';
     $search_box .= '</div>';
     ob_start();
     include 'includes/modules/content/' . $this->group . '/templates/search.php';
     $template = ob_get_clean();
     $oscTemplate->addContent($template, $this->group);
 }
Ejemplo n.º 25
0
 function getOutput()
 {
     $entries = [];
     $newsCache = new Cache('oscommerce_website-news-latest5');
     if ($newsCache->exists(360)) {
         $entries = $newsCache->get();
     } else {
         $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&GetLatestNews']);
         if (!empty($response)) {
             $response = json_decode($response, true);
             if (is_array($response) && count($response) === 5) {
                 $entries = $response;
             }
         }
         $newsCache->save($entries);
     }
     $output = '<table class="table table-hover">
                <thead>
                  <tr class="info">
                    <th>' . OSCOM::getDef('module_admin_dashboard_latest_news_title') . '</th>
                    <th class="text-right">' . OSCOM::getDef('module_admin_dashboard_latest_news_date') . '</th>
                  </tr>
                </thead>
                <tbody>';
     if (is_array($entries) && count($entries) === 5) {
         foreach ($entries as $item) {
             $output .= '    <tr>
                         <td><a href="' . HTML::outputProtected($item['link']) . '" target="_blank">' . HTML::outputProtected($item['title']) . '</a></td>
                         <td class="text-right" style="white-space: nowrap;">' . HTML::outputProtected(DateTime::toShort($item['date'])) . '</td>
                       </tr>';
         }
     } else {
         $output .= '    <tr>
                       <td colspan="2">' . OSCOM::getDef('module_admin_dashboard_latest_news_feed_error') . '</td>
                     </tr>';
     }
     $output .= '    <tr>
                     <td class="text-right" colspan="2">
                       <a href="https://www.oscommerce.com/Us&News" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_news')) . '"><span class="fa fa-fw fa-home"></span></a>
                       <a href="https://www.oscommerce.com/newsletter/subscribe" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_newsletter')) . '"><span class="fa fa-fw fa-newspaper-o"></span></a>
                       <a href="https://plus.google.com/+osCommerce" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_google_plus')) . '"><span class="fa fa-fw fa-google-plus"></span></a>
                       <a href="https://www.facebook.com/pages/osCommerce/33387373079" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_facebook')) . '"><span class="fa fa-fw fa-facebook"></span></a>
                       <a href="https://twitter.com/osCommerce" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_news_icon_twitter')) . '"><span class="fa fa-fw fa-twitter"></span></a>
                     </td>
                   </tr>
                 </tbody>
               </table>';
     return $output;
 }
Ejemplo n.º 26
0
 function getOutput()
 {
     $params = array('url=' . urlencode(OSCOM::link('product_info.php', 'products_id=' . $_GET['products_id'], false)));
     if (strlen(MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_ACCOUNT) > 0) {
         $params[] = 'via=' . urlencode(MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_ACCOUNT);
     }
     if (strlen(MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_RELATED_ACCOUNT) > 0) {
         $params[] = 'related=' . urlencode(MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_RELATED_ACCOUNT) . (strlen(MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_RELATED_ACCOUNT_DESC) > 0 ? ':' . urlencode(MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_RELATED_ACCOUNT_DESC) : '');
     }
     if (MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_COUNT_POSITION == 'Vertical') {
         $params[] = 'count=vertical';
     } elseif (MODULE_SOCIAL_BOOKMARKS_TWITTER_BUTTON_COUNT_POSITION == 'None') {
         $params[] = 'count=none';
     }
     $params = implode('&', $params);
     return '<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script><a href="http://twitter.com/share?' . $params . '" target="_blank" class="twitter-share-button">' . HTML::outputProtected($this->public_title) . '</a>';
 }
Ejemplo n.º 27
0
 function execute()
 {
     global $PHP_SELF, $oscTemplate;
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     if (basename($PHP_SELF) == 'index.php') {
         if (isset($_GET['manufacturers_id']) && is_numeric($_GET['manufacturers_id'])) {
             $Qmeta = $OSCOM_Db->get('manufacturers_info', ['manufacturers_seo_description', 'manufacturers_seo_keywords'], ['manufacturers_id' => (int) $_GET['manufacturers_id'], 'languages_id' => $OSCOM_Language->getId()]);
             if ($Qmeta->fetch() !== false) {
                 if (tep_not_null($Qmeta->value('manufacturers_seo_description'))) {
                     $oscTemplate->addBlock('<meta name="description" content="' . HTML::output($Qmeta->value('manufacturers_seo_description')) . '" />' . PHP_EOL, $this->group);
                 }
                 if (tep_not_null($Qmeta->value('manufacturers_seo_keywords')) && MODULE_HEADER_TAGS_MANUFACTURERS_SEO_KEYWORDS_STATUS == 'True') {
                     $oscTemplate->addBlock('<meta name="keywords" content="' . HTML::output($Qmeta->value('manufacturers_seo_keywords')) . '" />' . PHP_EOL, $this->group);
                 }
             }
         }
     }
 }
Ejemplo n.º 28
0
 function getOutput()
 {
     $entries = [];
     $addonsCache = new Cache('oscommerce_website-addons-latest5');
     if ($addonsCache->exists(360)) {
         $entries = $addonsCache->get();
     } else {
         $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&GetLatestAddons']);
         if (!empty($response)) {
             $response = json_decode($response, true);
             if (is_array($response) && count($response) === 5) {
                 $entries = $response;
             }
         }
         $addonsCache->save($entries);
     }
     $output = '<table class="table table-hover">
                <thead>
                  <tr class="info">
                    <th>' . OSCOM::getDef('module_admin_dashboard_latest_addons_title') . '</th>
                    <th class="text-right">' . OSCOM::getDef('module_admin_dashboard_latest_addons_date') . '</th>
                  </tr>
                </thead>
                <tbody>';
     if (is_array($entries) && count($entries) === 5) {
         foreach ($entries as $item) {
             $output .= '    <tr>
                         <td><a href="' . HTML::outputProtected($item['link']) . '" target="_blank">' . HTML::outputProtected($item['title']) . '</a></td>
                         <td class="text-right" style="white-space: nowrap;">' . HTML::outputProtected(DateTime::toShort($item['date'])) . '</td>
                       </tr>';
         }
     } else {
         $output .= '    <tr>
                       <td colspan="2">' . OSCOM::getDef('module_admin_dashboard_latest_addons_feed_error') . '</td>
                     </tr>';
     }
     $output .= '    <tr>
                     <td class="text-right" colspan="2"><a href="http://addons.oscommerce.com" target="_blank" title="' . HTML::outputProtected(OSCOM::getDef('module_admin_dashboard_latest_addons_icon_site')) . '"><span class="fa fa-fw fa-home"></span></a></td>
                   </tr>
                 </tbody>
               </table>';
     return $output;
 }
Ejemplo n.º 29
0
 function execute()
 {
     global $PHP_SELF, $lng, $request_type, $oscTemplate;
     if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
         if (!isset($lng) || isset($lng) && !is_object($lng)) {
             $lng = new language();
         }
         if (count($lng->catalog_languages) > 1) {
             $languages_string = '';
             foreach ($lng->catalog_languages as $key => $value) {
                 $languages_string .= ' <a href="' . OSCOM::link($PHP_SELF, tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . HTML::image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name'], NULL, NULL, NULL, false) . '</a> ';
             }
             ob_start();
             include 'includes/modules/boxes/templates/languages.php';
             $data = ob_get_clean();
             $oscTemplate->addBlock($data, $this->group);
         }
     }
 }
Ejemplo n.º 30
0
 public function get($group)
 {
     $result = '';
     if ($this->exists($group)) {
         $data = [];
         foreach ($this->data[$group] as $message) {
             $data['alert-' . $message['type']][] = $message['text'];
         }
         foreach ($data as $type => $messages) {
             $result .= '<div class="alert ' . HTML::outputProtected($type) . '" role="alert">';
             foreach ($messages as $message) {
                 $result .= '<p>' . $message . '</p>';
             }
             $result .= '</div>';
         }
         unset($this->data[$group]);
     }
     return $result;
 }