Esempio n. 1
0
	/**
	* Process
	* Does all the work.
	* Saves settings, Checks details, calls the API to save the actual settings and checks whether it worked or not.
	*
	* @see GetApi
	* @see API::Set
	* @see API::Save
	* @see GetLang
	* @see ParseTemplate
	* @see SendStudio_Functions::Process
	* @see SendTestPreview
	* @see Settings_API::CheckCron
	* @see Settings_API::UpdateCron
	*
	* @return Void Does all of the processing, doesn't return anything.
	*/
	function Process()
	{
		$action = (isset($_GET['Action'])) ? strtolower($_GET['Action']) : null;

		$user = GetUser();
		$access = $user->HasAccess('System', 'System');

		$popup = (in_array($action, $this->PopupWindows)) ? true : false;

		if (!$access) {
			$this->DenyAccess();
			return;
		}

		$LK = false;


		switch ($action) {
			case 'addons':

				// we need a subaction & addon name.
				if (!isset($_GET['SubAction'])) {
					return $this->ShowSettingsPage();
				}

				if (!isset($_GET['Addon'])) {
					return $this->ShowSettingsPage();
				}

				require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php');

				$post = array();
				if (!empty($_POST)) {
					$post = $_POST;
				}

				try {
					$allowed_sub_action = array('install', 'uninstall', 'enable', 'disable', 'upgrade', 'configure', 'savesettings');
					$subaction = $this->_getGETRequest('SubAction', '');

					if (!in_array(strtolower($subaction), $allowed_sub_action)) {
						FlashMessage(GetLang('Addon_Action_NotAllowed'), SS_FLASH_MSG_ERROR, 'index.php?Page=Settings&Tab=6');
						return;
					}

					$result = Interspire_Addons::Process($_GET['Addon'], $subaction, $post);
					if ($result === true) {
						FlashMessage(GetLang('Addon_Success_' . strtolower($_GET['SubAction'])), SS_FLASH_MSG_SUCCESS, 'index.php?Page=Settings&Tab=6');
						return;
					}
					if ($result === false || $result == null) {
						FlashMessage(GetLang('Addon_Failure_' . strtolower($_GET['SubAction'])), SS_FLASH_MSG_ERROR, 'index.php?Page=Settings&Tab=6');
						return;
					}
					echo $result;
				} catch (Exception $e) {
					$error = $e->GetMessage();
					FlashMessage($error, SS_FLASH_MSG_ERROR, 'index.php?Page=Settings&Tab=6');
				}
				return;
			break;

			case 'viewdisabled':
				$this->PrintHeader(true);
				$reporttype = (isset($_GET['Report'])) ? $_GET['Report'] : null;
				switch ($reporttype) {
					case 'autoresponder':
						$GLOBALS['Heading'] = GetLang('Autoresponders_Disabled_Heading');
						$GLOBALS['Intro'] = GetLang('Autoresponders_Disabled_Heading_Intro');

						$disabled_list = IEM::sessionGet('AutorespondersDisabled');

						$disabled_report = '';
						$var = GetLang('DisabledAutoresponder_Item');
						foreach ($disabled_list as $p => $details) {
							$disabled_report .= sprintf($var, $details['autorespondername'], $details['listname']) . "\n";
						}
					break;

					case 'newsletter':
						$GLOBALS['Heading'] = GetLang('Newsletters_Disabled_Heading');
						$GLOBALS['Intro'] = GetLang('Newsletters_Disabled_Heading_Intro');

						$disabled_list = IEM::sessionGet('NewslettersDisabled');

						$disabled_report = '';
						$var = GetLang('DisabledNewsletter_Item');
						foreach ($disabled_list as $p => $details) {
							$disabled_report .= sprintf($var, $details['newslettername']) . "\n";
						}
					break;
				}
				$GLOBALS['DisabledList'] = $disabled_report;
				$this->ParseTemplate('Settings_Disabled_Report');
				$this->PrintFooter(true);
			break;

			case 'systeminfo':
				$this->PrintHeader();
				$db = IEM::getDatabase();
				$GLOBALS['DatabaseVersion'] = $db->FetchOne('SELECT version() AS version');

				$GLOBALS['ProductVersion'] = GetLang('SENDSTUDIO_VERSION');
				$GLOBALS['ShowProd'] = empty($GLOBALS['ProductEdition']) ? 'none' : '';
				$charset = (isset($SENDSTUDIO_DEFAULTCHARSET)) ? $SENDSTUDIO_DEFAULTCHARSET : SENDSTUDIO_CHARSET;
				$GLOBALS['DefaultCharset'] = $charset;
				$GLOBALS['CharsetDescription'] = GetLang($charset);
				$GLOBALS['ServerTimeZone'] = SENDSTUDIO_SERVERTIMEZONE;
				$GLOBALS['ServerTimeZoneDescription'] = GetLang(SENDSTUDIO_SERVERTIMEZONE);
				$GLOBALS['ServerTime'] = date('r');
				$GLOBALS['PHPVersion'] = phpversion();
				$GLOBALS['ServerSoftware'] = htmlspecialchars($_SERVER["SERVER_SOFTWARE"], ENT_QUOTES, SENDSTUDIO_CHARSET);

				$GLOBALS['SafeModeEnabled'] = (SENDSTUDIO_SAFE_MODE) ? GetLang('Yes') : GetLang('No');

				$GLOBALS['ImapSupportFound'] = (function_exists('imap_open')) ? GetLang('Yes') : GetLang('No');

				$GLOBALS['CurlSupportFound'] = (function_exists('curl_init')) ? GetLang('Yes') : GetLang('No');

				$php_mods = $this->ParsePHPModules();

				$GLOBALS['GDVersion'] = GetLang('GD_NotDetected');
				if (Settings_API::GDEnabled() && $php_mods !== false) {
					$GLOBALS['GDVersion'] = $php_mods['gd']['GD Version'];
				}

				$GLOBALS['ModSecurity'] = GetLang('ModSecurity_Unknown');

				if (!is_numeric(strpos(php_sapi_name(), 'cgi')) && $php_mods !== false) {
					$apache_mods = $this->ParseApacheModules($php_mods);
					if (in_array('mod_security', $apache_mods)) {
						$GLOBALS['ModSecurity'] = GetLang('Yes');
					} else {
						$GLOBALS['ModSecurity'] = GetLang('No');
					}
				}
				$this->ParseTemplate('Settings_SystemInfo');
				$this->PrintFooter();
			break;

			case 'showinfo':
				$this->PrintHeader(true);
				phpinfo();
				$this->PrintFooter(true);
			break;

			case 'sendpreviewdisplay':
				$this->PrintHeader($popup);
				$this->SendTestPreviewDisplay('index.php?Page=Settings&Action=SendPreview', 'self.parent.getPreviewParameters()');
				$this->PrintFooter($popup);
			break;

			case 'sendsmtppreviewdisplay':
				$this->PrintHeader($popup);
				$this->SendTestPreviewDisplay('index.php?Page=Settings&Action=SendPreview', 'self.parent.getSMTPPreviewParameters()');
				$this->PrintFooter($popup);
			break;

			case 'sendpreview':
				$this->SendTestPreview();
			break;

			case 'testbouncedisplay':
				$this->PrintHeader($popup);
				$this->TestBounceSettingsDisplay();
				$this->PrintFooter($popup);
			break;

			case 'testbouncesettings':
				$this->TestBounceSettings();
			break;

			case 'save':
				if (empty($_POST)) {
					$this->ShowSettingsPage();
					break;
				}
				$api = $this->GetApi();
				$result = false;

				$errors = array();

				// Make sure that Contact email is filled in
				if (!isset($_POST['email_address']) || trim($_POST['email_address']) == '') {
					array_push($errors, GetLang('ErrorAlertMessage_BlankContactEmail'));
				}

				// Make sure that license key is filled in
				if (!isset($_POST['licensekey']) || trim($_POST['licensekey']) == '') {
					array_push($errors, GetLang('ErrorAlertMessage_BlankLicenseKey'));
				}

				// Make sure that application name is filled in
				if (!isset($_POST['lng_applicationtitle']) || trim($_POST['lng_applicationtitle']) == '') {
					array_push($errors, GetLang('ErrorAlertMessage_BlankApplicationName'));
				}

				$agencyId = get_agency_license_variables();
				if(!empty($agencyId['agencyid'])) {
					$temp = IEM::requestGetPOST('lng_accountupgrademessage', '', 'trim');
					if (empty($temp)) {
						array_push($errors, GetLang('ErrorAlertMessage_BlankAccountUpgradeMessage'));
					}

					$temp = IEM::requestGetPOST('lng_freetrial_expiry_login', '', 'trim');
					if (empty($temp)) {
						array_push($errors, GetLang('ErrorAlertMessage_BlankExpiredLogin'));
					}
				}

				if ($api && count($errors) == 0) {
					do {
						$settings = array();

						// fix up the database settings first.
						$all_areas = $api->Areas;

						$LK = (isset($_POST['licensekey'])) ? $_POST['licensekey'] : false;

						if (defined('APPLICATION_SHOW_WHITELABEL_MENU') && constant('APPLICATION_SHOW_WHITELABEL_MENU')) {
							foreach ($all_areas['whitelabel'] as $area) {
								$val = IEM::requestGetPOST(strtolower($area), false);

								$temp = strtolower($area);
								switch ($temp) {
									// Special case for handling logo image
									case 'application_logo_image':
										$val = IEM::requestGetPOST('existing_app_logo_image', false);

										if (isset($_FILES['Application_Logo_Image']) && !empty($_FILES['Application_Logo_Image']['name'])) {
											if ($_FILES['Application_Logo_Image']['error'] != 0 || !@is_uploaded_file($_FILES['Application_Logo_Image']['tmp_name'])) {
												array_push($errors, GetLang('ErrorAlertMessage_ErrorApplicationLogoImage'));
												break 3;
											}

											if (!$this->IsImageFile(strtolower($_FILES['Application_Logo_Image']['name']))){
												array_push($errors, GetLang('ErrorAlertMessage_InvalidNameApplicationLogoImage'));
												break 3;
											}

											$uploadedFile = strtolower(basename($_FILES['Application_Logo_Image']['name']));
											$uploadedFile = preg_replace('/.*(\..*)$/', 'applicationlogo${1}', $uploadedFile);

											if(move_uploaded_file($_FILES['Application_Logo_Image']['tmp_name'], (TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile))) {
												@chmod(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile, 0666);
												$val = 'temp/' . $uploadedFile;
											}

											if (!$this->IsValidImageFile(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile, $_FILES['Application_Logo_Image']['type'])){
												@unlink(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile);
												array_push($errors, GetLang('ErrorAlertMessage_InvalidFormatApplicationLogoImage'));
												break 3;
											}
										}
									break;

									// Special case for handling favicon
									case 'application_favicon':
										$val = IEM::requestGetPOST('existing_app_favicon', false);

										if (isset($_FILES['Application_Favicon']) && !empty($_FILES['Application_Favicon']['name'])) {
											if ($_FILES['Application_Favicon']['error'] != 0 || !@is_uploaded_file($_FILES['Application_Favicon']['tmp_name'])) {
												array_push($errors, GetLang('ErrorAlertMessage_ErrorApplicationFavicon'));
												break 3;
											}

											if (!$this->IsIconFile(strtolower($_FILES['Application_Favicon']['name']))){
												array_push($errors, GetLang('ErrorAlertMessage_InvalidNameApplicationFavicon'));
												break 3;
											}

											$uploadedFile = 'favicon.ico';

											if(move_uploaded_file($_FILES['Application_Favicon']['tmp_name'], (TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile))) {
												@chmod(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile, 0666);
												$val = 'temp/' . $uploadedFile;
											}

											if (!$this->IsValidIconFile(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile, $_FILES['Application_Favicon']['type'])){
												@unlink(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . $uploadedFile);
												array_push($errors, GetLang('ErrorAlertMessage_InvalidFormatApplicationFavicon'));
												break 3;
											}
										}
									break;
								}

								$settings[$area] = $val;
							}
						}

						foreach ($all_areas['config'] as $area) {

							if (isset($_POST[strtolower($area)])) {
								$val = $_POST[strtolower($area)];
							} else {
								$val = false;
							}

							if ($area == 'DATABASE_USER') {
								if (isset($_POST['database_u'])) {
									$val = $_POST['database_u'];
								}
							}

							if ($area == 'DATABASE_PASS') {
								if (isset($_POST['database_p'])) {
									$val = $_POST['database_p'];
								}
							}

							if ($area == 'APPLICATION_URL') {
								if (substr($val, -1) == '/') {
									$val = substr($val, 0, -1);
								}
							}
							$settings[$area] = $val;
						}

						unset($all_areas['config']);
						unset($all_areas['whitelabel']);

						// look after all of the other settings now.
						foreach ($all_areas as $p => $area) {
							if (isset($_POST[strtolower($area)])) {
								$val = $_POST[strtolower($area)];
							} else {
								$val = false;
							}

							if ($area == 'BOUNCE_AGREEDELETE' && isset($_POST['bounce_process'])) {
								$val = 1;
							}

							if ($area == 'TEXTFOOTER') {
								$val = strip_tags($val);
							}

							if ($area == 'SMTP_USERNAME') {
								if (isset($_POST['smtp_u'])) {
									$val = $_POST['smtp_u'];
								}
							}

							if ($area == 'SMTP_PASSWORD') {
								if (isset($_POST['smtp_p'])) {
									$val = $_POST['smtp_p'];
								}
								$val = base64_encode($val);
							}

							if ($area == 'BOUNCE_PASSWORD') {
								if (isset($_POST['bounce_password'])) {
									$val = $_POST['bounce_password'];
								}
								$val = base64_encode($val);
							}

							$settings[$area] = $val;
						}

						// ----- Settings that cannot be changed
							$settings['DEFAULTCHARSET'] = SENDSTUDIO_DEFAULTCHARSET;
							if (!empty($settings['DEFAULTCHARSET'])) {
								$settings['DEFAULTCHARSET'] = 'UTF-8';
							}
						// -----

						// ----- Security settings
							$settings['SECURITY_WRONG_LOGIN_WAIT'] = intval($settings['SECURITY_WRONG_LOGIN_WAIT']);
							$settings['SECURITY_WRONG_LOGIN_THRESHOLD_COUNT'] = intval($settings['SECURITY_WRONG_LOGIN_THRESHOLD_COUNT']);
							$settings['SECURITY_WRONG_LOGIN_THRESHOLD_DURATION'] = intval($settings['SECURITY_WRONG_LOGIN_THRESHOLD_DURATION']) * 60;
							$settings['SECURITY_BAN_DURATION'] = intval($settings['SECURITY_BAN_DURATION']) * 60;

							if (!isset($_POST['security_wrong_login_wait_enable'])) {
								$settings['SECURITY_WRONG_LOGIN_WAIT'] = 0;
							}

							if (!isset($_POST['security_wrong_login_threshold_enable'])) {
								$settings['SECURITY_WRONG_LOGIN_THRESHOLD_COUNT'] = 0;
							}
						// -----

						$api->Set('Settings', $settings);

						$result = $api->Save();

						// Save warnings
						if ($result) {
							$tempRequestWarningsEnabled = IEM::requestGetPOST('credit_percentage_warnings_enable', array());
							$tempRequestWarningLevels = IEM::requestGetPOST('credit_percentage_warnings_level', array());
							$tempRequestWarnigSubjects = IEM::requestGetPOST('credit_percentage_warnings_subject', array());
							$tempRequestWarningEmails = IEM::requestGetPOST('credit_percentage_warnings_text', array());

							if (!empty($tempRequestWarningsEnabled) && !empty($tempRequestWarningLevels) && !empty($tempRequestWarningEmails)) {
								$tempRecords = array();
								foreach ($tempRequestWarningLevels as $index => $level) {
									$tempRecords[] = array(
										'enabled' => in_array($index, $tempRequestWarningsEnabled),
										'creditlevel' => $level,
										'aspercentage' => '1', // FIXME at this stage, only monthly credits warnings are available
										'emailsubject' => (isset($tempRequestWarnigSubjects[$index]) ? $tempRequestWarnigSubjects[$index] : ''),
										'emailcontents' => (isset($tempRequestWarningEmails[$index]) ? $tempRequestWarningEmails[$index] : '')
									);
								}

								$result = $api->SaveCreditWarnings($tempRecords);
							} else {
								$result = $api->SaveCreditWarnings(array());
							}

							unset($tempRequestWarningsEnabled);
							unset($tempRequestWarningLevels);
							unset($tempRequestWarningEmails);
						}
					} while(false);
				}

				$tabNum = ($_POST['tab_num'] && intval($_POST['tab_num'])) ? intval($_POST['tab_num']) : 1 ;

				if ($result) {
					FlashMessage(GetLang('SettingsSaved'), SS_FLASH_MSG_SUCCESS, 'index.php?Page=Settings&Tab='.$tabNum);
				} else {
					foreach ($errors as $error) {
						FlashMessage($error, SS_FLASH_MSG_ERROR);
					}

					FlashMessage(GetLang('SettingsNotSaved'), SS_FLASH_MSG_ERROR, 'index.php?Page=Settings&Tab='.$tabNum);
				}
			break;

			default:
				$this->ShowSettingsPage();
			break;
		}
	}
Esempio n. 2
0
    $addon_mta->iem_email_campaign_save_thread($send_details, $_POST);
}
#END_BLOCK_2B#
#START_BLOCK_4A#
$addon_system = new Interspire_Addons();
$multithread_enabled = $addon_system->isEnabled("multithread");
if ($multithread_enabled) {
    $addon_mta = $addon_system->Process("multithread", "GetApi", "multithread");
    return $addon_mta->fetch_job($this);
}
#END_BLOCK_4A#
#START_BLOCK_4B#
$addon_system = new Interspire_Addons();
$multithread_enabled = $addon_system->isEnabled("multithread");
if ($multithread_enabled) {
    $addon_mta = $addon_system->Process("multithread", "GetApi", "multithread");
    return $addon_mta->process_job($this, $jobid);
}
#END_BLOCK_4B#
#START_BLOCK_4C#
if (isset($GLOBALS['addon_multithread_class'])) {
    $addon_multithread = $GLOBALS['addon_multithread_class'];
    $thread_data = $addon_multithread->get_thread($jobid);
    $thread_to_use = $thread_data['thread_id'];
    echo "We will use the thread id:{$thread_to_use}" . PHP_EOL;
    if ($thread_data['thread_id'] == false) {
        echo "Not available threads" . PHP_EOL;
        $finish_job = $thread_data['finish_job'];
        echo "Finish job? " . ($finish_job ? "YES" : "NO");
        if ($finish_job) {
            $this->Db->CommitTransaction();
Esempio n. 3
0
    $addon_mta->iem_log_send_pre($this, $send_results);
}
#END_BLOCK_5A#
#START_BLOCK_5B#
$addon_system = new Interspire_Addons();
$mta_enabled = $addon_system->isEnabled("mta");
if ($mta_enabled) {
    $addon_mta = $addon_system->Process("mta", "GetApi", "mta");
    $addon_mta->iem_log_send($this, $send_results);
}
#END_BLOCK_5B#
#START_BLOCK_6A#
$addon_system = new Interspire_Addons();
$mta_enabled = $addon_system->isEnabled("mta");
if ($mta_enabled) {
    $addon_mta = $addon_system->Process("mta", "GetApi", "mta");
    $addon_mta->iem_mta_schedule_details($details);
}
#END_BLOCK_6A#
?>
#START_BLOCK_1A#
%%GLOBAL_MTA_SEND_SELECT_MTA%%
#END_BLOCK_1A#
#START_BLOCK_4A#
%%GLOBAL_MTA_SEND_SELECT_MTA_CONFIRM%%
#END_BLOCK_4A#
#START_BLOCK_6B#
%%GLOBAL_MTA_SCHEDULE_INFO_TITLE%%
#END_BLOCK_6B#
#START_BLOCK_6C#
%%GLOBAL_MTA_SCHEDULE_INFO_CONTENT%%
Esempio n. 4
0
	/**
	 * Process
	 * Process does the basic work to figure out:
	 * - which addon you're trying to access (and whether it exists & is active/enabled)
	 * - whether you have access to perform that action
	 * - whether to print a header/footer or not
	 *
	 * Then hands control over to the addon itself to do the rest.
	 *
	 * @uses HasAccess
	 * @uses Interspire_Addons
	 * @uses Interspire_Addons::GetAvailableAddons
	 * @uses Interspire_Addons::Process
	 *
	 * @return Void Doesn't return anything.
	 */
	function Process()
	{
		// if we're not viewing an addon, then show an "access denied" message
		// there's no way to view a list of addons to run
		// they all have to appear in a menu somewhere.
		if (!isset($_GET['Addon'])) {
			$this->DenyAccess();
			return;
		}

		/**
		 * print_header tells us whether to print the header/footer at all.
		 */
		$print_header = true;

		/**
		 * popup_header tells us whether it's a popup window or not.
		 * If it's a full window, that includes the nav menus etc.
		 * If it's a popup window, then none of that is shown.
		 */
		$popup_header = false;

		$get_keywords = array_map('strtolower', array_keys($_GET));

		/**
		 * See if the 'ajax' keyword is used in the get string anywhere as a key.
		 * If it is, don't show the header/footer.
		 */
		if (in_array('ajax', $get_keywords)) {
			$print_header = false;
		}

		/**
		 * See if the 'popup' keyword is used in the get string anywhere as a key.
		 * If it is, show the popup header/footer.
		 */
		if (in_array('popup', $get_keywords)) {
			$popup_header = true;
		}

		if ($print_header) {
			$this->PrintHeader($popup_header);
		}

		$addon = strtolower($_GET['Addon']);

		require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php');
		$addon_system = new Interspire_Addons();
		$addons = $addon_system->GetAvailableAddons();

		if (!isset($addons[$addon])) {  
			$this->DenyAccess();
			if ($print_header) {
				$this->PrintFooter($popup_header);
			}
			return;
		}

		$action = 'Default';
		if (isset($_GET['Action']) && $_GET['Action'] !== '') {
			$action = $_GET['Action'];
		}

		/**
		* Check the user has access to this addon and what you are trying to do.
		* The first argument is always the addon id (eg 'surveys').
		*
		* The second argument is the action you are trying to perform.
		* eg 'create', 'edit', 'delete', 'stats'
		* This must match up to the methods in the addon itself
		* eg if you're trying to get the addon to create something, the permission is 'create' and the addon method must be 'Admin_Create_Action'
		*
		*/
		$user = IEM::GetCurrentUser();
		$admin_action = $action;
		if ($admin_action == 'Default') {
			$admin_action = null;
		}
		
		if(!is_null($admin_action)){$admin_action = strtolower($admin_action);}
		// Survey permission addon... added in the group now
		foreach ($user->group->permissions as $perm_key => &$perm ) {
			if ($perm_key == 'surveys') {
				$perm[] = "submit";
				$perm[] = "tinymcesurveylist";

				foreach ($perm as $perm_action) {
					switch ($perm_action):
						case 'create':
							$perm[] = "build";
							$perm[] = "save";
							break;
						case 'viewresponsesdefault':
							$perm[] = "viewresponses";
							$perm[] = "downloadattach";
							break;
						case 'editresponse':
							$perm[] = "saveresponse";
							$perm[] = "downloadattach";
						case 'exportdefault':
							$perm[] = "export";
						case 'resultdefault':
							$perm[] = "result";
							$perm[] = "result_responseslist";
							break;
					endswitch;
				}
			}
		}
		
		// Check if addon is enabled or disabled
		if (!$addon_system->isEnabled($addon)) {
				$this->DenyAccess();
		}
               
		if (!is_null($admin_action)) {  
            $access = $user->HasAccess($addon, $admin_action);
			if(!$access){
		        $this->DenyAccess();
                if ($print_header) {$this->PrintFooter($popup_header);}
                return;
            }
			
		} else {  
            $access = $user->HasAccess($addon); 
			if(!$access){
		        $this->DenyAccess();
                if ($print_header) {$this->PrintFooter($popup_header);}
                return;	
            }
				  
		}
              
		try {
            if(is_null($action)){$action = "Default";}
			$result = Interspire_Addons::Process($addon, 'Admin_Action_'.$action);
			echo $result;
		} catch (Exception $e) {
			echo "Error!: " . $e->getMessage();
		}

		if ($print_header) {
			$this->PrintFooter($popup_header);
		}
	}
Esempio n. 5
0
	/**
	* Save
	* This function saves the current class vars to the settings file.
	* It checks to make sure the file is writable, then places the appropriate values in there and saves it. It uses a temporary name then copies that over the top of the old one, then removes the temporary file.
	*
	* @return Boolean Returns true if it worked, false if it fails.
	*/
	function Save()
	{

		require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php');

		if (!is_writable($this->ConfigFile)) {
			return false;
		}

		$tmpfname = tempnam(TEMP_DIRECTORY, 'SS_');
		if (!$handle = fopen($tmpfname, 'w')) {
			return false;
		}

		$copy = true;
		if (is_file(TEMP_DIRECTORY . '/config.prev.php')) {
			if (!@unlink(TEMP_DIRECTORY . '/config.prev.php')) {
				$copy = false;
			}
		}

		if ($copy) {
			@copy($this->ConfigFile, TEMP_DIRECTORY . '/config.prev.php');
		}

		// the old config backups were in the includes folder so try to clean them up as part of this process.
		$config_prev = SENDSTUDIO_INCLUDES_DIRECTORY . '/config.prev.php';
		if (is_file($config_prev)) {
			@unlink($config_prev);
		}

		$contents = "<?php\n\n";

		gmt($this);

		$areas = $this->Areas;


		foreach ($areas['config'] as $area) {
			// See self::LoadSettings() on UTF8PATCH settings
			if ($area == 'DATABASE_UTF8PATCH') {
				if (!defined('SENDSTUDIO_DATABASE_UTF8PATCH')) {
					define('SENDSTUDIO_DATABASE_UTF8PATCH', 1);
				}
				$contents .= "define('SENDSTUDIO_DATABASE_UTF8PATCH', '" . SENDSTUDIO_DATABASE_UTF8PATCH . "');\n";
				continue;
			}
			$string = 'define(\'SENDSTUDIO_' . $area . '\', \'' . addslashes($this->Settings[$area]) . '\');' . "\n";
			$contents .= $string;
		}

		$contents .= "define('SENDSTUDIO_IS_SETUP', 1);\n";
		
		if (!defined('SENDSTUDIO_DEFAULTCHARSET')) {
			define('SENDSTUDIO_DEFAULTCHARSET', 'UTF-8');
		}
		$contents .= "define('SENDSTUDIO_DEFAULTCHARSET', '" . SENDSTUDIO_DEFAULTCHARSET . "');\n";

		$contents .= "\n\n";

		fputs($handle, $contents, strlen($contents));
		fclose($handle);
		chmod($tmpfname, 0644);

		if (!copy($tmpfname, $this->ConfigFile)) {
			return false;
		}
		unlink($tmpfname);

		$copy = true;
		if (is_file(TEMP_DIRECTORY . '/config.bkp.php')) {
			if (!@unlink(TEMP_DIRECTORY . '/config.bkp.php')) {
				$copy = false;
			}
		}

		if ($copy) {
			@copy($this->ConfigFile, TEMP_DIRECTORY . '/config.bkp.php');
		}

		// the old config backups were in the includes folder so try to clean them up as part of this process.
		$config_bkp = SENDSTUDIO_INCLUDES_DIRECTORY . '/config.bkp.php';
		if (is_file($config_bkp)) {
			@unlink($config_bkp);
		}

		unset($areas['config']);

		if (defined('APPLICATION_SHOW_WHITELABEL_MENU') && constant('APPLICATION_SHOW_WHITELABEL_MENU')) {
			$query = "DELETE FROM " . SENDSTUDIO_TABLEPREFIX . "whitelabel_settings";
			$result = $this->Db->Query($query);
			foreach ($areas['whitelabel'] as $area) {
				// If settings are not set, do not continue
				if (!isset($this->Settings[$area])) {
					continue;
				}

				$value = $this->Settings[$area];

				if (strtolower($area) == 'update_check_enabled') {
					$subAction = 'uninstall';
					if ($value == '1') {
						$subAction = 'install';
					}
					$result = Interspire_Addons::Process('updatecheck', $subAction, array());
					continue;
				} elseif (strtolower($area) == 'lng_accountupgrademessage') {
					$agencyId = get_agency_license_variables();
					if(empty($agencyId['agencyid'])) {
						continue;
					}
				}

				if (is_bool($value)) {
					$value = (int)$value;
				}

				$query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "whitelabel_settings(name, value) VALUES ('" . $this->Db->Quote($area) . "', '" . $this->Db->Quote($value) . "')";
				$result = $this->Db->Query($query);
			}
			if ($this->WhiteLabelCache->exists('IEM_SETTINGS_WHITELABEL')) {
				$this->WhiteLabelCache->remove('IEM_SETTINGS_WHITELABEL');
			}
		}

		if (isset($areas['whitelabel'])) {
			unset($areas['whitelabel']);
		}

		$stash = IEM_InterspireStash::getInstance();
		if ($stash->exists('IEM_SYSTEM_SETTINGS')) {
			$stash->remove('IEM_SYSTEM_SETTINGS');
		}

		$query = "DELETE FROM " . SENDSTUDIO_TABLEPREFIX . "config_settings";
		$result = $this->Db->Query($query);


		foreach ($areas as $area) {
			$value = isset($this->Settings[$area]) ? $this->Settings[$area] : '';



			if ($area == 'SYSTEM_DATABASE_VERSION') {
				$value = $this->Db->FetchOne("SELECT version() AS version");
			}
			if (is_bool($value)) {
				$value = (int)$value;
			}

			$query = "INSERT INTO " . SENDSTUDIO_TABLEPREFIX . "config_settings(area, areavalue) VALUES ('" . $this->Db->Quote($area) . "', '" . $this->Db->Quote($value) . "')";
			$result = $this->Db->Query($query);
		}


		return true;
	}
Esempio n. 6
0
#END_BLOCK_A4_G#
#START_BLOCK_A5#
$addon_system = new Interspire_Addons();
$spins_enabled = $addon_system->isEnabled("spins");
if ($spins_enabled) {
    $this->_AssembledEmail['Body']['t'] = null;
    $this->_AssembledEmail['Body']['h'] = null;
}
#END_BLOCK_A5#
#START_BLOCK_A6#
$addon_system = new Interspire_Addons();
$spins_enabled = $addon_system->isEnabled("spins");
if ($spins_enabled) {
} else {
    $extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>';
}
#END_BLOCK_A6#
#START_BLOCK_3A#
if (isset($GLOBALS['addon_spins_class'])) {
    $addon_spins = $GLOBALS['addon_spins_class'];
    $addon_system = new Interspire_Addons();
    $spins_enabled = $addon_system->isEnabled("spins");
    if ($spins_enabled) {
        $sp = $addon_system->Process("spins", "GetApi", "spins");
        $mid = $sp->rotate_url($this->message_id_server);
        $message_id = 'Message-ID: <' . $semi_rand . '@' . $mid . '>' . $this->_newline;
    } else {
        $message_id = 'Message-ID: <' . $semi_rand . '@' . $this->message_id_server . '>' . $this->_newline;
    }
}
#END_BLOCK_3A#
Esempio n. 7
0
    $GLOBALS['NetworksPage'] = $addon_social->stats($statid, $summary);
}
#END_BLOCK_2#
#START_BLOCK_4A#
$addon_system = new Interspire_Addons();
$social_enabled = $addon_system->isEnabled("social");
if ($social_enabled) {
    $addon_social = $addon_system->Process("social", "GetApi", "social");
    $addon_social->replace_in_mail($text, $web_version_link, $this->SentBy, $this->Subject);
}
#END_BLOCK_4A#
#START_BLOCK_4B#
$addon_system = new Interspire_Addons();
$social_enabled = $addon_system->isEnabled("social");
if ($social_enabled) {
    $addon_social = $addon_system->Process("social", "GetApi", "social");
    if ($addon_social->ignore_patterns($url)) {
        continue;
    }
}
#END_BLOCK_4B#
#START_BLOCK_EMAIL2#
if (preg_match('/%%sendfriend_(.*)%%/i', $url)) {
    continue;
}
if (preg_match("/(%%SURVEY.*?%%)/isx", $url)) {
    continue;
}
#END_BLOCK_EMAIL2#
#START_BLOCK_API_STATS_1#
if (isset($open_details['share'])) {