mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
- Imagesets can now be edited! Hooray! ( Might need to add something.. )
git-svn-id: file:///svn/phpbb/trunk@5483 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7de53b46ec
commit
c10f287751
4 changed files with 159 additions and 2 deletions
|
@ -30,6 +30,51 @@
|
|||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_EDIT_IMAGESET -->
|
||||
|
||||
<a href="{U_BACK}" style="float: right">« {L_BACK}</a>
|
||||
|
||||
<h1>{L_TITLE}</h1>
|
||||
|
||||
<p>{L_EXPLAIN}</p>
|
||||
|
||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
||||
<table cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="5">{L_IMAGE_CONFIGURATION}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row3" colspan="5"><b>{L_IMAGESET_NAME}: {NAME}</b></td>
|
||||
</tr>
|
||||
<tr class="row3">
|
||||
<td>{L_IMAGE_NAME}</td>
|
||||
<td>{L_IMAGE}</td>
|
||||
<td>{L_IMAGE_LOCATION}</td>
|
||||
<td>{L_IMAGE_WIDTH}</td>
|
||||
<td>{L_IMAGE_HEIGHT}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN element -->
|
||||
<!-- IF element.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td style="text-align: center;">{element.NAME}</td>
|
||||
<td style="text-align: center;"><img src="{element.IMG_SRC}" alt="" title="" /></td>
|
||||
<td><input class="post" type="text" name="src[{element.NAME}]" value="{element.SRC}" size="20" /></td>
|
||||
<td><input class="post" type="text" size="3" name="width[{element.NAME}]" value="{element.WIDTH}" /></td>
|
||||
<td><input class="post" type="text" size="3" name="height[{element.NAME}]" value="{element.HEIGHT}" /></td>
|
||||
</tr>
|
||||
<!-- END element -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_EXPORT -->
|
||||
|
||||
<a href="{U_BACK}" style="float: right">« {L_BACK}</a>
|
||||
|
|
|
@ -258,8 +258,14 @@ pagination_sep = \'{PAGINATION_SEP}\'
|
|||
break;
|
||||
|
||||
case 'imageset':
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'edit':
|
||||
$this->edit_imageset($style_id);
|
||||
break;
|
||||
default:
|
||||
$this->frontend('imageset', array('details', 'delete', 'export'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -410,6 +416,100 @@ pagination_sep = \'{PAGINATION_SEP}\'
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit imagesets
|
||||
*/
|
||||
function edit_imageset($style_id)
|
||||
{
|
||||
global $db, $template, $user, $phpbb_root_path, $cache;
|
||||
|
||||
$update = (isset($_POST['submit'])) ? true : false;
|
||||
|
||||
$sql = 'SELECT imageset_name, ' . $this->imageset_keys . '
|
||||
FROM ' . STYLES_IMAGE_TABLE . '
|
||||
WHERE imageset_id = ' . $style_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$style_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$style_row)
|
||||
{
|
||||
trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$name = $style_row['imageset_name'];
|
||||
unset($style_row['imageset_name']);
|
||||
|
||||
if ($update)
|
||||
{
|
||||
$images = (isset($_POST['src'])) ? request_var('src', array('' => '')) : array();
|
||||
$image_width = (isset($_POST['width'])) ? array_map('intval', $_POST['width']) : array();
|
||||
$image_height = (isset($_POST['height'])) ? array_map('intval', $_POST['height']) : array();
|
||||
|
||||
$img_array = array();
|
||||
|
||||
foreach ($images as $image_name => $value)
|
||||
{
|
||||
if (!empty($value))
|
||||
{
|
||||
$width = ($image_width[$image_name] == 0) ? '' : $image_width[$image_name];
|
||||
$img_array[$image_name] = $value . '*' . $image_height[$image_name] . '*' . $width;
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_array[$image_name] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . STYLES_IMAGE_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $img_array) . "
|
||||
WHERE imageset_id = $style_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
$cache->destroy('sql', STYLES_IMAGE_TABLE);
|
||||
|
||||
add_log('admin', 'LOG_IMAGESET_EDIT', $name);
|
||||
trigger_error($user->lang['EDITED_IMAGESET'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
$this->page_title = 'EDIT_IMAGESET';
|
||||
|
||||
foreach ($style_row as $key => $value)
|
||||
{
|
||||
$src = '';
|
||||
|
||||
$width = $height = $imgsrc = '';
|
||||
if (!empty($value))
|
||||
{
|
||||
$values = explode('*',$value);
|
||||
$imgsrc = $values[0];
|
||||
$height = (!empty($values[1])) ? $values[1] : '';
|
||||
$width = (!empty($values[2])) ? $values[2] : '';
|
||||
}
|
||||
|
||||
$template->assign_block_vars('element', array(
|
||||
'NAME' => $key,
|
||||
'SRC' => $imgsrc,
|
||||
'HEIGHT' => $height,
|
||||
'WIDTH' => $width,
|
||||
'IMG_SRC' => $phpbb_root_path . 'styles/' . $user->theme['imageset_path'] . '/imageset/' . str_replace('{LANG}', $user->img_lang, $imgsrc)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT_IMAGESET' => true,
|
||||
'L_TITLE' => $user->lang[$this->page_title],
|
||||
'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'],
|
||||
|
||||
'U_ACTION' => $this->u_action . "&action=edit&id=$style_id",
|
||||
'U_BACK' => $this->u_action,
|
||||
'NAME' => $name,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove style/template/theme/imageset
|
||||
*/
|
||||
|
|
|
@ -338,6 +338,7 @@ $lang = array_merge($lang, array(
|
|||
'LOG_IMAGESET_ADD_FS' => '<b>Add new imageset on filesystem</b><br />» %s',
|
||||
'LOG_IMAGESET_DELETE' => '<b>Deleted imageset</b><br />» %s',
|
||||
'LOG_IMAGESET_EDIT_DETAILS' => '<b>Edited imageset details</b><br />» %s',
|
||||
'LOG_IMAGESET_EDIT' => '<b>Edited imageset</b><br />» %s',
|
||||
'LOG_IMAGESET_EXPORT' => '<b>Exported imageset</b><br />» %s',
|
||||
|
||||
'LOG_INDEX_ACTIVATE' => '<b>Activated inactive users</b><br />» %s',
|
||||
|
|
|
@ -62,6 +62,15 @@ $lang = array_merge($lang, array(
|
|||
'DELETE_THEME_EXPLAIN' => 'Here you can remove the selected theme from the database. Additionally, if you have permission you can elect to remove the theme from the filesystem. Please note that there is no undo capability. When the theme is deleted it is gone for good. It is recommended that you first export your theme for possible future use.',
|
||||
'DETAILS' => 'Details',
|
||||
|
||||
'EDIT_IMAGESET' => 'Edit imageset',
|
||||
'EDIT_IMAGESET_EXPLAIN' => 'Here you can modify the images stored in the currently selected imageset.',
|
||||
'IMAGE_CONFIGURATION' => 'Image configuration',
|
||||
'IMAGE_WIDTH' => 'Image width',
|
||||
'IMAGE_HEIGHT' => 'Image height',
|
||||
'IMAGE' => 'Image',
|
||||
'IMAGE_NAME' => 'Image name',
|
||||
'IMAGE_LOCATION' => 'Image location',
|
||||
|
||||
'EDIT_DETAILS_IMAGESET' => 'Edit imageset details',
|
||||
'EDIT_DETAILS_IMAGESET_EXPLAIN' => 'Here you can edit certain imageset details such as its name.',
|
||||
'EDIT_DETAILS_STYLE' => 'Edit Style',
|
||||
|
@ -106,6 +115,8 @@ $lang = array_merge($lang, array(
|
|||
'INSTALLED_TEMPLATE' => 'Installed templates',
|
||||
'INSTALLED_THEME' => 'Installed themes',
|
||||
|
||||
'EDITED_IMAGESET' => 'Edited imageset',
|
||||
|
||||
'NO_IMAGESET' => 'Cannot find imageset on filesystem',
|
||||
'NO_STYLE' => 'Cannot find style on filesystem',
|
||||
'NO_TEMPLATE' => 'Cannot find template on filesystem',
|
||||
|
|
Loading…
Add table
Reference in a new issue