コード例 #1
0
ファイル: Get.php プロジェクト: haraldpdl/oscommerce
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $sql_query = 'select l.*, (select count(*) from :table_languages_definitions ld where ld.languages_id = l.languages_id) as total_definitions from :table_languages l where';

      if ( is_numeric($data['id']) ) {
        $sql_query .= ' l.languages_id = :languages_id';
      } else {
        $sql_query .= ' l.code = :code';
      }

      $sql_query .= ' limit 1';

      $Qlanguage = $OSCOM_PDO->prepare($sql_query);

      if ( is_numeric($data['id']) ) {
        $Qlanguage->bindInt(':languages_id', $data['id']);
      } else {
        $Qlanguage->bindValue(':code', $data['id']);
      }

      $Qlanguage->execute();

      return $Qlanguage->fetch();
    }
コード例 #2
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Shipping = Registry::get('Shipping');
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     if (!empty($_POST['comments'])) {
         $_SESSION['comments'] = HTML::sanitize($_POST['comments']);
     }
     if ($OSCOM_Shipping->hasQuotes()) {
         if (isset($_POST['shipping_mod_sel']) && strpos($_POST['shipping_mod_sel'], '_')) {
             list($module, $method) = explode('_', $_POST['shipping_mod_sel']);
             if (Registry::exists('Shipping_' . $module) && Registry::get('Shipping_' . $module)->isEnabled()) {
                 $quote = $OSCOM_Shipping->getQuote($_POST['shipping_mod_sel']);
                 if (isset($quote['error'])) {
                     $OSCOM_ShoppingCart->resetShippingMethod();
                 } else {
                     $OSCOM_ShoppingCart->setShippingMethod($quote);
                     OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
                 }
             } else {
                 $OSCOM_ShoppingCart->resetShippingMethod();
             }
         }
     } else {
         $OSCOM_ShoppingCart->resetShippingMethod();
         OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
     }
 }
コード例 #3
0
ファイル: Process.php プロジェクト: kdexter/oscommerce
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $Qcheck = $OSCOM_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
     $Qcheck->execute();
     if ($Qcheck->numberOfRows() === 1) {
         $password = osc_create_random_string(ACCOUNT_PASSWORD);
         if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
             if (ACCOUNT_GENDER > -1) {
                 if ($Qcheck->value('customers_gender') == 'm') {
                     $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 } else {
                     $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 }
             } else {
                 $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n";
             }
             $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), osc_get_ip_address(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS);
             osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success');
         }
         osc_redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL'));
     } else {
         $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found'));
     }
 }
コード例 #4
0
ファイル: Controller.php プロジェクト: kdexter/oscommerce
 public function install()
 {
     $OSCOM_Database = Registry::get('Database');
     parent::install();
     $OSCOM_Database->simpleQuery("insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Entries To Display', 'MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY', '10', 'Maximum number of upcoming products to display', '6', '0', now())");
     $OSCOM_Database->simpleQuery("insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Cache Contents', 'MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE', '1440', 'Number of minutes to keep the contents cached (0 = no cache)', '6', '0', now())");
 }
