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(OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1))) {
                     $this->lang->loadDefinitions('Shop/modules/action_recorder/' . $module);
                     include OSCOM::getConfig('dir_root', 'Shop') . '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();
 }
Example #2
0
 public final function __construct()
 {
     $this->setInfo();
     $this->db = Registry::get('Db');
     $this->lang = Registry::get('Language');
     $this->init();
 }
 function record($success = true)
 {
     $OSCOM_Db = Registry::get('Db');
     if (tep_not_null($this->_module)) {
         $OSCOM_Db->save('action_recorder', ['module' => $this->_module, 'user_id' => (int) $this->_user_id, 'user_name' => $this->_user_name, 'identifier' => $this->getIdentifier(), 'success' => $success == true ? 1 : 0, 'date_added' => 'now()']);
     }
 }
Example #4
0
 function query($order_id)
 {
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     $Qorder = $OSCOM_Db->get(['orders o', 'orders_status s'], ['o.*', 's.orders_status_name'], ['o.orders_id' => (int) $order_id, 'o.orders_status' => ['rel' => 's.orders_status_id'], 's.language_id' => $OSCOM_Language->getId()]);
     $Qtotals = $OSCOM_Db->get('orders_total', ['title', 'text', 'class'], ['orders_id' => (int) $order_id], 'sort_order');
     while ($Qtotals->fetch()) {
         $this->totals[] = ['title' => $Qtotals->value('title'), 'text' => $Qtotals->value('text'), 'class' => $Qtotals->value('class')];
     }
     $this->info = array('id' => $Qorder->valueInt('orders_id'), 'total' => null, 'currency' => $Qorder->value('currency'), 'currency_value' => $Qorder->value('currency_value'), 'payment_method' => $Qorder->value('payment_method'), 'cc_type' => $Qorder->value('cc_type'), 'cc_owner' => $Qorder->value('cc_owner'), 'cc_number' => $Qorder->value('cc_number'), 'cc_expires' => $Qorder->value('cc_expires'), 'date_purchased' => $Qorder->value('date_purchased'), 'status' => $Qorder->value('orders_status_name'), 'orders_status' => $Qorder->value('orders_status'), 'last_modified' => $Qorder->value('last_modified'));
     foreach ($this->totals as $t) {
         if ($t['class'] == 'ot_total') {
             $this->info['total'] = $t['text'];
             break;
         }
     }
     $this->customer = array('name' => $Qorder->value('customers_name'), 'company' => $Qorder->value('customers_company'), 'street_address' => $Qorder->value('customers_street_address'), 'suburb' => $Qorder->value('customers_suburb'), 'city' => $Qorder->value('customers_city'), 'postcode' => $Qorder->value('customers_postcode'), 'state' => $Qorder->value('customers_state'), 'country' => $Qorder->value('customers_country'), 'format_id' => $Qorder->value('customers_address_format_id'), 'telephone' => $Qorder->value('customers_telephone'), 'email_address' => $Qorder->value('customers_email_address'));
     $this->delivery = array('name' => $Qorder->value('delivery_name'), 'company' => $Qorder->value('delivery_company'), 'street_address' => $Qorder->value('delivery_street_address'), 'suburb' => $Qorder->value('delivery_suburb'), 'city' => $Qorder->value('delivery_city'), 'postcode' => $Qorder->value('delivery_postcode'), 'state' => $Qorder->value('delivery_state'), 'country' => $Qorder->value('delivery_country'), 'format_id' => $Qorder->value('delivery_address_format_id'));
     $this->billing = array('name' => $Qorder->value('billing_name'), 'company' => $Qorder->value('billing_company'), 'street_address' => $Qorder->value('billing_street_address'), 'suburb' => $Qorder->value('billing_suburb'), 'city' => $Qorder->value('billing_city'), 'postcode' => $Qorder->value('billing_postcode'), 'state' => $Qorder->value('billing_state'), 'country' => $Qorder->value('billing_country'), 'format_id' => $Qorder->value('billing_address_format_id'));
     $index = 0;
     $Qproducts = $OSCOM_Db->get('orders_products', ['orders_products_id', 'products_name', 'products_model', 'products_price', 'products_tax', 'products_quantity', 'final_price'], ['orders_id' => (int) $order_id]);
     while ($Qproducts->fetch()) {
         $this->products[$index] = array('qty' => $Qproducts->value('products_quantity'), 'name' => $Qproducts->value('products_name'), 'model' => $Qproducts->value('products_model'), 'tax' => $Qproducts->value('products_tax'), 'price' => $Qproducts->value('products_price'), 'final_price' => $Qproducts->value('final_price'));
         $subindex = 0;
         $Qattributes = $OSCOM_Db->get('orders_products_attributes', ['products_options', 'products_options_values', 'options_values_price', 'price_prefix'], ['orders_id' => (int) $order_id, 'orders_products_id' => $Qproducts->valueInt('orders_products_id')]);
         if ($Qattributes->fetch() !== false) {
             do {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $Qattributes->value('products_options'), 'value' => $Qattributes->value('products_options_values'), 'prefix' => $Qattributes->value('price_prefix'), 'price' => $Qattributes->value('options_values_price'));
                 $subindex++;
             } while ($Qattributes->fetch());
         }
         $index++;
     }
 }
