Esempio n. 1
0
<?php

sesion_start();
?>

<!doctype html>
<html lang="es">
<head>
        <title> PSW + Cookie pagina + nombre </title>
</head>
<body>
	 <?php 
if (isset($_SESION['nombre'])) {
    sesion_destroy();
    echo "se ha destruido la sesion exitosamente </br>";
    echo "<a href='index.php'>Volver</a>";
} else {
    echo "Error.. <br/> ";
    echo "<a href='index.php'>Volver</a>";
}
?>
 <!--Aca se cierra el ELSE-->


</body>
</html>
Esempio n. 2
0
	/**
	* Install
	* Performs an installation based on the request in $xml
	*
	* @return Void Returns nothing, exits on error
	*/
	function Install()
	{
		$install = &$this->xml->install;

		// Required variables:
		$required = array(
			'licenseKey','installPath',
			'user' => array(
				'email',
				'username',
				'password'
			),
			'database' => array(
				'dbUser','dbPass','dbDatabase','dbServer' // ,'dbType'
			)
		);
		$errors = array();
		foreach ($required as $node_name => $node) {
			if (is_array($node)) {
				foreach ($node as $variable) {
					if (!isset($install->$node_name->$variable)) {
						$errors[] = array('code' => 'missing' . ucfirst($node_name) . ucfirst($variable), 'message' => 'The ' . $node_name . ' ' . $variable . ' value was not supplied.');
					}
				}
			} else {
				if (!isset($install->$node)) {
					$errors[] = array('code' => 'missing' . ucfirst($node), 'message' => 'The ' . $node . ' value was not supplied.');
				}
			}
		}
		if (count($errors)) {
			$this->Error('Please fill out all mandatory fields to complete the installation.',$errors);
		}

		// Check if config file is writable

		$config_file = SENDSTUDIO_INCLUDES_DIRECTORY . "/config.php";
		if (!is_writable($config_file)) {
			$this->Error('Before you can install Interspire Email Marketer make sure the following files are writable.',array(array('code' => 'filePermissions', 'message' => $config_file . ' is not writable.')));
		}

		if (!is_writable(TEMP_DIRECTORY)) {
			$this->Error('Before you can install Interspire Email Marketer make sure the following files are writable.',array(array('code' => 'filePermissions', 'message' => TEMP_DIRECTORY . ' is not writable.')));
		}

		$license_key = (string)$install->licenseKey;
		list($error, $msg) = sesion_start($license_key);
		if ($error) {
			$this->Error('A valid license key was not supplied.',array(array('code' => 'badLicenseKey','message' => $msg)));
		}

		/**
		* Connect to the database
		*/

		/**
		* Due to a problem with Plesk only mysql installations can be done
		*
		if ($install->database->dbType == 'postgresql') {
			require(dirname(__FILE__) . "/lib/database/pgsql.php");
			$db_type = 'PGSQLDb';
			$db_type_name = 'pgsql';
		} elseif ($install->database->dbType == 'mysql') {
		*/
		require_once IEM_PATH . '/ext/database/mysql.php';
		$db_type = 'MySQLDb';
		$db_type_name = 'mysql';

		defined('SENDSTUDIO_DATABASE_TYPE') or define('SENDSTUDIO_DATABASE_TYPE', $db_type_name);

		/**
		} else {
			$this->Error('The installer was not able to connect to the database.',array(array('code' => 'dbConnectError', 'message' => 'Unknown database type ' . $install->database->dbType)));
		}
		*/

		$db = new $db_type($install->database->dbServer, $install->database->dbUser, $install->database->dbPass, $install->database->dbDatabase);
		$db->TablePrefix = $install->database->tablePrefix;
		$db->ErrorCallback = array(&$this,'DatabaseError');

		IEM::getDatabase($db);

		if (!$db->connection) {
			$this->Error('The installer was not able to connect to the database.', array(array('code' => 'dbConnectError', 'message' => "Unable to connect to the database: " . $db->GetError())));
		}

		/**
		* Load the database schema file and create the database tables
		*/

		require_once(IEM_PATH . "/install/schema." . $db_type_name . ".php");

		$tableprefix = '';
		if (isset($install->database->tablePrefix)) {
			$tableprefix = (string)$install->database->tablePrefix;
		}

		foreach ($queries as $query) {
			$query = str_replace('%%TABLEPREFIX%%', $tableprefix, $query);
			$db->Query($query);
		}

		/**
		* Find the server timezone and write the configuration file
		*/

		$this->LoadLanguageFile('Timezones');

		$timezone = date('O');
		$timezone = preg_replace('/([+-])0/', '$1', $timezone);
		if ($timezone == '+000') {
			$timezone = 'GMT';
		}
		$timez = 'GMT';
		foreach ($GLOBALS['SendStudioTimeZones'] as $k => $tz) {
			// if we're using date('O') it doesn't include "GMT" or the ":"
			// see if we can match it up.
			$tz_trim = str_replace(array('GMT', ':'), '', $tz);
			if ($tz_trim == $timezone) {
				$timez = $tz;
				break;
			}
		}

		if (!defined('SENDSTUDIO_SERVERTIMEZONE')) {
			define('SENDSTUDIO_SERVERTIMEZONE', $timez);
		}
		define('SENDSTUDIO_TABLEPREFIX', $tableprefix);

		ob_start();

		$settings_api = $this->GetApi('Settings');

		$settings_details = array();

		$settings_details['DATABASE_UTF8PATCH'] = '1';
		$settings_details['DATABASE_TYPE'] = $db_type_name;
		$settings_details['DATABASE_USER'] = (string)$install->database->dbUser;
		$settings_details['DATABASE_PASS'] = (string)$install->database->dbPass;
		$settings_details['DATABASE_HOST'] = (string)$install->database->dbServer;
		$settings_details['DATABASE_NAME'] = (string)$install->database->dbDatabase;
		$settings_details['TABLEPREFIX'] = $tableprefix;
		$settings_details['LICENSEKEY'] = (string)$install->licenseKey;
		$settings_details['APPLICATION_URL'] = (string)$install->installPath;
		$settings_details['SERVERTIMEZONE'] = $timez;
		$settings_details['DEFAULTCHARSET'] = 'UTF-8';
		$settings_details['EMAIL_ADDRESS'] = (string)$install->user->email;

		// now for the default settings.
		$settings_details['SMTP_PORT'] = '25';

		$settings_details['IPTRACKING'] = '1';

		$settings_details['MAX_IMAGEWIDTH'] = 700;
		$settings_details['MAX_IMAGEHEIGHT'] = 400;

		$settings_details['BOUNCE_IMAP'] = '0';

		$settings_details['ALLOW_EMBEDIMAGES'] = '1';

		$settings_details['ATTACHMENT_SIZE'] = '2048';

		$settings_details['CRON_SEND'] = '5';
		$settings_details['CRON_AUTORESPONDER'] = '10';
		$settings_details['CRON_BOUNCE'] = '60';

		$settings_details['EMAILSIZE_WARNING'] = '500';
		$settings_details['EMAILSIZE_MAXIMUM'] = '2048';

		$settings_details['RESEND_MAXIMUM'] = '3';

		$settings_api->Set('Settings', $settings_details);

		$settings_api->Db = &$db;
		$settings_api->Save();

		// ----- Update the default user account
			$username     = $install->user->username;
			$unique_token = API_USERS::generateUniqueToken($username);
			$new_password = API_USERS::generatePasswordHash($install->user->password, $unique_token);

			$tempServerTimeZone = $db->Quote($settings_details['SERVERTIMEZONE']);
			$tempEmailAddress = $db->Quote(strval($install->user->email));
			$tempUniqueToken = $db->Quote($unique_token);
			$tempUsername = $db->Quote($username);
			$tempPassword = $db->Quote($new_password);
			$tempHTMLFooter = $db->Quote(GetLang('Default_Global_HTML_Footer', ''));
			$tempTEXTFooter = $db->Quote(GetLang('Default_Global_Text_Footer', ''));

			$query = "
				UPDATE {$tableprefix}users
				SET unique_token = '{$tempUniqueToken}',
					usertimezone = '{$tempServerTimeZone}',
					emailaddress ='{$tempEmailAddress}',
					textfooter ='{$tempTEXTFooter}',
					htmlfooter ='{$tempHTMLFooter}',
					username = '******',
					password ='******'
				WHERE userid = 1
			";

			$db->Query($query);

			unset($tempTEXTFooter);
			unset($tempHTMLFooter);
			unset($tempPassword);
			unset($tempUniqueToken);
			unset($tempEmailAddress);
			unset($tempServerTimeZone);

			unset($new_password);
			unset($unique_token);
		// -----

		ob_end_clean();

		/**
		* Installation is finished
		*/

		$this->PrintHeader();
		?>
			<status>OK</status>
			<installPath><?php echo $install->installPath; ?></installPath>
			<user>
				<username>admin</username>
				<password><?php echo $install->user->password; ?></password>
			</user>
		<?php
		$this->PrintFooter();
		return;
	}
 /**
  * Enter description here...
  *
  * @return Void Does not return anything
  * @todo phpdoc
  */
 private function IEM_DefaultVariables()
 {
     static $variables = null;
     if (is_null($variables)) {
         $IEM = array('User' => GetUser(), 'ApplicationTitle' => GetLang('ApplicationTitle'), 'PageTitle' => GetLang('PageTitle'), 'CurrentPage' => IEM::requestGetGET('Page', IEM::requestGetGET('page', '')), 'ApplicationLogoImage' => APPLICATION_LOGO_IMAGE, 'ApplicationFavicon' => APPLICATION_FAVICON, 'InfoTips' => IEM::enableInfoTipsGet());
         list($IEM['LicenseError'], $IEM['LicenseMessage']) = sesion_start();
         IEM::sessionSet('LicenseError', $IEM['LicenseError']);
         if (!$IEM['LicenseError'] && isset($GLOBALS['ProductEdition'])) {
             $IEM['ApplicationTitle'] .= sprintf(GetLang('ApplicationTitleEdition'), $GLOBALS['ProductEdition']);
         }
         list($IEM['MenuLinks'], $IEM['TextLinks']) = $this->IEM_Menu();
         $variables = $IEM;
     }
     return $variables;
 }
