Line 73 | Line 73 |
---|
foreach ($imglist as $path => $img_ary) {
|
foreach ($imglist as $path => $img_ary) {
|
| if (empty($img_ary)) { continue; }
asort($img_ary, SORT_STRING);
|
foreach ($img_ary as $img) { $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
| foreach ($img_ary as $img) { $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
|
Line 80 | Line 87 |
---|
if (!$img_size[0] || !$img_size[1] || strlen($img) > 255) { continue;
|
if (!$img_size[0] || !$img_size[1] || strlen($img) > 255) { continue;
|
| }
// adjust the width and height to be lower than 128px while perserving the aspect ratio (for icons) if ($mode == 'icons') { if ($img_size[0] > 127 && $img_size[0] > $img_size[1]) { $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0])); $img_size[0] = 127; } else if ($img_size[1] > 127) { $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1])); $img_size[1] = 127; }
|
}
$_images[$path . $img]['file'] = $path . $img;
| }
$_images[$path . $img]['file'] = $path . $img;
|
Line 99 | Line 121 |
---|
} } closedir($dir);
|
} } closedir($dir);
|
| if (!empty($_paks)) { asort($_paks, SORT_STRING); }
|
} }
| } }
|
Line 219 | Line 246 |
---|
$data = $_images; }
|
$data = $_images; }
|
$colspan = (($mode == 'smilies') ? '7' : '5');
| $colspan = (($mode == 'smilies') ? 7 : 5);
|
$colspan += ($icon_id) ? 1 : 0; $colspan += ($action == 'add') ? 2 : 0;
| $colspan += ($icon_id) ? 1 : 0; $colspan += ($action == 'add') ? 2 : 0;
|
Line 333 | Line 360 |
---|
}
$image_order[$add_image] = request_var('add_order', 0);
|
}
$image_order[$add_image] = request_var('add_order', 0);
|
| } }
if ($mode == 'smilies' && $action == 'create') { $smiley_count = $this->item_count($table);
$addable_smileys_count = sizeof($images); foreach ($images as $image) { if (!isset($image_add[$image])) { --$addable_smileys_count; } }
if ($smiley_count + $addable_smileys_count > SMILEY_LIMIT) { trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING);
|
} }
| } }
|
Line 347 | Line 393 |
---|
else if ($action == 'create' && !isset($image_add[$image])) { // skip images where add wasn't checked
|
else if ($action == 'create' && !isset($image_add[$image])) { // skip images where add wasn't checked
|
| } else if (!file_exists($phpbb_root_path . $img_path . '/' . $image)) { $errors[$image] = 'SMILIE_NO_FILE';
|
} else {
| } else {
|
Line 355 | Line 405 |
---|
$img_size = getimagesize($phpbb_root_path . $img_path . '/' . $image); $image_width[$image] = $img_size[0]; $image_height[$image] = $img_size[1];
|
$img_size = getimagesize($phpbb_root_path . $img_path . '/' . $image); $image_width[$image] = $img_size[0]; $image_height[$image] = $img_size[1];
|
| }
// Adjust image width/height for icons if ($mode == 'icons') { if ($image_width[$image] > 127 && $image_width[$image] > $image_height[$image]) { $image_height[$image] = (int) ($image_height[$image] * (127 / $image_width[$image])); $image_width[$image] = 127; } else if ($image_height[$image] > 127) { $image_width[$image] = (int) ($image_width[$image] * (127 / $image_height[$image])); $image_height[$image] = 127; }
|
}
$img_sql = array(
| }
$img_sql = array(
|
Line 482 | Line 547 |
---|
trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } }
|
trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } }
|
| |
// The user has already selected a smilies_pak file if ($current == 'delete')
| // The user has already selected a smilies_pak file if ($current == 'delete')
|
Line 527 | Line 591 |
---|
$cur_img[$row[$field_sql]] = 1; } $db->sql_freeresult($result);
|
$cur_img[$row[$field_sql]] = 1; } $db->sql_freeresult($result);
|
| }
if ($mode == 'smilies') { $smiley_count = $this->item_count($table); if ($smiley_count + sizeof($pak_ary) > SMILEY_LIMIT) { trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING); }
|
}
foreach ($pak_ary as $pak_entry)
| }
foreach ($pak_ary as $pak_entry)
|
Line 823 | Line 896 |
---|
);
$spacer = false;
|
);
$spacer = false;
|
| $pagination_start = request_var('start', 0);
$item_count = $this->item_count($table);
|
$sql = "SELECT * FROM $table ORDER BY {$fields}_order ASC";
|
$sql = "SELECT * FROM $table ORDER BY {$fields}_order ASC";
|
$result = $db->sql_query($sql);
| $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $pagination_start);
|
while ($row = $db->sql_fetchrow($result)) {
| while ($row = $db->sql_fetchrow($result)) {
|
Line 843 | Line 919 |
---|
'EMOTION' => (isset($row['emotion'])) ? $row['emotion'] : '', 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row[$fields . '_id'], 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row[$fields . '_id'],
|
'EMOTION' => (isset($row['emotion'])) ? $row['emotion'] : '', 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row[$fields . '_id'], 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row[$fields . '_id'],
|
'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row[$fields . '_id'], 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row[$fields . '_id']) );
| 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row[$fields . '_id'] . '&start=' . $pagination_start, 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row[$fields . '_id'] . '&start=' . $pagination_start, ));
|
if (!$spacer && !$row['display_on_posting']) {
| if (!$spacer && !$row['display_on_posting']) {
|
Line 853 | Line 929 |
---|
} } $db->sql_freeresult($result);
|
} } $db->sql_freeresult($result);
|
| $template->assign_var('PAGINATION', generate_pagination($this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true) ); }
/** * Returns the count of smilies or icons in the database * * @param string $table The table of items to count. * @return int number of items */ /* private */ function item_count($table) { global $db;
$sql = "SELECT COUNT(*) AS item_count FROM $table"; $result = $db->sql_query($sql); $item_count = (int) $db->sql_fetchfield('item_count'); $db->sql_freeresult($result);
return $item_count;
|
} }
| } }
|