コード例 #5
0
ファイル: Update.php プロジェクト: kdexter/oscommerce
 public static function execute($data)
 {
     $OSCOM_Database = Registry::get('PDO');
     $OSCOM_Database->beginTransaction();
     $Qlanguage = $OSCOM_Database->prepare('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id, sort_order = :sort_order where languages_id = :languages_id');
     $Qlanguage->bindValue(':name', $data['name']);
     $Qlanguage->bindValue(':code', $data['code']);
     $Qlanguage->bindValue(':locale', $data['locale']);
     $Qlanguage->bindValue(':charset', $data['charset']);
     $Qlanguage->bindValue(':date_format_short', $data['date_format_short']);
     $Qlanguage->bindValue(':date_format_long', $data['date_format_long']);
     $Qlanguage->bindValue(':time_format', $data['time_format']);
     $Qlanguage->bindValue(':text_direction', $data['text_direction']);
     $Qlanguage->bindInt(':currencies_id', $data['currencies_id']);
     $Qlanguage->bindValue(':numeric_separator_decimal', $data['numeric_separator_decimal']);
     $Qlanguage->bindValue(':numeric_separator_thousands', $data['numeric_separator_thousands']);
     $Qlanguage->bindInt(':parent_id', $data['parent_id']);
     $Qlanguage->bindInt(':sort_order', $data['sort_order']);
     $Qlanguage->bindInt(':languages_id', $data['id']);
     $Qlanguage->execute();
     if (!$Qlanguage->isError()) {
         if ($data['set_default'] === true) {
             $Qupdate = $OSCOM_Database->prepare('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
             $Qupdate->bindValue(':configuration_value', $data['code']);
             $Qupdate->bindValue(':configuration_key', 'DEFAULT_LANGUAGE');
             $Qupdate->execute();
         }
         $OSCOM_Database->commit();
         return true;
     }
     $OSCOM_Database->rollBack();
     return false;
 }
コード例 #6
0
ファイル: Find.php プロジェクト: kdexter/oscommerce
 public static function execute($data)
 {
     $OSCOM_Database = Registry::get('PDO');
     $result = array();
     $sql_query = 'select SQL_CALC_FOUND_ROWS c.*, count(z.zone_id) as total_zones from :table_countries c left join :table_zones z on (c.countries_id = z.zone_country_id) where (c.countries_name like :countries_name or c.countries_iso_code_2 like :countries_iso_code_2 or c.countries_iso_code_3 like :countries_iso_code_3 or z.zone_name like :zone_name or z.zone_code like :zone_code) group by c.countries_id order by c.countries_name';
     if ($data['batch_pageset'] !== -1) {
         $sql_query .= ' limit :batch_pageset, :batch_max_results';
     }
     $sql_query .= '; select found_rows();';
     $Qcountries = $OSCOM_Database->prepare($sql_query);
     $Qcountries->bindValue(':countries_name', '%' . $data['keywords'] . '%');
     $Qcountries->bindValue(':countries_iso_code_2', '%' . $data['keywords'] . '%');
     $Qcountries->bindValue(':countries_iso_code_3', '%' . $data['keywords'] . '%');
     $Qcountries->bindValue(':zone_name', '%' . $data['keywords'] . '%');
     $Qcountries->bindValue(':zone_code', '%' . $data['keywords'] . '%');
     if ($data['batch_pageset'] !== -1) {
         $Qcountries->bindInt(':batch_pageset', $OSCOM_Database->getBatchFrom($data['batch_pageset'], $data['batch_max_results']));
         $Qcountries->bindInt(':batch_max_results', $data['batch_max_results']);
     }
     $Qcountries->execute();
     $result['entries'] = $Qcountries->fetchAll();
     $Qcountries->nextRowset();
     $result['total'] = $Qcountries->fetchColumn();
     return $result;
 }
コード例 #7
0
ファイル: Get.php プロジェクト: haraldpdl/oscommerce
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $result = array();

      $sql_query = 'select * from :table_customers where ';

      if ( isset($data['email_address']) ) {
        $sql_query .= 'customers_email_address = :customers_email_address';
      } else {
        $sql_query .= 'customers_id = :customers_id';
      }

      $Qcustomer = $OSCOM_PDO->prepare($sql_query);

      if ( isset($data['email_address']) ) {
        $Qcustomer->bindValue(':customers_email_address', $data['email_address']);
      } else {
        $Qcustomer->bindInt(':customers_id', $data['id']);
      }

      $Qcustomer->execute();

      if ( $Qcustomer->fetch() !== false ) {
        $result = $Qcustomer->toArray();

        $result['customers_name'] = $result['customers_firstname'] . ' ' . $result['customers_lastname'];
      }

      return $result;
    }
