/** * The constructor. */ public function __construct() { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('ebay'); parent::__construct(); GetLib('class.json'); }
public function __construct() { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('settings'); $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('settings.emailintegration'); GetLib('class.json'); parent::__construct(); }
public function HandleToDo($todo) { if (!$this->auth->HasPermission(AUTH_Manage_Variations)) { $this->engine->DoHomePage(GetLang('Unauthorized'), MSG_ERROR); } GetLib('class.json'); // todo method name $todo = $todo . 'Action'; $render = null; if (method_exists($this, $todo)) { $render = $this->$todo(); } // process template routing if ($render && is_string($render)) { if ($this->renderLayout) { $this->engine->printHeader(); } $this->template->display($render); if ($this->renderLayout) { $this->engine->printFooter(); } } }
public function HandleToDo() { /** * Convert the input character set from the hard coded UTF-8 to their * selected character set */ convertRequestInput(); GetLib('class.json'); $what = isc_strtolower(@$_REQUEST['w']); switch ($what) { case "loadlinker": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->IsLoggedIn()) { $this->loadLinker(); } exit; break; case "search": if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->IsLoggedIn()) { $this->search(); } exit; break; } }
/** * Does internal settings page routing. Something like this should be built in. * * @param string $todo The "action" for this "controller" * @return void */ public function HandleToDo($todo) { GetLib('class.json'); // todo method name $todo = $todo . 'Action'; // the page to render is returned as a string from the action $render = null; // process action routing if (method_exists($this, $todo) || method_exists($this, '__call')) { $render = $this->$todo(); } // process template routing if ($render && is_string($render)) { if ($this->renderLayout) { $this->engine->printHeader(); } $this->template->display($render . '.tpl'); if ($this->renderLayout) { $this->engine->printFooter(); } } }
/** * Constructs a new job tracker "controller" and sets defaults. * * @return Isc_Admin_JobTracker */ public function __construct() { parent::__construct(); GetLib('class.json'); // parse the language file // $this->engine->loadLangFile('shoppingcomparison'); }
public function setUp() { parent::setUp(); GetLib('class.json'); $this->_keystore = Interspire_KeyStore::instance(); $this->_prefix = 'email:module_export:' . $this->args['id'] . ':'; $this->_db = $GLOBALS['ISC_CLASS_DB']; }
public function setUp() { parent::setUp(); GetLib('class.json'); $this->_keystore = Interspire_KeyStore::instance(); $this->_prefix = 'ebay:list_products:' . $this->args['id'] . ':'; $this->_db = $GLOBALS['ISC_CLASS_DB']; $this->_engine = getClass('ISC_ADMIN_ENGINE'); $this->_engine->LoadLangFile('ebay'); $this->_log = $GLOBALS['ISC_CLASS_LOG']; }
public function HandlePage() { GetLib("class.redirects"); // We're here because we can't find the requested URL // It may be a URL that has been set up as a redirect, so lets check that ISC_REDIRECTS::checkRedirect($_SERVER['REQUEST_URI']); // Send the 404 status headers header("HTTP/1.1 404 Not Found"); // Simply show the 404 page $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(GetConfig('StoreName')." - ".GetLang('NotFound')); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("404"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); }
public function HandleToDo() { /** * Convert the input character set from the hard coded UTF-8 to their * selected character set */ convertRequestInput(); GetLib('class.json'); $action = isc_strtolower(@$_REQUEST['w']); if(method_exists($this, $action)) { $this->$action(); die(); } }
/** * Check that the license key is valid for a commerical template * * @return void **/ private function CheckTemplateKey() { $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('layout'); GetLib('class.remoteopener'); $opener = new connect_remote(); // Get the information about this template from the remote server $host = base64_encode($_SERVER['HTTP_HOST']); $urlBits = array('template' => urlencode($_REQUEST['template']), 'key' => urlencode($_POST['templateKey']), 'host' => $host); $url = $this->BuildTemplateURL($GLOBALS['ISC_CFG']['TemplateVerifyURL'], $urlBits); $response = PostToRemoteFileAndGetResponse($url); // A remote connection couldn't be established if ($response === null) { exit; } $templateXML = @simplexml_load_string($response); if (!is_object($templateXML)) { exit; } $GLOBALS['ErrorMessage'] = ''; if (isset($templateXML->error)) { switch (strval($this->error)) { case "invalid": $GLOBALS['ErrorMessage'] = GetLang('InvalidKey'); return false; case "invalid_domain": $GLOBALS['ErrorMessage'] = GetLang('InvalidKeyDomain'); return false; case "invalid_tpl": $GLOBALS['ErrorMessage'] = GetLang('InvalidKeyTemplate'); return false; case "invalid_tpl2": $GLOBALS['ErrorMessage'] = GetLang('InvalidKeyTemplate2'); return false; default: $GLOBALS['ErrorMessage'] = GetLang('InvalidTemplate'); return false; } } if ($GLOBALS['ErrorMessage'] == '') { $tags[] = $this->MakeXMLTag('status', 1); } else { $tags[] = $this->MakeXMLTag('status', 0); $tags[] = $this->MakeXMLTag('message', $GLOBALS['ErrorMessage']); } $this->SendXMLHeader(); $this->SendXMLResponse($tags); die; }
private function SaveUpdatedSettings() { if($_SERVER['REQUEST_METHOD'] != 'POST') { $this->ManageSettings(); return; } $boolean = array ( 'UseWYSIWYG', 'AllowPurchasing', 'ShowInventory', 'ShowPreOrderInventory', 'ShowThumbsInControlPanel', 'TagCloudsEnabled', 'ShowAddToCartQtyBox', 'CaptchaEnabled', 'ShowCartSuggestions', 'ShowThumbsInCart', 'AutoApproveReviews', 'SearchSuggest', 'QuickSearch', 'RSSNewProducts', 'RSSPopularProducts', 'RSSFeaturedProducts', 'RSSCategories', 'RSSProductSearches', 'RSSLatestBlogEntries', 'RSSSyndicationIcons', 'StoreDSTCorrection', 'SystemLogging', 'AdministratorLogging', 'DebugMode', 'EnableWishlist', 'EnableAccountCreation', 'EnableProductComparisons', 'ShowProductPrice', 'ShowProductSKU', 'ShowProductWeight', 'ShowProductBrand', 'ShowProductShipping', 'ShowProductRating', 'HidePHPErrors', 'HTTPSSLVerifyPeer', 'ShowAddToCartLink', 'ShowAddThisLink', 'BulkDiscountEnabled', 'EnableProductTabs', 'ForceControlPanelSSL', 'ProductImagesTinyThumbnailsEnabled', 'ProductImagesImageZoomEnabled', 'DownForMaintenance', 'EnableCustomersAlsoViewed', 'FacebookLikeButtonEnabled', 'FacebookLikeButtonShowFaces', 'categoryFlyoutDropShadow', ); foreach ($boolean as $var) { if (isset($_POST[$var]) && ($_POST[$var] == 1 || $_POST[$var] === "ON")) { $GLOBALS['ISC_NEW_CFG'][$var] = 1; } else { $GLOBALS['ISC_NEW_CFG'][$var] = 0; } } $positive_ints = array ( 'HomeFeaturedProducts', 'HomeNewProducts', 'HomeBlogPosts', 'CategoryProductsPerPage', 'CategoryListDepth', 'ProductReviewsPerPage', 'RSSItemsLimit', 'RSSCacheTime', 'EnableSEOUrls', 'SystemLogMaxLength', 'AdministratorLogMaxLength', 'GuestCustomerGroup', 'CategoryPerRow', 'CategoryImageWidth', 'CategoryImageHeight', 'BrandPerRow', 'BrandImageWidth', 'BrandImageHeight', 'TagCloudMinSize', 'TagCloudMaxSize', 'SearchResultsPerPage', 'ProductImagesStorewideThumbnail_width', 'ProductImagesStorewideThumbnail_height', 'ProductImagesProductPageImage_width', 'ProductImagesProductPageImage_height', 'ProductImagesGalleryThumbnail_width', 'ProductImagesGalleryThumbnail_height', 'ProductImagesZoomImage_width', 'ProductImagesZoomImage_height', 'StartingOrderNumber', 'CustomersAlsoViewedCount', 'PCIPasswordMinLen', 'PCIPasswordHistoryCount', 'PCIPasswordExpiryTimeDay', 'PCILoginAttemptCount', 'PCILoginLockoutTimeMin', 'PCILoginIdleTimeMin', 'PCILoginInactiveTimeDay', ); foreach ($positive_ints as $var) { if (isset($_POST[$var]) && (int)$_POST[$var] > 0) { $GLOBALS['ISC_NEW_CFG'][$var] = (int)$_POST[$var]; } else { $GLOBALS['ISC_NEW_CFG'][$var] = 0; } } $floats = array( 'categoryFlyoutMouseOutDelay', ); foreach ($floats as $var) { if (!isset($_POST[$var])) { $GLOBALS['ISC_NEW_CFG'][$var] = 0; } $GLOBALS['ISC_NEW_CFG'][$var] = (float)$_POST[$var]; } $_SESSION['RunImageResize'] = 'no'; if(isset($_POST['AutoResizeImages']) && $_POST['AutoResizeImages'] == 'yes') { $_SESSION['RunImageResize'] = 'yes'; } // check the starting order number $currentAutoIncrement = (int)GetOrderTableAutoIncrement(); $newAutoIncrement = (int)$_POST['StartingOrderNumber']; if($currentAutoIncrement != $newAutoIncrement) { // they've changed the starting order number // we need to make sure that it is not lower than any current order's ID tho $highestOrderId = GetHighestOrderNumber(); if($newAutoIncrement <= $highestOrderId) { // new starting ID is too low $message = GetLang('StartingOrderNumberTooLow', array( 'currentHighest' => $highestOrderId, 'lowestPossible' => ($highestOrderId+1), )); FlashMessage($message, MSG_ERROR, 'index.php?ToDo=viewSettings¤tTab='.((int) $_POST['currentTab'])); die(); } if(!UpdateOrderTableAutoIncrement($newAutoIncrement)) { FlashMessage(GetLang('StartingOrderNumberAlterFailed'), MSG_ERROR, 'index.php?ToDo=viewSettings¤tTab='.((int) $_POST['currentTab'])); die(); } } // check image size limits and cap them, check for invalid sizes and set them as defaults $imageSizes = array( 'StorewideThumbnail' => ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL, 'ProductPageImage' => ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD, 'GalleryThumbnail' => ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY, 'ZoomImage' => ISC_PRODUCT_DEFAULT_IMAGE_SIZE_ZOOM, ); foreach ($imageSizes as $imageSizeKey => $imageSizeDefault) { $widthKey = 'ProductImages' . $imageSizeKey . '_width'; $heightKey = 'ProductImages' . $imageSizeKey . '_height'; if ($GLOBALS['ISC_NEW_CFG'][$widthKey] > ISC_PRODUCT_IMAGE_MAXLONGEDGE) { $GLOBALS['ISC_NEW_CFG'][$widthKey] = ISC_PRODUCT_IMAGE_MAXLONGEDGE; } else if ($GLOBALS['ISC_NEW_CFG'][$widthKey] < 1) { $GLOBALS['ISC_NEW_CFG'][$widthKey] = $imageSizeDefault; } if ($GLOBALS['ISC_NEW_CFG'][$heightKey] > ISC_PRODUCT_IMAGE_MAXLONGEDGE) { $GLOBALS['ISC_NEW_CFG'][$heightKey] = ISC_PRODUCT_IMAGE_MAXLONGEDGE; } else if ($GLOBALS['ISC_NEW_CFG'][$heightKey] < 1) { $GLOBALS['ISC_NEW_CFG'][$heightKey] = $imageSizeDefault; } } // Have there been any changes to the image sizes? // If there were no changes, don't even touch the images database $imageSizes = array( ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL => array( 'ProductImagesStorewideThumbnail_width', 'ProductImagesStorewideThumbnail_height', ), ISC_PRODUCT_IMAGE_SIZE_STANDARD => array( 'ProductImagesProductPageImage_width', 'ProductImagesProductPageImage_height', ), ISC_PRODUCT_IMAGE_SIZE_TINY => array( 'ProductImagesGalleryThumbnail_width', 'ProductImagesGalleryThumbnail_height', ), ISC_PRODUCT_IMAGE_SIZE_ZOOM => array( 'ProductImagesZoomImage_width', 'ProductImagesZoomImage_height', ), ); // hacky :/ $imageTimeChangedKeys = array( ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL => 'ProductImagesStorewideThumbnail_timeChanged', ISC_PRODUCT_IMAGE_SIZE_STANDARD => 'ProductImagesProductPageImage_timeChanged', ISC_PRODUCT_IMAGE_SIZE_TINY => 'ProductImagesGalleryThumbnail_timeChanged', ISC_PRODUCT_IMAGE_SIZE_ZOOM => 'ProductImagesZoomImage_timeChanged', ); $changedDimensions = array(); foreach($imageSizes as $size => $dimensionSettings) { foreach($dimensionSettings as $dimension) { if($GLOBALS['ISC_NEW_CFG'][$dimension] != $GLOBALS['ISC_CFG'][$dimension]) { $changedDimensions[$size] = $size; $GLOBALS['ISC_NEW_CFG'][$imageTimeChangedKeys[$size]] = time(); } } } // product images used to be deleted here if the dimensions changed but this is now inside the image class // and is based off the _timeChanged above // check if the down for maintenance message is the same as the language pack if(Store_DownForMaintenance::getDownForMaintenanceMessage(true) == $_POST['DownForMaintenanceMessage'] || empty($_POST['DownForMaintenanceMessage'])) { $GLOBALS['ISC_NEW_CFG']['DownForMaintenanceMessage'] = ''; } else if ($GLOBALS['ISC_NEW_CFG']['DownForMaintenance'] == 1) { $GLOBALS['ISC_NEW_CFG']['DownForMaintenanceMessage'] = $_POST['DownForMaintenanceMessage']; } // Normalize the shop path based on users redirect to www/no-www setting $shopPath = $_POST['ShopPath']; GetLib('class.redirects'); $shopPath = ISC_REDIRECTS::normalizeShopPath($shopPath, (int)$_POST['RedirectWWW']); $GLOBALS['ISC_NEW_CFG']['ShopPath'] = $shopPath; $strings = array ( 'SharedSSLPath', 'SubdomainSSLPath', 'StoreName', 'StoreAddress', 'serverStamp', 'DownloadDirectory', 'ImageDirectory', 'HomePagePageTitle', 'MetaKeywords', 'MetaDesc', 'AdminEmail', 'OrderEmail', 'DisplayDateFormat', 'ExportDateFormat', 'ExtendedDisplayDateFormat', 'GoogleMapsAPIKey', 'ForwardInvoiceEmails', 'HTTPProxyPort', 'HTTPProxyServer', 'DimensionsDecimalToken', 'DimensionsThousandsToken', 'DimensionsDecimalPlaces', 'SessionSavePath', 'DefaultPreOrderMessage', 'FacebookLikeButtonAdminIds', 'CategoryListStyle', ); // ignore this setting if it's posted by the client but should be hidden, otherwise process it if (!GetConfig('HideDeletedOrdersActionSetting')) { $strings[] = 'DeletedOrdersAction'; } foreach ($strings as $var) { if (isset($_POST[$var]) && is_string($_POST[$var])) { $GLOBALS['ISC_NEW_CFG'][$var] = $_POST[$var]; } } $enums = array ( 'UseSSL' => array(SSL_NONE, SSL_NORMAL, SSL_SHARED, SSL_SUBDOMAIN), 'WeightMeasurement' => array ('LBS', 'KGS', 'Ounces', 'Grams', 'Tonnes'), 'LengthMeasurement' => array ('Inches', 'Centimeters'), 'StoreTimeZone' => array_keys($this->timezones), 'Language' => $this->GetAvailableLanguagesArray(), 'TagCartQuantityBoxes' => array ('dropdown', 'textbox'), 'FastCartAction' => array('popup', 'cart'), 'ProductImageMode' => array ('popup', 'lightbox'), 'ProductBreadcrumbs' => array('showall', 'showone', 'shownone'), 'CategoryListingMode' => array('single', 'emptychildren', 'children'), 'CategoryDisplayMode' => array('grid', 'list'), 'ShippingFactoringDimension' => array('depth', 'height', 'width'), 'SearchDefaultProductSort' => array('relevance', 'alphaasc', 'alphadesc', 'featured', 'newest', 'bestselling', 'avgcustomerreview', 'priceasc', 'pricedesc'), 'SearchDefaultContentSort' => array('relevance', 'alphaasc', 'alphadesc'), 'SearchProductDisplayMode' => array('grid', 'list'), 'SearchOptimisation' => array('fulltext', 'like', 'both'), 'CharacterSet' => $this->validCharacterSets, 'AbandonOrderLifetime' => array(1, 7, 14, 21, 30, 60, 90, 120, 150, 180), 'RedirectWWW' => array(REDIRECT_NO_PREFERENCE, REDIRECT_TO_WWW, REDIRECT_TO_NO_WWW), 'FacebookLikeButtonStyle' => array('standard', 'countonly'), 'FacebookLikeButtonPosition' => array('above', 'below'), 'FacebookLikeButtonVerb' => array('like', 'recommend'), ); foreach ($enums as $var => $possible_vals) { if (isset($_POST[$var]) && in_array($_POST[$var], $possible_vals)) { $GLOBALS['ISC_NEW_CFG'][$var] = $_POST[$var]; } else { $GLOBALS['ISC_NEW_CFG'][$var] = $possible_vals[0]; } } $uploads = array( 'CategoryDefaultImage', 'BrandDefaultImage', ); if($_POST['DefaultProductImage'] == 'custom') { $uploads[] = 'DefaultProductImageCustom'; } foreach ($uploads as $var) { $imageLocation = GetConfig($var); if (array_key_exists($var, $_FILES) && file_exists($_FILES[$var]['tmp_name'])) { $ext = GetFileExtension($_FILES[$var]['name']); $imageLocation = GetConfig('ImageDirectory').'/' . $var . '.' . $ext; move_uploaded_file($_FILES[$var]['tmp_name'], ISC_BASE_PATH . '/'.$imageLocation); // Attempt to change the permissions on the file isc_chmod(ISC_BASE_PATH . '/'.$imageLocation, ISC_WRITEABLE_FILE_PERM); } if (array_key_exists('Del' . $var, $_REQUEST) && $_REQUEST['Del' . $var]) { @unlink(ISC_BASE_PATH . GetConfig($var)); $imageLocation = ''; } $GLOBALS['ISC_NEW_CFG'][$var] = $imageLocation; } switch($_POST['DefaultProductImage']) { case 'custom': if ($GLOBALS['ISC_NEW_CFG']['DefaultProductImageCustom'] != '') { $GLOBALS['ISC_NEW_CFG']['DefaultProductImage'] = $GLOBALS['ISC_NEW_CFG']['DefaultProductImageCustom']; } unset($GLOBALS['ISC_NEW_CFG']['DefaultProductImageCustom']); break; case 'template': $GLOBALS['ISC_NEW_CFG']['DefaultProductImage'] = 'template'; break; default: $GLOBALS['ISC_NEW_CFG']['DefaultProductImage'] = ''; } // Backup Settings if (gzte11(ISC_MEDIUMPRINT)) { $boolean = array ( 'BackupsLocal', 'BackupsRemoteFTP', 'BackupsAutomatic', 'BackupsAutomaticDatabase', 'BackupsAutomaticImages', 'BackupsAutomaticDownloads', ); foreach ($boolean as $var) { if (isset($_POST[$var]) && ($_POST[$var] == 1 || $_POST[$var] === "ON")) { $GLOBALS['ISC_NEW_CFG'][$var] = 1; } else { $GLOBALS['ISC_NEW_CFG'][$var] = 0; } } $strings = array ( 'BackupsRemoteFTPHost', 'BackupsRemoteFTPUser', 'BackupsRemoteFTPPass', 'BackupsRemoteFTPPath', ); foreach ($strings as $var) { if (isset($_POST[$var]) && is_string($_POST[$var])) { $GLOBALS['ISC_NEW_CFG'][$var] = $_POST[$var]; } } $enums = array ( 'BackupsAutomaticMethod' => array ('ftp', 'local'), ); foreach ($enums as $var => $possible_vals) { if (isset($_POST[$var]) && in_array($_POST[$var], $possible_vals)) { $GLOBALS['ISC_NEW_CFG'][$var] = $_POST[$var]; } else { $GLOBALS['ISC_NEW_CFG'][$var] = $possible_vals[0]; } } } // Newsletter Settings if (isset($_POST['SystemLogTypes'])) { $GLOBALS['ISC_NEW_CFG']['SystemLogTypes'] = implode(",", $_POST['SystemLogTypes']); } else { $GLOBALS['ISC_NEW_CFG']['SystemLogTypes'] = ''; } if (isset($_POST['SystemLogSeverity'])) { $GLOBALS['ISC_NEW_CFG']['SystemLogSeverity'] = implode(",", $_POST['SystemLogSeverity']); } else { $GLOBALS['ISC_NEW_CFG']['SystemLogSeverity'] = ''; } if(isset($_POST['LowInventoryEmails']) && $_POST['LowInventoryEmails'] == 1) { $GLOBALS['ISC_NEW_CFG']['LowInventoryNotificationAddress'] = $_POST['LowInventoryNotificationAddress']; } else { $GLOBALS['ISC_NEW_CFG']['LowInventoryNotificationAddress'] = ''; } if(isset($_POST['ForwardInvoiceEmailsCheck']) && $_POST['ForwardInvoiceEmailsCheck'] == 1) { $GLOBALS['ISC_NEW_CFG']['ForwardInvoiceEmails'] = $_POST['ForwardInvoiceEmails']; } else { $GLOBALS['ISC_NEW_CFG']['ForwardInvoiceEmails'] = ''; } // Email Server Settings $GLOBALS['ISC_NEW_CFG']['MailUseSMTP'] = 0; $GLOBALS['ISC_NEW_CFG']['MailSMTPServer'] = ''; $GLOBALS['ISC_NEW_CFG']['MailSMTPUsername'] = ''; $GLOBALS['ISC_NEW_CFG']['MailSMTPPassword'] = ''; $GLOBALS['ISC_NEW_CFG']['MailSMTPPort'] = ''; if(isset($_POST['MailUseSMTP']) && $_POST['MailUseSMTP'] == 1) { $GLOBALS['ISC_NEW_CFG']['MailUseSMTP'] = 1; $GLOBALS['ISC_NEW_CFG']['MailSMTPServer'] = $_POST['MailSMTPServer']; if(isset($_POST['MailSMTPUsername'])) { $GLOBALS['ISC_NEW_CFG']['MailSMTPUsername'] = $_POST['MailSMTPUsername']; } if(isset($_POST['MailSMTPPassword'])) { $GLOBALS['ISC_NEW_CFG']['MailSMTPPassword'] = $_POST['MailSMTPPassword']; } if(isset($_POST['MailSMTPPort'])) { $GLOBALS['ISC_NEW_CFG']['MailSMTPPort'] = $_POST['MailSMTPPort']; } } if(isset($_POST['VendorPhotoUploading'])) { $GLOBALS['ISC_NEW_CFG']['VendorPhotoSize'] = (int)$_POST['VendorPhotoSizeW'].'x'.(int)$_POST['VendorPhotoSizeH']; } else { $GLOBALS['ISC_NEW_CFG']['VendorPhotoSize'] = ''; } if(isset($_POST['VendorLogoUploading'])) { $GLOBALS['ISC_NEW_CFG']['VendorLogoSize'] = (int)$_POST['VendorLogoSizeW'].'x'.(int)$_POST['VendorLogoSizeH']; } else { $GLOBALS['ISC_NEW_CFG']['VendorLogoSize'] = ''; } // Remove any settings that have been disabled so they can't be adjusted by the end user $disabledFields = array( 'DisableLicenseKeyField' => array( 'serverStamp' ), 'DisableStoreUrlField' => array( 'ShopPath' ), 'DisablePathFields' => array( 'DownloadDirectory', 'ImageDirectory' ), 'DisableLoggingSettingsTab' => array( 'SystemLogging', 'HidePHPErrors', 'SystemLogTypes', 'SystemLogSeverity', 'SystemLogMaxLength', 'AdministratorLogging', 'AdministratorLogMaxLength' ), 'DisableProxyFields' => array( 'HTTPProxyServer', 'HTTPProxyPort', 'HTTPSSLVerifyPeer' ), 'DisableBackupSettings' => array( 'BackupsLocal', 'BackupsRemoteFTP', 'BackupsRemoteFTPHost', 'BackupsRemoteFTPUser', 'BackupsRemoteFTPPass', 'BackupsRemoteFTPPath', 'BackupsAutomatic', 'BackupsAutomaticMethod', 'BackupsAutomaticDatabase', 'BackupsAutomaticImages', 'BackupsAutomaticDownloads' ), 'HidePCISettings' => array( 'PCIPasswordMinLen', 'PCIPasswordHistoryCount', 'PCIPasswordExpiryTimeDay', 'PCILoginAttemptCount', 'PCILoginLockoutTimeMin', 'PCILoginIdleTimeMin', 'PCILoginInactiveTimeDay' ) ); foreach($disabledFields as $setting => $fields) { if(GetConfig($setting) == true) { foreach($fields as $field) { unset($GLOBALS['ISC_NEW_CFG'][$field]); } } } $messages = array(); if ($this->CommitSettings($messages)) { $redirectUrl = 'index.php?ToDo=viewSettings¤tTab='.(int)$_POST['currentTab']; // Mark this step as complete in getting started if(GetClass('ISC_ADMIN_ENGINE')->MarkGettingStartedComplete('settings')) { $redirectUrl = 'index.php'; } // Log this action $GLOBALS['ISC_CLASS_LOG']->LogAdminAction(); FlashMessage(GetLang('SettingsSavedSuccessfully'), MSG_SUCCESS, $redirectUrl); } else { FlashMessage(sprintf(GetLang('SettingsNotSaved'), $messages), MSG_ERROR, 'index.php?ToDo=viewSettings¤tTab='.((int) $_POST['currentTab'])); } }
public function _GetTemplateList() { GetLib('class.file'); // Get a list of templates and return them as a sorted array $dir = ISC_BASE_PATH . "/templates"; $arrTemplates = array(); if (is_dir($dir)) { $fileHandle = new FileClass; if ($fileHandle->SetLoadDir($dir)) { while (($file = $fileHandle->NextFolder()) !== false) { if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn" && $file != 'blank.dat' && $file{0} != '_') { // These are the template categories. We will create // an array for each of them $arrTemplates[] = $file; sort($arrTemplates); } } $fileHandle->CloseHandle(); } } ksort($arrTemplates); return $arrTemplates; }
/** * Handler for accepting a new product images from the image manager or other products * * @param ISC_ADMIN_REMOTE $remote */ public function remoteUseSourceImages(ISC_ADMIN_REMOTE $remote) { GetLib('class.imagedir'); $db = $GLOBALS["ISC_CLASS_DB"]; $sourceImages = @$_POST['images']; $tags = array(); $errors = array(); $images = array(); $productId = false; $productHash = false; if (isset($_POST['product'])) { $productId = (int)@$_POST['product']; if (!isId($productId) || !ProductExists($productId)) { $errors[] = GetLang('ProductDoesntExist'); } } else if (isset($_POST['hash']) && $_POST['hash']) { $productHash = $_POST['hash']; } else { $errors[] = GetLang('ProductDoesntExist'); } if (empty($errors) && count($sourceImages)) { // only proceed if they had images selected $imageDir = new ISC_IMAGEDIR(); foreach ($sourceImages as $imageId) { if(substr($imageId, 0, strlen('productimage_')) == 'productimage_') { // image from another product $productImageId = (int)str_replace('productimage_', '', $imageId); $productImage = new ISC_PRODUCT_IMAGE($productImageId); $sourceFilePath = $productImage->getAbsoluteSourceFilePath(); $originalFilename = $productImage->getFileName(); } elseif (substr($imageId, 0, strlen('imagemanager_')) == 'imagemanager_') { // image from the image manager $imageManagerId = str_replace('imagemanager_', '', $imageId); $originalFilename = $imageDir->findFileNameById($imageManagerId); $sourceFilePath = $imageDir->GetImagePath() . '/' . $originalFilename; } else { // not a valid selection continue; } try { if ($productHash) { $image = ISC_PRODUCT_IMAGE::importImage($sourceFilePath, $originalFilename, $productHash, true, false); } else { $image = ISC_PRODUCT_IMAGE::importImage($sourceFilePath, $originalFilename, $productId, false, false); } } catch (ISC_PRODUCT_IMAGE_IMPORT_INVALIDIMAGEFILE_EXCEPTION $exception) { $errors[] = $url . ": " . $exception->getMessage() . ' ' . GetLang('ProductImageInvalidFileFromSource'); continue; } catch (ISC_PRODUCT_IMAGE_IMPORT_EXCEPTION $exception) { // these exceptions should have language-powered messages so are safe to return to the user $errors[] = $url . ": " . $exception->getMessage(); continue; } catch (Exception $exception) { // other unknown error $errors[] = $url . ': ' . GetLang('ProductImageProcessUnknownError'); continue; } // all done, add to list of successful images $images[] = $image; } } foreach ($images as /*ISC_PRODUCT_IMAGE*/$image) { $json = array( 'id' => $image->getProductImageId(), 'product' => $image->getProductId(), 'hash' => $image->getProductHash(), 'preview' => $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true), 'zoom' => $image->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true), 'description' => $image->getDescription(), 'baseThumbnail' => $image->getIsThumbnail(), 'sort' => $image->getSort(), ); $tags[] = $remote->MakeXMLTag('image', isc_json_encode($json), true); } foreach ($errors as $message) { $tags[] = $remote->MakeXMLTag('error', $message, true); } $remote->SendXMLHeader(); $remote->SendXMLResponse($tags); die(); }
/** * Adds or removes www. to the ShopPath depending on the RedirectWWW config setting. * This is so the store doesn't unnecessarily keep redirecting if the RedirectWWW setting doesn't match with the ShopPath. * * @param string $shopPath The ShopPath to normalize * @param REDIRECT_NO_PREFERENCE|REDIRECT_TO_WWW|REDIRECT_TO_NO_WWW $redirectWWW The chosen redirect www preference * @return string The normalized shop path */ public static function normalizeShopPath($shopPath, $redirectWWW) { if ($redirectWWW == REDIRECT_NO_PREFERENCE) { return $shopPath; } $info = @parse_url($shopPath); if ($info === false || empty($info['host'])) { return $shopPath; } $host = $info['host']; // set to redirect to www and their shop path doesn't contain www. if ($redirectWWW == REDIRECT_TO_WWW && isc_substr($host, 0, 4) != 'www.') { // add www. to host $newHost = 'www.' . $host; } // set to redirect to no-www but their shop path contains www? elseif ($redirectWWW == REDIRECT_TO_NO_WWW && isc_substr($host, 0, 4) == 'www.') { // remove the www. from host $newHost = isc_substr($host, 4); } else { return $shopPath; } // reconstruct shop path $info['host'] = $newHost; GetLib('class.urls'); $newShopPath = ISC_URLS::unparseUrl($info); return $newShopPath; }
/** * Handler for browser requests meant to trigger the internal task manager queue processor * * @return mixed If a task was not executed a null value will be returned, otherwise true or false will be returned depending on the successful (or not) execution of a task */ public static function handleTriggerRequest() { @ignore_user_abort(true); // run the task, if any self::executeNextTask(); header("Expires: Mon, 23 Jul 1993 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0, max-age=0", false); $response = array( 'remaining' => self::hasTasks(), ); GetLib('class.json'); ISC_JSON::output($response); exit; }
private function saveNewRedirectURL() { $newUrl = trim($_POST['newurl']); $redirectId = (int)$_POST['id']; if(empty($newUrl) || $newUrl == "/") { ISC_JSON::output(GetLang('InvalidRedirect')); } GetLib('class.redirects'); $newUrl = ISC_REDIRECTS::normalizeNewURLForDatabase($newUrl, $error); if ($newUrl === false) { if (empty($error)) { $error = GetLang('InvalidRedirect'); } ISC_JSON::output($error); } $returnData = array('url' => $newUrl, 'id' => $redirectId); if($redirectId == 0 && substr($_POST['id'], 0, 3) == 'tmp') { $redirectId = $GLOBALS['ISC_CLASS_DB']->InsertQuery('redirects', array('redirectpath'=> '', 'redirectmanual' => $newUrl, 'redirectassoctype' => ISC_REDIRECTS::REDIRECT_TYPE_MANUAL, 'redirectassocid'=>0)); //echo "REdirect iD is " . $GLOBALS['ISC_CLASS_DB']->getErrorMsg(); if($redirectId) { $returnData['id'] = $redirectId; $returnData['tmpredirectid'] = $_POST['id']; ISC_JSON::output('', true, $returnData); return; } } else { if($GLOBALS['ISC_CLASS_DB']->UpdateQuery('redirects', array('redirectmanual' => $newUrl), 'redirectid=' . $redirectId)) { ISC_JSON::output('', true, $returnData); return; } } ISC_JSON::output(GetLang('RedirectSaveErrorDatabase')); }
<?php GetLib('uploadhandler'); class ISC_UPLOADHANDLER extends UploadHandler { } // populate the upload handler language foreach (UploadHandler::$i18n as $UploadHandlerIndex => $UploadHandlerValue) { UploadHandler::$i18n[$UploadHandlerIndex] = GetLang($UploadHandlerIndex); }
<?php GetLib('class.json'); class ISC_ADMIN_GIFTCERTIFICATES extends ISC_ADMIN_BASE { public $_customSearch = array(); public function __construct() { parent::__construct(); // Initialise custom searches functionality require_once(dirname(__FILE__).'/class.customsearch.php'); $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH'] = new ISC_ADMIN_CUSTOMSEARCH('giftcertificates'); } public function HandleToDo($Do) { if(!gzte11(ISC_LARGEPRINT)) { exit; } $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('giftcertificates'); switch (isc_strtolower($Do)) { case "creategiftcertificateview": if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_GiftCertificates)) { $GLOBALS['BreadcrumEntries'] = array( $GLOBALS["ISC_LANG"]['Home'] => "index.php", $GLOBALS["ISC_LANG"]['GiftCertificates'] => "index.php?ToDo=viewGiftCertificates", $GLOBALS["ISC_LANG"]['CreateGiftCertificateView'] => "index.php?ToDo=createGiftCertificateView" );
function RewriteIncomingRequest() { // Using path info if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !== '' && basename($_SERVER['PATH_INFO']) != 'index.php') { $path = $_SERVER['PATH_INFO']; if (isset($_SERVER['SCRIPT_NAME'])) { $uriTest = str_ireplace($_SERVER['SCRIPT_NAME'], "", $path); if($uriTest != '') { $uri = $uriTest; } } else if (isset($_SERVER['SCRIPT_FILENAME'])) { $file = str_ireplace(ISC_BASE_PATH, "", $_SERVER['SCRIPT_FILENAME']); $uriTest = str_ireplace($file, "", $path); if($uriTest != '') { $uri = $uriTest; } } $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/index.php/"; } // Using HTTP_X_REWRITE_URL for ISAPI_Rewrite on IIS based servers if(isset($_SERVER['HTTP_X_REWRITE_URL']) && !isset($uri)) { $uri = $_SERVER['HTTP_X_REWRITE_URL']; $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/"; } // Using REQUEST_URI if (isset($_SERVER['REQUEST_URI']) && !isset($uri)) { $uri = $_SERVER['REQUEST_URI']; $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/"; } // Using SCRIPT URL if (isset($_SERVER['SCRIPT_URL']) && !isset($uri)) { $uri = $_SERVER['SCRIPT_URL']; $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/"; } // Using REDIRECT_URL if (isset($_SERVER['REDIRECT_URL']) && !isset($uri)) { $uri = $_SERVER['REDIRECT_URL']; $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/"; } // Using REDIRECT URI if (isset($_SERVER['REDIRECT_URI']) && !isset($uri)) { $uri = $_SERVER['REDIRECT_URI']; $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/"; } // Using query string? if (isset($_SERVER['QUERY_STRING']) && !isset($uri)) { $uri = $_SERVER['QUERY_STRING']; $GLOBALS['UrlRewriteBase'] = $GLOBALS['ShopPath'] . "/?"; $_SERVER['QUERY_STRING'] = preg_replace("#(.*?)\?#", "", $_SERVER['QUERY_STRING']); } if (isset($_SERVER['REDIRECT_QUERY_STRING'])) { $_SERVER['QUERY_STRING'] = $_SERVER['REDIRECT_QUERY_STRING']; } if(!isset($uri)) { $uri = ''; } // Check if the user needs to be redirected to www. or no www. GetLib('class.redirects'); $redirectURL = ISC_REDIRECTS::checkRedirectWWW($uri); if ($redirectURL) { ISC_REDIRECTS::redirect($redirectURL); } $originalUri = $uri; $appPath = preg_quote(trim($GLOBALS['AppPath'], "/"), "#"); $uri = trim($uri, "/"); $uri = trim(preg_replace("#".$appPath."#i", "", $uri,1), "/"); // Strip off anything after a ? in case we've got the query string too $uri = preg_replace("#\?(.*)#", "", $uri); $GLOBALS['PathInfo'] = explode("/", $uri); if(strtolower($GLOBALS['PathInfo'][0]) == "index.php") { $GLOBALS['PathInfo'][0] = ''; } if (!isset($GLOBALS['PathInfo'][0]) || !$GLOBALS['PathInfo'][0]) { $GLOBALS['PathInfo'][0] = "index"; } if(!isset($GLOBALS['RewriteRules'][$GLOBALS['PathInfo'][0]])) { $GLOBALS['PathInfo'][0] = "404"; } $handler = $GLOBALS['RewriteRules'][$GLOBALS['PathInfo'][0]]; $script = $handler['class']; $className = $handler['name']; $globalName = $handler['global']; if (isset($handler['checkdatabase'])) { // before redirecting, check for a stored 301 redirect GetLib("class.redirects"); ISC_REDIRECTS::checkRedirect($originalUri); } $GLOBALS[$globalName] = GetClass($className); $GLOBALS[$globalName]->HandlePage(); }
/** * The email integration modules save differently than other module types, so this method is overridden. * * @param array $settings * @param bool $deleteFirst This is ignored for email integration modules * @return boolean */ public function SaveModuleSettings($settings = array(), $deleteFirst = true) { $moduleVariables = $this->GetCustomVars(); /** @var mysqldb */ $db = $GLOBALS['ISC_CLASS_DB']; // general/api settings foreach ($settings as $name => $value) { if (!isset($moduleVariables[$name])) { continue; } $moduleVariable = $moduleVariables[$name]; if (isset($moduleVariable['format'])) { $format = $moduleVariable['format']; } else { $format = ''; } switch($format) { case 'boolean': if ($value) { $value = 1; } else { $value = 0; } break; case 'price': $value = DefaultPriceFormat($value); break; case 'weight': case 'dimension': $value = DefaultDimensionFormat($value); break; } $exists = $db->FetchOne("SELECT COUNT(*) FROM [|PREFIX|]module_vars WHERE modulename = '" . $db->Quote($this->GetId()) . "' AND variablename = '" . $db->Quote($name) . "'"); if ($exists > 0) { $db->UpdateQuery('module_vars', array('variableval' => $value), "modulename = '" . $db->Quote($this->GetId()) . "' AND variablename = '" . $db->Quote($name) . "'"); } else { $row = array( 'modulename' => $this->GetId(), 'variablename' => $name, 'variableval' => $value ); $db->InsertQuery('module_vars', $row); } $this->moduleVariables[$name] = $value; } // if provided, process rule builder POST data and serialize to config $commitRules = false; $decodedRules = false; $returnValue = true; GetLib('class.json'); /** @var ISC_LOG */ $log = $GLOBALS['ISC_CLASS_LOG']; // if rules are not set, do not save them if (isset($settings['rules'])) { if ($settings['rules']) { $decodedRules = ISC_JSON::decode($settings['rules'], true); if ($decodedRules) { $commitRules = true; } else { // do not save rules if they are set but failed to decode $log->LogSystemError(array('emailintegration', $this->GetName()), 'Failed to decode email integration rules JSON packet', $settings['rules']); $returnValue = false; } } else { // rules are set, but blank, so delete all rules $decodedRules = array(); $commitRules = true; } } if ($commitRules) { // parse and save each rule - _Rule class will handle insert or update $ruleIds = array(); $db->StartTransaction(); $transactionOk = true; $ruleIds = array(); if (!empty($decodedRules)) { foreach ($decodedRules as $rule) { $rule = Interspire_EmailIntegration_Rule::fromJSON($rule); if (!$rule) { $log->LogSystemError(array('emailintegration', $this->GetName()), 'Failed to translate email integration rule from JSON to EmailIntegration_Rule class.', $settings['rules']); $transactionOk = false; continue; } if (!$rule->save()) { $transactionOk = false; continue; } $ruleIds[] = $rule->id; } if ($transactionOk) { // rules saved ok - delete rules that should no longer exist if (!$db->DeleteQuery('email_rules', "WHERE `provider` = '" . $db->Quote($this->GetId()) . "' AND `id` NOT IN (" . implode(',', $ruleIds) . ")")) { $transactionOk = false; $log->LogSystemError(array('emailintegration', $this->GetName()), 'Failed to remove old integration rules due to database error.'); } } } else { if (!$db->DeleteQuery('email_rules', "WHERE `provider` = '" . $db->Quote($this->GetId()) . "'")) { $transactionOk = false; $log->LogSystemError(array('emailintegration', $this->GetName()), 'Failed to remove old integration rules due to database error.'); } } if ($transactionOk) { $db->CommitTransaction(); self::flushRules(); } else { $db->RollbackTransaction(); $returnValue = false; } } return $returnValue; }
private function DisableStoreMaintenance() { $result = false; if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_See_Store_During_Maintenance)) { $GLOBALS['ISC_NEW_CFG']['DownForMaintenance'] = 0; $settings = GetClass('ISC_ADMIN_SETTINGS'); $result = $settings->CommitSettings(); } GetLib('class.json'); ISC_JSON::output('', $result); }
public function processProductImages() { GetLib('class.json'); /** @var ISC_LOG */ $log = $GLOBALS['ISC_CLASS_LOG']; $query = " SELECT (SELECT COUNT(*) FROM [|PREFIX|]product_images) AS prodimagecount, (SELECT COUNT(DISTINCT vcimage, vcimagezoom, vcimagestd, vcimagethumb) FROM [|PREFIX|]product_variation_combinations WHERE vcimage != '') AS varimagecount "; $result = $this->db->Query($query); $countrow = $this->db->Fetch($result); $total = $countrow['prodimagecount'] + $countrow['varimagecount']; $start = max(0, @(int)$_POST['start']); $limit = 10; $completed = 0; if ($start < $countrow['prodimagecount']) { $imageIterator = new ISC_PRODUCT_IMAGE_ITERATOR('select * from `[|PREFIX|]product_images` limit ' . $start . ', ' . $limit); foreach($imageIterator as $imageId => $image) { try { // the first argument to saveToDatabase is $generateImages. If true (is by default), the images will be regenerated $image->saveToDatabase(); } catch (Exception $exception) { $log->LogSystemDebug('general', 'Exception while processing product image ' . $imageId, $exception->getMessage()); } ++$completed; } } // was there any remaining 'items' to process for this iteration? start on variation images $var_limit = $limit - $completed; if ($var_limit > 0) { $var_start = max(0, $start - $countrow['prodimagecount']); $query = ' SELECT vcimage, vcimagezoom, vcimagestd, vcimagethumb FROM [|PREFIX|]product_variation_combinations WHERE vcimage != "" GROUP BY vcimage, vcimagezoom, vcimagestd, vcimagethumb ORDER BY vcimage LIMIT ' . $var_start . ', ' . $var_limit; $result = $this->db->Query($query); while ($row = $this->db->Fetch($result)) { try { $image = new ISC_PRODUCT_IMAGE; $image->setSourceFilePath($row['vcimage']); if ($row['vcimagezoom']) { $image->setResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, $row['vcimagezoom']); } if ($row['vcimagestd']) { $image->setResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, $row['vcimagestd']); } if ($row['vcimagethumb']) { $image->setResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, $row['vcimagethumb']); } $updatedVariation = array( 'vcimagezoom' => $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, false), 'vcimagestd' => $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, false), 'vcimagethumb' => $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, false), ); $this->db->UpdateQuery('product_variation_combinations', $updatedVariation, "vcimage = '" . $this->db->Quote($row['vcimage']) . "'"); } catch (Exception $exception) { $log->LogSystemDebug('general', 'Exception while processing variation image ' . $row['vcimage'], $exception->getMessage()); } ++$completed; } } $result = array('completed' => $completed, 'start' => (int)$start, 'total'=> (int)$total); ISC_JSON::output('', true, $result); exit; }
public function getRedirectsTable() { GetLib('class.redirects'); GetLib('class.urls'); $perPage = 20; $page = max((int)@$_GET['page'], 1); $start = ($page * $perPage) - $perPage; $NumResults = 0; $GLOBALS['RedirectsGrid'] = ""; $GLOBALS['RedirectPaging'] = ""; $sortOrder = 'desc'; if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') { $sortOrder = 'asc'; } $sortLinks = array( "OldUrl" => "r.redirectpath", "NewUrl" => "r.redirectassoctype", "RedirectId" => "r.redirectid", ); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; } else { $sortField = "r.redirectid"; } $sortURL = '&sortField=' . $sortField . '&sortOrder=' . $sortOrder; $GLOBALS['SortURL'] = $sortURL; // Get the results for the query $redirectResult = $this->getRedirectRows($start, $sortField, $sortOrder, $perPage, $NumResults); $numPages = ceil($NumResults / $perPage); if(($start+1) > $NumResults && $start > 1) { $_GET['page'] = 1; return $this->getRedirectsTable(); } // Add the "(Page x of n)" label if($NumResults > $perPage) { $GLOBALS['RedirectPaging'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['RedirectPaging'] .= BuildPagination($NumResults, $perPage, $page, 'remote.php?remoteSection=redirects&w=getRedirectsTable' . $sortURL); } $GLOBALS['RedirectPaging'] = rtrim($GLOBALS['RedirectPaging'], ' |'); $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "remote.php?remoteSection=redirects&w=getRedirectsTable&page=".$page, $sortField, $sortOrder); if($NumResults > 0) { // Display the redirects while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($redirectResult)) { $GLOBALS['RedirectId'] = $row['redirectid']; $GLOBALS['OldURL'] = $row['redirectpath']; $redirectManual = $row['redirectmanual']; if ($redirectManual == '') { $redirectManual = GetLang('ClickHereToEnterAURL'); } $GLOBALS['NewURL'] = $redirectManual; $GLOBALS['RedirectTypeAutoSelected'] = "selected='selected'"; $GLOBALS['RedirectTypeManualSelected'] = ''; $GLOBALS['RedirectTypeManualDisplay'] = "display: none;"; $GLOBALS['RedirectTypeAutoDisplay'] = ""; $GLOBALS['NewURLTitle'] = ''; $GLOBALS['LinkerTitle'] = GetLang('ChangeLink'); $GLOBALS['RedirectTestLink'] = GetConfig('ShopPath') . $row['redirectpath']; $row['redirectassoctype'] = (int)$row['redirectassoctype']; switch($row['redirectassoctype']) { case ISC_REDIRECTS::REDIRECT_TYPE_NOREDIRECT: case ISC_REDIRECTS::REDIRECT_TYPE_MANUAL: $GLOBALS['RedirectTypeManualSelected'] = "selected='selected'"; $GLOBALS['RedirectTypeAutoSelected'] = ""; $GLOBALS['RedirectTypeManualDisplay'] = ""; $GLOBALS['RedirectTypeAutoDisplay'] = "display: none;"; $GLOBALS['LinkerTitle'] = GetLang('BrowseForLink'); break; case ISC_REDIRECTS::REDIRECT_TYPE_PRODUCT: $urlInfo = ISC_URLS::getProductUrl($row['redirectassocid'], true); if(is_array($urlInfo) && !empty($urlInfo['title'])) { $GLOBALS['NewURL'] = $urlInfo['url']; $GLOBALS['NewURLTitle'] = GetLang('Product') . ': ' . $urlInfo['title']; } break; case ISC_REDIRECTS::REDIRECT_TYPE_CATEGORY: $urlInfo = ISC_URLS::getCategoryUrl($row['redirectassocid'], true); if(is_array($urlInfo) && !empty($urlInfo['title'])) { $GLOBALS['NewURL'] = $urlInfo['url']; $GLOBALS['NewURLTitle'] = GetLang('Category') . ': ' . $urlInfo['title']; } break; case ISC_REDIRECTS::REDIRECT_TYPE_BRAND: $urlInfo = ISC_URLS::getBrandUrl($row['redirectassocid'], true); if(is_array($urlInfo) && !empty($urlInfo['title'])) { $GLOBALS['NewURL'] = $urlInfo['url']; $GLOBALS['NewURLTitle'] = GetLang('Brand') . ': ' . $urlInfo['title']; } break; case ISC_REDIRECTS::REDIRECT_TYPE_PAGE: $urlInfo = ISC_URLS::getPageUrl($row['redirectassocid'], true); if(is_array($urlInfo) && !empty($urlInfo['title'])) { $GLOBALS['NewURL'] = $urlInfo['url']; $GLOBALS['NewURLTitle'] = GetLang('Page') . ': ' . $urlInfo['title']; } break; } $GLOBALS['RedirectsGrid'] .= $this->template->render('redirects.row.tpl'); } } return array($this->template->render('redirects.grid.tpl'), $NumResults); }
/** * Displays the edit template form * */ public function editEbayTemplate() { GetLib('class.json'); $templateId = (int)$_GET['templateId']; try { $template = new ISC_ADMIN_EBAY_TEMPLATE($templateId); $this->template->assign('templateId', $templateId); $this->template->assign('formTitle', GetLang('EditEbayTemplate')); $this->template->assign('hasStore', (bool)GetConfig('EbayStore')); $this->template->assign('ebaySites', $this->getSupportedSites()); $this->template->assign('siteId', $template->getSiteId()); $this->template->assign('templateName', $template->getTemplateName()); $this->template->assign('templateIsDefault', $template->isDefaultTemplate()); $this->template->assign('isPrivateListing', $template->isPrivateListing()); // setup category details $primaryCategoryOptions = $template->getPrimaryCategoryOptions(); $secondaryCategoryOptions = $template->getSecondaryCategoryOptions(); $this->template->assign('primaryCategory', $primaryCategoryOptions['path']); $this->template->assign('primaryCategoryOptions', ISC_JSON::encode($primaryCategoryOptions)); $this->template->assign('categoryOptions', $primaryCategoryOptions); $this->template->assign('sellingMethod', $template->getSellingMethod()); try { if (empty ($secondaryCategoryOptions)) { $secondaryCategoryId = $template->getSecondaryCategoryId(); if (!empty ($secondaryCategoryId)) { $secondaryCategoryOptions = ''; $secondaryCategoryOptions = ISC_ADMIN_EBAY_CATEGORIES::getCategoryFeatures($secondaryCategoryId, $template->getSiteId()); $categoryPath = ISC_ADMIN_EBAY_CATEGORIES::getFormattedCategoryPath($secondaryCategoryId, $template->getSiteId()); $secondaryCategoryOptions['path'] = $categoryPath; } else { $secondaryCategoryOptions = ISC_ADMIN_EBAY_CATEGORIES::getCategoryOptionsFromId($template->getSecondaryCategoryId(), $template->getSiteId()); } } } catch (Exception $ex) { $secondaryCategoryOptions = array( 'category_id' => $template->getSecondaryCategoryId(), 'name' => $template->getSecondaryCategoryName(), 'path' => $template->getSecondaryCategoryName(), ); } if ($secondaryCategoryOptions) { $this->template->assign('secondaryCategoryOptionsData', $secondaryCategoryOptions); $this->template->assign('secondaryCategory', $secondaryCategoryOptions['path']); } $secCatNotSupportVariations = (isset ($secondaryCategoryOptions['variations_supported']) && $secondaryCategoryOptions['variations_supported'] == 0); $this->template->assign('secCatSelectedNotSupportVariations', ($secCatNotSupportVariations)); $this->template->assign('secondaryCategoryOptions', ISC_JSON::encode($secondaryCategoryOptions)); $this->template->assign('categoryFeaturesList', $this->template->render('ebay.template.featureslist.tpl')); $primaryStoreCategoryOptions = array(); if ($template->getPrimaryStoreCategoryId()) { $primaryStoreCategoryOptions = array( 'category_id' => $template->getPrimaryStoreCategoryId(), 'name' => $template->getPrimaryStoreCategoryName(), 'path' => $template->getPrimaryStoreCategoryName(), ); $this->template->assign('primaryStoreCategory', $primaryStoreCategoryOptions['path']); } $this->template->assign('primaryStoreCategoryOptions', ISC_JSON::encode($primaryStoreCategoryOptions)); $secondaryStoreCategoryOptions = array(); if ($template->getSecondaryStoreCategoryId()) { $secondaryStoreCategoryOptions = array( 'category_id' => $template->getSecondaryStoreCategoryId(), 'name' => $template->getSecondaryStoreCategoryName(), 'path' => $template->getSecondaryStoreCategoryName(), ); $this->template->assign('secondaryStoreCategory', $secondaryStoreCategoryOptions['path']); } $this->template->assign('secondaryStoreCategoryOptions', ISC_JSON::encode($secondaryStoreCategoryOptions)); $this->template->assign('sellingMethod', $template->getSellingMethod()); } catch (Exception $ex) { FlashMessage($ex->getMessage(), MSG_ERROR, 'index.php?ToDo=viewEbay'); } $GLOBALS['BreadcrumEntries'][GetLang('EditEbayTemplate')] = 'index.php?ToDo=editEbayTemplate'; $this->engine->PrintHeader(); $this->template->display('ebay.template.form.tpl'); $this->engine->PrintFooter(); }