|
Revision 2, 0.6 kB
(checked in by sven, 3 years ago)
|
importing elgg-0.1.1a
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
// Get current access level |
|---|
| 6 |
|
|---|
| 7 |
function accesslevel($owner = -1) { |
|---|
| 8 |
|
|---|
| 9 |
$currentaccess = 0; |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
if (logged_on == 1) { |
|---|
| 14 |
$currentaccess++; |
|---|
| 15 |
} |
|---|
| 16 |
|
|---|
| 17 |
if ($_SESSION['userid'] == $owner) { |
|---|
| 18 |
$currentaccess += 1000; |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
return $currentaccess; |
|---|
| 22 |
|
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
function protect($level, $owner = -1) { |
|---|
| 28 |
|
|---|
| 29 |
if (accesslevel($owner) < $level) { |
|---|
| 30 |
run("access_denied"); |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
exit(); |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
?> |
|---|