Skip to content

Commit 764ec88

Browse files
author
Paul S. Owen
committed
Some emergency updates ...
git-svn-id: file:///svn/phpbb/trunk@422 89ea8834-ac86-4346-8a33-228a782c2dd0
1 parent 10fa55f commit 764ec88

1 file changed

Lines changed: 58 additions & 83 deletions

File tree

phpBB/includes/auth.php

Lines changed: 58 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
6060
switch($type)
6161
{
6262
case AUTH_ALL:
63-
$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";
64-
$auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_votecreate", "auth_vote");
63+
$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";
64+
$auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_votecreate", "auth_vote", "auth_attachments");
6565
break;
6666
case AUTH_VIEW:
6767
$a_sql = "aa.auth_view";
@@ -95,6 +95,10 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
9595
$a_sql = "aa.auth_vote";
9696
$auth_fields = array("auth_vote");
9797
break;
98+
case AUTH_ATTACH:
99+
$a_sql = "aa.auth_attachments";
100+
$auth_fields = array("auth_attachments");
101+
break;
98102
default:
99103
break;
100104
}
@@ -125,7 +129,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
125129
}
126130
else
127131
{
128-
$f_access = $db->sql_fetchrowset($af_result);
132+
$f_access = ($forum_id != AUTH_LIST_ALL) ? $db->sql_fetchrow($af_result) : $db->sql_fetchrowset($af_result);
129133
}
130134
}
131135
}
@@ -190,7 +194,6 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
190194
for($i = 0; $i < count($auth_fields); $i++)
191195
{
192196
$key = $auth_fields[$i];
193-
$value = ($forum_id != AUTH_LIST_ALL) ? $f_access[$key] : $f_access[$k][$key];
194197

195198
if(!$num_u_access)
196199
{
@@ -201,14 +204,14 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
201204
//
202205
if($forum_id != AUTH_LIST_ALL)
203206
{
204-
$auth_user[$key] = ($value == AUTH_ALL || $value == AUTH_REG) ? 1 : 0;
207+
$auth_user[$key] = ($f_access[$key] == AUTH_ALL || $f_access[$key] == AUTH_REG) ? 1 : 0;
205208
}
206209
else
207210
{
208211
for($k = 0; $k < count($f_access); $k++)
209212
{
210213
$f_forum_id = $f_access[$k]['forum_id'];
211-
$auth_user[$f_forum_id][$key] = ($value == AUTH_ALL || $value == AUTH_REG) ? 1 : 0;
214+
$auth_user[$f_forum_id][$key] = ($f_access[$k][$key] == AUTH_ALL || $f_access[$k][$key] == AUTH_REG) ? 1 : 0;
212215
}
213216
}
214217
}
@@ -245,97 +248,69 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
245248
// contents of the access levels are.
246249
//
247250

248-
switch($value)
251+
if($forum_id != AUTH_LIST_ALL)
249252
{
250-
case AUTH_ALL:
251-
if($forum_id != AUTH_LIST_ALL)
252-
{
253+
switch($value)
254+
{
255+
case AUTH_ALL:
253256
$auth_user[$key] = 1;
254-
}
255-
else
256-
{
257-
for($k = 0; $k < count($f_access); $k++)
258-
{
259-
$f_forum_id = $f_access[$k]['forum_id'];
260-
$auth_user[$f_forum_id][$key] = 1;
261-
}
262-
}
263-
break;
257+
break;
264258

265-
case AUTH_REG:
266-
if($forum_id != AUTH_LIST_ALL)
267-
{
259+
case AUTH_REG:
268260
$auth_user[$key] = 1;
269-
}
270-
else
271-
{
272-
for($k = 0; $k < count($f_access); $k++)
273-
{
274-
$f_forum_id = $f_access[$k]['forum_id'];
275-
$auth_user[$f_forum_id][$key] = 1;
276-
}
277-
}
278-
break;
261+
break;
279262

280-
case AUTH_ACL:
281-
if($forum_id != AUTH_LIST_ALL)
282-
{
263+
case AUTH_ACL:
283264
$auth_user[$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
284-
}
285-
else
286-
{
287-
for($k = 0; $k < count($f_access); $k++)
288-
{
289-
$f_forum_id = $f_access[$k]['forum_id'];
290-
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
291-
}
292-
}
293-
break;
265+
break;
294266

295-
case AUTH_MOD:
296-
if($forum_id != AUTH_LIST_ALL)
297-
{
298-
$auth_user[$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
299-
}
300-
else
301-
{
302-
for($k = 0; $k < count($f_access); $k++)
303-
{
304-
$f_forum_id = $f_access[$k]['forum_id'];
305-
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
306-
}
307-
}
308-
break;
267+
case AUTH_MOD:
268+
$auth_user[$key] = auth_check_user(AUTH_MOD, $key, $u_access, $is_admin);
269+
break;
309270

310-
case AUTH_ADMIN:
311-
if($forum_id != AUTH_LIST_ALL)
312-
{
271+
case AUTH_ADMIN:
313272
$auth_user[$key] = $is_admin;
314-
}
315-
else
316-
{
317-
for($k = 0; $k < count($f_access); $k++)
318-
{
319-
$f_forum_id = $f_access[$k]['forum_id'];
320-
$auth_user[$f_forum_id][$key] = $is_admin;
321-
}
322-
}
323-
break;
273+
break;
324274

325-
default:
326-
if($forum_id != AUTH_LIST_ALL)
327-
{
275+
default:
328276
$auth_user[$key] = 0;
329-
}
330-
else
277+
break;
278+
}
279+
}
280+
else
281+
{
282+
for($k = 0; $k < count($f_access); $k++)
283+
{
284+
$value = $f_access[$k][$key];
285+
$f_forum_id = $f_access[$k]['forum_id'];
286+
287+
switch($value)
331288
{
332-
for($k = 0; $k < count($f_access); $k++)
333-
{
334-
$f_forum_id = $f_access[$k]['forum_id'];
289+
case AUTH_ALL:
290+
$auth_user[$f_forum_id][$key] = 1;
291+
break;
292+
293+
case AUTH_REG:
294+
$auth_user[$f_forum_id][$key] = 1;
295+
break;
296+
297+
case AUTH_ACL:
298+
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
299+
break;
300+
301+
case AUTH_MOD:
302+
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, $key, $u_access, $is_admin);
303+
break;
304+
305+
case AUTH_ADMIN:
306+
$auth_user[$f_forum_id][$key] = $is_admin;
307+
break;
308+
309+
default:
335310
$auth_user[$f_forum_id][$key] = 0;
336-
}
311+
break;
337312
}
338-
break;
313+
}
339314
}
340315
}
341316
}

0 commit comments

Comments
 (0)