Пример #1
0
    protected function process() {
      $OSCOM_MessageStack = Registry::get('MessageStack');

      $this->_page_title = OSCOM::getDef('heading_title');

      if ( isset($_GET['cid']) && is_numeric($_GET['cid']) ) {
        $this->_category_id = $_GET['cid'];
      }

      $this->_tree = new CategoryTree();
      Registry::set('CategoryTree', $this->_tree);

      Registry::set('Currencies', new Currencies());

      Registry::set('Tax', new Tax());

      Registry::set('Image', new Image());

// check if the products image directory exists
      if ( is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products') ) {
        if ( !is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products') ) {
          $OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('ms_error_image_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products'), 'error');
        }
      } else {
        $OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('ms_error_image_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products'), 'error');
      }

// check for imagemagick or GD
      if ( !Image::hasGDSupport() && ((strlen(CFG_APP_IMAGEMAGICK_CONVERT) < 1) || !file_exists(CFG_APP_IMAGEMAGICK_CONVERT)) ) {
        $OSCOM_MessageStack->add('header', OSCOM::getDef('ms_warning_image_processor_not_available'), 'warning');
      }
    }
Пример #2
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_Customer = Registry::get('Customer');
     global $osC_oiAddress;
     // HPDL
     $application->setPageTitle(OSCOM::getDef('shipping_method_heading'));
     $application->setPageContent('shipping.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_checkout_shipping'), OSCOM::getLink(null, null, 'Shipping', 'SSL'));
     }
     // load shipping address page if no default address exists
     if (!$OSCOM_ShoppingCart->hasShippingAddress()) {
         $application->setPageTitle(OSCOM::getDef('shipping_address_heading'));
         $application->setPageContent('shipping_address.php');
         $OSCOM_Template->addJavascriptFilename(OSCOM::getPublicSiteLink('javascript/checkout_shipping_address.js'));
         $OSCOM_Template->addJavascriptPhpFilename(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/form_check.js.php');
         if (!$OSCOM_Customer->isLoggedOn()) {
             $osC_oiAddress = new ObjectInfo($OSCOM_ShoppingCart->getShippingAddress());
         }
     } else {
         $OSCOM_Template->addJavascriptFilename(OSCOM::getPublicSiteLink('javascript/checkout_shipping.js'));
         // load all enabled shipping modules
         Registry::set('Shipping', new ShippingClass(), true);
     }
 }
Пример #3
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $application->setPageTitle(sprintf(OSCOM::getDef('index_heading'), STORE_NAME));
     $application->setPageContent('product_listing.php');
     if (is_numeric($_GET['Manufacturers'])) {
         Registry::set('Manufacturer', new Manufacturer($_GET['Manufacturers']));
         $OSCOM_Manufacturer = Registry::get('Manufacturer');
         $application->setPageTitle($OSCOM_Manufacturer->getTitle());
         // HPDL        $application->setPageImage('manufacturers/' . $OSCOM_Manufacturer->getImage());
         if ($OSCOM_Service->isStarted('Breadcrumb')) {
             $OSCOM_Breadcrumb->add($OSCOM_Manufacturer->getTitle(), OSCOM::getLink());
         }
         Registry::set('Products', new Products());
         $OSCOM_Products = Registry::get('Products');
         $OSCOM_Products->setManufacturer($OSCOM_Manufacturer->getID());
         if (isset($_GET['filter']) && is_numeric($_GET['filter']) && $_GET['filter'] > 0) {
             $OSCOM_Products->setCategory($_GET['filter']);
         }
         if (isset($_GET['sort']) && !empty($_GET['sort'])) {
             if (strpos($_GET['sort'], '|d') !== false) {
                 $OSCOM_Products->setSortBy(substr($_GET['sort'], 0, -2), '-');
             } else {
                 $OSCOM_Products->setSortBy($_GET['sort']);
             }
         }
     } else {
         osc_redirect(OSCOM::getLink(OSCOM::getDefaultSite(), OSCOM::getDefaultSiteApplication()));
     }
 }
 public static function isValid(Product $OSCOM_Product)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     if ($OSCOM_ShoppingCart->hasBillingAddress() === false) {
         if ($OSCOM_Customer->hasDefaultAddress()) {
             $OSCOM_ShoppingCart->setBillingAddress($OSCOM_Customer->getDefaultAddressID());
             $OSCOM_ShoppingCart->resetBillingMethod();
         } elseif ($OSCOM_ShoppingCart->hasShippingAddress()) {
             $OSCOM_ShoppingCart->setBillingAddress($OSCOM_ShoppingCart->getShippingAddress());
             $OSCOM_ShoppingCart->resetBillingMethod();
         }
     }
     if ($OSCOM_ShoppingCart->hasBillingMethod() === false) {
         if (Registry::exists('Payment') === false) {
             Registry::set('Payment', new Payment());
         }
         $OSCOM_Payment = Registry::get('Payment');
         $OSCOM_Payment->loadAll();
         if ($OSCOM_Payment->hasActive()) {
             $payment_modules = $OSCOM_Payment->getActive();
             $payment_module = $payment_modules[0];
             $OSCOM_PaymentModule = Registry::get('Payment_' . $payment_module);
             $OSCOM_ShoppingCart->setBillingMethod(array('id' => $OSCOM_PaymentModule->getCode(), 'title' => $OSCOM_PaymentModule->getMethodTitle()));
         }
     }
     return $OSCOM_ShoppingCart->hasBillingAddress() && $OSCOM_ShoppingCart->hasBillingMethod();
 }
