intval, ereg_, and gettype updates

This commit is contained in:
Miles Lott 2003-12-20 18:51:51 +00:00
parent 0e9e0c2da2
commit 5a1f288b96
8 changed files with 55 additions and 55 deletions

View File

@ -83,7 +83,7 @@
return False;
}
$account_id = intval($_POST['account_id']);
$account_id = (int)$_POST['account_id'];
$GLOBALS['phpgw']->db->lock(
Array(
@ -98,8 +98,8 @@
@reset($old_group_list);
while($old_group_list && $id = each($old_group_list))
{
$GLOBALS['phpgw']->acl->delete_repository('phpgw_group',$account_id,intval($id[1]));
$GLOBALS['phpgw']->session->delete_cache(intval($id[1]));
$GLOBALS['phpgw']->acl->delete_repository('phpgw_group',$account_id,(int)$id[1]);
$GLOBALS['phpgw']->session->delete_cache((int)$id[1]);
}
$GLOBALS['phpgw']->acl->delete_repository('%%','run',$account_id);
@ -205,7 +205,7 @@
@reset($account_apps);
$group_info = Array(
'account_id' => ($_POST['account_id']?intval($_POST['account_id']):0),
'account_id' => ($_POST['account_id']?(int)$_POST['account_id']:0),
'account_name' => ($_POST['account_name']?$_POST['account_name']:''),
'account_user' => $account_user,
'account_apps' => $account_apps
@ -334,12 +334,12 @@
{
if(!in_array($userData['account_primary_group'],$userData['account_groups']))
{
$userData['account_groups'][] = intval($userData['account_primary_group']);
$userData['account_groups'][] = (int)$userData['account_primary_group'];
}
}
else
{
$userData['account_groups'] = array(intval($userData['account_primary_group']));
$userData['account_groups'] = array((int)$userData['account_primary_group']);
}
// when does the account expire
@ -420,7 +420,7 @@
@reset($account_apps);
$group_info = Array(
'account_id' => ($_POST['account_id']?intval($_POST['account_id']):0),
'account_id' => ($_POST['account_id']?(int)$_POST['account_id']:0),
'account_name' => ($_POST['account_name']?$_POST['account_name']:''),
'account_user' => $account_user,
'account_apps' => $account_apps
@ -593,7 +593,7 @@
);
if ($userData['account_primary_group'] && (!isset($userData['account_groups']) || !in_array($userData['account_primary_group'],$userData['account_groups'])))
{
$userData['account_groups'][] = intval($userData['account_primary_group']);
$userData['account_groups'][] = (int)$userData['account_primary_group'];
}
if ($_POST['expires'] !== '' && !$_POST['never_expires'])
{
@ -644,19 +644,19 @@
}
elseif($_POST['submit'])
{
$acl = CreateObject('phpgwapi.acl',intval($_POST['account_id']));
$acl = CreateObject('phpgwapi.acl',(int)$_POST['account_id']);
$users = $GLOBALS['phpgw']->accounts->member($_POST['account_id']);
@reset($users);
while($managers && list($key,$user) = each($users))
{
$acl->add_repository('phpgw_group',intval($_POST['account_id']),$user['account_id'],1);
$acl->add_repository('phpgw_group',(int)$_POST['account_id'],$user['account_id'],1);
}
$managers = $_POST['managers'];
@reset($managers);
while($managers && list($key,$manager) = each($managers))
{
$acl->add_repository('phpgw_group',intval($_POST['account_id']),$manager,(1 + PHPGW_ACL_GROUP_MANAGERS));
$acl->add_repository('phpgw_group',(int)$_POST['account_id'],$manager,(1 + PHPGW_ACL_GROUP_MANAGERS));
}
}
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
@ -813,7 +813,7 @@
),False,True); // called for every app now, not only enabled ones)
}
$apps = CreateObject('phpgwapi.applications',array(intval($_userData['account_id']),'u'));
$apps = CreateObject('phpgwapi.applications',array((int)$_userData['account_id'],'u'));
$apps->account_id = $_userData['account_id'];
if ($_userData['account_permissions'])
@ -873,7 +873,7 @@
{
$GLOBALS['phpgw']->acl->delete_repository('preferences','changepassword',$_userData['account_id']);
}
$GLOBALS['phpgw']->session->delete_cache(intval($_userData['account_id']));
$GLOBALS['phpgw']->session->delete_cache((int)$_userData['account_id']);
}
function load_group_users($account_id)
@ -918,7 +918,7 @@
function load_group_apps($account_id)
{
$apps = CreateObject('phpgwapi.applications',intval($account_id));
$apps = CreateObject('phpgwapi.applications',(int)$account_id;
$app_list = $apps->read_account_specific();
$account_apps = Array();
while(list($key,$app) = each($app_list))

View File

@ -68,7 +68,8 @@
}
}
if ( gettype($head['_cols'])=="NULL")
// if(gettype($head['_cols'])=="NULL")
if(@is_null($head['_cols']))
{
$cols = $this->arr_keys($rows[0]);
}
@ -271,7 +272,8 @@
}
else
{
if ( gettype($head['_cols'])=="NULL")
// if(gettype($head['_cols'])=="NULL")
if(@is_null($head['_cols']))
{
$cols = $this->arr_keys($rows[0]);
}

View File

@ -24,7 +24,7 @@
function list_servers($data='',&$total)
{
if(gettype($data) == 'array')
if(@is_array($data))
{
if($this->debug) { _debug_array($data); }
list($start,$sort,$order,$query,$limit) = $data;

View File

@ -188,7 +188,7 @@
if(isset($_POST['start']))
{
$start = intval($_POST['start']);
$start = (int)$_POST['start'];
}
else
{
@ -391,7 +391,7 @@
$p->set_var('message_display',lang('Are you sure you want to delete this group ?'));
$p->parse('messages','message_row');
$old_group_list = $GLOBALS['phpgw']->acl->get_ids_for_location(intval($_GET['account_id']),1,'phpgw_group');
$old_group_list = $GLOBALS['phpgw']->acl->get_ids_for_location((int)$_GET['account_id'],1,'phpgw_group');
if($old_group_list)
{
@ -428,7 +428,6 @@
/*
$p->parse('yes','form_button');
$var = Array(
'submit_button' => lang('Submit'),
'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
@ -494,11 +493,11 @@
$cdid = $cd;
settype($cd,'integer');
$cd = ($_GET['cd']?$_GET['cd']:intval($cdid));
$cd = ($_GET['cd']?$_GET['cd']:(int)$cdid);
$accountid = $account_id;
settype($account_id,'integer');
$account_id = ($_GET['account_id']?$_GET['account_id']:intval($accountid));
$account_id = ($_GET['account_id'] ? $_GET['account_id'] : (int)$accountid);
// todo
// not needed if i use the same file for new groups too
@ -509,7 +508,7 @@
else
{
$group_info = Array(
'account_id' => intval($_GET['account_id']),
'account_id' => (int)$_GET['account_id'],
'account_name' => $GLOBALS['phpgw']->accounts->id2name($_GET['account_id']),
'account_user' => $this->bo->load_group_users($_GET['account_id']),
'account_apps' => $this->bo->load_group_apps($_GET['account_id'])
@ -551,11 +550,11 @@
$cdid = $cd;
settype($cd,'integer');
$cd = ($_GET['cd']?$_GET['cd']:intval($cdid));
$cd = ($_GET['cd']?$_GET['cd']:(int)$cdid);
$accountid = $account_id;
settype($account_id,'integer');
$account_id = intval($_GET['account_id'] ? $_GET['account_id'] : $accountid);
$account_id = (int)($_GET['account_id'] ? $_GET['account_id'] : $accountid);
// todo
// not needed if i use the same file for new users too
@ -611,14 +610,14 @@
$t->parse('password_fields','form_logininfo',True);
$account = CreateObject('phpgwapi.accounts',intval($_GET['account_id']),'u');
$account = CreateObject('phpgwapi.accounts',(int)$_GET['account_id'],'u');
$userData = $account->read_repository();
$var['account_lid'] = $userData['account_lid'];
$var['account_firstname'] = $userData['firstname'];
$var['account_lastname'] = $userData['lastname'];
$acl = CreateObject('phpgwapi.acl',intval($_GET['account_id']));
$acl = CreateObject('phpgwapi.acl',(int)$_GET['account_id']);
$var['anonymous'] = $acl->check('anonymous',1,'phpgwapi') ? '  X' : ' ';
$var['changepassword'] = $acl->check('changepassword',0xFFFF,'preferences') ? '  X' : ' ';
unset($acl);
@ -663,8 +662,8 @@
}
// Find out which groups they are members of
$usergroups = $account->membership(intval($_GET['account_id']));
if (gettype($usergroups) != 'array')
$usergroups = $account->membership((int)$_GET['account_id']);
if(!@is_array($usergroups))
{
$var['groups_select'] = lang('None');
}
@ -683,7 +682,7 @@
// create list of available app
$i = 0;
$availableApps = $GLOBALS['phpgw_info']['apps'];
@asort($availableApps);
@reset($availableApps);
@ -698,7 +697,7 @@
}
// create apps output
$apps = CreateObject('phpgwapi.applications',intval($_GET['account_id']));
$apps = CreateObject('phpgwapi.applications',(int)$_GET['account_id']);
$db_perms = $apps->read_account_specific();
@reset($db_perms);
@ -744,11 +743,11 @@
$cdid = $cd;
settype($cd,'integer');
$cd = ($_GET['cd']?$_GET['cd']:intval($cdid));
$cd = ($_GET['cd']?$_GET['cd']:(int)$cdid);
$accountid = $account_id;
settype($account_id,'integer');
$account_id = ($_GET['account_id']?$_GET['account_id']:intval($accountid));
$account_id = (int)($_GET['account_id'] ? $_GET['account_id'] : $accountid);
// todo
// not needed if i use the same file for new groups too
@ -759,7 +758,7 @@
else
{
$group_info = Array(
'account_id' => intval($_GET['account_id']),
'account_id' => (int)$_GET['account_id'],
'account_name' => $GLOBALS['phpgw']->accounts->id2name($_GET['account_id']),
'account_user' => $GLOBALS['phpgw']->accounts->member($_GET['account_id']),
'account_managers' => $this->bo->load_group_managers($_GET['account_id'])
@ -817,8 +816,8 @@
$ac_name = $GLOBALS['phpgw']->accounts->get_account_data($ac_id);
$user_list .= '<option value="' . $ac_id . '" selected>'
. $GLOBALS['phpgw']->common->display_fullname($ac_name[$ac_id]['lid'],$ac_name[$ac_id]['firstname'],$ac_name[$ac_id]['lastname'])
. '</option>'."\n";
. $GLOBALS['phpgw']->common->display_fullname($ac_name[$ac_id]['lid'],$ac_name[$ac_id]['firstname'],$ac_name[$ac_id]['lastname'])
. '</option>'."\n";
}
$account_num = count($group_info['account_user']);
$p->set_var('select_size',($account_num < 25?$account_num:25));
@ -834,7 +833,7 @@
while (list($key,$entry) = each($account_list))
{
$user_list .= '<option value="' . $entry['account_id'] . '"'
. $group_info['account_user'][intval($entry['account_id'])] . '>'
. $group_info['account_user'][(int)$entry['account_id']] . '>'
. $GLOBALS['phpgw']->common->display_fullname(
$entry['account_lid'],
$entry['account_firstname'],
@ -959,8 +958,8 @@
{
$userData = Array();
$userData=$_userData;
$userData['account_firstname'] = $userData['firstname'];
$userData['account_lastname'] = $userData['lastname'];
$userData['account_firstname'] = $userData['firstname'];
$userData['account_lastname'] = $userData['lastname'];
@reset($userData['account_groups']);
while (list($key, $value) = @each($userData['account_groups']))
{
@ -974,7 +973,7 @@
{
if($_account_id)
{
$account = CreateObject('phpgwapi.accounts',intval($_account_id),'u');
$account = CreateObject('phpgwapi.accounts',(int)$_account_id,'u');
$userData = $account->read_repository();
$userGroups = $account->membership($_account_id);
$acl = CreateObject('phpgwapi.acl',$_account_id);
@ -1165,7 +1164,7 @@
}
$var = Array(
'groups_select'
'groups_select'
=> '<select name="account_groups[]" multiple>'."\n".$groups_select.'</select>'."\n",
'primary_group_select'
=> '<select name="account_primary_group">'."\n".$primary_group_select.'</select>'."\n",
@ -1197,7 +1196,7 @@
while (list($key,$entry) = each($account_list))
{
$user_list .= '<option value="' . $entry['account_id'] . '"'
. $group_info['account_managers'][intval($entry['account_id'])] . '>'
. $group_info['account_managers'][(int)$entry['account_id']] . '>'
. $GLOBALS['phpgw']->common->grab_owner_name($entry['account_id'])
. '</option>'."\n";
}
@ -1211,7 +1210,7 @@
$t->set_file(
Array(
'manager' =>'group_manager.tpl'
'manager' =>'group_manager.tpl'
)
);
@ -1235,6 +1234,5 @@
$t->pfp('out','form');
}
}
?>

View File

@ -23,7 +23,7 @@
function uiaclmanager()
{
$this->account_id = intval($_GET['account_id']);
$this->account_id = (int)$_GET['account_id'];
if (!$this->account_id || $GLOBALS['phpgw']->acl->check('account_access',64,'admin'))
{
$GLOBALS['phpgw']->redirect_link('/index.php');

View File

@ -262,12 +262,12 @@
function add()
{
$new_parent = $_POST['new_parent'];
$cat_parent = intval(get_var('cat_parent',array('POST','GET')));
$cat_parent = (int)(get_var('cat_parent',array('POST','GET')));
$cat_name = $_POST['cat_name'];
$cat_description = $_POST['cat_description'];
if ($new_parent)
{
$cat_parent = intval($new_parent);
$cat_parent = (int)$new_parent;
}
if (!$this->acl_add && $cat_parent == 0 || !$this->acl_add_sub && $cat_parent != 0)
@ -328,11 +328,11 @@
function edit()
{
$new_parent = intval($_POST['new_parent']);
$cat_parent = intval($_POST['cat_parent']);
$new_parent = (int)$_POST['new_parent'];
$cat_parent = (int)$_POST['cat_parent'];
$cat_name = $_POST['cat_name'];
$cat_description = $_POST['cat_description'];
$old_parent = intval($_POST['old_parent']);
$old_parent = (int)$_POST['old_parent'];
if ($new_parent)
{

View File

@ -174,7 +174,7 @@
$t->set_var($value,lang($newval));
break;
case 'value':
$newval = ereg_replace(' ','_',$newval);
$newval = str_replace(' ','_',$newval);
/* Don't show passwords in the form */
if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value))
{
@ -187,7 +187,7 @@
break;
/*
case 'checked':
$newval = ereg_replace(' ','_',$newval);
$newval = str_replace(' ','_',$newval);
if ($current_config[$newval])
{
$t->set_var($value,' checked');
@ -219,7 +219,7 @@
}
break;
case 'hook':
$newval = ereg_replace(' ','_',$newval);
$newval = str_replace(' ','_',$newval);
if(function_exists($newval))
{
$t->set_var($value,$newval($current_config));

View File

@ -247,8 +247,8 @@
$server_info = array(
'server_name' => addslashes($_POST['server_name']),
'server_url' => addslashes($_POST['server_url']),
'trust_level' => intval($_POST['trust_level']),
'trust_rel' => intval($_POST['trust_rel']),
'trust_level' => (int)$_POST['trust_level'],
'trust_rel' => (int)$_POST['trust_rel'],
'username' => addslashes($_POST['server_username']),
'password' => $_POST['server_password'] ? $_POST['server_password'] : $server['password'],
'server_mode' => addslashes($_POST['server_mode']),