示例#1
0
文件: Quantum.php 项目: kingsj/core
 protected function setUpCheckoutViaHTTPS($value)
 {
     \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->createOption(array('category' => 'Security', 'name' => 'customer_security', 'value' => $value ? 'Y' : 'N'));
     // Reset cache - DO NOT CHANGE!
     \XLite\Core\Database::getCacheDriver()->deleteAll();
     \XLite\Core\Config::getInstance()->Security->customer_security;
 }
 /**
  * Switch state
  *
  * @return void
  */
 protected function doActionSwitch()
 {
     $value = !\XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
     \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'XC\\ThemeTweaker', 'name' => 'edit_mode', 'value' => $value));
     \XLite\Core\TopMessage::addInfo($value ? 'Webmaster mode is enabled' : 'Webmaster mode is disabled');
     $this->setReturnURL($this->buildURL('theme_tweaker_templates'));
 }
示例#3
0
 /**
  * Set return URL
  *
  * @param string $url URL to set
  *
  * @return void
  */
 public function setReturnURL($url)
 {
     if (\XLite\Module\CDev\Paypal\Main::isExpressCheckoutEnabled() && \XLite\Module\CDev\Paypal\Main::isInContextCheckoutAvailable() && \XLite\Core\Request::getInstance()->cancelUrl) {
         $url = $this->getShopURL(\XLite\Core\Request::getInstance()->cancelUrl, \XLite\Core\Config::getInstance()->Security->customer_security);
     }
     parent::setReturnURL($url);
 }
示例#4
0
 /**
  * Return params list to use for search
  *
  * @return \XLite\Core\CommonCell
  */
 protected function getSearchCondition()
 {
     $result = parent::getSearchCondition();
     $carrierParam = \XLite\Model\Repo\Shipping\Method::P_CARRIER;
     if (!empty($result->{$carrierParam}) && 'auctionInc' == $result->{$carrierParam} && \XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
         $result->{$carrierParam} = '';
     }
     if (!empty($result->{$carrierParam}) && 'auctionInc' == $result->{$carrierParam}) {
         $filter = array();
         $filter[] = 'FF%';
         $filter[] = 'NOCHG%';
         // UPS Next Day Air Early AM is a commercial only service.
         // Rather than ask you to implement differential code based
         // on the module Residential setting, lets just eliminate
         // this service method for the XS trial.
         $filter[] = 'UPS_UPSNDE';
         // The two “Saturday” services have special handling in AuctionInc.
         // It would be best just to eliminate these two service methods as well for the XS trial
         $filter[] = 'FEDEX_FDXPOS';
         $filter[] = 'UPS_UPSNDAS';
         foreach (array('DHL', 'FEDEX', 'UPS', 'USPS') as $carrier) {
             $entryPoint = \XLite\Core\Config::getInstance()->XC->AuctionInc->{'entryPoint' . $carrier};
             if (\XLite\Module\XC\AuctionInc\View\FormField\Select\AEntryPoint::STATE_DISABLED == $entryPoint) {
                 $filter[] = $carrier . '%';
             }
         }
         $result->{\XLite\Model\Repo\Shipping\Method::P_AUCTION_INC_FILTER} = $filter;
     }
     return $result;
 }
示例#5
0
 /**
  * Do action update languages
  *
  * @return void
  */
 protected function doActionUpdate()
 {
     // Update 'enabled' and 'added' properties editable in the item list
     $list = new \XLite\View\ItemsList\Model\Translation\Languages();
     $list->processQuick();
     // Update default languages settings
     $defaultCustomerLanguage = \XLite\Core\Request::getInstance()->defaultCustomer;
     $defaultAdminLanguage = \XLite\Core\Request::getInstance()->defaultAdmin;
     if ($defaultCustomerLanguage != \XLite\Core\Config::getInstance()->General->default_language) {
         $lng = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findOneBy(array('code' => $defaultCustomerLanguage));
         if ($lng && $lng->getEnabled()) {
             \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('name' => 'default_language', 'category' => 'General', 'value' => $defaultCustomerLanguage));
         } else {
             \XLite\Core\TopMessage::addWarning('Disabled language cannot be default.');
         }
     }
     if ($defaultAdminLanguage != \XLite\Core\Config::getInstance()->General->default_admin_language) {
         $lng = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findOneBy(array('code' => $defaultAdminLanguage));
         if ($lng && $lng->getEnabled()) {
             \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('name' => 'default_admin_language', 'category' => 'General', 'value' => $defaultAdminLanguage));
         } else {
             \XLite\Core\TopMessage::addWarning('Disabled language cannot be default.');
         }
     }
 }
