Example #1
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Shipping = Registry::get('Shipping');
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     if (!empty($_POST['comments'])) {
         $_SESSION['comments'] = osc_sanitize_string($_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);
                     osc_redirect(OSCOM::getLink(null, null, null, 'SSL'));
                 }
             } else {
                 $OSCOM_ShoppingCart->resetShippingMethod();
             }
         }
     } else {
         $OSCOM_ShoppingCart->resetShippingMethod();
         osc_redirect(OSCOM::getLink(null, null, null, 'SSL'));
     }
 }
Example #2
0
 function _process()
 {
     global $osC_ShoppingCart, $osC_Shipping;
     if (!empty($_POST['comments'])) {
         $_SESSION['comments'] = osc_sanitize_string($_POST['comments']);
     }
     if ($osC_Shipping->hasQuotes()) {
         if (isset($_POST['shipping_mod_sel']) && strpos($_POST['shipping_mod_sel'], '_')) {
             list($module, $method) = explode('_', $_POST['shipping_mod_sel']);
             $module = 'osC_Shipping_' . $module;
             if (is_object($GLOBALS[$module]) && $GLOBALS[$module]->isEnabled()) {
                 $quote = $osC_Shipping->getQuote($_POST['shipping_mod_sel']);
                 if (isset($quote['error'])) {
                     $osC_ShoppingCart->resetShippingMethod();
                 } else {
                     $osC_ShoppingCart->setShippingMethod($quote);
                     osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
                 }
             } else {
                 $osC_ShoppingCart->resetShippingMethod();
             }
         }
     } else {
         $osC_ShoppingCart->resetShippingMethod();
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
 }
Example #3
0
 function _process()
 {
     global $osC_Database, $messageStack, $osC_Language;
     $data = array();
     $data['url'] = osc_sanitize_string($_POST['url']);
     if (isset($_POST['title']) && !empty($_POST['title'])) {
         $data['title'] = osc_sanitize_string($_POST['title']);
     } else {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_title_error'));
     }
     if (isset($_POST['email']) && !empty($_POST['email']) && osc_validate_email_address($_POST['email'])) {
         $data['email'] = $_POST['email'];
     } else {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_email_error'));
     }
     if (isset($_POST['content']) && !empty($_POST['content'])) {
         $data['content'] = osc_sanitize_string($_POST['content']);
     } else {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_content_error'));
     }
     if ($_POST['verify_code'] != $_SESSION['verify_code']) {
         $messageStack->add('guestbook', $osC_Language->get('field_guestbook_verify_code_error'));
     }
     if ($messageStack->size('guestbook') === 0) {
         if (toC_Guestbook::saveEntry($data)) {
             $messageStack->add_session('guestbook', $osC_Language->get('success_guestbook_saved'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_INFO, 'guestbook'));
     }
 }
Example #4
0
 function _process()
 {
     global $osC_Language, $osC_MessageStack, $osC_Product;
     if (empty($_POST['from_name'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_customers_name_empty'));
     }
     if (!osc_validate_email_address($_POST['from_email_address'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_customers_email_address'));
     }
     if (empty($_POST['to_name'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_friends_name_empty'));
     }
     if (!osc_validate_email_address($_POST['to_email_address'])) {
         $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_friends_email_address'));
     }
     if ($osC_MessageStack->size('tell_a_friend') < 1) {
         $email_subject = sprintf($osC_Language->get('email_tell_a_friend_subject'), osc_sanitize_string($_POST['from_name']), STORE_NAME);
         $email_body = sprintf($osC_Language->get('email_tell_a_friend_intro'), osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['from_name']), $osC_Product->getTitle(), STORE_NAME) . "\n\n";
         if (!empty($_POST['message'])) {
             $email_body .= osc_sanitize_string($_POST['message']) . "\n\n";
         }
         $email_body .= sprintf($osC_Language->get('email_tell_a_friend_link'), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf($osC_Language->get('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']));
         $osC_MessageStack->add('header', sprintf($osC_Language->get('success_tell_a_friend_email_sent'), $osC_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success');
         osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
     }
 }
Example #5
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');
 }
Example #6
0
 public static function execute(ApplicationAbstract $application)
 {
     $data = osc_sanitize_string(basename($_GET['code']));
     if (PaymentModules::uninstall($data)) {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success');
     } else {
         Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error');
     }
     osc_redirect_admin(OSCOM::getLink());
 }
 public function __construct()
 {
     $this->initialize();
     if (isset($_GET['action']) && !empty($_GET['action'])) {
         $action = osc_sanitize_string(basename($_GET['action']));
         if (class_exists('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action)) {
             call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this);
         }
     }
 }
Example #8
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'));
     }
 }
Example #9
0
 function osC_Checkout_Confirmation()
 {
     global $osC_Session, $osC_Services, $osC_Language, $osC_ShoppingCart, $osC_Customer, $osC_MessageStack, $osC_NavigationHistory, $osC_Breadcrumb, $osC_Payment;
     if ($osC_Customer->isLoggedOn() === false) {
         $osC_NavigationHistory->setSnapshot();
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     }
     if ($osC_ShoppingCart->hasContents() === false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'));
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if ($osC_ShoppingCart->hasShippingAddress() == false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
     }
     include 'includes/classes/order.php';
     $this->_page_title = $osC_Language->get('confirmation_heading');
     $osC_Language->load('order');
     if ($osC_Services->isStarted('breadcrumb')) {
         $osC_Breadcrumb->add($osC_Language->get('breadcrumb_checkout_confirmation'), osc_href_link(FILENAME_CHECKOUT, $this->_module, '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') {
             $osC_MessageStack->add('checkout_payment', $osC_Language->get('error_conditions_not_accepted'), 'error');
         }
     }
     // load the selected payment module
     include 'includes/classes/payment.php';
     $osC_Payment = new osC_Payment(isset($_POST['payment_method']) ? $_POST['payment_method'] : $osC_ShoppingCart->getBillingMethod('id'));
     if (isset($_POST['payment_method'])) {
         $osC_ShoppingCart->setBillingMethod(array('id' => $_POST['payment_method'], 'title' => $GLOBALS['osC_Payment_' . $_POST['payment_method']]->getMethodTitle()));
     }
     if ($osC_Payment->hasActive() && (isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) === false || isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && is_object($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && $GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]->isEnabled() === false)) {
         $osC_MessageStack->add('checkout_payment', $osC_Language->get('error_no_payment_module_selected'), 'error');
     }
     if ($osC_MessageStack->size('checkout_payment') > 0) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
     if ($osC_Payment->hasActive()) {
         $osC_Payment->pre_confirmation_check();
     }
     // Stock Check
     if (STOCK_CHECK == '1' && STOCK_ALLOW_CHECKOUT == '-1') {
         foreach ($osC_ShoppingCart->getProducts() as $product) {
             if (!$osC_ShoppingCart->isInStock($product['item_id'])) {
                 osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'AUTO'));
             }
         }
     }
 }
Example #10
0
 public static function execute(ApplicationAbstract $application)
 {
     if (isset($_GET['module']) && !empty($_GET['module'])) {
         $module = osc_sanitize_string($_GET['module']);
         if (class_exists('osCommerce\\OM\\Core\\Site\\Shop\\Module\\Payment\\' . $module)) {
             $module = 'osCommerce\\OM\\Core\\Site\\Shop\\Module\\Payment\\' . $module;
             $module = new $module();
             $module->callback();
         }
     }
     exit;
 }
Example #11
0
 function _process()
 {
     global $osC_Language, $osC_MessageStack;
     $name = osc_sanitize_string($_POST['name']);
     $email_address = osc_sanitize_string($_POST['email']);
     $enquiry = osc_sanitize_string($_POST['enquiry']);
     if (osc_validate_email_address($email_address)) {
         osc_email(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $osC_Language->get('contact_email_subject'), $enquiry, $name, $email_address);
         osc_redirect(osc_href_link(FILENAME_INFO, 'contact=success', 'AUTO'));
     } else {
         $osC_MessageStack->add('contact', $osC_Language->get('field_customer_email_address_check_error'));
     }
 }
Example #12
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $name = osc_sanitize_string($_POST['name']);
     $email_address = osc_sanitize_string($_POST['email']);
     $enquiry = osc_sanitize_string($_POST['enquiry']);
     if (osc_validate_email_address($email_address)) {
         osc_email(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('contact_email_subject'), $enquiry, $name, $email_address);
         osc_redirect(OSCOM::getLink(null, null, 'Contact&Success'));
     } else {
         $OSCOM_MessageStack->add('Contact', OSCOM::getDef('field_customer_email_address_check_error'));
     }
 }
Example #13
0
 function &setup($module)
 {
     $class = 'osC_Application_' . ucfirst($module);
     if (isset($_GET['action']) && !empty($_GET['action'])) {
         $_action = osc_sanitize_string(basename($_GET['action']));
         if (file_exists('includes/applications/' . $module . '/actions/' . $_action . '.php')) {
             include 'includes/applications/' . $module . '/actions/' . $_action . '.php';
             $class = 'osC_Application_' . ucfirst($module) . '_Actions_' . $_action;
         }
     }
     $object = new $class();
     return $object;
 }
Example #14
0
 public static function execute(ApplicationAbstract $application)
 {
     if (!empty($_GET['shortcut'])) {
         $application = osc_sanitize_string($_GET['shortcut']);
         if (OSCOM::siteApplicationExists($application)) {
             if (Dashboard::deleteShortcut($_SESSION[OSCOM::getSite()]['id'], $application)) {
                 $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']);
                 Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_success_shortcut_removed'), 'success');
                 osc_redirect_admin(OSCOM::getLink(null, $application));
             }
         }
     }
     osc_redirect_admin(OSCOM::getLink());
 }
Example #15
0
 function _process()
 {
     global $osC_Language, $messageStack;
     if (isset($_POST['department_email']) && !empty($_POST['department_email'])) {
         $department_email = osc_sanitize_string($_POST['department_email']);
         if (!osc_validate_email_address($department_email)) {
             $messageStack->add('contact', $osC_Language->get('field_departments_email_error'));
         }
     } else {
         $department_email = STORE_OWNER_EMAIL_ADDRESS;
     }
     if (isset($_POST['name']) && !empty($_POST['name'])) {
         $name = osc_sanitize_string($_POST['name']);
     } else {
         $messageStack->add('contact', $osC_Language->get('field_customer_name_error'));
     }
     if (isset($_POST['email']) && !empty($_POST['email'])) {
         $email_address = osc_sanitize_string($_POST['email']);
         if (!osc_validate_email_address($email_address)) {
             $messageStack->add('contact', $osC_Language->get('field_customer_concat_email_error'));
         }
     } else {
         $messageStack->add('contact', $osC_Language->get('field_customer_concat_email_error'));
     }
     if (isset($_POST['telephone']) && !empty($_POST['telephone'])) {
         $telephone = osc_sanitize_string($_POST['telephone']);
     }
     if (isset($_POST['enquiry']) && !empty($_POST['enquiry'])) {
         $enquiry = osc_sanitize_string($_POST['enquiry']);
     } else {
         $messageStack->add('contact', $osC_Language->get('field_enquiry_error'));
     }
     if (ACTIVATE_CAPTCHA == '1') {
         if (isset($_POST['captcha_code']) && !empty($_POST['captcha_code'])) {
             $securimage = new Securimage();
             if ($securimage->check($_POST['captcha_code']) == false) {
                 $messageStack->add('contact', $osC_Language->get('field_concat_captcha_check_error'));
             }
         } else {
             $messageStack->add('contact', $osC_Language->get('field_concat_captcha_check_error'));
         }
     }
     if ($messageStack->size('contact') === 0) {
         osc_email(STORE_OWNER, $department_email, $osC_Language->get('contact_email_subject'), $enquiry . '<br /><br /><br />' . $osC_Language->get('contact_telephone_title') . $telephone, $name, $email_address);
         osc_redirect(osc_href_link(FILENAME_INFO, 'contact=success', 'AUTO', true, false));
     }
 }
Example #16
0
 public static function initialize()
 {
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     if (empty($_GET)) {
         echo json_encode(array('rpcStatus' => self::STATUS_NO_MODULE));
         exit;
     }
     $site = osc_sanitize_string(basename(key(array_slice($_GET, 1, 1, true))));
     $application = osc_sanitize_string(basename(key(array_slice($_GET, 2, 1, true))));
     if (!OSCOM::siteExists($site)) {
         echo json_encode(array('rpcStatus' => self::STATUS_CLASS_NONEXISTENT));
         exit;
     }
     OSCOM::setSite($site);
     if (!OSCOM::siteApplicationExists($application)) {
         echo json_encode(array('rpcStatus' => self::STATUS_CLASS_NONEXISTENT));
         exit;
     }
     OSCOM::setSiteApplication($application);
     call_user_func(array('osCommerce\\OM\\Core\\Site\\' . $site . '\\Controller', 'initialize'));
     if (!call_user_func(array('osCommerce\\OM\\Core\\Site\\' . $site . '\\Controller', 'hasAccess'), $application)) {
         echo json_encode(array('rpcStatus' => self::STATUS_NO_ACCESS));
         exit;
     }
     if (count($_GET) < 3) {
         echo json_encode(array('rpcStatus' => self::STATUS_NO_ACTION));
         exit;
     }
     $rpc_called = false;
     $rpc = array('RPC');
     for ($i = 3, $n = count($_GET); $i < $n; $i++) {
         $subrpc = osc_sanitize_string(basename(key(array_slice($_GET, $i, 1, true))));
         if (self::siteApplicationRPCExists(implode('\\', $rpc) . '\\' . $subrpc)) {
             call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\' . implode('\\', $rpc) . '\\' . $subrpc, 'execute'));
             $rpc[] = $subrpc;
             $rpc_called = true;
         } else {
             break;
         }
     }
     if ($rpc_called === false) {
         echo json_encode(array('rpcStatus' => self::STATUS_NO_ACTION));
         exit;
     }
     exit;
 }
Example #17
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Database = Registry::get('Database');
     if (!empty($_GET['shortcut'])) {
         $application = osc_sanitize_string($_GET['shortcut']);
         if (OSCOM::siteApplicationExists($application)) {
             $Qsc = $OSCOM_Database->query('delete from :table_administrator_shortcuts where administrators_id = :administrators_id and module = :module');
             $Qsc->bindInt(':administrators_id', $_SESSION[OSCOM::getSite()]['id']);
             $Qsc->bindValue(':module', $application);
             $Qsc->execute();
             if (!$OSCOM_Database->isError()) {
                 $_SESSION[OSCOM::getSite()]['access'] = Access::getUserLevels($_SESSION[OSCOM::getSite()]['id']);
                 Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_success_shortcut_removed'), 'success');
                 osc_redirect_admin(OSCOM::getLink(null, $application));
             }
         }
     }
     osc_redirect_admin(OSCOM::getLink());
 }
 public function __construct($process = true)
 {
     $OSCOM_Session = Registry::get('Session');
     $this->initialize();
     if ($process === true) {
         $this->process();
         $action = null;
         $action_index = 1;
         if (count($_GET) > 1) {
             $requested_action = osc_sanitize_string(basename(key(array_slice($_GET, 1, 1, true))));
             if ($requested_action == OSCOM::getSiteApplication()) {
                 $requested_action = null;
                 if (count($_GET) > 2) {
                     $requested_action = osc_sanitize_string(basename(key(array_slice($_GET, 2, 1, true))));
                     $action_index = 2;
                 }
             }
             if (!empty($requested_action) && self::siteApplicationActionExists($requested_action)) {
                 $action = $requested_action;
             }
         }
         if (isset($action)) {
             call_user_func(array('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this);
             $action_index++;
             if ($action_index < count($_GET)) {
                 $action = array($action);
                 for ($i = $action_index, $n = count($_GET); $i < $n; $i++) {
                     $subaction = osc_sanitize_string(basename(key(array_slice($_GET, $i, 1, true))));
                     if ($subaction != $OSCOM_Session->getName() && self::siteApplicationActionExists(implode('\\', $action) . '\\' . $subaction)) {
                         call_user_func(array('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . implode('\\', $action) . '\\' . $subaction, 'execute'), $this);
                         $action[] = $subaction;
                     } else {
                         break;
                     }
                 }
             }
         }
     }
 }
Example #19
0
 public static function setSiteApplication($application = null)
 {
     if (isset($application)) {
         if (!self::siteApplicationExists($application)) {
             trigger_error('Application \'' . $application . '\' does not exist for Site \'' . self::getSite() . '\', using default \'' . self::getDefaultSiteApplication() . '\'', E_USER_ERROR);
             $application = null;
         }
     } else {
         if (!empty($_GET)) {
             $requested_application = osc_sanitize_string(basename(key(array_slice($_GET, 0, 1, true))));
             if ($requested_application == self::getSite()) {
                 $requested_application = osc_sanitize_string(basename(key(array_slice($_GET, 1, 1, true))));
             }
             if (!empty($requested_application) && self::siteApplicationExists($requested_application)) {
                 $application = $requested_application;
             }
         }
     }
     if (empty($application)) {
         $application = self::getDefaultSiteApplication();
     }
     self::$_application = $application;
 }
Example #20
0
 /**
  * Setup the template class with the requested page module
  *
  * @param string $module The default page module to setup
  * @return object
  */
 function &setup($module)
 {
     global $osC_Template;
     $group = basename($_SERVER['SCRIPT_FILENAME']);
     if (($pos = strrpos($group, '.')) !== false) {
         $group = substr($group, 0, $pos);
     }
     if (empty($_GET) === false) {
         $first_array = array_slice($_GET, 0, 1);
         $_module = osc_sanitize_string(basename(key($first_array)));
         if (file_exists('includes/content/' . $group . '/' . $_module . '.php')) {
             $module = $_module;
         }
     }
     include 'includes/content/' . $group . '/' . $module . '.php';
     $_page_module_name = 'osC_' . ucfirst($group) . '_' . ucfirst($module);
     $osC_Template = new $_page_module_name();
     $osC_Template->iniModules();
     require 'includes/classes/actions.php';
     osC_Actions::parse();
     return $osC_Template;
 }
Example #21
0
 function _process()
 {
     global $osC_Language, $messageStack;
     if (isset($_POST['name']) && !empty($_POST['name'])) {
         $name = osc_sanitize_string($_POST['name']);
     } else {
         $messageStack->add('bank_receipt', $osC_Language->get('field_customer_name_error'));
     }
     if (isset($_POST['email']) && !empty($_POST['email'])) {
         $email_address = osc_sanitize_string($_POST['email']);
         if (!osc_validate_email_address($email_address)) {
             $messageStack->add('bank_receipt', $osC_Language->get('field_customer_bank_receipt_email_error'));
         }
     } else {
         $messageStack->add('bank_receipt', $osC_Language->get('field_customer_bank_receipt_email_error'));
     }
     if (isset($_POST['telephone']) && !empty($_POST['telephone'])) {
         $telephone = osc_sanitize_string($_POST['telephone']);
     }
     if (isset($_POST['amount']) && !empty($_POST['amount'])) {
         $amount = osc_sanitize_string($_POST['amount']);
     } else {
         $messageStack->add('bank_receipt', $osC_Language->get('field_bank_receipt_amount_error'));
     }
     if (isset($_POST['bankname']) && !empty($_POST['bankname'])) {
         $bankname = osc_sanitize_string($_POST['bankname']);
     } else {
         $messageStack->add('bank_receipt', $osC_Language->get('field_bank_receipt_bankname_error'));
     }
     if (isset($_POST['receiptnumber']) && !empty($_POST['receiptnumber'])) {
         $receiptnumber = osc_sanitize_string($_POST['receiptnumber']);
     } else {
         $messageStack->add('bank_receipt', $osC_Language->get('field_bank_receipt_receiptnumber_error'));
     }
     if (isset($_POST['receiptdate_days']) && isset($_POST['receiptdate_months']) && isset($_POST['receiptdate_years'])) {
         $receiptdate = $_POST['receiptdate_years'] . '/' . $_POST['receiptdate_months'] . '/' . $_POST['receiptdate_days'];
     }
     if (isset($_POST['ordernumber']) && !empty($_POST['ordernumber'])) {
         $ordernumber = osc_sanitize_string($_POST['ordernumber']);
     } else {
         $messageStack->add('bank_receipt', $osC_Language->get('field_bank_receipt_ordernumber_error'));
     }
     if (isset($_POST['description']) && !empty($_POST['description'])) {
         $description = osc_sanitize_string($_POST['description']);
     }
     if (ACTIVATE_CAPTCHA == '1') {
         if (isset($_POST['captcha_code']) && !empty($_POST['captcha_code'])) {
             $securimage = new Securimage();
             if ($securimage->check($_POST['captcha_code']) == false) {
                 $messageStack->add('bank_receipt', $osC_Language->get('field_bank_receipt_captcha_check_error'));
             }
         } else {
             $messageStack->add('bank_receipt', $osC_Language->get('field_bank_receipt_captcha_check_error'));
         }
     }
     if ($messageStack->size('bank_receipt') === 0) {
         $email_content = "\n\t<center>\n\t<table dir=rtl width=100% height=100% cellpadding=2 cellspacing=1><tr><td style='font-family:tahoma; font-size:12px; ' align=right >\n" . $osC_Language->get('bank_receipt_name_title') . $name . "<br><br>\n" . $osC_Language->get('bank_receipt_telephone_title') . $telephone . "<br><br>\n" . $osC_Language->get('bank_receipt_email_address_title') . $email_address . "<br><br>\n" . $osC_Language->get('bank_receipt_amount_title') . $amount . "<br><br>\n" . $osC_Language->get('bank_receipt_bank_name_title') . $bankname . "<br><br>\n" . $osC_Language->get('bank_receipt_receipt_number_title') . $receiptnumber . "<br><br>\n" . $osC_Language->get('bank_receipt_receipt_date_title') . $receiptdate . "<br><br>\n" . $osC_Language->get('bank_receipt_order_number_title') . $ordernumber . "<br><br>\n" . $osC_Language->get('bank_receipt_description_title') . $description . "<br><br>\n\t</td></tr></table>\n\t</center>\n";
         osc_email(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $osC_Language->get('bank_receipt_email_subject'), $email_content, $name, $email_address);
         osc_redirect(osc_href_link(FILENAME_INFO, 'bank_receipt=success', 'AUTO', true, false));
         $email_content = '';
     }
 }
Example #22
0
    exit;
}
$module = null;
$class = null;
if (empty($_GET)) {
    echo json_encode(array('rpcStatus' => RPC_STATUS_NO_MODULE));
    exit;
} else {
    $first_array = array_slice($_GET, 0, 1);
    $_module = osc_sanitize_string(basename(key($first_array)));
    if (!osC_Access::hasAccess($_module)) {
        echo json_encode(array('rpcStatus' => RPC_STATUS_NO_ACCESS));
        exit;
    }
    $class = isset($_GET['class']) && !empty($_GET['class']) ? osc_sanitize_string(basename($_GET['class'])) : 'rpc';
    $action = isset($_GET['action']) && !empty($_GET['action']) ? osc_sanitize_string(basename($_GET['action'])) : '';
    if (empty($action)) {
        echo json_encode(array('rpcStatus' => RPC_STATUS_NO_ACTION));
        exit;
    }
    if (file_exists('includes/applications/' . $_module . '/classes/' . $class . '.php')) {
        include 'includes/applications/' . $_module . '/classes/' . $class . '.php';
        if (method_exists('osC_' . ucfirst($_module) . '_Admin_' . $class, $action)) {
            call_user_func(array('osC_' . ucfirst($_module) . '_Admin_' . $class, $action));
            exit;
        } else {
            echo json_encode(array('rpcStatus' => RPC_STATUS_ACTION_NONEXISTENT));
            exit;
        }
    } else {
        echo json_encode(array('rpcStatus' => RPC_STATUS_CLASS_NONEXISTENT));
Example #23
0
 function savePaymentMethod()
 {
     global $osC_Language, $osC_ShoppingCart, $osC_Payment, $messageStack, $toC_Json, $osC_Currencies;
     $errors = array();
     $osC_Language->load('account');
     $osC_Language->load('checkout');
     $osC_Language->load('order');
     if (isset($_POST['payment_comments']) && isset($_SESSION['payment_comments']) && empty($_POST['payment_comments'])) {
         unset($_SESSION['comments']);
     } elseif (!empty($_POST['payment_comments'])) {
         $_SESSION['comments'] = osc_sanitize_string($_POST['payment_comments']);
     }
     if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1') {
         if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
             $errors[] = $osC_Language->get('error_conditions_not_accepted');
         }
     }
     if ($osC_ShoppingCart->isTotalZero() == false) {
         // load the selected payment module
         require_once 'includes/classes/payment.php';
         $osC_Payment = new osC_Payment(isset($_REQUEST['payment_method']) ? $_REQUEST['payment_method'] : $osC_ShoppingCart->getBillingMethod('id'));
         if (isset($_REQUEST['payment_method'])) {
             $osC_ShoppingCart->setBillingMethod(array('id' => $_REQUEST['payment_method'], 'title' => $GLOBALS['osC_Payment_' . $_REQUEST['payment_method']]->getMethodTitle()));
         }
         if ($osC_Payment->hasActive() && (isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) === false || isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && is_object($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && $GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]->isEnabled() === false)) {
             $errors[] = $osC_Language->get('error_no_payment_module_selected');
         }
         if ($osC_Payment->hasActive()) {
             $osC_Payment->pre_confirmation_check();
         }
         if ($messageStack->size('checkout_payment') > 0) {
             $errors = array_merge($errors, $messageStack->getMessages('checkout_payment'));
         }
     } else {
         $osC_ShoppingCart->resetBillingMethod();
     }
     if (sizeof($errors) > 0) {
         $response = array('success' => false, 'errors' => $errors);
     } else {
         $form = toC_Json_Checkout::_getOrderConfirmationForm();
         $response = array('success' => true, 'form' => $form);
     }
     echo $toC_Json->encode($response);
 }
Example #24
0
 /**
  * Setup the template class with the requested page module
  *
  * @param string $module The default page module to setup
  * @return object
  */
 public static function setup($module)
 {
     $group = basename($_SERVER['SCRIPT_FILENAME']);
     if (($pos = strrpos($group, '.')) !== false) {
         $group = substr($group, 0, $pos);
     }
     if (empty($_GET) === false) {
         $first_array = array_slice($_GET, 0, 1);
         $_module = osc_sanitize_string(basename(key($first_array)));
         if (file_exists('includes/content/' . $group . '/' . $_module . '.php')) {
             $module = $_module;
         }
     }
     include 'includes/content/' . $group . '/' . $module . '.php';
     $_page_module_name = 'osC_' . ucfirst($group) . '_' . ucfirst($module);
     $object = new $_page_module_name();
     if (isset($_GET['action']) && !empty($_GET['action'])) {
         include 'includes/classes/actions.php';
         osC_Actions::parse($_GET['action']);
     }
     return $object;
 }
Example #25
0
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2006 osCommerce

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
require 'includes/application_top.php';
if ($osC_Customer->isLoggedOn() === false) {
    if (!empty($_GET)) {
        $first_array = array_slice($_GET, 0, 1);
    }
    if (empty($_GET) || !empty($_GET) && !in_array(osc_sanitize_string(basename(key($first_array))), array('login', 'create', 'password_forgotten'))) {
        $osC_NavigationHistory->setSnapshot();
        osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
    }
}
$osC_Language->load('account');
if ($osC_Services->isStarted('breadcrumb')) {
    $osC_Breadcrumb->add($osC_Language->get('breadcrumb_my_account'), osc_href_link(FILENAME_ACCOUNT, null, 'SSL'));
}
$osC_Template = osC_Template::setup('account');
require 'templates/' . $osC_Template->getCode() . '.php';
require 'includes/application_bottom.php';
Example #26
0
function osc_market($section, $code)
{
    $plugin = false;
    $re_enable = false;
    $message = "";
    $data = array();
    $download_post_data = array('api_key' => osc_market_api_connect());
    /************************
     *** CHECK VALID CODE ***
     ************************/
    if ($code != '' && $section != '') {
        if (stripos($code, "http://") === FALSE) {
            // OSCLASS OFFICIAL REPOSITORY
            $url = osc_market_url($section, $code);
            $data = osc_file_get_contents($url, array('api_key' => osc_market_api_connect()));
            $data = json_decode(osc_file_get_contents($url, array('api_key' => osc_market_api_connect())), true);
        } else {
            // THIRD PARTY REPOSITORY
            if (osc_market_external_sources()) {
                $download_post_data = array();
                $data = json_decode(osc_file_get_contents($code), true);
            } else {
                return array('error' => 9, 'message' => __('No external sources are allowed'), 'data' => $data);
            }
        }
        /***********************
         **** DOWNLOAD FILE ****
         ***********************/
        if (isset($data['s_update_url']) && isset($data['s_source_file']) && isset($data['e_type'])) {
            if ($data['e_type'] == 'THEME') {
                $folder = 'themes/';
            } else {
                if ($data['e_type'] == 'LANGUAGE') {
                    $folder = 'languages/';
                } else {
                    // PLUGINS
                    $folder = 'plugins/';
                    $plugin = Plugins::findByUpdateURI($data['s_update_url']);
                    if ($plugin != false) {
                        if (Plugins::isEnabled($plugin)) {
                            Plugins::runHook($plugin . '_disable');
                            Plugins::deactivate($plugin);
                            $re_enable = true;
                        }
                    }
                }
            }
            $filename = date('YmdHis') . "_" . osc_sanitize_string($data['s_title']) . "_" . $data['s_version'] . ".zip";
            $url_source_file = $data['s_source_file'];
            $result = osc_downloadFile($url_source_file, $filename, $download_post_data);
            if ($result) {
                // Everything is OK, continue
                /**********************
                 ***** UNZIP FILE *****
                 **********************/
                @mkdir(osc_content_path() . 'downloads/oc-temp/');
                $res = osc_unzip_file(osc_content_path() . 'downloads/' . $filename, osc_content_path() . 'downloads/oc-temp/');
                if ($res == 1) {
                    // Everything is OK, continue
                    /**********************
                     ***** COPY FILES *****
                     **********************/
                    $fail = -1;
                    if ($handle = opendir(osc_content_path() . 'downloads/oc-temp')) {
                        $folder_dest = ABS_PATH . "oc-content/" . $folder;
                        if (function_exists('posix_getpwuid')) {
                            $current_user = posix_getpwuid(posix_geteuid());
                            $ownerFolder = posix_getpwuid(fileowner($folder_dest));
                        }
                        $fail = 0;
                        while (false !== ($_file = readdir($handle))) {
                            if ($_file != '.' && $_file != '..') {
                                $copyprocess = osc_copy(osc_content_path() . "downloads/oc-temp/" . $_file, $folder_dest . $_file);
                                if ($copyprocess == false) {
                                    $fail = 1;
                                }
                            }
                        }
                        closedir($handle);
                        // Additional actions is not important for the rest of the proccess
                        // We will inform the user of the problems but the upgrade could continue
                        // Also remove the zip package
                        /****************************
                         ** REMOVE TEMPORARY FILES **
                         ****************************/
                        @unlink(osc_content_path() . 'downloads/' . $filename);
                        $path = osc_content_path() . 'downloads/oc-temp';
                        $rm_errors = 0;
                        $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                        for ($dir->rewind(); $dir->valid(); $dir->next()) {
                            if ($dir->isDir()) {
                                if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                    if (!rmdir($dir->getPathname())) {
                                        $rm_errors++;
                                    }
                                }
                            } else {
                                if (!unlink($dir->getPathname())) {
                                    $rm_errors++;
                                }
                            }
                        }
                        if (!rmdir($path)) {
                            $rm_errors++;
                        }
                        if ($fail == 0) {
                            // Everything is OK, continue
                            if ($data['e_type'] != 'THEME' && $data['e_type'] != 'LANGUAGE') {
                                if ($plugin != false && $re_enable) {
                                    $enabled = Plugins::activate($plugin);
                                    if ($enabled) {
                                        Plugins::runHook($plugin . '_enable');
                                    }
                                }
                            } else {
                                if ($data['e_type'] == 'LANGUAGE') {
                                    osc_checkLocales();
                                }
                            }
                            // recount plugins&themes for update
                            if ($section == 'plugins') {
                                osc_check_plugins_update(true);
                            } else {
                                if ($section == 'themes') {
                                    osc_check_themes_update(true);
                                } else {
                                    if ($section == 'languages') {
                                        osc_check_languages_update(true);
                                    }
                                }
                            }
                            if ($rm_errors == 0) {
                                $message = __('Everything looks good!');
                                $error = 0;
                            } else {
                                $message = __('Nearly everything looks good! but there were some errors removing temporary files. Please manually remove the \\"oc-content/downloads/oc-temp\\" folder');
                                $error = 6;
                                // Some errors removing files
                            }
                        } else {
                            $message = __('Problems when copying files. Please check your permissions. ');
                            if ($current_user['uid'] != $ownerFolder['uid']) {
                                if (function_exists('posix_getgrgid')) {
                                    $current_group = posix_getgrgid($current_user['gid']);
                                    $message .= '<p><strong>' . sprintf(__('NOTE: Web user and destination folder user is not the same, you might have an issue there. <br/>Do this in your console:<br/>chown -R %s:%s %s'), $current_user['name'], $current_group['name'], $folder_dest) . '</strong></p>';
                                }
                            }
                            $error = 4;
                            // Problems copying files. Maybe permissions are not correct
                        }
                    } else {
                        $message = __('Nothing to copy');
                        $error = 99;
                        // Nothing to copy. THIS SHOULD NEVER HAPPEN, means we don't update any file!
                    }
                } else {
                    $message = __('Unzip failed');
                    $error = 3;
                    // Unzip failed
                }
            } else {
                $message = __('Download failed');
                $error = 2;
                // Download failed
            }
        } else {
            if (isset($data['s_buy_url']) && isset($data['b_paid']) && $data['s_buy_url'] != '' && $data['b_paid'] == 0) {
                $message = __('This is a paid item, you need to buy it before you are able to download it');
                $error = 8;
                // Item not paid
            } else {
                $message = __('Input code not valid');
                $error = 7;
                // Input code not valid
            }
        }
    } else {
        $message = __('Missing download URL');
        $error = 1;
        // Missing download URL
    }
    return array('error' => $error, 'message' => $message, 'data' => $data);
}
Example #27
0
// define our general functions used application-wide
require '../includes/functions/general.php';
require 'includes/functions/general.php';
require '../includes/functions/html_output.php';
require 'includes/functions/html_output.php';
// include session class
require '../includes/classes/session.php';
$osC_Session = osC_Session::load('osCAdminID');
$osC_Session->start();
if (!isset($_SESSION['admin']) && basename($_SERVER['PHP_SELF']) != FILENAME_RPC) {
    $redirect = false;
    if (empty($_GET)) {
        $redirect = true;
    } else {
        $first_array = array_slice($_GET, 0, 1);
        $_module = osc_sanitize_string(basename(key($first_array)));
        if ($_module != 'login') {
            if (!isset($_SESSION['redirect_origin'])) {
                $_SESSION['redirect_origin'] = array('module' => $_module, 'get' => $_GET);
            }
            $redirect = true;
        }
    }
    if ($redirect === true) {
        osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
    }
    unset($redirect);
}
require 'includes/classes/directory_listing.php';
require 'includes/classes/access.php';
require '../includes/classes/address.php';