forked from ezsystems/ezpublish-legacy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
access.php
128 lines (117 loc) · 3.32 KB
/
access.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/**
* File containing (site)access functions
*
* @copyright Copyright (C) 1999-2010 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/gnu_gpl GNU GPL v2
* @version //autogentag//
* @package index
* @deprecated This file and its compatibility functions/constants will be removed in "4.6"
*/
/**
* Integer constants that identify the siteaccess matching used
*
* @see eZSiteAccess class constants
*/
define( 'EZ_ACCESS_TYPE_DEFAULT', 1 );
define( 'EZ_ACCESS_TYPE_URI', 2 );
define( 'EZ_ACCESS_TYPE_PORT', 3 );
define( 'EZ_ACCESS_TYPE_HTTP_HOST', 4 );
define( 'EZ_ACCESS_TYPE_INDEX_FILE', 5 );
define( 'EZ_ACCESS_TYPE_STATIC', 6 );
define( 'EZ_ACCESS_TYPE_SERVER_VAR', 7 );
define( 'EZ_ACCESS_TYPE_URL', 8 );
define( 'EZ_ACCESS_SUBTYPE_PRE', 1 );
define( 'EZ_ACCESS_SUBTYPE_POST', 2 );
/**
* Goes trough the access matching rules and returns the access match.
* The returned match is an associative array with:
* name => string Name of the siteaccess (same as folder name)
* type => int The constant that represent the matching used
* uri_part => array(string) List of path elements that was used in start of url for the match
*
* @see eZSiteAccess::match()
* @param eZURI $uri
* @param string $host
* @param string(numeric) $port
* @param string $file Example '/index.php'
* @return array
*/
function accessType( eZURI $uri, $host, $port, $file )
{
return eZSiteAccess::match( $uri, $host, $port, $file );
}
/**
* Changes the site access to what's defined in $access. It will change the
* access path in eZSys and prepend an override dir to eZINI
*
* @see eZSiteAccess::change()
* @param array $access An associative array with 'name' (string), 'type' (int) and 'uri_part' (array).
* @return array The $access parameter
*/
function changeAccess( array $access )
{
return eZSiteAccess::change( $access );
}
/**
* Match a regex expression
*
* @see eZSiteAccess::matchRegexp()
* @param string $text
* @param string $reg
* @param int $num
* @return string|null
*/
function accessMatchRegexp( &$text, $reg, $num )
{
return eZSiteAccess::matchRegexp( $text, $reg, $num );
}
/**
* Match a text string with pre or/or post text strings
*
* @see eZSiteAccess::matchText()
* @param string $text
* @param string $match_pre
* @param string $match_post
* @return string|null
*/
function accessMatchText( &$text, $match_pre, $match_post )
{
return eZSiteAccess::matchText( $text, $match_pre, $match_post );
}
/**
* Checks if site access debug is enabled
*
* @see eZSiteAccess::debugEnabled()
* @return bool
*/
function accessDebugEnabled()
{
return eZSiteAccess::debugEnabled();
}
/**
* Checks if extra site access debug is enabled
*
* @see eZSiteAccess::extraDebugEnabled()
* @return bool
*/
function accessExtraDebugEnabled()
{
return eZSiteAccess::extraDebugEnabled();
}
/**
* Checks if access is allowed to a module/view based on site.ini[SiteAccessRules]Rules settings
*
* @see eZModule::accessAllowed()
* @param eZURI $uri
* @return array An associative array with:
* 'result' => bool Indicates if access is allowed
* 'module' => string Module name
* 'view' => string View name
* 'view_checked' => bool Indicates if view access has been checked
*/
function accessAllowed( eZURI $uri )
{
return eZModule::accessAllowed( $uri );
}
?>