示例#6
0
 /**
  * Save requested product ID in the recently viewed statistics
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Config::getInstance()->CDev->ProductAdvisor->rv_enabled) {
         \XLite\Module\CDev\ProductAdvisor\Main::saveProductIds($this->getProductId());
     }
     return parent::handleRequest();
 }
示例#7
0
 /**
  * Get publisher id
  *
  * @param string $email Email
  *
  * @return string
  */
 public function getPublisherId($email)
 {
     $publisherId = null;
     $sellerName = \XLite\Core\Config::getInstance()->Company->company_name;
     $data = array('sellerName' => $sellerName, 'emailAddress' => $email, 'bnCode' => static::BN_CODE);
     $request = new \XLite\Core\HTTP\Request(static::END_POINT);
     if (function_exists('curl_version')) {
         $request->setAdditionalOption(\CURLOPT_SSLVERSION, 1);
         $curlVersion = curl_version();
         if ($curlVersion && $curlVersion['ssl_version'] && 0 !== strpos($curlVersion['ssl_version'], 'NSS')) {
             $request->setAdditionalOption(\CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
         }
     }
     $request->body = json_encode($data);
     $request->verb = 'POST';
     $timeStamp = LC_START_TIME . '000';
     $authorization = 'FPA ' . static::CLIENT_KEY;
     $authorization .= ':' . sha1(static::SHARED_SECRET . $timeStamp);
     $authorization .= ':' . $timeStamp;
     $request->setHeader('Authorization', $authorization);
     $request->setHeader('Accept', 'application/json');
     $request->setHeader('Content-Type', 'application/json');
     $response = $request->sendRequest();
     \XLite\Module\CDev\Paypal\Main::addLog('getPublisherId', $response->body);
     if (201 == $response->code) {
         $responseData = json_decode($response->body, true);
         if ($responseData && isset($responseData['publisherId'])) {
             $publisherId = $responseData['publisherId'];
         }
     }
     return $publisherId;
 }
示例#8
0
 /**
  * Send message
  *
  * @return boolean
  */
 public function send()
 {
     if (\XLite\Core\Config::getInstance()->XC->WebmasterKit->logMail) {
         \XLite\Logger::getInstance()->logCustom('mail-messages', 'From: ' . $this->mail->From . PHP_EOL . 'To: ' . $this->get('to') . PHP_EOL . 'Subject: ' . $this->mail->Subject . PHP_EOL . $this->mail->Body . PHP_EOL . PHP_EOL);
     }
     return parent::send();
 }
示例#9
0
 /**
  * Check - cache is enabled or not
  *
  * @return boolean
  */
 public function isEnabled()
 {
     if (!isset($this->enableCache)) {
         $this->enableCache = \XLite\Core\Config::getInstance()->Performance->use_view_cache;
     }
     return $this->enableCache;
 }
示例#10
0
 /**
  * Handles the request.
  * Create installation timestamp if empty (at first software launch)
  *
  * @return string
  */
 public function handleRequest()
 {
     if (empty(\XLite\Core\Config::getInstance()->Version->timestamp)) {
         \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'Version', 'name' => 'timestamp', 'value' => time()));
     }
     parent::handleRequest();
 }
示例#11
0
 /**
  * Check - cache is enabled or not
  *
  * @return boolean
  */
 public function isEnabled()
 {
     if (!isset($this->editMode)) {
         $this->editMode = \XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
     }
     return parent::isEnabled() && !$this->editMode;
 }