Example #5
0
 public function execute()
 {
     global $login_customer_id;
     $OSCOM_Db = Registry::get('Db');
     if (is_int($login_customer_id) && $login_customer_id > 0) {
         if (SESSION_RECREATE == 'True') {
             tep_session_recreate();
         }
         $Qcustomer = $OSCOM_Db->prepare('select c.customers_firstname, c.customers_default_address_id, ab.entry_country_id, ab.entry_zone_id from :table_customers c left join :table_address_book ab on (c.customers_id = ab.customers_id and c.customers_default_address_id = ab.address_book_id) where c.customers_id = :customers_id');
         $Qcustomer->bindInt(':customers_id', $login_customer_id);
         $Qcustomer->execute();
         $_SESSION['customer_id'] = $login_customer_id;
         $_SESSION['customer_default_address_id'] = $Qcustomer->valueInt('customers_default_address_id');
         $_SESSION['customer_first_name'] = $Qcustomer->value('customers_firstname');
         $_SESSION['customer_country_id'] = $Qcustomer->valueInt('entry_country_id');
         $_SESSION['customer_zone_id'] = $Qcustomer->valueInt('entry_zone_id');
         $Qupdate = $OSCOM_Db->prepare('update :table_customers_info set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1, password_reset_key = null, password_reset_date = null where customers_info_id = :customers_info_id');
         $Qupdate->bindInt(':customers_info_id', $_SESSION['customer_id']);
         $Qupdate->execute();
         // reset session token
         $_SESSION['sessiontoken'] = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
         // restore cart contents
         $_SESSION['cart']->restore_contents();
         if (count($_SESSION['navigation']->snapshot) > 0) {
             $origin_href = OSCOM::link($_SESSION['navigation']->snapshot['page'], tep_array_to_string($_SESSION['navigation']->snapshot['get'], array(session_name())), $_SESSION['navigation']->snapshot['mode']);
             $_SESSION['navigation']->clear_snapshot();
             HTTP::redirect($origin_href);
         }
         OSCOM::redirect('index.php');
     }
 }
Example #6
0
 function _sess_gc($maxlifetime)
 {
     $OSCOM_Db = Registry::get('Db');
     $Qdel = $OSCOM_Db->prepare('delete from :table_sessions where expiry < :expiry');
     $Qdel->bindValue(':expiry', time() - $maxlifetime);
     $Qdel->execute();
     return $Qdel->rowCount();
 }
Example #7
0
 function __construct()
 {
     $OSCOM_Db = Registry::get('Db');
     $this->currencies = array();
     $Qcurrencies = $OSCOM_Db->query('select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from :table_currencies');
     while ($Qcurrencies->fetch()) {
         $this->currencies[$Qcurrencies->value('code')] = array('title' => $Qcurrencies->value('title'), 'symbol_left' => $Qcurrencies->value('symbol_left'), 'symbol_right' => $Qcurrencies->value('symbol_right'), 'decimal_point' => $Qcurrencies->value('decimal_point'), 'thousands_point' => $Qcurrencies->value('thousands_point'), 'decimal_places' => $Qcurrencies->valueInt('decimal_places'), 'value' => $Qcurrencies->valueDecimal('value'));
     }
 }
Example #8
0
 function currencies()
 {
     $OSCOM_Db = Registry::get('Db');
     $this->currencies = array();
     $Qcurrencies = $OSCOM_Db->get('currencies', ['code', 'title', 'symbol_left', 'symbol_right', 'decimal_point', 'thousands_point', 'decimal_places', 'value']);
     while ($Qcurrencies->fetch()) {
         $this->currencies[$Qcurrencies->value('code')] = ['title' => $Qcurrencies->value('title'), 'symbol_left' => $Qcurrencies->value('symbol_left'), 'symbol_right' => $Qcurrencies->value('symbol_right'), 'decimal_point' => $Qcurrencies->value('decimal_point'), 'thousands_point' => $Qcurrencies->value('thousands_point'), 'decimal_places' => $Qcurrencies->value('decimal_places'), 'value' => $Qcurrencies->value('value')];
     }
 }
Example #9
0
function tep_expire_specials()
{
    $OSCOM_Db = Registry::get('Db');
    $Qspecials = $OSCOM_Db->query('select specials_id from :table_specials where status = 1 and now() >= expires_date and expires_date > 0');
    if ($Qspecials->fetch() !== false) {
        do {
            tep_set_specials_status($Qspecials->valueInt('specials_id'), 0);
        } while ($Qspecials->fetch());
    }
}
Example #10
0
function tep_dt_get_tables()
{
    $OSCOM_Db = Registry::get('Db');
    $result = array();
    $Qtables = $OSCOM_Db->query('show table status');
    while ($Qtables->fetch()) {
        $result[] = $Qtables->value('Name');
    }
    return $result;
}
 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);
 }
Example #12
0
 function language($lng = '')
 {
     $OSCOM_Db = Registry::get('Db');
     $this->languages = array('af' => 'af|afrikaans', 'ar' => 'ar([-_][[:alpha:]]{2})?|arabic', 'be' => 'be|belarusian', 'bg' => 'bg|bulgarian', 'br' => 'pt[-_]br|brazilian portuguese', 'ca' => 'ca|catalan', 'cs' => 'cs|czech', 'da' => 'da|danish', 'de' => 'de([-_][[:alpha:]]{2})?|german', 'el' => 'el|greek', 'en' => 'en([-_][[:alpha:]]{2})?|english', 'es' => 'es([-_][[:alpha:]]{2})?|spanish', 'et' => 'et|estonian', 'eu' => 'eu|basque', 'fa' => 'fa|farsi', 'fi' => 'fi|finnish', 'fo' => 'fo|faeroese', 'fr' => 'fr([-_][[:alpha:]]{2})?|french', 'ga' => 'ga|irish', 'gl' => 'gl|galician', 'he' => 'he|hebrew', 'hi' => 'hi|hindi', 'hr' => 'hr|croatian', 'hu' => 'hu|hungarian', 'id' => 'id|indonesian', 'it' => 'it|italian', 'ja' => 'ja|japanese', 'ko' => 'ko|korean', 'ka' => 'ka|georgian', 'lt' => 'lt|lithuanian', 'lv' => 'lv|latvian', 'mk' => 'mk|macedonian', 'mt' => 'mt|maltese', 'ms' => 'ms|malaysian', 'nl' => 'nl([-_][[:alpha:]]{2})?|dutch', 'no' => 'no|norwegian', 'pl' => 'pl|polish', 'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese', 'ro' => 'ro|romanian', 'ru' => 'ru|russian', 'sk' => 'sk|slovak', 'sq' => 'sq|albanian', 'sr' => 'sr|serbian', 'sv' => 'sv|swedish', 'sz' => 'sz|sami', 'sx' => 'sx|sutu', 'th' => 'th|thai', 'ts' => 'ts|tsonga', 'tr' => 'tr|turkish', 'tn' => 'tn|tswana', 'uk' => 'uk|ukrainian', 'ur' => 'ur|urdu', 'vi' => 'vi|vietnamese', 'tw' => 'zh[-_]tw|chinese traditional', 'zh' => 'zh|chinese simplified', 'ji' => 'ji|yiddish', 'zu' => 'zu|zulu');
     $this->catalog_languages = array();
     $Qlanguages = $OSCOM_Db->query('select languages_id, name, code, image, directory from :table_languages order by sort_order');
     while ($Qlanguages->fetch()) {
         $this->catalog_languages[$Qlanguages->value('code')] = array('id' => $Qlanguages->valueInt('languages_id'), 'name' => $Qlanguages->value('name'), 'image' => $Qlanguages->value('image'), 'directory' => $Qlanguages->value('directory'));
     }
     $this->browser_languages = '';
     $this->language = '';
     $this->set_language($lng);
 }
Example #13
0
 function pass()
 {
     $OSCOM_Db = Registry::get('Db');
     $Qcheck = $OSCOM_Db->query('show table status');
     if ($Qcheck->fetch() !== false) {
         do {
             if ($Qcheck->hasValue('Collation') && $Qcheck->value('Collation') != 'utf8_unicode_ci') {
                 return false;
             }
         } while ($Qcheck->fetch());
     }
     return true;
 }
 function pass()
 {
     global $PHP_SELF;
     $OSCOM_Db = Registry::get('Db');
     if ($PHP_SELF == 'security_checks.php') {
         if (defined('MODULE_SECURITY_CHECK_EXTENDED_LAST_RUN_DATETIME')) {
             $OSCOM_Db->save('configuration', ['configuration_value' => time()], ['configuration_key' => 'MODULE_SECURITY_CHECK_EXTENDED_LAST_RUN_DATETIME']);
         } else {
             $OSCOM_Db->save('configuration', ['configuration_title' => 'Security Check Extended Last Run', 'configuration_key' => 'MODULE_SECURITY_CHECK_EXTENDED_LAST_RUN_DATETIME', 'configuration_value' => time(), 'configuration_description' => 'The date and time the last extended security check was performed.', 'configuration_group_id' => '6', 'date_added' => 'now()']);
         }
         return true;
     }
     return defined('MODULE_SECURITY_CHECK_EXTENDED_LAST_RUN_DATETIME') && MODULE_SECURITY_CHECK_EXTENDED_LAST_RUN_DATETIME > strtotime('-30 days');
 }
Example #15
0
 public function __construct()
 {
     static $_category_tree_data;
     $OSCOM_Db = Registry::get('Db');
     $OSCOM_Language = Registry::get('Language');
     if (isset($_category_tree_data)) {
         $this->_data = $_category_tree_data;
     } else {
         $Qcategories = $OSCOM_Db->prepare('select c.categories_id, c.parent_id, c.categories_image, cd.categories_name from :table_categories c, :table_categories_description cd where c.categories_id = cd.categories_id and cd.language_id = :language_id order by c.parent_id, c.sort_order, cd.categories_name');
         $Qcategories->bindInt(':language_id', $OSCOM_Language->getId());
         $Qcategories->setCache('categories-lang' . $OSCOM_Language->getId());
         $Qcategories->execute();
         while ($Qcategories->fetch()) {
             $this->_data[$Qcategories->valueInt('parent_id')][$Qcategories->valueInt('categories_id')] = array('name' => $Qcategories->value('categories_name'), 'image' => $Qcategories->value('categories_image'));
         }
         $_category_tree_data = $this->_data;
     }
 }
Example #16
0
 function send($newsletter_id)
 {
     $OSCOM_Db = Registry::get('Db');
     $newsletterEmail = new Mail();
     $newsletterEmail->setFrom(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER);
     $newsletterEmail->setSubject($this->title);
     if (!empty($this->content)) {
         $newsletterEmail->setBodyPlain($this->content);
     }
     if (!empty($this->content_html)) {
         $newsletterEmail->setBodyHTML($this->content_html);
     }
     $Qmail = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address'], ['customers_newsletter' => '1']);
     while ($Qmail->fetch()) {
         $newsletterEmail->clearTo();
         $newsletterEmail->addTo($Qmail->value('customers_email_address'), $Qmail->value('customers_firstname') . ' ' . $Qmail->value('customers_lastname'));
         $newsletterEmail->send();
     }
     $OSCOM_Db->save('newsletters', ['date_sent' => 'now()', 'status' => '1'], ['newsletters_id' => (int) $newsletter_id]);
 }
Example #17
0
 public function __construct($code = null)
 {
     $this->db = Registry::get('Db');
     $Qlanguages = $this->db->prepare('select languages_id, name, code, image, directory from :table_languages order by sort_order');
     $Qlanguages->setCache('languages-system');
     $Qlanguages->execute();
     while ($Qlanguages->fetch()) {
         $this->languages[$Qlanguages->value('code')] = ['id' => $Qlanguages->valueInt('languages_id'), 'code' => $Qlanguages->value('code'), 'name' => $Qlanguages->value('name'), 'image' => $Qlanguages->value('image'), 'directory' => $Qlanguages->value('directory')];
     }
     $this->detectors = ['af' => 'af|afrikaans', 'ar' => 'ar([-_][[:alpha:]]{2})?|arabic', 'be' => 'be|belarusian', 'bg' => 'bg|bulgarian', 'br' => 'pt[-_]br|brazilian portuguese', 'ca' => 'ca|catalan', 'cs' => 'cs|czech', 'da' => 'da|danish', 'de' => 'de([-_][[:alpha:]]{2})?|german', 'el' => 'el|greek', 'en' => 'en([-_][[:alpha:]]{2})?|english', 'es' => 'es([-_][[:alpha:]]{2})?|spanish', 'et' => 'et|estonian', 'eu' => 'eu|basque', 'fa' => 'fa|farsi', 'fi' => 'fi|finnish', 'fo' => 'fo|faeroese', 'fr' => 'fr([-_][[:alpha:]]{2})?|french', 'ga' => 'ga|irish', 'gl' => 'gl|galician', 'he' => 'he|hebrew', 'hi' => 'hi|hindi', 'hr' => 'hr|croatian', 'hu' => 'hu|hungarian', 'id' => 'id|indonesian', 'it' => 'it|italian', 'ja' => 'ja|japanese', 'ko' => 'ko|korean', 'ka' => 'ka|georgian', 'lt' => 'lt|lithuanian', 'lv' => 'lv|latvian', 'mk' => 'mk|macedonian', 'mt' => 'mt|maltese', 'ms' => 'ms|malaysian', 'nl' => 'nl([-_][[:alpha:]]{2})?|dutch', 'no' => 'no|norwegian', 'pl' => 'pl|polish', 'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese', 'ro' => 'ro|romanian', 'ru' => 'ru|russian', 'sk' => 'sk|slovak', 'sq' => 'sq|albanian', 'sr' => 'sr|serbian', 'sv' => 'sv|swedish', 'sz' => 'sz|sami', 'sx' => 'sx|sutu', 'th' => 'th|thai', 'ts' => 'ts|tsonga', 'tr' => 'tr|turkish', 'tn' => 'tn|tswana', 'uk' => 'uk|ukrainian', 'ur' => 'ur|urdu', 'vi' => 'vi|vietnamese', 'tw' => 'zh[-_]tw|chinese traditional', 'zh' => 'zh|chinese simplified', 'ji' => 'ji|yiddish', 'zu' => 'zu|zulu'];
     if (!isset($code) || !$this->exists($code)) {
         if (isset($_SESSION['language'])) {
             $code = $_SESSION['language'];
         } else {
             $client = $this->getClientPreference();
             $code = $client !== false ? $client : DEFAULT_LANGUAGE;
         }
     }
     $this->set($code);
 }