コード例 #8
0
 public static function start()
 {
     $OSCOM_Service = Registry::get('Service');
     Registry::set('RecentlyVisited', new RecentlyVisitedClass());
     $OSCOM_Service->addCallBeforePageContent('RecentlyVisited', 'initialize');
     return true;
 }
コード例 #9
0
ファイル: GetVersion.php プロジェクト: haraldpdl/oscommerce
    public static function execute() {
      $OSCOM_PDO = Registry::get('PDO');

      $result = $OSCOM_PDO->query('show server_version')->fetch();

      return 'PostgreSQL v' . $result['server_version'];
    }
コード例 #10
0
ファイル: Get.php プロジェクト: haraldpdl/oscommerce
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $sql_query = 'select * from :table_currencies where';

      if ( is_numeric($data['id']) ) {
        $sql_query .= ' currencies_id = :currencies_id';
      } else {
        $sql_query .= ' code = :code';
      }

      $sql_query .= ' limit 1';

      $Qcurrency = $OSCOM_PDO->prepare($sql_query);

      if ( is_numeric($data['id']) ) {
        $Qcurrency->bindInt(':currencies_id', $data['id']);
      } else {
        $Qcurrency->bindValue(':code', $data['id']);
      }

      $Qcurrency->execute();

      return $Qcurrency->fetch();
    }
コード例 #11
0
 public function initialize()
 {
     $OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Language = Registry::get('Language');
     if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
         $Qmanufacturer = $OSCOM_PDO->query('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', $OSCOM_Product->getID());
         $Qmanufacturer->execute();
         $result = $Qmanufacturer->fetch();
         if (!empty($result)) {
             $this->_content = '';
             if (strlen($result['manufacturers_image']) > 0) {
                 $this->_content .= '<div style="text-align: center;">' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), HTML::image('public/manufacturers/' . $result['manufacturers_image'], $result['manufacturers_name'])) . '</div>';
             }
             $this->_content .= '<ol style="list-style: none; margin: 0; padding: 0;">';
             if (strlen($result['manufacturers_url']) > 0) {
                 $this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Redirct', 'Manufacturer=' . $result['manufacturers_id']), sprintf(OSCOM::getDef('box_manufacturer_info_website'), $result['manufacturers_name']), 'target="_blank"') . '</li>';
             }
             $this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), OSCOM::getDef('box_manufacturer_info_products')) . '</li>';
             $this->_content .= '</ol>';
         }
     }
 }
コード例 #12
0
    public function uninstall() {
      $OSCOM_PDO = Registry::get('PDO');

      $error = false;

      $OSCOM_PDO->beginTransaction();

      $Qdelete = $OSCOM_PDO->prepare('delete from :table_product_attributes where id = :id');
      $Qdelete->bindInt(':id', $this->getID());
      $Qdelete->execute();

      if ( $Qdelete->isError() ) {
        $error = true;
      }

      if ( $error === false ) {
        $Quninstall = $OSCOM_PDO->prepare('delete from :table_templates_boxes where code = :code and modules_group = :modules_group');
        $Quninstall->bindValue(':code', $this->getCode());
        $Quninstall->bindValue(':modules_group', 'ProductAttribute');
        $Quninstall->execute();

        if ( $Quninstall->isError() ) {
          $error = true;
        }
      }

      if ( $error === false ) {
        $OSCOM_PDO->commit();
      } else {
        $OSCOM_PDO->rollBack();
      }

      return ( $error === false );
    }
コード例 #13
0
ファイル: GetAll.php プロジェクト: haraldpdl/oscommerce
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $result = array();

      $sql_query = 'select * from :table_administrators order by user_name';

      if ( $data['batch_pageset'] !== -1 ) {
        $sql_query .= ' limit :batch_max_results offset :batch_pageset';
      }

      $Qadmins = $OSCOM_PDO->prepare($sql_query);

      if ( $data['batch_pageset'] !== -1 ) {
        $Qadmins->bindInt(':batch_pageset', $OSCOM_PDO->getBatchFrom($data['batch_pageset'], $data['batch_max_results']));
        $Qadmins->bindInt(':batch_max_results', $data['batch_max_results']);
      }

      $Qadmins->execute();

      $result['entries'] = $Qadmins->fetchAll();

      $Qtotal = $OSCOM_PDO->query('select count(*) from :table_administrators');
      $Qtotal->execute();

      $result['total'] = $Qtotal->fetchColumn();

      return $result;
    }
コード例 #14
0
 public static function execute($data)
 {
     $OSCOM_PDO = Registry::get('PDO');
     if (isset($data['key']) && isset($data['value'])) {
         $data = array($data);
     }
     $error = false;
     $in_transaction = false;
     if (count($data) > 1) {
         $OSCOM_PDO->beginTransaction();
         $in_transaction = true;
     }
     $Qcfg = $OSCOM_PDO->prepare('update :table_configuration set configuration_value = :configuration_value, last_modified = now() where configuration_key = :configuration_key');
     foreach ($data as $d) {
         $Qcfg->bindValue(':configuration_value', $d['value']);
         $Qcfg->bindValue(':configuration_key', $d['key']);
         $Qcfg->execute();
         if ($Qcfg->isError()) {
             if ($in_transaction === true) {
                 $OSCOM_PDO->rollBack();
             }
             $error = true;
             break;
         }
     }
     if ($error === false && $in_transaction === true) {
         $OSCOM_PDO->commit();
     }
     return !$error;
 }
