1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-20 07:42:09 +02:00

Merged forum nav for viewtopic/viewforum, fixed cache behavior with an empty icons table.

git-svn-id: file:///svn/phpbb/trunk@3359 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2003-01-22 20:16:18 +00:00
parent 2005fb7061
commit 4be10373b8
3 changed files with 17 additions and 100 deletions

View File

@ -19,7 +19,7 @@
*
***************************************************************************/
function set_config($config_name, $config_value)
function set_config($config_name, $config_value, $is_dynamic = TRUE)
{
global $db, $cache, $config;
@ -41,8 +41,11 @@ function set_config($config_name, $config_value)
}
$config[$config_name] = $config_value;
$cache->put('config', $config);
if (!$is_dynamic)
{
$cache->put('config', $config);
}
}
function get_userdata($user)
@ -100,7 +103,7 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl
// list if currently null, assign basic forum info to template
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template;
global $db, $user, $template, $phpEx, $SID;
// Get forum parents
$forum_parents = array();
@ -683,10 +686,9 @@ function obtain_word_list(&$censors)
$censors['replace'][] = $row['replacement'];
}
while ($row = $db->sql_fetchrow($result));
$cache->put('word_censors', $censors);
}
$db->sql_freeresult($result);
$cache->put('word_censors', $censors);
}
return true;
@ -697,7 +699,11 @@ function obtain_icons(&$icons)
{
global $db, $cache;
if (!($icons = $cache->get('icons')))
if ($cache->exists('icons'))
{
$icons = $cache->get('icons');
}
else
{
// Topic icons
$sql = "SELECT *

View File

@ -96,53 +96,8 @@ if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
}
// End of auth check
// Get forum parents
$forum_parents = array();
if ($forum_data['parent_id'] > 0)
{
if (empty($forum_data['forum_parents']))
{
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE left_id < ' . $forum_data['left_id'] . '
AND right_id > ' . $forum_data['right_id'] . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_parents[$row['forum_id']] = $row['forum_name'];
}
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_parents = '" . sql_escape(serialize($forum_parents)) . "'
WHERE parent_id = " . $forum_data['parent_id'];
$db->sql_query($sql);
}
else
{
$forum_parents = unserialize($forum_data['forum_parents']);
}
}
// Build navigation links
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $parent_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $parent_forum_id
));
}
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $forum_data['forum_name'],
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id
));
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => strip_tags($forum_data['forum_desc'])
));
generate_forum_nav($forum_data);
// Moderators
$forum_moderators = array();

View File

@ -130,11 +130,11 @@ $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.top
$order_sql";
$result = $db->sql_query($sql);
if (!extract($db->sql_fetchrow($result)))
if (!$topic_data = $db->sql_fetchrow($result))
{
trigger_error('Topic_post_not_exist');
}
extract($topic_data);
@ -335,52 +335,8 @@ if (sizeof($censors))
}
// Navigation links ... common to several scripts so we need
// to look at centralising this ... major issue is variable naming
// complicated particularly by viewtopic ...
if ($parent_id > 0)
{
if (empty($forum_parents))
{
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE left_id < ' . $left_id . '
AND right_id > ' . $right_id . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_parents[$row['forum_id']] = $row['forum_name'];
}
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_parents = '" . $db->sql_escape(serialize($forum_parents)) . "'
WHERE parent_id = " . $parent_id;
$db->sql_query($sql);
}
else
{
$forum_parents = unserialize($forum_parents);
}
}
// Build navigation links
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $parent_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $parent_forum_id
));
}
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $forum_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id
));
// Navigation links
generate_forum_nav($topic_data);
// Moderators