Example #18
0
 function cfg_modules()
 {
     global $PHP_SELF;
     $this->lang = Registry::get('Language');
     $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
     $directory = OSCOM::getConfig('dir_root') . 'includes/modules/cfg_modules';
     if ($dir = @dir($directory)) {
         while ($file = $dir->read()) {
             if (!is_dir($directory . $file)) {
                 if (substr($file, strrpos($file, '.')) == $file_extension) {
                     $class = substr($file, 0, strrpos($file, '.'));
                     $this->lang->loadDefinitions('modules/cfg_modules/' . pathinfo($file, PATHINFO_FILENAME));
                     include OSCOM::getConfig('dir_root') . 'includes/modules/cfg_modules/' . $class . '.php';
                     $m = new $class();
                     $this->_modules[] = array('code' => $m->code, 'directory' => $m->directory, 'language_directory' => $m->language_directory, 'key' => $m->key, 'title' => $m->title, 'template_integration' => $m->template_integration, 'site' => $m->site);
                 }
             }
         }
     }
 }
Example #19
0
 function output()
 {
     $output_string = '';
     if (is_array($this->modules)) {
         foreach ($this->modules as $value) {
             if (strpos($value, '\\') !== false) {
                 $OSCOM_OTM = Registry::get('OrderTotal_' . str_replace('\\', '_', $value));
             } else {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $OSCOM_OTM = $GLOBALS[$class];
             }
             if ($OSCOM_OTM->enabled) {
                 $size = sizeof($OSCOM_OTM->output);
                 for ($i = 0; $i < $size; $i++) {
                     $output_string .= '              <tr>' . "\n" . '                <td align="right" class="main">' . $OSCOM_OTM->output[$i]['title'] . '</td>' . "\n" . '                <td align="right" class="main">' . $OSCOM_OTM->output[$i]['text'] . '</td>' . "\n" . '              </tr>';
                 }
             }
         }
     }
     return $output_string;
 }
Example #20
0
 public function __construct()
 {
     register_shutdown_function(function () {
         if (!empty($this->data)) {
             $_SESSION['MessageStack_Data'] = $this->data;
         }
     });
     Registry::get('Hooks')->watch('Session', 'StartAfter', 'execute', function () {
         if (isset($_SESSION['MessageStack_Data']) && !empty($_SESSION['MessageStack_Data'])) {
             foreach ($_SESSION['MessageStack_Data'] as $group => $messages) {
                 foreach ($messages as $message) {
                     $this->add($message['text'], $message['type'], $group);
                 }
             }
             unset($_SESSION['MessageStack_Data']);
         }
     });
     Registry::get('Hooks')->watch('Account', 'LogoutAfter', 'execute', function () {
         $this->reset('main');
     });
 }
Example #21
0
 public function call($group, $hook, $action = 'execute', $flatten = false)
 {
     if (!isset($this->hooks[$this->site][$group][$hook][$action])) {
         $this->register($group, $hook, $action);
     }
     $result = [];
     foreach ($this->hooks[$this->site][$group][$hook][$action] as $code) {
         $class = Apps::getModuleClass($code, 'Hooks');
         $regclass = 'Hook_' . str_replace(['/', '\\'], '_', $code);
         if (!Registry::exists($regclass)) {
             Registry::set($regclass, new $class());
         }
         $bait = Registry::get($regclass)->{$action}();
         if (!empty($bait)) {
             $result[] = $bait;
         }
     }
     if ($flatten === true) {
         $result = implode('', $result);
     }
     return $result;
 }
Example #22
0
 public function execute()
 {
     $OSCOM_Session = Registry::get('Session');
     // initialize a session token
     if (!isset($_SESSION['sessiontoken'])) {
         $_SESSION['sessiontoken'] = md5(Hash::getRandomInt() . Hash::getRandomInt() . Hash::getRandomInt() . Hash::getRandomInt());
     }
     // verify the ssl_session_id if the feature is enabled
     if (HTTP::getRequestType() === 'SSL' && SESSION_CHECK_SSL_SESSION_ID == 'True' && $OSCOM_Session->hasStarted()) {
         if (!isset($_SESSION['SSL_SESSION_ID'])) {
             $_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
         }
         if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
             $OSCOM_Session->kill();
             OSCOM::redirect('ssl_check.php');
         }
     }
     // verify the browser user agent if the feature is enabled
     if (SESSION_CHECK_USER_AGENT == 'True') {
         if (!isset($_SESSION['SESSION_USER_AGENT'])) {
             $_SESSION['SESSION_USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
         }
         if ($_SESSION['SESSION_USER_AGENT'] != $_SERVER['HTTP_USER_AGENT']) {
             $OSCOM_Session->kill();
             OSCOM::redirect('login.php');
         }
     }
     // verify the IP address if the feature is enabled
     if (SESSION_CHECK_IP_ADDRESS == 'True') {
         if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
             $_SESSION['SESSION_IP_ADDRESS'] = HTTP::getIpAddress();
         }
         if ($_SESSION['SESSION_IP_ADDRESS'] != HTTP::getIpAddress()) {
             $OSCOM_Session->kill();
             OSCOM::redirect('login.php');
         }
     }
 }
Example #23
0
 public static function form($name, $action, $method = 'post', $parameters = '', array $flags = [])
 {
     if (!isset($flags['tokenize']) || !is_bool($flags['tokenize'])) {
         $flags['tokenize'] = false;
     }
     if (!isset($flags['session_id']) || !is_bool($flags['session_id'])) {
         $flags['session_id'] = false;
     }
     $form = '<form name="' . static::output($name) . '" action="' . static::output($action) . '" method="' . static::output($method) . '"';
     if (!empty($parameters)) {
         $form .= ' ' . $parameters;
     }
     $form .= '>';
     if (isset($flags['action'])) {
         $form .= static::hiddenField('action', $flags['action']);
     }
     if ($flags['session_id'] === true && Registry::get('Session')->hasStarted() && strlen(SID) > 0 && !Registry::get('Session')->isForceCookies()) {
         $form .= static::hiddenField(session_name(), session_id());
     }
     if ($flags['tokenize'] === true && isset($_SESSION['sessiontoken'])) {
         $form .= static::hiddenField('formid', $_SESSION['sessiontoken']);
     }
     return $form;
 }
Example #24
0
 function getNumberOfItems()
 {
     global $order, $total_count;
     $OSCOM_Db = Registry::get('Db');
     $number_of_items = $total_count;
     if ($order->content_type == 'mixed') {
         $number_of_items = 0;
         for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
             $number_of_items += $order->products[$i]['qty'];
             if (isset($order->products[$i]['attributes'])) {
                 foreach ($order->products[$i]['attributes'] as $option => $value) {
                     $Qcheck = $OSCOM_Db->prepare('select pa.products_id from :table_products_attributes pa, :table_products_attributes_download pad where pa.products_id = :products_id and pa.options_values_id = :options_values_id and pa.products_attributes_id = pad.products_attributes_id');
                     $Qcheck->bindInt(':products_id', $order->products[$i]['id']);
                     $Qcheck->bindInt(':options_values_id', $value['value_id']);
                     $Qcheck->execute();
                     if ($Qcheck->fetch() !== false) {
                         $number_of_items -= $order->products[$i]['qty'];
                     }
                 }
             }
         }
     }
     return $number_of_items;
 }
Example #25
0
 function remove()
 {
     return Registry::get('Db')->exec('delete from :table_configuration where configuration_key in ("' . implode('", "', $this->keys()) . '")');
 }
Example #26
0
    define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
    // set the cookie domain
    $cookie_domain = HTTPS_COOKIE_DOMAIN;
    $cookie_path = HTTPS_COOKIE_PATH;
} else {
    $request_type = 'NONSSL';
    define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
    $cookie_domain = HTTP_COOKIE_DOMAIN;
    $cookie_path = HTTP_COOKIE_PATH;
}
// set php_self in the local scope
$req = parse_url($_SERVER['SCRIPT_NAME']);
$PHP_SELF = substr($req['path'], $request_type == 'NONSSL' ? strlen(DIR_WS_HTTP_CATALOG) : strlen(DIR_WS_HTTPS_CATALOG));
Registry::set('Cache', new Cache());
Registry::set('Db', Db::initialize());
$OSCOM_Db = Registry::get('Db');
// set the application parameters
$Qcfg = $OSCOM_Db->get('configuration', ['configuration_key as k', 'configuration_value as v']);
//, null, null, null, 'configuration'); // TODO add cache when supported by admin
while ($Qcfg->fetch()) {
    define($Qcfg->value('k'), $Qcfg->value('v'));
}
// if gzip_compression is enabled, start to buffer the output
if (GZIP_COMPRESSION == 'true' && extension_loaded('zlib') && !headers_sent()) {
    if ((int) ini_get('zlib.output_compression') < 1) {
        if (PHP_VERSION < '5.4' || PHP_VERSION > '5.4.5') {
            // see PHP bug 55544
            ob_start('ob_gzhandler');
        }
    } elseif (function_exists('ini_set')) {
        ini_set('zlib.output_compression_level', GZIP_LEVEL);
Example #27
0
            $class = $code = $_GET['module'];
            foreach ($modules['installed'] as $m) {
                if ($m['code'] == $code) {
                    if (strpos($code, '\\') !== false) {
                        $class = Apps::getModuleClass($code, 'Content');
                        $installed_code = $m['code'];
                    } else {
                        $installed_code = $m['group'] . '/' . $m['code'];
                    }
                    $module = new $class();
                    $module->remove();
                    $modules_installed = explode(';', MODULE_CONTENT_INSTALLED);
                    if (in_array($installed_code, $modules_installed)) {
                        unset($modules_installed[array_search($installed_code, $modules_installed)]);
                    }
                    Registry::get('Db')->save('configuration', ['configuration_value' => implode(';', $modules_installed), 'last_modified' => 'now()'], ['configuration_key' => 'MODULE_CONTENT_INSTALLED']);
                    OSCOM::redirect('modules_content.php');
                }
            }
            OSCOM::redirect('modules_content.php', 'module=' . $code);
            break;
    }
}
require $oscTemplate->getFile('template_top.php');
?>

    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php 