Пример #5
0
 public function load($module)
 {
     if (in_array($module, $this->_modules)) {
         $module_class = 'osCommerce\\OM\\Core\\Site\\Shop\\Module\\Payment\\' . $module;
         Registry::set('PaymentModule', new $module_class(), true);
     }
 }
Пример #6
0
 public static function execute($search, $parent_id = 0)
 {
     if (Registry::exists('CategoryTree')) {
         $OSCOM_CategoryTree = Registry::get('CategoryTree');
     } else {
         $OSCOM_CategoryTree = new CategoryTree();
         Registry::set('CategoryTree', $OSCOM_CategoryTree);
     }
     $OSCOM_CategoryTree->reset();
     $OSCOM_CategoryTree->setRootCategoryID($parent_id);
     $OSCOM_CategoryTree->setBreadcrumbUsage(false);
     $categories = array();
     foreach ($OSCOM_CategoryTree->getArray() as $c) {
         if (stripos($c['title'], $search) !== false) {
             if ($c['id'] != $parent_id) {
                 $category_path = $OSCOM_CategoryTree->getPathArray($c['id']);
                 $top_category_id = $category_path[0]['id'];
                 if (!in_array($top_category_id, $categories)) {
                     $categories[] = $top_category_id;
                 }
             }
         }
     }
     $result = array('entries' => array());
     foreach ($categories as $c) {
         $result['entries'][] = array('id' => $OSCOM_CategoryTree->getData($c, 'id'), 'title' => $OSCOM_CategoryTree->getData($c, 'name'), 'products' => $OSCOM_CategoryTree->getData($c, 'count'));
     }
     $result['total'] = count($result['entries']);
     return $result;
 }
Пример #7
0
 public static function start()
 {
     $OSCOM_Service = Registry::get('Service');
     Registry::set('RecentlyVisited', new RecentlyVisitedClass());
     $OSCOM_Service->addCallBeforePageContent('RecentlyVisited', 'initialize');
     return true;
 }