Esempio n. 4
0
	/**
	 * ShowSettingsPage
	 * Prints out the settings page and pre-fills the form fields as much as it can.
	 *
	 * It will also show:
	 * - if there is a license key issue
	 * - if there is a problem with cron/scheduled tasks set up not working properly
	 * - if 'test mode' is enabled
	 * - if you disable attachments, it checks autoresponders to see if any need to be disabled
	 *
	 * @return Void Prints out the settings form, doesn't return anything.
	 */
	function ShowSettingsPage()
	{
		require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php');
		$addonSystem = new Interspire_Addons();
		$addonStatus = $addonSystem->GetAvailableAddons();

		$this->PrintHeader();

		$tpl = GetTemplateSystem();

		$GLOBALS['Message'] = '';

		list($license_error, $msg) = sesion_start();

		$extra = '';

		if ($license_error) {
			$GLOBALS['Error'] = $msg;
			$GLOBALS['Message'] .= $this->ParseTemplate('ErrorMsg', true, false);
			$extra = '
				<script>
					$(function() {
						$("licensekey").select();
						$("licensekey").focus();
					});
				</script>
			';
			unset($GLOBALS['Error']);
		}

		if (!is_writable(SENDSTUDIO_INCLUDES_DIRECTORY . '/config.php')) {
			FlashMessage(sprintf(GetLang('ConfigFileNotWritable'), SENDSTUDIO_INCLUDES_DIRECTORY . '/config.php'), SS_FLASH_MSG_WARNING);
		}

		$api = $this->GetApi();
		$api->Load();

		$all_areas = $api->Areas;


		foreach ($all_areas['config'] as $k => $option) {
			$opt_name = 'SENDSTUDIO_' . $option;
			${$opt_name} = constant($opt_name);
		}


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

		foreach ($all_areas as $k => $option) {
			$opt_name = 'SENDSTUDIO_' . $option;
			${$opt_name} = constant($opt_name);
		}

		if (isset($SENDSTUDIO_FORCE_UNSUBLINK) && $SENDSTUDIO_FORCE_UNSUBLINK == 1) {
			$SENDSTUDIO_FORCE_UNSUBLINK = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_FORCE_UNSUBLINK)) {
			$SENDSTUDIO_FORCE_UNSUBLINK = '';
		}

		$cron_checked = false;
		if (isset($SENDSTUDIO_CRON_ENABLED) && $SENDSTUDIO_CRON_ENABLED == 1) {
			$SENDSTUDIO_CRON_ENABLED = ' CHECKED';
			$cron_checked = true;
		}

		if (!isset($SENDSTUDIO_CRON_ENABLED)) {
			$SENDSTUDIO_CRON_ENABLED = '';
		}

		$GLOBALS['Cron_ShowInfo'] = 'none';
		if ($cron_checked) {
			$GLOBALS['Cron_ShowInfo'] = '';
		}

		$ip_tracking = false;
		if (isset($SENDSTUDIO_IPTRACKING) && $SENDSTUDIO_IPTRACKING == 1) {
			$SENDSTUDIO_IPTRACKING = ' CHECKED';
			$ip_tracking = true;
		}

		if (!isset($SENDSTUDIO_IPTRACKING)) {
			$SENDSTUDIO_IPTRACKING = '';
		}

		if (isset($SENDSTUDIO_USEMULTIPLEUNSUBSCRIBE) && $SENDSTUDIO_USEMULTIPLEUNSUBSCRIBE == 1) {
			$SENDSTUDIO_USEMULTIPLEUNSUBSCRIBE = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_USEMULTIPLEUNSUBSCRIBE)) {
			$SENDSTUDIO_USEMULTIPLEUNSUBSCRIBE = '';
		}

		if (isset($SENDSTUDIO_CONTACTCANMODIFYEMAIL) && $SENDSTUDIO_CONTACTCANMODIFYEMAIL == 1) {
			$SENDSTUDIO_CONTACTCANMODIFYEMAIL = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_CONTACTCANMODIFYEMAIL)) {
			$SENDSTUDIO_CONTACTCANMODIFYEMAIL = '';
		}


		$send_test_mode = false;
		if (isset($SENDSTUDIO_SEND_TEST_MODE) && $SENDSTUDIO_SEND_TEST_MODE == 1) {
			$SENDSTUDIO_SEND_TEST_MODE = ' CHECKED';
			$send_test_mode = true;
		}

		if (!isset($SENDSTUDIO_SEND_TEST_MODE) && SENDSTUDIO_SEND_TEST_MODE == 1) {
			$SENDSTUDIO_SEND_TEST_MODE = ' CHECKED';
			$send_test_mode = true;
		}

		if (!isset($SENDSTUDIO_SEND_TEST_MODE)) {
			$SENDSTUDIO_SEND_TEST_MODE = '';
		}


		if ($SENDSTUDIO_SMTP_SERVER) {
			$GLOBALS['UseSMTP'] = ' CHECKED';
			$GLOBALS['DisplaySMTP'] = "'';";
		} else {
			$GLOBALS['UseDefaultMail'] = ' CHECKED';
			$GLOBALS['DisplaySMTP'] = 'none';
		}

		$GLOBALS['ShowCronInfo'] = 'none';
		$GLOBALS['CronRunTime'] = GetLang('CronRunTime_Never');
		$GLOBALS['CronRunTime_Explain'] = GetLang('CronRunTime_Explain');
		if ($SENDSTUDIO_CRON_ENABLED) {
			$GLOBALS['ShowCronInfo'] = '';
			$cron_ok = $api->Get('cronok');
			if ($cron_ok) {
				$cron_1 = $api->Get('cronrun1');
				$cron_2 = $api->Get('cronrun2');
				if (!$cron_1) {
					$GLOBALS['CronRunTime'] = GetLang('CronRunTime_Once');
				} else {
					$diff = $this->TimeDifference($cron_2 - $cron_1);
					$GLOBALS['CronRunTime'] = sprintf(GetLang('CronRunTime_Difference'), $diff);
				}
			}
		}

		$GLOBALS['Settings_CronOptionsList'] = '';

		/**
		 * The schedule stuff is a little different and comes from the database.
		 * Look at all of the options in the schedule
		 * as addons can defined their own schedules if they need to.
		 */
		$cron_schedule = $api->Get('Schedule');
		$cron_options = array_keys($cron_schedule);


		foreach ($cron_options as $p => $cron_option) {
			if ($cron_option == 'triggeremails_p') {
				$GLOBALS['Settings_CronOptionsList'] .= '<tr style="display:none;"><td><input type="hidden" name="cron_triggeremails_p" value="' . SENDSTUDIO_CRON_TRIGGEREMAILS_P . '" /></td></tr>';
				continue;
			}

			$opt_name = 'Cron_Options';
			$GLOBALS[$opt_name] = '';
			$settings_var = ${'SENDSTUDIO_CRON_' . strtoupper($cron_option)};

			$GLOBALS['Cron_Option_SelectName'] = 'cron_' . $cron_option;

			$GLOBALS['Cron_Option_Heading'] = GetLang('Cron_Option_'.$cron_option.'_Heading');




			foreach ($api->Get($cron_option . '_options') as $opt => $desc) {
				$selected = '';
				if ($opt == $settings_var) {
					$selected = ' SELECTED';
				}
				$GLOBALS[$opt_name] .= '<option value="' . $opt . '"' . $selected . '>' . GetLang('Cron_Option_' . $desc) . '</option>';
			}


			$GLOBALS['Cron_LastRun'] = $GLOBALS['Cron_NextRun'] = '';

			$last_run = $cron_schedule[$cron_option]['lastrun'];
			if ($last_run > 0) {
				$GLOBALS['Cron_LastRun'] = IEM::timeGetUserDisplayString(GetLang('Cron_DateFormat'), $last_run);
				if ($settings_var > 0) {
					$next_run = $last_run + ($settings_var * 60);
					$GLOBALS['Cron_NextRun'] = IEM::timeGetUserDisplayString(GetLang('Cron_DateFormat'), $next_run);
				} else {
					$GLOBALS['Cron_NextRun'] = GetLang('Cron_Option_Disabled');
				}
			} else {
				$GLOBALS['Cron_LastRun'] = GetLang('Cron_Option_HasNotRun');
			}

			// Skipping any problematic CRON schedule
			if (!defined('LNG_Cron_Option_'.$cron_option.'_Heading')) {
				continue;
			}

			$GLOBALS['Cron_Option_Heading'] = GetLang('Cron_Option_'.$cron_option.'_Heading');
			$GLOBALS['Settings_CronOptionsList'] .= $this->ParseTemplate('Settings_Cron_Option', true, false);
		}





		$GLOBALS['Imap_Selected'] = $GLOBALS['Pop3_Selected'] = '';
		if (!isset($SENDSTUDIO_BOUNCE_IMAP) && SENDSTUDIO_BOUNCE_IMAP == 1) {
			$GLOBALS['Imap_Selected'] = ' SELECTED ';
		} else {
			$GLOBALS['Pop3_Selected'] = ' SELECTED ';
		}

		if (isset($SENDSTUDIO_BOUNCE_IMAP) && $SENDSTUDIO_BOUNCE_IMAP == 1) {
			$GLOBALS['Imap_Selected'] = ' SELECTED ';
		} else {
			$GLOBALS['Pop3_Selected'] = ' SELECTED ';
		}

		if (!isset($SENDSTUDIO_BOUNCE_AGREEDELETE) && SENDSTUDIO_BOUNCE_AGREEDELETE == 1) {
			$SENDSTUDIO_BOUNCE_AGREEDELETE = ' CHECKED';
		}

		if (isset($SENDSTUDIO_BOUNCE_AGREEDELETE) && $SENDSTUDIO_BOUNCE_AGREEDELETE == 1) {
			$SENDSTUDIO_BOUNCE_AGREEDELETE = ' CHECKED';
			$GLOBALS['ProcessBounceChecked'] = ' CHECKED';
		} else {
			$GLOBALS['DisplayExtraMailSettings'] = 'none';
		}

		if (!isset($SENDSTUDIO_BOUNCE_AGREEDELETEALL) && SENDSTUDIO_BOUNCE_AGREEDELETEALL == 1) {
			$SENDSTUDIO_BOUNCE_AGREEDELETEALL = ' CHECKED';
		}

		if (isset($SENDSTUDIO_BOUNCE_AGREEDELETEALL) && $SENDSTUDIO_BOUNCE_AGREEDELETEALL == 1) {
			$SENDSTUDIO_BOUNCE_AGREEDELETEALL = ' CHECKED';
		}


		if ($SENDSTUDIO_BOUNCE_EXTRASETTINGS) {
			$GLOBALS['Bounce_ExtraSettings'] = ' CHECKED';
		} else {
			$GLOBALS['DisplayExtraMailSettings'] = 'none';
		}

		$allow_attachments = false;
		if (isset($SENDSTUDIO_ALLOW_ATTACHMENTS) && $SENDSTUDIO_ALLOW_ATTACHMENTS == 1) {
			$SENDSTUDIO_ALLOW_ATTACHMENTS = ' CHECKED';
			$allow_attachments = true;
		}
		if (!isset($SENDSTUDIO_ALLOW_ATTACHMENTS) && SENDSTUDIO_ALLOW_ATTACHMENTS == 1) {
			$SENDSTUDIO_ALLOW_ATTACHMENTS = ' CHECKED';
			$allow_attachments = true;
		}
		if (!isset($SENDSTUDIO_ALLOW_ATTACHMENTS)) {
			$SENDSTUDIO_ALLOW_ATTACHMENTS = '';
		}

		$GLOBALS['ShowAttachmentSize'] = 'none';
		if ($allow_attachments) {
			$GLOBALS['ShowAttachmentSize'] = "'';";
		}

		$embedded_images = false;
		if (isset($SENDSTUDIO_ALLOW_EMBEDIMAGES) && $SENDSTUDIO_ALLOW_EMBEDIMAGES == 1) {
			$embedded_images = true;
			$SENDSTUDIO_ALLOW_EMBEDIMAGES = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_ALLOW_EMBEDIMAGES) && SENDSTUDIO_ALLOW_EMBEDIMAGES == 1) {
			$embedded_images = true;
			$SENDSTUDIO_ALLOW_EMBEDIMAGES = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_ALLOW_EMBEDIMAGES)) {
			$SENDSTUDIO_ALLOW_EMBEDIMAGES = '';
		}

		// this option is hidden by the embedded_images check but we should remember the 'state' in case the admin turns off embedded images and then turns it back on.
		if (isset($SENDSTUDIO_DEFAULT_EMBEDIMAGES) && $SENDSTUDIO_DEFAULT_EMBEDIMAGES == 1) {
			$SENDSTUDIO_DEFAULT_EMBEDIMAGES = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_DEFAULT_EMBEDIMAGES) && SENDSTUDIO_DEFAULT_EMBEDIMAGES == 1) {
			$SENDSTUDIO_DEFAULT_EMBEDIMAGES = ' CHECKED';
		}

		if (!isset($SENDSTUDIO_DEFAULT_EMBEDIMAGES)) {
			$SENDSTUDIO_DEFAULT_EMBEDIMAGES = '';
		}

		$GLOBALS['ShowDefaultEmbeddedImages'] = 'none';
		if ($embedded_images) {
			$GLOBALS['ShowDefaultEmbeddedImages'] = "'';";
		}

		/**
		* Now we have worked out the logic of what options are pre-filled,
		* we'll just set up the variables ready for the template system to use everything.
		*/

		$disabled_functions = explode(',', SENDSTUDIO_DISABLED_FUNCTIONS);
		$php_binary = 'php';
		if (substr(strtolower(PHP_OS), 0, 3) == 'win') {
			$php_binary = 'php.exe';
		}
		$php_path = $this->Which($php_binary);

		// If we can't find the full path, just print the binary so people get the right idea.
		if ($php_path == '') {
			$php_path = $php_binary;
		}
		$php_path .= ' -f ';

		$GLOBALS['CronPath'] = $php_path . SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'cron' . DIRECTORY_SEPARATOR . 'cron.php';

		$GLOBALS['DatabaseType'] = $SENDSTUDIO_DATABASE_TYPE;
		$GLOBALS['DatabaseUser'] = $SENDSTUDIO_DATABASE_USER;
		$GLOBALS['DatabaseHost'] = $SENDSTUDIO_DATABASE_HOST;
		$GLOBALS['DatabasePass'] = $SENDSTUDIO_DATABASE_PASS;
		$GLOBALS['DatabaseName'] = $SENDSTUDIO_DATABASE_NAME;
		$GLOBALS['DatabaseTablePrefix'] = $SENDSTUDIO_TABLEPREFIX;
		$GLOBALS['ApplicationURL'] = $SENDSTUDIO_APPLICATION_URL;
		$GLOBALS['LicenseKey'] = $SENDSTUDIO_LICENSEKEY;
		$GLOBALS['DatabaseVersion'] = $api->Db->FetchOne('SELECT version() AS version');

		$GLOBALS['System_Message'] = htmlentities($SENDSTUDIO_SYSTEM_MESSAGE, ENT_QUOTES, SENDSTUDIO_CHARSET);

		$GLOBALS['TextFooter'] = strip_tags($SENDSTUDIO_TEXTFOOTER);
		$GLOBALS['HTMLFooter'] = $SENDSTUDIO_HTMLFOOTER;

		$GLOBALS['ForceUnsubLink'] = $SENDSTUDIO_FORCE_UNSUBLINK;

		$GLOBALS['CronEnabled'] = $SENDSTUDIO_CRON_ENABLED;

		$GLOBALS['IpTracking'] = $SENDSTUDIO_IPTRACKING;
		$GLOBALS['UseMultipleUnsubscribe'] = $SENDSTUDIO_USEMULTIPLEUNSUBSCRIBE;
		$GLOBALS['ContactCanModifyEmail'] = $SENDSTUDIO_CONTACTCANMODIFYEMAIL;

		$GLOBALS['SendTestMode'] = $SENDSTUDIO_SEND_TEST_MODE;

		$GLOBALS['MaxHourlyRate'] = $SENDSTUDIO_MAXHOURLYRATE;

		$GLOBALS['MaxOverSize'] = $SENDSTUDIO_MAXOVERSIZE;

		$GLOBALS['EmailAddress'] = htmlspecialchars($SENDSTUDIO_EMAIL_ADDRESS, ENT_QUOTES, SENDSTUDIO_CHARSET);

		$GLOBALS['MaxImageWidth'] = intval($SENDSTUDIO_MAX_IMAGEWIDTH);
		$GLOBALS['MaxImageHeight'] = intval($SENDSTUDIO_MAX_IMAGEHEIGHT);

		$GLOBALS['Smtp_Server'] = htmlspecialchars($SENDSTUDIO_SMTP_SERVER, ENT_QUOTES, SENDSTUDIO_CHARSET);
		$GLOBALS['Smtp_Username'] = htmlspecialchars($SENDSTUDIO_SMTP_USERNAME, ENT_QUOTES, SENDSTUDIO_CHARSET);
		$GLOBALS['Smtp_Password'] = base64_decode($SENDSTUDIO_SMTP_PASSWORD);
		$GLOBALS['Smtp_Port'] = $SENDSTUDIO_SMTP_PORT;

		$GLOBALS['Bounce_Address'] = htmlspecialchars($SENDSTUDIO_BOUNCE_ADDRESS, ENT_QUOTES, SENDSTUDIO_CHARSET);
		$GLOBALS['Bounce_Server'] = htmlspecialchars($SENDSTUDIO_BOUNCE_SERVER, ENT_QUOTES, SENDSTUDIO_CHARSET);
		$GLOBALS['Bounce_Username'] = htmlspecialchars($SENDSTUDIO_BOUNCE_USERNAME, ENT_QUOTES, SENDSTUDIO_CHARSET);
		$GLOBALS['Bounce_Password'] = base64_decode($SENDSTUDIO_BOUNCE_PASSWORD);
		$GLOBALS['Bounce_Imap'] = $SENDSTUDIO_BOUNCE_IMAP;
		$GLOBALS['Bounce_ExtraSettings'] = htmlspecialchars($SENDSTUDIO_BOUNCE_EXTRASETTINGS, ENT_QUOTES, SENDSTUDIO_CHARSET);
		$GLOBALS['Bounce_AgreeDelete'] = $SENDSTUDIO_BOUNCE_AGREEDELETE;
		$GLOBALS['Bounce_AgreeDeleteAll'] = $SENDSTUDIO_BOUNCE_AGREEDELETEALL;

		$GLOBALS['AllowAttachments'] = $SENDSTUDIO_ALLOW_ATTACHMENTS;
		$GLOBALS['AllowEmbedImages'] = $SENDSTUDIO_ALLOW_EMBEDIMAGES;

		$GLOBALS['AttachmentSize'] = $SENDSTUDIO_ATTACHMENT_SIZE;

		$GLOBALS['EmailSize_Warning'] = $SENDSTUDIO_EMAILSIZE_WARNING;
		$GLOBALS['EmailSize_Maximum'] = $SENDSTUDIO_EMAILSIZE_MAXIMUM;

		$GLOBALS['Resend_Maximum'] = $SENDSTUDIO_RESEND_MAXIMUM;

		$GLOBALS['DefaultEmbedImages'] = $SENDSTUDIO_DEFAULT_EMBEDIMAGES;

		$GLOBALS['Copyright'] = htmlspecialchars(LNG_Copyright, ENT_QUOTES, SENDSTUDIO_CHARSET);

		$GLOBALS['Existing_App_Logo_Image'] = APPLICATION_LOGO_IMAGE;

		$GLOBALS['Existing_App_Favicon'] = APPLICATION_FAVICON;

