mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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:
parent
2005fb7061
commit
4be10373b8
3 changed files with 17 additions and 100 deletions
|
@ -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;
|
global $db, $cache, $config;
|
||||||
|
|
||||||
|
@ -41,8 +41,11 @@ function set_config($config_name, $config_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
$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)
|
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
|
// list if currently null, assign basic forum info to template
|
||||||
function generate_forum_nav(&$forum_data)
|
function generate_forum_nav(&$forum_data)
|
||||||
{
|
{
|
||||||
global $db, $user, $template;
|
global $db, $user, $template, $phpEx, $SID;
|
||||||
|
|
||||||
// Get forum parents
|
// Get forum parents
|
||||||
$forum_parents = array();
|
$forum_parents = array();
|
||||||
|
@ -683,10 +686,9 @@ function obtain_word_list(&$censors)
|
||||||
$censors['replace'][] = $row['replacement'];
|
$censors['replace'][] = $row['replacement'];
|
||||||
}
|
}
|
||||||
while ($row = $db->sql_fetchrow($result));
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
$cache->put('word_censors', $censors);
|
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
$cache->put('word_censors', $censors);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -697,7 +699,11 @@ function obtain_icons(&$icons)
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $db, $cache;
|
||||||
|
|
||||||
if (!($icons = $cache->get('icons')))
|
if ($cache->exists('icons'))
|
||||||
|
{
|
||||||
|
$icons = $cache->get('icons');
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Topic icons
|
// Topic icons
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
|
|
|
@ -96,53 +96,8 @@ if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
|
||||||
}
|
}
|
||||||
// End of auth check
|
// 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
|
// Build navigation links
|
||||||
foreach ($forum_parents as $parent_forum_id => $parent_name)
|
generate_forum_nav($forum_data);
|
||||||
{
|
|
||||||
$template->assign_block_vars('navlinks', array(
|
|
||||||
'FORUM_NAME' => $parent_name,
|
|
||||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $parent_forum_id
|
|
||||||
));
|
|
||||||
}
|
|
||||||
$template->assign_block_vars('navlinks', array(
|
|
||||||
'FORUM_NAME' => $forum_data['forum_name'],
|
|
||||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&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'])
|
|
||||||
));
|
|
||||||
|
|
||||||
// Moderators
|
// Moderators
|
||||||
$forum_moderators = array();
|
$forum_moderators = array();
|
||||||
|
|
|
@ -130,11 +130,11 @@ $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.top
|
||||||
$order_sql";
|
$order_sql";
|
||||||
$result = $db->sql_query($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');
|
trigger_error('Topic_post_not_exist');
|
||||||
}
|
}
|
||||||
|
extract($topic_data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,52 +335,8 @@ if (sizeof($censors))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Navigation links
|
||||||
// Navigation links ... common to several scripts so we need
|
generate_forum_nav($topic_data);
|
||||||
// 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 . '&f=' . $parent_forum_id
|
|
||||||
));
|
|
||||||
}
|
|
||||||
$template->assign_block_vars('navlinks', array(
|
|
||||||
'FORUM_NAME' => $forum_name,
|
|
||||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Moderators
|
// Moderators
|
||||||
|
|
Loading…
Add table
Reference in a new issue