Yep, more fixes

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3221 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-12-21 18:31:54 +00:00
parent 3a07d77b03
commit 6f9d59a4a6
11 changed files with 67 additions and 41 deletions

View file

@ -43,7 +43,7 @@ $forum_auth_ary = array(
"auth_reply" => AUTH_ALL,
"auth_edit" => AUTH_REG,
"auth_delete" => AUTH_REG,
"auth_sticky" => AUTH_REG,
"auth_sticky" => AUTH_MOD,
"auth_announce" => AUTH_MOD,
"auth_vote" => AUTH_REG,
"auth_pollcreate" => AUTH_REG

View file

@ -51,7 +51,7 @@ class sql_db
$this->server = $sqlserver;
$this->dbname = $database;
$this->db_connect_id = ( $this->persistency ) ? mssql_pconnect($this->server, $this->user, $this->password) : mssql_connect($this->server, $this->user, $this->password);
$this->db_connect_id = ( $this->persistency ) ? @mssql_pconnect($this->server, $this->user, $this->password) : @mssql_connect($this->server, $this->user, $this->password);
if( $this->db_connect_id && $this->dbname != "" )
{
@ -92,7 +92,7 @@ class sql_db
//
// Query method
//
function sql_query($query = "", $transaction = FALSE)
function sql_query($query = '', $transaction = FALSE)
{
//
// Remove any pre-existing queries
@ -100,13 +100,13 @@ class sql_db
unset($this->result);
unset($this->row);
if ( $query != "" )
if ( $query != '' )
{
$this->num_queries++;
if ( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
{
if ( !mssql_query("BEGIN TRANSACTION", $this->db_connect_id) )
if ( !@mssql_query('BEGIN TRANSACTION', $this->db_connect_id) )
{
return false;
}
@ -125,7 +125,7 @@ class sql_db
// returns something then there's a problem. This may well be a false assumption though
// ... needs checking under Windows itself.
//
if( preg_match("/^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$/s", $query, $limits) )
if( preg_match('#^SELECT(.*?)(LIMIT ([0-9]+)[, ]*([0-9]+)*)?$#s', $query, $limits) )
{
$query = $limits[1];
@ -134,10 +134,10 @@ class sql_db
$row_offset = ( $limits[4] ) ? $limits[3] : "";
$num_rows = ( $limits[4] ) ? $limits[4] : $limits[3];
$query = "TOP " . ( $row_offset + $num_rows ) . $query;
$query = 'TOP ' . ( $row_offset + $num_rows ) . $query;
}
$this->result = mssql_query("SELECT $query", $this->db_connect_id);
$this->result = @mssql_query("SELECT $query", $this->db_connect_id);
if( $this->result )
{
@ -145,20 +145,20 @@ class sql_db
if( $row_offset > 0 )
{
mssql_data_seek($this->result, $row_offset);
@mssql_data_seek($this->result, $row_offset);
}
}
}
else if( eregi("^INSERT ", $query) )
else if( preg_match('#^INSERT #i', $query) )
{
if( mssql_query($query, $this->db_connect_id) )
if( @mssql_query($query, $this->db_connect_id) )
{
$this->result = time() + microtime();
$result_id = mssql_query("SELECT @@IDENTITY AS id, @@ROWCOUNT as affected", $this->db_connect_id);
$result_id = @mssql_query('SELECT @@IDENTITY AS id, @@ROWCOUNT as affected', $this->db_connect_id);
if( $result_id )
{
if( $row = mssql_fetch_array($result_id) )
if( $row = @mssql_fetch_array($result_id) )
{
$this->next_id[$this->db_connect_id] = $row['id'];
$this->affected_rows[$this->db_connect_id] = $row['affected'];
@ -168,14 +168,14 @@ class sql_db
}
else
{
if( mssql_query($query, $this->db_connect_id) )
if( @mssql_query($query, $this->db_connect_id) )
{
$this->result = time() + microtime();
$result_id = mssql_query("SELECT @@ROWCOUNT as affected", $this->db_connect_id);
$result_id = @mssql_query('SELECT @@ROWCOUNT as affected', $this->db_connect_id);
if( $result_id )
{
if( $row = mssql_fetch_array($result_id) )
if( $row = @mssql_fetch_array($result_id) )
{
$this->affected_rows[$this->db_connect_id] = $row['affected'];
}
@ -187,7 +187,7 @@ class sql_db
{
if( $this->in_transaction )
{
mssql_query("ROLLBACK", $this->db_connect_id);
@mssql_query('ROLLBACK', $this->db_connect_id);
$this->in_transaction = FALSE;
}
@ -198,7 +198,7 @@ class sql_db
{
$this->in_transaction = FALSE;
if( !@mssql_query("COMMIT", $this->db_connect_id) )
if( !@mssql_query('COMMIT', $this->db_connect_id) )
{
@mssql_query("ROLLBACK", $this->db_connect_id);
return false;
@ -213,9 +213,9 @@ class sql_db
{
$this->in_transaction = FALSE;
if( !@mssql_query("COMMIT", $this->db_connect_id) )
if( !@mssql_query('COMMIT', $this->db_connect_id) )
{
@mssql_query("ROLLBACK", $this->db_connect_id);
@mssql_query('ROLLBACK', $this->db_connect_id);
return false;
}
}
@ -236,7 +236,7 @@ class sql_db
if( $query_id )
{
return ( !empty($this->limit_offset[$query_id]) ) ? mssql_num_rows($query_id) - $this->limit_offset[$query_id] : @mssql_num_rows($query_id);
return ( !empty($this->limit_offset[$query_id]) ) ? @mssql_num_rows($query_id) - $this->limit_offset[$query_id] : @mssql_num_rows($query_id);
}
else
{
@ -251,7 +251,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_num_fields($query_id) : false;
return ( $query_id ) ? @mssql_num_fields($query_id) : false;
}
function sql_fieldname($offset, $query_id = 0)
@ -261,7 +261,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_field_name($query_id, $offset) : false;
return ( $query_id ) ? @mssql_field_name($query_id, $offset) : false;
}
function sql_fieldtype($offset, $query_id = 0)
@ -271,7 +271,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_field_type($query_id, $offset) : false;
return ( $query_id ) ? @mssql_field_type($query_id, $offset) : false;
}
function sql_fetchrow($query_id = 0)
@ -285,7 +285,7 @@ class sql_db
{
empty($row);
$row = mssql_fetch_array($query_id);
$row = @mssql_fetch_array($query_id);
while( list($key, $value) = @each($row) )
{
@ -313,7 +313,7 @@ class sql_db
$i = 0;
empty($rowset);
while( $row = mssql_fetch_array($query_id))
while( $row = @mssql_fetch_array($query_id))
{
while( list($key, $value) = @each($row) )
{
@ -344,18 +344,18 @@ class sql_db
{
if( $this->limit_offset[$query_id] > 0 )
{
$result = ( !empty($this->limit_offset[$query_id]) ) ? mssql_result($this->result, ($this->limit_offset[$query_id] + $row), $field) : false;
$result = ( !empty($this->limit_offset[$query_id]) ) ? @mssql_result($this->result, ($this->limit_offset[$query_id] + $row), $field) : false;
}
else
{
$result = mssql_result($this->result, $row, $field);
$result = @mssql_result($this->result, $row, $field);
}
}
else
{
if( empty($this->row[$query_id]) )
{
$this->row[$query_id] = mssql_fetch_array($query_id);
$this->row[$query_id] = @mssql_fetch_array($query_id);
$result = stripslashes($this->row[$query_id][$field]);
}
}
@ -377,7 +377,7 @@ class sql_db
if( $query_id )
{
return ( !empty($this->limit_offset[$query_id]) ) ? mssql_data_seek($query_id, ($this->limit_offset[$query_id] + $rownum)) : mssql_data_seek($query_id, $rownum);
return ( !empty($this->limit_offset[$query_id]) ) ? @mssql_data_seek($query_id, ($this->limit_offset[$query_id] + $rownum)) : @mssql_data_seek($query_id, $rownum);
}
else
{
@ -402,7 +402,7 @@ class sql_db
$query_id = $this->result;
}
return ( $query_id ) ? mssql_free_result($query_id) : false;
return ( $query_id ) ? @mssql_free_result($query_id) : false;
}
function sql_error($query_id = 0)

View file

@ -164,7 +164,10 @@ p,ul,td {font-size:10pt;}
<li>Fixed duplicate group_id error during upgrade of users from phpBB 1.x</li>
<li>Fixed stripslashes() problem with the conversion of the config table from phpBB 1.x</li>
<li>Rejiggled validation code, may eliminate "Username disallowed" issues</li>
<li></li>
<li>Fixed differing initial "public" setting of forum permissions between different files</li>
<li>Added check for invalid (non-compliant) email addresses to upgrade script</li>
<li>Further redirect workarounds for broken servers, please direct further issues to the vendors</li>
<li>Added GMT + 13 to English lang_main, all translators are encouraged to do likewise</li>
<li></li>
</ul>

View file

@ -705,7 +705,7 @@ function redirect($url)
if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
{
header('Refresh: 0; URL=' . $server_protocol . $server_name . $script_name . $server_port . $url);
echo '<html><meta http-equiv="refresh" content="0; url=' . $server_protocol . $server_name . $script_name . $server_port . $url . '"></html>';
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $server_protocol . $server_name . $script_name . $server_port . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $server_protocol . $server_name . $script_name . $server_port . $url . '">HERE</a> to be redirected</div></body></html>';
exit;
}

View file

@ -82,7 +82,7 @@ SET IDENTITY_INSERT phpbb_categories OFF;
/*
-- Forums
*/
INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 1, 'Test Forum 1', 'This is just a test forum, nothing special here.', '', 1, 1, 1, 1, '', 1, '', '', '', '', 1, 1, 3, 1, 1, 1, 3);
INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 1, 'Test Forum 1', 'This is just a test forum, nothing special here.', '', 1, 1, 1, 1, '', 1, '', '', '', '', 1, 1, 3, 3, 1, 1, 3);
/*
-- Users

View file

@ -554,10 +554,10 @@ ALTER TABLE [phpbb_forums] WITH NOCHECK ADD
GO
ALTER TABLE [phpbb_posts] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_posts_enable_bbcode] DEFAULT (1) FOR [enable_bbcode]
CONSTRAINT [DF_phpbb_posts_enable_html] DEFAULT (0) FOR [enable_html]
CONSTRAINT [DF_phpbb_posts_enable_smilies] DEFAULT (1) FOR [enable_smilies]
CONSTRAINT [DF_phpbb_posts_enable_sig] DEFAULT (1) FOR [enable_sig]
CONSTRAINT [DF_phpbb_posts_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
CONSTRAINT [DF_phpbb_posts_enable_html] DEFAULT (0) FOR [enable_html],
CONSTRAINT [DF_phpbb_posts_enable_smilies] DEFAULT (1) FOR [enable_smilies],
CONSTRAINT [DF_phpbb_posts_enable_sig] DEFAULT (1) FOR [enable_sig],
CONSTRAINT [DF_phpbb_posts_post_edit_count] DEFAULT (0) FOR [post_edit_count]
GO

View file

@ -68,7 +68,7 @@ INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test cat
# -- Forums
INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3);
INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1, 3);
# -- Users

View file

@ -68,7 +68,7 @@ INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test cat
-- Forums
INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3);
INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1, 3);
-- Users
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);

View file

@ -817,7 +817,21 @@ switch ($row['config_value'])
}
$db->sql_freeresult($result);
// Optimize/vacuum analyze the tables where appropriate
// Reset any email addresses which are non-compliant ... something
// not done in the upgrade script and thus which may affect some
// mysql users
switch (SQL_LAYER)
{
case 'mysql':
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9\-_]+\.[a-zA-Z]{2,}$'";
_sql($sql, $errored, $error_ary);
}
// Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
// the version number update
switch (SQL_LAYER)
{
case 'mysql':

View file

@ -936,6 +936,14 @@ if ( !empty($next) )
}
}
// Set any non-standard (like) email addresses to nothing
// could do this above as a preg_ but this one query may
// be faster
$sql = "UPDATE " . USERS_TABLE . "
SET user_email = ''
WHERE user_email NOT REGEXP '^[a-zA-Z0-9_\+\.\-]+@.*[a-zA-Z0-9\-_]+\.[a-zA-Z]{2,}$'";
query($sql, "Couldn't update ".USERS_TABLE." table non-standard user_email entries");
print " <span class=\"ok\"><b>OK</b></span><br />\n";
lock_tables(0);

View file

@ -952,6 +952,7 @@ $lang['tz']['9.5'] = 'GMT + 9.5 Hours';
$lang['tz']['10'] = 'GMT + 10 Hours';
$lang['tz']['11'] = 'GMT + 11 Hours';
$lang['tz']['12'] = 'GMT + 12 Hours';
$lang['tz']['13'] = 'GMT + 13 Hours';
$lang['datetime']['Sunday'] = 'Sunday';
$lang['datetime']['Monday'] = 'Monday';