Пример #8
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_NavigationHistory = Registry::get('NavigationHistory');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $OSCOM_Customer->isLoggedOn() === false) {
         $OSCOM_NavigationHistory->setSnapshot();
         osc_redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
     }
     $requested_product = null;
     $product_check = false;
     if (count($_GET) > 3) {
         $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
         if ($requested_product == 'Write') {
             unset($requested_product);
             if (count($_GET) > 4) {
                 $requested_product = basename(key(array_slice($_GET, 4, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $product_check = true;
         }
     }
     if ($product_check === false) {
         $application->setPageContent('not_found.php');
         return false;
     }
     Registry::set('Product', new Product($requested_product));
     $OSCOM_Product = Registry::get('Product');
     if (empty($_POST['from_name'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_customers_name_empty'));
     }
     if (!osc_validate_email_address($_POST['from_email_address'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_customers_email_address'));
     }
     if (empty($_POST['to_name'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_friends_name_empty'));
     }
     if (!osc_validate_email_address($_POST['to_email_address'])) {
         $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_friends_email_address'));
     }
     if ($OSCOM_MessageStack->size('TellAFriend') < 1) {
         $email_subject = sprintf(OSCOM::getDef('email_tell_a_friend_subject'), osc_sanitize_string($_POST['from_name']), STORE_NAME);
         $email_body = sprintf(OSCOM::getDef('email_tell_a_friend_intro'), osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['from_name']), $OSCOM_Product->getTitle(), STORE_NAME) . "\n\n";
         if (!empty($_POST['message'])) {
             $email_body .= osc_sanitize_string($_POST['message']) . "\n\n";
         }
         $email_body .= sprintf(OSCOM::getDef('email_tell_a_friend_link'), OSCOM::getLink(null, null, $OSCOM_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf(OSCOM::getDef('email_tell_a_friend_signature'), STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");
         osc_email(osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['to_email_address']), $email_subject, $email_body, osc_sanitize_string($_POST['from_name']), osc_sanitize_string($_POST['from_email_address']));
         $OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('success_tell_a_friend_email_sent'), $OSCOM_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success');
         osc_redirect(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword()));
     }
     $application->setPageTitle($OSCOM_Product->getTitle());
     $application->setPageContent('tell_a_friend.php');
 }
Пример #9
0
 public static function start()
 {
     Registry::set('Breadcrumb', new BreadcrumbClass());
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_top'), OSCOM::getLink(OSCOM::getDefaultSite(), OSCOM::getDefaultSiteApplication()));
     $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_shop'), OSCOM::getLink('Shop', 'Index'));
     return true;
 }
Пример #10
0
 public static function execute($data)
 {
     if ($OSCOM_PDO = PDO::initialize($data['server'], $data['username'], $data['password'], null, $data['port'], $data['class'])) {
         Registry::set('PDO', $OSCOM_PDO);
         OSCOM::callDB('Setup\\Install\\CreateDB', array('database' => $data['database']));
     }
     return PDO::initialize($data['server'], $data['username'], $data['password'], $data['database'], $data['port'], $data['class']);
 }
Пример #11
0
 public static function start()
 {
     Registry::set('Banner', new BannerClass());
     $OSCOM_Banner = Registry::get('Banner');
     $OSCOM_Banner->activateAll();
     $OSCOM_Banner->expireAll();
     return true;
 }
Пример #12
0
 public static function start()
 {
     Registry::set('Specials', new SpecialsClass());
     $OSCOM_Specials = Registry::get('Specials');
     $OSCOM_Specials->activateAll();
     $OSCOM_Specials->expireAll();
     return true;
 }
Пример #13
0
 public static function initialize()
 {
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('PDO', PDO::initialize());
     foreach (OSCOM::callDB('Shop\\GetConfiguration', null, 'Site') as $param) {
         define($param['cfgKey'], $param['cfgValue']);
     }
     Registry::set('Session', Session::load('adminSid'));
     Registry::get('Session')->start();
     Registry::get('MessageStack')->loadFromSession();
     Registry::set('Language', new Language());
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         Registry::get('MessageStack')->add('header', 'No access.', 'error');
         OSCOM::redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
     // HPDL move following checks elsewhere
     // check if a default currency is set
     if (!defined('DEFAULT_CURRENCY')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
     }
     // check if a default language is set
     if (!defined('DEFAULT_LANGUAGE')) {
         Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
     }
     if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
     }
     // check if Work directories are writable
     $work_dirs = array();
     foreach (array('Cache', 'CoreUpdate', 'Database', 'Logs', 'Session', 'Temp') as $w) {
         if (!is_writable(OSCOM::BASE_DIRECTORY . 'Work/' . $w)) {
             $work_dirs[] = $w;
         }
     }
     if (!empty($work_dirs)) {
         Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_work_directories_not_writable'), OSCOM::BASE_DIRECTORY . 'Work/', implode(', ', $work_dirs)), 'error');
     }
     if (!OSCOM::configExists('time_zone', 'OSCOM')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_time_zone_not_defined'), 'warning');
     }
     if (!OSCOM::configExists('dir_fs_public', 'OSCOM') || !file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM'))) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_dir_fs_public_not_defined'), 'warning');
     }
     // check if the upload directory exists
     if (is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
         if (!is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
             Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
         }
     } else {
         Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
     }
 }
Пример #14
0
 protected function process()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     // redirect to shopping cart if shopping cart is empty
     if (!$OSCOM_ShoppingCart->hasContents()) {
         osc_redirect(OSCOM::getLink(null, 'Cart'));
     }
     // check for e-mail address
     if (!$OSCOM_Customer->hasEmailAddress()) {
         if (isset($_POST['email']) && strlen(trim($_POST['email'])) >= ACCOUNT_EMAIL_ADDRESS) {
             if (osc_validate_email_address($_POST['email'])) {
                 $OSCOM_Customer->setEmailAddress(trim($_POST['email']));
             } else {
                 $OSCOM_MessageStack->add('Cart', OSCOM::getDef('field_customer_email_address_check_error'));
                 osc_redirect(OSCOM::getLink(null, 'Cart'));
             }
         } else {
             $OSCOM_MessageStack->add('Cart', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS));
             osc_redirect(OSCOM::getLink(null, 'Cart'));
         }
     }
     // check product type perform_order conditions
     foreach ($OSCOM_ShoppingCart->getProducts() as $product) {
         $OSCOM_Product = new Product($product['id']);
         $OSCOM_Product->isTypeActionAllowed('PerformOrder');
     }
     $OSCOM_Language->load('checkout');
     $OSCOM_Language->load('order');
     $this->_page_title = OSCOM::getDef('confirmation_heading');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_checkout_confirmation'), OSCOM::getLink(null, 'Checkout', null, 'SSL'));
     }
     if (isset($_POST['comments']) && isset($_SESSION['comments']) && empty($_POST['comments'])) {
         unset($_SESSION['comments']);
     } elseif (!empty($_POST['comments'])) {
         $_SESSION['comments'] = osc_sanitize_string($_POST['comments']);
     }
     if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1') {
         if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
             $OSCOM_MessageStack->add('Checkout', OSCOM::getDef('error_conditions_not_accepted'), 'error');
         }
     }
     if (Registry::exists('Payment') === false) {
         Registry::set('Payment', new Payment());
     }
     if ($OSCOM_ShoppingCart->hasBillingMethod()) {
         $OSCOM_Payment = Registry::get('Payment');
         $OSCOM_Payment->load($OSCOM_ShoppingCart->getBillingMethod('id'));
     }
 }
Пример #15
0
 public static function execute($data)
 {
     Registry::set('PDO', PDO::initialize($data['server'], $data['username'], $data['password'], $data['database'], $data['port'], $data['class']));
     OSCOM::setConfig('db_table_prefix', $data['table_prefix'], 'Admin');
     OSCOM::setConfig('db_table_prefix', $data['table_prefix'], 'Shop');
     OSCOM::setConfig('db_table_prefix', $data['table_prefix'], 'Setup');
     $cfg_data = array(array('key' => 'STORE_NAME', 'value' => $data['shop_name']), array('key' => 'STORE_OWNER', 'value' => $data['shop_owner_name']), array('key' => 'STORE_OWNER_EMAIL_ADDRESS', 'value' => $data['shop_owner_email']), array('key' => 'EMAIL_FROM', 'value' => '"' . $data['shop_owner_name'] . '" <' . $data['shop_owner_email'] . '>'));
     OSCOM::callDB('Admin\\UpdateConfigurationParameters', $cfg_data, 'Site');
     $admin_data = array('username' => $data['admin_username'], 'password' => $data['admin_password'], 'modules' => array('0'));
     Administrators::save($admin_data);
 }
Пример #16
0
 public static function start()
 {
     Registry::set('Customer', new Customer());
     Registry::set('Tax', new Tax());
     Registry::set('Weight', new Weight());
     Registry::set('ShoppingCart', new ShoppingCart());
     Registry::get('ShoppingCart')->refresh();
     Registry::set('NavigationHistory', new NavigationHistory(true));
     Registry::set('Image', new Image());
     return true;
 }
Пример #17
0
    public static function execute() {
      if ( !Registry::exists('Currencies') ) {
        Registry::set('Currencies', new Currencies());
      }

      $OSCOM_Currencies = Registry::get('Currencies');

      $result = array('value' => $OSCOM_Currencies->format($_GET['value']),
                      'rpcStatus' => RPC::STATUS_SUCCESS);

      echo json_encode($result);
    }
Пример #18
0
 public static function execute($id)
 {
     if (Registry::exists('CategoryTree')) {
         $OSCOM_CategoryTree = Registry::get('CategoryTree');
     } else {
         $OSCOM_CategoryTree = new CategoryTree();
         Registry::set('CategoryTree', $OSCOM_CategoryTree);
     }
     $data = $OSCOM_CategoryTree->getData($id);
     if (!empty($data['image']) && file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $data['image'])) {
         unlink(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $data['image']);
     }
 }
