phpBB

Code Changes

File: includes/functions_messenger.php

  Unmodified   Added   Modified   Removed
Line 210Line 210
	/**
* Set email template to use
*/

	/**
* Set email template to use
*/

	function template($template_file, $template_lang = '', $template_path = '')

	function template($template_file, $template_lang = '', $template_path = '', $template_dir_prefix = '')

	{
global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;

	{
global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;

 

$template_dir_prefix = (!$template_dir_prefix || $template_dir_prefix[0] === '/') ? $template_dir_prefix : '/' . $template_dir_prefix;


$this->setup_template();



$this->setup_template();


Line 228Line 230
			// $this->template->set_filenames will do a trigger_error
$template_lang = basename($config['default_lang']);
}

			// $this->template->set_filenames will do a trigger_error
$template_lang = basename($config['default_lang']);
}

 

$ext_template_paths = array(
array(
'name' => $template_lang . '_email',
'ext_path' => 'language/' . $template_lang . '/email' . $template_dir_prefix,
),
);


if ($template_path)
{
$template_paths = array(


if ($template_path)
{
$template_paths = array(

				$template_path,

				$template_path . $template_dir_prefix,

			);
}
else

			);
}
else

Line 241Line 250
			$template_path .= $template_lang . '/email';

$template_paths = array(

			$template_path .= $template_lang . '/email';

$template_paths = array(

				$template_path,

				$template_path . $template_dir_prefix,

			);

			);

 

$board_language = basename($config['default_lang']);


// we can only specify default language fallback when the path is not a custom one for which we
// do not know the default language alternative


// we can only specify default language fallback when the path is not a custom one for which we
// do not know the default language alternative

			if ($template_lang !== basename($config['default_lang']))

			if ($template_lang !== $board_language)

			{
$fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';

			{
$fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';

				$fallback_template_path .= basename($config['default_lang']) . '/email';

				$fallback_template_path .= $board_language . '/email';





				$template_paths[] = $fallback_template_path;



















				$template_paths[] = $fallback_template_path . $template_dir_prefix;

$ext_template_paths[] = array(
'name' => $board_language . '_email',
'ext_path' => 'language/' . $board_language . '/email' . $template_dir_prefix,
);
}
// If everything fails just fall back to en template
if ($template_lang !== 'en' && $board_language !== 'en')
{
$fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
$fallback_template_path .= 'en/email';

$template_paths[] = $fallback_template_path . $template_dir_prefix;

$ext_template_paths[] = array(
'name' => 'en_email',
'ext_path' => 'language/en/email' . $template_dir_prefix,
);

			}
}


			}
}


		$this->set_template_paths(array(
array(
'name' => $template_lang . '_email',
'ext_path' => 'language/' . $template_lang . '/email'
),
), $template_paths);

		$this->set_template_paths($ext_template_paths, $template_paths);







$this->template->set_filenames(array(
'body' => $template_file . '.txt',


$this->template->set_filenames(array(
'body' => $template_file . '.txt',

Line 510Line 534

foreach ($address_ary as $which_ary)
{


foreach ($address_ary as $which_ary)
{

				$$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']);

				${$type} .= ((${$type} != '') ? ', ' : '') . (($which_ary['name'] != '') ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']);

			}
}


			}
}


Line 858Line 882
			{
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
fclose($fp);

			{
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
fclose($fp);

 

if (function_exists('opcache_invalidate'))
{
@opcache_invalidate($this->cache_file);
}


phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
}


phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
}

Line 900Line 929
		{
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
fclose($fp);

		{
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
fclose($fp);

 

if (function_exists('opcache_invalidate'))
{
@opcache_invalidate($this->cache_file);
}


phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);


phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);

 

$this->data = array();

		}

$lock->release();

		}

$lock->release();