<?php
/**
*
* @package ppkBB3cker
* @version $Id: posting_add1.php 1.000 2009-03-26 19:25:00 PPK $
* @copyright (c) 2009 PPK
* http://ppkbb3cker.rx22.ru, http://protoneutron.narod.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}
			$post_addfields='';
			foreach($array_addfields as $k)
			{
				$c=intval(@$user->lang['TRACKER_FORUM_ADDFIELDS_COUNT'][$k]);
				$cf_bbcodes=@$user->lang['TRACKER_FORUM_ADDFIELDS_BBCODES'][$k];
				if($c)
				{
					$tmp_addfields=array();
					for($i=1;$i<=$c;$i++)
					{
						if(@$_POST[$k.$i])
						{
							if($cf_bbcodes)
							{
								$tmp_addfields[]=sprintf($cf_bbcodes, $_POST[$k.$i]);
							}
							else
							{
								$tmp_addfields[]=$_POST[$k.$i];
							}
						}
					}
					if($tmp_addfields)
					{
						$post_addfields ? $post_addfields.="\r\n" : '';
						$cf_bbcode=@$user->lang['TRACKER_FORUM_ADDFIELDS_BBCODE'][$k];
						if($cf_bbcode)
						{
							$post_addfields.=sprintf($cf_bbcode, implode("\r\n", $tmp_addfields));
						}
						else
						{
							$post_addfields.=implode("\r\n", $tmp_addfields);
						}
					}
				}
				else
				{
					$v=@$_POST[$k];
					$tmp_addfields=array();
					$post_addfields && $v ? $post_addfields.="\r\n" : '';
					if($v)
					{
						$cf_bbcodes=@$user->lang['TRACKER_FORUM_ADDFIELDS_BBCODES'][$k];
						if($cf_bbcodes)
						{
							$tmp_addfields[]=sprintf($cf_bbcodes, $v);
						}
						else if(@$user->lang['TRACKER_FORUM_ADDFIELDS'][$k])
						{
							$tmp_addfields[]="[b]{$user->lang['TRACKER_FORUM_ADDFIELDS'][$k]}[/b]: $v";
						}
						$cf_bbcode=@$user->lang['TRACKER_FORUM_ADDFIELDS_BBCODE'][$k];
						if($tmp_addfields)
						{
							if($cf_bbcode)
							{
								$post_addfields.=sprintf($cf_bbcode, implode("\r\n", $tmp_addfields));
							}
							else
							{
								$post_addfields.=implode("\r\n", $tmp_addfields);
							}
						}
					}
				}

			}
			$post_addfields ? $_REQUEST['message']=$post_addfields."\r\n".$_REQUEST['message'] : '';
?>