formatting

This commit is contained in:
Miles Lott 2002-03-19 02:58:50 +00:00
parent 31e6ac71a4
commit 33549dcf9e
3 changed files with 104 additions and 98 deletions

View File

@ -26,7 +26,7 @@
$GLOBALS['phpgw']->template->set_block('import','ffooter','ffooterhandle');
$GLOBALS['phpgw']->template->set_block('import','imported','importedhandle');
if ($action == 'download' && (!$fieldsep || !$csvfile || !($fp=fopen($csvfile,'r'))))
if($action == 'download' && (!$fieldsep || !$csvfile || !($fp=fopen($csvfile,'rb'))))
{
$action = '';
}
@ -41,7 +41,7 @@
function dump_array($arr)
{
while (list($key,$val) = each($arr))
while(is_array($arr) && (list($key,$val) = each($arr)))
{
$ret .= ($ret ? ',' : '(') . "'$key' => '$val'\n";
}
@ -50,7 +50,7 @@
function index($value,$arr)
{
while (list ($key,$val) = each($arr))
while(is_array($arr) && (list($key,$val) = each($arr)))
{
if($value == $val)
{
@ -238,7 +238,7 @@
$GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
break;
case 'import':
$fp=fopen($csvfile,"r");
$fp=fopen($csvfile,'rb');
$csv_fields = fgetcsv($fp,8000,$fieldsep);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2';
@ -288,7 +288,10 @@
}
$log .= "\t\t<td><b>$addr</b></td>\n";
}
if ($start < 1) $start = 1;
if($start < 1)
{
$start = 1;
}
for($i = 1; $i < $start && fgetcsv($fp,8000,$fieldsep); ++$i); // overread lines before our start-record
for($anz = 0; $anz < $max && ($fields = fgetcsv($fp,8000,$fieldsep)); ++$anz)
@ -314,7 +317,9 @@
$reg = $CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg;
while(ereg($reg,$val,$vars))
{ // expand all CSV fields
$val = str_replace($CPre.$vars[1].$CPos,$val[0] == '@' ? "'".addslashes($fields[index($vars[1],$csv_fields)])."'" : $fields[index($vars[1],$csv_fields)],$val);
$val = str_replace($CPre . $vars[1] . $CPos, $val[0] == '@' ? "'"
. addslashes($fields[index($vars[1], $csv_fields)])
. "'" : $fields[index($vars[1], $csv_fields)], $val);
}
if($val[0] == '@')
{

View File

@ -20,6 +20,7 @@
$setup_info['addressbook']['author'] = 'Joseph Engo, Miles Lott';
$setup_info['addressbook']['note'] = 'The phpgwapi manages contact data. Addressbook manages servers for its remote capability.';
/* Tables */
$setup_info['addressbook']['tables'][] = 'phpgw_addressbook_servers';