[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/class.account_mgr.php, 1.1.2.33
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/class.account_mgr.php, 1.1.2.33 |
Date: |
Thu, 20 May 2004 15:58:38 -0000 |
Update of /api
Modified Files:
Branch: proposal-branch
class.account_mgr.php
date: 2004/04/16 20:59:48; author: seek3r; state: Exp; lines: +132 -115
Log Message:
bringing savannah cvs back up to date with what we were doing on our private
cvs server. We will not be doing dev from this cvs tree
=====================================================================
No syntax errors detected in -
=====================================================================
Index: api/class.account_mgr.php
diff -u api/class.account_mgr.php:1.1.2.32 api/class.account_mgr.php:1.1.2.33
--- api/class.account_mgr.php:1.1.2.32 Sun Mar 7 22:44:53 2004
+++ api/class.account_mgr.php Fri Apr 16 20:59:48 2004
@@ -25,83 +25,94 @@
/* $Source$ */
$functions = array();
- $functions['api_account_mgr'] = array(
+ $functions['api_account_mgr'] = array
+ (
'type' => 'public',
'abstract' => 'Main page for everything',
'discussion' => 'Default main page'
);
- $functions['start'] = array(
+ $functions['start'] = array
+ (
'type' => 'public',
'title' => 'Show users',
'abstract' => 'List user accounts'
);
- $functions['create'] = array(
+ $functions['create'] = array
+ (
'type' => 'public',
'title' => 'Create user',
'abstract' => 'Create user account',
- 'params' => array(
- 'account_lid' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Login ID'),
- 'account_firstname' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'First Name'),
- 'account_lastname' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Last Name'),
- 'account_password' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Password'),
- 'account_password_confirm' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Password confirmation')
+ 'params' => array
+ (
+ 'account_lid' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Login ID'),
+ 'account_firstname' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'First Name'),
+ 'account_lastname' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Last Name'),
+ 'account_password' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Password'),
+ 'account_password_confirm' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Password confirmation')
)
);
- $functions['edit'] = array(
+ $functions['edit'] = array
+ (
'type' => 'public',
'title' => 'Edit user',
'abstract' => 'Edit user account',
- 'params' => array(
- 'account_id' => array('type' => 'int',
'default' => '##NOTSET##', 'desc' => 'Account ID'),
- 'account_lid' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Login ID'),
- 'account_firstname' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'First Name'),
- 'account_lastname' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Last Name'),
- 'account_password' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Password'),
- 'account_password_confirm' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Password confirmation')
+ 'params' => array
+ (
+ 'account_id' => array('type' => 'int',
'default' => NOTSET, 'desc' => 'Account ID'),
+ 'account_lid' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Login ID'),
+ 'account_firstname' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'First Name'),
+ 'account_lastname' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Last Name'),
+ 'account_password' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Password'),
+ 'account_password_confirm' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Password confirmation')
)
);
- $functions['view'] = array(
+ $functions['view'] = array
+ (
'type' => 'public',
'title' => 'View user',
'abstract' => 'View user account',
- 'params' => array(
- 'account_id' => array('type' => 'int',
'default' => '##NOTSET##', 'desc' => 'Account ID number')
+ 'params' => array
+ (
+ 'account_id' => array('type' => 'int',
'default' => NOTSET, 'desc' => 'Account ID number')
)
);
- $functions['delete'] = array(
+ $functions['delete'] = array
+ (
'type' => 'public',
'title' => 'Delete user',
'abstract' => 'Delete user account',
- 'params' => array(
- 'account_id' => array('type' => 'int',
'default' => '##NOTSET##', 'desc' => 'Account ID number'),
- 'answer' => array('type' => 'any',
'default' => '##NOTSET##', 'desc' => 'Answer to yes no dialog')
+ 'params' => array
+ (
+ 'account_id' => array('type' => 'int',
'default' => NOTSET, 'desc' => 'Account ID number'),
+ 'answer' => array('type' => 'any',
'default' => NOTSET, 'desc' => 'Answer to yes no dialog')
)
);
- $functions['login_history'] = array(
+ $functions['login_history'] = array
+ (
'type' => 'public',
'title' => 'User login history',
'abstract' => 'Show users login history',
- 'params' => array(
- 'account_id' => array('type' => 'int', 'default' =>
'##REQUIRED##', 'desc' => 'Account ID number')
+ 'params' => array
+ (
+ 'account_id' => array('type' => 'int', 'default' =>
REQUIRED, 'desc' => 'Account ID number')
)
);
- $GLOBALS['docs']['api']['classes']['api_account_mgr'] = array(
+ $GLOBALS['docs']['api']['classes']['api_account_mgr'] = array
+ (
'abstract' => 'User account management',
'functions' => $functions
);
- $GLOBALS['api_account_mgr_menus_loaded'] = False;
+ $GLOBALS['api_account_mgr_menus_loaded'] = false;
class api_account_mgr
{
- var $db;
-
function api_account_mgr()
{
if (! $GLOBALS['api_account_mgr_menus_loaded'])
@@ -123,43 +134,44 @@
$GLOBALS['phpgw']->add_xsl('api.account_mgr');
$GLOBALS['phpgw']->add_xsl('api.widgets');
$GLOBALS['phpgw']->add_xsl('api.acl_mgr');
- $GLOBALS['api_account_mgr_menus_loaded'] = True;
+ $GLOBALS['api_account_mgr_menus_loaded'] = true;
}
- $this->db = $GLOBALS['phpgw']->db;
}
function menu_for_this_user()
{
$args = new safe_args();
- $args->set('account_id', '##REQUIRED##', 'int');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args->set('account_id', REQUIRED, 'int');
+ $args = $args->get(func_get_args());
if
($GLOBALS['phpgw']->acl->check('api.account_mgr.create',1,1))
{
- $GLOBALS['phpgw']->add_appmenu('Maintain
user','View this user','api.account_mgr.view&account_id=' .
$args['account_id'],True);
+ $GLOBALS['phpgw']->add_appmenu('Maintain
user','View this user','api.account_mgr.view&account_id=' .
$args['account_id'],true);
}
if
($GLOBALS['phpgw']->acl->check('api.account_mgr.edit',1,1))
{
- $GLOBALS['phpgw']->add_appmenu('Maintain
user','Edit this user','api.account_mgr.edit&account_id=' .
$args['account_id'],True);
+ $GLOBALS['phpgw']->add_appmenu('Maintain
user','Edit this user','api.account_mgr.edit&account_id=' .
$args['account_id'],true);
}
if
($GLOBALS['phpgw']->acl->check('api.account_mgr.delete',1,1))
{
- $GLOBALS['phpgw']->add_appmenu('Maintain
user','Delete this user','api.account_mgr.delete&account_id=' .
$args['account_id'],True);
+ $GLOBALS['phpgw']->add_appmenu('Maintain
user','Delete this user','api.account_mgr.delete&account_id=' .
$args['account_id'],true);
}
if
($GLOBALS['phpgw']->acl->check('api.account_mgr.view',2,1))
{
- $GLOBALS['phpgw']->add_appmenu('Maintain
user','View login history','api.account_mgr.login_history&account_id=' .
$args['account_id'],True);
+ $GLOBALS['phpgw']->add_appmenu('Maintain
user','View login history','api.account_mgr.login_history&account_id=' .
$args['account_id'],true);
}
}
- function account_status()
+ // FIXME: This should be default REQUIRED, it was spitting out
errors
+ // and I didn't have a chance to fix it
+ function _account_status()
{
$args = new safe_args();
- $args->set('account_status', '##REQUIRED##', 'any');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args->set('account_status',NOTSET,'any');
+ $args = $args->get(func_get_args());
// If there is NO value passed, don't return a disabled
... it could be a new account
// This is mainly for history (jengo)
@@ -179,7 +191,7 @@
$args->set('start',0,'int');
$args->set('order','account_lid','string');
$args->set('sort', 'asc', 'string');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args = $args->get(func_get_args());
$args['offset'] =
$GLOBALS['phpgw_data']['prefs']['api.maxmatchs'];
$result['accounts'] =
$GLOBALS['phpgw']->accounts->list_repository($args);
@@ -189,12 +201,12 @@
if
($GLOBALS['phpgw']->acl->check('api.account_mgr.edit',1,1))
{
- $result['edit_allowed'] = True;
+ $result['edit_allowed'] = true;
}
if
($GLOBALS['phpgw']->acl->check('api.account_mgr.delete',1,1))
{
- $result['delete_allowed'] = True;
+ $result['delete_allowed'] = true;
}
return $result;
@@ -203,17 +215,18 @@
function create()
{
$args = new safe_args();
- $args->set('form_submit', 'False', 'any');
- $args->set('acl_advanced_submit','##NOTSET##','any');
- $args->set('account_lid', '##NOTSET##', 'any');
- $args->set('account_firstname', '##NOTSET##', 'any');
- $args->set('account_lastname', '##NOTSET##', 'any');
- $args->set('account_password', '##NOTSET##', 'any');
- $args->set('account_password_confirm', '##NOTSET##',
'any');
+ $args->set('form_submit',array('false','true'),'enum');
+ $args->set('acl_advanced_submit',NOTSET,'any');
+ $args->set('account_lid', NOTSET, 'any');
+ $args->set('account_firstname', NOTSET, 'any');
+ $args->set('account_lastname', NOTSET, 'any');
+ $args->set('account_password', NOTSET, 'any');
+ $args->set('account_password_confirm', NOTSET, 'any');
$args->set('acl_allow',array(),'any');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args = $args->get(func_get_args());
- $result = array(
+ $result = array
+ (
'account_lid' => $args['account_lid'],
'account_firstname' =>
$args['account_firstname'],
'account_lastname' => $args['account_lastname']
@@ -227,52 +240,52 @@
execMethod('api.acl_mgr.account');
}
- else if ($args['form_submit'] == 'True')
+ else if ($args['form_submit'] == 'true')
{
if (! strlen($args['account_lid']))
{
-
$result['missing_fields']['account_lid'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_lid'] = true;
+ $missing_fields = true;
}
if (! strlen($args['account_firstname']))
{
-
$result['missing_fields']['account_firstname'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_firstname'] = true;
+ $missing_fields = true;
}
if (! strlen($args['account_lastname']))
{
-
$result['missing_fields']['account_lastname'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_lastname'] = true;
+ $missing_fields = true;
}
if (! strlen($args['account_password']))
{
-
$result['missing_fields']['account_password'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_password'] = true;
+ $missing_fields = true;
}
if (! strlen($args['account_password_confirm']))
{
-
$result['missing_fields']['account_password_confirm'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_password_confirm'] = true;
+ $missing_fields = true;
}
else if ($args['account_password'] !=
$args['account_password_confirm'])
{
-
$result['missing_fields']['account_password'] = True;
-
$result['missing_fields']['account_password_confirm'] = True;
- $GLOBALS['msgbox']->add(lang('The
passwords you entered do not match'),__LINE__,__FILE__, 'notice');
+
$result['missing_fields']['account_password'] = true;
+
$result['missing_fields']['account_password_confirm'] = true;
+ $GLOBALS['msgbox']->add(lang('The
passwords you entered do not match'), 'notice');
}
else
{
// FIXME: This hasn't been tested yet
-
sanitize($args['account_password'],'password');
+
validate($args['account_password'],'password');
}
if ($missing_fields)
{
- $GLOBALS['msgbox']->add(lang('You
forgot to enter some of the required fields. The missing fields have been
marked'),__LINE__,__FILE__, 'notice');
+ $GLOBALS['msgbox']->add(lang('You
forgot to enter some of the required fields. The missing fields have been
marked'), 'notice');
$GLOBALS['phpgw']->form_lock();
}
else
@@ -288,7 +301,7 @@
$acl =
createObject('api_acl',$account_id);
foreach ($args['acl_allow'] as
$key => $value)
{
- $dbresult =
$GLOBALS['phpgw']->db->execute("select loc_value from phpgw_acl_locations where
loc_op='$key'",__LINE__,__FILE__);
+ $dbresult =
$GLOBALS['phpgw']->db->Execute("select loc_value from phpgw_acl_locations where
loc_op='$key'");
$dbresult->movenext();
if
($dbresult->numrows() &&
$GLOBALS['phpgw']->acl->check($key,$dbresult->fields['loc_value'],$dbresult->fields['loc_value']))
@@ -306,7 +319,7 @@
$obj =
createObject('api_history');
$obj->set('api.accounts.' .
$account_id,$history_data,array());
-
$GLOBALS['msgbox']->add(lang('Account has been created
successfully'),__LINE__,__FILE__, 'notice');
+
$GLOBALS['msgbox']->add(lang('Account has been created successfully'),
'notice');
}
}
@@ -323,14 +336,14 @@
function edit()
{
$args = new safe_args();
- $args->set('edit_account_submit', '##NOTSET##', 'any');
- $args->set('account_id', '##REQUIRED##', 'int');
- $args->set('account_lid', '##NOTSET##', 'any');
- $args->set('account_firstname', '##NOTSET##', 'any');
- $args->set('account_lastname', '##NOTSET##', 'any');
- $args->set('account_password', '##NOTSET##', 'any');
- $args->set('account_password_confirm', '##NOTSET##',
'any');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args->set('edit_account_submit', NOTSET, 'any');
+ $args->set('account_id', REQUIRED, 'int');
+ $args->set('account_lid', NOTSET, 'any');
+ $args->set('account_firstname', NOTSET, 'any');
+ $args->set('account_lastname', NOTSET, 'any');
+ $args->set('account_password', NOTSET, 'any');
+ $args->set('account_password_confirm', NOTSET, 'any');
+ $args = $args->get(func_get_args());
$GLOBALS['phpgw_xml_apinode']->add_node('Edit user
account','title');
$this->menu_for_this_user($args['account_id']);
@@ -338,13 +351,14 @@
if (!
$GLOBALS['phpgw']->accounts->cross_reference((int)$args['account_id']))
{
// This normally shouldn't happen
- $GLOBALS['msgbox']->add(lang('The account you
are tring to edit could not be found'),__LINE__,__FILE__, 'warning');
+ $GLOBALS['msgbox']->add(lang('The account you
are tring to edit could not be found'), 'warning');
return;
}
$account =
createObject('api_accounts',(int)$args['account_id']);
- $result = array(
+ $result = array
+ (
'account_id' => $args['account_id'],
'account_lid' => $args['account_lid'],
'account_firstname' =>
$args['account_firstname'],
@@ -353,42 +367,42 @@
// Yes, this is supposed to be a string, NOT a boolean
value
$result['action_type'] = 'edit_account';
- if ($args['edit_account_submit'] == 'True')
+ if ($args['edit_account_submit'] == 'true')
{
if (! strlen($args['account_lid']))
{
-
$result['missing_fields']['account_lid'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_lid'] = true;
+ $missing_fields = true;
}
if (! strlen($args['account_firstname']))
{
-
$result['missing_fields']['account_firstname'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_firstname'] = true;
+ $missing_fields = true;
}
if (! strlen($args['account_lastname']))
{
-
$result['missing_fields']['account_lastname'] = True;
- $missing_fields = True;
+
$result['missing_fields']['account_lastname'] = true;
+ $missing_fields = true;
}
if (strlen($args['account_password']) ||
strlen($args['account_password_confirm']) && $args['account_password'] !=
$args['account_password_confirm'])
{
-
$result['missing_fields']['account_password'] = True;
-
$result['missing_fields']['account_password_confirm'] = True;
- $GLOBALS['msgbox']->add(lang('The
passwords you entered do not match'),__LINE__,__FILE__, 'notice');
+
$result['missing_fields']['account_password'] = true;
+
$result['missing_fields']['account_password_confirm'] = true;
+ $GLOBALS['msgbox']->add(lang('The
passwords you entered do not match'), 'notice');
}
else
{
// FIXME: This hasn't been tested yet
-
//sanitize($args['account_password'],'password');
+
//validate($args['account_password'],'password');
}
if ($missing_fields)
{
- $GLOBALS['msgbox']->add(lang('You
forgot to enter some of the required fields. The missing fields have been
marked with a *'),__LINE__,__FILE__, 'notice');
+ $GLOBALS['msgbox']->add(lang('You
forgot to enter some of the required fields. The missing fields have been
marked with a *'), 'notice');
$GLOBALS['phpgw']->form_lock();
}
else
@@ -403,7 +417,7 @@
if ($account->save_repository())
{
-
$GLOBALS['msgbox']->add(lang('Account has been updated
successfully'),__LINE__,__FILE__, 'notice');
+
$GLOBALS['msgbox']->add(lang('Account has been updated successfully'),
'notice');
unset($result);
$history_data['account_lid']
= $args['account_lid'];
@@ -432,20 +446,20 @@
function view()
{
$args = new safe_args();
- $args->set('account_id', '##NOTSET##', 'int');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args->set('account_id', NOTSET, 'int');
+ $args = $args->get(func_get_args());
if (!
$GLOBALS['phpgw']->accounts->cross_reference((int)$args['account_id']))
{
// This normally shouldn't happen
- $GLOBALS['msgbox']->add(lang('The account you
are tring to view could not be found'),__LINE__,__FILE__, 'warning');
+ $GLOBALS['msgbox']->add(lang('The account you
are tring to view could not be found'), 'warning');
return;
}
$this->menu_for_this_user($args['account_id']);
$args['account'] = $args['account_id'];
- $accounts =
CreateObject('api_accounts',$args);
+ $accounts =
createObject('api_accounts',$args);
$data = $accounts->data;
$result['expires'] =
strftime('%x',$data['expires']) . date(' h:i:s a',$data['expires']);
@@ -457,15 +471,18 @@
$result['status'] = $accounts->data['status'];
$obj = createObject('api_history');
- $obj->field_desc = array(
+ $obj->field_desc = array
+ (
'account_lid' => lang('Login ID'),
'account_firstname' => lang('First Name'),
'account_lastname' => lang('Last Name'),
'account_status' => lang('Account status')
);
- $obj->field_execmethod['account_status'] =
'api.account_mgr.account_status';
+ $obj->field_execMethod['account_status'] =
'api.account_mgr._account_status';
$result['history_data'] = $obj->get('api.accounts.' .
$args['account_id']);
- $result['acl_options'] =
execMethod('api.acl_mgr.basic',array('account_id' => $args['account_id'],
'acl_check' => False));
+
+ $result['acl_options'] =
execMethod('api.acl_mgr.basic',array('account_id' => $args['account_id'],
'acl_check' => false));
+ $result['datamine'] =
execMethod('api.datamine._get','api.accounts.' . $args['account_id']);
return $result;
}
@@ -473,25 +490,25 @@
function delete()
{
$args = new safe_args();
- $args->set('answer', '##NOVAR##', 'any');
- $args->set('account_id', '##REQUIRED##', 'int');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args->set('answer', NOVAR, 'any');
+ $args->set('account_id', REQUIRED, 'int');
+ $args = $args->get(func_get_args());
$account_lid =
$GLOBALS['phpgw']->accounts->cross_reference((int)$args['account_id']);
if ($args['account_id'] ==
$GLOBALS['phpgw_data']['user']['id'])
{
- $GLOBALS['msgbox']->add(lang('You can not
delete your own account'),__LINE__,__FILE__, 'warning');
+ $GLOBALS['msgbox']->add(lang('You can not
delete your own account'), 'warning');
return;
}
if ($account_lid == 'anonymous')
{
- $GLOBALS['msgbox']->add(lang('You can not
delete the anonymous account'),__LINE__,__FILE__, 'warning');
+ $GLOBALS['msgbox']->add(lang('You can not
delete the anonymous account'), 'warning');
return;
}
- if ($args['answer'] == '##NOVAR##')
+ if ($args['answer'] == NOVAR)
{
$result['dialog'] = array(
'question' => lang('Are you sure you
want to delete the user %s ?',$account_lid),
@@ -505,7 +522,7 @@
)
);
- $result['delete_account'] = True;
+ $result['delete_account'] = true;
}
else if ($args['answer'] == 'Yes')
{
@@ -522,12 +539,12 @@
if ($account_result && $acl_result &&
$history_result)
{
$GLOBALS['phpgw']->db->transaction_commit();
- $GLOBALS['msgbox']->add(lang('The user
%s has been deleted successfully',$account_lid),__LINE__,__FILE__, 'notice');
+ $GLOBALS['msgbox']->add(lang('The user
%s has been deleted successfully',$account_lid), 'notice');
}
else
{
$GLOBALS['phpgw']->db->transaction_abort();
- $GLOBALS['msgbox']->add(lang('There was
a problem deleting the account %s',$account_lid),__LINE__,__FILE__, 'warning');
+ $GLOBALS['msgbox']->add(lang('There was
a problem deleting the account %s',$account_lid), 'warning');
}
}
@@ -537,8 +554,8 @@
function login_history()
{
$args = new safe_args();
- $args->set('account_id','##REQUIRED##','int');
- $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ $args->set('account_id',REQUIRED,'int');
+ $args = $args->get(func_get_args());
$GLOBALS['phpgw_xml_apinode']->add_node(lang('Login
history for
%s',$GLOBALS['phpgw']->accounts->cross_reference((int)$args['account_id'])),'title');
$this->menu_for_this_user($args['account_id']);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/class.account_mgr.php, 1.1.2.33,
nomail <=