コード例 #15
0
ファイル: Save.php プロジェクト: kdexter/oscommerce
 public static function execute($data)
 {
     $OSCOM_Database = Registry::get('PDO');
     $OSCOM_Database->beginTransaction();
     if (is_numeric($data['id'])) {
         $Qcurrency = $OSCOM_Database->prepare('update :table_currencies set title = :title, code = :code, symbol_left = :symbol_left, symbol_right = :symbol_right, decimal_places = :decimal_places, value = :value where currencies_id = :currencies_id');
         $Qcurrency->bindInt(':currencies_id', $data['id']);
     } else {
         $Qcurrency = $OSCOM_Database->prepare('insert into :table_currencies (title, code, symbol_left, symbol_right, decimal_places, value) values (:title, :code, :symbol_left, :symbol_right, :decimal_places, :value)');
     }
     $Qcurrency->bindValue(':title', $data['title']);
     $Qcurrency->bindValue(':code', $data['code']);
     $Qcurrency->bindValue(':symbol_left', $data['symbol_left']);
     $Qcurrency->bindValue(':symbol_right', $data['symbol_right']);
     $Qcurrency->bindInt(':decimal_places', $data['decimal_places']);
     $Qcurrency->bindValue(':value', $data['value']);
     $Qcurrency->execute();
     if (!$Qcurrency->isError()) {
         if ($data['set_default'] === true) {
             $Qupdate = $OSCOM_Database->prepare('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
             $Qupdate->bindValue(':configuration_value', $data['code']);
             $Qupdate->bindValue(':configuration_key', 'DEFAULT_CURRENCY');
             $Qupdate->execute();
         }
         $OSCOM_Database->commit();
         return true;
     }
     $OSCOM_Database->rollBack();
     return false;
 }
コード例 #16
0
ファイル: Language.php プロジェクト: kdexter/oscommerce
 public function __construct()
 {
     $OSCOM_Language = Registry::get('Language');
     $OSCOM_Language->loadIniFile('modules/services/language.php');
     $this->title = OSCOM::getDef('services_language_title');
     $this->description = OSCOM::getDef('services_language_description');
 }
コード例 #17
0
 public function install()
 {
     $OSCOM_PDO = Registry::get('PDO');
     parent::install();
     $OSCOM_PDO->exec("insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Random Product Specials Selection', 'BOX_SPECIALS_RANDOM_SELECT', '10', 'Select a random product on special from this amount of the newest products on specials available', '6', '0', now())");
     $OSCOM_PDO->exec("insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Cache Contents', 'BOX_SPECIALS_CACHE', '1', 'Number of minutes to keep the contents cached (0 = no cache)', '6', '0', now())");
 }
コード例 #18
0
ファイル: Controller.php プロジェクト: kdexter/oscommerce
 public function initialize()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Template = Registry::get('Template');
     $steps = array();
     if ($OSCOM_ShoppingCart->getContentType() != 'virtual') {
         $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_delivery'), 'code' => 'shipping', 'active' => $OSCOM_Template->getModule() == 'Shipping' || $OSCOM_Template->getModule() == 'ShippingAddress' ? true : false);
     }
     $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_payment'), 'code' => 'payment', 'active' => $OSCOM_Template->getModule() == 'Payment' || $OSCOM_Template->getModule() == 'PaymentAddress' ? true : false);
     $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_confirmation'), 'code' => 'confirmation', 'active' => $OSCOM_Template->getModule() == 'Confirmation' ? true : false);
     $steps[] = array('title' => OSCOM::getDef('box_ordering_steps_complete'), 'active' => $OSCOM_Template->getModule() == 'Success' ? true : false);
     $content = osc_image('templates/' . $OSCOM_Template->getCode() . '/images/icons/32x32/checkout_preparing_to_ship.gif') . '<br />';
     $counter = 0;
     foreach ($steps as $step) {
         $counter++;
         $content .= '<span style="white-space: nowrap;">&nbsp;' . osc_image('templates/' . $OSCOM_Template->getCode() . '/images/icons/24x24/checkout_' . $counter . ($step['active'] === true ? '_on' : '') . '.gif', $step['title'], 24, 24, 'align="absmiddle"');
         if (isset($step['code'])) {
             $content .= osc_link_object(OSCOM::getLink(null, 'Checkout', $step['code'], 'SSL'), $step['title'], 'class="boxCheckoutTrail' . ($step['active'] === true ? 'Active' : '') . '"');
         } else {
             $content .= '<span class="boxCheckoutTrail' . ($step['active'] === true ? 'Active' : '') . '">' . $step['title'] . '</span>';
         }
         $content .= '</span><br />';
     }
     $content .= osc_image('templates/' . $OSCOM_Template->getCode() . '/images/icons/32x32/checkout_ready_to_ship.gif');
     $this->_content = $content;
 }
コード例 #19
0
ファイル: Total.php プロジェクト: kdexter/oscommerce
 public function install()
 {
     $OSCOM_Database = Registry::get('Database');
     parent::install();
     $OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Total', 'MODULE_ORDER_TOTAL_TOTAL_STATUS', 'true', 'Do you want to display the total order value?', '6', '1', 'osc_cfg_set_boolean_value(array(\\'true\\', \\'false\\'))', now())");
     $OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())");
 }
コード例 #20
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');
     global $osC_oiAddress;
     // HPDL
     $application->setPageTitle(OSCOM::getDef('payment_method_heading'));
     $application->setPageContent('billing.php');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_checkout_payment'), OSCOM::getLink(null, null, 'Billing', 'SSL'));
     }
     // load billing address page if no default address exists
     if (!$OSCOM_ShoppingCart->hasBillingAddress()) {
         $application->setPageTitle(OSCOM::getDef('payment_address_heading'));
         $application->setPageContent('billing_address.php');
         $OSCOM_Template->addJavascriptFilename(OSCOM::getPublicSiteLink('javascript/checkout_payment_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->getBillingAddress());
         }
     } else {
         $OSCOM_Template->addJavascriptFilename(OSCOM::getPublicSiteLink('javascript/checkout_payment.js'));
         // load all enabled payment modules
         $OSCOM_Payment = Registry::get('Payment');
         $OSCOM_Payment->loadAll();
         $OSCOM_Template->addJavascriptBlock($OSCOM_Payment->getJavascriptBlocks());
     }
     // HPDL
     //      if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) {
     //        $OSCOM_MessageStack->add('CheckoutBilling', $error['error'], 'error');
     //      }
 }
