From 6f9d59a4a6e6b793b1a7bfac2170bb48aa38122b Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sat, 21 Dec 2002 18:31:54 +0000 Subject: [PATCH] Yep, more fixes git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3221 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_forums.php | 2 +- phpBB/db/mssql.php | 60 +++++++++++------------ phpBB/docs/CHANGELOG.html | 5 +- phpBB/includes/functions.php | 2 +- phpBB/install/schemas/mssql_basic.sql | 2 +- phpBB/install/schemas/mssql_schema.sql | 8 +-- phpBB/install/schemas/mysql_basic.sql | 2 +- phpBB/install/schemas/postgres_basic.sql | 2 +- phpBB/install/update_to_204.php | 16 +++++- phpBB/install/upgrade.php | 8 +++ phpBB/language/lang_english/lang_main.php | 1 + 11 files changed, 67 insertions(+), 41 deletions(-) diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php index 4de5d75c75..3900b6ba7a 100644 --- a/phpBB/admin/admin_forums.php +++ b/phpBB/admin/admin_forums.php @@ -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 diff --git a/phpBB/db/mssql.php b/phpBB/db/mssql.php index 181990e0da..136067b804 100644 --- a/phpBB/db/mssql.php +++ b/phpBB/db/mssql.php @@ -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) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 772c882b80..c754ff3ac4 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -164,7 +164,10 @@ p,ul,td {font-size:10pt;}
  • Fixed duplicate group_id error during upgrade of users from phpBB 1.x
  • Fixed stripslashes() problem with the conversion of the config table from phpBB 1.x
  • Rejiggled validation code, may eliminate "Username disallowed" issues
  • -
  • +
  • Fixed differing initial "public" setting of forum permissions between different files
  • +
  • Added check for invalid (non-compliant) email addresses to upgrade script
  • +
  • Further redirect workarounds for broken servers, please direct further issues to the vendors
  • +
  • Added GMT + 13 to English lang_main, all translators are encouraged to do likewise
  • diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a10f9d4516..58718a75fe 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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 ''; + echo 'Redirect
    If your browser does not support meta redirection please click HERE to be redirected
    '; exit; } diff --git a/phpBB/install/schemas/mssql_basic.sql b/phpBB/install/schemas/mssql_basic.sql index 1a3de2b342..33c5ff704f 100644 --- a/phpBB/install/schemas/mssql_basic.sql +++ b/phpBB/install/schemas/mssql_basic.sql @@ -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 diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 224d0a5bf0..b909ed0d55 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -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 diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql index fd7ab1530a..6e6c16bf4e 100644 --- a/phpBB/install/schemas/mysql_basic.sql +++ b/phpBB/install/schemas/mysql_basic.sql @@ -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 diff --git a/phpBB/install/schemas/postgres_basic.sql b/phpBB/install/schemas/postgres_basic.sql index 16fecc5bed..5867d76515 100644 --- a/phpBB/install/schemas/postgres_basic.sql +++ b/phpBB/install/schemas/postgres_basic.sql @@ -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); diff --git a/phpBB/install/update_to_204.php b/phpBB/install/update_to_204.php index 22dae9825f..6ac3bedcc0 100644 --- a/phpBB/install/update_to_204.php +++ b/phpBB/install/update_to_204.php @@ -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': diff --git a/phpBB/install/upgrade.php b/phpBB/install/upgrade.php index d1b4ed1db3..a607fb7e99 100644 --- a/phpBB/install/upgrade.php +++ b/phpBB/install/upgrade.php @@ -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 " OK
    \n"; lock_tables(0); diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 3cc6ae9eaf..5c5f56cf42 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -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';