Example #1
0
 private function getPermissions()
 {
     $permissions = array();
     $files = array(SHOPGATE_BASE_DIR . '/config/myconfig.php', $this->config->getExportFolderPath(), $this->config->getLogFolderPath(), $this->config->getCacheFolderPath(), $this->config->getItemsCsvPath(), $this->config->getCategoriesCsvPath(), $this->config->getReviewsCsvPath(), $this->config->getAccessLogPath(), $this->config->getRequestLogPath(), $this->config->getErrorLogPath(), $this->config->getDebugLogPath(), $this->config->getRedirectKeywordCachePath(), $this->config->getRedirectSkipKeywordCachePath());
     foreach ($files as $file) {
         $permissions[] = $this->_getFileMeta($file, 1);
     }
     return $permissions;
 }
Example #2
0
 /**
  * @param ShopgateConfigInterface $config
  */
 public function setup(ShopgateConfigInterface $config)
 {
     // needs to check if an old config is present without any access token
     if ($config->getCustomerNumber() && $config->getShopNumber() && $config->getApiKey() && !$config->getOauthAccessToken()) {
         // needs to load the non-oauth-url since the new access token needs to be generated using the classic shopgate merchant api authentication
         $apiUrls = $config->getApiUrls();
         $apiUrl = $config->getServer() == 'custom' ? str_replace('/api/merchant2', '/api/merchant', $config->getApiUrl()) : $apiUrls[$config->getServer()][ShopgateConfigInterface::SHOPGATE_AUTH_SERVICE_CLASS_NAME_SHOPGATE];
         $smaAuthServiceShopgate = new ShopgateAuthenticationServiceShopgate($config->getCustomerNumber(), $config->getApiKey());
         $smaAuthServiceShopgate->setup($config);
         $classicSma = new ShopgateMerchantApi($smaAuthServiceShopgate, $config->getShopNumber(), $apiUrl);
         // the "get_shop_info" returns an oauth access token
         $shopInfo = $classicSma->getShopInfo()->getData();
         // set newly generated access token
         $this->accessToken = $shopInfo['oauth_access_token'];
         // create a new settings array
         $shopgateSettingsNew = array($field = 'oauth_access_token' => $shopInfo[$field], $field = 'customer_number' => $shopInfo[$field], $field = 'shop_number' => $shopInfo[$field], $field = 'apikey' => $shopInfo[$field], $field = 'alias' => $shopInfo[$field], $field = 'cname' => $shopInfo[$field]);
         // save all shop config data to plugin-config using the configs save method
         $config->load($shopgateSettingsNew);
         $config->save(array_keys($shopgateSettingsNew), true);
     } elseif (!$this->accessToken && $config->getOauthAccessToken()) {
         // this would mean the data was somehow not in sync (should no be happening by default)
         $this->accessToken = $config->getOauthAccessToken();
     } else {
         // skip this since the connection is fully functional or there has not been made any connection at all, yet
         // -> missing data (except the oauth access token) is treated as "no valid connection available"
         // -> in either case there is nothing to do here
     }
 }
Example #3
0
 /**
  * Callback function for the Shopgate Plugin API ping action.
  * Override this to append additional information about shop system to the response of the ping action.
  *
  * @return mixed[] An array with additional information.
  */
 public function createShopInfo()
 {
     $shopInfo = array('category_count' => 0, 'item_count' => 0);
     if ($this->config->getEnableGetReviewsCsv()) {
         $shopInfo['review_count'] = 0;
     }
     if ($this->config->getEnableGetMediaCsv()) {
         $shopInfo['media_count'] = array();
     }
     return $shopInfo;
 }
Example #4
0
 /**
  * Takes care of buffer and file handlers and calls ShopgatePlugin::createPagesCsv().
  *
  * @throws ShopgateLibraryException
  */
 public final function startGetPagesCsv()
 {
     $this->buffer->setFile($this->config->getReviewsCsvPath());
     $this->createPagesCsv();
     $this->buffer->finish();
 }