aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-04-19 15:05:39 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-04-19 15:05:39 +0000
commit87b7ae578f3c8a72f847c3610bd1ef479569a3ff (patch)
tree18739861ecebc98552ba69a7e527d0c6ffd51ae0 /phpBB
parent4c05450291d939f0d6bf4ea3ba538719cf3b43ba (diff)
downloadforums-87b7ae578f3c8a72f847c3610bd1ef479569a3ff.tar
forums-87b7ae578f3c8a72f847c3610bd1ef479569a3ff.tar.gz
forums-87b7ae578f3c8a72f847c3610bd1ef479569a3ff.tar.bz2
forums-87b7ae578f3c8a72f847c3610bd1ef479569a3ff.tar.xz
forums-87b7ae578f3c8a72f847c3610bd1ef479569a3ff.zip
Removed need to send db as a parameter to functions
git-svn-id: file:///svn/phpbb/trunk@189 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/auth.php14
-rw-r--r--phpBB/includes/functions.php16
-rw-r--r--phpBB/includes/page_header.php6
-rw-r--r--phpBB/index.php8
-rw-r--r--phpBB/profile.php2
-rw-r--r--phpBB/viewonline.php6
6 files changed, 33 insertions, 19 deletions
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 3730cd5872..79ec6f04f2 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -31,9 +31,10 @@
* TRUE if the user authorized
* FALSE if the user is not
*/
-function auth($type, $db, $id = "", $user_ip = "")
+function auth($type, $id = "", $user_ip = "")
{
- global $userdata;
+ global $db, $userdata;
+
switch($type)
{
// Empty for the moment.
@@ -45,8 +46,10 @@ function auth($type, $db, $id = "", $user_ip = "")
* The following functions are used for getting user information. They are not related directly to auth()
*/
-function get_userdata_from_id($userid, $db)
+function get_userdata_from_id($userid)
{
+ global $db;
+
$sql = "SELECT * FROM ".USERS_TABLE." WHERE user_id = $userid";
if(!$result = $db->sql_query($sql))
{
@@ -65,7 +68,10 @@ function get_userdata_from_id($userid, $db)
}
}
-function get_userdata($username, $db) {
+function get_userdata($username) {
+
+ global $db;
+
$sql = "SELECT * FROM ".USERS_TABLE." WHERE username = '$username' AND user_level != ".DELETED;
if(!$result = $db->sql_query($sql))
{
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index e7b236f207..8bd31ba54e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -22,8 +22,10 @@
*
***************************************************************************/
-function get_db_stat($db, $mode)
+function get_db_stat($mode)
{
+ global $db;
+
switch($mode){
case 'postcount':
$sql = 'SELECT count(*) AS total FROM '.POSTS_TABLE;
@@ -73,8 +75,9 @@ function get_db_stat($db, $mode)
}
-function make_jumpbox($db)
+function make_jumpbox()
{
+ global $db;
global $l_jumpto, $l_noforums, $l_nocategories;
$sql = "SELECT c.*
@@ -157,8 +160,10 @@ function language_select($default, $name="language", $dirname="language/")
return $lang_select;
}
-function theme_select($default, $db)
+function theme_select($default)
{
+ global $db;
+
$sql = "SELECT theme_id, theme_name FROM ".THEMES_TABLE." ORDER BY theme_name";
if($result = $db->sql_query($sql))
{
@@ -337,8 +342,11 @@ function tz_select($default)
return($tz_select);
}
-function validate_username(&$username, $db)
+function validate_username(&$username)
{
+
+ global $db;
+
$username = trim($username);
$username = strip_tags($username);
$username = htmlspecialchars($username);
diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php
index be7e59cd7f..ae636d0e07 100644
--- a/phpBB/includes/page_header.php
+++ b/phpBB/includes/page_header.php
@@ -96,7 +96,7 @@ switch($pagetype)
"jumpbox" => "jumpbox.tpl",
"footer" => "viewforum_footer.tpl"));
- $jumpbox = make_jumpbox($db);
+ $jumpbox = make_jumpbox();
$template->assign_vars(array("JUMPBOX_LIST" => $jumpbox,
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
"SELECT_NAME" => POST_FORUM_URL));
@@ -114,7 +114,7 @@ switch($pagetype)
"body" => "viewtopic_body.tpl",
"jumpbox" => "jumpbox.tpl",
"footer" => "viewtopic_footer.tpl"));
- $jumpbox = make_jumpbox($db);
+ $jumpbox = make_jumpbox();
$template->assign_vars(array("JUMPBOX_LIST" => $jumpbox,
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
"SELECT_NAME" => POST_FORUM_URL));
@@ -134,7 +134,7 @@ switch($pagetype)
"body" => "viewonline_body.tpl",
"jumpbox" => "jumpbox.tpl",
"footer" => "viewonline_footer.tpl"));
- $jumpbox = make_jumpbox($db);
+ $jumpbox = make_jumpbox();
$template->assign_vars(array("TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"POST_USER_URL" => POST_USERS_URL,
diff --git a/phpBB/index.php b/phpBB/index.php
index 05cc109f3e..73d4ff59fb 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -37,12 +37,12 @@ init_userprefs($userdata);
//
//nl2br(var_dump($userdata));
-$total_posts = get_db_stat($db, 'postcount');
-$total_users = get_db_stat($db, 'usercount');
-$newest_userdata = get_db_stat($db, 'newestuser');
+$total_posts = get_db_stat('postcount');
+$total_users = get_db_stat('usercount');
+$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata["username"];
$newest_uid = $newest_userdata["user_id"];
-$users_browsing = get_db_stat($db, "usersonline") . " Users ";
+$users_browsing = get_db_stat("usersonline") . " Users ";
if(empty($viewcat))
{
diff --git a/phpBB/profile.php b/phpBB/profile.php
index c666118835..54b8d9141a 100644
--- a/phpBB/profile.php
+++ b/phpBB/profile.php
@@ -51,7 +51,7 @@ switch($mode)
error_die(GENERAL_ERROR, $l_nouserid);
}
}
- $profiledata = get_userdata_from_id($HTTP_GET_VARS[POST_USERS_URL], $db);
+ $profiledata = get_userdata_from_id($db, $HTTP_GET_VARS[POST_USERS_URL]);
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index 5f3eebab2e..6e4aedcd2c 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -36,9 +36,9 @@ init_userprefs($userdata);
// End session management
//
-$total_posts = get_db_stat($db, 'postcount');
-$total_users = get_db_stat($db, 'usercount');
-$newest_userdata = get_db_stat($db, 'newestuser');
+$total_posts = get_db_stat('postcount');
+$total_users = get_db_stat('usercount');
+$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata["username"];
$newest_uid = $newest_userdata["user_id"];