示例#12
0
 /**
  * Get _gaq options list
  *
  * @return array
  */
 protected function getGaqOptions()
 {
     $list = array(sprintf('\'_setAccount\', \'%s\'', \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_account));
     if (2 == \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_tracking_type) {
         $list[] = '\'_setDomainName\', \'.\' + self.location.host.replace(/^[^\\.]+\\./, \'\')';
     } elseif (3 == \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_tracking_type) {
         $list[] = '\'_setDomainName\', \'none\'';
         $list[] = '\'_setAllowLinker\', true';
     }
     $list[] = '\'_trackPageview\'';
     $controller = \XLite::getController();
     if ($this->isEcommercePartEnabled() && $controller instanceof \XLite\Controller\Customer\CheckoutSuccess) {
         $orders = \XLite\Core\Session::getInstance()->gaProcessedOrders;
         if (!is_array($orders)) {
             $orders = array();
         }
         $order = $this->getOrder();
         if ($order->getProfile() && !in_array($order->getOrderId(), $orders)) {
             $bAddress = $order->getProfile()->getBillingAddress();
             $city = $bAddress ? $bAddress->getCity() : '';
             $state = $bAddress && $bAddress->getState() ? $bAddress->getState()->getState() : '';
             $country = $bAddress && $bAddress->getCountry() ? $bAddress->getCountry()->getCountry() : '';
             $tax = $order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_TAX);
             $shipping = $order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_SHIPPING);
             $list[] = '\'_addTrans\', ' . '\'' . $order->getOrderNumber() . '\', ' . '\'' . $this->escapeJavascript(\XLite\Core\Config::getInstance()->Company->company_name) . '\', ' . '\'' . $order->getTotal() . '\', ' . '\'' . $tax . '\', ' . '\'' . $shipping . '\', ' . '\'' . $this->escapeJavascript($city) . '\', ' . '\'' . $this->escapeJavascript($state) . '\', ' . '\'' . $this->escapeJavascript($country) . '\'';
             foreach ($order->getItems() as $item) {
                 $list[] = '\'_addItem\', ' . '\'' . $order->getOrderNumber() . '\', ' . '\'' . $this->escapeJavascript($item->getSku()) . '\', ' . '\'' . $this->escapeJavascript($item->getName()) . '\', ' . '\'\', ' . '\'' . $item->getPrice() . '\', ' . '\'' . $item->getAmount() . '\'';
             }
             $list[] = '\'_trackTrans\'';
             $orders[] = $order->getOrderId();
             \XLite\Core\Session::getInstance()->gaProcessedOrders = $orders;
         }
     }
     return $list;
 }
示例#13
0
文件: ContactUs.php 项目: kingsj/core
 /**
  * Define menu items
  *
  * @return array
  */
 protected function defineItems()
 {
     $menu = parent::defineItems();
     if (\XLite\Core\Config::getInstance()->CDev->ContactUs->enable_form) {
         $menu[] = array('target' => 'contact_us', 'url' => $this->buildURL('contact_us'), 'label' => static::t('Contact us'));
     }
     return $menu;
 }
示例#14
0
文件: Mailer.php 项目: kingsj/core
 /**
  * Send contact us message
  *
  * @param array  $data  Data
  * @param string $email Email
  *
  * @return string | null
  */
 public static function sendContactUsMessage(array $data, $email)
 {
     static::setMailInterface(\XLite::MAIL_INTERFACE);
     $data['message'] = htmlspecialchars($data['message']);
     static::register('data', $data);
     static::compose(\XLite\Core\Config::getInstance()->Company->site_administrator, $email, 'modules/CDev/ContactUs/message');
     return static::getMailer()->getLastError();
 }
 /**
  * handleRequest
  *
  * @return void
  */
 public function handleRequest()
 {
     $apiClient = ServiceApiClient::getInstance();
     $apiClient->requestSecretKey();
     Config::updateInstance();
     $secretKey = Config::getInstance()->QSL->CloudSearch->secret_key;
     $this->redirect($apiClient->getDashboardIframeUrl($secretKey));
 }
示例#16
0
 /**
  * Initialize widget (set attributes)
  *
  * @param array $params Widget params
  *
  * @return void
  */
 public function setWidgetParams(array $params)
 {
     parent::setWidgetParams($params);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_SHOW_ITEMS_PER_PAGE_SELECTOR]->setValue(false);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_ITEMS_COUNT]->setValue(\XLite\Core\Config::getInstance()->XC->Reviews->reviewsCountPerTab);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_ITEMS_PER_PAGE]->setValue(\XLite\Core\Config::getInstance()->XC->Reviews->reviewsCountPerTab);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_ONLY_PAGES]->setValue(true);
 }
示例#17
0
文件: ViewList.php 项目: kingsj/core
 /**
  * Define query builder for findClassList()
  *
  * @param string $list Class list name
  * @param string $zone Current interface name
  *
  * @return \Doctrine\ORM\QueryBuilder
  */
 protected function defineClassListQuery($list, $zone)
 {
     $qb = parent::defineClassListQuery($list, $zone);
     if (\XLite\Core\Config::getInstance()->CDev->Catalog->disable_checkout) {
         $qb->andWhere($qb->expr()->notIn('v.tpl', $this->templatesToHide));
     }
     return $qb;
 }
示例#18
0
 /**
  * Get JS files
  *
  * @return array
  */
 public function getJSFiles()
 {
     $list = parent::getJSFiles();
     if (!\XLite\Core\Config::getInstance()->Security->customer_security || $this->isHTTPS()) {
         $list[] = 'js/login.js';
     }
     return $list;
 }
示例#19
0
文件: ACustomer.php 项目: kingsj/core
 /**
  * Register JS files
  *
  * @return array
  */
 public function getJSFiles()
 {
     $list = parent::getJSFiles();
     if (\XLite\Core\Config::getInstance()->CDev->Catalog->disable_checkout) {
         $list[] = 'modules/CDev/Catalog/disable_dragging.js';
     }
     return $list;
 }
示例#20
0
文件: Facebook.php 项目: kingsj/core
 /**
  * Get SDK URL hash query
  *
  * @return array
  */
 protected function getQuery()
 {
     $query = array('xfbml' => 1);
     if (\XLite\Core\Config::getInstance()->CDev->GoSocial->fb_app_id) {
         $query['appId'] = \XLite\Core\Config::getInstance()->CDev->GoSocial->fb_app_id;
     }
     return $query;
 }
示例#21
0
 /**
  * Ask CloudSearch server to send us a new secret key
  *
  * @return void
  */
 public function requestSecretKey()
 {
     $apiKey = Config::getInstance()->QSL->CloudSearch->api_key;
     $requestUrl = 'http://' . static::CLOUD_SEARCH_DOMAIN . static::CLOUD_SEARCH_REQUEST_SECRET_KEY_URL;
     $request = new Request($requestUrl);
     $request->body = array('apiKey' => $apiKey);
     $request->sendRequest();
 }
示例#22
0
 /**
  * Register CSS files
  *
  * @return array
  */
 public function getCSSFiles()
 {
     $list = parent::getCSSFiles();
     $dir = 'modules/XC/Reviews/ColorSchemes/' . \XLite\Core\Config::getInstance()->Layout->skin_name;
     $list[] = $dir . '/form_field/input/rating/rating.css';
     $list[] = $dir . '/average_rating/style.css';
     return $list;
 }
示例#23
0
 /**
  * Define tabs
  *
  * @return array
  */
 protected function defineTabs()
 {
     $list = parent::defineTabs();
     if (\XLite\Core\Config::getInstance()->CDev->GoSocial->fb_comments_use && \XLite\Core\Config::getInstance()->CDev->GoSocial->fb_app_id) {
         $list['Comments'] = array('list' => 'product.details.page.tab.comments');
     }
     return $list;
 }
示例#24
0
 /**
  * Return list of the "Button" widgets
  *
  * @return array
  */
 protected function getFormButtons()
 {
     $result = parent::getFormButtons();
     if (('cache_management' === $this->getTarget() || 'module' === $this->getTarget() && $this->getModule() && 'XC\\ProductFilter' == $this->getModule()->getActualName()) && \XLite\Core\Config::getInstance()->XC->ProductFilter->attributes_filter_by_category && \XLite\Core\Config::getInstance()->XC->ProductFilter->attributes_filter_cache_mode) {
         $result['remove_product_filter_cache'] = new \XLite\View\Button\Tooltip(array(\XLite\View\Button\AButton::PARAM_LABEL => 'Remove product filter cache', \XLite\View\Button\Regular::PARAM_ACTION => 'remove_product_filter_cache', \XLite\View\Button\Tooltip::PARAM_SEPARATE_TOOLTIP => static::t('Remove product filter cache tooltip'), \XLite\View\Button\AButton::PARAM_STYLE => 'action always-enabled'));
     }
     return $result;
 }
