aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2004-03-20 17:06:21 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2004-03-20 17:06:21 +0000
commitfa36798694a55faa0210c3a5eca7dd41e92a2edc (patch)
treec228bde49a44270273531b609898b80ab9b52085
parentba7008b387d1972736c638444cb6273c3d9ebeab (diff)
downloadforums-fa36798694a55faa0210c3a5eca7dd41e92a2edc.tar
forums-fa36798694a55faa0210c3a5eca7dd41e92a2edc.tar.gz
forums-fa36798694a55faa0210c3a5eca7dd41e92a2edc.tar.bz2
forums-fa36798694a55faa0210c3a5eca7dd41e92a2edc.tar.xz
forums-fa36798694a55faa0210c3a5eca7dd41e92a2edc.zip
add a little bit more information for style authors
ease the jumpbox handling a little bit git-svn-id: file:///svn/phpbb/trunk@4870 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/functions.php86
-rw-r--r--phpBB/includes/functions_posting.php14
-rw-r--r--phpBB/posting.php3
-rw-r--r--phpBB/styles/subSilver/template/jumpbox.html21
-rw-r--r--phpBB/viewtopic.php12
5 files changed, 85 insertions, 51 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index fcb073a074..af1a0370fc 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -127,15 +127,23 @@ function generate_forum_nav(&$forum_data)
$forum_parents = get_forum_parents($forum_data);
// Build navigation links
- foreach ($forum_parents as $parent_forum_id => $parent_name)
+ foreach ($forum_parents as $parent_forum_id => $parent_data)
{
+ list($parent_name, $parent_type) = array_values($parent_data);
+
$template->assign_block_vars('navlinks', array(
+ 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false,
+ 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
+ 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$parent_forum_id")
);
}
$template->assign_block_vars('navlinks', array(
+ 'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
+ 'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
+ 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=" . $forum_data['forum_id'])
);
@@ -159,7 +167,7 @@ function get_forum_parents(&$forum_data)
{
if ($forum_data['forum_parents'] == '')
{
- $sql = 'SELECT forum_id, forum_name
+ $sql = 'SELECT forum_id, forum_name, forum_type
FROM ' . FORUMS_TABLE . '
WHERE left_id < ' . $forum_data['left_id'] . '
AND right_id > ' . $forum_data['right_id'] . '
@@ -168,7 +176,7 @@ function get_forum_parents(&$forum_data)
while ($row = $db->sql_fetchrow($result))
{
- $forum_parents[$row['forum_id']] = $row['forum_name'];
+ $forum_parents[$row['forum_id']] = array($row['forum_name'], (int) $row['forum_type']);
}
$db->sql_freeresult($result);
@@ -285,15 +293,16 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
return;
}
- $boxstring = '';
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
- $right = $cat_right = $padding_inc = 0;
- $padding = $forum_list = $holding = '';
- $padding_store = array('0' => '');
+ $right = $cat_right = $padding = 0;
+ $padding_store = array('0' => 0);
+ $display_jumpbox = false;
+ $iteration = 1;
+
while ($row = $db->sql_fetchrow($result))
{
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
@@ -307,10 +316,22 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
// if the user does not have permissions to list this forum skip
continue;
}
-
+
+ if (!$display_jumpbox)
+ {
+ $template->assign_block_vars('jumpbox_forums', array(
+ 'FORUM_ID' => ($select_all) ? 0 : -1,
+ 'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'],
+ 'S_FORUM_COUNT' => $iteration)
+ );
+
+ $iteration++;
+ $display_jumpbox = true;
+ }
+
if ($row['left_id'] < $right)
{
- $padding .= '&nbsp; &nbsp;';
+ $padding++;
$padding_store[$row['parent_id']] = $padding;
}
else if ($row['left_id'] > $right + 1)
@@ -320,35 +341,32 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
$right = $row['right_id'];
- $selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '';
-
- if ($row['left_id'] > $cat_right)
- {
- $holding = '';
- }
-
if ($row['right_id'] - $row['left_id'] > 1)
{
$cat_right = max($cat_right, $row['right_id']);
-
- $holding .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
}
- else
+
+ $template->assign_block_vars('jumpbox_forums', array(
+ 'FORUM_ID' => $row['forum_id'],
+ 'FORUM_NAME' => $row['forum_name'],
+ 'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '',
+ 'S_FORUM_COUNT' => $iteration,
+ 'S_IS_CAT' => ($row['forum_type'] == FORUM_CAT) ? true : false,
+ 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
+ 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false)
+ );
+
+ for ($i = 0; $i < $padding; $i++)
{
- $boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
- $holding = '';
+ $template->assign_block_vars('jumpbox_forums.level', array());
}
+ $iteration++;
}
$db->sql_freeresult($result);
unset($padding_store);
- if ($boxstring)
- {
- $boxstring = (($select_all) ? '<option value="0">' . $user->lang['ALL_FORUMS'] : '<option value="-1">' . $user->lang['SELECT_FORUM']) . '</option><option value="-1">-----------------</option>' . $boxstring;
- }
-
$template->assign_vars(array(
- 'S_JUMPBOX_OPTIONS' => $boxstring,
+ 'S_DISPLAY_JUMPBOX' => $display_jumpbox,
'S_JUMPBOX_ACTION' => $action)
);
@@ -1131,6 +1149,20 @@ function smilie_text($text, $force_option = false)
return ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $text);
}
+// Check if extension is allowed to be posted within forum X
+function extension_allowed($forum_id, $extension)
+{
+ global $extensions;
+
+ if (!isset($extensions) || !is_array($extensions))
+ {
+ $extensions = array();
+ obtain_attach_extensions($extensions);
+ }
+
+ return (is_array($extensions['_allowed_'][$extension]) && !in_array($forum_id, $extensions['_allowed_'][$extension])) || !isset($extensions['_allowed_'][$extension]);
+}
+
// Error and message handler, call with trigger_error if reqd
function msg_handler($errno, $msg_text, $errfile, $errline)
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index f43a28b9d3..e6158eb370 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -503,20 +503,6 @@ function create_thumbnail($source, $new_file, $mimetype)
return true;
}
-// Check if extension is allowed to be posted within forum X
-function extension_allowed($forum_id, $extension)
-{
- global $extensions;
-
- if (!isset($extensions) || !is_array($extensions))
- {
- $extensions = array();
- obtain_attach_extensions($extensions);
- }
-
- return (is_array($extensions['_allowed_'][$extension]) && !in_array($forum_id, $extensions['_allowed_'][$extension])) || !isset($extensions['_allowed_'][$extension]);
-}
-
//
// TODO
//
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 7be7c457de..10c3cf61ae 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1002,7 +1002,8 @@ $forum_data = array(
'forum_parents' => $forum_parents,
'forum_name' => $forum_name,
'forum_id' => $forum_id,
- 'forum_desc' => ''
+ 'forum_type' => $forum_type,
+ 'forum_desc' => $forum_desc
);
generate_forum_nav($forum_data);
diff --git a/phpBB/styles/subSilver/template/jumpbox.html b/phpBB/styles/subSilver/template/jumpbox.html
index 9858c7e69d..819b6dc506 100644
--- a/phpBB/styles/subSilver/template/jumpbox.html
+++ b/phpBB/styles/subSilver/template/jumpbox.html
@@ -1,8 +1,19 @@
-<!-- IF S_JUMPBOX_OPTIONS -->
-<form method="post" name="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(document.jumpbox.f.value == -1){return false;}"><table cellspacing="0" cellpadding="0" border="0">
+<!-- IF S_DISPLAY_JUMPBOX -->
+<form method="post" name="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(document.jumpbox.f.value == -1){return false;}">
+
+<table cellspacing="0" cellpadding="0" border="0">
<tr>
- <td nowrap="nowrap"><span class="gensmall">{L_JUMP_TO}:</span>&nbsp;<select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }">{S_JUMPBOX_OPTIONS}</select>&nbsp;<input class="btnlite" type="submit" value="{L_GO}" /></td>
+ <td nowrap="nowrap"><span class="gensmall">{L_JUMP_TO}:</span>&nbsp;<select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }">
+
+<!-- BEGIN jumpbox_forums -->
+ <!-- IF jumpbox_forums.S_FORUM_COUNT eq 2 --><option value="-1">------------------</option><!-- ENDIF -->
+ <option value="{jumpbox_forums.FORUM_ID}"{jumpbox_forums.SELECTED}><!-- BEGIN level -->&nbsp; &nbsp;<!-- END level -->{jumpbox_forums.FORUM_NAME}</option>
+<!-- END jumpbox_forums -->
+
+ </select>&nbsp;<input class="btnlite" type="submit" value="{L_GO}" /></td>
</tr>
-</table></form>
-<!-- ENDIF -->
+</table>
+
+</form>
+<!-- ENDIF --> \ No newline at end of file
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index cef6bd1a7e..9a899e75d5 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -162,7 +162,7 @@ if ($user->data['user_id'] != ANONYMOUS)
// whereupon we join on the forum_id passed as a parameter ... this
// is done so navigation, forum name, etc. remain consistent with where
// user clicked to view a global topic
-$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . '
+$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . '
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . "
WHERE $join_sql
AND (f.forum_id = t.forum_id
@@ -448,10 +448,10 @@ $topic_title = censor_text($topic_title);
// Send vars to template
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
- 'FORUM_NAME' => $forum_name,
+ 'FORUM_NAME' => $forum_name,
'FORUM_DESC' => $forum_desc,
- 'TOPIC_ID' => $topic_id,
- 'TOPIC_TITLE' => $topic_title,
+ 'TOPIC_ID' => $topic_id,
+ 'TOPIC_TITLE' => $topic_title,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start),
'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts),
@@ -1029,6 +1029,10 @@ if ($bbcode_bitfield)
$i_total = sizeof($rowset) - 1;
$prev_post_id = '';
+$template->assign_vars(array(
+ 'S_NUM_POSTS' => count($post_list))
+);
+
// Output the posts
//foreach ($rowset as $i => $row)
for ($i = 0; $i < count($post_list); ++$i)