/** * Validate and save the exporter configuration. * * @param string Any error message encountered (passed back by reference) * @return mixed False on failure, if successful, array of configuration information to save. */ function SaveConfiguration(&$err) { if (!isset($_POST['path'])) { $err = GetLang('NoOsCommercePath'); return false; } if (isc_strpos($_POST['path'], 'http://') === 0 || isc_strpos($_POST['path'], 'https://') === 0) { $path = $this->URLToPath($_POST['path'], $err); if (!$path) { return false; } } else { $path = realpath(APP_ROOT . "/../" . $_POST['path']); $path = preg_replace("#[^a-z0-9\\./\\:]#i", "", $path); } if (!is_dir($path) || !file_exists($path . "/includes/configure.php")) { $err = sprintf(GetLang('InvalidOsCommercePath'), isc_html_escape($_POST['path']), isc_html_escape($_POST['path'])); return false; } else { // Grab the default OsCommerce language require $path . "/includes/configure.php"; $GLOBALS['OSCOMMERCE_DB'] =& new MySQLDB(); $connection = $GLOBALS['OSCOMMERCE_DB']->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); if (!$connection) { list($error, $level) = $db->GetError(); trigger_error($error, $level); } $query = "select languages_id from languages order by sort_order asc limit 1"; $result = $GLOBALS['OSCOMMERCE_DB']->Query($query); $language_id = $GLOBALS['OSCOMMERCE_DB']->FetchOne($result); return array("path" => $path, "language" => $language_id); } }
/** * Validate and save the exporter configuration. * * @param string Any error message encountered (passed back by reference) * @return mixed False on failure, if successful, array of configuration information to save. */ function SaveConfiguration(&$err) { if (!isset($_POST['xcart_path'])) { $err = GetLang('NoXCartPath'); return false; } if (isc_strpos($_POST['xcart_path'], 'http://') === 0 || isc_strpos($_POST['xcart_path'], 'https://') === 0) { $path = $this->URLToPath($_POST['xcart_path'], $err); if (!$path) { return false; } } else { $path = realpath(APP_ROOT . "/../" . $_POST['xcart_path']); $path = preg_replace("#[^a-z0-9\\./\\:]#i", "", $path); } if (!is_dir($path) || !file_exists($path . "/config.php")) { $err = sprintf(GetLang('InvalidXCartPath'), isc_html_escape($_POST['xcart_path']), isc_html_escape($_POST['xcart_path'])); return false; } else { // Grab the default X-Cart language if (!defined("XCART_START")) { define("XCART_START", 1); } $xcart_dir = $path; require $path . "/config.php"; $GLOBALS['XCART_DB'] =& new MySQLDB(); $connection = $GLOBALS['XCART_DB']->Connect($sql_host, $sql_user, $sql_password, $sql_db); // Modify the structure of the X-Cart customers table so we can store users' email addresses in it $GLOBALS['XCART_DB']->Query("ALTER TABLE xcart_customers CHANGE login login varchar(200) NOT NULL default ''"); return array("path" => $path, "blowfish_key" => $blowfish_key); } }
/** * Test the notification method by displaying a simple HTML form */ public function TestNotificationForm() { // Set some test variables $this->SetOrderId(99999); $this->SetOrderTotal(139.5); $this->SetOrderNumItems(3); // Send the email message $result = $this->SendNotification(); if ($result['outcome'] == "success") { $GLOBALS['Icon'] = "success"; // How many recipients was it sent to? if (is_numeric(isc_strpos($this->_email, ","))) { // There are multiple email addresses $tmp_emails = explode(",", $this->_email); $num_emails = count($tmp_emails); $success_msg = sprintf(GetLang('NEmailTestSuccessX'), $num_emails); } else { // Just one recipient $success_msg = GetLang('NEmailTestSuccess'); } $GLOBALS['EmailResultMessage'] = sprintf($success_msg, $this->_email); } else { $GLOBALS['Icon'] = "error"; $GLOBALS['EmailResultMessage'] = sprintf(GetLang('NEmailTestFail'), $this->_email, $result['message']); } $this->ParseTemplate("module.email.test"); }
/** * Convert a redis-like key pattern to mysql =, LIKE or REGEXP syntax * * @param string $pattern * @return string */ protected function redisPatternToMysql($pattern) { // incoming key patterns are redis-like, convert to mysql equivalent if ($pattern == '*') { // shortcut to all keys return ''; } if (isc_strpos($pattern, '[') !== false && isc_strpos($pattern, ']') !== false) { // need to use regex $pattern = "^" .strtr($pattern, array( '*' => '.*', '?' => '.', )) . "$"; $pattern = "REGEXP '" . $this->db->Quote($pattern) . "'"; } else if (isc_strpos($pattern, '*') !== false || isc_strpos($pattern, '?') !== false) { // no [character] specifiers, can use LIKE $pattern = strtr($pattern, array( '%' => '\%', '_' => '\_', '*' => '%', '?' => '_', )); $pattern = "LIKE '" . $this->db->Quote($pattern) . "'"; } else { // no pattern specified, can use = $pattern = "= '" . $this->db->Quote($pattern) . "'"; } return $pattern; }
/** * Check if a particular addon module is enabled. * * @param string The ID of the addon module. * @return boolean True if the addon is enabled, false if not. */ function AddonsModuleIsEnabled($id) { if (is_numeric(isc_strpos(GetConfig('AddonModules'), $id))) { return true; } else { return false; } }
/** * Validate and save the importer configuration. * * @param string Any error message encountered (passed back by reference) * @return mixed False on failure, if successful, array of configuration information to save. */ function SaveConfiguration(&$err) { if (!isset($_POST['path'])) { $err = GetLang('NoZenCartPath'); return false; } if (isc_strpos($_POST['path'], 'http://') === 0 || isc_strpos($_POST['path'], 'https://') === 0) { $path = $this->URLToPath($_POST['path'], $err); if (!$path) { return false; } } else { $path = realpath(APP_ROOT . "/../" . $_POST['path']); $path = preg_replace("#[^a-z0-9\\./\\:]#i", "", $path); } if (!is_dir($path) || !file_exists($path . "/includes/configure.php")) { $err = sprintf(GetLang('InvalidZenCartPath'), isc_html_escape($_POST['path']), isc_html_escape($_POST['path'])); return false; } else { // Grab the default ZenCart language require $path . "/includes/configure.php"; if (!defined('DB_PREFIX')) { define('DB_PREFIX', ''); } $GLOBALS['ZENCART_DB'] = new MySQLDB(); $GLOBALS['ZENCART_DB']->TablePrefix = DB_PREFIX; $connection = $GLOBALS['ZENCART_DB']->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); if (!$connection) { list($error, $level) = $db->GetError(); trigger_error($error, $level); } $query = "select languages_id from [|PREFIX|]languages order by sort_order asc limit 1"; $result = $GLOBALS['ZENCART_DB']->Query($query); $language_id = $GLOBALS['ZENCART_DB']->FetchOne($result); // Get the collation/character set of one of the ZenCart tables to use as a base $query = "SHOW CREATE TABLE [|PREFIX|]customers"; $result = $GLOBALS['ZENCART_DB']->Query($query); $tableStructure = $GLOBALS['ZENCART_DB']->Fetch($result); $tableStructure = array_pop($tableStructure); $chartset = ''; preg_match("#CHARSET=([a-zA-Z0-9_]+)\\s?#i", $tableStructure, $matches); if (isset($matches[1]) && $matches[1] != '') { $charset = $matches[1]; } return array("path" => $path, "language" => $language_id, "charset" => $charset); } }
/** * Validate and save the exporter configuration. * * @param string Any error message encountered (passed back by reference) * @return mixed False on failure, if successful, array of configuration information to save. */ function SaveConfiguration(&$err) { if (!isset($_POST['cubecart4_path'])) { $err = GetLang('NoCubeCartPath'); return false; } if (isc_strpos($_POST['cubecart4_path'], 'http://') === 0 || isc_strpos($_POST['cubecart4_path'], 'https://') === 0) { $path = $this->URLToPath($_POST['cubecart4_path'], $err); if (!$path) { return false; } } else { $path = realpath(APP_ROOT . "/../" . $_POST['cubecart4_path']); $path = preg_replace("#[^a-z0-9\\./\\:]#i", "", $path); } if (!is_dir($path) || !file_exists($path . "/includes/global.inc.php")) { $err = sprintf(GetLang('InvalidCubeCartPath'), isc_html_escape($_POST['cubecart4_path']), isc_html_escape($_POST['cubecart4_path'])); return false; } else { return array("path" => $path); } }
/** * Send the order notification SMS text message */ public function SendNotification() { // Load up the variables for the SMS gateway $this->_username = $this->GetValue("username"); $this->_password = $this->GetValue("password"); $this->_cellnumber = $this->GetValue("cellnumber"); $this->_message = $this->BuildSmsMessage(); $sms_url = sprintf("http://www.smsglobal.com.au/http-api.php?action=sendsms&user=%s&password=%s&from=%s&to=%s&clientcharset=UTF-8&text=%s", $this->_username, $this->_password, $this->_cellnumber, $this->_cellnumber, urlencode($this->_message)); // Let's try to send the message $result = PostToRemoteFileAndGetResponse($sms_url); if (is_numeric(isc_strpos($result, "OK"))) { $result = array("outcome" => "success", "message" => sprintf(GetLang('SMSNotificationSentNumber'), $this->_cellnumber)); } else { // The message couldn't be sent. Do they have enough credit? $low_balance = false; $bal_url = sprintf("http://www.smsglobal.com.au/http-api.php?action=balancesms&user=%s&password=%s", $this->_username, $this->_password); $bal_result = PostToRemoteFileAndGetResponse($bal_url); // SMSGlobal returns the balance in the format: BALANCE: 0.0999999; USER: johndoe $bal_data = explode(";", $bal_result); if (is_array($bal_data) && count($bal_data) > 1) { $bal_data_1 = explode(":", $bal_data[0]); if (is_array($bal_data_1)) { $balance = floor((int) trim($bal_data_1[1])); if ($balance == 0) { $low_balance = true; } } } if ($low_balance) { $error_message = GetLang('SMSZeroBalance'); } else { $error_message = $bal_result; } $result = array("outcome" => "fail", "message" => $error_message); } return $result; }
public function ManageBackups($MsgDesc = "", $MsgStatus = "") { if(isset($_GET['complete'])) { $MsgStatus = MSG_SUCCESS; if($_GET['complete'] == "remote") { $MsgDesc = GetLang('RemoteBackupComplete'); } else { $MsgDesc = sprintf(GetLang('LocalBackupComplete'), $_GET['complete']); } } else if(isset($_GET['failed'])) { $MsgStatus = MSG_ERROR; if($_GET['failed'] == 'local') { $MsgDesc = GetLang('LocalBackupFailed'); } else { $MsgDesc = GetLang('RemoteBackupFailed'); } } if($MsgDesc != "") { $GLOBALS["Message"] = MessageBox($MsgDesc, $MsgStatus); } $dir = realpath(ISC_BACKUP_DIRECTORY); $dir = isc_substr($dir, isc_strpos($dir, realpath(ISC_BASE_PATH))); $backups = $this->_GetBackupList(); $GLOBALS['BackupGrid'] = ''; // Loop through all of the existing backups foreach($backups as $file => $details) { $GLOBALS['FileName'] = isc_html_escape($file); $GLOBALS['ModifiedTime'] = Store_DateTime::niceTime($details['mtime']); if(isset($details['directory'])) { $GLOBALS['FileSize'] = "N/A"; $GLOBALS['DownloadOpen'] = GetLang('OpenBackup'); $GLOBALS['BackupImage'] = "backup_folder"; $GLOBALS['BackupType'] = GetLang('BackupFolder'); $GLOBALS['ViewLink'] = "backups/" . $GLOBALS['FileName']; } else { $GLOBALS['FileSize'] = Store_Number::niceSize($details['size']); $GLOBALS['DownloadOpen'] = GetLang('DownloadBackup'); $GLOBALS['BackupImage'] = "backup"; $GLOBALS['BackupType'] = GetLang('BackupFile'); $GLOBALS['ViewLink'] = "index.php?ToDo=viewBackup&file=" . $GLOBALS['FileName']; } $GLOBALS["BackupGrid"] .= $this->template->render('backup.manage.row.tpl'); } if($GLOBALS['BackupGrid'] == "") { $GLOBALS['DisplayGrid'] = "none"; $GLOBALS["Message"] = MessageBox(GetLang('NoBackups'), MSG_SUCCESS); $GLOBALS["DisableDelete"] = "DISABLED"; } $this->template->display('backups.manage.tpl'); }
/** * ExportCSV * Grab all products and create the CSV file to output * * @return Void */ public function ExportCSV() { $this->init(); $cat_ids = ""; $csv = ""; if(isset($_POST['category']) && isset($_POST['title']) && isset($_POST['desc1']) && isset($_POST['desc2']) && isset($_POST['displayurl']) && isset($_POST['destinationurl'])) { $all_fields = $_POST['title'] . $_POST['desc1'] . $_POST['desc2'] . $_POST['displayurl'] . $_POST['destinationurl']; if(count($_POST['category']) == 1 && in_array(0, $_POST['category'])) { // Export all products } else { // Only export the selected categories foreach($_POST['category'] as $cat_id) { if($cat_id != 0) { $cat_ids .= $cat_id . ","; } } $cat_ids = rtrim($cat_ids, ","); } $query = "select p.productid, p.prodname, p.tax_class_id "; // Do we need to get the product's brand? if(is_numeric(isc_strpos($all_fields, "{PRODBRAND}"))) { $query .= "(select brandname from [|PREFIX|]brands where brandid=p.prodbrandid) as prodbrand"; } // Do we need to get the product's summary? if(is_numeric(isc_strpos($all_fields, "{PRODSUMMARY}"))) { //$query .= "substring(proddesc from 1 for 100) as prodsummary, "; $query .= ", proddesc as prodsummary "; } // Do we need to get the product's price? if(is_numeric(isc_strpos($all_fields, "{PRODPRICE}"))) { $query .= ", p.prodcalculatedprice as prodprice "; } // Do we need to get the product's SKU? if(is_numeric(isc_strpos($all_fields, "{PRODSKU}"))) { $query .= ", p.prodcode as prodsku "; } // Do we need to get the product's category? if(is_numeric(isc_strpos($all_fields, "{PRODCAT}"))) { $query .= "(select catname from [|PREFIX|]categoryassociations ca inner join [|PREFIX|]categories c on ca.categoryid=c.categoryid where ca.productid=p.productid limit 1) as prodcat "; } $cat_ids = rtrim($cat_ids, ", "); $query .= " from [|PREFIX|]products p "; // Do we need to filter on category? if($cat_ids != "") { $query .= sprintf("inner join [|PREFIX|]categoryassociations ca on p.productid=ca.productid where ca.categoryid in (%s)", $cat_ids); } // Build the headers for the CSV file $csv .= $this->_HeaderRow(); // Build the campaign row $csv .= $this->_CampaignRow(); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $csv .= $this->_CreateRecord($row); } // Flush the buffer ob_end_clean(); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"ysm-".isc_date("Y-m-d").".csv\";"); header("Content-Length: " . strlen($csv)); echo $csv; // Let the parent class know the addon's just been executed parent::LogAction(); exit; } else { // Bad form details $GLOBALS['ErrorTitle'] = GetLang('Oops'); $GLOBALS['Message'] = MessageBox(GetLang('YSMBadFormDetails'), MSG_ERROR); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("error"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); } }
private function GetQuote() { // The following array will be returned to the calling function. // It will contain at least one ISC_SHIPPING_QUOTE object if // the shipping quote was successful. $usps_quote = array(); $origincountry = $this->GetCountry($this->_origincountry); $destcountry = $this->GetCountry($this->_destcountry); // Is this an international quote? if ($origincountry != $destcountry) { $this->_api = "IntlRate"; } else { $this->_api = "RateV3"; } // Build the start of the USPS XML query - password can be anything but empty $usps_xml = sprintf("<%sRequest USERID=\"%s\">", $this->_api, $this->_username); $usps_xml .= "<Package ID=\"0\">"; // Which server are we shipping with? if ($this->_service == "PARCEL") { $usps_xml .= "<Service>PARCEL</Service>"; } else { $usps_xml .= sprintf("<Service>%s</Service>", $this->_service); } if ($this->_service == "FIRST CLASS" || $this->_service == "PARCEL") { $usps_xml .= "<FirstClassMailType>PARCEL</FirstClassMailType>"; } // get the amount of pounds $fractional_pounds = ConvertWeight($this->_weight, 'pounds'); $pounds = floor($fractional_pounds); // get the amount of ounces for the fractional remainder $ounces = round(ConvertWeight($fractional_pounds - $pounds, 'ounces', 'pounds'), 3); $weight_xml = sprintf("<Pounds>%s</Pounds>", $pounds); $weight_xml .= sprintf("<Ounces>%s</Ounces>", $ounces); // Must output weight before mailtype for international if ($this->_api == "IntlRate") { $usps_xml .= $weight_xml; } if ($this->_api == "IntlRate") { $usps_xml .= "<MailType>Package</MailType>"; $usps_xml .= sprintf("<Country>%s</Country>", $destcountry); } else { $usps_xml .= sprintf("<ZipOrigination>%s</ZipOrigination>", $this->_originzip); $usps_xml .= sprintf("<ZipDestination>%s</ZipDestination>", $this->_destzip); } // Must output weight after mailtype for domestic if ($this->_api != "IntlRate") { $usps_xml .= $weight_xml; } // Which container to use depends on which method was chosen switch ($this->_service) { case "EXPRESS": $this->_container = $this->_expressmailcontainertype; $this->_size = $this->_expressmailpackagesize; break; case "FIRST CLASS": $this->_container = $this->_firstclasscontainertype; $this->_size = $this->_firstclasspackagesize; break; case "PRIORITY": $this->_container = $this->_prioritycontainertype; $this->_size = $this->_prioritypackagesize; break; case "PARCEL": $this->_size = $this->_parcelpostmachpackagesize; break; case "BPM": $this->_size = $this->_bpmpackagesize; break; case "LIBRARY": $this->_size = $this->_librarypackagesize; break; case "MEDIA": $this->_size = $this->_mediapackagesize; break; } $this->_container = $this->GetContainerType($this->_container); $this->_size = $this->GetContainerSize($this->_size); $usps_xml .= sprintf("<Container>%s</Container>", $this->_container); $usps_xml .= sprintf("<Size>%s</Size>", $this->_size); if ($this->_service == "PRIORITY" && $this->_size == "LARGE") { $usps_xml .= sprintf("<Width>%s</Width>", number_format(ConvertLength($this->_prioritywidth, "in"), 2)); $usps_xml .= sprintf("<Length>%s</Length>", number_format(ConvertLength($this->_prioritylength, "in"), 2)); $usps_xml .= sprintf("<Height>%s</Height>", number_format(ConvertLength($this->_priorityheight, "in"), 2)); if ($this->_prioritygirth > 0) { $usps_xml .= sprintf("<Girth>%s</Girth>", ConvertLength($this->_prioritygirth, "in")); } } // Add the Machinable element if it's a parcel post if ($this->_service == "PARCEL") { $usps_xml .= "<Machinable>true</Machinable>"; } $usps_xml .= "</Package>"; $usps_xml .= sprintf("</%sRequest>", $this->_api); // If it's an international quote then we'll strip out // the service, container and size elements if ($this->_api == "IntlRate") { $usps_xml = preg_replace("#<Service>(.*)</Service>#si", "", $usps_xml); $usps_xml = preg_replace("#<Container>(.*)</Container>#si", "", $usps_xml); $usps_xml = preg_replace("#<Size>(.*)</Size>#si", "", $usps_xml); $usps_xml = preg_replace("#<Width>(.*)</Width>#si", "", $usps_xml); $usps_xml = preg_replace("#<Length>(.*)</Length>#si", "", $usps_xml); $usps_xml = preg_replace("#<Height>(.*)</Height>#si", "", $usps_xml); $usps_xml = preg_replace("#<Girth>(.*)</Girth>#si", "", $usps_xml); $usps_xml = preg_replace("#<FirstClassMailType>(.*)</FirstClassMailType>#si", "", $usps_xml); $usps_xml = preg_replace("#<Machinable>(.*)</Machinable>#si", "", $usps_xml); } // Connect to USPS to retrieve a live shipping quote $result = ""; $valid_quote = false; // Should we test on the test or production server? $usps_mode = $this->GetValue("servertype"); if ($usps_mode == "test") { $usps_url = "http://testing.shippingapis.com/ShippingAPITest.dll?"; } else { $usps_url = "http://production.shippingapis.com/ShippingAPI.dll?"; } $post_vars = implode("&", array("API={$this->_api}", "XML={$usps_xml}")); if (function_exists("curl_exec")) { // Use CURL if it's available $ch = @curl_init($usps_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Setup the proxy settings if there are any if (GetConfig('HTTPProxyServer')) { curl_setopt($ch, CURLOPT_PROXY, GetConfig('HTTPProxyServer')); if (GetConfig('HTTPProxyPort')) { curl_setopt($ch, CURLOPT_PROXYPORT, GetConfig('HTTPProxyPort')); } } if (GetConfig('HTTPSSLVerifyPeer') == 0) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } $result = curl_exec($ch); if ($result != "") { $valid_quote = true; } } $this->DebugLog($result); if ($valid_quote) { // Was the user authenticated? if (is_numeric(isc_strpos($result, "Authorization failure"))) { $this->SetError(GetLang('USPSAuthError')); return false; } else { $xml = xmlize($result); // Are we dealing with a domestic or international shipment? if (isset($xml['RateV3Response'])) { // Domestic if (is_numeric(isc_strpos($result, "Error"))) { // Bad quote $this->SetError($xml['RateV3Response']["#"]['Package'][0]["#"]['Error'][0]["#"]['Description'][0]["#"]); return false; } else { // Create a quote object $quote = new ISC_SHIPPING_QUOTE($this->GetId(), $this->GetDisplayName(), $xml['RateV3Response']["#"]['Package'][0]["#"]['Postage'][0]["#"]['Rate'][0]["#"], $xml['RateV3Response']["#"]['Package'][0]["#"]['Postage'][0]["#"]['MailService'][0]["#"]); return $quote; } } else { if (isset($xml['IntlRateResponse'])) { // International if (is_numeric(isc_strpos($result, "Error"))) { // Bad quote $this->SetError($xml['IntlRateResponse']["#"]['Package'][0]["#"]['Error'][0]["#"]['Description'][0]["#"]); return false; } else { // Success $QuoteList = array(); $USPSServices = $xml['IntlRateResponse']["#"]['Package'][0]["#"]['Service']; // get the list of enabled services $services = $this->GetIntlServices($this->_service); foreach ($USPSServices as $Service) { $serviceId = $Service['@']['ID']; // check if this service is enabled if (!in_array($serviceId, $services)) { continue; } // Create a quote object $quote = new ISC_SHIPPING_QUOTE($this->GetId(), $this->GetDisplayName(), $Service["#"]['Postage'][0]["#"], GetLang('USPSIntlService_' . $serviceId)); //save quotes in an array $QuoteList[] = $quote; } return $QuoteList; } } else { if (isset($xml['Error'])) { // Error $this->SetError($xml['Error']["#"]['Description'][0]["#"]); return false; } } } } } else { // Couldn't get to USPS $this->SetError(GetLang('USPSOpenError')); return false; } }
/** * _BuildTabMenu * Build the menu of tabs that appears at the top of the control panel * * @return String */ private function _BuildTabMenu() { $menu = ""; // Get an array of permissions for the selected user $arrPermissions = $GLOBALS["ISC_CLASS_ADMIN_AUTH"]->GetPermissions(); $show_manage_products = in_array(AUTH_Manage_Products, $arrPermissions) || in_array(AUTH_Manage_Reviews, $arrPermissions) || in_array(AUTH_Create_Product, $arrPermissions) || in_array(AUTH_Import_Products, $arrPermissions); $show_manage_categories = in_array(AUTH_Manage_Categories, $arrPermissions) || in_array(AUTH_Create_Category, $arrPermissions); $show_manage_orders = in_array(AUTH_Manage_Orders, $arrPermissions) || in_array(AUTH_Add_Orders, $arrPermissions) || in_array(AUTH_Export_Orders, $arrPermissions) || in_array(AUTH_Manage_Returns, $arrPermissions); $show_import_tracking_number = in_array(AUTH_Manage_Orders, $arrPermissions) && in_array(AUTH_Import_Order_Tracking_Numbers, $arrPermissions) && gzte11(ISC_MEDIUMPRINT); $show_manage_customers = in_array(AUTH_Manage_Customers, $arrPermissions) || in_array(AUTH_Add_Customer, $arrPermissions) || in_array(AUTH_Import_Customers, $arrPermissions); $menuItems = array ( 'mnuOrders' => array ( 'match' => array('order', 'shipment'), 'items' => array( array ( 'id' => 'SubMenuViewOrders', 'text' => GetLang('ViewOrders'), 'help' => GetLang('ViewOrdersMenuHelp'), 'link' => 'index.php?ToDo=viewOrders', 'show' => $show_manage_orders, ), array ( 'id' => 'SubMenuAddAnOrder', 'text' => GetLang('AddAnOrder'), 'help' => GetLang('AddOrderMenuHelp'), 'link' => 'index.php?ToDo=addOrder', 'show' => in_array(AUTH_Add_Orders, $arrPermissions), ), array ( 'id' => 'SubMenuSearchOrders', 'text' => GetLang('SearchOrders'), 'help' => GetLang('SearchOrdersMenuHelp'), 'link' => 'index.php?ToDo=searchOrders', 'show' => $show_manage_orders, ), array ( 'id' => 'SubMenuExportOrders', 'text' => GetLang('ExportOrdersMenu'), 'help' => GetLang('ExportOrdersMenuHelp'), 'link' => 'index.php?ToDo=startExport&t=orders', 'show' => in_array(AUTH_Export_Orders, $arrPermissions) && gzte11(ISC_MEDIUMPRINT) ), array( 'id' => 'SubMenuViewShipments', 'text' => GetLang('ViewShipments'), 'help' => GetLang('ViewShipmentsHelp'), 'link' => 'index.php?ToDo=viewShipments', 'show' => $show_manage_orders ), array ( 'id' => 'SubMenuViewReturns', 'text' => GetLang('ViewReturns'), 'help' => GetLang('ViewReturnsMenuHelp'), 'link' => 'index.php?ToDo=viewReturns', 'show' => in_array(AUTH_Manage_Returns, $arrPermissions) && GetConfig('EnableReturns') && gzte11(ISC_LARGEPRINT), ), array ( 'id' => 'SubMenuImportTrackingNum', 'text' => GetLang('ImportOrdertrackingnumbers'), 'help' => GetLang('ImportOrdertrackingnumbersMenuHelp'), 'link' => 'index.php?ToDo=importOrdertrackingnumbers', 'show' => $show_import_tracking_number, ), ), ), 'mnuCustomers' => array ( 'match' => 'customer', 'items' => array( array ( 'id' => 'SubMenuViewCustomers', 'text' => GetLang('ViewCustomers'), 'help' => GetLang('ViewCustomersMenuHelp'), 'link' => 'index.php?ToDo=viewCustomers', 'show' => $show_manage_customers, ), array ( 'id' => 'SubMenuAddCustomers', 'text' => GetLang('AddCustomers'), 'help' => GetLang('AddCustomersMenuHelp'), 'link' => 'index.php?ToDo=addCustomer', 'show' => in_array(AUTH_Add_Customer, $arrPermissions), ), array ( 'id' => 'SubMenuCustomerGroups', 'text' => GetLang('CustomerGroups'), 'help' => GetLang('CustomerGroupsMenuHelp'), 'link' => 'index.php?ToDo=viewCustomerGroups', 'show' => in_array(AUTH_Customer_Groups, $arrPermissions) && gzte11(ISC_MEDIUMPRINT), ), array ( 'id' => 'SubMenuSearchCustomers', 'text' => GetLang('SearchCustomers'), 'help' => GetLang('SearchCustomersMenuHelp'), 'link' => 'index.php?ToDo=searchCustomers', 'show' => $show_manage_customers, ), array ( 'id' => 'SubMenuImportCustomers', 'text' => GetLang('ImportCustomers'), 'help' => GetLang('ImportCustomersMenuHelp'), 'link' => 'index.php?ToDo=importCustomers', 'show' => in_array(AUTH_Import_Customers, $arrPermissions), ), array ( 'id' => 'SubMenuExportCustomers', 'text' => GetLang('ExportCustomersMenu'), 'help' => GetLang('ExportCustomersMenuHelp'), 'link' => 'index.php?ToDo=startExport&t=customers', 'show' => in_array(AUTH_Export_Customers, $arrPermissions) && gzte11(ISC_MEDIUMPRINT) ), ), ), 'mnuProducts' => array ( 'match' => array('product', 'review', 'categor', 'brand'), 'items' => array( array ( 'id' => 'SubMenuViewProducts', 'text' => GetLang('ViewProducts'), 'help' => GetLang('ViewProductsMenuHelp'), 'link' => 'index.php?ToDo=viewProducts', 'show' => $show_manage_products, ), array ( 'id' => 'SubMenuAddProduct', 'text' => GetLang('AddProduct'), 'help' => GetLang('AddProductMenuHelp'), 'link' => 'index.php?ToDo=addProduct', 'show' => in_array(AUTH_Create_Product, $arrPermissions), ), array ( 'id' => 'SubMenuViewCategories', 'text' => GetLang('ViewCategories'), 'help' => GetLang('ViewCategoriesMenuHelp'), 'link' => 'index.php?ToDo=viewCategories', 'show' => $show_manage_categories, ), array ( 'id' => 'SubMenuProductVariations', 'text' => GetLang('ProductVariations'), 'help' => GetLang('ProductVariationsMenuHelp'), 'link' => 'index.php?ToDo=viewProductVariations', 'show' => in_array(AUTH_Manage_Variations, $arrPermissions), ), array ( 'id' => 'SubMenuSearchProducts', 'text' => GetLang('SearchProducts'), 'help' => GetLang('SearchProductsMenuHelp'), 'link' => 'index.php?ToDo=searchProducts', 'show' => $show_manage_products, ), array ( 'id' => 'SubMenuImportProducts', 'text' => GetLang('ImportProducts'), 'help' => GetLang('ImportProductsMenuHelp'), 'link' => 'index.php?ToDo=importProducts', 'show' => in_array(AUTH_Import_Products, $arrPermissions), ), array ( 'id' => 'SubMenuImportProductVariations', 'text' => GetLang('ImportProductVariations'), 'help' => GetLang('ImportProductVariationsHelp'), 'link' => 'index.php?ToDo=importProductVariations', 'show' => in_array(AUTH_Import_Products, $arrPermissions), ), array ( 'id' => 'SubMenuExportProducts', 'text' => GetLang('ExportProductsMenu'), 'help' => GetLang('ExportProductsMenuHelp'), 'link' => 'index.php?ToDo=startExport&t=products', 'show' => in_array(AUTH_Export_Products, $arrPermissions) && gzte11(ISC_MEDIUMPRINT) ), array ( 'id' => 'SubMenuManageReviews', 'text' => GetLang('ManageReviews'), 'help' => GetLang('ViewReviewsMenuHelp'), 'link' => 'index.php?ToDo=viewReviews', 'show' => in_array(AUTH_Manage_Reviews, $arrPermissions), ), array ( 'id' => 'SubMenuViewBrands', 'text' => GetLang('ViewBrands'), 'help' => GetLang('ViewBrandsHelp'), 'link' => 'index.php?ToDo=viewBrands', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions), ), ), ), 'mnuContent' => array ( 'match' => array('news', 'page'), 'ignore' => array('vendor'), 'items' => array( array ( 'id' => 'SubMenuViewNews', 'text' => GetLang('ViewNews'), 'help' => GetLang('ViewNewsMenuHelp'), 'link' => 'index.php?ToDo=viewNews', 'show' => in_array(AUTH_Manage_News, $arrPermissions), ), array ( 'id' => 'SubMenuAddNews', 'text' => GetLang('AddNews'), 'help' => GetLang('AddNewsMenuHelp'), 'link' => 'index.php?ToDo=addNews', 'show' => in_array(AUTH_Manage_News, $arrPermissions), ), array ( 'id' => 'SubMenuViewWebPages', 'text' => GetLang('ViewWebPages'), 'help' => GetLang('ViewWebPagesMenuHelp'), 'link' => 'index.php?ToDo=viewPages', 'show' => in_array(AUTH_Manage_Pages, $arrPermissions), ), array ( 'id' => 'SubMenuCreateAWebPage', 'text' => GetLang('CreateAWebPage'), 'help' => GetLang('CreateWebPageMenuHelp'), 'link' => 'index.php?ToDo=createPage', 'show' => in_array(AUTH_Manage_Pages, $arrPermissions), ), array ( 'id' => 'SubMenuImageManager', 'text' => GetLang('ImageManagerMenu'), 'help' => GetLang('ImageManagerMenuIntro'), 'link' => 'index.php?ToDo=manageImages', 'show' => in_array(AUTH_Manage_Images, $arrPermissions) ) ), ), 'mnuMarketing' => array ( 'match' => array('coupon', 'banner', 'discount', 'giftcertificates', 'optimizer', 'comparison', 'ebay', 'emailintegration'), 'items' => array( array( 'id' => 'SubMenuEmailIntegration', 'text' => GetLang('EmailMarketing'), 'help' => GetLang('EmailMarketingMenuHelp'), 'link' => 'index.php?ToDo=viewEmailIntegrationSettings', 'show' => in_array(AUTH_Manage_EmailMarketing, $arrPermissions), ), array ( 'id' => 'SubMenuShoppingComparison', 'text' => GetLang('ShoppingComparisonSites'), 'help' => GetLang('ShoppingComparisonMenuHelp'), 'link' => 'index.php?ToDo=viewShoppingComparison', 'show' => true ), array ( 'id' => 'SubMenuViewEbay', 'text' => GetLang('ViewEbay'), 'help' => GetLang('ViewEbayMenuHelp'), 'link' => 'index.php?ToDo=viewEbay', 'show' => in_array(AUTH_Ebay_Selling, $arrPermissions) && gzte11(ISC_LARGEPRINT), ), array ( 'id' => 'SubMenuViewBanners', 'text' => GetLang('ViewBanners'), 'help' => GetLang('ViewBannersMenuHelp'), 'link' => 'index.php?ToDo=viewBanners', 'show' => in_array(AUTH_Manage_Banners, $arrPermissions), ), array ( 'id' => 'SubMenuViewCoupons', 'text' => GetLang('ViewCoupons'), 'help' => GetLang('ViewCouponsMenuHelp'), 'link' => 'index.php?ToDo=viewCoupons', 'show' => in_array(AUTH_Manage_Coupons, $arrPermissions), ), array ( 'id' => 'SubMenuGoogleWebsiteOptimizer', 'text' => GetLang('GoogleWebsiteOptimizer'), 'help' => GetLang('GoogleWebsiteOptimizerHelp'), 'link' => 'index.php?ToDo=manageOptimizer', 'show' => in_array(AUTH_Website_Optimizer, $arrPermissions), ), array ( 'id' => 'SubMenuCreateFroogleFeed', 'text' => GetLang('CreateFroogleFeed'), 'help' => GetLang('GoogleProductsFeedMenuHelp'), 'link' => 'javascript:Common.ExportGoogleBase()', 'show' => in_array(AUTH_Export_Froogle, $arrPermissions), ), array ( 'id' => 'SubMenuViewDiscounts', 'text' => GetLang('ViewDiscounts'), 'help' => GetLang('ViewDiscountsMenuHelp'), 'link' => 'index.php?ToDo=viewDiscounts', 'show' => in_array(AUTH_Manage_Discounts, $arrPermissions) && gzte11(ISC_MEDIUMPRINT), ), array ( 'id' => 'SubMenuViewGiftCertificates', 'text' => GetLang('ViewGiftCertificates'), 'help' => GetLang('ViewGiftCertificatesMenuHelp'), 'link' => 'index.php?ToDo=viewGiftCertificates', 'show' => in_array(AUTH_Manage_GiftCertificates, $arrPermissions) && gzte11(ISC_LARGEPRINT), ), array ( 'id' => 'SubMenuGoogleSitemap', 'text' => GetLang('GoogleSitemap'), 'help' => GetLang('GoogleSitemapHelp'), 'link' => 'javascript:Common.DisplayGoogleSitemapInfo()', 'show' => in_array(AUTH_View_XMLSitemap, $arrPermissions), ), ), ), 'mnuStatistics' => array ( 'match' => 'stats', 'items' => array( array ( 'id' => 'SubMenuStoreOverview', 'text' => GetLang('StoreOverview'), 'help' => GetLang('StoreOverviewMenuHelp'), 'link' => 'index.php?ToDo=viewStats', 'show' => in_array(AUTH_Statistics_Overview, $arrPermissions), ), array ( 'id' => 'SubMenuOrderStatistics', 'text' => GetLang('OrderStatistics'), 'help' => GetLang('OrderStatsMenuHelp'), 'link' => 'index.php?ToDo=viewOrdStats', 'show' => in_array(AUTH_Statistics_Orders, $arrPermissions), ), array ( 'id' => 'SubMenuProductStatistics', 'text' => GetLang('ProductStatistics'), 'help' => GetLang('ProductStatsMenuHelp'), 'link' => 'index.php?ToDo=viewProdStats', 'show' => in_array(AUTH_Statistics_Products, $arrPermissions), ), array ( 'id' => 'SubMenuCustomerStatistics', 'text' => GetLang('CustomerStatistics'), 'help' => GetLang('CustomerStatsMenuHelp'), 'link' => 'index.php?ToDo=viewCustStats', 'show' => in_array(AUTH_Statistics_Customers, $arrPermissions), ), array ( 'id' => 'SubMenuSearchStatistics', 'text' => GetLang('SearchStatistics'), 'help' => GetLang('SearchStatsHelp'), 'link' => 'index.php?ToDo=viewSearchStats', 'show' => in_array(AUTH_Statistics_Search, $arrPermissions), ), ), ), ); // Now that we've loaded the default menu, let's check if there are any addons we need to load $this->_LoadAddons($menuItems); $imagesDir = dirname(__FILE__).'/../../images'; $menu = "\n".'<div id="Menu">'."\n".'<ul>'."\n"; foreach ($menuItems as $tabName => $link) { // By default we wont highlight this tab $highlight_tab = false; if ($link['match'] && isset($_REQUEST['ToDo'])) { // If the URI matches the "match" index, we'll highlight the tab $page = @isc_strtolower($_REQUEST['ToDo']); if(isset($GLOBALS['HighlightedMenuItem']) && $GLOBALS['HighlightedMenuItem'] == $tabName) { $highlight_tab = true; } // Does it need to match mutiple words? if (is_array($link['match'])) { foreach ($link['match'] as $match_it) { if ($match_it == "") { continue; } if (is_numeric(isc_strpos($page, isc_strtolower($match_it)))) { $highlight_tab = true; } } } else { if (is_numeric(isc_strpos($page, $link['match']))) { $highlight_tab = true; } } if(isset($link['ignore']) && is_array($link['ignore'])) { foreach($link['ignore'] as $ignore) { if(isc_strpos($page, strtolower($ignore)) !== false) { $highlight_tab = false; } } } } // If the menu has sub menus, display them if (is_array($link['items'])) { $firstItem = true; $mainMenuLink = ''; $subMenuList = ''; foreach ($link['items'] as $id => $sub) { if (is_numeric($id)) { // If the child is forbidden by law, hide it if (@!$sub['show']) { continue; } if($firstItem) { //make the main menu link as the first menu item $mainMenuLink = $sub['link']; $firstItem = false; } $GLOBALS['SubMenuId'] = $sub['id']; $GLOBALS['SubMenuURL'] = $sub['link']; $GLOBALS['SubMenuName'] = $sub['text']; $GLOBALS['SubMenuText'] = $sub['help']; $GLOBALS['ExtraClass'] = ''; if (isset($sub['class'])) { $GLOBALS['ExtraClass'] = $sub['class']; } $this->template->assign('menuItem', $sub); $subMenuList .= $this->template->render('Snippets/SubMenuItem.html'); } } //if at list one if($mainMenuLink != '') { if($subMenuList != '') { $GLOBALS['SubMenuList']="<ul style='display:none'>".$subMenuList."</ul>"; } $GLOBALS['MenuTabId'] = $tabName; $GLOBALS['MenuActive'] = ''; if ($highlight_tab) { $GLOBALS['MenuActive'] = "Active"; } $GLOBALS['MenuURL'] = $mainMenuLink; $menuLangVar = str_replace('mnu', '', $tabName); $GLOBALS['MenuName'] = GetLang($menuLangVar); $menu .= $this->template->render('Snippets/MenuItem.html'); } } } $menu .= '</ul></div>'."\n"; return $menu; }
private function EditPageStep1($MsgDesc = "", $MsgStatus = "", $IsError = false) { $GLOBALS['Message'] = ''; if($MsgDesc != "") { $GLOBALS['Message'] .= MessageBox($MsgDesc, $MsgStatus); } $GLOBALS['Message'] .= GetFlashMessageBoxes(); $pageId = (int)$_REQUEST['pageId']; $arrData = array(); if(PageExists($pageId)) { // Was the page submitted with a duplicate page name? if($IsError) { $this->_GetPageData(0, $arrData); } else { $this->_GetPageData($pageId, $arrData); } $GLOBALS['CurrentTab'] = '0'; if(isset($_REQUEST['currentTab'])) { $GLOBALS['CurrentTab'] = $_REQUEST['currentTab']; } // Does this user have permission to edit this product? if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['pagevendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewPages'); } $GLOBALS['PageId'] = (int) $pageId; $GLOBALS['SetupType'] = sprintf("SwitchType(%d);", $arrData['pagetype']); $GLOBALS['Title'] = GetLang('EditPage'); $GLOBALS['FormAction'] = "editPage2"; $GLOBALS['PageTitle'] = isc_html_escape($arrData['pagetitle']); $wysiwygOptions = array( 'id' => 'wysiwyg', 'value' => $arrData['pagecontent'] ); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['PageLink'] = isc_html_escape($arrData['pagelink']); $GLOBALS['PageFeed'] = isc_html_escape($arrData['pagefeed']); $GLOBALS['PageEmail'] = isc_html_escape($arrData['pageemail']); $GLOBALS['ParentPageOptions'] = $this->GetParentPageOptions($arrData['pageparentid'], $pageId, $arrData['pagevendorid']); $GLOBALS['PageKeywords'] = isc_html_escape($arrData['pagekeywords']); $GLOBALS['PageMetaTitle'] = isc_html_escape($arrData['pagemetatitle']); $GLOBALS['PageDesc'] = isc_html_escape($arrData['pagedesc']); $GLOBALS['PageSearchKeywords'] = isc_html_escape($arrData['pagesearchkeywords']); $GLOBALS['PageSort'] = (int) $arrData['pagesort']; if($arrData['pagestatus'] == 1) { $GLOBALS['Visible'] = 'checked="checked"'; } if($arrData['pagecustomersonly'] == 1) { $GLOBALS['IsCustomersOnly'] = "checked=\"checked\""; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "fullname"))) { $GLOBALS['IsContactFullName'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "companyname"))) { $GLOBALS['IsContactCompanyName'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "phone"))) { $GLOBALS['IsContactPhone'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "orderno"))) { $GLOBALS['IsContactOrderNo'] = 'checked="checked"'; } if(is_numeric(isc_strpos($arrData['pagecontactfields'], "rma"))) { $GLOBALS['IsContactRMA'] = 'checked="checked"'; } // Is this page the default home page? if($arrData['pageishomepage'] == 1) { $GLOBALS['IsHomePage'] = 'checked="checked"'; } $GLOBALS['IsVendor'] = 'false'; if(!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOption'] = 'display: none'; } else { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if(isset($vendorData['vendorid'])) { $GLOBALS['HideVendorSelect'] = 'display: none'; $GLOBALS['IsVendor'] = 'true'; $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']); } else { $GLOBALS['HideVendorLabel'] = 'display: none'; $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['pagevendorid']); } } // Get a list of all layout files $layoutFile = 'page.html'; if($arrData['pagelayoutfile'] != '') { $layoutFile = $arrData['pagelayoutfile']; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("page.html", $layoutFile); //Google website optimizer $GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('PageGoogleWebsiteOptimizerIntro'); $GLOBALS['HideOptimizerConfigForm'] = 'display:none;'; $GLOBALS['CheckEnableOptimizer'] = ''; $GLOBALS['SkipOptimizerConfirmMsg'] = 'true'; $enabledOptimizers = GetConfig('OptimizerMethods'); if(!empty($enabledOptimizers)) { foreach ($enabledOptimizers as $id => $date) { GetModuleById('optimizer', $optimizerModule, $id); if ($optimizerModule->_testPage == 'pages' || $optimizerModule->_testPage == 'all') { $GLOBALS['SkipOptimizerConfirmMsg'] = 'false'; break; } } } if($arrData['page_enable_optimizer']) { $GLOBALS['HideOptimizerConfigForm'] = ''; $GLOBALS['CheckEnableOptimizer'] = 'Checked'; } $pageUrl = PageLink($pageId, $arrData['pagetitle']); $optimizer = getClass('ISC_ADMIN_OPTIMIZER'); $GLOBALS['OptimizerConfigForm'] = $optimizer->showPerItemConfigForm('page', $pageId, $pageUrl); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing'); $this->template->display('page.form.tpl'); } else { // The news page doesn't exist FlashMessage(GetLang('PageDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewPages'); } }
/** * DesignMode::UpdateLayoutPanels() * * @return */ protected function UpdateLayoutPanels() { $FileContent = ""; $LayoutFile = $this->FileName; $PanelString = $this->PanelString; // we need to put the columns into an associative array $cols = explode("|", $PanelString); foreach ($cols as $key => $val) { if($val == '') { unset($cols[$key]); } } foreach($cols as $key => $val) { $PanelSplit = explode(":", $val); $Columns[$PanelSplit[0]] = explode(",",$PanelSplit[1]); } $LayoutFilePath = str_replace('//', '/', $this->templateDirectories[count($this->templateDirectories)-1].'/'.$LayoutFile); $MasterLayoutFilePath = ''; $sortedDirectories = array_reverse($this->templateDirectories); foreach($sortedDirectories as $directory) { if(file_exists($directory.'/'.$LayoutFile)) { $MasterLayoutFilePath = $directory.'/'.$LayoutFile; break; } } // File doesn't exist in the local template and in the master template. Exit if((!$MasterLayoutFilePath || !file_exists($MasterLayoutFilePath)) && !file_exists($LayoutFilePath)) { return false; } // File doesn't exist in the local template, we need to create it if(!file_exists($LayoutFilePath)) { $parentDir = dirname($LayoutFilePath); if(!is_dir($parentDir) && !isc_mkdir($parentDir, ISC_WRITEABLE_DIR_PERM, true)) { $this->SetError($LayoutFilePath); return false; } if(!@touch($LayoutFilePath)) { $this->SetError($LayoutFilePath); return false; } $FileContent = file_get_contents($MasterLayoutFilePath); } else { $FileContent = file_get_contents($LayoutFilePath); } foreach($Columns as $PanelName => $PanelList) { // we need to get the content between a div, but there might be sub-divs that we still want included... // we do this loop to get the whole bit of the correct div $inDivCount = 0; $position = 0; $count = 0; $LastReplace = ''; $LastPosition = ''; $found_gt = false; // gt = greater than $divPos = isc_strpos($FileContent, $PanelName); $size = isc_strlen($FileContent); // start the loop through the html to get it all for($i = $divPos; $i < $size; ++$i) { if($found_gt == false) { if($FileContent[$i] == ">") { // we found the end of the starting div tag, now we can search for the correct </div> $found_gt = true; $start_pos = $i+1; } } else { // looping through the content if($FileContent[$i] == "<") { if($FileContent[$i+1].$FileContent[$i+2].$FileContent[$i+3].$FileContent[$i+4] == "/div") { // we've found a closing div! if($inDivCount == 0) { // we found the end! hooray! $end_pos = $i; break; } else { // we're in a sub-div, but it closed! =D --$inDivCount; } } elseif($FileContent[$i+1].$FileContent[$i+2].$FileContent[$i+3] == "div") { // found a sub-div, up the count =( ++$inDivCount; } } } } // now we get the content! $origcontent = $content = isc_substr($FileContent, $start_pos, ($end_pos - $start_pos)); // find the panel placeholders $regex_one = '%%GLOBAL_[a-zA-Z0-9]+_Position[0-9]+%%'; $regex_two = '%%Panel[\._]([a-zA-Z0-9]{1,})%%'; preg_match_all("/(?siU)(" . $regex_one . ")|(" . $regex_two . ")/", $content , $panel_matches); // loop through the matches and replace them with temporary position placeholders foreach ($panel_matches[0] as $key => $k) { $content = str_replace($panel_matches[0][$key], "%%GLOBAL_".$PanelName."_Position".$position.'%%', $content); ++$position; } // loop through and replace the temporary position placeholders with the new panels foreach($PanelList as $key => $NewPanel) { if($count == ($position-1)) { // reached the last one! $LastPosition = "%%GLOBAL_".$PanelName."_Position".$count.'%%'; $LastReplace .= '%%Panel.'.$NewPanel."%%\r\n"; } else { $content = str_replace("%%GLOBAL_".$PanelName."_Position".$count.'%%','%%Panel.'.$NewPanel.'%%', $content); ++$count; } } if($LastPosition != '') { $content = str_replace($LastPosition,$LastReplace, $content); } $FileContent = str_replace($origcontent,$content, $FileContent); } // Fix up any stray tags we may still have $FileContent= preg_replace("#%%GLOBAL_[a-zA-Z0-9]+_Position[0-9]+%%#isu",'', $FileContent); // All done, now write the file back isc_chmod($LayoutFilePath, ISC_WRITEABLE_FILE_PERM); if (@file_put_contents($LayoutFilePath, $FileContent)) { return true; } else { $this->SetError($LayoutFilePath); return false; } }
function BuildPaginationUrl($url, $page) { if (isc_strpos($url, "{page}") === false) { if (isc_strpos($url, "?") === false) { $url .= "?"; } else { $url .= "&"; } $url .= "page={$page}"; } else { $url = str_replace("{page}", $page, $url); } return $url; }
private function SaveUpdatedMailSettings() { $messages = array(); if (isset($_POST['MailXMLPath']) && isset($_POST['MailXMLToken']) && isset($_POST['MailUsername'])) { $xml_path = $_POST['MailXMLPath']; $xml_token = $_POST['MailXMLToken']; $api_user = $_POST['MailUsername']; $xml = "<xmlrequest>\n\t\t\t\t\t\t\t<username>" . $api_user . "</username>\n\t\t\t\t\t\t\t<usertoken>" . $xml_token . "</usertoken>\n\t\t\t\t\t\t\t<requesttype>authentication</requesttype>\n\t\t\t\t\t\t\t<requestmethod>xmlapitest</requestmethod>\n\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t</xmlrequest>"; $xml = urlencode($xml); // Let's make sure the path is valid before enabling the XML API $result = PostToRemoteFileAndGetResponse($xml_path, "xml=" . $xml); $response = @simplexml_load_string($result); if (!is_object($response)) { $GLOBALS['MailXMLAPIValid'] = 0; } // We expect the response to contain SUCCESS - no point using XML to validate when we can do a string comparison if (is_numeric(isc_strpos(isc_strtoupper($result), "<STATUS>SUCCESS</STATUS>"))) { $GLOBALS['ISC_NEW_CFG']['MailXMLAPIValid'] = "1"; $GLOBALS['ISC_NEW_CFG']['MailXMLPath'] = $_POST['MailXMLPath']; $GLOBALS['ISC_NEW_CFG']['MailXMLToken'] = $_POST['MailXMLToken']; $GLOBALS['ISC_NEW_CFG']['MailUsername'] = $_POST['MailUsername']; } else { $GLOBALS['ISC_NEW_CFG']['MailXMLAPIValid'] = "0"; $GLOBALS['ISC_NEW_CFG']['MailXMLPath'] = ""; $GLOBALS['ISC_NEW_CFG']['MailXMLToken'] = ""; $GLOBALS['ISC_NEW_CFG']['MailUsername'] = ""; $GLOBALS['ISC_NEW_CFG']['MailAutomaticallyTickNewsletterBox'] = 0; $GLOBALS['ISC_NEW_CFG']['MailAutomaticallyTickOrderBox'] = 0; // Was an error message returned? if (isset($response->errormessage)) { $message = strval($response->errormessage); if (isc_strtolower(trim($message)) != "invalid details") { $messages[$message] = MSG_ERROR; } } } // Are we capturing subscribers from the newsletter form? if (isset($_POST['UseMailAPIForNewsletters'])) { $GLOBALS['ISC_NEW_CFG']['UseMailerForNewsletter'] = 1; $GLOBALS['ISC_NEW_CFG']['MailNewsletterList'] = (int) $_POST['MailNewsletterList']; $GLOBALS['ISC_NEW_CFG']['MailNewsletterCustomField'] = (int) @$_POST['MailNewsletterCustomField']; } else { $GLOBALS['ISC_NEW_CFG']['UseMailerForNewsletter'] = 0; $GLOBALS['ISC_NEW_CFG']['MailNewsletterList'] = 0; $GLOBALS['ISC_NEW_CFG']['MailNewsletterCustomField'] = 0; } // Are we capturing subscribers for customers? if (isset($_POST['UseMailAPIForOrders'])) { $GLOBALS['ISC_NEW_CFG']['UseMailerForOrders'] = 1; $GLOBALS['ISC_NEW_CFG']['MailOrderList'] = (int) $_POST['MailOrderList']; $GLOBALS['ISC_NEW_CFG']['MailOrderFirstName'] = (int) @$_POST['MailOrderFirstName']; $GLOBALS['ISC_NEW_CFG']['MailOrderLastName'] = (int) @$_POST['MailOrderLastName']; $GLOBALS['ISC_NEW_CFG']['MailOrderFullName'] = (int) @$_POST['MailOrderFullName']; $GLOBALS['ISC_NEW_CFG']['MailOrderZip'] = (int) @$_POST['MailOrderZip']; $GLOBALS['ISC_NEW_CFG']['MailOrderCountry'] = (int) @$_POST['MailOrderCountry']; $GLOBALS['ISC_NEW_CFG']['MailOrderTotal'] = (int) @$_POST['MailOrderTotal']; $GLOBALS['ISC_NEW_CFG']['MailOrderPaymentMethod'] = (int) @$_POST['MailOrderPaymentMethod']; $GLOBALS['ISC_NEW_CFG']['MailOrderShippingMethod'] = (int) @$_POST['MailOrderShippingMethod']; $GLOBALS['ISC_NEW_CFG']['MailOrderListAutoSubscribe'] = (int) @$_POST['MailOrderListAutoSubscribe']; } else { $GLOBALS['ISC_NEW_CFG']['UseMailerForOrders'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderList'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderFirstName'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderLastName'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderFullName'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderZip'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderCountry'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderTotal'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderPaymentMethod'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderShippingMethod'] = 0; $GLOBALS['ISC_NEW_CFG']['MailOrderListAutoSubscribe'] = 0; } // Are we showing product updates? if (isset($_POST['UseMailAPIForUpdates'])) { $GLOBALS['ISC_NEW_CFG']['UseMailAPIForUpdates'] = 1; $GLOBALS['ISC_NEW_CFG']['MailProductUpdatesListType'] = $_POST['MailProductUpdatesListType']; } else { $GLOBALS['ISC_NEW_CFG']['UseMailAPIForUpdates'] = 0; $GLOBALS['ISC_NEW_CFG']['MailProductUpdatesListType'] = ""; } // Update the settings if ($this->CommitSettings($messages)) { if (GetConfig('MailXMLAPIValid')) { if ($GLOBALS['CurrentTab'] == 0) { $success_var = "MailAPIInitSuccess"; } else { $success_var = "MailAPIIntegrationSuccess"; } // Log this action $GLOBALS['ISC_CLASS_LOG']->LogAdminAction(); $messages = array_merge(array(GetLang($success_var) => MSG_SUCCESS), $messages); foreach ($messages as $message => $type) { FlashMessage($message, $type); } header("Location: index.php?ToDo=viewMailSettings"); exit; } else { $GLOBALS['ISC_NEW_CFG']['MailXMLPath'] = $_POST['MailXMLPath']; $GLOBALS['ISC_NEW_CFG']['MailXMLToken'] = $_POST['MailXMLToken']; $GLOBALS['ISC_NEW_CFG']['MailUsername'] = $_POST['MailUsername']; $messages = array_merge(array(GetLang('MailAPIInitFailed') => MSG_ERROR), $messages); foreach ($messages as $message => $type) { FlashMessage($message, $type); } header("Location: index.php?ToDo=viewMailSettings"); exit; } } else { $messages = array_merge(array(GetLang('SettingsNotSaved') => MSG_ERROR), $messages); foreach ($messages as $message => $type) { FlashMessage($message, $type); } header("Location: index.php?ToDo=viewMailSettings"); exit; } } else { header("Location: index.php?ToDo=viewMailSettings"); exit; } }
/** * _LangifyHTMLTag * Convert the <html> tag in to it's equivilent for the language in use. * Will switch text direction if necessary and add lang attributes to the head tag. * Pass in the template to be converted. * * @param string The template contents. */ private function _LangifyHTMLTag() { $tplData = $this->_GetTemplate(); if (isset($this->_DoneHead)) { return $tplData; } if (isc_strpos($tplData, "<html") !== false) { $this->_DoneHead = true; } else { return $tplData; } if (GetConfig('Language')) { if (function_exists('str_ireplace')) { $tplData = str_ireplace("<html", sprintf("<html xml:lang=\"%s\" lang=\"%s\"", GetConfig('Language'), GetConfig('Language')), $tplData); } else { $tplData = str_replace("<html", sprintf("<html xml:lang=\"%s\" lang=\"%s\"", GetConfig('Language'), GetConfig('Language')), $tplData); } } if (GetLang('RTL') == 1) { $tplData = str_ireplace("<html", "<html dir=\"rtl\"", $tplData); if ($this->frontEnd) { $rtlCSSPath = $this->baseDir . "/" . GetConfig('template') . "/Styles/rtl.css"; $rtlCSS = $GLOBALS['TPL_PATH'] . "/Styles/rtl.css"; } else { $rtlCSSPath = $this->baseDir . "/../Styles/rtl.css"; $rtlCSS = "Styles/rtl.css"; } if (file_exists($rtlCSSPath)) { $GLOBALS['RTLStyles'] = sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $rtlCSS); } } return $tplData; }
/** * Import X-Cart reviews in to the application. */ public function ImportReviews() { $start = $this->_importSession['ImportReviews']['done']; // On our first iteration, store the number of records in this table we'll be importing if ($start == 0) { $query = "SELECT COUNT(review_id) FROM xcart_product_reviews"; $result = $GLOBALS['XCART_DB']->Query($query); $this->_importSession['ImportReviews']['count'] = $GLOBALS['XCART_DB']->FetchOne($query); $this->_importSession['ImportReviews']['done'] = 0; } $query = "SELECT * FROM xcart_product_reviews ORDER BY review_id ASC"; $query .= $GLOBALS['XCART_DB']->AddLimit($start, ISC_IMPORT_REVIEWS_PER_PAGE); $result = $GLOBALS['XCART_DB']->Query($query); while ($review = $GLOBALS['XCART_DB']->Fetch($result)) { if (isc_strpos($review['email'], "(") !== 0) { // Review name inside email field $fromName = isc_substr($review['email'], 0, isc_strpos($review['email'], "(")); } else { $from = explode("@", $review['email'], 2); $fromName = $from[1]; } $importReview = array("revproductid" => $review['productid'], "revfromname" => trim($fromName), "revdate" => time(), "revtext" => $review['message'], "revstatus" => 1); $err = ''; $this->UpdateProgress(GetLang('StatusImportingReview'), $this->_importSession['ImportReviews']['done'], $this->_importSession['ImportReviews']['count']); $this->InsertReview($review['review_id'], $importReview, $err); ++$this->_importSession['ImportReviews']['done']; } }
private function EditPageStep1($MsgDesc = "", $MsgStatus = "", $IsError = false) { $GLOBALS['Message'] = ''; if ($MsgDesc != "") { $GLOBALS['Message'] .= MessageBox($MsgDesc, $MsgStatus); } $GLOBALS['Message'] .= GetFlashMessageBoxes(); $pageId = (int) $_REQUEST['pageId']; $arrData = array(); if (PageExists($pageId)) { // Was the page submitted with a duplicate page name? if ($IsError) { $this->_GetPageData(0, $arrData); } else { $this->_GetPageData($pageId, $arrData); } // Does this user have permission to edit this product? if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['pagevendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewPages'); } $GLOBALS['PageId'] = (int) $pageId; $GLOBALS['SetupType'] = sprintf("SwitchType(%d);", $arrData['pagetype']); $GLOBALS['Title'] = GetLang('EditPage'); $GLOBALS['FormAction'] = "editPage2"; $GLOBALS['PageTitle'] = isc_html_escape($arrData['pagetitle']); $GLOBALS['PageName'] = isc_html_escape($arrData['pagename']); $wysiwygOptions = array('id' => 'wysiwyg', 'value' => $arrData['pagecontent']); $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions); $GLOBALS['PageLink'] = isc_html_escape($arrData['pagelink']); $GLOBALS['PageFeed'] = isc_html_escape($arrData['pagefeed']); $GLOBALS['PageEmail'] = isc_html_escape($arrData['pageemail']); $GLOBALS['ParentPageOptions'] = $this->GetParentPageOptions($arrData['pageparentid'], $pageId, $arrData['pagevendorid']); $GLOBALS['PageKeywords'] = isc_html_escape($arrData['pagekeywords']); $GLOBALS['PageDesc'] = isc_html_escape($arrData['pagedesc']); $GLOBALS['PageSort'] = (int) $arrData['pagesort']; if ($arrData['pagestatus'] == 1) { $GLOBALS['Visible'] = 'checked="checked"'; } if ($arrData['pagecustomersonly'] == 1) { $GLOBALS['IsCustomersOnly'] = "checked=\"checked\""; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "fullname"))) { $GLOBALS['IsContactFullName'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "companyname"))) { $GLOBALS['IsContactCompanyName'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "phone"))) { $GLOBALS['IsContactPhone'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "orderno"))) { $GLOBALS['IsContactOrderNo'] = 'checked="checked"'; } if (is_numeric(isc_strpos($arrData['pagecontactfields'], "rma"))) { $GLOBALS['IsContactRMA'] = 'checked="checked"'; } // Is this page the default home page? if ($arrData['pageishomepage'] == 1) { $GLOBALS['IsHomePage'] = 'checked="checked"'; } if (!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOption'] = 'display: none'; } else { $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor(); if (isset($vendorData['vendorid'])) { $GLOBALS['HideVendorSelect'] = 'display: none'; $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']); } else { $GLOBALS['HideVendorLabel'] = 'display: none'; $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['pagevendorid']); } } // Get a list of all layout files $layoutFile = 'page.html'; if ($arrData['pagelayoutfile'] != '') { $layoutFile = $arrData['pagelayoutfile']; } $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("page.html", $layoutFile); $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing'); $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("page.form"); $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(); } else { // The news page doesn't exist FlashMessage(GetLang('PageDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewPages'); } }
private function GetQuote() { // The following array will be returned to the calling function. // It will contain at least one ISC_SHIPPING_QUOTE object if // the shipping quote was successful. $usps_quote = array(); $origincountry = $this->GetCountry($this->_origin_country['country_iso']); $destcountry = $this->GetCountry($this->_destination_country['country_iso']); // Is this an international quote? if($origincountry != $destcountry) { $api = "IntlRate"; } else { $api = "RateV3"; } $uspsXML = new SimpleXMLElement('<'.$api.'Request USERID="'.$this->GetValue('username').'" />'); $package = $uspsXML->addChild('Package'); $package->addAttribute('ID', 0); if($api != 'IntlRate') { $package->addChild('Service', $this->_service); if($this->_service == "FIRST CLASS" || $this->_service == "PARCEL") { $package->addChild('FirstClassMailType', 'PARCEL'); } } // Get the amount of pounds $fractionalPounds = ConvertWeight($this->_weight, 'pounds'); $pounds = floor($fractionalPounds); // Get the amount of ounces for the fractional remainder $ounces = round(ConvertWeight($fractionalPounds - $pounds, 'ounces', 'pounds'), 2); $weight_xml = sprintf("<Pounds>%s</Pounds>", $pounds); $weight_xml .= sprintf("<Ounces>%s</Ounces>", $ounces); // International rates require the weight before the mail type if($api == "IntlRate") { $package->addChild('Pounds', $pounds); $package->addChild('Ounces', $ounces); $package->addChild('MailType', 'Package'); $package->addChild('Country', $destcountry); } // Domestic rates require the destination before the weight else { $package->addChild('ZipOrigination', $this->_origin_zip); $package->addChild('ZipDestination', $this->_destination_zip); $package->addChild('Pounds', $pounds); $package->addChild('Ounces', $ounces); // Which container to use depends on which method was chosen switch($this->_service) { case "EXPRESS": { $containerType = $this->_expressmailcontainertype; $containerSize = $this->_expressmailpackagesize; break; } case "FIRST CLASS": { $containerType = $this->_firstclasscontainertype; $containerSize = $this->_firstclasspackagesize; break; } case "PRIORITY": { $containerType = $this->_prioritycontainertype; $containerSize = $this->_prioritypackagesize; break; } case "PARCEL": { $containerSize = $this->_parcelpostmachpackagesize; break; } case "BPM": { $containerSize = $this->_bpmpackagesize; break; } case "LIBRARY": { $containerSize = $this->_librarypackagesize; break; } case "MEDIA": { $containerSize = $this->_mediapackagesize; break; } } if(!empty($containerType)) { $containerType = $this->GetContainerType($containerType); } else { $containerType =''; } $package->addChild('Container', $containerType); $containerSize = $this->GetContainerSize($containerSize); $package->addChild('Size', $containerSize); if($this->_service == "PRIORITY" && $containerSize == "LARGE") { $dimensions = $this->Getcombinedshipdimensions(); $package->addChild('Width', number_format(ConvertLength($dimensions['width'], "in"), 2)); $package->addChild('Length', number_format(ConvertLength($dimensions['length'], "in"), 2)); $package->addChild('Height', number_format(ConvertLength($dimensions['height'], "in"), 2)); } // Add the Machinable element if it's a parcel post if($this->_service == "PARCEL") { $package->addChild('Machinable', 'true'); } } // Should we test on the test or production server? if($this->GetValue("servertype") == "test") { $uspsURL = "http://testing.shippingapis.com/ShippingAPITest.dll"; } else { $uspsURL = "http://production.shippingapis.com/ShippingAPI.dll"; } $postVars = array( 'API' => $api, 'XML' => $uspsXML->asXML() ); $postVars = http_build_query($postVars); $result = postToRemoteFileAndGetResponse($uspsURL, $postVars); if(!$result) { // Couldn't get to USPS $this->SetError(GetLang('USPSOpenError')); return false; } // Parse the XML response from USPS $xml = simplexml_load_string($result); if(!is_object($xml)) { $this->SetError(GetLang('USPSOpenError')); return false; } // Invalid username or access credentials supplied to USPS if(isc_strpos($result, "Authorization failure") !== false) { $this->SetError(GetLang('USPSAuthError')); return false; } // Return with the error message if the USPS request returned an error if(isset($xml->Package->Error)) { // Bad quote $this->SetError((string)$xml->Package->Error->Description); return false; } // Domestic quote responses return a single shipping quote // as we supplied a particular service if($api == 'RateV3') { $classId = (string)$xml->Package->Postage['CLASSID']; $service = $this->GetDomesticServiceByClassId($classId); $quote = new ISC_SHIPPING_QUOTE( $this->GetId(), $this->GetDisplayName(), (string)$xml->Package->Postage->Rate, $service['description'] ); return $quote; } // International quotes return a series of available shipping services // so we need to loop through them and return an array of matching // quotes $quotes = array(); $enabledServices = $this->GetIntlServices($this->_service); foreach($xml->Package->Service as $service) { $attributes = $service->attributes(); $serviceId = (int)$attributes['ID']; // Check if this service is enabled if (!in_array($serviceId, $enabledServices)) { continue; } // Create a quote object $quotes[] = new ISC_SHIPPING_QUOTE( $this->GetId(), $this->GetDisplayName(), (string)$service->Postage, GetLang('USPSIntlService_' . $serviceId) ); } if(empty($quotes)) { $this->SetError(GetLang('USPSNoShippingMethods')); return false; } return $quotes; }
public function HandleSTSToDo($ToDo) { $do = isc_strtolower($ToDo); if (is_numeric(isc_strpos($do, "picnik"))) { $GLOBALS['ISC_CLASS_ADMIN_PICNIK'] = GetClass('ISC_ADMIN_PICNIK'); $GLOBALS['ISC_CLASS_ADMIN_PICNIK']->HandleToDo($ToDo); } else if (is_numeric(isc_strpos($do, "vendorpayment"))) { $GLOBALS['ISC_CLASS_ADMIN_VENDOR_PAYMENTS'] = GetClass('ISC_ADMIN_VENDOR_PAYMENTS'); $GLOBALS['ISC_CLASS_ADMIN_VENDOR_PAYMENTS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "vendor"))) { $GLOBALS['ISC_CLASS_ADMIN_VENDORS'] = GetClass('ISC_ADMIN_VENDORS'); $GLOBALS['ISC_CLASS_ADMIN_VENDORS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "page"))) { $GLOBALS['ISC_CLASS_ADMIN_PAGES'] = GetClass('ISC_ADMIN_PAGES'); $GLOBALS['ISC_CLASS_ADMIN_PAGES']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "variation"))) { $GLOBALS['ISC_CLASS_ADMIN_PRODUCT_VARIATIONS'] = GetClass('ISC_ADMIN_PRODUCT_VARIATIONS'); $GLOBALS['ISC_CLASS_ADMIN_PRODUCT_VARIATIONS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "product"))) { $GLOBALS['ISC_CLASS_ADMIN_PRODUCT'] = GetClass('ISC_ADMIN_PRODUCT'); $GLOBALS['ISC_CLASS_ADMIN_PRODUCT']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "review"))) { $GLOBALS['ISC_CLASS_ADMIN_REVIEW'] = GetClass('ISC_ADMIN_REVIEW'); $GLOBALS['ISC_CLASS_ADMIN_REVIEW']->HandleToDo($ToDo); } else if (is_numeric(isc_strpos($do, "shoppingcomparison"))) { $GLOBALS['ISC_CLASS_ADMIN_SHOPPINGCOMPARISON'] = GetClass('ISC_ADMIN_SHOPPINGCOMPARISON'); $GLOBALS['ISC_CLASS_ADMIN_SHOPPINGCOMPARISON']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "categ"))) { $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY'); $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "shipment")) || is_numeric(isc_strpos($do, "packingslip"))) { $GLOBALS['ISC_CLASS_ADMIN_SHIPMENTS'] = GetClass('ISC_ADMIN_SHIPMENTS'); $GLOBALS['ISC_CLASS_ADMIN_SHIPMENTS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "ebay"))) { $GLOBALS['ISC_CLASS_ADMIN_EBAY'] = GetClass('ISC_ADMIN_EBAY'); $GLOBALS['ISC_CLASS_ADMIN_EBAY']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "order"))) { $GLOBALS['ISC_CLASS_ADMIN_ORDERS'] = GetClass('ISC_ADMIN_ORDERS'); $GLOBALS['ISC_CLASS_ADMIN_ORDERS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "giftwrap"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_GIFTWRAPPING'] = GetClass('ISC_ADMIN_SETTINGS_GIFTWRAPPING'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_GIFTWRAPPING']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "googlesitemap"))) { $GLOBALS['ISC_CLASS_ADMIN_GOOGLESITEMAP'] = GetClass('ISC_ADMIN_GOOGLESITEMAP'); $GLOBALS['ISC_CLASS_ADMIN_GOOGLESITEMAP']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "customer"))) { $GLOBALS['ISC_CLASS_ADMIN_CUSTOMERS'] = GetClass('ISC_ADMIN_CUSTOMERS'); $GLOBALS['ISC_CLASS_ADMIN_CUSTOMERS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "shippingsettings")) || is_numeric(isc_strpos($do, "shippingzone")) || is_numeric(isc_strpos($do, "testshipping"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING'] = GetClass('ISC_ADMIN_SETTINGS_SHIPPING'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "accountingsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ACCOUNTING'] = GetClass('ISC_ADMIN_SETTINGS_ACCOUNTING'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ACCOUNTING']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "checkoutsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_CHECKOUT'] = GetClass('ISC_ADMIN_SETTINGS_CHECKOUT'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_CHECKOUT']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "emailintegration"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_EMAILINTEGRATION'] = GetClass('ISC_ADMIN_SETTINGS_EMAILINTEGRATION'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_EMAILINTEGRATION']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "news"))) { $GLOBALS['ISC_CLASS_ADMIN_NEWS'] = GetClass('ISC_ADMIN_NEWS'); $GLOBALS['ISC_CLASS_ADMIN_NEWS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "coupon"))) { $GLOBALS['ISC_CLASS_ADMIN_COUPONS'] = GetClass('ISC_ADMIN_COUPONS'); $GLOBALS['ISC_CLASS_ADMIN_COUPONS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "discount"))) { $GLOBALS['ISC_CLASS_ADMIN_COUPONS'] = GetClass('ISC_ADMIN_DISCOUNTS'); $GLOBALS['ISC_CLASS_ADMIN_COUPONS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "subscribers"))) { $GLOBALS['ISC_CLASS_ADMIN_SUBSCRIBERS'] = GetClass('ISC_ADMIN_SUBSCRIBERS'); $GLOBALS['ISC_CLASS_ADMIN_SUBSCRIBERS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "froogle"))) { $GLOBALS['ISC_CLASS_ADMIN_FROOGLE'] = GetClass('ISC_ADMIN_FROOGLE'); $GLOBALS['ISC_CLASS_ADMIN_FROOGLE']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "ajaxexport"))) { $GLOBALS['ISC_CLASS_ADMIN_AJAXEXPORTER_CONTROLLER'] = GetClass('ISC_ADMIN_AJAXEXPORTER_CONTROLLER'); $GLOBALS['ISC_CLASS_ADMIN_AJAXEXPORTER_CONTROLLER']->Export(); } else if(is_numeric(isc_strpos($do, "exporttemplate"))) { $GLOBALS['ISC_CLASS_ADMIN_EXPORTTEMPLATES'] = GetClass('ISC_ADMIN_EXPORTTEMPLATES'); $GLOBALS['ISC_CLASS_ADMIN_EXPORTTEMPLATES']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "export"))) { $GLOBALS['ISC_CLASS_ADMIN_EXPORT'] = GetClass('ISC_ADMIN_EXPORT'); $GLOBALS['ISC_CLASS_ADMIN_EXPORT']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "template"))) { $GLOBALS['ISC_CLASS_ADMIN_LAYOUT'] = GetClass('ISC_ADMIN_LAYOUT'); $GLOBALS['ISC_CLASS_ADMIN_LAYOUT']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "user"))) { $GLOBALS['ISC_CLASS_ADMIN_USER'] = GetClass('ISC_ADMIN_USER'); $GLOBALS['ISC_CLASS_ADMIN_USER']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "banner"))) { $GLOBALS['ISC_CLASS_ADMIN_BANNERS'] = GetClass('ISC_ADMIN_BANNERS'); $GLOBALS["ISC_CLASS_ADMIN_BANNERS"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "brand"))) { $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS'); $GLOBALS["ISC_CLASS_ADMIN_BRANDS"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "commentsystem"))) { $GLOBALS['ISC_CLASS_SETTINGS_COMMENTS'] = GetClass('ISC_ADMIN_SETTINGS_COMMENTS'); $GLOBALS["ISC_CLASS_SETTINGS_COMMENTS"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "livechatsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_LIVECHAT'] = GetClass('ISC_ADMIN_SETTINGS_LIVECHAT'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_LIVECHAT']->HandleToDo($ToDo); } else if((isc_strpos($do, 'settings') !== false && isc_strpos($do, 'tax') !== false) || isc_strpos($do, 'taxzone') !== false || isc_strpos($do, 'taxclass') !== false || isc_strpos($do, 'taxrate') !== false) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_TAX'] = GetClass('ISC_ADMIN_SETTINGS_TAX'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_TAX']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "shippingmanager"))) { $GLOBALS['ISC_ADMIN_SETTINGS_SHIPPINGMANAGER'] = GetClass('ISC_ADMIN_SETTINGS_SHIPPINGMANAGER'); $GLOBALS['ISC_ADMIN_SETTINGS_SHIPPINGMANAGER']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "settings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS'] = GetClass('ISC_ADMIN_SETTINGS'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "backup"))) { $GLOBALS['ISC_CLASS_ADMIN_BACKUP'] = GetClass('ISC_ADMIN_BACKUP'); $GLOBALS["ISC_CLASS_ADMIN_BACKUP"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "stats"))) { $GLOBALS['ISC_CLASS_ADMIN_STATITICS'] = GetClass('ISC_ADMIN_STATISTICS'); $GLOBALS['ISC_CLASS_ADMIN_STATITICS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "log"))) { $GLOBALS['ISC_CLASS_ADMIN_LOGS'] = GetClass('ISC_ADMIN_LOGS'); $GLOBALS['ISC_CLASS_ADMIN_LOGS']->HandleToDo($ToDo); } else if(is_numeric(strpos($do, "quicksearch"))) { $GLOBALS['ISC_CLASS_ADMIN_QUICKSEARCH'] = GetClass('ISC_ADMIN_QUICKSEARCH'); $GLOBALS['ISC_CLASS_ADMIN_QUICKSEARCH']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "return")) && GetConfig('EnableReturns') && gzte11(ISC_LARGEPRINT)) { $GLOBALS['ISC_CLASS_ADMIN_RETURNS'] = GetClass('ISC_ADMIN_RETURNS'); $GLOBALS['ISC_CLASS_ADMIN_RETURNS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "giftcertificate")) && GetConfig('EnableGiftCertificates') && gzte11(ISC_LARGEPRINT)) { $GLOBALS['ISC_CLASS_ADMIN_GIFTCERTIFICATES'] = GetClass('ISC_ADMIN_GIFTCERTIFICATES'); $GLOBALS['ISC_CLASS_ADMIN_GIFTCERTIFICATES']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "systeminfo"))) { $GLOBALS['ISC_CLASS_ADMIN_SYSINFO'] = GetClass('ISC_ADMIN_SYSINFO'); $GLOBALS['ISC_CLASS_ADMIN_SYSINFO']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "runaddon"))) { $GLOBALS['ISC_CLASS_ADMIN_ADDON'] = GetClass('ISC_ADMIN_ADDON'); $GLOBALS["ISC_CLASS_ADMIN_ADDON"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "redirects"))) { $GLOBALS['ISC_CLASS_ADMIN_REDIRECTS'] = GetClass('ISC_ADMIN_REDIRECTS'); $GLOBALS["ISC_CLASS_ADMIN_REDIRECTS"]->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "downloadaddons"))) { $GLOBALS['ISC_CLASS_ADMIN_DOWNLOADADDONS'] = GetClass('ISC_ADMIN_DOWNLOADADDONS'); $GLOBALS['ISC_CLASS_ADMIN_DOWNLOADADDONS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "formfields"))) { $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS'] = GetClass('ISC_ADMIN_FORMFIELDS'); $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "image"))) { $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS'] = GetClass('ISC_ADMIN_IMAGEMANAGER'); $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "optimizer"))) { $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS'] = GetClass('ISC_ADMIN_OPTIMIZER'); $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "jobstatus"))){ $GLOBALS['ISC_CLASS_ADMIN_JOBSTATUS'] = GetClass('ISC_ADMIN_JOBSTATUS'); $GLOBALS['ISC_CLASS_ADMIN_JOBSTATUS']->HandleToDo($ToDo); } else if(is_numeric(isc_strpos($do, "robotstxt"))) { $GLOBALS['ISC_CLASS_ADMIN_ROBOTSTXT'] = GetClass('ISC_ADMIN_ROBOTSTXT'); $GLOBALS['ISC_CLASS_ADMIN_ROBOTSTXT']->HandleToDo($ToDo); } }
/** * Send a contact form from a page */ public function SendContactForm() { // If the pageid or captcha is not set then just show the page and exit if (!isset($_POST['page_id']) || !isset($_POST['captcha'])) { $this->ShowPage(); return; } // Load the captcha class $GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA'); // Load the form variables $page_id = (int)$_POST['page_id']; $this->_SetPageData($page_id); $captcha = $_POST['captcha']; if(GetConfig('CaptchaEnabled') == 0) { $captcha_check = true; } else { if(isc_strtolower($captcha) == isc_strtolower($GLOBALS['ISC_CLASS_CAPTCHA']->LoadSecret())) { // Captcha validation succeeded $captcha_check = true; } else { // Captcha validation failed $captcha_check = false; } } if($captcha_check) { // Valid captcha, let's send the form. The template used for the contents of the // email is page_contact_email.html $from = @$_POST['contact_fullname']; $GLOBALS['PageTitle'] = $this->_pagetitle; $GLOBALS['FormFieldList'] = ""; $emailTemplate = FetchEmailTemplateParser(); // Which fields should we include in the form? $fields = $this->_pagerow['pagecontactfields']; if(is_numeric(isc_strpos($fields, "fullname"))) { $GLOBALS['FormField'] = GetLang('ContactName'); $GLOBALS['FormValue'] = isc_html_escape($_POST['contact_fullname']); $GLOBALS['FormFieldList'] .= $emailTemplate->GetSnippet("ContactFormField"); } $GLOBALS['FormField'] = GetLang('ContactEmail'); $GLOBALS['FormValue'] = isc_html_escape($_POST['contact_email']); $GLOBALS['FormFieldList'] .= $emailTemplate->GetSnippet("ContactFormField"); if(is_numeric(isc_strpos($fields, "companyname"))) { $GLOBALS['FormField'] = GetLang('ContactCompanyName'); $GLOBALS['FormValue'] = isc_html_escape($_POST['contact_companyname']); $GLOBALS['FormFieldList'] .= $emailTemplate->GetSnippet("ContactFormField"); } if(is_numeric(isc_strpos($fields, "phone"))) { $GLOBALS['FormField'] = GetLang('ContactPhone'); $GLOBALS['FormValue'] = isc_html_escape($_POST['contact_phone']); $GLOBALS['FormFieldList'] .= $emailTemplate->GetSnippet("ContactFormField"); } if(is_numeric(isc_strpos($fields, "orderno"))) { $GLOBALS['FormField'] = GetLang('ContactOrderNo'); $GLOBALS['FormValue'] = isc_html_escape($_POST['contact_orderno']); $GLOBALS['FormFieldList'] .= $emailTemplate->GetSnippet("ContactFormField"); } if(is_numeric(isc_strpos($fields, "rma"))) { $GLOBALS['FormField'] = GetLang('ContactRMANo'); $GLOBALS['FormValue'] = isc_html_escape($_POST['contact_rma']); $GLOBALS['FormFieldList'] .= $emailTemplate->GetSnippet("ContactFormField"); } $GLOBALS['Question'] = nl2br(isc_html_escape($_POST['contact_question'])); $GLOBALS['ISC_LANG']['ContactPageFormSubmitted'] = sprintf(GetLang('ContactPageFormSubmitted'), $GLOBALS['PageTitle']); $emailTemplate->SetTemplate("page_contact_email"); $message = $emailTemplate->ParseTemplate(true); // Send the email require_once(ISC_BASE_PATH . "/lib/email.php"); $obj_email = GetEmailClass(); $obj_email->Set('CharSet', GetConfig('CharacterSet')); $obj_email->From($_POST['contact_email'], $from); $obj_email->ReplyTo = $_POST['contact_email']; $obj_email->Set("Subject", GetLang('ContactPageFormSubmitted')); $obj_email->AddBody("html", $message); $obj_email->AddRecipient($this->_pagerow['pageemail'], "", "h"); $email_result = $obj_email->Send(); // If the email was sent ok, show a confirmation message $GLOBALS['MessageTitle'] = $GLOBALS['PageTitle']; if($email_result['success']) { $GLOBALS['MessageIcon'] = "IcoInfo"; $GLOBALS['MessageText'] = sprintf(GetLang('PageFormSent'), $GLOBALS['ShopPath']); } else { // Email error $GLOBALS['MessageIcon'] = "IcoError"; $GLOBALS['MessageText'] = GetLang('PageFormNotSent'); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("message"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); } else { // Bad captcha, take them back to the form $this->ShowPage(); } }
/** * * @param string $url * @param int $page * @param string $precall * @return string */ function BuildPaginationUrl($url, $page, $precall='') { if (isc_strpos($url, "{page}") === false) { if (isc_strpos($url, "?") === false) { $url .= "?"; } else { $url .= "&"; } $url .= "page=$page"; } else { $url = str_replace("{page}", $page, $url); } if ($precall !== '') { if (isc_strpos($url, "?") === false) { $url .= "?"; } else { $url .= "&"; } $url .= "precall=" . $precall; } return $url; }
/** * _BuildTabMenu * Build the menu of tabs that appears at the top of the control panel * * @return String */ private function _BuildTabMenu() { $menu = ""; // Get an array of permissions for the selected user $arrPermissions = $GLOBALS["ISC_CLASS_ADMIN_AUTH"]->GetPermissions(); $show_manage_products = in_array(AUTH_Manage_Products, $arrPermissions) || in_array(AUTH_Manage_Reviews, $arrPermissions) || in_array(AUTH_Create_Product, $arrPermissions) || in_array(AUTH_Import_Products, $arrPermissions); $show_manage_categories = in_array(AUTH_Manage_Categories, $arrPermissions) || in_array(AUTH_Create_Category, $arrPermissions); $show_manage_orders = in_array(AUTH_Manage_Orders, $arrPermissions) || in_array(AUTH_Add_Orders, $arrPermissions) || in_array(AUTH_Export_Orders, $arrPermissions) || in_array(AUTH_Manage_Returns, $arrPermissions); $show_import_tracking_number = in_array(AUTH_Manage_Orders, $arrPermissions) && in_array(AUTH_Import_Order_Tracking_Numbers, $arrPermissions) && gzte11(ISC_MEDIUMPRINT); $show_manage_customers = in_array(AUTH_Manage_Customers, $arrPermissions) || in_array(AUTH_Add_Customer, $arrPermissions) || in_array(AUTH_Import_Customers, $arrPermissions); // If Interspire Email Marketer is integrated and setup to handle newsletter subscribers then we'll take them // to the login page. If not we'll just export from the subscribers table in CSV format if (GetConfig('MailXMLAPIValid') && GetConfig('UseMailerForNewsletter') && GetConfig('MailNewsletterList') > 0) { $mailer_link = str_replace("xml.php", "admin", GetConfig('MailXMLPath')); $subscriber_link = sprintf("javascript:LaunchMailer('%s')", $mailer_link); $subscriber_class = ''; } else { $subscriber_link = "index.php?ToDo=exportSubscribersIntro&height=260&width=400"; $subscriber_class = 'thickbox'; } $menuItems = array('mnuOrders' => array('match' => array('order', 'shipment'), 'items' => array(array('text' => GetLang('ViewOrders'), 'help' => GetLang('ViewOrdersMenuHelp'), 'icon' => 'order.gif', 'link' => 'index.php?ToDo=viewOrders', 'show' => $show_manage_orders), array('text' => GetLang('AddAnOrder'), 'help' => GetLang('AddOrderMenuHelp'), 'icon' => 'order_add.gif', 'link' => 'index.php?ToDo=addOrder', 'show' => in_array(AUTH_Add_Orders, $arrPermissions)), array('text' => GetLang('SearchOrders'), 'help' => GetLang('SearchOrdersMenuHelp'), 'icon' => 'find.gif', 'link' => 'index.php?ToDo=searchOrders', 'show' => $show_manage_orders), array('text' => GetLang('ExportOrdersMenu'), 'help' => GetLang('ExportOrdersMenuHelp'), 'icon' => 'export.gif', 'link' => 'index.php?ToDo=startExport&t=orders', 'show' => in_array(AUTH_Export_Orders, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('ViewShipments'), 'help' => GetLang('ViewShipmentsHelp'), 'icon' => 'shipments.gif', 'link' => 'index.php?ToDo=viewShipments', 'show' => $show_manage_orders), array('text' => GetLang('ViewReturns'), 'help' => GetLang('ViewReturnsMenuHelp'), 'icon' => 'return.gif', 'link' => 'index.php?ToDo=viewReturns', 'show' => in_array(AUTH_Manage_Returns, $arrPermissions) && GetConfig('EnableReturns') && gzte11(ISC_LARGEPRINT)), array('text' => GetLang('ImportOrdertrackingnumbers'), 'help' => GetLang('ImportOrdertrackingnumbersMenuHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=importOrdertrackingnumbers', 'show' => $show_import_tracking_number))), 'mnuCustomers' => array('match' => 'customer', 'items' => array(array('text' => GetLang('ViewCustomers'), 'help' => GetLang('ViewCustomersMenuHelp'), 'icon' => 'customer.gif', 'link' => 'index.php?ToDo=viewCustomers', 'show' => $show_manage_customers), array('text' => GetLang('AddCustomers'), 'help' => GetLang('AddCustomersMenuHelp'), 'icon' => 'customers_add.gif', 'link' => 'index.php?ToDo=addCustomer', 'show' => in_array(AUTH_Add_Customer, $arrPermissions)), array('text' => GetLang('CustomerGroups'), 'help' => GetLang('CustomerGroupsMenuHelp'), 'icon' => 'customer_group.gif', 'link' => 'index.php?ToDo=viewCustomerGroups', 'show' => in_array(AUTH_Customer_Groups, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('SearchCustomers'), 'help' => GetLang('SearchCustomersMenuHelp'), 'icon' => 'find.gif', 'link' => 'index.php?ToDo=searchCustomers', 'show' => $show_manage_customers), array('text' => GetLang('ImportCustomers'), 'help' => GetLang('ImportCustomersMenuHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=importCustomers', 'show' => in_array(AUTH_Import_Customers, $arrPermissions)), array('text' => GetLang('ExportCustomersMenu'), 'help' => GetLang('ExportCustomersMenuHelp'), 'icon' => 'export.gif', 'link' => 'index.php?ToDo=startExport&t=customers', 'show' => in_array(AUTH_Export_Customers, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('WishListCustomers'), 'help' => GetLang('WishListCustomersMenuHelp'), 'icon' => 'customers_add.gif', 'link' => 'index.php?ToDo=wishlist', 'show' => in_array(AUTH_Add_Customer, $arrPermissions)))), 'mnuProducts' => array('match' => array('product', 'review', 'categor'), 'items' => array(array('text' => GetLang('ViewProducts'), 'help' => GetLang('ViewProductsMenuHelp'), 'icon' => 'product.gif', 'link' => 'index.php?ToDo=viewProducts', 'show' => $show_manage_products), array('text' => GetLang('AddProduct'), 'help' => GetLang('AddProductMenuHelp'), 'icon' => 'product_add.gif', 'link' => 'index.php?ToDo=addProduct', 'show' => in_array(AUTH_Create_Product, $arrPermissions)), array('text' => GetLang('ViewCategories'), 'help' => GetLang('ViewCategoriesMenuHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewCategories', 'show' => $show_manage_categories), array('text' => GetLang('ProductVariations'), 'help' => GetLang('ProductVariationsMenuHelp'), 'icon' => 'product_variation.gif', 'link' => 'index.php?ToDo=viewProductVariations', 'show' => in_array(AUTH_Manage_Variations, $arrPermissions)), array('text' => GetLang('SearchProducts'), 'help' => GetLang('SearchProductsMenuHelp'), 'icon' => 'find.gif', 'link' => 'index.php?ToDo=searchProducts', 'show' => $show_manage_products), array('text' => GetLang('ImportProducts'), 'help' => GetLang('ImportProductsMenuHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=importProducts', 'show' => in_array(AUTH_Import_Products, $arrPermissions)), array('text' => GetLang('ExportProductsMenu'), 'help' => GetLang('ExportProductsMenuHelp'), 'icon' => 'export.gif', 'link' => 'index.php?ToDo=startExport&t=products', 'show' => in_array(AUTH_Export_Products, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('ManageReviews'), 'help' => GetLang('ViewReviewsMenuHelp'), 'icon' => 'comment_view.gif', 'link' => 'index.php?ToDo=viewReviews', 'show' => in_array(AUTH_Manage_Reviews, $arrPermissions)), array('text' => GetLang('SettingsNew'), 'help' => GetLang('SettingsHelp'), 'icon' => 'product_add.gif', 'link' => '#', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions), 'items' => array(array('text' => GetLang('ValidMMY'), 'help' => GetLang('ViewMMYHelp'), 'icon' => 'brand_menu.gif', 'link' => 'index.php?ToDo=viewMMY', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions)), array('text' => GetLang('QualifierAssociations'), 'help' => GetLang('QualifierAssociationsHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewQualifierAssociations', 'show' => in_array(AUTH_Qualifier_Associations, $arrPermissions)), array('text' => GetLang('QValueAssociations'), 'help' => GetLang('QValueAssociationsHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewQValueAssociations', 'show' => in_array(AUTH_QValue_Associations, $arrPermissions)))), array('text' => GetLang('ViewBrands'), 'help' => GetLang('ViewBrandsHelp'), 'icon' => 'brand_menu.gif', 'link' => 'index.php?ToDo=viewBrands', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions)), array('text' => GetLang('ImportLog'), 'help' => GetLang('ImportLogHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=viewImportlog', 'show' => in_array(AUTH_Import_Products, $arrPermissions)), array('text' => GetLang('FileManagement'), 'help' => GetLang('FileManagementHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewFileManagement', 'show' => in_array(AUTH_QValue_Associations, $arrPermissions)), array('text' => GetLang('ChangesReport'), 'help' => GetLang('ChangesReportHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewChangesReport', 'show' => in_array(AUTH_Changes_Report, $arrPermissions)))), 'mnuContent' => array('match' => array('news', 'page'), 'ignore' => array('vendor'), 'items' => array(array('text' => GetLang('ViewNews'), 'help' => GetLang('ViewNewsMenuHelp'), 'icon' => 'news.gif', 'link' => 'index.php?ToDo=viewNews', 'show' => in_array(AUTH_Manage_News, $arrPermissions)), array('text' => GetLang('AddNews'), 'help' => GetLang('AddNewsMenuHelp'), 'icon' => 'news_add.gif', 'link' => 'index.php?ToDo=addNews', 'show' => in_array(AUTH_Manage_News, $arrPermissions)), array('text' => GetLang('ViewWebPages'), 'help' => GetLang('ViewWebPagesMenuHelp'), 'icon' => 'page.gif', 'link' => 'index.php?ToDo=viewPages', 'show' => in_array(AUTH_Manage_Pages, $arrPermissions)), array('text' => GetLang('CreateAWebPage'), 'help' => GetLang('CreateWebPageMenuHelp'), 'icon' => 'page_add.gif', 'link' => 'index.php?ToDo=createPage', 'show' => in_array(AUTH_Manage_Pages, $arrPermissions)))), 'mnuPromotions' => array('match' => array('coupon', 'banner', 'discount', 'giftcertificates'), 'items' => array(array('text' => GetLang('ViewBanners'), 'help' => GetLang('ViewBannersMenuHelp'), 'icon' => 'banner.gif', 'link' => 'index.php?ToDo=viewBanners', 'show' => in_array(AUTH_Manage_Banners, $arrPermissions)), array('text' => GetLang('ViewCoupons'), 'help' => GetLang('ViewCouponsMenuHelp'), 'icon' => 'coupon.gif', 'link' => 'index.php?ToDo=viewCoupons', 'show' => in_array(AUTH_Manage_Coupons, $arrPermissions)), array('text' => GetLang('CouponsSettings'), 'help' => GetLang('CouponsSettingsMenuHelp'), 'icon' => 'coupon.gif', 'link' => 'index.php?ToDo=Couponssettings', 'show' => in_array(AUTH_Manage_Coupons, $arrPermissions)), array('text' => GetLang('ViewDiscounts'), 'help' => GetLang('ViewDiscountsMenuHelp'), 'icon' => 'discountrule.gif', 'link' => 'index.php?ToDo=viewDiscounts', 'show' => in_array(AUTH_Manage_Discounts, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('ViewGiftCertificates'), 'help' => GetLang('ViewGiftCertificatesMenuHelp'), 'icon' => 'giftcertificate.gif', 'link' => 'index.php?ToDo=viewGiftCertificates', 'show' => in_array(AUTH_Manage_GiftCertificates, $arrPermissions) && gzte11(ISC_LARGEPRINT)), array('text' => GetLang('NewsletterSubscribers'), 'help' => GetLang('ViewSubscribersMenuHelp'), 'icon' => 'subscriber.gif', 'link' => $subscriber_link, 'class' => $subscriber_class, 'show' => in_array(AUTH_Newsletter_Subscribers, $arrPermissions)), array('text' => GetLang('CreateFroogleFeed'), 'help' => GetLang('GoogleProductsFeedMenuHelp'), 'icon' => 'google.gif', 'link' => 'index.php?ToDo=exportFroogleIntro&height=260&width=400', 'class' => 'thickbox', 'show' => in_array(AUTH_Export_Froogle, $arrPermissions)))), 'mnuStatistics' => array('match' => 'stats', 'items' => array(array('text' => GetLang('StoreOverview'), 'help' => GetLang('StoreOverviewMenuHelp'), 'icon' => 'stats_overview.gif', 'link' => 'index.php?ToDo=viewStats', 'show' => in_array(AUTH_Statistics_Overview, $arrPermissions)), array('text' => GetLang('OrderStatistics'), 'help' => GetLang('OrderStatsMenuHelp'), 'icon' => 'stats_orders.gif', 'link' => 'index.php?ToDo=viewOrdStats', 'show' => in_array(AUTH_Statistics_Orders, $arrPermissions)), array('text' => GetLang('ProductStatistics'), 'help' => GetLang('ProductStatsMenuHelp'), 'icon' => 'stats_products.gif', 'link' => 'index.php?ToDo=viewProdStats', 'show' => in_array(AUTH_Statistics_Products, $arrPermissions)), array('text' => GetLang('CustomerStatistics'), 'help' => GetLang('CustomerStatsMenuHelp'), 'icon' => 'stats_customers.gif', 'link' => 'index.php?ToDo=viewCustStats', 'show' => in_array(AUTH_Statistics_Customers, $arrPermissions)), array('text' => GetLang('SearchStatistics'), 'help' => GetLang('SearchStatsHelp'), 'icon' => 'stats_search.gif', 'link' => 'index.php?ToDo=viewSearchStats', 'show' => in_array(AUTH_Statistics_Search, $arrPermissions))))); // Now that we've loaded the default menu, let's check if there are any addons we need to load $this->_LoadAddons($menuItems); $imagesDir = dirname(__FILE__) . '/../../images'; $menu = "\n" . '<div id="headerMenu">' . "\n" . '<ul>' . "\n"; foreach ($menuItems as $image => $link) { // By default we wont highlight this tab $highlight_tab = false; if ($link['match'] && isset($_REQUEST['ToDo'])) { // If the URI matches the "match" index, we'll highlight the tab $page = @isc_strtolower($_REQUEST['ToDo']); if (isset($GLOBALS['HighlightedMenuItem']) && $GLOBALS['HighlightedMenuItem'] == $image) { $highlight_tab = true; } // Does it need to match mutiple words? if (is_array($link['match'])) { foreach ($link['match'] as $match_it) { if ($match_it == "") { continue; } if (is_numeric(isc_strpos($page, isc_strtolower($match_it)))) { $highlight_tab = true; } } } else { if (is_numeric(isc_strpos($page, $link['match']))) { $highlight_tab = true; } } if (isset($link['ignore']) && is_array($link['ignore'])) { foreach ($link['ignore'] as $ignore) { if (isc_strpos($page, strtolower($ignore)) !== false) { $highlight_tab = false; } } } } // If the menu has sub menus, display them if (is_array($link['items'])) { $first = true; $shown = false; foreach ($link['items'] as $id => $sub) { if (is_numeric($id)) { // If the child is forbidden by law, hide it if (@(!$sub['show'])) { continue; } else { $shown = true; } // If its the first born, give it an image if ($first) { $menu .= '<li class="dropdown'; if ($highlight_tab) { $menu .= ' dropselected'; } $menu .= '"><a href="' . $sub['link'] . '">'; $class = $image; if ($highlight_tab) { $image .= "On"; } $filename = $imagesDir . DIRECTORY_SEPARATOR . $image . '.gif'; if (file_exists($filename)) { list($width, $height, $type, $attr) = getimagesize($filename); $menu .= '<img ' . $attr . ' src="images/' . $image . '.gif" border="0" style="padding-right:2px" />'; } else { $menu .= $image; } $menu .= '</a>' . "\n"; if (count($link) > 1) { $menu .= '<ul>' . "\n"; } $first = false; } // If it's not an only child, don't show the first item as a child if (count($link) > 1) { $extraclass = ''; if (isset($sub['class'])) { $extraclass = $sub['class']; } // Is there help text set for this item? if (isset($sub['help'])) { if (isset($sub['is_addon'])) { $icon = $sub['icon']; } else { $icon = "images/" . $sub['icon']; } if (@is_array($sub['items'])) { $subsub = $this->GetSubSub($sub); } else { $subsub = ''; } $menu .= '<li><a style="background-image: url(' . $icon . ');" class="menu_' . $class . ' ' . $extraclass . '" href="' . $sub['link'] . '" onclick="closeMenu()"><strong>' . $sub['text'] . '</strong><span>' . $sub['help'] . '</span></a>' . $subsub . '</li>' . "\n"; } else { $menu .= '<li><a class="menu_' . $class . ' ' . $extraclass . '" href="' . $sub['link'] . '">' . $sub['text'] . '</a></li>' . "\n"; } } } } if ($shown) { if (count($link) > 1) { $menu .= '</ul>' . "\n"; } $menu .= '</li>' . "\n"; } } } $menu .= '</ul></div>' . "\n"; return $menu; }
public function SetComparisonData() { if ($GLOBALS['EnableSEOUrls']) { $path = '/' . implode('/', $GLOBALS['PathInfo']) . '/'; } else { if (isset($_SERVER['REQUEST_URI'])) { $path = $_SERVER['REQUEST_URI']; } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { $path = $_SERVER['HTTP_X_REWRITE_URL']; } else { $path = $_SERVER['QUERY_STRING']; } $path = preg_replace('#\\.php[\\?]?#si', '/', $path); } // Retrieve the query string variables. Can't use the $_GET array // because of SEO friendly links in the URL SetPGQVariablesManually(); if (isset($_GET['sort'])) { $sort = $_GET['sort']; switch ($sort) { case "product_name": $this->_comparesort = "p.prodname asc"; break; case "product_price": $this->_comparesort = "p.prodcalculatedprice asc"; break; case "product_rating": $this->_comparesort = "prodavgrating asc"; break; case "product_brand": $this->_comparesort = "brand asc"; break; } } if (is_numeric(isc_strpos($path, '/compare/'))) { $iPos = isc_strpos($path, '/compare/') + isc_strlen('/compare/'); $ids = isc_substr($path, $iPos, isc_strlen($path)); } else { $ids = $path; } // With SEO urls off the url might have additional get vars (e.g. sorting) so make sure // we don't include those otherwise the last productid will fail the is_numeric check if (isc_strpos($ids, '&') !== false) { $ids = isc_substr($ids, 0, isc_strpos($ids, '&')); } $ids = rtrim($ids, '/'); $ids_array = explode('?', $ids); $ids = $ids_array[0]; $exploded_ids = explode('/', $ids); foreach ($exploded_ids as $k => $v) { if (!is_numeric($v) || $v < 0) { unset($exploded_ids[$k]); } } $exploded_ids = array_unique($exploded_ids); $this->_compareids = implode('/', $exploded_ids); $this->_compareproducts = $exploded_ids; // Are we comparing more products than allowed by the template? $this->CheckTemplateRestrictions(); // Load the products to compare $this->LoadProductsToCompare(); }
public function HandleSTSToDo($ToDo) { $do = isc_strtolower($ToDo); // NI cloud 2010-06-08 export search statistic to csv file if ($do === 'exsearchstats') { $GLOBALS['ISC_CLASS_ADMIN_EXPORT_SEARCH_STATISTIC'] = GetClass('ISC_ADMIN_EXPORT_SEARCH_STATISTIC'); $GLOBALS['ISC_CLASS_ADMIN_EXPORT_SEARCH_STATISTIC']->HandleToDo(); return; } if (is_numeric(isc_strpos($do, "vendorpayment"))) { $GLOBALS['ISC_CLASS_ADMIN_VENDOR_PAYMENTS'] = GetClass('ISC_ADMIN_VENDOR_PAYMENTS'); $GLOBALS['ISC_CLASS_ADMIN_VENDOR_PAYMENTS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "vendor"))) { $GLOBALS['ISC_CLASS_ADMIN_VENDORS'] = GetClass('ISC_ADMIN_VENDORS'); $GLOBALS['ISC_CLASS_ADMIN_VENDORS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "page"))) { $GLOBALS['ISC_CLASS_ADMIN_PAGES'] = GetClass('ISC_ADMIN_PAGES'); $GLOBALS['ISC_CLASS_ADMIN_PAGES']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "product"))) { $GLOBALS['ISC_CLASS_ADMIN_PRODUCT'] = GetClass('ISC_ADMIN_PRODUCT'); $GLOBALS['ISC_CLASS_ADMIN_PRODUCT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "qualifierassociation"))) { $GLOBALS['ISC_CLASS_ADMIN_QUALIFIER_ASSOCIATIONS'] = GetClass('ISC_ADMIN_QUALIFIER_ASSOCIATIONS'); $GLOBALS['ISC_CLASS_ADMIN_QUALIFIER_ASSOCIATIONS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "qvalueassociation"))) { $GLOBALS['ISC_CLASS_ADMIN_QVALUE_ASSOCIATIONS'] = GetClass('ISC_ADMIN_QVALUE_ASSOCIATIONS'); $GLOBALS['ISC_CLASS_ADMIN_QVALUE_ASSOCIATIONS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "filemanagement"))) { $GLOBALS['ISC_CLASS_ADMIN_FILE_MANAGEMENT'] = GetClass('ISC_ADMIN_FILE_MANAGEMENT'); $GLOBALS['ISC_CLASS_ADMIN_FILE_MANAGEMENT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "changesreport"))) { $GLOBALS['ISC_CLASS_ADMIN_CHANGES_REPORT'] = GetClass('ISC_ADMIN_CHANGES_REPORT'); $GLOBALS['ISC_CLASS_ADMIN_CHANGES_REPORT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "review"))) { $GLOBALS['ISC_CLASS_ADMIN_REVIEW'] = GetClass('ISC_ADMIN_REVIEW'); $GLOBALS['ISC_CLASS_ADMIN_REVIEW']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "categ"))) { $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY'); $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "shipment")) || is_numeric(isc_strpos($do, "packingslip"))) { $GLOBALS['ISC_CLASS_ADMIN_SHIPMENTS'] = GetClass('ISC_ADMIN_SHIPMENTS'); $GLOBALS['ISC_CLASS_ADMIN_SHIPMENTS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "order"))) { $GLOBALS['ISC_CLASS_ADMIN_ORDERS'] = GetClass('ISC_ADMIN_ORDERS'); $GLOBALS['ISC_CLASS_ADMIN_ORDERS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "offer"))) { $GLOBALS['ISC_CLASS_ADMIN_OFFERS'] = GetClass('ISC_ADMIN_OFFERS'); $GLOBALS['ISC_CLASS_ADMIN_OFFERS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "giftwrap"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_GIFTWRAPPING'] = GetClass('ISC_ADMIN_SETTINGS_GIFTWRAPPING'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_GIFTWRAPPING']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "customer"))) { $GLOBALS['ISC_CLASS_ADMIN_CUSTOMERS'] = GetClass('ISC_ADMIN_CUSTOMERS'); $GLOBALS['ISC_CLASS_ADMIN_CUSTOMERS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "shippingsettings")) || is_numeric(isc_strpos($do, "shippingzone")) || is_numeric(isc_strpos($do, "testshipping"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING'] = GetClass('ISC_ADMIN_SETTINGS_SHIPPING'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "accountingsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ACCOUNTING'] = GetClass('ISC_ADMIN_SETTINGS_ACCOUNTING'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ACCOUNTING']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "scriptsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ORDER'] = GetClass('ISC_ADMIN_SETTINGS_ORDER'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ORDER']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "checkoutsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_CHECKOUT'] = GetClass('ISC_ADMIN_SETTINGS_CHECKOUT'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_CHECKOUT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "news"))) { $GLOBALS['ISC_CLASS_ADMIN_NEWS'] = GetClass('ISC_ADMIN_NEWS'); $GLOBALS['ISC_CLASS_ADMIN_NEWS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "coupon"))) { $GLOBALS['ISC_CLASS_ADMIN_COUPONS'] = GetClass('ISC_ADMIN_COUPONS'); $GLOBALS['ISC_CLASS_ADMIN_COUPONS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "discount"))) { $GLOBALS['ISC_CLASS_ADMIN_COUPONS'] = GetClass('ISC_ADMIN_DISCOUNTS'); $GLOBALS['ISC_CLASS_ADMIN_COUPONS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "subscribers"))) { $GLOBALS['ISC_CLASS_ADMIN_SUBSCRIBERS'] = GetClass('ISC_ADMIN_SUBSCRIBERS'); $GLOBALS['ISC_CLASS_ADMIN_SUBSCRIBERS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "froogle"))) { $GLOBALS['ISC_CLASS_ADMIN_FROOGLE'] = GetClass('ISC_ADMIN_FROOGLE'); $GLOBALS['ISC_CLASS_ADMIN_FROOGLE']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "exporttemplate"))) { $GLOBALS['ISC_CLASS_ADMIN_EXPORTTEMPLATES'] = GetClass('ISC_ADMIN_EXPORTTEMPLATES'); $GLOBALS['ISC_CLASS_ADMIN_EXPORTTEMPLATES']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "importtemplate"))) { $GLOBALS['ISC_CLASS_ADMIN_IMPORTTEMPLATES'] = GetClass('ISC_ADMIN_IMPORTTEMPLATES'); $GLOBALS['ISC_CLASS_ADMIN_IMPORTTEMPLATES']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "export"))) { $GLOBALS['ISC_CLASS_ADMIN_EXPORT'] = GetClass('ISC_ADMIN_EXPORT'); $GLOBALS['ISC_CLASS_ADMIN_EXPORT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "template"))) { $GLOBALS['ISC_CLASS_ADMIN_LAYOUT'] = GetClass('ISC_ADMIN_LAYOUT'); $GLOBALS['ISC_CLASS_ADMIN_LAYOUT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "user"))) { $GLOBALS['ISC_CLASS_ADMIN_USER'] = GetClass('ISC_ADMIN_USER'); $GLOBALS['ISC_CLASS_ADMIN_USER']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "banner"))) { $GLOBALS['ISC_CLASS_ADMIN_BANNERS'] = GetClass('ISC_ADMIN_BANNERS'); $GLOBALS["ISC_CLASS_ADMIN_BANNERS"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "brand"))) { $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS'); $GLOBALS["ISC_CLASS_ADMIN_BRANDS"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "livechatsettings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_LIVECHAT'] = GetClass('ISC_ADMIN_SETTINGS_LIVECHAT'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_LIVECHAT']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "importlog"))) { $GLOBALS['ISC_CLASS_ADMIN_IMPORT_LOG'] = GetClass('ISC_ADMIN_IMPORTLOG'); $GLOBALS["ISC_CLASS_ADMIN_IMPORT_LOG"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "series"))) { $GLOBALS['ISC_CLASS_ADMIN_SERIES'] = GetClass('ISC_ADMIN_SERIES'); $GLOBALS["ISC_CLASS_ADMIN_SERIES"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "defect"))) { $GLOBALS['ISC_CLASS_ADMIN_DEFECT'] = GetClass('ISC_ADMIN_DEFECT'); $GLOBALS["ISC_CLASS_ADMIN_DEFECT"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "mmy"))) { $GLOBALS['ISC_CLASS_ADMIN_MMY'] = GetClass('ISC_ADMIN_MMY'); $GLOBALS["ISC_CLASS_ADMIN_MMY"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "sweepstakes"))) { $GLOBALS['ISC_CLASS_ADMIN_SWEEPSTAKES'] = GetClass('ISC_ADMIN_SWEEPSTAKES'); $GLOBALS["ISC_CLASS_ADMIN_SWEEPSTAKES"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "wishlist"))) { $GLOBALS['ISC_CLASS_ADMIN_MMY'] = GetClass('ISC_ADMIN_WISHLIST'); $GLOBALS["ISC_CLASS_ADMIN_MMY"]->HandleToDo($ToDo); } else { if (isc_strpos($do, 'settings') !== false && isc_strpos($do, 'tax') !== false) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_TAX'] = GetClass('ISC_ADMIN_SETTINGS_TAX'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_TAX']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "settings"))) { $GLOBALS['ISC_CLASS_ADMIN_SETTINGS'] = GetClass('ISC_ADMIN_SETTINGS'); $GLOBALS['ISC_CLASS_ADMIN_SETTINGS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "backup"))) { $GLOBALS['ISC_CLASS_ADMIN_BACKUP'] = GetClass('ISC_ADMIN_BACKUP'); $GLOBALS["ISC_CLASS_ADMIN_BACKUP"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "stats"))) { $GLOBALS['ISC_CLASS_ADMIN_STATITICS'] = GetClass('ISC_ADMIN_STATISTICS'); $GLOBALS['ISC_CLASS_ADMIN_STATITICS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "delinker"))) { $GLOBALS['ISC_CLASS_ADMIN_DELINKER'] = GetClass('ISC_ADMIN_DELINKER'); } else { if (is_numeric(isc_strpos($do, "converter")) && is_dir(APP_ROOT . "/includes/converter")) { include APP_ROOT . "/includes/converter/class.converter.php"; $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"] = new ISC_ADMIN_CONVERTER(); $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "exporter")) && is_dir(APP_ROOT . "/includes/converter")) { include APP_ROOT . "/includes/converter/class.exporter.php"; $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"] = new ISC_ADMIN_EXPORTER(); $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "log"))) { $GLOBALS['ISC_CLASS_ADMIN_LOGS'] = GetClass('ISC_ADMIN_LOGS'); $GLOBALS['ISC_CLASS_ADMIN_LOGS']->HandleToDo($ToDo); } else { if (is_numeric(strpos($do, "quicksearch"))) { $GLOBALS['ISC_CLASS_ADMIN_QUICKSEARCH'] = GetClass('ISC_ADMIN_QUICKSEARCH'); $GLOBALS['ISC_CLASS_ADMIN_QUICKSEARCH']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "return")) && GetConfig('EnableReturns') && gzte11(ISC_LARGEPRINT)) { $GLOBALS['ISC_CLASS_ADMIN_RETURNS'] = GetClass('ISC_ADMIN_RETURNS'); $GLOBALS['ISC_CLASS_ADMIN_RETURNS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "companygiftcertificate")) && GetConfig('EnableCompanyGiftCertificates') && gzte11(ISC_LARGEPRINT)) { $GLOBALS['ISC_CLASS_ADMIN_COMPANY_GIFTCERTIFICATES'] = GetClass('ISC_ADMIN_COMPANY_GIFTCERTIFICATES'); $GLOBALS['ISC_CLASS_ADMIN_COMPANY_GIFTCERTIFICATES']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "giftcertificate")) && GetConfig('EnableGiftCertificates') && gzte11(ISC_LARGEPRINT)) { $GLOBALS['ISC_CLASS_ADMIN_GIFTCERTIFICATES'] = GetClass('ISC_ADMIN_GIFTCERTIFICATES'); $GLOBALS['ISC_CLASS_ADMIN_GIFTCERTIFICATES']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "systeminfo"))) { $GLOBALS['ISC_CLASS_ADMIN_SYSINFO'] = GetClass('ISC_ADMIN_SYSINFO'); $GLOBALS['ISC_CLASS_ADMIN_SYSINFO']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "runaddon"))) { $GLOBALS['ISC_CLASS_ADMIN_ADDON'] = GetClass('ISC_ADMIN_ADDON'); $GLOBALS["ISC_CLASS_ADMIN_ADDON"]->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "downloadaddons"))) { $GLOBALS['ISC_CLASS_ADMIN_DOWNLOADADDONS'] = GetClass('ISC_ADMIN_DOWNLOADADDONS'); $GLOBALS['ISC_CLASS_ADMIN_DOWNLOADADDONS']->HandleToDo($ToDo); } else { if (is_numeric(isc_strpos($do, "formfields"))) { $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS'] = GetClass('ISC_ADMIN_FORMFIELDS'); $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS']->HandleToDo($ToDo); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } }
private function GetQuote() { // The following array will be returned to the calling function. // It will contain at least one ISC_SHIPPING_QUOTE object if // the shipping quote was successful. $is_quote = array(); // Connect to Intershipper to retrieve a live shipping quote $items = ""; $result = ""; $valid_quote = false; $is_url = "http://www.intershipper.com/Interface/Intershipper/XML/v2.0/HTTP.jsp?"; // Workout the carrier data $carrier_data = array(); $carrier_count = 1; if(!is_array($this->_carriers) && $this->_carriers != "") { $this->_carriers = array($this->_carriers); } foreach($this->_carriers as $carrier) { array_push($carrier_data, sprintf("CarrierCode%d=%s", $carrier_count, $carrier)); array_push($carrier_data, sprintf("CarrierInvoiced%d=1", $carrier_count)); $carrier_count++; } $post_vars = implode("&", array("Version=2.0.0.0", "Username="******"Password="******"TotalCarriers=" . count($this->_carriers) ) ); $post_vars .= "&" . implode("&", $carrier_data); $post_vars .= "&TotalClasses=" . count($this->_shipclasses); // Workout the classes data $class_data = array(); $class_count = 1; if(!is_array($this->_shipclasses) && $this->_shipclasses != "") { $this->_shipclasses = array($this->_shipclasses); } foreach($this->_shipclasses as $shipclass) { array_push($class_data, sprintf("ClassCode%d=%s", $class_count, $shipclass)); $class_count++; } $post_vars .= "&" . implode("&", $class_data) . "&"; $post_vars .= implode("&", array("DeliveryType=" . $this->_destinationtype, "ShipMethod=" . $this->_shippingmethod, "OriginationPostal=" . $this->_origin_zip, "OriginationCountry=" . $this->_origin_country['country_iso'], "DestinationPostal=" . $this->_destzip, "DestinationCountry=" . $this->_destcountry, "Currency=USD", "SortBy=" . $this->_sort, "TotalPackages=" . $this->getnumproducts() ) ); // Workout the box data $box_data = array(); $box_count = 1; if(isc_strtolower(GetConfig('LengthMeasurement')) == "inches") { $length_measure = "IN"; } else { $length_measure = "CM"; } foreach($this->getproducts() as $item) { array_push($box_data, sprintf("BoxID%d=item%d", $box_count, $box_count)); array_push($box_data, sprintf("Weight%d=%s", $box_count, ConvertWeight($item->getweight(), 'kgs'))); array_push($box_data, sprintf("WeightUnit%d=%s", $box_count, 'KG')); array_push($box_data, sprintf("Length%d=%s", $box_count, ConvertLength($item->getlength(), $length_measure))); array_push($box_data, sprintf("Width%d=%s", $box_count, ConvertLength($item->getwidth(), $length_measure))); array_push($box_data, sprintf("Height%d=%s", $box_count, ConvertLength($item->getheight(), $length_measure))); array_push($box_data, sprintf("DimensionalUnit%d=%s", $box_count, $length_measure)); array_push($box_data, sprintf("Packaging%d=%s", $box_count, $this->_packagingtype)); array_push($box_data, sprintf("Contents%d=OTR", $box_count)); $box_count++; } $post_vars .= "&" . implode("&", $box_data); $post_vars .= "&TotalOptions=0"; if(function_exists("curl_exec")) { // Use CURL if it's available $ch = @curl_init($is_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Setup the proxy settings if there are any if (GetConfig('HTTPProxyServer')) { curl_setopt($ch, CURLOPT_PROXY, GetConfig('HTTPProxyServer')); if (GetConfig('HTTPProxyPort')) { curl_setopt($ch, CURLOPT_PROXYPORT, GetConfig('HTTPProxyPort')); } } if (GetConfig('HTTPSSLVerifyPeer') == 0) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } $result = curl_exec($ch); if($result != "") { $valid_quote = true; } } else { // Use fopen instead if($fp = @fopen($is_url . $post_vars, "rb")) { $result = ""; while(!feof($fp)) { $result .= fgets($fp, 4096); } @fclose($fp); $valid_quote = true; } } if($valid_quote) { if(is_numeric(isc_strpos($result, "Invalid User"))) { $this->SetError(GetLang('IntershipperAuthError')); return false; } else { $xml = xmlize($result); if(isset($xml['shipment'])) { // Is there an error? if(isset($xml['shipment']["#"]['error'])) { $this->SetError($xml['shipment']["#"]['error'][0]["#"]); return false; } else { if(isset($xml['shipment']["#"]['package'][0]["#"]['quote'])) { // Successful quote foreach($xml['shipment']["#"]['package'][0]["#"]['quote'] as $quote) { $shipper = $quote["#"]['carrier'][0]["#"]['name'][0]["#"]; // Shorten the length of the shipper's name // DHL $shipper = str_replace(" World Wide Express", "", $shipper); // UPS $shipper = str_replace("United Parcel Service", "", $shipper); // FedEx $shipper = str_replace("Federal Express", "FedEx", $shipper); // USPS $shipper = str_replace("U.S. Postal Service", "USPS", $shipper); $method = $quote["#"]['service'][0]["#"]['name'][0]["#"]; // Shorten the length of the method // USPS $method = str_replace("USP ", "", $method); $desc = trim(sprintf("%s %s", $shipper, $method)); $price = $quote["#"]['rate'][0]["#"]['amount'][0]["#"] / 100; $transit_time = -1; // Workout the time in transit (if any) $today_stamp = mktime(0, 0, 0, date("m"), date("d"), date("Y")); if(isset($quote["#"]['guaranteedarrival'])) { $delivered = $quote["#"]['guaranteedarrival'][0]["#"]['date'][0]["#"]; $arr_delivered = explode("/", $delivered); if(count($arr_delivered) == 3) { $delivered_stamp = mktime(0, 0, 0, $arr_delivered[0], $arr_delivered[1], $arr_delivered[2]); $transit_time = $delivered_stamp - $today_stamp; // Convert transit time to days $transit_time = floor($transit_time/60/60/24); } } else if(isset($quote["#"]['nonguaranteedarrival'])) { $delivered = $quote["#"]['nonguaranteedarrival'][0]["#"]['earliestarrivaldate'][0]["#"]; $arr_delivered = explode("/", $delivered); if(count($arr_delivered) == 3) { $delivered_stamp = mktime(0, 0, 0, $arr_delivered[0], $arr_delivered[1], $arr_delivered[2]); $transit_time = $delivered_stamp - $today_stamp; // Convert transit time to days $transit_time = floor($transit_time/60/60/24); } } // Create a quote object $quote = new ISC_SHIPPING_QUOTE($this->GetId(), $this->GetDisplayName(), $price, $desc, $transit_time); // Append it to the list of shipping methods array_push($is_quote, $quote); } } else { $this->SetError(GetLang('IntershipperBadDestination')); return false; } } } else { // Error $this->SetError(GetLang('IntershipperBadResponse')); return false; } } } else { // Couldn't get to Intershipper $this->SetError(GetLang('IntershipperOpenError')); return false; } return $is_quote; }