コード例 #21
0
ファイル: Add.php プロジェクト: digitaldevelopers/oscommerce
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $requested_product = null;
     if (count($_GET) > 2) {
         $requested_product = basename(key(array_slice($_GET, 2, 1, true)));
         if ($requested_product == 'Add') {
             unset($requested_product);
             if (count($_GET) > 3) {
                 $requested_product = basename(key(array_slice($_GET, 3, 1, true)));
             }
         }
     }
     if (isset($requested_product)) {
         if (Product::checkEntry($requested_product)) {
             $OSCOM_Product = new Product($requested_product);
             if ($OSCOM_Product->isTypeActionAllowed('AddToShoppingCart')) {
                 if ($OSCOM_Product->hasVariants()) {
                     if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) {
                         if ($OSCOM_Product->variantExists($_POST['variants'])) {
                             $OSCOM_ShoppingCart->add($OSCOM_Product->getProductVariantID($_POST['variants']));
                         } else {
                             OSCOM::redirect(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()));
                         }
                     } else {
                         OSCOM::redirect(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword()));
                     }
                 } else {
                     $OSCOM_ShoppingCart->add($OSCOM_Product->getID());
                 }
             }
         }
     }
     OSCOM::redirect(OSCOM::getLink(null, 'Cart'));
 }
コード例 #22
0
    public static function execute($data)
    {
        $OSCOM_PDO = Registry::get('PDO');
        $sql_file = OSCOM::BASE_DIRECTORY . 'Core/Site/Setup/sql/oscommerce_innodb.sql';
        $OSCOM_PDO->importSQL($sql_file, $data['table_prefix']);
        $OSCOM_PDO->exec('DROP PROCEDURE IF EXISTS CountriesGetAll;
CREATE PROCEDURE CountriesGetAll (IN pageset INT, IN maxresults INT)
BEGIN
  IF pageset is null THEN
    SELECT SQL_CALC_FOUND_ROWS c.*, COUNT(z.zone_id) AS total_zones
    FROM osc_countries c
    LEFT JOIN osc_zones z ON (c.countries_id = z.zone_country_id)
    GROUP BY c.countries_id
    ORDER BY c.countries_name;
  ELSE
    PREPARE STMT FROM
      "SELECT SQL_CALC_FOUND_ROWS c.*, COUNT(z.zone_id) AS total_zones
       FROM osc_countries c
       LEFT JOIN osc_zones z ON (c.countries_id = z.zone_country_id)
       GROUP BY c.countries_id
       ORDER BY c.countries_name
       LIMIT ?, ?";
    SET @START = pageset;
    SET @LIMIT = maxresults;
    EXECUTE STMT USING @START, @LIMIT;
  END IF;

  SELECT FOUND_ROWS() as total;
END;');
    }
コード例 #23
0
ファイル: Find.php プロジェクト: haraldpdl/oscommerce
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $result = array();

      $sql_query = 'select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_status, c.date_account_created, a.entry_country_id from :table_customers c left join :table_address_book a on (c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id) where (c.customers_firstname ilike :customers_firstname or c.customers_lastname ilike :customers_lastname) order by c.customers_lastname, c.customers_firstname';

      if ( $data['batch_pageset'] !== -1 ) {
        $sql_query .= ' limit :batch_max_results offset :batch_pageset';
      }

      $Qcustomers = $OSCOM_PDO->prepare($sql_query);
      $Qcustomers->bindValue(':customers_firstname', '%' . $data['keywords'] . '%');
      $Qcustomers->bindValue(':customers_lastname', '%' . $data['keywords'] . '%');

      if ( $data['batch_pageset'] !== -1 ) {
        $Qcustomers->bindInt(':batch_pageset', $OSCOM_PDO->getBatchFrom($data['batch_pageset'], $data['batch_max_results']));
        $Qcustomers->bindInt(':batch_max_results', $data['batch_max_results']);
      }

      $Qcustomers->execute();

      $result['entries'] = $Qcustomers->fetchAll();

      $Qtotal = $OSCOM_PDO->prepare('select count(*) from :table_customers where (customers_firstname ilike :customers_firstname or customers_lastname ilike :customers_lastname)');
      $Qtotal->bindValue(':customers_firstname', '%' . $data['keywords'] . '%');
      $Qtotal->bindValue(':customers_lastname', '%' . $data['keywords'] . '%');
      $Qtotal->execute();

      $result['total'] = $Qtotal->fetchColumn();

      return $result;
    }
コード例 #24
0
ファイル: Flat.php プロジェクト: kdexter/oscommerce
 public function initialize()
 {
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
     if ($this->_status === true && (int) MODULE_SHIPPING_FLAT_ZONE > 0) {
         $check_flag = false;
         $Qcheck = $OSCOM_Database->query('select zone_id from :table_zones_to_geo_zones where geo_zone_id = :geo_zone_id and zone_country_id = :zone_country_id order by zone_id');
         $Qcheck->bindInt(':geo_zone_id', MODULE_SHIPPING_FLAT_ZONE);
         $Qcheck->bindInt(':zone_country_id', $OSCOM_ShoppingCart->getShippingAddress('country_id'));
         $Qcheck->execute();
         while ($Qcheck->next()) {
             if ($Qcheck->valueInt('zone_id') < 1) {
                 $check_flag = true;
                 break;
             } elseif ($Qcheck->valueInt('zone_id') == $OSCOM_ShoppingCart->getShippingAddress('zone_id')) {
                 $check_flag = true;
                 break;
             }
         }
         if ($check_flag === false) {
             $this->_status = false;
         }
     }
 }
コード例 #25
0
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $error = false;

      $OSCOM_PDO->beginTransaction();

      foreach ( $data as $c ) {
        $Qcategory = $OSCOM_PDO->prepare('update :table_categories set sort_order = :sort_order, last_modified = now() where categories_id = :categories_id');
        $Qcategory->bindInt(':sort_order', $c['sort_order']);
        $Qcategory->bindInt(':categories_id', $c['id']);
        $Qcategory->execute();

        if ( $Qcategory->isError() ) {
          $error = true;
          break;
        }
      }

      if ( $error === false ) {
        $OSCOM_PDO->commit();

        return true;
      }

      $OSCOM_PDO->rollBack();

      return false;
    }
コード例 #26
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);
     }
 }
コード例 #27
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $data = array();
     if (DISPLAY_PRIVACY_CONDITIONS == '1') {
         if (isset($_POST['privacy_conditions']) === false || isset($_POST['privacy_conditions']) && $_POST['privacy_conditions'] != '1') {
             $OSCOM_MessageStack->add('Create', OSCOM::getDef('error_privacy_statement_not_accepted'));
         }
     }
     if (ACCOUNT_GENDER >= 0) {
         if (isset($_POST['gender']) && ($_POST['gender'] == 'm' || $_POST['gender'] == 'f')) {
             $data['gender'] = $_POST['gender'];
         } else {
             $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_gender_error'));
         }
     }
     if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) {
         $data['firstname'] = $_POST['firstname'];
     } else {
         $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME));
     }
     if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) {
         $data['lastname'] = $_POST['lastname'];
     } else {
         $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME));
     }
     if (ACCOUNT_DATE_OF_BIRTH == '1') {
         if (isset($_POST['dob_days']) && isset($_POST['dob_months']) && isset($_POST['dob_years']) && checkdate($_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years'])) {
             $data['dob'] = mktime(0, 0, 0, $_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years']);
         } else {
             $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_date_of_birth_error'));
         }
     }
     if (isset($_POST['email_address']) && strlen(trim($_POST['email_address'])) >= ACCOUNT_EMAIL_ADDRESS) {
         if (filter_var($_POST['email_address'], FILTER_VALIDATE_EMAIL)) {
             if (Account::checkEntry($_POST['email_address']) === false) {
                 $data['email_address'] = $_POST['email_address'];
             } else {
                 $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_email_address_exists_error'));
             }
         } else {
             $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_email_address_check_error'));
         }
     } else {
         $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS));
     }
     if (isset($_POST['password']) === false || isset($_POST['password']) && strlen(trim($_POST['password'])) < ACCOUNT_PASSWORD) {
         $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_password_error'), ACCOUNT_PASSWORD));
     } elseif (isset($_POST['confirmation']) === false || isset($_POST['confirmation']) && trim($_POST['password']) != trim($_POST['confirmation'])) {
         $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_password_mismatch_with_confirmation'));
     } else {
         $data['password'] = $_POST['password'];
     }
     if ($OSCOM_MessageStack->size('Create') === 0) {
         if (Account::createEntry($data)) {
             $OSCOM_MessageStack->add('Create', OSCOM::getDef('success_account_updated'), 'success');
         }
         OSCOM::redirect(OSCOM::getLink(null, null, 'Create&Success', 'SSL'));
     }
 }
コード例 #28
0
    public static function execute($data) {
      $OSCOM_PDO = Registry::get('PDO');

      $sql_file = OSCOM::BASE_DIRECTORY . 'Core/Site/Setup/sql/PostgreSQL/sample.sql';

      return $OSCOM_PDO->importSQL($sql_file, $data['table_prefix']);
    }
コード例 #29
0
ファイル: Process.php プロジェクト: kdexter/oscommerce
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_PaymentModule = Registry::get('PaymentModule');
     $OSCOM_PaymentModule->process();
     osc_redirect(OSCOM::getLink(null, null, 'Success', 'SSL'));
 }
コード例 #30
0
 public static function execute($country, $form, $field)
 {
     $OSCOM_PDO = Registry::get('PDO');
     $num_country = 1;
     $output_string = '';
     $Qcountries = $OSCOM_PDO->query('select distinct zone_country_id from :table_zones order by zone_country_id');
     $Qcountries->execute();
     while ($Qcountries->fetch()) {
         if ($num_country == 1) {
             $output_string .= '  if (' . $country . ' == "' . $Qcountries->valueInt('zone_country_id') . '") {' . "\n";
         } else {
             $output_string .= '  } else if (' . $country . ' == "' . $Qcountries->valueInt('zone_country_id') . '") {' . "\n";
         }
         $num_state = 1;
         $Qzones = $OSCOM_PDO->prepare('select zone_name, zone_id from :table_zones where zone_country_id = :zone_country_id order by zone_name');
         $Qzones->bindInt(':zone_country_id', $Qcountries->valueInt('zone_country_id'));
         $Qzones->execute();
         while ($Qzones->fetch()) {
             if ($num_state == '1') {
                 $output_string .= '    ' . $form . '.' . $field . '.options[0] = new Option("' . OSCOM::getDef('all_zones') . '", "");' . "\n";
             }
             $output_string .= '    ' . $form . '.' . $field . '.options[' . $num_state . '] = new Option("' . $Qzones->value('zone_name') . '", "' . $Qzones->valueInt('zone_id') . '");' . "\n";
             $num_state++;
         }
         $num_country++;
     }
     $output_string .= '  } else {' . "\n" . '    ' . $form . '.' . $field . '.options[0] = new Option("' . OSCOM::getDef('all_zones') . '", "");' . "\n" . '  }' . "\n";
     return $output_string;
 }