aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/profile.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-05-26 21:40:58 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-05-26 21:40:58 +0000
commit81c26eef7ed8e73bbf6ef179e37582d43120e6f8 (patch)
tree81a998ea585ec167d09d95da87d23f87fab3dffd /phpBB/profile.php
parente1139ff198a31b4316ba6ef4c864a606920fb26a (diff)
downloadforums-81c26eef7ed8e73bbf6ef179e37582d43120e6f8.tar
forums-81c26eef7ed8e73bbf6ef179e37582d43120e6f8.tar.gz
forums-81c26eef7ed8e73bbf6ef179e37582d43120e6f8.tar.bz2
forums-81c26eef7ed8e73bbf6ef179e37582d43120e6f8.tar.xz
forums-81c26eef7ed8e73bbf6ef179e37582d43120e6f8.zip
Fixed a problem with newlines replacing breaks in sigs
git-svn-id: file:///svn/phpbb/trunk@333 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/profile.php')
-rw-r--r--phpBB/profile.php62
1 files changed, 49 insertions, 13 deletions
diff --git a/phpBB/profile.php b/phpBB/profile.php
index 273692b510..549fc841e9 100644
--- a/phpBB/profile.php
+++ b/phpBB/profile.php
@@ -42,18 +42,54 @@ function validate_username($username)
global $db;
- $sql = "SELECT u.username, d.disallow_username
- FROM ".USERS_TABLE." u, ".DISALLOW_TABLE." d
- WHERE LOWER(u.username) = '".strtolower($username)."'
- OR d.disallow_username = '$username'";
- if($result = $db->sql_query($sql))
+ switch(SQL_LAYER)
{
- if($db->sql_numrows($result) > 0)
- {
- return(FALSE);
- }
+ // Along with subqueries MySQL also lacks
+ // a UNION clause which would be very nice here :(
+ // So we have to use two queries
+ case 'mysql':
+ $sql_users = "SELECT username
+ FROM ".USERS_TABLE."
+ WHERE LOWER(u.username) = '".strtolower($username)."'";
+ $sql_disallow = "SELECT disallow_username
+ FROM ".DISALLOW_TABLE."
+ WHERE disallow_username = '$username'";
+
+ if($result = $db->sql_query($sql_users))
+ {
+ if($db->sql_numrows($result) > 0)
+ {
+ return(FALSE);
+ }
+ }
+ if($result = $db->sql_query($sql_disallow))
+ {
+ if($db->sql_numrows($result) > 0)
+ {
+ return(FALSE);
+ }
+ }
+ break;
+
+ default:
+ $sql = "SELECT disallow_username
+ FROM ".DISALLOW_TABLE."
+ WHERE disallow_username = '$username'
+ UNION
+ SELECT username
+ FROM ".USERS_TABLE."
+ WHERE LOWER(username) = '".strtolower($username)."'";
+
+ if($result = $db->sql_query($sql))
+ {
+ if($db->sql_numrows($result) > 0)
+ {
+ return(FALSE);
+ }
+ }
+ break;
}
-
+
return(TRUE);
}
function language_select($default, $dirname="language/")
@@ -116,7 +152,7 @@ function theme_select($default)
{
if(stripslashes($rowset[$i]['themes_name']) == $default || $rowset[$i]['themes_id'] == $default)
{
- $selected = " SELECTED";
+ $selected = " selected";
}
else
{
@@ -177,7 +213,7 @@ function tz_select($default)
{
if($offset == $default)
{
- $selected = " SELECTED";
+ $selected = " selected";
}
else
{
@@ -342,7 +378,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['location']))) : "";
$occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags(addslashes($HTTP_POST_VARS['occupation']))) : "";
$interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(addslashes($HTTP_POST_VARS['interests'])) : "";
- $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(addslashes(str_replace("\n", "<br />", $HTTP_POST_VARS['signature']))) : "";
+ echo $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(addslashes(str_replace("<br />", "\n", $HTTP_POST_VARS['signature']))) : "";
$viewemail = $HTTP_POST_VARS['viewemail'];
$attachsig = $HTTP_POST_VARS['attachsig'];