1 |
tomk 10/09/09 17:56:19 |
2 |
|
3 |
Modified: admin_forums.php |
4 |
Log: |
5 |
Prevent non-replication safe id generation |
6 |
|
7 |
Revision Changes Path |
8 |
1.7 forums/htdocs/admin/admin_forums.php |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_forums.php?rev=1.7&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_forums.php?rev=1.7&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_forums.php?r1=1.6&r2=1.7 |
13 |
|
14 |
Index: admin_forums.php |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_forums.php,v |
17 |
retrieving revision 1.6 |
18 |
retrieving revision 1.7 |
19 |
diff -u -r1.6 -r1.7 |
20 |
--- admin_forums.php 9 Sep 2010 17:10:15 -0000 1.6 |
21 |
+++ admin_forums.php 9 Sep 2010 17:56:19 -0000 1.7 |
22 |
@@ -6,7 +6,7 @@ |
23 |
* copyright : (C) 2001 The phpBB Group |
24 |
* email : support@×××××.com |
25 |
* |
26 |
- * $Id: admin_forums.php,v 1.6 2010/09/09 17:10:15 robbat2 Exp $ |
27 |
+ * $Id: admin_forums.php,v 1.7 2010/09/09 17:56:19 tomk Exp $ |
28 |
* |
29 |
***************************************************************************/ |
30 |
|
31 |
@@ -439,8 +439,8 @@ |
32 |
|
33 |
$next_order = ($parent_id == NO_PARENT) ? $max_order + 100 : $max_order + 10; |
34 |
|
35 |
- // TODO: this is not replication-safe - robbat2 2010/09/09 |
36 |
- // Not fixing yet as creation of a forum is very rare. |
37 |
+ // this is not replication-safe - robbat2 2010/09/09 |
38 |
+ /* |
39 |
$sql = "SELECT MAX(forum_id) AS max_id |
40 |
FROM " . FORUMS_TABLE; |
41 |
if( !$result = $db->sql_query($sql) ) |
42 |
@@ -448,9 +448,11 @@ |
43 |
message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); |
44 |
} |
45 |
$row = $db->sql_fetchrow($result); |
46 |
+ |
47 |
|
48 |
$max_id = $row['max_id']; |
49 |
$next_id = $max_id + 1; |
50 |
+ */ |
51 |
|
52 |
// |
53 |
// Default permissions of public :: |
54 |
@@ -465,13 +467,16 @@ |
55 |
} |
56 |
|
57 |
// There is no problem having duplicate forum names so we won't check for it. |
58 |
- $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable, parent_id" . $field_sql . ") |
59 |
- VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . $cat_id . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) .", " . $parent_id . $value_sql . ")"; |
60 |
+ $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable, parent_id" . $field_sql . ") |
61 |
+ VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . $cat_id . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) .", " . $parent_id . $value_sql . ")"; |
62 |
if( !$result = $db->sql_query($sql) ) |
63 |
{ |
64 |
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql); |
65 |
} |
66 |
|
67 |
+ // 2010-09-09 tomk - replication-safe auto increment |
68 |
+ $next_id = $db->sql_nextid(); |
69 |
+ |
70 |
if( $HTTP_POST_VARS['prune_enable'] ) |
71 |
{ |