From 6080c584e81927b2263267822e3ebc1e553662ec Mon Sep 17 00:00:00 2001 From: Robin Gareus <robin@gareus.org> Date: Thu, 12 Mar 2009 23:44:54 +0100 Subject: [PATCH] Action Event wrappers around HTTP requests and authentication checks Ignore-this: 9ffd0327c318a633e33a60e0a8ecf7f5 darcs-hash:20090312224454-b7b7f-12b7fa78c0b638c1795f6d5e1b1c1aa2cbab64d4.gz --- inc/HTTPClient.php | 12 ++++++++++++ inc/auth.php | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index f59efbaf8..7efe39a9c 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -158,6 +158,18 @@ class HTTPClient { $this->error = ''; $this->status = 0; + $httpdata = array('url' => $url, + 'data' => $data, + 'method' => $method); + $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND',$httpdata); + if($evt->advise_before()){ + $url = $httpdata['url']; + $data = $httpdata['data']; + $method = $httpdata['method']; + } + $evt->advise_after(); + unset($evt); + // parse URL into bits $uri = parse_url($url); $server = $uri['host']; diff --git a/inc/auth.php b/inc/auth.php index e1f9029a9..c3480b725 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -81,7 +81,23 @@ // external trust mechanism in place $auth->trustExternal($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']); }else{ - auth_login($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r'],$_REQUEST['http_credentials']); + $evdata = array( + 'action' => $ACT, + 'user' => $_REQUEST['u'], + 'password' => $_REQUEST['p'], + 'sticky' => $_REQUEST['r'], + 'silent' => $_REQUEST['http_credentials'], + ); + $evt = new Doku_Event('AUTH_LOGIN_CHECK',$ACT); + if($evt->advise_before()){ + auth_login($evdata['user'], + $evdata['password'], + $evdata['sticky'], + $evdata['silent']); + } + $evt->advise_after(); + unset($evt); + unset($evdata); } } -- GitLab