Hooks generique powa
This commit is contained in:
parent
2aeb58a614
commit
edaf3ef953
|
@ -238,17 +238,16 @@ class m_authip {
|
||||||
* @return array Retourne un tableau compliqué
|
* @return array Retourne un tableau compliqué
|
||||||
*/
|
*/
|
||||||
function get_auth_class() {
|
function get_auth_class() {
|
||||||
global $classes;
|
global $hooks;
|
||||||
$authclass=array();
|
$authclass=array();
|
||||||
|
$authclass = $hooks->invoke('authip_class');
|
||||||
|
|
||||||
foreach ($classes as $c) {
|
// Je rajoute la class DANS l'objet parce que
|
||||||
global $$c;
|
// ca m'interesse
|
||||||
if ( method_exists($$c, "authip_class") ) {
|
foreach ($authclass as $k => $v) {
|
||||||
$a=$$c->authip_class();
|
$authclass[$k]['class']=$k;
|
||||||
$a['class']=$c;
|
|
||||||
$authclass[$a['protocol']]=$a;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $authclass;
|
return $authclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,14 +318,19 @@ class m_authip {
|
||||||
* @return boolean Retourne TRUE
|
* @return boolean Retourne TRUE
|
||||||
*/
|
*/
|
||||||
function call_hooks($function, $affectation_id) {
|
function call_hooks($function, $affectation_id) {
|
||||||
|
global $hooks;
|
||||||
|
|
||||||
|
// On récure l'objet dont on parle
|
||||||
$d = $this->list_affected();
|
$d = $this->list_affected();
|
||||||
$affectation = $d[$affectation_id];
|
$affectation = $d[$affectation_id];
|
||||||
|
|
||||||
|
// On en déduis la classe qui le concerne
|
||||||
$e = $this->get_auth_class();
|
$e = $this->get_auth_class();
|
||||||
$c = $e[$affectation['protocol']]['class'];
|
$c = $e[$affectation['protocol']]['class'];
|
||||||
global $$c;
|
|
||||||
if ( method_exists($$c, $function) ) {
|
// On appelle le hooks de cette classe
|
||||||
$$c->$function($affectation);
|
$hooks->invoke($function, Array($affectation), Array($c) );
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue