mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
r507
Добавление поддержки мульти-шаблонности. SQL: ALTER TABLE `bb_users` ADD `tpl_name` varchar(255) NOT NULL DEFAULT 'default'; git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@507 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
a495218f78
commit
1cf81be17f
7 changed files with 72 additions and 9 deletions
|
@ -1459,6 +1459,7 @@ CREATE TABLE IF NOT EXISTS `bb_users` (
|
|||
`autologin_id` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`user_newest_pm_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||
`user_points` float(16,2) NOT NULL DEFAULT '0.00',
|
||||
`tpl_name` varchar(255) NOT NULL DEFAULT 'default',
|
||||
PRIMARY KEY (`user_id`),
|
||||
KEY `username` (`username`(10)),
|
||||
KEY `user_email` (`user_email`(10)),
|
||||
|
@ -1469,9 +1470,9 @@ CREATE TABLE IF NOT EXISTS `bb_users` (
|
|||
-- Дамп данных таблицы `bb_users`
|
||||
--
|
||||
|
||||
INSERT INTO `bb_users` VALUES (-1, 0, 'Anonymous', 'd41d8cd98f00b204e9800998ecf8427e', 0, 0, '0', 0, '0', 0, 5, 0.00, '', 0, 0, 0, 0, 0, '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', '', '', 0, '', 0, 0);
|
||||
INSERT INTO `bb_users` VALUES (2, 1, 'admin', 'c3284d0f94606de1fd2af172aba15bf3', 0, 0, '0', 0, '0', 1, 1, 4.00, '', 0, 0, 0, 304, 1, '', 1, 0, 0, 0, 'admin@admin.com', '', '', '', '', '', '', '', '', '', 0, '', 0, 0);
|
||||
INSERT INTO `bb_users` VALUES (-746, 0, 'bot', 'd41d8cd98f00b204e9800998ecf8427e', 0, 0, '0', 0, '0', 0, 0, 0.00, '', 0, 0, 0, 144, 0, 'bot.gif', 1, 0, 0, 0, 'bot@bot.bot', '', '', '', '', '', '', '', '', '', 0, '', 0, 0);
|
||||
INSERT INTO `bb_users` VALUES (-1, 0, 'Anonymous', 'd41d8cd98f00b204e9800998ecf8427e', 0, 0, '0', 0, '0', 0, 5, 0.00, '', 0, 0, 0, 0, 0, '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', '', '', 0, '', 0, 0, 'default');
|
||||
INSERT INTO `bb_users` VALUES (2, 1, 'admin', 'c3284d0f94606de1fd2af172aba15bf3', 0, 0, '0', 0, '0', 1, 1, 4.00, '', 0, 0, 0, 304, 1, '', 1, 0, 0, 0, 'admin@admin.com', '', '', '', '', '', '', '', '', '', 0, '', 0, 0, 'default');
|
||||
INSERT INTO `bb_users` VALUES (-746, 0, 'bot', 'd41d8cd98f00b204e9800998ecf8427e', 0, 0, '0', 0, '0', 0, 0, 0.00, '', 0, 0, 0, 144, 0, 'bot.gif', 1, 0, 0, 0, 'bot@bot.bot', '', '', '', '', '', '', '', '', '', 0, '', 0, 0, 'default');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
|||
|
||||
// Increase number of revision after update
|
||||
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
||||
$bb_cfg['tp_release_date'] = '23-06-2013';
|
||||
$bb_cfg['tp_release_state'] = 'R506';
|
||||
$bb_cfg['tp_release_date'] = '28-06-2013';
|
||||
$bb_cfg['tp_release_state'] = 'R507';
|
||||
|
||||
// Database
|
||||
$charset = 'utf8';
|
||||
|
@ -261,7 +261,11 @@ else
|
|||
// Templates
|
||||
define('ADMIN_TPL_DIR', TEMPLATES_DIR .'/admin/');
|
||||
|
||||
$bb_cfg['tpl_name'] = 'default';
|
||||
// Template 1 (template 2 is $bb_cfg['templates'][1], template 3 is $bb_cfg['templates'][2]...)
|
||||
$bb_cfg['templates'][0]['dirname'] = 'default';
|
||||
$bb_cfg['templates'][0]['title'] = 'Стандартный';
|
||||
|
||||
$bb_cfg['tpl_name'] = $bb_cfg['templates'][0]['dirname'];
|
||||
$bb_cfg['stylesheet'] = 'main.css';
|
||||
|
||||
$bb_cfg['show_sidebar1_on_every_page'] = false;
|
||||
|
|
|
@ -1547,12 +1547,23 @@ function get_forum_select ($mode = 'guest', $name = POST_FORUM_URL, $selected =
|
|||
|
||||
function setup_style ()
|
||||
{
|
||||
global $bb_cfg, $template;
|
||||
global $bb_cfg, $template, $userdata;
|
||||
|
||||
// AdminCP works only with default template
|
||||
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']);
|
||||
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']);
|
||||
|
||||
if (!empty($userdata['tpl_name']))
|
||||
{
|
||||
foreach ($bb_cfg['templates'] as $temptemplate)
|
||||
{
|
||||
if ($userdata['tpl_name'] == $temptemplate['dirname'])
|
||||
{
|
||||
$tpl_dir_name = basename($userdata['tpl_name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template = new Template(TEMPLATES_DIR . $tpl_dir_name);
|
||||
$css_dir = basename(TEMPLATES_DIR) ."/$tpl_dir_name/css/";
|
||||
|
||||
|
@ -1572,6 +1583,21 @@ function setup_style ()
|
|||
return $theme;
|
||||
}
|
||||
|
||||
function templates_select($default, $select_name = 'tpl_name')
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$templates_select = '<select name="'. $select_name .'">';
|
||||
foreach ($bb_cfg['templates'] as $template)
|
||||
{
|
||||
$selected = '';
|
||||
if ($template['dirname'] == $default) $selected = ' selected="selected"';
|
||||
$templates_select .= '<option value="'. $template['dirname'] .'"'. $selected .'>'. $template['title'] .'</option>';
|
||||
}
|
||||
$templates_select .= '</select> ';
|
||||
return $templates_select;
|
||||
}
|
||||
|
||||
// Create date/time from format and timezone
|
||||
function bb_date ($gmepoch, $format = false, $tz = null)
|
||||
{
|
||||
|
|
|
@ -124,6 +124,7 @@ switch ($mode)
|
|||
'user_occ' => true,
|
||||
'user_interests' => true,
|
||||
'user_avatar_type' => true,
|
||||
'tpl_name' => true,
|
||||
);
|
||||
|
||||
// Выбор профиля: для юзера свой, для админа любой
|
||||
|
@ -720,6 +721,25 @@ foreach ($profile_fields as $field => $can_edit)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'tpl_name':
|
||||
$templates = isset($_POST['tpl_name']) ? (string) $_POST['tpl_name'] : $pr_data['tpl_name'];
|
||||
$templates = htmlCHR($templates);
|
||||
if ($submit && $templates != $pr_data['tpl_name'])
|
||||
{
|
||||
$pr_data['tpl_name'] = $bb_cfg['tpl_name'];
|
||||
$db_data['tpl_name'] = (string) $bb_cfg['tpl_name'];
|
||||
foreach ($bb_cfg['templates'] as $temptemplate)
|
||||
{
|
||||
if ($templates == $temptemplate['dirname'])
|
||||
{
|
||||
$pr_data['tpl_name'] = $templates;
|
||||
$db_data['tpl_name'] = (string) $templates;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tp_data['TEMPLATES_SELECT'] = templates_select($pr_data['tpl_name'], 'tpl_name');
|
||||
break;
|
||||
|
||||
/**
|
||||
* default
|
||||
*/
|
||||
|
|
|
@ -1759,4 +1759,6 @@ $lang['PROFILE_EDIT_RETURN'] = 'Return to editing';
|
|||
$lang['PROFILE_RETURN'] = 'Go to the Profile';
|
||||
|
||||
$lang['WARNING'] = 'Warning';
|
||||
$lang['INDEXER'] = "Reindex search";
|
||||
$lang['INDEXER'] = "Reindex search";
|
||||
|
||||
$lang['FORUM_STYLE'] = 'Forum style';
|
||||
|
|
|
@ -1770,4 +1770,6 @@ $lang['PROFILE_EDIT_RETURN'] = 'Вернуться к редактировани
|
|||
$lang['PROFILE_RETURN'] = 'Перейти к просмотру профиля';
|
||||
|
||||
$lang['WARNING'] = 'Предупреждение';
|
||||
$lang['INDEXER'] = "Переиндексировать поиск";
|
||||
$lang['INDEXER'] = "Переиндексировать поиск";
|
||||
|
||||
$lang['FORUM_STYLE'] = 'Стиль форума';
|
||||
|
|
|
@ -140,6 +140,14 @@ document.write('<input type="hidden" name="user_timezone" value="'+tz+'" />');
|
|||
<tr>
|
||||
<th colspan="2">{L_PREFERENCES}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{L_FORUM_STYLE}</td>
|
||||
<td>
|
||||
<div style="margin: 3px 0;">
|
||||
{TEMPLATES_SELECT}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- IF not SIG_DISALLOWED -->
|
||||
<tr colspan="2" id="view_message" class="hidden">
|
||||
<td colspan="2">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue