/** * Get the dialog for listing products on eBay * */ private function getListProductsDialogAction() { $productOptions = $_POST['productOptions']; // check if ebay is configured $ebay = new ISC_ADMIN_EBAY(); if (!ISC_ADMIN_EBAY::checkEbayConfig()) { $this->template->assign('message', GetLang('EbayListingStoreNotConfigured')); $this->template->display('ebay.listproducts.error.tpl'); exit; } // get the templates $query = 'SELECT id, name FROM [|PREFIX|]ebay_listing_template ORDER BY name'; $res = $this->db->Query($query); $templates = array(); while ($row = $this->db->Fetch($res)) { $templates[$row['id']] = $row['name']; } if (empty($templates)) { $this->template->assign('message', GetLang('EbayListingNoTemplates')); $this->template->display('ebay.listproducts.error.tpl'); exit; } $where = ISC_ADMIN_EBAY_LIST_PRODUCTS::getWhereFromOptions($productOptions); $productCount = ISC_ADMIN_EBAY_LIST_PRODUCTS::getProductCount($where); $this->template->assign('templates', $templates); $this->template->assign('productOptions', ISC_JSON::encode($productOptions)); $this->template->assign('productCount', $productCount); $this->template->display('ebay.listproducts.tpl'); }
/** * Update the eBay notification URL to hopefully fix pending item issue * */ public function updateEbayNotificationURL() { // is ebay enabled/configured? if (ISC_ADMIN_EBAY::checkEbayConfig()) { // lets ensure our notification URL is correct ISC_ADMIN_EBAY::resubscribeNotifications(); } return true; }
public function CommitSettings(&$messages=array()) { // If the shop path has changed normalize it and set the app path too if (isset($GLOBALS['ISC_NEW_CFG']['ShopPath']) && $GLOBALS['ISC_NEW_CFG']['ShopPath'] != GetConfig('ShopPath')) { $parsedPath = ParseShopPath($GLOBALS['ISC_NEW_CFG']['ShopPath']); $GLOBALS['ISC_NEW_CFG']['ShopPath'] = $parsedPath['shopPath']; // add an event to resubscribe to ebay notifications since the notification url will now be different if (ISC_ADMIN_EBAY::checkEbayConfig()) { Interspire_Event::bind('settings_updated', array('ISC_ADMIN_EBAY', 'resubscribeNotifications')); } } // normalize our shared ssl path if (isset($GLOBALS['ISC_NEW_CFG']['SharedSSLPath']) && trim($GLOBALS['ISC_NEW_CFG']['SharedSSLPath'])) { $ssl_path_parts = parse_url($GLOBALS['ISC_NEW_CFG']['SharedSSLPath']); if (!isset($ssl_path_parts['path'])) { $ssl_path_parts['path'] = ''; } $ssl_path_parts['path'] = rtrim($ssl_path_parts['path'], '/'); // Workout the Shop Path $GLOBALS['ISC_NEW_CFG']['SharedSSLPath'] = 'https://' . $ssl_path_parts['host']; if (isset($ssl_path_parts['port']) && $ssl_path_parts['port'] != '443') { $GLOBALS['ISC_NEW_CFG']['SharedSSLPath'] .= ':'.$ssl_path_parts['port']; } $GLOBALS['ISC_NEW_CFG']['SharedSSLPath'] .= $ssl_path_parts['path']; } // normalize our subdomain ssl path if (isset($GLOBALS['ISC_NEW_CFG']['SubdomainSSLPath']) && trim($GLOBALS['ISC_NEW_CFG']['SubdomainSSLPath'])) { $ssl_path_parts = parse_url($GLOBALS['ISC_NEW_CFG']['SubdomainSSLPath']); if (!isset($ssl_path_parts['path'])) { $ssl_path_parts['path'] = ''; } $ssl_path_parts['path'] = rtrim($ssl_path_parts['path'], '/'); // Workout the Shop Path $GLOBALS['ISC_NEW_CFG']['SubdomainSSLPath'] = 'https://' . $ssl_path_parts['host']; if (isset($ssl_path_parts['port']) && $ssl_path_parts['port'] != '443') { $GLOBALS['ISC_NEW_CFG']['SubdomainSSLPath'] .= ':'.$ssl_path_parts['port']; } $GLOBALS['ISC_NEW_CFG']['SubdomainSSLPath'] .= $ssl_path_parts['path']; } if (!isset($GLOBALS['ISC_NEW_CFG'])) { $GLOBALS['ISC_NEW_CFG'] = array(); } $directories = array( 'ImageDirectory' => 'product_images', 'DownloadDirectory' => 'product_downloads' ); foreach($directories as $directory => $default) { if(isset($GLOBALS['ISC_NEW_CFG'][$directory])) { $newDirectory = ISC_BASE_PATH.'/'.$GLOBALS['ISC_NEW_CFG'][$directory]; if(!$GLOBALS['ISC_NEW_CFG'][$directory] || !is_dir($newDirectory)) { $GLOBALS['ISC_NEW_CFG'][$directory] = $default; } } } // Wht we're doing here is we copy the current configuration in to another variable and // then load the store configuration file again. We do this to prevent any settings // that may have temporarily been modified in memory from propagating to the configuration // file. We then revert back to the in memory settings $memoryConfig = $GLOBALS['ISC_CFG']; unset($GLOBALS['ISC_CFG']); require ISC_CONFIG_FILE; $originalConfig = $GLOBALS['ISC_CFG']; $GLOBALS['ISC_CFG'] = $memoryConfig; $GLOBALS['ISC_SAVE_CFG'] = array_merge($originalConfig, $GLOBALS['ISC_NEW_CFG']); // Save the var_exported vars in the globals array temporarily for saving foreach ($this->all_vars as $var) { if (!array_key_exists($var, $GLOBALS['ISC_SAVE_CFG'])) { if(array_key_exists($var, $memoryConfig)) { $GLOBALS[$var] = var_export($memoryConfig[$var], true); } else { $GLOBALS[$var] = "null"; } } else { $GLOBALS[$var] = var_export($GLOBALS['ISC_SAVE_CFG'][$var], true); } } $config_data = $this->template->render('config.file.tpl'); $setting_string = "<" . "?php\n\n"; $setting_string .= "\t// Last Updated: ".isc_date("jS M Y @ g:i A") . "\n"; $setting_string .= $config_data; if (!defined("ISC_CONFIG_FILE") || !defined("ISC_CONFIG_BACKUP_FILE")) { die("Config sanity check failed"); } // Try to copy the current config file to a backup file if (!@copy(ISC_CONFIG_FILE, ISC_CONFIG_BACKUP_FILE)) { isc_chmod(ISC_CONFIG_BACKUP_FILE, ISC_WRITEABLE_FILE_PERM); $messages = array(GetLang('CouldntBackupConfig') => MSG_INFO); } // Try to write to the config file if (!is_writable(ISC_CONFIG_FILE)) { $this->error = GetLang('CouldntSaveConfig'); return false; } if (!($fp = @fopen(ISC_CONFIG_FILE, "wb+"))) { $this->error = GetLang('CouldntSaveConfig'); return false; } if (@fwrite($fp, $setting_string)) { fclose($fp); $prevCatListDepth = GetConfig('CategoryListDepth'); // Include the config file again to initialize the new values include(ISC_CONFIG_FILE); if (isset($GLOBALS['ISC_NEW_CFG']['CategoryListDepth']) && $GLOBALS['ISC_NEW_CFG']['CategoryListDepth'] != $prevCatListDepth) { $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateRootCategories(); } // trigger any events that should run after the settings have been saved Interspire_Event::trigger('settings_updated'); return true; } fclose($fp); $this->error = GetLang('CouldntSaveConfig'); return false; }