PageRenderTime 27ms CodeModel.GetById 18ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/upload/includes/topic_templates/audiobooks.php

http://torrentpier2.googlecode.com/
PHP | 66 lines | 54 code | 10 blank | 2 comment | 9 complexity | dda950bedd6e6634ad3b1bf8a0c23dac MD5 | raw file
 1<?php
 2
 3if (!defined('IN_PHPBB')) die(basename(__FILE__));
 4if (!$topic_tpl) die('$topic_tpl missing');
 5
 6$img_align = '=right';
 7$title_font_size = 24;
 8
 9if (@$_REQUEST['preview'] && is_array($_POST['msg']))
10{
11	$tpl_items = array(
12		'release_name',
13		'picture',
14		'year',
15		'author',
16		'performer',
17		'genre',
18		'publisher',
19		'audiobook_type',
20		'audio_codec',
21		'audio_bitrate',
22		'description',
23		'moreinfo',
24	);
25
26	$tpl_sprintf = array(
27		'picture'      => "[img{$img_align}]%s[/img]",
28		'release_name' => "[size=$title_font_size]%s[/size]\n\n",
29	);
30
31	$message = $subject = '';
32	$msg = $sbj_ext = array();
33
34	foreach ($tpl_items as $item)
35	{
36		$msg[$item] = @$_POST['msg'][$item];
37	}
38	array_deep($msg, 'trim');
39
40	if ($msg)
41	{
42		// Subject
43		$subject = $msg['release_name'];
44
45		if ($msg['author'])
46		{
47			$subject = $msg['author'] .' - '. $subject;
48		}
49
50		if ($msg['performer'])
51		{
52			$sbj_ext[] = $msg['performer'];
53		}
54		if ($msg['year'])
55		{
56			$sbj_ext[] = $msg['year'];
57		}
58		if ($sbj_ext)
59		{
60			$subject .= ' ['. join(', ', $sbj_ext) .']';
61		}
62
63		// Message
64		$message = tpl_build_message($msg);
65	}
66}