-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
57 lines (48 loc) · 1.14 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/*
* Set debugging ON
* Do not use in production
*/
ini_set('display_errors', 'On');
error_reporting(E_ALL);
/*
* Define some core constants
*/
define('ROOT', __DIR__);
define('DS', DIRECTORY_SEPARATOR);
/**
* A simple wrapper function around print_r and wrapped in HTML pre tags
* @param mixed $w
* @return string
*/
function pr($w)
{
return '<pre>' . print_r($w, true) . '</pre>';
}
/*
* The autoloader, quick-nd-dirty
*/
spl_autoload_register(function($class) {
$file = ROOT . DS . str_replace('\\', DS, $class) . '.php';
if(file_exists($file))
{
include_once($file);
}
else
{
trigger_error('The requested file <em>' . $file . '</em> could not be found', E_USER_ERROR);
}
});
/*
* Let the fun begin
*/
$acl = new ACL();
print pr($acl);
print pr($acl->test('guest', 'node', 'read'));
print pr($acl->test('guest', 'node', 'create'));
print pr($acl->test('guest', 'node', 'update'));
print pr($acl->test('guest', 'node', 'delete'));
print pr($acl->test('user', 'node', 'read'));
print pr($acl->test('user', 'node', 'create'));
print pr($acl->test('user', 'node', 'update'));
print pr($acl->test('user', 'node', 'delete'));