//		$GLOBALS['EnableUpdatesCheck'] = (isset($addonStatus['updatecheck']['enabled']) && $addonStatus['updatecheck']['enabled'] == '1') ? 'CHECKED' : '';

		$GLOBALS['ShowIntroVideo'] = (SHOW_INTRO_VIDEO == true) ? 'CHECKED' : '';

		$GLOBALS['ShowSmtpComOption'] = (SHOW_SMTP_COM_OPTION == true) ? 'CHECKED' : '';

		$GLOBALS['ShowSmtpComOptionShow'] = (SHOW_SMTP_COM_OPTION == true) ? '' : 'none';



		$GLOBALS['FormAction'] = 'Action=Save';

		if (!$cron_checked) {
			$api->DisableCron();
		}

		if ($cron_checked) {
			$this->DisplayCronWarning(false);
		}

		$test_mode_report = '';
		if ($send_test_mode) {
			$jobs_api = $this->GetApi('Jobs');
			$job_found = $jobs_api->FindJob('send', 'newsletter', 0, true, false, false);
			if ($job_found) {
				$test_mode_report = $this->PrintWarning('Send_TestMode_JobsWaiting');
			}
		}

		$GLOBALS['Send_TestMode_Report'] = $test_mode_report;

		$attachments_report = '';

		if (!$allow_attachments) {
			$autos_to_disable = array();

			$auto_files = list_files(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'autoresponders', null, true);
			if (!empty($auto_files)) {
				$autoresponder_ids = array_keys($auto_files);
				foreach ($autoresponder_ids as $p => $autoresponderid) {
					$files = $auto_files[$autoresponderid];
					if (isset($files['attachments'])) {
						if (!empty($files['attachments'])) {
							$autos_to_disable[] = $autoresponderid;
						}
					}
				}
			}

			if (!empty($autos_to_disable)) {
				$auto_api = $this->GetApi('Autoresponders');
				$disabled_list = $auto_api->DisableAutoresponders($autos_to_disable);
				if (!empty($disabled_list)) {
					$amount = sizeof(array_keys($disabled_list));
					if ($amount == 1) {
						$attachments_report .= GetLang('Autoresponders_Disabled_Attachments_One_Link');
					} else {
						$attachments_report .= sprintf(GetLang('Autoresponders_Disabled_Attachments_Many_Link'), $this->FormatNumber($amount));
					}

					$email_api = $this->GetApi('Email');
					$email_api->Set('CharSet', SENDSTUDIO_CHARSET);

					foreach ($disabled_list as $p => $disabled_details) {
						$subject = GetLang('Autoresponders_Disabled_Email_Subject');

						$message = sprintf(GetLang('Autoresponders_Disabled_Email_Message'), $disabled_details['autorespondername'], $disabled_details['listname']);

						$email_api->ClearAttachments();
						$email_api->ClearRecipients();

						$email_api->Set('Multipart', false);
						$email_api->AddBody('text', $message);
						$email_api->Set('Subject', $subject);

						$email_api->Set('FromAddress', SENDSTUDIO_EMAIL_ADDRESS);

						$email_api->AddRecipient($disabled_details['owneremail'], $disabled_details['ownername'], 't');

						$email_api->Send();
					}
					IEM::sessionSet('AutorespondersDisabled', $disabled_list);
				}
			}
			
			$newsletters_to_disable = array();
            
            $newsletter_files = list_files(TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'newsletters', null, true);
			if (!empty($newsletter_files)) {
				$newsletter_ids = array_keys($newsletter_files);
				
				
				
				foreach ($newsletter_ids as $newsid) {
			
			
			
			
			
			
                
					$files = $newsletter_files[$newsid];
					if (isset($files['attachments'])) {
						if (!empty($files['attachments'])) {
							$newsletterts_to_disable[] = $newsid;
						}
					}
                   
                }
            }            

			if (!empty($newsletters_to_disable)) {
				if ($attachments_report != '') {
					$attachments_report .= '<br/><br/>';
				}

				$news_api = $this->GetApi('Newsletters');
				$disabled_list = $news_api->DisableNewsletters($newsletters_to_disable);
				if (!empty($disabled_list)) {
					$amount = sizeof(array_keys($disabled_list));
					if ($amount == 1) {
					
						$attachments_report .= GetLang('Newsletters_Disabled_Attachments_One_Link');
					} else {
						$attachments_report .= sprintf(GetLang('Newsletters_Disabled_Attachments_Many_Link'), $this->FormatNumber($amount));
				}
				IEM::sessionSet('NewslettersDisabled', $disabled_list);
			}
		  }
		}

		$GLOBALS['DisplayAttachmentsMessage'] = "none;";
		if ($attachments_report) {
			$GLOBALS['DisplayAttachmentsMessage'] = '';
			$GLOBALS['Warning'] = $attachments_report;

			$GLOBALS['Attachments_Message'] = $this->ParseTemplate('WarningMsg', true, false);
		}

		$GLOBALS['ExtraScript'] = $extra;

		$GLOBALS['Settings_AddonsDisplay'] = $this->PrintAddonsList();

		// ----- Credit settings
			$tempPercentageWarnings = array();
			$tempFixedWarnings = array(); // TODO fixed credit warnings aren't implemented yet
			$tempWarnings = $api->GetCreditWarningsSettings();

			// If warnings can't be found, create default.
			if (empty($tempWarnings)) {
				$tempDefaultLevel = array('0', '15', '25');
				$tempWarnings = array();

				foreach ($tempDefaultLevel as $each) {
					$tempPercentageWarnings[] = array(
						'enabled' => '0',
						'creditlevel' => $each,
						'aspercentage' => '1',
						'emailsubject' => GetLang('CreditWarnings_Warnings_EmailSubjectDefaultText'),
						'emailcontents' => str_replace('%s', "{$each}%", GetLang('CreditSettings_Warnings_PercentageDefaultText'))
					);
				}

				unset($tempDefaultLevel);

			// Split the warnings into two arrays (fixed and percentage warnings)
			} else {
				foreach ($tempWarnings as $each) {
					if ($each['aspercentage']) {
						$tempPercentageWarnings[] = $each;
					} else {
						$tempFixedWarnings[] = $each;
					}
				}
			}

			unset($tempWarnings);

			$tpl->Assign('credit_settings', array(
				'autoresponders_take_credit' => (bool)SENDSTUDIO_CREDIT_INCLUDE_AUTORESPONDERS,
				'triggers_take_credit' => (bool)SENDSTUDIO_CREDIT_INCLUDE_TRIGGERS,
				'enable_credit_level_warnings' => (bool)SENDSTUDIO_CREDIT_WARNINGS,
				'warnings_percentage_level' => $tempPercentageWarnings,
				'warnings_percentage_level_choices' => array(
					'0', '5', '10', '15', '20', '25',
					'30', '35', '40', '45', '50'
				)
			));
		// -----

		// ----- Login Security settings
			$security_settings = array(
				'login_wait' => SENDSTUDIO_SECURITY_WRONG_LOGIN_WAIT,
				'threshold_login_count' => SENDSTUDIO_SECURITY_WRONG_LOGIN_THRESHOLD_COUNT,
				'threshold_login_duration' => SENDSTUDIO_SECURITY_WRONG_LOGIN_THRESHOLD_DURATION / 60,
				'ip_login_ban_duration' => SENDSTUDIO_SECURITY_BAN_DURATION / 60
			);

			$security_settings_options = array(
				'login_wait' => array(1, 2, 3, 4, 5),
				'threshold_login_count' => array(3, 4, 5, 10, 15),
				'threshold_login_duration' => array(1, 5, 10, 15),
				'ip_login_ban_duration' => array(1, 5, 10, 15)
			);

			$tpl->Assign('security_settings', $security_settings);
			$tpl->Assign('security_settings_options', $security_settings_options);
		// -----

		$tpl->Assign('AgencyEdition', get_agency_license_variables());

		$showtab = 1;
		if (isset($_GET['Tab'])) {
			$tab = (int)$_GET['Tab'];
			if ($tab > 0) {
				$showtab = $tab;
			}
		}

		$GLOBALS['Message'] .= GetFlashMessages();

		$tpl->Assign('ShowTab', $showtab);
		$tpl->Assign('DisplayPrivateLabel', (defined('APPLICATION_SHOW_WHITELABEL_MENU')? constant('APPLICATION_SHOW_WHITELABEL_MENU') : true));

		$tpl->ParseTemplate('Settings');

		$this->PrintFooter();
	}
Esempio n. 5
0
 /**
  * ValidateLicense
  * Checks whether the supplied licence is valid or not, and checks if the license can be used with am optionally supplied database type.
  *
  * @param String $key The licence key to validate.
  * @param String $db_type A database type, e.g. 'mysql', 'pgsql'.
  *
  * @return Array The first element is an error code indicating success (0) or failure (> 0). The second element is an error string.
  */
 public static function ValidateLicense($key, $db_type = '')
 {
     list($error, $msg) = sesion_start($key);
     if ($error) {
         return array(self::FIELD_INVALID, $msg);
     }
     if ($db_type && !installCheck($key, $db_type)) {
         //return array(self::DB_UNSUPPORTED, 'Your license key only allows you to use a MySQL database.');
     }
     return array(self::SUCCESS, null);
 }