From c16d34f995647c763d894689deea6aac0439b6eb Mon Sep 17 00:00:00 2001
From: Henry Sudhof <kellanved@phpbb.com>
Date: Tue, 22 Jan 2008 15:29:58 +0000
Subject: #19675 and #19675

Language changes, so take care.

I guess it's time to close up shop :)


git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8326 89ea8834-ac86-4346-8a33-228a782c2dd0
---
 phpBB/includes/acp/acp_icons.php      | 20 +++++++++++++++-----
 phpBB/includes/ucp/ucp_pm_compose.php | 35 ++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 16 deletions(-)

(limited to 'phpBB/includes')

diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 537c0425a2..f66f45cd36 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -337,11 +337,16 @@ class acp_icons
 				}
 
 				$icons_updated = 0;
+				$errors = array();
 				foreach ($images as $image)
 				{
-					if (($mode == 'smilies' && ($image_emotion[$image] == '' || $image_code[$image] == '')) ||
-						($action == 'create' && !isset($image_add[$image])))
+					if ($mode == 'smilies' && ($image_emotion[$image] == '' || $image_code[$image] == ''))
 					{
+						$errors[$image] = 'SMILIE_NO_' . (($image_emotion[$image] == '') ? 'EMOTION' : 'CODE');
+					}
+					else if ($action == 'create' && !isset($image_add[$image]))
+					{
+						// skip images where add wasn't checked
 					}
 					else
 					{
@@ -431,13 +436,18 @@ class acp_icons
 					default:
 						$suc_lang = $lang;
 				}
+				$errormsgs = '<br />';
+				foreach ($errors as $img => $error)
+				{
+					$errormsgs .= '<br />' . sprintf($user->lang[$error], $img);
+				}
 				if ($action == 'modify')
 				{
-					trigger_error($user->lang[$suc_lang . '_EDITED'] . adm_back_link($this->u_action), $level);
+					trigger_error($user->lang[$suc_lang . '_EDITED'] . $errormsgs . adm_back_link($this->u_action), $level);
 				}
 				else
 				{
-					trigger_error($user->lang[$suc_lang . '_ADDED'] . adm_back_link($this->u_action), $level);
+					trigger_error($user->lang[$suc_lang . '_ADDED'] . $errormsgs .adm_back_link($this->u_action), $level);
 				}
 
 			break;
@@ -462,7 +472,7 @@ class acp_icons
 						if (preg_match_all("#'(.*?)', ?#", $pak_entry, $data))
 						{
 							if ((sizeof($data[1]) != 4 && $mode == 'icons') ||
-								(sizeof($data[1]) != 6 && $mode == 'smilies'))
+								((sizeof($data[1]) != 6 || (empty($data[1][4]) || empty($data[1][5]))) && $mode == 'smilies' ))
 							{
 								trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING);
 							}
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index b2e91d8dde..af592e3612 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -465,7 +465,8 @@ function compose_pm($id, $mode, $action)
 					'forum_id'		=> 0,
 					'save_time'		=> $current_time,
 					'draft_subject'	=> $subject,
-					'draft_message'	=> $message)
+					'draft_message'	=> $message
+					)
 				);
 				$db->sql_query($sql);
 
@@ -488,6 +489,8 @@ function compose_pm($id, $mode, $action)
 					'g'			=> $to_group_id,
 					'p'			=> $msg_id)
 				);
+				$s_hidden_fields .= build_address_field($address_list);
+
 
 				confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields);
 			}
@@ -541,7 +544,7 @@ function compose_pm($id, $mode, $action)
 
 	if ($submit || $preview || $refresh)
 	{
-		if (!check_form_key('ucp_pm_compose'))
+		if (($submit || $preview) && !check_form_key('ucp_pm_compose'))
 		{
 			$error[] = $user->lang['FORM_INVALID'];
 		}
@@ -888,15 +891,9 @@ function compose_pm($id, $mode, $action)
 	}
 
 	// Build hidden address list
-	$s_hidden_address_field = '';
-	foreach ($address_list as $type => $adr_ary)
-	{
-		foreach ($adr_ary as $id => $field)
-		{
-			$s_hidden_address_field .= '<input type="hidden" name="address_list[' . (($type == 'u') ? 'u' : 'g') . '][' . (int) $id . ']" value="' . (($field == 'to') ? 'to' : 'bcc') . '" />';
-		}
-	}
-
+	$s_hidden_address_field = build_address_field($address_list);
+	 
+	
 	$bbcode_checked		= (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1);
 	$smilies_checked	= (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1);
 	$urls_checked		= (isset($enable_urls)) ? !$enable_urls : 0;
@@ -1117,6 +1114,22 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
 	}
 }
 
+/** 
+* Build the hidden field for the recipients. Needed, as the variable is not read via request_var.
+*/
+function build_address_field($address_list)
+{
+	$s_hidden_address_field = '';
+	foreach ($address_list as $type => $adr_ary)
+	{
+		foreach ($adr_ary as $id => $field)
+		{
+			$s_hidden_address_field .= '<input type="hidden" name="address_list[' . (($type == 'u') ? 'u' : 'g') . '][' . (int) $id . ']" value="' . (($field == 'to') ? 'to' : 'bcc') . '" />';
+		}
+	}
+	return $s_hidden_address_field;
+}
+
 /**
 * Return number of private message recipients
 */
-- 
cgit v1.2.1