1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +02:00

some fixes

git-svn-id: file:///svn/phpbb/trunk@7286 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-04-06 14:03:20 +00:00
parent 088c6e1c3e
commit ba536c6270
11 changed files with 75 additions and 40 deletions

View File

@@ -558,6 +558,7 @@ class acp_groups
'S_RANK_OPTIONS' => $rank_options,
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == USER_FOUNDER) ? false : 0)),
'AVATAR' => $avatar_img,
'AVATAR_IMAGE' => $avatar_img,
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',

View File

@@ -287,24 +287,26 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
{
foreach ($subforums[$forum_id] as $subforum_id => $subforum_row)
{
// Update unread information if needed
if (!$forum_unread)
{
$forum_unread = (isset($forum_tracking_info[$subforum_id]) && $subforum_row['orig_forum_last_post_time'] > $forum_tracking_info[$subforum_id]) ? true : false;
}
$subforum_unread = (isset($forum_tracking_info[$subforum_id]) && $subforum_row['orig_forum_last_post_time'] > $forum_tracking_info[$subforum_id]) ? true : false;
if ($subforum_row['display'] && $subforum_row['name'])
{
$subforums_list[] = array(
'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id),
'name' => $subforum_row['name'],
'unread' => $forum_unread,
'unread' => $subforum_unread,
);
}
else
{
unset($subforums[$forum_id][$subforum_id]);
}
// If one subforum is unread the forum gets unread too...
if ($subforum_unread)
{
$forum_unread = true;
}
}
$l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';

View File

@@ -54,7 +54,7 @@ class template_compile
* Load template source from file
* @access private
*/
function _tpl_load_file($handle)
function _tpl_load_file($handle, $store_in_db = false)
{
// Try and open template for read
if (!file_exists($this->template->files[$handle]))
@@ -66,6 +66,23 @@ class template_compile
// Actually compile the code now.
$this->compile_write($handle, $this->template->compiled_code[$handle]);
// Store in database if required...
if ($store_in_db)
{
global $db, $user;
$sql_ary = array(
'template_id' => $user->theme['template_id'],
'template_filename' => $this->template->filename[$handle],
'template_included' => '',
'template_mtime' => time(),
'template_data' => trim(@file_get_contents($this->template->files[$handle])),
);
$sql = 'INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
}
}
/**

View File

@@ -222,44 +222,56 @@ class template
if (isset($user->theme['template_storedb']) && $user->theme['template_storedb'])
{
$sql = 'SELECT * FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
$sql = 'SELECT *
FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
WHERE template_id = ' . $user->theme['template_id'] . "
AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "'
OR template_included LIKE '%" . $db->sql_escape($this->filename[$handle]) . ":%')";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
while ($row = $db->sql_fetchrow($result))
if ($row)
{
if ($row['template_mtime'] < filemtime($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename']))
do
{
if ($row['template_mtime'] < filemtime($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename']))
{
if ($row['template_filename'] == $this->filename[$handle])
{
$compile->_tpl_load_file($handle);
}
else
{
$this->files[$row['template_filename']] = $this->root . '/' . $row['template_filename'];
$compile->_tpl_load_file($row['template_filename']);
unset($this->compiled_code[$row['template_filename']]);
unset($this->files[$row['template_filename']]);
}
}
if ($row['template_filename'] == $this->filename[$handle])
{
$compile->_tpl_load_file($handle);
$this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
$compile->compile_write($handle, $this->compiled_code[$handle]);
}
else
{
$this->files[$row['template_filename']] = $this->root . '/' . $row['template_filename'];
$compile->_tpl_load_file($row['template_filename']);
unset($this->compiled_code[$row['template_filename']]);
unset($this->files[$row['template_filename']]);
}
}
if ($row['template_filename'] == $this->filename[$handle])
{
$this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
$compile->compile_write($handle, $this->compiled_code[$handle]);
}
else
{
// Only bother compiling if it doesn't already exist
if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx))
{
$this->filename[$row['template_filename']] = $row['template_filename'];
$compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data'])));
unset($this->filename[$row['template_filename']]);
// Only bother compiling if it doesn't already exist
if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx))
{
$this->filename[$row['template_filename']] = $row['template_filename'];
$compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data'])));
unset($this->filename[$row['template_filename']]);
}
}
}
while ($row = $db->sql_fetchrow($result));
}
else
{
// Try to load from filesystem and instruct to insert into the styles table...
$compile->_tpl_load_file($handle, true);
return false;
}
$db->sql_freeresult($result);

View File

@@ -679,6 +679,7 @@ class ucp_groups
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
'S_RANK_OPTIONS' => $rank_options,
'AVATAR' => $avatar_img,
'AVATAR_IMAGE' => $avatar_img,
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',