diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-10-28 20:38:53 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-10-28 20:38:53 +0000 |
commit | c581ae15c2c19afb92ffc4403df35a68fbab258a (patch) | |
tree | e09813e56a252c6ef44d7ca82b900691c479fac4 | |
parent | 98f17b0f75d8561c0be180d5e9c2f9b3c166e2a6 (diff) | |
download | forums-c581ae15c2c19afb92ffc4403df35a68fbab258a.tar forums-c581ae15c2c19afb92ffc4403df35a68fbab258a.tar.gz forums-c581ae15c2c19afb92ffc4403df35a68fbab258a.tar.bz2 forums-c581ae15c2c19afb92ffc4403df35a68fbab258a.tar.xz forums-c581ae15c2c19afb92ffc4403df35a68fbab258a.zip |
sql_quote fixed
git-svn-id: file:///svn/phpbb/trunk@2980 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/includes/functions.php | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9e101ae43b..5a38c4f9e7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -21,7 +21,7 @@ function sql_quote($msg) { - return str_replace("'", "''", $msg); + return str_replace("\'", "''", $msg); } function get_userdata($user) @@ -75,6 +75,81 @@ function get_forum_branch($forum_id, $type='all', $order='descending', $include_ return $rows; } +function forum_nav_links(&$forum_id, &$forum_name) +{ + global $SID, $template, $phpEx, $auth; + + $type = 'parent'; + $forum_rows = array(); + + if (!($forum_branch = get_forum_branch($forum_id))) + { + trigger_error($user->lang['Forum_not_exist']); + } + + $s_has_subforums = FALSE; + foreach ($forum_branch as $row) + { + if ($type == 'parent') + { + $link = ($row['forum_status'] == ITEM_CATEGORY) ? 'index.' . $phpEx . $SID . '&c=' . $row['forum_id'] : 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id']; + + $template->assign_block_vars('navlinks', array( + 'FORUM_NAME' => $row['forum_name'], + 'U_VIEW_FORUM' => $link + )); + + if ($row['forum_id'] == $forum_id) + { + $branch_root_id = 0; + $forum_data = $row; + $type = 'child'; + + $forum_name = $row['forum_name']; + } + } + else + { + if ($row['parent_id'] == $forum_data['forum_id']) + { + // Root-level forum + $forum_rows[] = $row; + $parent_id = $row['forum_id']; + + if ($row['forum_status'] == ITEM_CATEGORY) + { + $branch_root_id = $row['forum_id']; + } + else + { + $s_has_subforums = TRUE; + } + } + elseif ($row['parent_id'] == $branch_root_id) + { + // Forum directly under a category + $forum_rows[] = $row; + $parent_id = $row['forum_id']; + + if ($row['forum_status'] != ITEM_CATEGORY) + { + $s_has_subforums = TRUE; + } + } + elseif ($row['forum_status'] != ITEM_CATEGORY) + { + // Subforum + if ($auth->acl_get('f_list', $row['forum_id'])) + { + $subforums[$parent_id][] = $row; + } + } + } + } + + return $s_has_subforums; +} + // Obtain list of moderators of each forum // First users, then groups ... broken into two queries // We could cache this ... certainly into a DB table. Would |