B
Bustra
Гость
PHP:
##############################################################
## MOD Title: Выбор лого из админки
## MOD Author: RusTrek
## MOD адаптировал: Bustra
## Описание: Выбираем логотип из админки, например из папки images/logo
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit:
## admin/admin_board.php
## includes/page_header.php
## language/lang_russian/lang_admin.php
## templates/ваш стиль/admin/admin_board.tpl
## templates/ваш стиль/page_header.tpl
#############################################################
#-----[ ]------------------------------------------
PHP:
INSERT INTO `bb_config` VALUES ('logo_image_path', 'images/logo');
INSERT INTO `bb_config` VALUES ('logo_image', 'subSilver.gif');
INSERT INTO `bb_config` VALUES ('logo_image_w', '200');
INSERT INTO `bb_config` VALUES ('logo_image_h', '91');
PHP:
#-----[ OPEN ]------------------------------------------
language/lang_russian/lang_admin.php
в самый конец добавить
// Logo Selector MOD
$lang['LOGO_SETTINGS'] = 'Настройки логотипа';
$lang['LOGO_EXPLAIN'] = 'Здесь вы можете задать путь к папке на вашем форуме к логотипу, логотип, который будет использоваться на форуме';
$lang['LOGO_PATH'] = 'Папка где находятся логотипы';
$lang['LOGO_PATH_EXPLAIN'] = 'Путь к корневой папке, например. images/logo';
$lang['LOGO'] = 'Выберите логотип';
$lang['LOGO_DIMENSIONS'] = 'Размеры логотипа';
$lang['LOGO_DIMENSIONS_EXPLAIN'] = '(высота х ширина в пикселях) ';
#-----[ OPEN ]------------------------------------------
admin/admin_board.php
#-----[ FIND ]------------------------------------------
$message = $lang['CONFIG_UPDATED'] . "<br /><br />" . sprintf($lang['CLICK_RETURN_CONFIG'], "<a href=\"" . append_sid("admin_board.php") . "\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"" . append_sid("index.php?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
#-----[ AFTER, ADD ]------------------------------------------
// Logo Selector MOD
// Get all images in the logo directory
$dir = @opendir(BB_ROOT . $new['logo_image_path']);
$count = 0;
while( $file = @readdir($dir) )
{
if( !@is_dir(phpbb_realpath(BB_ROOT . $new['logo_image_path'] . '/' . $file)) )
{
if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $file) )
{
$logo[$count] = $file;
$count++;
}
}
}
@closedir($dir);
// Logo ListBox
$logo_list = "";
for( $i = 0; $i < count($logo); $i++ )
{
if ($logo[$i] == $new['logo_image'])
$logo_list .= '<option value="' . $logo[$i] . '" selected="selected">' . $logo[$i] . '</option>';
else
$logo_list .= '<option value="' . $logo[$i] . '">' . $logo[$i] . '</option>';
}
$logo_image = $new['logo_image'];
$logo_width = $new['logo_image_w'];
$logo_height = $new['logo_image_h'];
#-----[ FIND ]------------------------------------------
'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
#-----[ AFTER, ADD ]------------------------------------------
// Logo Selector MOD
'LOGO_PATH' => $new['logo_image_path'],
'LOGO_IMAGE_DIR' => BB_ROOT . $new['logo_image_path'],
'LOGO_LIST' => $logo_list,
'LOGO_IMAGE' => ($logo_image) ? BB_ROOT . $bb_cfg['logo_image_path'] .'/' . $logo_image : '',
'LOGO_WIDTH' => $new['logo_image_w'],
'LOGO_HEIGHT' => $new['logo_image_h'],
// Logo Selector MOD
#-----[ OPEN ]------------------------------------------
includes/page_header.php
#-----[ FIND ]------------------------------------------
'U_GROUP_CP' => "groupcp.php",
#-----[ AFTER, ADD ]------------------------------------------
// Logo Selector MOD
'LOGO' => ($bb_cfg['logo_image']) ? $bb_cfg['logo_image_path'] .'/' . $bb_cfg['logo_image'] : '',
'LOGO_WIDTH' => $bb_cfg['logo_image_w'],
'LOGO_HEIGHT' => $bb_cfg['logo_image_h'],
// Logo Selector MOD
#
#-----[ OPEN ]------------------------------------------
#
templates/ваш стиль/admin/admin_board.tpl
#
#-----[ FIND ]------------------------------------------
#
<p>{L_CONFIG_EXPLAIN}</p>
#-----[ AFTER, ADD ]------------------------------------------
<script language="javascript" type="text/javascript">
<!--
function update_logo(newlogo)
{
document.logo_image.src = "{LOGO_IMAGE_DIR}/" + newlogo;
}
//-->
</script>
#-----[ FIND ]------------------------------------------
<tr>
<td><h4>{L_ENABLE_PRUNE}</h4></td>
<td>
<label><input type="radio" name="prune_enable" value="1" <!-- IF PRUNE_ENABLE -->checked="checked"<!-- ENDIF --> />{L_YES}</label>
<label><input type="radio" name="prune_enable" value="0" <!-- IF not PRUNE_ENABLE -->checked="checked"<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
#-----[ AFTER, ADD ]------------------------------------------
<tr>
<th class="thHead" colspan="2">{L_LOGO_SETTINGS}</th>
</tr>
<tr>
<td class="row2" colspan="2"><span class="gensmall">{L_LOGO_EXPLAIN}</span></td>
</tr>
<tr>
<td class="row1">{L_LOGO_PATH}<br /><span class="gensmall">{L_LOGO_PATH_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="20" maxlength="255" name="logo_image_path" value="{LOGO_PATH}" /></td>
</tr>
<tr>
<td class="row1">{L_LOGO_DIMENSIONS}<br /><span class="gensmall">{L_LOGO_DIMENSIONS_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="logo_image_h" value="{LOGO_HEIGHT}" /> x <input class="post" type="text" size="3" maxlength="4" name="logo_image_w" value="{LOGO_WIDTH}"></td>
</tr>
<tr>
<td class="row1">{L_LOGO}</td>
<td class="row2"><select name="logo_image" onchange="update_logo(this.options[selectedIndex].value);">{LOGO_LIST}</select> <img name="logo_image" src="{LOGO_IMAGE}" border="0" width="{LOGO_WIDTH}" height="{LOGO_HEIGHT}"/> </td>
</tr>
#-----[ OPEN ]------------------------------------------
templates/ваш стиль/page_header.tpl
#-----[ FIND ]------------------------------------------
<a href="{U_INDEX}"><img src="images/logo/logo.gif" alt="{SITENAME}" /></a>
#-----[ REPLACE WITH ]------------------------------------------
<a href="{U_INDEX}"><img src="{LOGO}" width="{LOGO_WIDTH}" height="{LOGO_HEIGHT}" border="0" alt="{L_HOME}" vspace="1" /></a>
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
Все готово!
Тестируем !!Пишем ... отвечаем как работает