Index: includes/acp/acp_icons.php =================================================================== --- includes/acp/acp_icons.php (revision 9738) +++ includes/acp/acp_icons.php (working copy) @@ -369,64 +369,80 @@ $image_height[$image] = $img_size[1]; } - $img_sql = array( - $fields . '_url' => $image, - $fields . '_width' => $image_width[$image], - $fields . '_height' => $image_height[$image], - 'display_on_posting' => (isset($image_display_on_posting[$image])) ? 1 : 0, - ); - - if ($mode == 'smilies') + // Chech max width and height + if ($image_width[$image] > 127 || $image_height[$image] > 127) { - $img_sql = array_merge($img_sql, array( - 'emotion' => $image_emotion[$image], - 'code' => $image_code[$image]) - ); + if ($image_width[$image] > 127) + { + $user->lang['WRONG_SIZE'] = sprintf($user->lang['WRONG_SIZE'], $user->lang[strtoupper($mode) . '_WIDTH'], "%s"); + $errors[$image] = 'WRONG_SIZE'; + } + if ($image_height[$image] > 127) + { + $user->lang['WRONG_SIZE'] = sprintf($user->lang['WRONG_SIZE'], $user->lang[strtoupper($mode) . '_HEIGHT'], "%s"); + $errors[$image] = 'WRONG_SIZE'; + } } - - // Image_order holds the 'new' order value - if (!empty($image_order[$image])) + else { - $img_sql = array_merge($img_sql, array( - $fields . '_order' => $image_order[$image]) + $img_sql = array( + $fields . '_url' => $image, + $fields . '_width' => $image_width[$image], + $fields . '_height' => $image_height[$image], + 'display_on_posting' => (isset($image_display_on_posting[$image])) ? 1 : 0, ); - // Since we always add 'after' an item, we just need to increase all following + the current by one - $sql = "UPDATE $table - SET {$fields}_order = {$fields}_order + 1 - WHERE {$fields}_order >= {$image_order[$image]}"; - $db->sql_query($sql); + if ($mode == 'smilies') + { + $img_sql = array_merge($img_sql, array( + 'emotion' => $image_emotion[$image], + 'code' => $image_code[$image]) + ); + } - // If we adjust the order, we need to adjust all other orders too - they became inaccurate... - foreach ($image_order as $_image => $_order) + // Image_order holds the 'new' order value + if (!empty($image_order[$image])) { - if ($_image == $image) + $img_sql = array_merge($img_sql, array( + $fields . '_order' => $image_order[$image]) + ); + + // Since we always add 'after' an item, we just need to increase all following + the current by one + $sql = "UPDATE $table + SET {$fields}_order = {$fields}_order + 1 + WHERE {$fields}_order >= {$image_order[$image]}"; + $db->sql_query($sql); + + // If we adjust the order, we need to adjust all other orders too - they became inaccurate... + foreach ($image_order as $_image => $_order) { - continue; - } + if ($_image == $image) + { + continue; + } - if ($_order >= $image_order[$image]) - { - $image_order[$_image]++; + if ($_order >= $image_order[$image]) + { + $image_order[$_image]++; + } } } - } - if ($action == 'modify' && !empty($image_id[$image])) - { - $sql = "UPDATE $table - SET " . $db->sql_build_array('UPDATE', $img_sql) . " - WHERE {$fields}_id = " . $image_id[$image]; - $db->sql_query($sql); - $icons_updated++; + if ($action == 'modify' && !empty($image_id[$image])) + { + $sql = "UPDATE $table + SET " . $db->sql_build_array('UPDATE', $img_sql) . " + WHERE {$fields}_id = " . $image_id[$image]; + $db->sql_query($sql); + $icons_updated++; + } + else if ($action !== 'modify') + { + $sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql); + $db->sql_query($sql); + $icons_updated++; + } } - else if ($action !== 'modify') - { - $sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql); - $db->sql_query($sql); - $icons_updated++; - } - } } Index: language/en/acp/posting.php =================================================================== --- language/en/acp/posting.php (revision 9738) +++ language/en/acp/posting.php (working copy) @@ -181,6 +181,7 @@ 'SMILIES_WIDTH' => 'Smiley width', 'WRONG_PAK_TYPE' => 'The specified package does not contain the appropriate data.', + 'WRONG_SIZE' => 'The %1$s you entered for the smilie “%2$s” is too big. The maximum allowed is 127.', ));