/** * Handles XHR 'providerAction 'requests from the settings > email integration forms, and routes them to the correct provider module * * @param array $data */ public function handleProviderAction($data) { $providerAction = $data['providerAction']; $provider = $data['provider']; unset($data['providerAction'], $data['provider']); GetModuleById('emailintegration', /** @var ISC_EMAILINTEGRATION */$module, $provider); if (!$module) { ISC_JSON::output('Unknown module: ' . $provider, false); return; } $method = 'remote' . $providerAction; if (!is_callable(array($module, $method))) { ISC_JSON::output('Provider action not "' . $providerAction . '" found for provider "' . $provider . '"', false); return; } // api auth details will be included in the request, based on the form - this should be separated before sending it to the provider module $auth = @$data['auth']; if (!$auth) { $auth = array(); } unset($data['auth']); $result = $module->$method($auth, $data); // result expected from provider module is array containing at least 'message' and 'success'; any other elements will be sent back as json too but message and success are stripped out and handled separately due to how ISC_JSON works $message = @$result['message']; $success = !!$result['success']; unset($result['message'], $result['success']); ISC_JSON::output($message, $success, $result); }
/** * Constructor * * Base constructor * * @access public * @param string $op The operation to preform * @param array &$data The referenced data array * @param array &$parent The referenced handler parent object */ public function __construct($op, &$data, &$parent) { parent::__construct($op, $data, $parent); GetModuleById('accounting', $this->quickbooks, 'accounting_quickbooks'); $this->xmlNode = new XMLWriter(); $this->xmlNode->openMemory(); }
private function HandleSupport() { $accounting = null; if (!array_key_exists('accounting', $_REQUEST) || !GetModuleById('accounting', $accounting, $_REQUEST['accounting'])) { exit; } header('Location: ' . $accounting->_supporturl); exit; }
/** * Get the selected module * * Method will return the selected module * * @access private * @return object the selected module on success, FALSE if the module could not be found */ private function getSelectedModule() { $module = null; if (!array_key_exists("accounting", $_GET) || !GetModuleById("accounting", $module, $_GET["accounting"])) { return false; } return $module; }
/** * Constructor * * Base constructor * * @access public * @param string $op The operation to preform * @param array &$data The referenced data array * @param array &$parent The referenced handler parent object */ public function __construct($op, &$data, &$parent) { parent::__construct($op, $data, $parent); $this->entity = new ACCOUNTING_QUICKBOOKS_ENTITIES(); GetModuleById('accounting', $this->quickbooks, 'accounting_quickbooks'); /** * Now assign the spool data */ $this->spoolId = $this->data->spoolId; $this->spoolData = $this->quickbooks->getAccountingSpool($this->data->spoolId); }
/** * Return the tracking code for all of the enabled analytics modules. * * @return string The tracking code to be inserted on pages. */ function GetTrackingCodeForAllPackages() { $packages = GetAvailableModules('analytics', true, true); $code = ""; foreach ($packages as $package) { if (GetModuleById('analytics', $module, $package['id'])) { $trackingCode = $module->GetTrackingCode(); } $code .= "<!-- Start Tracking Code for " . $package['id'] . " -->\n\n" . $trackingCode . "\n\n<!-- End Tracking Code for " . $package['id'] . " -->\n\n"; } return $code; }
public function perform() { $moduleId = $this->args['module']; GetModuleById('emailintegration', /** @var EMAILINTEGRATION_MAILCHIMP */$module, $moduleId); $listId = $this->args['listId']; $subscription = unserialize($this->args['subscription']); $fields = $this->args['fields']; $result = $module->addSubscriberToList($listId, $subscription, $fields, false); return $result->success; }
public function perform() { $moduleId = $this->args['module']; GetModuleById('emailintegration', /** @var EMAILINTEGRATION_MAILCHIMP */$module, $moduleId); $listId = $this->args['listId']; $email = $this->args['email']; $subscription = new Interspire_EmailIntegration_Subscription_Newsletter($email, ''); $result = $module->removeSubscriberFromList($listId, $subscription, false); return $result->success; }
public function handleManager() { if (!isset($_GET['manager'])) { exit; } $manager = 'shippingmanager_' . $_GET['manager']; if (!GetModuleById('shippingmanager', $module, $manager) || !$module->IsEnabled() || !method_exists($module, 'handleAction')) { exit; } $module->handleAction(); }
/** * The constructor. If you pass in xml_response then it will automatically call HandleRequest for you too * * @return void **/ public function __construct($xml_response = null) { // If the google checkout module is not enabled and configured we don't need to do anything GetModuleById('checkout', $this->module, 'checkout_googlecheckout'); if (!$this->module) { $GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', 'checkout_googlecheckout'), 'Google checkout not configured.'); die; } $this->logtype = array('payment', $this->module->_name); require_once dirname(__FILE__) . '/library/googleresponse.php'; $this->response = new GoogleResponse($this->module->GetValue('merchantid'), $this->module->GetValue('merchanttoken')); if ($xml_response !== null) { $this->HandleRequest($xml_response); } }
public function SetPanelSettings() { // get our comments system if (!GetModuleById('comments', /** @var ISC_COMMENTS **/$commentsModule, GetConfig('CommentSystemModule'))) { $this->DontDisplay = true; return; } if (!$commentsModule->commentsEnabledForType(ISC_COMMENTS::PRODUCT_COMMENTS)) { $this->DontDisplay = true; return; } $GLOBALS['CommentsHTML'] = $commentsModule->getCommentsHTMLForType(ISC_COMMENTS::PRODUCT_COMMENTS, $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()); }
public function SetPanelSettings() { // get our comments system if (!GetModuleById('comments', /** @var ISC_COMMENTS **/$commentsModule, GetConfig('CommentSystemModule'))) { $this->DontDisplay = true; return; } $pageId = $GLOBALS['ISC_CLASS_PAGE']->GetPageId(); if (!$commentsModule->commentsEnabledForType(ISC_COMMENTS::PAGE_COMMENTS) || !$commentsModule->pageEnabled($pageId)) { $this->DontDisplay = true; return; } $GLOBALS['CommentsHTML'] = $commentsModule->getCommentsHTMLForType(ISC_COMMENTS::PAGE_COMMENTS, $pageId); }
public function update_simplepay_checkout_module() { if (!ModuleIsConfigured('checkout_paysimple')) { return true; } GetModuleById('checkout', $module, 'checkout_paysimple'); // Check to see if the module hasn't already been updated $value = $module->GetValue('merchantkey'); if (!is_null($value) && trim($value) !== '') { return true; } // OK, it hasn't been updated yet, so do so $keyFile = ISC_BASE_PATH . "/modules/checkout/paysimple/lib/keyHalf.txt"; if (!file_exists($keyFile)) { return true; } if (!is_readable($keyFile)) { $this->SetError('Unable to read the key file ' . GetConfig('AppPath') . '/modules/checkout/paysimple/lib/keyHalf.txt. Please CHMOD it to 646 or 666.'); return false; } $newKey = @file_get_contents(ISC_BASE_PATH . "/modules/checkout/paysimple/lib/keyHalf.txt"); $newKey = trim($newKey); if ($newKey == '') { return true; } // Make sure you get the 'static' part $newKey = Interspire_String::toUnixLineEndings($newKey); $newKey = explode("\n", $newKey); $newKey = $newKey[0]; $module->setMerchantKey($newKey); return true; }
public function perform() { $_engine = getClass('ISC_ADMIN_ENGINE'); $_engine->LoadLangFile('shoppingcomparison'); $moduleId = $this->args['module']; GetModuleById('shoppingcomparison', $module, $moduleId); if(!$module) return; if(!isset($this->args['controller']) || !($controllerId = $this->args['controller'])) { error_log("No controller for export task. Aborting"); return; } $this->initialize($module, $controllerId); $this->run(); }
private function SetOrderData() { // Some payment providers like WorldPay simply "fetch" FinishOrder.php and so it // doesn't factor in cookies stored by Unreal Shopping Cart, so we have to pass back the // order token manually from those payment providers. We do this by taking the // cart ID passed back from the provider which stores the order's unique token. if(isset($_COOKIE['SHOP_ORDER_TOKEN'])) { $this->orderToken = $_COOKIE['SHOP_ORDER_TOKEN']; } else if(isset($_REQUEST['provider'])) { GetModuleById('checkout', $this->paymentProvider, $_REQUEST['provider']); if(in_array("GetOrderToken", get_class_methods($this->paymentProvider))) { $this->orderToken = $this->paymentProvider->GetOrderToken(); } else { ob_end_clean(); header(sprintf("Location:%s", $GLOBALS['ShopPath'])); die(); } } // Load the pending orders from the database $this->pendingData = LoadPendingOrdersByToken($this->orderToken, true); if(!$this->orderToken || $this->pendingData === false) { $this->BadOrder(); exit; } if($this->paymentProvider === null) { GetModuleById('checkout', $this->paymentProvider, $this->pendingData['paymentmodule']); } if($this->paymentProvider) { $this->paymentProvider->SetOrderData($this->pendingData); } }
/** * Get Rule Module Info * * Retrieves a list of discount rules enabled by the customer * * @access public * @param string $type - The type of the rules * @return array Returns an array of initialized rules */ function GetRuleModuleInfo($type='all') { static $cache = array(); if(isset($cache[$type])) { return $cache[$type]; } if ($type == 'all') { $query = " SELECT * FROM [|PREFIX|]discounts ORDER BY sortorder"; } else { $query = " SELECT * FROM [|PREFIX|]discounts WHERE discountruletype='rule_".$type . "' ORDER BY sortorder"; } $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while($var = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { GetModuleById('rule', $object, $var['discountruletype']); $object->initialize($var); $cache[$type][] = $object; } if (isset($cache[$type])) { return $cache[$type]; } else { return array(); } }
/** * Add the shipping information to the google object representation of the customers cart. * * @return void **/ private function AddShippingInformationToCart() { $shippingZones = GetShippingZoneInfo(); $defaultZone = null; $coveredLocations = array(); $defaultShippingMethods = array(); // Do all the normal zones first (skip the default one) // this is so that we can work out where "everywhere else" equates to foreach ($shippingZones as $shippingZone) { // If the zone has no enabled methods if (!isset($shippingZone['methods'])) { continue; } // Skip the default zone for now if (!isset($shippingZone['locationtype'])) { continue; } foreach ($shippingZone['methods'] as $method) { $module = null; if (!GetModuleById('shipping', $module, $method['methodmodule'])) { continue; } if ($module === null) { continue; } $module->SetMethodId($method['methodid']); $deliveryMethods = $module->GetAvailableDeliveryMethods(); foreach ($deliveryMethods as $deliveryMethod) { $shipping_name = $deliveryMethod . ' (' . $shippingZone['zonename'] . ')'; // If it's a flat rate if ($module->_flatrate) { $defaultCost = $module->GetValue('defaultcost'); if ($defaultCost === null) { $defaultCost = $this->GetValue('fallbackshippingcost'); } $ship = new GoogleMerchantCalculatedShipping($shipping_name, $defaultCost); } else { $ship = new GoogleMerchantCalculatedShipping($shipping_name, $this->GetValue('fallbackshippingcost')); } $ShippingRestrictions = $this->GetShippingRestrictions($shippingZone); $this->AddDefaultShippingRestrictions($shippingZone); if ($ShippingRestrictions !== false) { // Address filters are used when a customer goes to the google checkout page $ship->AddAddressFilters($ShippingRestrictions); // Shipping restrictions are used if the merchant callback calculation fails $ship->AddShippingRestrictions($ShippingRestrictions); } $this->cart->AddShipping($ship); } } } // Now add the methods for the default zone foreach ($shippingZones as $shippingZone) { // If the zone has no enabled methods if (!isset($shippingZone['methods'])) { continue; } // Skip any non-default zones now if (isset($shippingZone['locationtype'])) { continue; } foreach ($shippingZone['methods'] as $method) { $module = null; if (!GetModuleById('shipping', $module, $method['methodmodule'])) { continue; } if ($module === null) { continue; } $module->SetMethodId($method['methodid']); $deliveryMethods = $module->GetAvailableDeliveryMethods(); foreach ($deliveryMethods as $deliveryMethod) { $shipping_name = $deliveryMethod; // If it's a flat rate if ($module->_flatrate) { $defaultCost = $module->GetValue('defaultcost'); if ($defaultCost === null) { $defaultCost = $this->GetValue('fallbackshippingcost'); } $ship = new GoogleMerchantCalculatedShipping($shipping_name, $defaultCost); } else { $ship = new GoogleMerchantCalculatedShipping($shipping_name, $this->GetValue('fallbackshippingcost')); } if ($this->defaultZoneGFilter) { // Address filters are used when a customer goes to the google checkout page $ship->AddAddressFilters($this->defaultZoneGFilter); // Shipping restrictions are used if the merchant callback calculation fails $ship->AddShippingRestrictions($this->defaultZoneGFilter); } $this->cart->AddShipping($ship); } } } }
private function RefundOrder() { $message = ''; $messageStaus = MSG_ERROR; $provider = null; if (!isset($_REQUEST['orderid'])) { return false; } $orderId = $_REQUEST['orderid']; $order = GetOrder($_REQUEST['orderid']); if (!isset($order['orderid'])) { return false; } /* Validate posted data*/ $refundType = ''; if (!isset($_REQUEST['refundType'])) { return false; } $refundType = $_REQUEST['refundType']; //preset the refund amount to the available amount of the order $refundAmt = $order['ordgatewayamount'] - $order['ordrefundedamount']; //refund partial amount if ($refundType == 'partial') { //is refund amount specified if (!isset($_REQUEST['refundAmt']) || $_REQUEST['refundAmt'] == '') { $message = GetLang('EnterRefundAmount'); } else { if (!is_numeric($_REQUEST['refundAmt']) || $_REQUEST['refundAmt'] <= 0) { $message = GetLang('InvalidRefundAmountFormat'); } else { if ($_REQUEST['refundAmt'] + $order['ordrefundedamount'] > $order['ordgatewayamount']) { $message = GetLang('InvalidRefundAmount'); } else { $refundAmt = $_REQUEST['refundAmt']; } } } } //there is an error message if ($message != '') { FlashMessage($message, $messageStatus, 'index.php?ToDo=viewOrders'); } $transactionId = trim($order['ordpayproviderid']); if ($transactionId == '') { $message = GetLang('OrderTranscationIDNotFound'); } else { if (!GetModuleById('checkout', $provider, $order['orderpaymentmodule'])) { $message = GetLang('PaymentMethodNotExist'); } else { if (!$provider->IsEnabled()) { $message = GetLang('PaymentProviderIsDisabled'); } else { if (!method_exists($provider, "DoRefund")) { $message = GetLang('RefundNotAvailable'); } else { //still here, perform a delay capture if ($provider->DoRefund($order, $message, $refundAmt)) { $messageStatus = MSG_SUCCESS; //update order status $orderStatus = ORDER_STATUS_REFUNDED; UpdateOrderStatus($order['orderid'], $orderStatus, true); } } } } } FlashMessage($message, $messageStatus, 'index.php?ToDo=viewOrders'); return $message; }
private function saveShippingManagerSettings() { $currentTab = $_POST['currentTab']; $enabledStack = array(); if (isset($_POST['shippingManagers'])) { foreach ($_POST['shippingManagers'] as $moduleid) { GetModuleById('shippingmanager', $module, $moduleid); if (is_object($module)) { // Is this shipping manager supported on this server? if($module->IsSupported() == false) { $errors = $module->GetErrors(); foreach($errors as $error) { FlashMessage($error, MSG_ERROR); } $this->manageShippingManagerSettings(); } // Otherwise, this manager module is fine, so add it to the stack of enabled $enabledStack[] = $moduleid; } } } $shippingManagers = implode(",", $enabledStack); $GLOBALS['ISC_NEW_CFG']['ShippingManagerModules'] = $shippingManagers; $settings = GetClass('ISC_ADMIN_SETTINGS'); $messages = array(); if ($settings->CommitSettings($messages)) { if (is_array($messages) && !empty($messages)) { foreach($messages as $message => $status) { FlashMessage($message, $status); } } // Delete existing module configuration $GLOBALS['ISC_CLASS_DB']->DeleteQuery('module_vars', "WHERE modulename LIKE 'shippingmanager\_%' AND MID(variablename, 1, 6) != 'setup_'"); // Now get all variables (they are in an array from $_POST) foreach($enabledStack as $module_id) { $vars = array(); if(isset($_POST[$module_id])) { $vars = $_POST[$module_id]; } GetModuleById('shippingmanager', $module, $module_id); $module->SaveModuleSettings($vars, false); } FlashMessage(GetLang('ShippingManagerSettingsSaved'), MSG_SUCCESS, 'index.php?ToDo=viewShippingManagerSettings&tab=' . $currentTab); } else { FlashMessage(GetLang('ShippingManagerSettingsNotSaved'), MSG_ERROR, 'index.php?ToDo=viewShippingManagerSettings&tab=' . $currentTab); } }
/** * Constructor * * Base constructor * * @access public * @param string $op The operation to preform * @param array &$data The referenced data array * @param array &$parent The referenced handler parent object */ public function __construct($op, &$data, &$parent) { parent::__construct($op, $data, $parent); $this->service = new ACCOUNTING_QUICKBOOKS_SERVICES(); GetModuleById('accounting', $this->quickbooks, 'accounting_quickbooks'); }
/** * Constructor * * Base constructor * * @access public */ public function __construct() { $this->entity = new ACCOUNTING_QUICKBOOKS_ENTITIES(); $this->session = new ACCOUNTING_QUICKBOOKS_SESSION(); GetModuleById('accounting', $this->quickbooks, 'accounting_quickbooks'); }
private function saveCommentSystemSettings() { $currentTab = $_POST['currentTab']; $enabledModule = ''; if (isset($_POST['commentSystem'])) { $moduleid = $_POST['commentSystem']; GetModuleById('comments', $module, $moduleid); if (is_object($module)) { // Is this shipping manager supported on this server? if($module->IsSupported() == false) { $errors = $module->GetErrors(); foreach($errors as $error) { FlashMessage($error, MSG_ERROR); } $this->manageShippingManagerSettings(); } // Otherwise, this manager module is fine, so add it to the stack of enabled $enabledModule = $moduleid; } } // has the selected comment system changed? if (GetConfig('CommentSystemModule') != $enabledModule) { // activate the tab for the module $currentTab = '1'; // enable all the types for this module $_POST[$enabledModule]['commenttypes'] = $module->getAvailableCommentTypes(); // select all the pages for this module by default $_POST[$enabledModule]['pages'] = $this->getPageIds(); } elseif (!$module->commentsEnabledForType(ISC_COMMENTS::PAGE_COMMENTS) && in_array(ISC_COMMENTS::PAGE_COMMENTS, $_POST[$enabledModule]['commenttypes'])) { // were page comments just enabled? $_POST[$enabledModule]['pages'] = $this->getPageIds(); } $GLOBALS['ISC_NEW_CFG']['CommentSystemModule'] = $enabledModule; $settings = GetClass('ISC_ADMIN_SETTINGS'); $messages = array(); if ($settings->CommitSettings($messages)) { if (is_array($messages) && !empty($messages)) { foreach($messages as $message => $status) { FlashMessage($message, $status); } } // Delete existing module configuration $GLOBALS['ISC_CLASS_DB']->DeleteQuery('module_vars', "WHERE modulename LIKE 'comments\_%' AND MID(variablename, 1, 6) != 'setup_'"); if ($enabledModule) { $vars = array(); if(isset($_POST[$enabledModule])) { $vars = $_POST[$enabledModule]; } GetModuleById('comments', $module, $enabledModule); $module->SaveModuleSettings($vars, false); } FlashMessage(GetLang('CommentSettingsSaved'), MSG_SUCCESS, 'index.php?ToDo=viewCommentSystemSettings&tab=' . $currentTab); } else { FlashMessage(GetLang('CommentSettingsNotSaved'), MSG_ERROR, 'index.php?ToDo=viewCommentSystemSettings&tab=' . $currentTab); } }
private function EditDiscountStep1() { $GLOBALS['Title'] = GetLang('EditDiscount'); $GLOBALS['Intro'] = GetLang('EditDiscountIntro'); $GLOBALS['Enabled'] = 'checked="checked"'; $GLOBALS['FormAction'] = "editDiscount2"; $GLOBALS['DiscountTypes'] = ''; $GLOBALS['Edit'] = 'display : none;'; $GLOBALS['DiscountJavascriptValidation'] = ''; $GLOBALS['DiscountEnabledCheck'] = 'checked="checked"'; $rules = GetAvailableModules('rule', false, false, false); $GLOBALS['RuleList'] = ''; $GLOBALS['MaxUses'] = ''; $GLOBALS['DiscountExpiryFields'] = 'display : none'; $GLOBALS['DiscountMaxUsesDisabled'] = 'readonly="readonly"'; $GLOBALS['DiscountExpiryDateDisabled'] = 'readonly="readonly"'; require_once(ISC_BASE_PATH.'/lib/api/discount.api.php'); $discountAPI = new API_DISCOUNT(); $discountId = (int) $_GET['discountId']; if ($discountAPI->DiscountExists($discountId)) { $discount = $this->GetDiscountData($discountId); $freeShippingMessageLocations = unserialize($discount['free_shipping_message_location']); $GLOBALS['DiscountId'] = $discountId; $GLOBALS['DiscountName'] = isc_html_escape($discount['discountname']); $module = explode('_',$discount['discountruletype']); if (isset($module[1])) { GetModuleById('rule', $ruleModule, $module[1]); if(!is_object($ruleModule)) { // Something really bad went wrong >_< exit; } } else { die('Can\'t find the module'); } $cd = unserialize($discount['configdata']); if (!empty($cd)) { foreach ($cd as $var => $data) { if (isc_substr($var,0,5) == "varn_") { $data = FormatPrice($data, false, false); } $GLOBALS[$var] = $data; } } $ruleModule->initialize($discount); $ruleModule->initializeAdmin(); $GLOBALS['RuleList'] = ''; $GLOBALS['Vendor'] = '0'; if(gzte11(ISC_HUGEPRINT)) { $GLOBALS['Vendor'] = 1; } foreach ($rules as $rule) { $rulesSorted[$rule['object']->getRuleType()][] = $rule; } $first = true; $GLOBALS['CurrentRule'] = 'null'; foreach ($rulesSorted as $type => $ruleType) { if ($first) { $GLOBALS['RuleList'] .= '<h4 style="margin-top:5px; margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>'; } else { $GLOBALS['RuleList'] .= '<h4 style="margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>'; } $first = false; foreach ($ruleType as $rule) { $GLOBALS['RuleList'] .= '<label><input type="radio" class="discountRadio" onClick="UpdateModule(this.id,'.(int)$rule['object']->vendorSupport().')" name="RuleType" value="'.$rule['id'].'" '; if ($rule['id'] == $discount['discountruletype']) { $GLOBALS['RuleList'] .= ' checked="checked" '; $GLOBALS['CurrentRule'] = "'".$rule['id']."'"; } $GLOBALS['RuleList'] .= 'id="'.$rule['id'].'"> '; if (!(int)$rule['object']->vendorSupport() && $GLOBALS['Vendor'] == 1) { $GLOBALS['RuleList'] .= '<span class="aside">'.$rule['object']->getDisplayName().'</span>'; } else { $GLOBALS['RuleList'] .= '<span>'.$rule['object']->getDisplayName().'</span>'; } $GLOBALS['RuleList'] .= '</input></label><br /><div id="ruleWrapper'.$rule['id'].'" class="ruleWrapper"'; if ($rule['id'] != $discount['discountruletype']) $GLOBALS['RuleList'] .= 'style="display : none; "'; $GLOBALS['RuleList'] .= '><img src="images/nodejoin.gif" style="vertical-align: middle; float:left; padding-right : 10px;" /><span class="ruleSettings" id="ruleSettings'.$rule['id'].'">'; if ($rule['id'] == $discount['discountruletype']) $GLOBALS['RuleList'] .= $ruleModule->getTemplateClass()->render('module.'.$module[1].'.tpl'); $GLOBALS['RuleList'] .= '</span><br /></div>'; $GLOBALS['DiscountJavascriptValidation'] .= $rule['object']->getJavascriptValidation(); } } $GLOBALS['DiscountMaxUses'] = isc_html_escape($discount['discountmaxuses']); if ($discount['discountexpiry'] != 0) { $GLOBALS['DiscountExpiryDate'] = date("m/d/Y", isc_html_escape($discount['discountexpiry'])); } else { $GLOBALS['DiscountExpiryDate'] = ''; } $GLOBALS['DiscountExpiryFields'] = 'display : none'; $GLOBALS['DiscountMaxUsesDisabled'] = 'readonly="readonly"'; $GLOBALS['DiscountDisabled'] = 'readonly="readonly"'; if (!empty($GLOBALS['DiscountMaxUses']) || !empty($GLOBALS['DiscountExpiryDate'])) { $GLOBALS['DiscountExpiryCheck'] = 'checked="checked"'; $GLOBALS['DiscountExpiryFields'] = ''; } if (!empty($GLOBALS['DiscountMaxUses'])) { $GLOBALS['DiscountMaxUsesCheck'] = 'checked="checked"'; $GLOBALS['DiscountMaxUsesDisabled'] = ''; } if (!empty($GLOBALS['DiscountExpiryDate'])) { $GLOBALS['DiscountExpiryDateCheck'] = 'checked="checked"'; $GLOBALS['DiscountExpiryDateDisabled'] = ''; } $GLOBALS['DiscountEnabled'] = isc_html_escape($discount['discountenabled']); if (empty($GLOBALS['DiscountEnabled'])) { $GLOBALS['DiscountEnabledCheck'] = ''; } $GLOBALS['DiscountCurrentUses'] = isc_html_escape($discount['discountcurrentuses']); $GLOBALS['MaxUses'] = (int) $discount['discountmaxuses']; if($GLOBALS['MaxUses'] > 0) { $GLOBALS['MaxUsesChecked'] = 'checked="checked"'; } else { $GLOBALS['DiscountMaxUses'] = 1; $GLOBALS['MaxUsesHide'] = 'none'; } $this->template->assign('freeShippingMessage', $discount['free_shipping_message']); $this->template->assign('freeShippingMessageLocations', $freeShippingMessageLocations); $this->template->display('discount.form.tpl'); } else { // The discount doesn't exist if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Discounts)) { $this->ManageDiscounts(GetLang('DiscountDoesntExist'), MSG_ERROR); } else { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } } }
private function SaveUpdatedAddonSettings() { // Delete existing module configuration $GLOBALS['ISC_CLASS_DB']->DeleteQuery('module_vars', "WHERE modulename LIKE 'addon\\_%'"); $enabledStack = array(); $messages = array(); // Can the selected addons be enabled? if (!isset($_POST['addonpackages']) || !is_array($_POST['addonpackages'])) { $_POST['addonpackages'] = array(); } foreach ($_POST['addonpackages'] as $package) { $id = explode('_', $package, 2); GetAddonsModule($module, $id[1]); if (is_object($module)) { // Is this addon supported on this server? if ($module->IsSupported() == false) { $errors = $module->GetErrors(); foreach ($errors as $error) { FlashMessage($error, MSG_ERROR); } continue; } // Otherwise, this addon is fine, so add it to the stack of enabled $enabledStack[] = 'addon_' . $id[1]; } } $addonpackages = implode(",", $enabledStack); // Push everything to globals and save $GLOBALS['ISC_NEW_CFG']['AddonModules'] = $addonpackages; $messages = array(); if ($this->CommitSettings($messages)) { // Now get all addon variables (they are in an array from $_POST) foreach ($enabledStack as $module_id) { $vars = array(); if (isset($_POST[$module_id])) { $vars = $_POST[$module_id]; } GetModuleById('addon', $module, $module_id); $module->SaveModuleSettings($vars); } $tab = 0; if (isset($_POST['currentTab'])) { $tab = (int) $_POST['currentTab']; } if ($GLOBALS['ISC_CLASS_DB']->Error() == "") { // Log this action $GLOBALS['ISC_CLASS_LOG']->LogAdminAction(); // Redirect them so that any new modules appear in the menu straight away $success = true; $message = GetLang('AddonSettingsSavedSuccessfully'); } else { $success = false; $message = GetLang('AddonSettingsNotSaved'); } } else { $success = false; $message = GetLang('AddonSettingsNotSaved'); } if ($success == true) { $msgType = MSG_SUCCESS; } else { $msgType = MSG_ERROR; } // Rebuild the cache of the addon module variables $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateAddonModuleVars(); FlashMessage($message, $msgType, 'index.php?ToDo=viewAddonSettings'); }
public function setPanelSettings() { if (!isset($GLOBALS['OrderId']) || !isId($GLOBALS['OrderId'])) { $this->DontDisplay = true; return; } $orderId = $GLOBALS['OrderId']; // Fetch the shipments for the order (not bothering to select address details here since we're viewing in the context of the order where addresses should already show) $shipments = array(); $query = " SELECT shipmentid, shipdate, shiptrackno, shipping_module, shipmethod, shipcomments, shipshipcountryid FROM [|PREFIX|]shipments WHERE shiporderid = " . $orderId . " ORDER BY shipdate, shipmentid "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($shipment = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $shipments[] = $shipment; } if (empty($shipments)) { $this->DontDisplay = true; return; } $GLOBALS['LNG_OrderShipments'] = GetLang('ShipmentsForOrder', array( 'order' => $orderId, )); $GLOBALS['SNIPPETS']['AccountOrderShipmentRow'] = ''; foreach ($shipments as $shipment) { GetModuleById('shipping', /** @var ISC_SHIPPING */$module, $shipment['shipping_module']); $GLOBALS['DateShipped'] = isc_date(GetConfig('DisplayDateFormat'), $shipment['shipdate']); if ($module) { $GLOBALS['ShippingProvider'] = $module->GetName(); $module->SetDestinationCountry($shipment['shipshipcountryid']); } else { $GLOBALS['ShippingProvider'] = $shipment['shipping_module']; } $GLOBALS['ShippingMethod'] = $shipment['shipmethod']; if (empty($GLOBALS['ShippingMethod']) || $GLOBALS['ShippingMethod'] == $GLOBALS['ShippingProvider']) { $GLOBALS['HideShippingMethod'] = 'display:none'; } else { $GLOBALS['HideShippingMethod'] = ''; } $GLOBALS['TrackingLink'] = isc_html_escape($shipment['shiptrackno']); if ($module) { $link = $module->GetTrackingLink($shipment['shiptrackno']); if ($link) { $GLOBALS['TrackingLink'] = '<a href="' . isc_html_escape($link) . '" target="_blank">' . $GLOBALS['TrackingLink'] . '</a>'; } } $GLOBALS['SNIPPETS']['AccountOrderShipmentRow'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('AccountOrderShipmentRow'); } }
private function DelayedCaptureAction() { if(!isset($_REQUEST['orderid'])) { exit; } $orderId = $_REQUEST['orderid']; $order = GetOrder($_REQUEST['orderid']); if(!isset($order['orderid'])) { exit; } $message = ''; $provider = null; $paymentStatus = 2; $msgStatus = MSG_ERROR; $transactionId = trim($order['ordpayproviderid']); if($transactionId == '') { $message = GetLang('OrderTranscationIDNotFound'); } elseif(!GetModuleById('checkout', $provider, $order['orderpaymentmodule'])) { $message = GetLang('PaymentMethodNotExist'); } elseif(!$provider->IsEnabled()) { $message = GetLang('PaymentProviderIsDisabled'); } elseif(!method_exists($provider, "DelayedCapture")) { $message = GetLang('DelayedCaptureNotAvailable'); } else { //still here, perform a delay capture if($provider->DelayedCapture($order, $message, $order['total_inc_tax'])) { $paymentStatus = 1; $msgStatus = MSG_SUCCESS; //update order status if($order['ordisdigital'] == 0 && ($order['ordtotalqty']-$order['ordtotalshipped']) > 0) { $orderStatus = ORDER_STATUS_AWAITING_SHIPMENT; } else { $orderStatus = ORDER_STATUS_COMPLETED; } UpdateOrderStatus($order['orderid'], $orderStatus, true); } } FlashMessage($message, $msgStatus); $tags[] = $this->MakeXMLTag('status', $paymentStatus); $tags[] = $this->MakeXMLTag('message', $message, true); $this->SendXMLHeader(); $this->SendXMLResponse($tags); exit; }
/** * Show a list of orders and the ability to download the product if it's a digital download */ private function OrderStatus() { $GLOBALS['SNIPPETS']['AccountOrderStatus'] = ""; $result = false; $this->GetCustomerOrders($result, false, true); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $order = $row; $GLOBALS['OrderDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['orddate']); $GLOBALS['OrderId'] = $row['orderid']; $GLOBALS['OrderTotal'] = CurrencyConvertFormatPrice($row['total_inc_tax'], $row['ordcurrencyid'], $row['ordcurrencyexchangerate'], true); $GLOBALS['OrderStatus'] = $row['ordstatustext']; $GLOBALS['TrackURL'] = ""; $GLOBALS['HidePaymentInstructions'] = "none"; $GLOBALS['OrderInstructions'] = ""; // Is the order status "awaiting payment"? If so show the payment instructions if ($row['ordstatus'] == ORDER_STATUS_AWAITING_PAYMENT) { $checkout_object = false; if (GetModuleById('checkout', $checkout_object, $row['orderpaymentmodule']) && $checkout_object->getpaymenttype("text") == "PAYMENT_PROVIDER_OFFLINE") { $GLOBALS['HidePaymentInstructions'] = ""; if (method_exists($checkout_object, 'GetOfflinePaymentMessage')) { // set the order data so any variables that are used in the GetOfflinePaymentMessage function are set correctly $paymentData = array( 'orders' => array($row['orderid'] => $row) ); $checkout_object->SetOrderData($paymentData); $GLOBALS['OrderInstructions'] = $checkout_object->GetOfflinePaymentMessage(); } else { $GLOBALS['OrderInstructions'] = nl2br(GetModuleVariable($row['orderpaymentmodule'], "helptext")); } } } // Get a list of products in the order $prod_result = false; $products = $this->GetProductsInOrder($row['orderid'], $prod_result); $GLOBALS['AccountOrderItemList'] = ''; while ($prod_row = $GLOBALS['ISC_CLASS_DB']->Fetch($prod_result)) { $GLOBALS['ItemName'] = isc_html_escape($prod_row['ordprodname']); $GLOBALS['ItemQty'] = $prod_row['ordprodqty']; // Is it a downloadable item? if ($prod_row['ordprodtype'] == "digital" && OrderIsComplete($row['ordstatus'])) { $GLOBALS['DownloadItemEncrypted'] = $this->EncryptDownloadKey($prod_row['orderprodid'], $prod_row['ordprodid'], $row['orderid'], $row['ordtoken']); $GLOBALS['DownloadLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemDownloadLink"); } else { $GLOBALS['DownloadLink'] = ""; } $GLOBALS['Refunded'] = ''; if ($prod_row['ordprodrefunded'] > 0) { if ($prod_row['ordprodrefunded'] == $prod_row['ordprodqty']) { $GLOBALS['StrikeStart'] = "<s>"; $GLOBALS['StrikeEnd'] = "</s>"; $GLOBALS['Refunded'] = '<span class="Refunded">'.GetLang('OrderProductRefunded').'</span>'; } else { $GLOBALS['Refunded'] = '<span class="Refunded">'.sprintf(GetLang('OrderProductsRefundedX'), $prod_row['ordprodrefunded']).'</span>'; } } // Were there one or more options selected? $GLOBALS['ProductOptions'] = ''; if($prod_row['ordprodoptions'] != '') { $options = @unserialize($prod_row['ordprodoptions']); if(!empty($options)) { $GLOBALS['ProductOptions'] = "<br /><small>("; $comma = ''; foreach($options as $name => $value) { $GLOBALS['ProductOptions'] .= $comma.isc_html_escape($name).": ".isc_html_escape($value); $comma = ', '; } $GLOBALS['ProductOptions'] .= ")</small>"; } } $GLOBALS['HideExpectedReleaseDate'] = 'display:none;'; $GLOBALS['ExpectedReleaseDate'] = ''; if ($prod_row['prodpreorder']) { if ($prod_row['prodreleasedate']) { $message = $prod_row['prodpreordermessage']; if (!$message) { $message = GetConfig('DefaultPreOrderMessage'); } $GLOBALS['ExpectedReleaseDate'] = '(' . str_replace('%%DATE%%', isc_date(GetConfig('DisplayDateFormat'), $prod_row['prodreleasedate']), $message) . ')'; } else { $GLOBALS['ExpectedReleaseDate'] = '(' . GetLang('PreOrderProduct') . ')'; } $GLOBALS['HideExpectedReleaseDate'] = ''; } $GLOBALS['AccountOrderItemList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemList"); } $GLOBALS['SNIPPETS']['AccountOrderStatus'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderStatusItem"); } if($GLOBALS['SNIPPETS']['AccountOrderStatus']) { $GLOBALS['HideNoOrderStatusMessage'] = "none"; } else { $GLOBALS['HideOrderStatusList'] = "none"; } $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(sprintf("%s - %s", GetConfig('StoreName'), GetLang('OrderStatus'))); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("account_orderstatus"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); }
/** * Update the exchange rate of a currency * * Method will automatically update the exchange rate currency corresponding to the currency id $currencyid * * @access public * @return null */ public function UpdateExchangeRate() { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('settings'); $currModules = explode(",", GetConfig("CurrencyMethods")); if (!isset($_REQUEST['cid']) || !isset($_REQUEST['currencyid'])) { print "{'id': " . (int) $_REQUEST['currencyid'] . ", 'status':1, 'newRate':null, 'seq': " . (int) $_REQUEST['seq'] . "};"; exit; } $module = null; GetModuleById("currency", $module, $_REQUEST['cid']); if ($module === null || $module === false) { print "{'id': " . (int) $_REQUEST['currencyid'] . ", 'status':1, 'newRate':null, 'seq': " . (int) $_REQUEST['seq'] . "};"; exit; } $query = "SELECT *\n\t\t\tFROM [|PREFIX|]currencies\n\t\t\tWHERE currencyid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['currencyid']) . "'"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if ($row == false) { print "{'id': " . (int) $_REQUEST['currencyid'] . ", 'status':1, 'newRate':null, 'seq': " . (int) $_REQUEST['seq'] . "};"; exit; } $rate = $module->GetExchangeRateUsingBase($row['currencycode']); if ($rate === false) { $messages = $module->GetErrors(); $message = $messages[0]; if ($message == GetLang("CurrencyProviderRequestUnavailable")) { print "{'id': " . (int) $_REQUEST['currencyid'] . ", 'status':1, 'newRate':null, 'seq': " . (int) $_REQUEST['seq'] . "};"; } else { print "{'id': " . (int) $_REQUEST['currencyid'] . ", 'status':2, 'newRate':null, 'seq': " . (int) $_REQUEST['seq'] . "};"; } } else { $data = array(); $data['currencyexchangerate'] = $rate; $data["currencylastupdated"] = time(); $GLOBALS['ISC_CLASS_DB']->UpdateQuery("currencies", $data, "currencyid='" . $GLOBALS['ISC_CLASS_DB']->Quote((int) $_REQUEST['currencyid']) . "'"); $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateCurrencies(); print "{'id': " . (int) $_REQUEST['currencyid'] . ", 'status':0, 'newRate':'" . (string) FormatPrice($rate, false, true, false, $row, false) . "', 'seq': " . (int) $_REQUEST['seq'] . "};"; } exit; }
/** * Check to see if the customer, customer group, product or order is in a module spool list * * Method will check to see if the $nodeID of type $type currently exists in one of the module spool lists. It is up to the developer to * also check to see if these customer/products will be imported for orders that are in the import list * * @access public * @param int $nodeId The node ID to check for (customerid, productid, etc) * @param string $type The type of $nodeId this is ('customer', 'customergroup', 'product' or 'order') * @return array An array of all the module IDs that this node is currently in the list for. If this node is not * in a list then the array will be empty. FALSE if an error occured */ public function isNodeInSpool($nodeId, $type) { if (!isId($nodeId) || $type == '') { return false; } $modules = explode(",", GetConfig('AccountingMethods')); $selected = array(); if (!is_array($modules)) { return false; } $objects = array(); foreach ($modules as $module) { $obj =& $objects[]; if (substr($module, 0, 11) !== $this->type . '_' || !GetModuleById($this->type, $obj, $module)) { return false; } } foreach ($objects as $object) { if ($object->isNodeInSpool($nodeId, $type)) { $selected[$object->getid()] = $object->_name; } } return $selected; }
/** * Check which order notification methods are enabled and trigger each one */ function SendOrderNotifications($pendingOrderToken) { $orders = LoadPendingOrdersByToken($pendingOrderToken); // Firstly, are there any order notification methods that are enabled? $notifications = GetEnabledNotificationModules(); if(!is_array($notifications) || empty($notifications)) { return false; } foreach($notifications as $notifier) { // Instantiate the notification object by reference if(!GetModuleById('notification', $notify_object, $notifier['object']->GetId())) { continue; } // Set the required variables foreach($orders['orders'] as $order) { $notify_object->SetOrderId($order['orderid']); $notify_object->SetOrderTotal($order['total_inc_tax']); $notify_object->SetOrderNumItems($order['ordtotalqty']); $notify_object->SetOrderPaymentMethod($order['orderpaymentmethod']); $response = $notify_object->SendNotification(); if(isset($response['outcome']) && $response['outcome'] == "fail") { $GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('notification', $notify_object->_name), GetLang('NotificationOrderError'), $response['message']); } else if(isset($response['outcome']) && $response['outcome'] == "success") { $GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('notification', $notify_object->_name), GetLang('NotificationOrderSuccess'), $response['message']); } } } }