Cleanup format and use of HTTP_ vars, intval, etc.

This commit is contained in:
Miles Lott 2003-12-01 00:46:45 +00:00
parent fb8e5b9f8a
commit c77cc462e6
8 changed files with 200 additions and 195 deletions

View File

@ -64,7 +64,7 @@
$this->query = $_query;
}
if(isset($GLOBALS['HTTP_POST_VARS']['fcat_id']) || isset($GLOBALS['HTTP_POST_VARS']['fcat_id']))
if(isset($_POST['fcat_id']) || isset($_POST['fcat_id']))
{
$this->cat_id = $_fcat_id;
}

View File

@ -243,7 +243,7 @@
}
for($i=0;$i<count($dirty);$i++)
{
if(gettype($dirty[$i]) == 'array')
if(@is_array($dirty[$i]))
{
while(list($name,$value) = @each($dirty[$i]))
{
@ -299,7 +299,7 @@
srand((double)microtime() * 1000000);
$random_number = rand(100000000,999999999);
$newfilename = md5("$uploadedfile, $uploadedfile_name, "
. time() . getenv("REMOTE_ADDR") . $random_number );
. time() . getenv('REMOTE_ADDR') . $random_number);
copy($uploadedfile, $uploaddir . $newfilename);
$ftp = fopen($uploaddir . $newfilename . '.info','w');
@ -391,13 +391,13 @@
{
if(!is_array($addr))
{
$id = intval($addr);
$id = (int)$addr;
}
else
{
if(is_numeric($addr[0])) // xmlrpc liefert array($id)
{
$id = intval($addr[0]);
$id = (int)$addr[0];
}
else
{

View File

@ -141,15 +141,17 @@
$jselect = ' onChange="this.form.submit();"';
}
/* Setup all and none first */
$cats_link = "\n" .'<select name="fcat_id'.($multiple?'[]':'').'"' .$jselect . ($multiple ? 'multiple size="3"' : '') . ">\n";
$cats_link = "\n" . '<select name="fcat_id'
. ($multiple?'[]':'') . '"' . $jselect
. ($multiple ? 'multiple size="3"' : '') . ">\n";
if(!$notall)
{
$cats_link .= '<option value=""';
if ($cat_id=="all")
if($cat_id == 'all')
{
$cats_link .= ' selected';
}
$cats_link .= '>'.lang("all").'</option>'."\n";
$cats_link .= '>' . lang('all') . '</option>' . "\n";
}
/* Get global and app-specific category listings */
@ -473,7 +475,10 @@
/* Some fields require special formatting. */
if($column[0] == 'url')
{
if ( !empty($coldata) && (substr($coldata,0,7) != 'http://') ) { $coldata = 'http://' . $coldata; }
if(!empty($coldata) && (substr($coldata,0,7) != 'http://'))
{
$coldata = 'http://' . $coldata;
}
$ref='<a href="'.$coldata.'" target="_new">';
$data=$coldata.'</a>';
}
@ -920,7 +925,7 @@
{
if($contactscat)
{
$catinfo = $this->cat->return_single(intval($contactscat));
$catinfo = $this->cat->return_single((int)$contactscat);
$catname .= $catinfo[0]['name'] . '; ';
}
}
@ -932,7 +937,7 @@
else
{
$fields[0]['cat_id'] = ereg_replace(',','',$fields[0]['cat_id']);
$catinfo = $this->cat->return_single(intval($fields[0]['cat_id']));
$catinfo = $this->cat->return_single((int)$fields[0]['cat_id']);
$catname = $catinfo[0]['name'];
if(!$this->cat_id)
{
@ -1015,7 +1020,7 @@
{
$prefs = $_POST['prefs'];
$other = $_POST['other'];
$fcat_id = intval($_POST['fcat_id']);
$fcat_id = (int)$_POST['fcat_id'];
$custom = $this->fields->read_custom_fields();
$customfields = array();
@ -1418,7 +1423,7 @@
}
}
if ($format != "view")
if($format != 'view')
{
/* Preferred phone number radio buttons */
$pref[0] = '<font size="-2">';
@ -1432,7 +1437,7 @@
}
$str[$name] .= '>';
$str[$name] = $pref[0].$str[$name].$pref[1];
$GLOBALS['phpgw']->template->set_var("pref_".$name,$str[$name]);
$GLOBALS['phpgw']->template->set_var('pref_' . $name,$str[$name]);
}
if(strlen($bday) > 2)
@ -1567,12 +1572,12 @@
}
$birthday = $GLOBALS['phpgw']->common->dateformatorder($bday_year,$bday_month,$bday_day)
. '<font face="'.$theme["font"].'" size="-2">'.lang('(e.g. 1969)').'</font>';
. '<font face="' . $theme['font'] . '" size="-2">' . lang('(e.g. 1969)') . '</font>';
if($format == 'edit')
{
$create .= '<tr bgcolor="' . $GLOBALS['phpgw_info']['theme']['th_bg'] . '"><td colspan="2"><font size="-1">' . lang("Created by") . ':</font></td>'
$create .= '<tr bgcolor="' . $GLOBALS['phpgw_info']['theme']['th_bg'] . '"><td colspan="2"><font size="-1">' . lang('Created by') . ':</font></td>'
. '<td colspan="3"><font size="-1">'
. $GLOBALS['phpgw']->common->grab_owner_name($fields["owner"]);
. $GLOBALS['phpgw']->common->grab_owner_name($fields['owner']);
}
else
{

View File

@ -45,10 +45,10 @@
));
$GLOBALS['phpgw']->template->set_block('field_list_t','field_list','list');
$field = $GLOBALS['HTTP_POST_VARS']['field'];
$start = $GLOBALS['HTTP_POST_VARS']['start'] ? $GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start'];
$query = $GLOBALS['HTTP_POST_VARS']['query'] ? $GLOBALS['HTTP_POST_VARS']['query'] : $GLOBALS['HTTP_GET_VARS']['query'];
$sort = $GLOBALS['HTTP_POST_VARS']['sort'] ? $GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort'];
$field = $_POST['field'];
$start = $_POST['start'] ? $_POST['start'] : $_GET['start'];
$query = $_POST['query'] ? $_POST['query'] : $_GET['query'];
$sort = $_POST['sort'] ? $_POST['sort'] : $_GET['sort'];
$common_hidden_vars =
'<input type="hidden" name="sort" value="' . $sort . '">' . "\n"
@ -134,12 +134,12 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
$field = stripslashes($GLOBALS['HTTP_POST_VARS']['field']);
$field_name = stripslashes($GLOBALS['HTTP_POST_VARS']['field_name']);
$start = $GLOBALS['HTTP_POST_VARS']['start'];
$query = $GLOBALS['HTTP_POST_VARS']['query'];
$sort = $GLOBALS['HTTP_POST_VARS']['sort'];
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
$field = stripslashes($_POST['field']);
$field_name = stripslashes($_POST['field_name']);
$start = $_POST['start'];
$query = $_POST['query'];
$sort = $_POST['sort'];
$submit = $_POST['submit'];
$GLOBALS['phpgw']->template->set_file(array('form' => 'field_form.tpl'));
$GLOBALS['phpgw']->template->set_block('form','add','addhandle');
@ -211,12 +211,12 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
$field = stripslashes($GLOBALS['HTTP_POST_VARS']['field'] ? $GLOBALS['HTTP_POST_VARS']['field'] : $GLOBALS['HTTP_GET_VARS']['field']);
$field_name = stripslashes($GLOBALS['HTTP_POST_VARS']['field_name']);
$start = $GLOBALS['HTTP_POST_VARS']['start'] ? $GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start'];
$query = $GLOBALS['HTTP_POST_VARS']['query'] ? $GLOBALS['HTTP_POST_VARS']['query'] : $GLOBALS['HTTP_GET_VARS']['query'];
$sort = $GLOBALS['HTTP_POST_VARS']['sort'] ? $GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort'];
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
$field = stripslashes($_POST['field'] ? $_POST['field'] : $_GET['field']);
$field_name = stripslashes($_POST['field_name']);
$start = $_POST['start'] ? $_POST['start'] : $_GET['start'];
$query = $_POST['query'] ? $_POST['query'] : $_GET['query'];
$sort = $_POST['sort'] ? $_POST['sort'] : $_GET['sort'];
$submit = $_POST['submit'];
if(!$field)
{
@ -304,18 +304,18 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
$field = $GLOBALS['HTTP_POST_VARS']['field'] ? $GLOBALS['HTTP_POST_VARS']['field'] : $GLOBALS['HTTP_GET_VARS']['field'];
$field_id = $GLOBALS['HTTP_POST_VARS']['field_id'] ? $GLOBALS['HTTP_POST_VARS']['field_id'] : $GLOBALS['HTTP_GET_VARS']['field_id'];
$start = $GLOBALS['HTTP_POST_VARS']['start'] ? $GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start'];
$query = $GLOBALS['HTTP_POST_VARS']['query'] ? $GLOBALS['HTTP_POST_VARS']['query'] : $GLOBALS['HTTP_GET_VARS']['query'];
$sort = $GLOBALS['HTTP_POST_VARS']['sort'] ? $GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort'];
$field = $_POST['field'] ? $_POST['field'] : $_GET['field'];
$field_id = $_POST['field_id'] ? $_POST['field_id'] : $_GET['field_id'];
$start = $_POST['start'] ? $_POST['start'] : $_GET['start'];
$query = $_POST['query'] ? $_POST['query'] : $_GET['query'];
$sort = $_POST['sort'] ? $_POST['sort'] : $_GET['sort'];
if(!$field)
{
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uifields.index'));
}
if($GLOBALS['HTTP_POST_VARS']['confirm'])
if($_POST['confirm'])
{
$this->save_custom_field($field);
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',"menuaction=addressbook.uifields.index&start=$start&query=$query&sort=$sort"));

View File

@ -14,12 +14,12 @@
$contacts = CreateObject('phpgwapi.contacts');
if(intval($GLOBALS['HTTP_POST_VARS']['new_owner'])==0)
if((int)$_POST['new_owner'] == 0)
{
$contacts->delete_all(intval($GLOBALS['HTTP_POST_VARS']['account_id']));
$contacts->delete_all((int)$_POST['account_id']);
}
else
{
$contacts->change_owner(intval($GLOBALS['HTTP_POST_VARS']['account_id']),intval($GLOBALS['HTTP_POST_VARS']['new_owner']));
$contacts->change_owner((int)$_POST['account_id'],(int)$_POST['new_owner']);
}
?>

View File

@ -30,7 +30,7 @@
'n_family' => 'n_family',
'bday' => 'bday'
);
$now = time() - ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
$now = time() - ((60 * 60) * (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']);
$today = $GLOBALS['phpgw']->common->show_date($now,'n/d/');
$bdays = $c->read(0,15,$qfields,$today,'tid=n','','',$GLOBALS['phpgw_info']['user']['account_id']);

View File

@ -33,7 +33,7 @@
'n_family' => 'n_family',
'bday' => 'bday'
);
$now = time() - ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
$now = time() - ((60 * 60) * (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']);
$today = $GLOBALS['phpgw']->common->show_date($now,'n/d/');
// echo $today."\n";