예제 #1
0
	public function getSubscriptionFields()
	{
		// can't rely on ISC_ADMIN_ENGINE or admin lang stuff from here because this code may be run by the task manager
		$languagePath = ISC_BASE_PATH . '/language/' . GetConfig('Language') . '/admin';
		ParseLangFile($languagePath . '/common.ini');
		ParseLangFile($languagePath . '/settings.emailintegration.ini');

		$groups = array();

		$groups[GetLang('NewsletterFields')] = array(
			'subemail' => new Interspire_EmailIntegration_Field_Email('subemail', GetLang('EmailAddress')),
			'subfirstname' => new Interspire_EmailIntegration_Field_String('subfirstname', GetLang('FirstName')),
		);

		return $groups;
	}
예제 #2
0
	public function getSubscriptionFields()
	{
		// can't rely on ISC_ADMIN_ENGINE or admin lang stuff from here because this code may be run by the task manager
		$languagePath = ISC_BASE_PATH . '/language/' . GetConfig('Language') . '/admin';
		ParseLangFile($languagePath . '/common.ini');
		ParseLangFile($languagePath . '/customers.ini');
		ParseLangFile($languagePath . '/settings.emailintegration.ini');
		ParseLangFile($languagePath . '/export.filetype.customers.ini');

		/** @var ISC_FORM */
		$form = $GLOBALS['ISC_CLASS_FORM'];

		$groups = array();

		$accountLang = GetLang('EmailIntegrationCustomerSubscriptionAccountFields');
		$billingLang = GetLang('EmailIntegrationCustomerSubscriptionBillingFields');

		// these don't exist as form fields so create them manually
		$groups[$accountLang] = array(
			'custconfirstname' => new Interspire_EmailIntegration_Field_String('custconfirstname', GetLang('customerFirstName')),
			'custconlastname' => new Interspire_EmailIntegration_Field_String('custconlastname', GetLang('customerLastName')),
			'custconcompany' => new Interspire_EmailIntegration_Field_String('custconcompany', GetLang('customerCompany')),
			'customerid' => new Interspire_EmailIntegration_Field_Number('customerid', GetLang('customerID')),
		);

		$groups[$accountLang] += $this->mapFormFields($form->getFormFields(FORMFIELDS_FORM_ACCOUNT), array(
			'EmailAddress' => 'custconemail',
		));

		// these don't exist as form fields so create them manually
		$groups[$accountLang] += array(
			'custconphone' => new Interspire_EmailIntegration_Field_String('custconphone', GetLang('PhoneNumber')),
			'custstorecredit' => new Interspire_EmailIntegration_Field_Currency('custstorecredit', GetLang('StoreCredit')),
			'custdatejoined' => new Interspire_EmailIntegration_Field_Date('custdatejoined', GetLang('DateJoined')),
			'custlastmodified' => new Interspire_EmailIntegration_Field_Date('custlastmodified', GetLang('LastModified')),
			'groupname' => new Interspire_EmailIntegration_Field_String('groupname', GetLang('customerGroup')),
			'customergroupid' => new Interspire_EmailIntegration_Field_Number('customergroupid', GetLang('customerGroupID')),
		);

		// add generated fields that contain full address information as an array
		$groups[$billingLang]['CustomerSubscription_Address'] = new Interspire_EmailIntegration_Field_Address('CustomerSubscription_Address', GetLang('EmailIntegrationOrderSubscriptionFullAddress'));

		$groups[$billingLang] += $this->mapFormFields($form->getFormFields(FORMFIELDS_FORM_BILLING), array(
			'AddressLine1' => 'CustomerSubscription_Address_address1',
			'AddressLine2' => 'CustomerSubscription_Address_address2',
			'City' => 'CustomerSubscription_Address_city',
			'Country' => 'CustomerSubscription_Address_country',
			'State' => 'CustomerSubscription_Address_state',
			'Zip' => 'CustomerSubscription_Address_zip',
		), 'CustomerSubscription_Address_');

		$groups[$billingLang]['CustomerSubscription_Address_countryiso2'] = new Interspire_EmailIntegration_Field_String('CustomerSubscription_Address_countryiso2', GetLang('CountryIso2'));
		$groups[$billingLang]['CustomerSubscription_Address_countryiso3'] = new Interspire_EmailIntegration_Field_String('CustomerSubscription_Address_countryiso3', GetLang('CountryIso3'));

		return $groups;
	}
예제 #3
0
		/**
		 * Constructor function that determines whether or not the installer should be run.
		 */
		public function __construct()
		{
			$this->template = Interspire_Template::getInstance('admin');

			// is it already setup? if so, don't run the installer!
			if(!GetConfig("isSetup")) {
				if(isset($_GET['ToDo'])) {
					$todo = $_GET['ToDo'];
				} else {
					$todo = "";
				}

				// Load the installation language file
				$file = ISC_BASE_PATH.'/language/'.GetConfig('Language').'/admin/install.ini';
				ParseLangFile($file);

				// Make the folders appear in alphabetical order to make it easier to go through and fix up permissions
				natsort($this->FoldersToCheck);

				// Then order them by their depth
				usort($this->FoldersToCheck, array($this, 'dir_depth_compare'));

				// Installation is being performed via the command line
				if(defined('CLI_INSTALL')) {
					$this->apiMode = 'cli';

					// Setup the CLI install request, move the incoming variables in to the _POST array
					$this->SetupCliInstall();

					// Check requirements
					$this->CheckInstallationPrerequisites();

					// Run the installation
					$this->RunInstall();
					exit;
				}

				if((isset($_SERVER['HTTP_ACCEPT']) && $_SERVER['HTTP_ACCEPT'] == "application/xml") || (isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] == "application/xml")) {
					$this->apiMode = 'xml';

					// Set up the API request, move the incoming variables in to the _POST array
					$this->SetupApiInstall();

					// Check the prerequisites
					$this->CheckInstallationPrerequisites();

					// All that can be accessed in the install XML API is the RunInstall method, so run it now
					$this->RunInstall();
					exit;
				}

				switch(strtolower($todo)) {
					case "runinstallation": {
						$this->RunInstall();
						break;
					}
					default: {
						$this->GetVariables();
					}
				}

				// We don't want anything running after the installer!
				die();
			}
		}
예제 #4
0
		public function ParseModuleLangFile()
		{
			$backLangFile = dirname(__FILE__) . "/../../language/".GetConfig('Language')."/module_language.ini";
			ParseLangFile($backLangFile);
		}
예제 #5
0
		/**
		 * Load an admin language file with the specified name.
		 *
		 * @param string The name of the language file to load. (no extension)
		 */
		public function LoadLangFile($name)
		{
			$file = ISC_BASE_PATH.'/language/'.GetConfig('Language').'/admin/'.$name.'.ini';
			ParseLangFile($file);
		}
예제 #6
0
	/**
	 * Handle the action for this section.
	 *
	 * @param string The name of the action to do.
	 */
	public function HandleToDo($Do)
	{
		if (isset($_REQUEST["currentTab"])) {
			$GLOBALS["CurrentTab"] = (int)$_REQUEST["currentTab"];
		}
		else {
			$GLOBALS["CurrentTab"] = 0;
		}

		$GLOBALS["BreadcrumEntries"] = array (
			GetLang("Home") => "index.php",
			GetLang("Settings") => "index.php?ToDo=viewSettings",
			GetLang("AccountingSettings") => "index.php?ToDo=viewAccountingSettings"
		);

		if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Settings) || !gzte11(ISC_MEDIUMPRINT)) {
			$GLOBALS["ISC_CLASS_ADMIN_ENGINE"]->DoHomePage(GetLang("Unauthorized"), MSG_ERROR);
			return;
		}

		$GLOBALS["ISC_CLASS_ADMIN_ENGINE"]->LoadLangFile("settings.accounting");

		/**
		 * Load the language file
		 */
		$lang = "en";

		if (strpos(GetConfig("Language"), "/") === false) {
			$lang = GetConfig("Language");
		}

		ParseLangFile(ISC_BASE_PATH . "/modules/accounting/quickbooks/lang/" . $lang . "/language.ini");

		switch(isc_strtolower($Do))
		{
			case "viewaccountingsettings": {
				$GLOBALS["ISC_CLASS_ADMIN_ENGINE"]->PrintHeader();
				$this->ManageAccountingSettings();
				$GLOBALS["ISC_CLASS_ADMIN_ENGINE"]->PrintFooter();
				break;
			}
			case "saveupdatedaccountingsettings": {
				$GLOBALS["ISC_CLASS_ADMIN_ENGINE"]->PrintHeader();
				$this->SaveUpdatedAccountingSettings();
				$GLOBALS["ISC_CLASS_ADMIN_ENGINE"]->PrintFooter();
				break;
			}
			case "getfileaccountingsettings": {
				$this->getFileAccountingSettings();
				break;
			}
			default:
				if(!isset($_REQUEST['ajax'])) {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
				}
				$this->ManageAccountingSettings();
				if(!isset($_REQUEST['ajax'])) {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
				}
				break;
		}
	}
예제 #7
0
파일: Order.php 프로젝트: hungnv0789/vhtm
	public function getSubscriptionFields()
	{
		// can't rely on ISC_ADMIN_ENGINE or admin lang stuff from here because this code may be run by the task manager
		$languagePath = ISC_BASE_PATH . '/language/' . GetConfig('Language') . '/admin';
		ParseLangFile($languagePath . '/common.ini');
		ParseLangFile($languagePath . '/settings.emailintegration.ini');
		ParseLangFile($languagePath . '/export.filetype.orders.ini');

		/** @var ISC_FORM */
		$form = $GLOBALS['ISC_CLASS_FORM'];

		$groups = array();

		$accountLang = GetLang('EmailIntegrationOrderSubscriptionAccountFields');
		$billingLang = GetLang('EmailIntegrationOrderSubscriptionBillingFields');
		$orderLang = GetLang('EmailIntegrationOrderSubscriptionOrderFields');

		$groups[$accountLang] = $this->mapFormFields($form->getFormFields(FORMFIELDS_FORM_ACCOUNT), array(
			'EmailAddress' => 'ordbillemail',
		));

		$groups[$orderLang] = array(
			'orderid' => new Interspire_EmailIntegration_Field_Int('orderid', GetLang('orderID')),
			'orddate' => new Interspire_EmailIntegration_Field_Date('orddate', GetLang('orderDate')),
			'subtotal_ex_tax' => new Interspire_EmailIntegration_Field_Currency('subtotal_ex_tax', GetLang('orderSubtotalEx')),
			'subtotal_inc_tax' => new Interspire_EmailIntegration_Field_Currency('subtotal_inc_tax', GetLang('orderSubtotalInc')),
			'total_ex_tax' => new Interspire_EmailIntegration_Field_Currency('total_ex_tax', GetLang('orderTotalAmountEx')),
			'total_inc_tax' => new Interspire_EmailIntegration_Field_Currency('total_inc_tax', GetLang('orderTotalAmountInc')),
			'ordipaddress' => new Interspire_EmailIntegration_Field_Ip('ordipaddress', GetLang('CustomerIPAddress')),
			'orderpaymentmethod' => new Interspire_EmailIntegration_Field_String('orderpaymentmethod', GetLang('orderPayMethod')),
			'shipping_method' => new Interspire_EmailIntegration_Field_String('shipping_method', GetLang('orderShipMethod')),
		);

		// add generated fields that contain full address information as an array
		$groups[$billingLang]['OrderSubscription_BillingAddress'] = new Interspire_EmailIntegration_Field_Address('OrderSubscription_BillingAddress', GetLang('EmailIntegrationOrderSubscriptionFullAddress'));

		$groups[$billingLang] += $this->mapFormFields($form->getFormFields(FORMFIELDS_FORM_BILLING), array(
			'FirstName' => 'ordbillfirstname',
			'LastName' => 'ordbilllastname',
			'CompanyName' => 'ordbillcompany',
			'Phone' => 'ordbillphone',
			'AddressLine1' => 'ordbillstreet1',
			'AddressLine2' => 'ordbillstreet2',
			'City' => 'ordbillsuburb',
			'Country' => 'ordbillcountry',
			'State' => 'ordbillstate',
			'Zip' => 'ordbillzip',
		));

		$groups[$billingLang]['OrderSubscription_BillingAddress_countryiso2'] = new Interspire_EmailIntegration_Field_String('OrderSubscription_BillingAddress_countryiso2', GetLang('CountryIso2'));
		$groups[$billingLang]['OrderSubscription_BillingAddress_countryiso3'] = new Interspire_EmailIntegration_Field_String('OrderSubscription_BillingAddress_countryiso3', GetLang('CountryIso3'));

		return $groups;
	}
예제 #8
0
		/**
		* Updates the language file. Used by design mode
		*
		* @return void
		*/
		private function UpdateLanguage()
		{
			if(!getClass('ISC_ADMIN_AUTH')->isDesignModeAuthenticated()) {
				exit;
			}

			$name	= str_replace("lang_", "", $_REQUEST['LangName']);
			$value	= $_REQUEST['NewValue'];
			/*$value = str_replace(array("\n","\r"), "", $value);*/
			$value = str_replace('"', """, $value);

			$content = file_get_contents(ISC_BASE_PATH."/language/".GetConfig('Language')."/front_language.ini");
			$frontLang = parse_ini_file(ISC_BASE_PATH."/language/".GetConfig('Language')."/front_language.ini");

			$replacement = $name . ' = "' . str_replace('$', '\$', $value) . '"';
			$replace = preg_replace("#^\s*".preg_quote($name, "#")."\s*=\s*\"".preg_quote(@$frontLang[$name], "#").'"\s*$#im', $replacement, $content);

			if(file_put_contents(ISC_BASE_PATH."/language/".GetConfig('Language')."/front_language.ini", $replace)) {
				$tags[] = $this->MakeXMLTag('status',1);
				$tags[] = $this->MakeXMLTag('newvalue', $value, true);
			}else {
				$langFile = ISC_BASE_PATH.'/language/'.GetConfig('Language').'/admin/common.ini';
				ParseLangFile($langFile);
				$tags[] = $this->MakeXMLTag('status',0);
				$tags[] = $this->MakeXMLTag('message', GetLang('UpdateLanguage'));
			}

			$this->SendXMLHeader();
			$this->SendXMLResponse($tags);
			die();
		}
예제 #9
0
	/**
	 * Load the language file for this module in to the global language scope.
	 * Any language variable sthat conflict with existing language variables will be ignored.
	 */
	protected function LoadLanguageFile()
	{
		if (!isset($this->id) || empty($this->id)) {
			return;
		}

		if (!isset($this->type) || empty($this->type)) {
			return;
		}

		$lang = 'en';

		if (strpos(GetConfig('Language'), '/') === false) {
			$lang = GetConfig('Language');
		}

		$mod_id = str_replace($this->type.'_', '', $this->id);

		if($this->type == 'addon') {
			$directory = ISC_BASE_PATH.'/addons/';
		}
		else {
			$directory = ISC_BASE_PATH.'/modules/'.$this->type.'/';
		}

		$lang_file = $directory.$mod_id.'/lang/'.$lang.'/language.ini';

		// Try and fall back to english if the module hasn't been translated yet
		if (!is_file($lang_file)) {
			$lang_file = $directory.$mod_id.'/lang/en/language.ini';
		}

		if (!is_file($lang_file)) {
			return;
		}

		ParseLangFile($lang_file);
	}
예제 #10
0
	/**
	* Notify admin by email of a failed subscription
	*
	* @param Interspire_EmailIntegration_Subscription $subscription Failed subscription
	* @param array $merge Failed merge data
	* @param string $errorMessage
	*/
	public function notifyAdmin(Interspire_EmailIntegration_Subscription $subscription, $merge, $errorMessage)
	{
		// can't rely on ISC_ADMIN_ENGINE or admin lang stuff from here because this code may be run by the task manager
		$languagePath = ISC_BASE_PATH . '/language/' . GetConfig('Language') . '/admin';
		ParseLangFile($languagePath . '/common.ini');
		ParseLangFile($languagePath . '/settings.emailintegration.ini');

		$replacements = array(
			'provider' => $this->GetName(),
			'time' => isc_date(GetConfig('ExtendedDisplayDateFormat'), time()),
		);

		$GLOBALS['EmailHeader'] = GetLang("NoCheckoutProvidersSubject");
		$GLOBALS['EmailMessage'] = sprintf(GetLang("NoCheckoutProvidersErrorLong"), $GLOBALS['ShopPath']);
		$GLOBALS['SubscriptionDetails'] = '';

		$GLOBALS['EmailIntegrationNotice_Header'] = GetLang('EmailIntegrationNotice_Header', $replacements);

		$GLOBALS['EmailIntegrationNotice_Intro'] = GetLang('EmailIntegrationNotice_Intro', $replacements);
		$GLOBALS['EmailIntegrationNotice_Error'] = GetLang('EmailIntegrationNotice_Error', $replacements);
		$GLOBALS['EmailIntegrationNotice_Message'] = $errorMessage;
		$GLOBALS['EmailIntegrationNotice_Time'] = GetLang('EmailIntegrationNotice_Time', $replacements);
		$GLOBALS['EmailIntegrationNotice_Details'] = GetLang('EmailIntegrationNotice_Details', $replacements);
		$GLOBALS['EmailIntegrationNotice_Type'] = $subscription->getSubscriptionTypeLang();

		$details = new Xhtml_Table();

		$row = new Xhtml_Tr();
		$row->appendChild(new Xhtml_Th(GetLang('EmailIntegrationNotice_Columns_Provider', $replacements)));
		$row->appendChild(new Xhtml_Th(GetLang('EmailIntegrationNotice_Columns_Subscription', $replacements)));
		$details->appendChild($row);

		$row = new Xhtml_Tr();
		$row->appendChild(new Xhtml_Td($this->getEmailProviderFieldId()));
		$row->appendChild(new Xhtml_Td($subscription->getSubscriptionEmail()));
		$details->appendChild($row);

		foreach ($merge as $field => $value) {
			$row = new Xhtml_Tr();
			$row->appendChild(new Xhtml_Td($field));
			$row->appendChild(new Xhtml_Td($value));
			$details->appendChild($row);
		}

		$GLOBALS['EmailIntegrationNotice_Subscription'] = $details->render();

		$GLOBALS['EmailIntegrationNotice_CommonCauses'] = GetLang('EmailIntegrationNotice_CommonCauses', $replacements);

		$GLOBALS['EmailIntegrationNotice_Cause1_Intro'] = GetLang('EmailIntegrationNotice_Cause1_Intro', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause1_Detail'] = GetLang('EmailIntegrationNotice_Cause1_Detail', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause2_Intro'] = GetLang('EmailIntegrationNotice_Cause2_Intro', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause2_Detail'] = GetLang('EmailIntegrationNotice_Cause2_Detail', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause3_Intro'] = GetLang('EmailIntegrationNotice_Cause3_Intro', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause3_Detail'] = GetLang('EmailIntegrationNotice_Cause3_Detail', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause4_Intro'] = GetLang('EmailIntegrationNotice_Cause4_Intro', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause4_Detail'] = GetLang('EmailIntegrationNotice_Cause4_Detail', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause5_Intro'] = GetLang('EmailIntegrationNotice_Cause5_Intro', $replacements);
		$GLOBALS['EmailIntegrationNotice_Cause5_Detail'] = GetLang('EmailIntegrationNotice_Cause5_Detail', $replacements);

		$GLOBALS['EmailIntegrationNotice_Closing'] = GetLang('EmailIntegrationNotice_Closing', $replacements);

		$emailTemplate = FetchEmailTemplateParser();
		$emailTemplate->SetTemplate("email_integration_notice_email");
		$message = $emailTemplate->ParseTemplate(true);

		$obj_email = GetEmailClass();
		$obj_email->Set('CharSet', GetConfig('CharacterSet'));
		$obj_email->From(GetConfig('OrderEmail'), GetConfig('StoreName'));
		$obj_email->Set("Subject", GetLang("EmailIntegrationEmailSubject"));
		$obj_email->AddBody("html", $message);
		$obj_email->AddRecipient(GetConfig('AdminEmail'), "", "h");
		$email_result = $obj_email->Send();
	}