From ed318a39d630b3a145b4baaa51c1e63b9fb98b97 Mon Sep 17 00:00:00 2001
From: "Paul S. Owen"
Date: Tue, 10 Jun 2003 00:32:03 +0000
Subject: [PATCH] Add confirmation stuff here ... save time elsehwere ...
MSAccess note yet updated
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@4104 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/schemas/mssql_schema.sql | 23 +++++++++++++
phpBB/install/schemas/mysql_schema.sql | 11 +++---
phpBB/install/schemas/postgres_schema.sql | 17 +++++++--
phpBB/install/update_to_205.php | 40 ++++++++++++++++++++--
phpBB/language/lang_english/lang_admin.php | 3 ++
phpBB/language/lang_english/lang_main.php | 11 ++++++
6 files changed, 95 insertions(+), 10 deletions(-)
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index b909ed0d55..fda21b1321 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -48,6 +48,15 @@ CREATE TABLE [phpbb_config] (
) ON [PRIMARY]
GO
+
+CREATE TABLE [phpbb_confirm] (
+ [confirm_id] [char] (32) NOT NULL ,
+ [session_id] [char] (32) NOT NULL ,
+ [code] [char] (6) NOT NULL ,
+ [time] [int] NOT NULL
+) ON [PRIMARY]
+GO
+
CREATE TABLE [phpbb_disallow] (
[disallow_id] [int] IDENTITY (1, 1) NOT NULL ,
[disallow_username] [varchar] (100) NULL
@@ -401,6 +410,13 @@ ALTER TABLE [phpbb_categories] WITH NOCHECK ADD
) ON [PRIMARY]
GO
+ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD
+ CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED
+ (
+ [session_id,confirm_id]
+ ) ON [PRIMARY]
+GO
+
ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD
CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED
(
@@ -553,6 +569,13 @@ ALTER TABLE [phpbb_forums] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]
GO
+ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD
+ CONSTRAINT [DF_phpbb_confirm_confirm_id] DEFAULT ('') FOR [confirm_id],
+ CONSTRAINT [DF_phpbb_confirm_session_id] DEFAULT ('') FOR [session_id],
+ CONSTRAINT [DF_phpbb_confirm_code] DEFAULT ('') FOR [code],
+ CONSTRAINT [DF_phpbb_confirm_time] DEFAULT (0) FOR [time]
+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],
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index f74cd7c4e1..2ff1c25e56 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -93,14 +93,15 @@ CREATE TABLE phpbb_config (
# --------------------------------------------------------
#
-# Table structure for table `phpbb_confirm`
+# Table structure for table 'phpbb_confirm'
#
CREATE TABLE phpbb_confirm (
- confirm_id char(32) NOT NULL default '',
- session_id char(32) NOT NULL default '',
- code char(6) NOT NULL default '',
+ confirm_id char(32) DEFAULT '' NOT NULL,
+ session_id char(32) DEFAULT '' NOT NULL,
+ code char(6) DEFAULT '' NOT NULL,
+ time int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (session_id,confirm_id),
- KEY session_id (session_id)
+ KEY time (time)
);
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index dde1b1ca83..cbd696e578 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -33,16 +33,29 @@ CREATE TABLE phpbb_auth_access (
auth_reply int2 DEFAULT '0' NOT NULL,
auth_edit int2 DEFAULT '0' NOT NULL,
auth_delete int2 DEFAULT '0' NOT NULL,
- auth_announce int2 DEFAULT '0' NOT NULL,
auth_sticky int2 DEFAULT '0' NOT NULL,
+ auth_announce int2 DEFAULT '0' NOT NULL,
+ auth_vote int2 DEFAULT '0' NOT NULL,
auth_pollcreate int2 DEFAULT '0' NOT NULL,
auth_attachments int2 DEFAULT '0' NOT NULL,
- auth_vote int2 DEFAULT '0' NOT NULL,
auth_mod int2 DEFAULT '0' NOT NULL,
CONSTRAINT phpbb_auth_access_pkey PRIMARY KEY (group_id, forum_id)
);
+/* --------------------------------------------------------
+ Table structure for table phpbb_confirm
+-------------------------------------------------------- */
+CREATE TABLE phpbb_confirm (
+ confirm_id char(32) DEFAULT '' NOT NULL,
+ session_id char(32) DEFAULT '' NOT NULL,
+ code char(6) DEFAULT '' NOT NULL,
+ time int2 DEFAULT '0' NOT NULL,
+ CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id)
+);
+CREATE INDEX time_phpbb_confirm_index ON phpbb_confirm (time);
+
+
/* --------------------------------------------------------
Table structure for table phpbb_groups
-------------------------------------------------------- */
diff --git a/phpBB/install/update_to_205.php b/phpBB/install/update_to_205.php
index 1385956dcc..466104c8f4 100644
--- a/phpBB/install/update_to_205.php
+++ b/phpBB/install/update_to_205.php
@@ -496,6 +496,33 @@ switch ($row['config_value'])
CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
break;
}
+
+ // Add tables for visual confirmation ... saves me the trouble of writing a seperate
+ // script :D
+ switch (SQL_LAYER)
+ {
+ case 'mysql':
+ case 'mysql4':
+ $sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, time int(11) DEFAULT \'0\' NOT NULL, PRIMARY KEY (session_id, confirm_id), KEY time (time))';
+ break;
+
+ case 'mssql':
+ $sql[] = 'CREATE TABLE [' . $table_prefix . 'confirm] ([confirm_id] [char] (32) NOT NULL , [session_id] [char] (32) NOT NULL , [code] [char] (6) NOT NULL , [time] [int] NOT NULL ) ON [PRIMARY]';
+ $sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id,confirm_id]) ON [PRIMARY]';
+ $sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [DF_' . $table_prefix . 'confirm_confirm_id] DEFAULT (\'\') FOR [confirm_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_session_id] DEFAULT (\'\') FOR [session_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_code] DEFAULT (\'\') FOR [code], CONSTRAINT [DF_' . $table_prefix . 'confirm_time] DEFAULT (0) FOR [time]';
+ break;
+
+ case 'msaccess':
+ // TODO
+ break;
+
+ case 'postgresql':
+ $sql[] = 'CREATE TABLE ' . $table_prefix . 'confirm (confirm_id char(32) DEFAULT \'\' NOT NULL, session_id char(32) DEFAULT \'\' NOT NULL, code char(6) DEFAULT \'\' NOT NULL, time int2 DEFAULT \'0\' NOT NULL, CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id))';
+ $sql[] = 'CREATE INDEX time_' . $table_prefix . 'confirm_index ON ' . $table_prefix . 'confirm (time)';
+ break;
+ }
+
+ break;
}
echo "Updating database schema
\n";
@@ -850,11 +877,18 @@ switch ($row['config_value'])
_sql($sql, $errored, $error_ary);
}
+ case '.0.4':
+
+ // Add the confirmation code switch ... save time and trouble elsewhere
+ $sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
+ VALUES ('enable_confirm', '0')";
+ _sql($sql, $errored, $error_ary);
+
break;
- default:
- echo " No updates where required
\n";
- break;
+ default:
+ echo " No updates where required\n";
+ break;
}
echo "Updating version and optimizing tables
\n";
diff --git a/phpBB/language/lang_english/lang_admin.php b/phpBB/language/lang_english/lang_admin.php
index 31b516d5b3..6a06f56229 100644
--- a/phpBB/language/lang_english/lang_admin.php
+++ b/phpBB/language/lang_english/lang_admin.php
@@ -331,6 +331,9 @@ $lang['Cookie_secure'] = 'Cookie secure';
$lang['Cookie_secure_explain'] = 'If your server is running via SSL, set this to enabled, else leave as disabled';
$lang['Session_length'] = 'Session length [ seconds ]';
+// Visual Confirmation
+$lang['Visual_confirm'] = 'Enable Visual Confirmation';
+$lang['Visual_confirm_explain'] = 'Requires users enter a code defined by an image when registering.';
//
// Forum Management
diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php
index fd09dd4f95..8131a1880c 100644
--- a/phpBB/language/lang_english/lang_main.php
+++ b/phpBB/language/lang_english/lang_main.php
@@ -658,6 +658,17 @@ $lang['Empty_subject_email'] = 'You must specify a subject for the e-mail.';
$lang['Empty_message_email'] = 'You must enter a message to be e-mailed.';
+//
+// Visual confirmation system strings
+//
+$lang['Confirm_code_wrong'] = 'The confirmation code you entered was incorrect';
+$lang['Too_many_registers'] = 'You have exceeded the number of registration attempts for this session. Please try again later.';
+$lang['Confirm_code_impaired'] = 'If you are visually impaired or cannot otherwise read this code please contact the %sAdministrator%s for help.';
+$lang['Confirm_code'] = 'Confirmation code';
+$lang['Confirm_code_explain'] = 'Enter the code exactly as you see it. The code is case sensitive and zero has a diagonal line through it.';
+
+
+
//
// Memberslist
//