'; echo '
'; print fetchmail_edit_row($formvars); } else { # display mode print '
'; print ''; print "\n"; print " \n"; print " \n"; print " \n"; print " \n"; foreach($headers as $row){ list($editible,$view,$type,$title,$comment)=$row; print " \n"; } print ""; print ""; print " \n"; if (sizeof ($tFmail) > 0){ foreach($tFmail as $row){ print " \n"; foreach($row as $key=>$val){ if (!isset($fm_struct[$key])) continue; # TODO: not really nice, but avoids undefined index warnings ;-) list($editible,$view,$type)=$fm_struct[$key]; if ($view){ $func="_listview_".$type; print " \n"; } } print ""; print " \n"; print " \n"; } } print "

".$PALANG['pFetchmail_welcome'].$user_domains."

" . $title . "  
" . (function_exists($func)?$func($val):$val) . "" . $PALANG['edit'] . "" . $PALANG['del'] . "
"; print "

\n"; print "

\n"; print "
\n"; print "

".$PALANG['pFetchmail_new_entry']."

\n"; } # end display mode function fetchmail_edit_row($data=array()){ global $fm_struct,$fm_defaults,$PALANG; $id=$data["id"]; $_id=$data["id"]*100+1; $ret=""; $ret .= ''; # TODO: $formvars possibly contains db-specific boolean values # TODO: no problems with MySQL, to be tested with PgSQL # TODO: undefined values may also occour foreach($fm_struct as $key=>$struct){ list($editible,$view,$type)=$struct; $title = $PALANG['pFetchmail_field_' . $key]; $comment = $PALANG['pFetchmail_desc_' . $key]; if ($editible){ $ret.=""; $ret.="\n"; } elseif($view){ $func="_view_".$type; $val=isset($data[$key]) ?(function_exists($func) ?$func($data[$key]) :nl2br($data[$key]) ) :"--x--"; $ret.=""; $ret.="\n"; } } $ret.="\n"; $ret.="

' . $PALANG['pMenu_fetchmail'] . '

"; $func="_edit_".$type; if (! function_exists($func)) $func="_edit_text"; $val=isset($data[$key]) ?$data[$key] :(! is_array($fm_defaults[$key]) ?$fm_defaults[$key] :'' ); $fm_defaults_key = ""; if (isset($fm_defaults[$key])) $fm_defaults_key = $fm_defaults[$key]; $ret.=$func($_id++,$key,$fm_defaults_key,$val); $ret.=" ${comment}
${title}: ".$val; $ret.=" ${comment}
  "; if ($id){ $ret.=""; } $ret.="
\n"; $ret.="

\n"; $ret.="\n"; $ret.="\n"; return $ret; } function _edit_text($id,$key,$def_vals,$val=""){ $val=htmlspecialchars($val); return ""; } function _edit_password($id,$key,$def_vals,$val=""){ $val=preg_replace("{.}","*",$val); return ""; } function _edit_num($id,$key,$def_vals,$val=""){ $val=(int)($val); return ""; } function _edit_bool($id,$key,$def_vals,$val=""){ $ret="${val}"; } function _edit_enum($id,$key,$def_vals,$val=""){ $ret="