Пример #19
0
 public static function initialize()
 {
     Registry::set('Language', new Language());
     Registry::set('osC_Language', Registry::get('Language'));
     // HPDL to remove
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         OSCOM::redirect(OSCOM::getLink(null, 'Offline'));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Setup\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
 }
Пример #20
0
 protected function initialize()
 {
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Language->load('search');
     $this->_page_title = OSCOM::getDef('search_heading');
     $OSCOM_Template->addJavascriptPhpFilename(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/search.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_search'), OSCOM::getLink());
     }
     Registry::set('Search', new Search());
 }
Пример #21
0
 public static function execute()
 {
     $db = array('DB_SERVER' => trim(urldecode($_POST['server'])), 'DB_SERVER_USERNAME' => trim(urldecode($_POST['username'])), 'DB_SERVER_PASSWORD' => trim(urldecode($_POST['password'])), 'DB_DATABASE' => trim(urldecode($_POST['name'])), 'DB_SERVER_PORT' => trim(urldecode($_POST['port'])), 'DB_DATABASE_CLASS' => trim(urldecode(str_replace('_', '\\', $_POST['class']))));
     Registry::set('Database', Database::initialize($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD'], $db['DB_DATABASE'], $db['DB_SERVER_PORT'], $db['DB_DATABASE_CLASS']));
     $OSCOM_Database = Registry::get('Database');
     if (!$OSCOM_Database->isError()) {
         $OSCOM_Database->selectDatabase($db['DB_DATABASE']);
     }
     if (!$OSCOM_Database->isError()) {
         echo '[[1]]';
     } else {
         echo '[[0|' . $OSCOM_Database->getError() . ']]';
     }
 }
Пример #22
0
 protected function process()
 {
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Language->load('search');
     $this->_page_title = OSCOM::getDef('search_heading');
     $OSCOM_Template->addJavascriptPhpFilename('templates/' . $OSCOM_Template->getCode() . '/javascript/search/search.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_search'), OSCOM::getLink());
     }
     Registry::set('Search', new Search());
 }