Example #28
0
 function cart()
 {
     global $currencies;
     $OSCOM_Db = Registry::get('Db');
     $this->content_type = $_SESSION['cart']->get_content_type();
     if ($this->content_type != 'virtual' && $_SESSION['sendto'] == false) {
         $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
     }
     $customer_address = ['customers_firstname' => null, 'customers_lastname' => null, 'customers_telephone' => null, 'customers_email_address' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null];
     if (isset($_SESSION['customer_id'])) {
         $Qcustomer = $OSCOM_Db->prepare('select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from :table_customers c, :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries co on (ab.entry_country_id = co.countries_id) where c.customers_id = :customers_id and c.customers_id = ab.customers_id and c.customers_default_address_id = ab.address_book_id');
         $Qcustomer->bindInt(':customers_id', $_SESSION['customer_id']);
         $Qcustomer->execute();
         $customer_address = $Qcustomer->toArray();
     }
     $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     if (isset($_SESSION['sendto'])) {
         if (is_array($_SESSION['sendto']) && !empty($_SESSION['sendto'])) {
             $shipping_address = array('entry_firstname' => $_SESSION['sendto']['firstname'], 'entry_lastname' => $_SESSION['sendto']['lastname'], 'entry_company' => $_SESSION['sendto']['company'], 'entry_street_address' => $_SESSION['sendto']['street_address'], 'entry_suburb' => $_SESSION['sendto']['suburb'], 'entry_postcode' => $_SESSION['sendto']['postcode'], 'entry_city' => $_SESSION['sendto']['city'], 'entry_zone_id' => $_SESSION['sendto']['zone_id'], 'zone_name' => $_SESSION['sendto']['zone_name'], 'entry_country_id' => $_SESSION['sendto']['country_id'], 'countries_id' => $_SESSION['sendto']['country_id'], 'countries_name' => $_SESSION['sendto']['country_name'], 'countries_iso_code_2' => $_SESSION['sendto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['sendto']['country_iso_code_3'], 'address_format_id' => $_SESSION['sendto']['address_format_id'], 'entry_state' => $_SESSION['sendto']['zone_name']);
         } elseif (is_numeric($_SESSION['sendto'])) {
             $Qaddress = $OSCOM_Db->prepare('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
             $Qaddress->bindInt(':customers_id', $_SESSION['customer_id']);
             $Qaddress->bindInt(':address_book_id', $_SESSION['sendto']);
             $Qaddress->execute();
             $shipping_address = $Qaddress->toArray();
         }
     }
     $billing_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     if (isset($_SESSION['billto'])) {
         if (is_array($_SESSION['billto']) && !empty($_SESSION['billto'])) {
             $billing_address = array('entry_firstname' => $_SESSION['billto']['firstname'], 'entry_lastname' => $_SESSION['billto']['lastname'], 'entry_company' => $_SESSION['billto']['company'], 'entry_street_address' => $_SESSION['billto']['street_address'], 'entry_suburb' => $_SESSION['billto']['suburb'], 'entry_postcode' => $_SESSION['billto']['postcode'], 'entry_city' => $_SESSION['billto']['city'], 'entry_zone_id' => $_SESSION['billto']['zone_id'], 'zone_name' => $_SESSION['billto']['zone_name'], 'entry_country_id' => $_SESSION['billto']['country_id'], 'countries_id' => $_SESSION['billto']['country_id'], 'countries_name' => $_SESSION['billto']['country_name'], 'countries_iso_code_2' => $_SESSION['billto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['billto']['country_iso_code_3'], 'address_format_id' => $_SESSION['billto']['address_format_id'], 'entry_state' => $_SESSION['billto']['zone_name']);
         } elseif (is_numeric($_SESSION['billto'])) {
             $Qaddress = $OSCOM_Db->prepare('select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
             $Qaddress->bindInt(':customers_id', $_SESSION['customer_id']);
             $Qaddress->bindInt(':address_book_id', $_SESSION['billto']);
             $Qaddress->execute();
             $billing_address = $Qaddress->toArray();
         }
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $_SESSION['currency'], 'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'], 'payment_method' => isset($_SESSION['payment']) ? $_SESSION['payment'] : '', 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => isset($_SESSION['shipping']) ? $_SESSION['shipping']['title'] : '', 'shipping_cost' => isset($_SESSION['shipping']) ? $_SESSION['shipping']['cost'] : 0, 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => isset($_SESSION['comments']) && !empty($_SESSION['comments']) ? $_SESSION['comments'] : '');
     if (isset($_SESSION['payment'])) {
         if (strpos($_SESSION['payment'], '\\') !== false) {
             $code = 'Payment_' . str_replace('\\', '_', $_SESSION['payment']);
             if (Registry::exists($code)) {
                 $OSCOM_PM = Registry::get($code);
             }
         } elseif (is_object($GLOBALS[$_SESSION['payment']])) {
             $OSCOM_PM = $GLOBALS[$_SESSION['payment']];
         }
         if (isset($OSCOM_PM)) {
             if (isset($OSCOM_PM->public_title)) {
                 $this->info['payment_method'] = $OSCOM_PM->public_title;
             } else {
                 $this->info['payment_method'] = $OSCOM_PM->title;
             }
             if (isset($OSCOM_PM->order_status) && is_numeric($OSCOM_PM->order_status) && $OSCOM_PM->order_status > 0) {
                 $this->info['order_status'] = $OSCOM_PM->order_status;
             }
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => tep_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => tep_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => tep_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             foreach ($products[$i]['attributes'] as $option => $value) {
                 $Qattributes = $OSCOM_Db->prepare('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :language_id and popt.language_id = poval.language_id');
                 $Qattributes->bindInt(':products_id', $products[$i]['id']);
                 $Qattributes->bindInt(':options_id', $option);
                 $Qattributes->bindInt(':options_values_id', $value);
                 $Qattributes->bindInt(':language_id', $_SESSION['languages_id']);
                 $Qattributes->execute();
                 $this->products[$index]['attributes'][$subindex] = array('option' => $Qattributes->value('products_options_name'), 'value' => $Qattributes->value('products_options_values_name'), 'option_id' => $option, 'value_id' => $value, 'prefix' => $Qattributes->value('price_prefix'), 'price' => $Qattributes->value('options_values_price'));
                 $subindex++;
             }
         }
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
Example #29
0
    unset($_SESSION['sendto']);
}
if (isset($_SESSION['billto'])) {
    unset($_SESSION['billto']);
}
if (isset($_SESSION['shipping'])) {
    unset($_SESSION['shipping']);
}
if (isset($_SESSION['payment'])) {
    unset($_SESSION['payment']);
}
if (isset($_SESSION['comments'])) {
    unset($_SESSION['comments']);
}
$_SESSION['cart']->reset();
Registry::get('Hooks')->call('Account', 'Logout');
require $oscTemplate->getFile('template_top.php');
?>

<div class="page-header">
  <h1><?php 
echo OSCOM::getDef('heading_title');
?>
</h1>
</div>

<div class="contentContainer">
  <div class="contentText">
    <div class="alert alert-danger">
      <?php 
echo OSCOM::getDef('text_main');
Example #30
0
 public static function getDef()
 {
     $OSCOM_Language = Registry::get('Language');
     return call_user_func_array([$OSCOM_Language, 'getDef'], func_get_args());
 }