Reduced auth code size and added some more auth types

git-svn-id: file:///svn/phpbb/trunk@435 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-06-06 21:35:08 +00:00
parent 43bc7ac78f
commit 999a0c9d1a
6 changed files with 207 additions and 315 deletions

View file

@ -32,10 +32,10 @@ INSERT INTO phpbb_user_group (group_id, user_id) VALUES (1, 1);
INSERT INTO phpbb_user_group (group_id, user_id) VALUES (2, 2); INSERT INTO phpbb_user_group (group_id, user_id) VALUES (2, 2);
# -- Forum Access (Open access to ALL) # -- Forum Access (Open access to ALL)
INSERT INTO phpbb_auth_forums (forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_votecreate, auth_vote) VALUES (1, 0, 0, 0, 0, 0, 0, 0, 0); INSERT INTO phpbb_auth_forums (forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_votecreate, auth_vote) VALUES (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
# -- User Access (admin is set as a moderator of the created forum) # -- User Access (admin is set as a moderator of the created forum)
INSERT INTO phpbb_auth_access (group_id, forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_votecreate, auth_vote, auth_mod) VALUES (2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1); INSERT INTO phpbb_auth_access (group_id, forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_votecreate, auth_vote, auth_mod) VALUES (2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
# -- Demo Topic # -- Demo Topic
INSERT INTO phpbb_topics VALUES(1, 1, 'Demo Topic', 1, NOW(), 0, 0, 0, 0, 1); INSERT INTO phpbb_topics VALUES(1, 1, 'Demo Topic', 1, NOW(), 0, 0, 0, 0, 1);

View file

@ -18,6 +18,8 @@ CREATE TABLE phpbb_auth_access (
auth_reply tinyint(1) DEFAULT '0' NOT NULL, auth_reply tinyint(1) DEFAULT '0' NOT NULL,
auth_edit tinyint(1) DEFAULT '0' NOT NULL, auth_edit tinyint(1) DEFAULT '0' NOT NULL,
auth_delete tinyint(1) DEFAULT '0' NOT NULL, auth_delete tinyint(1) DEFAULT '0' NOT NULL,
auth_announce tinyint(1) DEFAULT '0' NOT NULL,
auth_sticky tinyint(1) DEFAULT '0' NOT NULL,
auth_votecreate tinyint(1) DEFAULT '0' NOT NULL, auth_votecreate tinyint(1) DEFAULT '0' NOT NULL,
auth_attachments tinyint(1) DEFAULT '0' NOT NULL, auth_attachments tinyint(1) DEFAULT '0' NOT NULL,
auth_vote tinyint(1) DEFAULT '0' NOT NULL, auth_vote tinyint(1) DEFAULT '0' NOT NULL,
@ -38,6 +40,8 @@ CREATE TABLE phpbb_auth_forums (
auth_reply tinyint(4) DEFAULT '0' NOT NULL, auth_reply tinyint(4) DEFAULT '0' NOT NULL,
auth_edit tinyint(4) DEFAULT '0' NOT NULL, auth_edit tinyint(4) DEFAULT '0' NOT NULL,
auth_delete tinyint(4) DEFAULT '0' NOT NULL, auth_delete tinyint(4) DEFAULT '0' NOT NULL,
auth_announce tinyint(4) DEFAULT '0' NOT NULL,
auth_sticky tinyint(4) DEFAULT '0' NOT NULL,
auth_votecreate tinyint(4) DEFAULT '0' NOT NULL, auth_votecreate tinyint(4) DEFAULT '0' NOT NULL,
auth_vote tinyint(4) DEFAULT '0' NOT NULL, auth_vote tinyint(4) DEFAULT '0' NOT NULL,
auth_attachments tinyint(4) DEFAULT '0' NOT NULL auth_attachments tinyint(4) DEFAULT '0' NOT NULL
@ -421,14 +425,20 @@ CREATE TABLE phpbb_users (
user_id int(11) NOT NULL auto_increment, user_id int(11) NOT NULL auto_increment,
user_active tinyint(4), user_active tinyint(4),
username varchar(40) NOT NULL, username varchar(40) NOT NULL,
user_level int(11) DEFAULT '0',
user_regdate int(11) DEFAULT '0' NOT NULL,
user_password varchar(32) NOT NULL, user_password varchar(32) NOT NULL,
user_autologin_key varchar(32), user_autologin_key varchar(32),
user_template varchar(50), user_level tinyint(4) DEFAULT '0',
user_lang varchar(255),
user_timezone int(11) DEFAULT '0' NOT NULL, user_timezone int(11) DEFAULT '0' NOT NULL,
user_dateformat varchar(14) DEFAULT 'd M Y H:i' NOT NULL, user_dateformat varchar(14) DEFAULT 'd M Y H:i' NOT NULL,
user_template varchar(50),
user_theme int(11),
user_lang varchar(255),
user_viewemail tinyint(1),
user_attachsig tinyint(1),
user_allowhtml tinyint(1),
user_allowbbcode tinyint(1),
user_allowsmile tinyint(1),
user_regdate int(11) DEFAULT '0' NOT NULL,
user_rank int(11) DEFAULT '0', user_rank int(11) DEFAULT '0',
user_avatar varchar(100), user_avatar varchar(100),
user_email varchar(255), user_email varchar(255),
@ -438,21 +448,14 @@ CREATE TABLE phpbb_users (
user_from varchar(100), user_from varchar(100),
user_interests varchar(255), user_interests varchar(255),
user_sig varchar(255), user_sig varchar(255),
user_theme int(11),
user_aim varchar(255), user_aim varchar(255),
user_yim varchar(255), user_yim varchar(255),
user_msnm varchar(255), user_msnm varchar(255),
user_posts int(11) DEFAULT '0', user_posts int(11) DEFAULT '0',
user_viewemail tinyint(3),
user_attachsig tinyint(3),
user_allowhtml tinyint(3),
user_allowbbcode tinyint(3),
user_allowsmile tinyint(3),
user_actkey varchar(32), user_actkey varchar(32),
user_newpasswd varchar(32), user_newpasswd varchar(32),
user_notify tinyint(3), user_notify tinyint(3),
PRIMARY KEY (user_id), PRIMARY KEY (user_id)
KEY user_id (user_id)
); );

View file

@ -31,6 +31,8 @@ CREATE TABLE phpbb_auth_forums (
auth_reply int2 DEFAULT '0' NOT NULL, auth_reply int2 DEFAULT '0' NOT NULL,
auth_edit int2 DEFAULT '0' NOT NULL, auth_edit int2 DEFAULT '0' NOT NULL,
auth_delete 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_votecreate int2 DEFAULT '0' NOT NULL, auth_votecreate int2 DEFAULT '0' NOT NULL,
auth_vote int2 DEFAULT '0' NOT NULL, auth_vote int2 DEFAULT '0' NOT NULL,
auth_attachments int2 DEFAULT '0' NOT NULL auth_attachments int2 DEFAULT '0' NOT NULL
@ -49,6 +51,8 @@ CREATE TABLE phpbb_auth_access (
auth_reply int2 DEFAULT '0' NOT NULL, auth_reply int2 DEFAULT '0' NOT NULL,
auth_edit int2 DEFAULT '0' NOT NULL, auth_edit int2 DEFAULT '0' NOT NULL,
auth_delete 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_votecreate int2 DEFAULT '0' NOT NULL, auth_votecreate int2 DEFAULT '0' NOT NULL,
auth_attachments int2 DEFAULT '0' NOT NULL, auth_attachments int2 DEFAULT '0' NOT NULL,
auth_vote int2 DEFAULT '0' NOT NULL, auth_vote int2 DEFAULT '0' NOT NULL,

View file

@ -60,45 +60,64 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
switch($type) switch($type)
{ {
case AUTH_ALL: case AUTH_ALL:
$a_sql = "aa.auth_view, aa.auth_read, aa.auth_post, aa.auth_reply, aa.auth_edit, aa.auth_delete, aa.auth_votecreate, aa.auth_vote, aa.auth_attachments"; $a_sql = "au.auth_view, au.auth_read, au.auth_post, au.auth_reply, au.auth_edit, au.auth_delete, au.auth_announce, au.auth_sticky, au.auth_votecreate, au.auth_vote, au.auth_attachments";
$auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_votecreate", "auth_vote", "auth_attachments"); $auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_announce", "auth_sticky", "auth_votecreate", "auth_vote", "auth_attachments");
break; break;
case AUTH_VIEW: case AUTH_VIEW:
$a_sql = "aa.auth_view"; $a_sql = "au.auth_view";
$auth_fields = array("auth_view"); $auth_fields = array("auth_view");
break; break;
case AUTH_READ: case AUTH_READ:
$a_sql = "aa.auth_read"; $a_sql = "au.auth_read";
$auth_fields = array("auth_read"); $auth_fields = array("auth_read");
break; break;
case AUTH_POST: case AUTH_POST:
$a_sql = "aa.auth_post"; $a_sql = "au.auth_post";
$auth_fields = array("auth_post"); $auth_fields = array("auth_post");
break; break;
case AUTH_REPLY: case AUTH_REPLY:
$a_sql = "aa.auth_reply"; $a_sql = "au.auth_reply";
$auth_fields = array("auth_reply"); $auth_fields = array("auth_reply");
break; break;
case AUTH_EDIT: case AUTH_EDIT:
$a_sql = "aa.auth_edit"; $a_sql = "au.auth_edit";
$auth_fields = array("auth_edit"); $auth_fields = array("auth_edit");
break; break;
case AUTH_DELETE: case AUTH_DELETE:
$a_sql = "aa.auth_delete"; $a_sql = "au.auth_delete";
$auth_fields = array("auth_delete"); $auth_fields = array("auth_delete");
break; break;
case AUTH_ANNOUNCE:
$a_sql = "au.auth_announce";
$auth_fields = array("auth_announce");
break;
case AUTH_STICKY:
$a_sql = "au.auth_sticky";
$auth_fields = array("auth_sticky");
break;
case AUTH_VOTECREATE: case AUTH_VOTECREATE:
$a_sql = "aa.auth_votecreate"; $a_sql = "au.auth_votecreate";
$auth_fields = array("auth_votecreate"); $auth_fields = array("auth_votecreate");
break; break;
case AUTH_VOTE: case AUTH_VOTE:
$a_sql = "aa.auth_vote"; $a_sql = "au.auth_vote";
$auth_fields = array("auth_vote"); $auth_fields = array("auth_vote");
break; break;
case AUTH_ATTACH: case AUTH_ATTACH:
$a_sql = "aa.auth_attachments"; $a_sql = "au.auth_attachments";
$auth_fields = array("auth_attachments"); $auth_fields = array("auth_attachments");
break; break;
case AUTH_ALLOW_HTML:
break;
case AUTH_ALLOW_BBCODE:
break;
case AUTH_ALLOW_SMILIES:
break;
default: default:
break; break;
} }
@ -111,9 +130,9 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
// //
if($f_access == -1) if($f_access == -1)
{ {
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE aa.forum_id = $forum_id" : ""; $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE au.forum_id = $forum_id" : "";
$sql = "SELECT aa.forum_id, $a_sql $sql = "SELECT au.forum_id, $a_sql
FROM ".FORUMS_TABLE." aa FROM ".AUTH_FORUMS_TABLE." au
$forum_match_sql"; $forum_match_sql";
$af_result = $db->sql_query($sql); $af_result = $db->sql_query($sql);
@ -133,10 +152,6 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
} }
} }
} }
else
{
}
// //
// If the user isn't logged on then // If the user isn't logged on then
@ -147,80 +162,14 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
// //
$auth_user = array(); $auth_user = array();
if(!$userdata['session_logged_in']) if($userdata['session_logged_in'])
{ {
for($j = 0; $j < count($auth_fields); $j++) $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND au.forum_id = $forum_id" : "";
{ $sql = "SELECT au.forum_id, $a_sql, au.auth_mod, g.group_single_user
$key = $auth_fields[$j]; FROM ".AUTH_ACCESS_TABLE." au, " . USER_GROUP_TABLE. " ug, " . GROUPS_TABLE. " g
if($forum_id != AUTH_LIST_ALL)
{
$auth_user[$key] = ($f_access[$key] == AUTH_ALL) ? 1 : 0;
switch($f_access[$key])
{
case AUTH_ALL:
$auth_user[$key . '_type'] = "Anonymous Users";
break;
case AUTH_REG:
$auth_user[$key . '_type'] = "Registered Users";
break;
case AUTH_ACL:
$auth_user[$key . '_type'] = "Users granted Special Access";
break;
case AUTH_MOD:
$auth_user[$key . '_type'] = "Moderators";
break;
case AUTH_ADMIN:
$auth_user[$key . '_type'] = "Administrators";
break;
}
}
else
{
for($i = 0; $i < count($f_access); $i++)
{
$forum_id = $f_access[$i]['forum_id'];
$auth_user[$forum_id][$key] = ($f_access[$i][$key] == AUTH_ALL) ? 1 : 0;
switch($f_access[$i][$key])
{
case AUTH_ALL:
$auth_user[$forum_id][$key . '_type'] = "Anonymous Users";
break;
case AUTH_REG:
$auth_user[$forum_id][$key . '_type'] = "Registered Users";
break;
case AUTH_ACL:
$auth_user[$forum_id][$key . '_type'] = "Users granted special access";
break;
case AUTH_MOD:
$auth_user[$forum_id][$key . '_type'] = "Moderators";
break;
case AUTH_ADMIN:
$auth_user[$forum_id][$key . '_type'] = "Administrators";
break;
}
}
}
}
}
else
{
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND aa.forum_id = $forum_id" : "";
$sql = "SELECT aa.forum_id, $a_sql, aa.auth_mod, g.group_single_user
FROM ".AUTH_ACCESS_TABLE." aa, " . USER_GROUP_TABLE. " ug, " . GROUPS_TABLE. " g
WHERE ug.user_id = ".$userdata['user_id']. " WHERE ug.user_id = ".$userdata['user_id']. "
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND aa.group_id = ug.group_id AND au.group_id = ug.group_id
$forum_match_sql"; $forum_match_sql";
$au_result = $db->sql_query($sql); $au_result = $db->sql_query($sql);
if(!$au_result) if(!$au_result)
@ -233,6 +182,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{ {
$u_access = $db->sql_fetchrowset($au_result); $u_access = $db->sql_fetchrowset($au_result);
} }
}
$is_admin = ($userdata['user_level'] == ADMIN) ? 1 : 0; $is_admin = ($userdata['user_level'] == ADMIN) ? 1 : 0;
$auth_user = array(); $auth_user = array();
@ -241,74 +191,6 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{ {
$key = $auth_fields[$i]; $key = $auth_fields[$i];
if(!$num_u_access)
{
//
// If no rows for this user where
// returned then auth is only true
// if the key has a value of ALL || REG
//
if($forum_id != AUTH_LIST_ALL)
{
$auth_user[$key] = ($f_access[$key] == AUTH_ALL || $f_access[$key] == AUTH_REG) ? 1 : 0;
switch($f_access[$key])
{
case AUTH_ALL:
$auth_user[$key . '_type'] = "Anonymous Users";
break;
case AUTH_REG:
$auth_user[$key . '_type'] = "Registered Users";
break;
case AUTH_ACL:
$auth_user[$key . '_type'] = "Users granted special access";
break;
case AUTH_MOD:
$auth_user[$key . '_type'] = "Moderators";
break;
case AUTH_ADMIN:
$auth_user[$key . '_type'] = "Administrators";
break;
}
}
else
{
for($k = 0; $k < count($f_access); $k++)
{
$f_forum_id = $f_access[$k]['forum_id'];
$auth_user[$f_forum_id][$key] = ($f_access[$k][$key] == AUTH_ALL || $f_access[$k][$key] == AUTH_REG) ? 1 : 0;
switch($f_access[$k][$key])
{
case AUTH_ALL:
$auth_user[$forum_id][$key . '_type'] = "Anonymous Users";
break;
case AUTH_REG:
$auth_user[$forum_id][$key . '_type'] = "Registered Users";
break;
case AUTH_ACL:
$auth_user[$forum_id][$key . '_type'] = "Users granted special access";
break;
case AUTH_MOD:
$auth_user[$forum_id][$key . '_type'] = "Moderators";
break;
case AUTH_ADMIN:
$auth_user[$forum_id][$key . '_type'] = "Administrators";
break;
}
}
}
}
else
{
// //
// If the user is logged on and the forum type is either // If the user is logged on and the forum type is either
// ALL or REG then the user has access // ALL or REG then the user has access
@ -342,6 +224,8 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
if($forum_id != AUTH_LIST_ALL) if($forum_id != AUTH_LIST_ALL)
{ {
$value = $f_access[$key];
switch($value) switch($value)
{ {
case AUTH_ALL: case AUTH_ALL:
@ -350,17 +234,17 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
break; break;
case AUTH_REG: case AUTH_REG:
$auth_user[$key] = 1; $auth_user[$key] = ($userdata['session_logged_in']) ? 1 : 0;
$auth_user[$key . '_type'] = "Registered Users"; $auth_user[$key . '_type'] = "Registered Users";
break; break;
case AUTH_ACL: case AUTH_ACL:
$auth_user[$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin); $auth_user[$key] = ($userdata['session_logged_in'] && $num_u_access) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = "Users granted special access"; $auth_user[$key . '_type'] = "Users granted special access";
break; break;
case AUTH_MOD: case AUTH_MOD:
$auth_user[$key] = auth_check_user(AUTH_MOD, $key, $u_access, $is_admin); $auth_user[$key] = ($userdata['session_logged_in'] && $num_u_access) ? auth_check_user(AUTH_MOD, $key, $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = "Moderators"; $auth_user[$key . '_type'] = "Moderators";
break; break;
@ -389,17 +273,17 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
break; break;
case AUTH_REG: case AUTH_REG:
$auth_user[$f_forum_id][$key] = 1; $auth_user[$f_forum_id][$key] = ($userdata['session_logged_in']) ? 1 : 0;
$auth_user[$f_forum_id][$key . '_type'] = "Registered Users"; $auth_user[$f_forum_id][$key . '_type'] = "Registered Users";
break; break;
case AUTH_ACL: case AUTH_ACL:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin); $auth_user[$f_forum_id][$key] = ($userdata['session_logged_in'] && $num_u_access) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0;
$auth_user[$f_forum_id][$key . '_type'] = "Users granted special access"; $auth_user[$f_forum_id][$key . '_type'] = "Users granted special access";
break; break;
case AUTH_MOD: case AUTH_MOD:
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, $key, $u_access, $is_admin); $auth_user[$f_forum_id][$key] = ($userdata['session_logged_in'] && $num_u_access) ? auth_check_user(AUTH_MOD, $key, $u_access, $is_admin) : 0;
$auth_user[$f_forum_id][$key . '_type'] = "Moderators"; $auth_user[$f_forum_id][$key . '_type'] = "Moderators";
break; break;
@ -415,20 +299,20 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
} }
} }
} }
}
// //
// Is user a moderator? // Is user a moderator?
// //
if($forum_id != AUTH_LIST_ALL) if($forum_id != AUTH_LIST_ALL)
{ {
$auth_user['auth_mod'] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin); $auth_user['auth_mod'] = ($userdata['session_logged_in'] && $num_u_access) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
} }
else else
{ {
for($k = 0; $k < count($f_access); $k++) for($k = 0; $k < count($f_access); $k++)
{ {
$f_forum_id = $f_access[$k]['forum_id']; $f_forum_id = $f_access[$k]['forum_id'];
$auth_user[$f_forum_id]['auth_mod'] = auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin); $auth_user[$f_forum_id]['auth_mod'] = ($userdata['session_logged_in'] && $num_u_access) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
} }
} }
@ -448,7 +332,6 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
$auth_user[$f_forum_id]['auth_admin'] = $is_admin; $auth_user[$f_forum_id]['auth_admin'] = $is_admin;
} }
} }
}
return $auth_user; return $auth_user;

View file

@ -87,37 +87,39 @@ define(AUTH_MOD, 3);
define(AUTH_ADMIN, 5); define(AUTH_ADMIN, 5);
define(AUTH_VIEW, 1); define(AUTH_VIEW, 1);
define(AUTH_READ, 2); define(AUTH_READ, 2);
define(AUTH_POST, 3); define(AUTH_POST, 3);
define(AUTH_REPLY, 4); define(AUTH_REPLY, 4);
define(AUTH_EDIT, 5); define(AUTH_EDIT, 5);
define(AUTH_DELETE, 6); define(AUTH_DELETE, 6);
define(AUTH_VOTECREATE, 7);
define(AUTH_VOTE, 8); define(AUTH_ANNOUNCE, 7);
define(AUTH_ATTACH, 9); define(AUTH_STICKY, 8);
define(AUTH_LIST_ALL, 10); define(AUTH_VOTECREATE, 9);
define(AUTH_VOTE, 10);
define(AUTH_ATTACH, 11);
define(AUTH_LIST_ALL, 20);
// Table names // Table names
define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access');
define('AUTH_FORUMS_TABLE', $table_prefix.'auth_forums');
define('BANLIST_TABLE', $table_prefix.'banlist'); define('BANLIST_TABLE', $table_prefix.'banlist');
define('CATEGORIES_TABLE', $table_prefix.'categories'); define('CATEGORIES_TABLE', $table_prefix.'categories');
define('CONFIG_TABLE', $table_prefix.'config'); define('CONFIG_TABLE', $table_prefix.'config');
define('DISALLOW_TABLE', $table_prefix.'disallow'); define('DISALLOW_TABLE', $table_prefix.'disallow');
define('FORUM_ACCESS_TABLE', $table_prefix.'forum_access');
define('FORUM_MODS_TABLE', $table_prefix.'forum_mods');
define('FORUMS_TABLE', $table_prefix.'forums'); define('FORUMS_TABLE', $table_prefix.'forums');
define('GROUPS_TABLE', $table_prefix.'groups');
define('POSTS_TABLE', $table_prefix.'posts'); define('POSTS_TABLE', $table_prefix.'posts');
define('POSTS_TEXT_TABLE', $table_prefix.'posts_text'); define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');
define('PRIV_MSGS_TABLE', $table_prefix.'priv_msgs'); define('PRIV_MSGS_TABLE', $table_prefix.'priv_msgs');
define('RANKS_TABLE', $table_prefix.'ranks'); define('RANKS_TABLE', $table_prefix.'ranks');
define('SESSIONS_TABLE', $table_prefix.'session'); define('SESSIONS_TABLE', $table_prefix.'session');
define('SESSIONS_KEY_TABLE', $table_prefix.'session_keys');
define('THEMES_TABLE', $table_prefix.'themes'); define('THEMES_TABLE', $table_prefix.'themes');
define('TOPICS_TABLE', $table_prefix.'topics'); define('TOPICS_TABLE', $table_prefix.'topics');
define('USERS_TABLE', $table_prefix.'users');
define('GROUPS_TABLE', $table_prefix.'groups');
define('USER_GROUP_TABLE', $table_prefix.'user_group'); define('USER_GROUP_TABLE', $table_prefix.'user_group');
define('USERS_TABLE', $table_prefix.'users');
define('WORDS_TABLE', $table_prefix.'words'); define('WORDS_TABLE', $table_prefix.'words');
define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access');
define('AUTH_FORUMS_TABLE', $table_prefix.'auth_forums');
?> ?>

View file

@ -148,9 +148,9 @@ else
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
$order_sql"; $order_sql";
*/ */
$order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, fa.auth_view, fa.auth_read, fa.auth_post, fa.auth_reply, fa.auth_edit, fa.auth_delete, fa.auth_votecreate, fa.auth_vote ORDER BY p.post_id ASC"; $order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, fa.auth_view, fa.auth_read, fa.auth_post, fa.auth_reply, fa.auth_edit, fa.auth_delete, fa.auth_announce, fa.auth_sticky, fa.auth_votecreate, fa.auth_vote ORDER BY p.post_id ASC";
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, fa.auth_view, fa.auth_read, fa.auth_post, fa.auth_reply, fa.auth_edit, fa.auth_delete, fa.auth_votecreate, fa.auth_vote" . $count_sql . " $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, fa.auth_view, fa.auth_read, fa.auth_post, fa.auth_reply, fa.auth_edit, fa.auth_announce, fa.auth_sticky, fa.auth_delete, fa.auth_votecreate, fa.auth_vote" . $count_sql . "
FROM $join_sql_table ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".AUTH_FORUMS_TABLE." fa FROM $join_sql_table ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".AUTH_FORUMS_TABLE." fa
WHERE $join_sql WHERE $join_sql
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id