aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-04-06 14:03:20 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-04-06 14:03:20 +0000
commitba536c6270a1cd448e5a4add56686fd3fdc9d711 (patch)
tree936479ce8d398a82986f59cf172ed8563c4aefd1 /phpBB/includes
parent088c6e1c3eb8cc044c328dd0988da7a9862ef7d5 (diff)
downloadforums-ba536c6270a1cd448e5a4add56686fd3fdc9d711.tar
forums-ba536c6270a1cd448e5a4add56686fd3fdc9d711.tar.gz
forums-ba536c6270a1cd448e5a4add56686fd3fdc9d711.tar.bz2
forums-ba536c6270a1cd448e5a4add56686fd3fdc9d711.tar.xz
forums-ba536c6270a1cd448e5a4add56686fd3fdc9d711.zip
some fixes
git-svn-id: file:///svn/phpbb/trunk@7286 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_groups.php1
-rw-r--r--phpBB/includes/functions_display.php14
-rw-r--r--phpBB/includes/functions_template.php19
-rw-r--r--phpBB/includes/template.php60
-rw-r--r--phpBB/includes/ucp/ucp_groups.php1
5 files changed, 64 insertions, 31 deletions
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 128cea2cb9..cbf46a1dc1 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -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'] : '',
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 1ab6dda638..23e2cd4106 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -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'] . ': ';
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php
index 4e5b46c3f7..f37148658b 100644
--- a/phpBB/includes/functions_template.php
+++ b/phpBB/includes/functions_template.php
@@ -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);
+ }
}
/**
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 259874488d..3326852ee7 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -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_filename'] == $this->filename[$handle])
+ if ($row['template_mtime'] < filemtime($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename']))
{
- $compile->_tpl_load_file($handle);
+ 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']]);
+ }
}
- else
+
+ if ($row['template_filename'] == $this->filename[$handle])
{
- $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']]);
+ $this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
+ $compile->compile_write($handle, $this->compiled_code[$handle]);
}
- }
-
- 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))
+ else
{
- $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);
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 720d1f9467..5445d661b7 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -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'] : '',