PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/upload/includes/topic_templates/books.php

http://torrentpier2.googlecode.com/
PHP | 67 lines | 55 code | 10 blank | 2 comment | 9 complexity | ce9e46fc627fcb12b9ec883f9a9278bb 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		'genre',
17		'publisher',
18		'edition',
19		'isbn',
20		'format',
21		'quality',
22		'pages_count',
23		'description',
24		'moreinfo',
25	);
26
27	$tpl_sprintf = array(
28		'picture'      => "[img{$img_align}]%s[/img]\n\n",
29		'release_name' => "[size=$title_font_size]%s[/size]\n\n",
30	);
31
32	$message = $subject = '';
33	$msg = $sbj_ext = array();
34
35	foreach ($tpl_items as $item)
36	{
37		$msg[$item] = @$_POST['msg'][$item];
38	}
39	array_deep($msg, 'trim');
40
41	if ($msg)
42	{
43		// Subject
44		$subject = $msg['release_name'];
45
46		if ($msg['author'])
47		{
48			$subject = $msg['author'] .' - '. $subject;
49		}
50
51		if ($msg['year'])
52		{
53			$sbj_ext[] = $msg['year'];
54		}
55		if ($msg['format'])
56		{
57			$sbj_ext[] = $msg['format'];
58		}
59		if ($sbj_ext)
60		{
61			$subject .= ' ['. join(', ', $sbj_ext) .']';
62		}
63
64		// Message
65		$message = tpl_build_message($msg);
66	}
67}