[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/class.phpgw.php, 1.1.1.1.2.47
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/class.phpgw.php, 1.1.1.1.2.47 |
Date: |
Sun, 25 Jul 2004 18:20:08 +0200 |
Update of /api
Modified Files:
Branch: proposal-branch
class.phpgw.php
date: 2004/07/25 16:20:08; author: dcech; state: Exp; lines: +49 -42
Log Message:
fixed passing login and session vars for xmlrpc interface
added xmlrpc_base64 type
changed ADODB fetch mode to ASSOC
cleaned up auth code in api_phpgw
modified check_op for speed
=====================================================================
Index: api/class.phpgw.php
diff -u api/class.phpgw.php:1.1.1.1.2.46 api/class.phpgw.php:1.1.1.1.2.47
--- api/class.phpgw.php:1.1.1.1.2.46 Thu Jul 8 23:22:16 2004
+++ api/class.phpgw.php Sun Jul 25 16:20:08 2004
@@ -80,42 +80,41 @@
{
$_SESSION['phpgw_session']['nextop'] =
$GLOBALS['phpgw_data']['api']['op'];
}
+
while ($GLOBALS['phpgw_data']['api']['op'] ==
'api.base.login')
{
-
if(isset($GLOBALS['phpgw_data']['api']['phpgw_user']) &&
isset($GLOBALS['phpgw_data']['api']['phpgw_pass']))
+
if(!isset($GLOBALS['phpgw_data']['api']['phpgw_user']) ||
!isset($GLOBALS['phpgw_data']['api']['phpgw_pass']))
{
- $this->auth = createObject('api_auth');
- if
($this->auth->authenticate($GLOBALS['phpgw_data']['api']['phpgw_user'],
$GLOBALS['phpgw_data']['api']['phpgw_pass']))
- {
- $this->accounts =
createObject('api_accounts',$GLOBALS['phpgw_data']['api']['phpgw_user']);
- $history =
createObject('api_history');
- $history->account_id =
$this->accounts->account_id;
- $new_data = array(
- 'ip_address' =>
get_ip(),
- 'sessionid' =>
session_id()
- );
- $history->set('api.sessions.' .
$history->account_id,$new_data,array());
-
-
$this->session->create($GLOBALS['phpgw_data']['api']['phpgw_user']);
-
unset($GLOBALS['phpgw_data']['api']['phpgw_user']);
-
unset($GLOBALS['phpgw_data']['api']['phpgw_pass']);
- $this->check_op();
-
if($GLOBALS['phpgw_data']['api']['op'] == 'api.base.login')
- {
-
$GLOBALS['phpgw_data']['api']['op'] = 'api.base.start';
- }
-
unset($_SESSION['phpgw_session']['serialized_classes']);
-
$GLOBALS['phpgw']->interface->good_login();
- }
- else
- {
-
$GLOBALS['phpgw']->interface->failed_login('invalid');
- }
+
$GLOBALS['phpgw']->interface->failed_login('missing');
+ break;
}
- else
+
+ $this->auth = createObject('api_auth');
+ if
(!$this->auth->authenticate($GLOBALS['phpgw_data']['api']['phpgw_user'],
$GLOBALS['phpgw_data']['api']['phpgw_pass']))
+ {
+
$GLOBALS['phpgw']->interface->failed_login('invalid');
+ break;
+ }
+
+ $this->accounts =
createObject('api_accounts',$GLOBALS['phpgw_data']['api']['phpgw_user']);
+ $history =
createObject('api_history');
+ $history->account_id =
$this->accounts->account_id;
+ $new_data = array(
+ 'ip_address' => get_ip(),
+ 'sessionid' => session_id()
+ );
+ $history->set('api.sessions.' .
$history->account_id,$new_data,array());
+
+
$this->session->create($GLOBALS['phpgw_data']['api']['phpgw_user']);
+
unset($GLOBALS['phpgw_data']['api']['phpgw_user']);
+
unset($GLOBALS['phpgw_data']['api']['phpgw_pass']);
+ $this->check_op();
+ if($GLOBALS['phpgw_data']['api']['op'] ==
'api.base.login')
{
-
$GLOBALS['phpgw']->interface->failed_login('missing');
+ $GLOBALS['phpgw_data']['api']['op'] =
'api.base.start';
}
+
unset($_SESSION['phpgw_session']['serialized_classes']);
+ $GLOBALS['phpgw']->interface->good_login();
}
$this->load_base_classes();
}
@@ -523,18 +522,26 @@
}
}
}
-
-
list($GLOBALS['phpgw_data']['flags']['req_app'],$GLOBALS['phpgw_data']['flags']['req_class'],$GLOBALS['phpgw_data']['flags']['req_method'])
= explode('.',$GLOBALS['phpgw_data']['api']['op']);
-
- if (!
validate($GLOBALS['phpgw_data']['flags']['req_app'],'string')
- || !
validate($GLOBALS['phpgw_data']['flags']['req_class'],'string')
- || !
validate($GLOBALS['phpgw_data']['flags']['req_method'],'string'))
+
+ if
(preg_match('/^(\w+)\.(\w+)\.(\w+)$/',$GLOBALS['phpgw_data']['api']['op'],$matches))
{
- $GLOBALS['msgbox']->add('illegal op name',
'fatal');
-
-
unset($GLOBALS['phpgw_data']['flags']['req_app'],$GLOBALS['phpgw_data']['flags']['req_class'],$GLOBALS['phpgw_data']['flags']['req_method']);
+ $GLOBALS['phpgw_data']['flags']['req_app'] =
$matches[1];
+ $GLOBALS['phpgw_data']['flags']['req_class'] =
$matches[2];
+ $GLOBALS['phpgw_data']['flags']['req_method'] =
$matches[3];
+ }
+ /*
+ elseif
(preg_match('/^(\w+)([A-Z]{1}\w+?)\.(\w+)$/',$GLOBALS['phpgw_data']['api']['op'],$matches))
+ {
+ $GLOBALS['phpgw_data']['flags']['req_app'] =
strtolower($matches[1]);
+ $GLOBALS['phpgw_data']['flags']['req_class'] =
strtolower($matches[2]);
+ $GLOBALS['phpgw_data']['flags']['req_method'] =
$matches[3];
+ }
+ */
+ else
+ {
+ trigger_error('illegal op name',E_USER_ERROR);
}
-
+
if (!isset($GLOBALS['phpgw_data']['flags']['req_app']))
{
$GLOBALS['phpgw_data']['flags']['req_app'] =
'api';
@@ -547,7 +554,7 @@
$GLOBALS['phpgw_data']['api']['req_app'] =
$GLOBALS['phpgw_data']['flags']['req_app'];
$GLOBALS['phpgw_data']['api']['prevop'] =
$_SESSION['phpgw_session']['prevop'];
- $_SESSION['phpgw_session']['prevop'] =
$GLOBALS['phpgw_data']['api']['op'];
+ $_SESSION['phpgw_session']['prevop'] =
$GLOBALS['phpgw_data']['api']['op'];
}
function load_docs()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/class.phpgw.php, 1.1.1.1.2.47,
nomail <=