Пример #23
0
 public static function execute()
 {
     $db = array('DB_SERVER' => trim(urldecode($_POST['server'])), 'DB_SERVER_USERNAME' => trim(urldecode($_POST['username'])), 'DB_SERVER_PASSWORD' => trim(urldecode($_POST['password'])), 'DB_DATABASE' => trim(urldecode($_POST['name'])), 'DB_SERVER_PORT' => trim(urldecode($_POST['port'])), 'DB_DATABASE_CLASS' => trim(urldecode(str_replace('_', '\\', $_POST['class']))), 'DB_TABLE_PREFIX' => trim(urldecode($_POST['prefix'])));
     Registry::set('Database', Database::initialize($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD'], $db['DB_DATABASE'], $db['DB_SERVER_PORT'], $db['DB_DATABASE_CLASS']));
     $OSCOM_Database = Registry::get('Database');
     if (!$OSCOM_Database->isError()) {
         $sql_file = OSCOM::BASE_DIRECTORY . 'Core/Site/Setup/sql/oscommerce_sample_data.sql';
         $OSCOM_Database->importSQL($sql_file, $db['DB_DATABASE'], $db['DB_TABLE_PREFIX']);
     }
     if (!$OSCOM_Database->isError()) {
         echo '[[1]]';
     } else {
         echo '[[0|' . $OSCOM_Database->getError() . ']]';
     }
 }
Пример #24
0
 public static function start()
 {
     Registry::set('Language', new LanguageClass());
     $OSCOM_Language = Registry::get('Language');
     if (isset($_GET['language']) && !empty($_GET['language'])) {
         $OSCOM_Language->set($_GET['language']);
     }
     $OSCOM_Language->load('general');
     $OSCOM_Language->load('modules-boxes');
     $OSCOM_Language->load('modules-content');
     $OSCOM_Language->load(OSCOM::getSiteApplication());
     header('Content-Type: text/html; charset=' . $OSCOM_Language->getCharacterSet());
     osc_setlocale(LC_TIME, explode(',', $OSCOM_Language->getLocale()));
     return true;
 }
Пример #25
0
 public static function initialize()
 {
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('PDO', PDO::initialize());
     foreach (OSCOM::callDB('Shop\\GetConfiguration', null, 'Site') as $param) {
         define($param['cfgKey'], $param['cfgValue']);
     }
     Registry::set('Service', new Service());
     Registry::get('Service')->start();
     Registry::set('Template', new Template());
     $application = 'osCommerce\\OM\\Core\\Site\\Shop\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::get('Template')->setApplication(Registry::get('Application'));
 }
Пример #26
0
 public static function execute()
 {
     $db = array('DB_SERVER' => trim(urldecode($_POST['server'])), 'DB_SERVER_USERNAME' => trim(urldecode($_POST['username'])), 'DB_SERVER_PASSWORD' => trim(urldecode($_POST['password'])), 'DB_DATABASE' => trim(urldecode($_POST['name'])), 'DB_SERVER_PORT' => trim(urldecode($_POST['port'])), 'DB_DATABASE_CLASS' => trim(urldecode(str_replace('_', '\\', $_POST['class']))));
     Registry::set('Database', Database::initialize($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD'], $db['DB_DATABASE'], $db['DB_SERVER_PORT'], $db['DB_DATABASE_CLASS']));
     $OSCOM_Database = Registry::get('Database');
     if (!$OSCOM_Database->isError()) {
         $OSCOM_Database->selectDatabase($db['DB_DATABASE']);
     }
     if (!$OSCOM_Database->isError()) {
         $result = array('result' => true);
     } else {
         $result = array('result' => false, 'error_message' => $OSCOM_Database->getError());
     }
     echo json_encode($result);
 }
Пример #27
0
 protected function _process()
 {
     $OSCOM_Category = Registry::get('Category');
     Registry::set('Products', new Products($OSCOM_Category->getID()));
     $OSCOM_Products = Registry::get('Products');
     if (isset($_GET['filter']) && is_numeric($_GET['filter']) && $_GET['filter'] > 0) {
         $OSCOM_Products->setManufacturer($_GET['filter']);
     }
     if (isset($_GET['sort']) && !empty($_GET['sort'])) {
         if (strpos($_GET['sort'], '|d') !== false) {
             $OSCOM_Products->setSortBy(substr($_GET['sort'], 0, -2), '-');
         } else {
             $OSCOM_Products->setSortBy($_GET['sort']);
         }
     }
 }
Пример #28
0
 public static function execute($parent_id = 0)
 {
     if (Registry::exists('CategoryTree')) {
         $OSCOM_CategoryTree = Registry::get('CategoryTree');
     } else {
         $OSCOM_CategoryTree = new CategoryTree();
         Registry::set('CategoryTree', $OSCOM_CategoryTree);
     }
     $OSCOM_CategoryTree->reset();
     $OSCOM_CategoryTree->setMaximumLevel(1);
     $OSCOM_CategoryTree->setBreadcrumbUsage(false);
     $result = $OSCOM_CategoryTree->getArray($parent_id);
     foreach ($result as &$c) {
         $c['products'] = $OSCOM_CategoryTree->getData($c['id'], 'count');
     }
     return array('entries' => $result, 'total' => count($result));
 }
Пример #29
0
 public static function start()
 {
     Registry::set('Currencies', new CurrenciesClass());
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_Language = Registry::get('Language');
     if (!isset($_SESSION['currency']) || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == '1' && $OSCOM_Currencies->getCode($OSCOM_Language->getCurrencyID()) != $_SESSION['currency']) {
         if (isset($_GET['currency']) && $OSCOM_Currencies->exists($_GET['currency'])) {
             $_SESSION['currency'] = $_GET['currency'];
         } else {
             $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == '1' ? $OSCOM_Currencies->getCode($OSCOM_Language->getCurrencyID()) : DEFAULT_CURRENCY;
         }
         if (isset($_SESSION['cartID'])) {
             unset($_SESSION['cartID']);
         }
     }
     return true;
 }
Пример #30
0
 public function __construct($module = null)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_Language = Registry::get('Language');
     $do_shipping = false;
     foreach ($OSCOM_ShoppingCart->getProducts() as $product) {
         $OSCOM_Product = new Product($product['id']);
         if ($OSCOM_Product->isTypeActionAllowed('apply_shipping_fees')) {
             $do_shipping = true;
             break;
         }
     }
     if ($do_shipping === true) {
         $this->_quotes =& $_SESSION['osC_ShoppingCart_data']['shipping_quotes'];
         $Qmodules = $OSCOM_Database->query('select code from :table_templates_boxes where modules_group = "shipping"');
         $Qmodules->setCache('modules-shipping');
         $Qmodules->execute();
         while ($Qmodules->next()) {
             $this->_modules[] = $Qmodules->value('code');
         }
         $Qmodules->freeResult();
         if (!empty($this->_modules)) {
             if (!empty($module) && in_array(substr($module, 0, strpos($module, '_')), $this->_modules)) {
                 $this->_selected_module = $module;
                 $this->_modules = array(substr($module, 0, strpos($module, '_')));
             }
             $OSCOM_Language->load('modules-shipping');
             foreach ($this->_modules as $module) {
                 $module_class = 'osCommerce\\OM\\Core\\Site\\Shop\\Module\\Shipping\\' . $module;
                 Registry::set('Shipping_' . $module, new $module_class(), true);
                 Registry::get('Shipping_' . $module)->initialize();
             }
             usort($this->_modules, function ($a, $b) {
                 if (Registry::get('Shipping_' . $a)->getSortOrder() == Registry::get('Shipping_' . $b)->getSortOrder()) {
                     return strnatcasecmp(Registry::get('Shipping_' . $a)->getTitle(), Registry::get('Shipping_' . $b)->getTitle());
                 }
                 return Registry::get('Shipping_' . $a)->getSortOrder() < Registry::get('Shipping_' . $b)->getSortOrder() ? -1 : 1;
             });
         }
     }
     if (empty($this->_quotes)) {
         $this->_calculate();
     }
 }