Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
ldap
Commits
2cb72276
Commit
2cb72276
authored
Jan 29, 2014
by
Bertrand Gauthier
Browse files
Changement syntaxe PHP 5.4 -> 5.3.
parent
a6d29378
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/UnicaenLdap/Entity/Entity.php
View file @
2cb72276
...
...
@@ -130,7 +130,7 @@ abstract class Entity
*/
public
function
getId
()
{
$key
=
self
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
self
::
getNodeParams
(
$this
->
type
);
return
$this
->
get
(
$key
);
}
...
...
@@ -141,7 +141,7 @@ abstract class Entity
*/
public
function
getKey
()
{
return
self
::
getNodeParams
(
$this
->
type
)
[
0
]
;
return
reset
(
self
::
getNodeParams
(
$this
->
type
)
)
;
}
/**
...
...
src/UnicaenLdap/Service/Service.php
View file @
2cb72276
...
...
@@ -146,7 +146,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
getList
(
$orderBy
=
null
,
$limit
=
self
::
DEFAULT_LIMIT
,
$offset
=
self
::
DEFAULT_OFFSET
)
{
$key
=
Entity
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
Entity
::
getNodeParams
(
$this
->
type
);
return
$this
->
search
(
"(
$key
=*)"
,
$orderBy
,
$limit
,
$offset
);
}
...
...
@@ -161,7 +161,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
search
(
$filter
,
$orderBy
=
null
,
$limit
=
self
::
DEFAULT_LIMIT
,
$offset
=
self
::
DEFAULT_OFFSET
)
{
$key
=
Entity
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
Entity
::
getNodeParams
(
$this
->
type
);
if
(
$limit
<
0
)
$limit
=
3999999999
;
// Limite maximum à 4 milliard...
if
(
$offset
<
0
)
$offset
=
0
;
// Moins de zéro = impossible
...
...
@@ -186,7 +186,7 @@ abstract class Service implements ServiceManagerAwareInterface
$i
=
0
;
ErrorHandler
::
start
(
E_WARNING
);
for
(
$entry
=
ldap_first_entry
(
$resource
,
$search
);
$entry
;
$entry
=
ldap_next_entry
(
$resource
,
$entry
))
{
$value
=
ldap_get_values_len
(
$resource
,
$entry
,
$key
)
[
0
]
;
list
(
$value
)
=
ldap_get_values_len
(
$resource
,
$entry
,
$key
);
if
(
null
!==
$value
){
$result
[]
=
$value
;
$i
++
;
...
...
@@ -233,7 +233,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
searchAttributes
(
$filter
,
array
$attributes
,
$orderBy
=
null
,
$limit
=
self
::
DEFAULT_LIMIT
,
$offset
=
self
::
DEFAULT_OFFSET
)
{
$key
=
Entity
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
Entity
::
getNodeParams
(
$this
->
type
);
if
(
$limit
<
0
)
$limit
=
3999999999
;
// Limite maximum à 4 milliard...
if
(
$offset
<
0
)
$offset
=
0
;
// Moins de zéro = impossible
...
...
@@ -259,7 +259,7 @@ abstract class Service implements ServiceManagerAwareInterface
$i
=
0
;
ErrorHandler
::
start
(
E_WARNING
);
for
(
$entry
=
ldap_first_entry
(
$resource
,
$search
);
$entry
;
$entry
=
ldap_next_entry
(
$resource
,
$entry
))
{
$id
=
ldap_get_values_len
(
$resource
,
$entry
,
$key
)
[
0
]
;
list
(
$id
)
=
ldap_get_values_len
(
$resource
,
$entry
,
$key
);
$data
=
array
();
foreach
(
$attributes
as
$attribute
){
$attrValue
=
ldap_get_values_len
(
$resource
,
$entry
,
$attribute
);
...
...
@@ -378,7 +378,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
get
(
$id
)
{
$key
=
Entity
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
Entity
::
getNodeParams
(
$this
->
type
);
return
$this
->
getBy
(
$id
,
$key
);
}
...
...
@@ -399,7 +399,7 @@ abstract class Service implements ServiceManagerAwareInterface
$value
=
current
(
$value
);
}
$classname
=
Entity
::
getNodeParams
(
$this
->
type
)
[
1
]
;
list
(
$tmp
,
$classname
)
=
Entity
::
getNodeParams
(
$this
->
type
);
list
(
$resource
,
$search
)
=
$this
->
__searchBegin
(
Filter
::
equals
(
$by
,
$value
),
$this
->
ou
,
array
(
'*'
,
'+'
)
);
$count
=
ldap_count_entries
(
$resource
,
$search
);
switch
(
$count
){
...
...
@@ -428,7 +428,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
getAll
(
$ids
,
$orderBy
=
null
)
{
$key
=
Entity
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
Entity
::
getNodeParams
(
$this
->
type
);
return
$this
->
getAllBy
(
$ids
,
$key
,
$orderBy
);
}
...
...
@@ -472,7 +472,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
exists
(
$id
)
{
$key
=
Entity
::
getNodeParams
(
$this
->
type
)
[
0
]
;
list
(
$key
)
=
Entity
::
getNodeParams
(
$this
->
type
);
return
$this
->
existsBy
(
$id
,
$key
);
}
...
...
@@ -507,7 +507,7 @@ abstract class Service implements ServiceManagerAwareInterface
*/
public
function
create
(
$id
,
$ou
=
null
)
{
list
(
$key
,
$classname
)
=
Entity
::
getNodeParams
(
$this
->
type
);
list
(
$key
,
$classname
)
=
Entity
::
getNodeParams
(
$this
->
type
);
if
(
empty
(
$ou
)){
if
(
count
(
$this
->
ou
)
>
1
){
throw
new
Exception
(
'$ou non renseigné alors que le service couvre plusieurs Organizational Units (OU).'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment