aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2002-10-09 19:50:48 +0000
committerLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2002-10-09 19:50:48 +0000
commit369189806bf4bf85fe0409e6f66919ab4f4b70cd (patch)
tree988680c7700c818b42e2170a9d7d887efa3c812b /phpBB/includes
parentac4b54ff4dea78aaeec015685b1c02a66449f1f1 (diff)
downloadforums-369189806bf4bf85fe0409e6f66919ab4f4b70cd.tar
forums-369189806bf4bf85fe0409e6f66919ab4f4b70cd.tar.gz
forums-369189806bf4bf85fe0409e6f66919ab4f4b70cd.tar.bz2
forums-369189806bf4bf85fe0409e6f66919ab4f4b70cd.tar.xz
forums-369189806bf4bf85fe0409e6f66919ab4f4b70cd.zip
Added the redirect() function for nice and clean redirection.
git-svn-id: file:///svn/phpbb/trunk@2948 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/forums_display.php14
-rw-r--r--phpBB/includes/functions.php42
-rw-r--r--phpBB/includes/session.php12
3 files changed, 34 insertions, 34 deletions
diff --git a/phpBB/includes/forums_display.php b/phpBB/includes/forums_display.php
index e9e7a2ac45..e71746bcb7 100644
--- a/phpBB/includes/forums_display.php
+++ b/phpBB/includes/forums_display.php
@@ -111,7 +111,19 @@ foreach ($forum_rows as $row)
if (isset($subforums[$forum_id]))
{
- $subforums_list = format_subforums_list($subforums[$forum_id]);
+ foreach ($subforums as $row)
+ {
+ $alist[$row['forum_id']] = $row['forum_name'];
+ }
+ asort($alist);
+
+ $links = array();
+ foreach ($alist as $forum_id => $forum_name)
+ {
+ $links[] = '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">' . htmlspecialchars($forum_name) . '</a>';
+ }
+ $subforums_list = implode(', ', $links);
+
$l_subforums = (count($subforums[$forum_id]) == 1) ? $lang['Subforum'] . ': ' : $lang['Subforums'] . ': ';
}
else
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index b45eced074..dda7a3c393 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -70,7 +70,7 @@ function get_db_stat($mode)
function sql_quote($msg)
{
- return str_replace('\'', '\'\'', $msg);
+ return str_replace("'", "''", $msg);
}
function get_userdata($user)
@@ -403,9 +403,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
{
if ( $_GET['unwatch'] == $mode )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . "login.$phpEx$SID&redirect=view$mode.$phpEx&" . $u_url . "=$match_id&unwatch=forum");
- exit;
+ redirect("login.$phpEx$SID&redirect=view$mode.$phpEx&" . $u_url . "=$match_id&unwatch=forum");
}
}
else
@@ -527,29 +525,6 @@ function on_page($num_items, $per_page, $start)
return sprintf($lang['Page_of'], floor( $start / $per_page ) + 1, max(ceil( $num_items / $per_page ), 1) );
}
-function format_subforums_list($subforums)
-{
- if (empty($subforums))
- {
- return '';
- }
-
- global $phpEx, $SID;
- foreach ($subforums as $row)
- {
- $alist[$row['forum_id']] = $row['forum_name'];
- }
- asort($alist);
-
- $links = array();
- foreach ($alist as $forum_id => $forum_name)
- {
- $links[] = '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">' . htmlspecialchars($forum_name) . '</a>';
- }
-
- return implode(', ', $links);
-}
-
// Obtain list of naughty words and build preg style replacement arrays for use by the
// calling script, note that the vars are passed as references this just makes it easier
// to return both sets of arrays
@@ -575,6 +550,19 @@ function obtain_word_list(&$orig_word, &$replacement_word)
}
//
+// Redirects the user to another page then exits the script nicely
+//
+function redirect($location)
+{
+ global $db;
+ $db->sql_close();
+
+ $header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
+ header($header_location . $location);
+ exit;
+}
+
+//
// This is general replacement for die(), allows templated output in users (or default)
// language, etc. $msg_code can be one of these constants:
//
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index ed2bc840a8..0dd9ebd8e1 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -442,9 +442,9 @@ class auth
{
global $db;
- if ( !($this->founder = $userdata['user_founder']) )
+ if (!$this->founder = $userdata['user_founder'])
{
- $in_sql = '\'a_\', \'f_list\'';
+ $in_sql = "'a_', 'f_list'";
if ( $options )
{
@@ -452,7 +452,7 @@ class auth
{
foreach ( $options as $option )
{
- $in_sql .= ', \'' . $option . '\'';
+ $in_sql .= ", '$option'";
}
}
else
@@ -468,8 +468,8 @@ class auth
// The possible alternative here is to store the options in a file
// (perhaps with the other config data) and do away with this query.
- $sql = "SELECT auth_option_id, auth_value
- FROM " . ACL_OPTIONS_TABLE . "
+ $sql = 'SELECT auth_option_id, auth_value
+ FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_value IN ($in_sql) $or_sql";
$result = $db->sql_query($sql);
@@ -527,7 +527,7 @@ class auth
}
*/
}
-
+$this->acl_cache($userdata);
return;
}