示例#25
0
文件: Order.php 项目: kingsj/core
 /**
  * Handles the request.
  * Parses the request variables if necessary. Attempts to call the specified action function
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Config::getInstance()->CDev->Catalog->disable_checkout) {
         $this->redirect($this->buildUrl('profile'));
     } else {
         parent::handleRequest();
     }
 }
示例#26
0
 /**
  * Return products list: temporary disable coming-soon products to exclude them from result
  *
  * @param \XLite\Core\CommonCell $cnd       Search condition
  * @param boolean                $countOnly Return items list or only its size OPTIONAL
  *
  * @return mixed
  */
 protected function getData(\XLite\Core\CommonCell $cnd, $countOnly = false)
 {
     $oldCsEnabled = \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->cs_enabled;
     \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->cs_enabled = false;
     $result = parent::getData($cnd, $countOnly);
     \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->cs_enabled = $oldCsEnabled;
     return $result;
 }
示例#27
0
文件: States.php 项目: kingsj/core
 /**
  * init
  *
  * @return void
  */
 public function init()
 {
     if (!in_array('country_code', $this->params)) {
         $this->params[] = 'country_code';
     }
     parent::init();
     $countryCode = isset(\XLite\Core\Request::getInstance()->country_code) ? \XLite\Core\Request::getInstance()->country_code : \XLite\Core\Config::getInstance()->General->default_country;
     $this->set('country_code', $countryCode);
 }
示例#28
0
文件: Module.php 项目: kingsj/core
 /**
  * Check amazon S3 settings 
  * 
  * @return void
  */
 protected function checkAmazonS3Settings()
 {
     $config = \XLite\Core\Config::getInstance()->CDev->AmazonS3Images;
     if (!function_exists('curl_init')) {
         \XLite\Core\TopMessage::addError('This module uses PHP\'s cURL functions which are disabled on your web server');
     } elseif ($config->access_key && $config->secret_key && !\XLite\Module\CDev\AmazonS3Images\Core\S3::getInstance()->isValid()) {
         \XLite\Core\TopMessage::addWarning('Connection to Amazon S3 failed.' . ' Check whether the AWS Access key и AWS Secret key specified in the module settings are correct.');
     }
 }
示例#29
0
 /**
  * Define widget parameters
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_USE_NODE => new \XLite\Model\WidgetParam\Checkbox('Show products only for current category', \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->cs_from_current_category, true), self::PARAM_ROOT_ID => new \XLite\Model\WidgetParam\ObjectId\Category('Root category Id', 0, true, true), self::PARAM_MAX_ITEMS_TO_DISPLAY => new \XLite\Model\WidgetParam\Int('Maximum products to display', $this->getMaxCountInBlock(), true, true));
     $widgetType = \XLite\Core\Config::getInstance()->CDev->ProductAdvisor->cs_show_in_sidebar ? self::WIDGET_TYPE_SIDEBAR : self::WIDGET_TYPE_CENTER;
     $this->widgetParams[self::PARAM_WIDGET_TYPE]->setValue($widgetType);
     unset($this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]);
     unset($this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]);
 }
示例#30
0
 /**
  * Check if field is valid and (if needed) set an error message
  *
  * @param array  $data    Current section data
  * @param string $section Current section name
  *
  * @return void
  */
 protected function validateFields(array $data, $section)
 {
     parent::validateFields($data, $section);
     $orderCounterNumber = (int) \XLite\Core\Config::getInstance()->General->order_number_counter;
     $orderCounterNumberToChange = (int) \XLite\Core\Request::getInstance()->order_number_counter;
     if ($orderCounterNumberToChange < $orderCounterNumber) {
         $this->addErrorMessage(static::SECTION_PARAM_FIELDS, 'The next order number should be greater than the current one');
     }
 }