require_once('../src/validate.php');
require_once('../functions/strings.php');
+require_once('../functions/html.php');
/* Function to include JavaScript code */
function insert_javascript() {
insert_javascript();
$line = 0;
- echo '<TABLE BORDER="0" WIDTH="98%" ALIGN=center>' .
- '<TR BGCOLOR="' . $color[9] . '"><TH ALIGN=left> ' .
- '<TH ALIGN=left> ' . _("Name") .
- '<TH ALIGN=left> ' . _("E-mail") .
- '<TH ALIGN=left> ' . _("Info");
+ echo html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) .
+ html_tag( 'tr', '', '', $color[9] ) .
+ html_tag( 'th', ' ', 'left' ) .
+ html_tag( 'th', ' ' . _("Name"), 'left' ) .
+ html_tag( 'th', ' ' . _("E-mail"), 'left' ) .
+ html_tag( 'th', ' ' . _("Info"), 'left' );
if ($includesource) {
- echo '<TH ALIGN=left WIDTH="10%"> ' . _("Source");
+ echo html_tag( 'th', ' ' . _("Source"), 'left', 'width="10%"' );
}
- echo "</TR>\n";
+ echo "</tr>\n";
while (list($undef, $row) = each($res)) {
- echo '<tr';
- if ($line % 2) { echo ' bgcolor="' . $color[0] . '"'; }
- echo ' nowrap><td valign=top nowrap align=center width="5%">' .
+ $tr_bgcolor = '';
+ if ($line % 2) { $tr_bgcolor = $color[0]; }
+ echo html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) .
+ html_tag( 'td',
'<small><a href="javascript:to_address(' .
"'" . $row['email'] . "');\">To</A> | " .
'<a href="javascript:cc_address(' .
"'" . $row['email'] . "');\">Cc</A> | " .
'<a href="javascript:bcc_address(' .
- "'" . $row['email'] . "');\">Bcc</A></small>" .
- '<td nowrap valign=top> ' .
- $row['name'] . '<td valign=top>' .
+ "'" . $row['email'] . "');\">Bcc</A></small>",
+ 'center', '', 'valign="top" width="5%" nowrap' ) .
+ html_tag( 'td', ' ' . $row['name'], 'left', '', 'valign="top" nowrap' ) .
+ html_tag( 'td', ' ' .
'<a href="javascript:to_and_close(' .
- "'" . $row['email'] . "');\">" . $row['email'] . '</A>' .
- '<td valign=top nowrap>' . $row['label'];
+ "'" . $row['email'] . "');\">" . $row['email'] . '</A>'
+ , 'left', '', 'valign="top"' ) .
+ html_tag( 'td', $row['label'], 'left', '', 'valign="top" nowrap' );
if ($includesource) {
- echo '<td nowrap valign=top> ' . $row['source'];
+ echo html_tag( 'td', ' ' . $row['source'], 'left', '', 'valign="top" nowrap' );
}
- echo "</TR>\n";
+ echo "</tr>\n";
$line++;
}
- echo '</TABLE>';
+ echo '</table>';
}
/* ================= End of functions ================= */
/* Empty search */
if (empty($query) && empty($show) && empty($listall)) {
- echo '<P ALIGN=center><BR>' .
- _("No persons matching your search was found") .
- "</P>\n</BODY></HTML>\n",
+ echo html_tag( 'p', '<br>' .
+ _("No persons matching your search was found"),
+ 'center' ) .
+ "\n</BODY></HTML>\n",
exit;
}
if ($show == 'form' && empty($listall)) {
echo '<FORM NAME=sform TARGET=abookres ACTION="addrbook_search.php'.
'" METHOD="POST">' . "\n" .
- '<TABLE BORDER="0" WIDTH="100%" HEIGHT="100%">' .
- '<TR><TD NOWRAP VALIGN=middle align=left width=10%>' . "\n" .
- ' <STRONG>' . _("Search for") . "</STRONG>\n" .
- ' </TD><TD align=left><INPUT TYPE=text NAME=query VALUE="' . htmlspecialchars($query) .
- "\" SIZE=28>\n";
+ html_tag( 'table', '', '', '', 'border="0" width="100%" height="100%"' ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', ' <strong>' . _("Search for") . "</strong>\n", 'left', '', 'nowrap valign="middle" width="10%"' ) .
+ html_tag( 'td', '', 'left', '', '' ) .
+ '<INPUT TYPE=text NAME=query VALUE="' . htmlspecialchars($query) .
+ "\" SIZE=28>\n";
/* List all backends to allow the user to choose where to search */
if ($abook->numbackends > 1) {
echo '<INPUT TYPE=hidden NAME=backend VALUE=-1>' . "\n";
}
- echo '</TD></TR><TR><TD></TD><TD align=left>'.
- '<INPUT TYPE=submit VALUE="' . _("Search") . '" NAME=show>' .
- ' | <INPUT TYPE=submit VALUE="' . _("List all") .
- '" NAME=listall>' . "\n" .
- ' | <INPUT TYPE=button VALUE="' . _("Close") .
- '" onclick="parent.close();">' . "\n" .
- '</TD></TR></TABLE></FORM>' . "\n";
+ echo '</td></tr>' .
+ html_tag( 'tr',
+ html_tag( 'td', '', 'left' ) .
+ html_tag( 'td',
+ '<INPUT TYPE=submit VALUE="' . _("Search") . '" NAME=show>' .
+ ' | <INPUT TYPE=submit VALUE="' . _("List all") .
+ '" NAME=listall>' . "\n" .
+ ' | <INPUT TYPE=button VALUE="' . _("Close") .
+ '" onclick="parent.close();">' . "\n" ,
+ 'left' )
+ ) .
+ '</table></form>' . "\n";
} else {
/* Show personal addressbook */
usort($res,'alistcmp');
display_result($res, false);
} else {
- echo '<P ALIGN=center><STRONG>' .
- sprintf(_("Unable to list addresses from %s"),
- $abook->backends[$backend]->sname) .
- '</STRONG></P>' . "\n";
+ echo html_tag( 'p', '<strong>' .
+ sprintf(_("Unable to list addresses from %s"),
+ $abook->backends[$backend]->sname) . '</strong>' ,
+ 'center' ) . "\n";
}
} else {
$res = $abook->list_addr();
}
if (!is_array($res)) {
- echo '<P ALIGN=center><B><BR>' .
- _("Your search failed with the following error(s)") .
- ':<br>' . $abook->error . "</B></P>\n</BODY></HTML>\n";
+ echo html_tag( 'p', '<b><br>' .
+ _("Your search failed with the following error(s)") .
+ ':<br>' . $abook->error . "</b>\n" ,
+ 'center' ) .
+ "\n</BODY></HTML>\n";
exit;
}
if (sizeof($res) == 0) {
- echo '<P ALIGN=center><BR><B>' .
- _("No persons matching your search was found") .
- ".</B></P>\n</BODY></HTML>\n";
+ echo html_tag( 'p', '<br><b>' .
+ _("No persons matching your search was found") . "</b>\n" ,
+ 'center' ) .
+ "\n</BODY></HTML>\n";
exit;
}
require_once('../functions/display_messages.php');
require_once('../functions/addressbook.php');
require_once('../functions/strings.php');
+require_once('../functions/html.php');
/* Make an input field */
function adressbook_inp_field($label, $field, $name, $size, $values, $add) {
global $color;
- echo '<TR><TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
- $label . ':</TD>' .
- '<TD BGCOLOR="' . $color[4] . '" ALIGN=left>' .
- '<INPUT NAME="' . $name . '[' . $field . ']" SIZE="' . $size . '" VALUE="';
+ $td_str = '<INPUT NAME="' . $name . '[' . $field . ']" SIZE="' . $size . '" VALUE="';
if (isset($values[$field])) {
- echo htmlspecialchars($values[$field]);
+ $td_str .= htmlspecialchars($values[$field]);
}
- echo '">' . $add . '</TD></TR>' . "\n";
+ $td_str .= '">' . $add . '';
+ return html_tag( 'tr' ,
+ html_tag( 'td', $label . ':', 'right', $color[4]) .
+ html_tag( 'td', $td_str, 'left', $color[4])
+ )
+ . "\n";
}
/* Output form to add and modify address data */
function address_form($name, $submittext, $values = array()) {
global $color;
-
- echo '<TABLE BORDER=0 CELLPADDING=1 COLS=2 WIDTH="90%" ALIGN=center>' ."\n";
-
- adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values,
- '<SMALL>' . _("Must be unique") . '</SMALL>');
- adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '');
- adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '');
- adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '');
- adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '');
-
- echo '<TR><TD COLSPAN=2 BGCOLOR="' . $color[4] . '" ALIGN=center>' . "\n" .
- '<INPUT TYPE=submit NAME="' . $name . '[SUBMIT]" VALUE="' .
- $submittext . '"></TD></TR>' .
- "\n</TABLE>\n";
+ echo html_tag( 'table',
+ adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values,
+ '<SMALL>' . _("Must be unique") . '</SMALL>') .
+ adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') .
+ adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') .
+ adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') .
+ adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') .
+ html_tag( 'tr',
+ html_tag( 'td',
+ '<INPUT TYPE=submit NAME="' . $name . '[SUBMIT]" VALUE="' .
+ $submittext . '">',
+ 'center', $color[4], 'colspan="2"')
+ )
+ , 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"') ."\n";
}
/* Display the "new address" form */
echo '<FORM ACTION="' . $PHP_SELF . '" METHOD="POST">' .
"\n" .
- '<TABLE WIDTH="100%" COLS=1 ALIGN=CENTER>' . "\n" .
- '<TR><TD BGCOLOR="' . $color[0] .
- '" ALIGN=CENTER>' . "\n" . '<STRONG>' .
- _("Update address") .
- "</STRONG>\n</TD></TR>\n</TABLE>\n";
+ html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td',
+ "\n". '<strong>' . _("Update address") . '</strong>' ."\n",
+ 'center', $color[0] )
+ ),
+ 'center', '', 'width="100%" cols="1"' ) .
address_form("editaddr", _("Update address"), $olddata);
echo '<INPUT TYPE=hidden NAME=oldnick VALUE="' .
htmlspecialchars($olddata["nickname"]) . "\">\n" .
/* Handle error messages */
if (!$r) {
/* Display error */
- echo '<TABLE WIDTH="100%" COLS=1 ALIGN=CENTER>' .
- "\n" . '<TR><TD ALIGN=CENTER>' . "\n" .
- '<br><STRONG><FONT COLOR="' . $color[2] .
- '">' . _("ERROR") . ": " . $abook->error .
- '</FONT></STRONG>' . "\n</TD></TR>\n</TABLE>\n";
+ echo html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td',
+ "\n". '<br><strong><font color="' . $color[2] .
+ '">' . _("ERROR") . ': ' . $abook->error . '</font></strong>' ."\n",
+ 'center' )
+ ),
+ 'center', '', 'width="100%" cols="1"' );
/* Display the "new address" form again */
echo '<FORM ACTION="' . $PHP_SELF .
'" METHOD="POST">' . "\n" .
- '<TABLE WIDTH="100%" COLS=1 ALIGN=CENTER>' .
- "\n" . '<TR><TD BGCOLOR="' . $color[0] .
- '" ALIGN=CENTER>' . "\n" . '<STRONG>' .
- _("Update address") .
- "</STRONG>\n</TD></TR>\n</TABLE>\n";
+ html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td',
+ "\n". '<br><strong>' . _("Update address") . '</strong>' ."\n",
+ 'center', $color[0] )
+ ),
+ 'center', '', 'width="100%" cols="1"' ) .
address_form("editaddr", _("Update address"), $newdata);
echo '<INPUT TYPE=hidden NAME=oldnick VALUE="' .
htmlspecialchars($oldnick) . "\">\n" .
/* Display error messages */
if (!empty($formerror)) {
- echo '<TABLE WIDTH="100%" COLS=1 ALIGN=CENTER>' . "\n" .
- '<TR><TD ALIGN=CENTER>' . "\n" . '<br><STRONG>' .
- '<FONT COLOR="' . $color[2]. '">' . _("ERROR") . ': ' . $formerror .
- '</FONT></STRONG>' . "\n</TD></TR>\n</TABLE>\n";
+ echo html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td',
+ "\n". '<br><strong><font color="' . $color[2] .
+ '">' . _("ERROR") . ': ' . $formerror . '</font></strong>' ."\n",
+ 'center' )
+ ),
+ 'center', '', 'width="100%" cols="1"' );
}
$prevbackend = -1;
$headerprinted = false;
- echo '<p align=center><a href="#AddAddress">' .
- _("Add address") . "</a></p>\n";
+ echo html_tag( 'p', '<a href="#AddAddress">' . _("Add address") . '</a>', 'center' ) . "\n";
/* List addresses */
if (count($alist) > 0) {
/* New table header for each backend */
if($prevbackend != $row['backend']) {
if($prevbackend < 0) {
- echo '<TR><TD COLSPAN=5 ALIGN=center>' . "\n" .
- '<INPUT TYPE=submit NAME=editaddr VALUE="' .
- _("Edit selected") . "\">\n" .
- '<INPUT TYPE=submit NAME=deladdr VALUE="' .
- _("Delete selected") . "\">\n</tr>\n" .
- '<TR><TD COLSPAN="5" ALIGN=center>' .
- ' <BR></TD></TR></TABLE>' . "\n";
+ echo html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td',
+ '<INPUT TYPE=submit NAME=editaddr VALUE="' .
+ _("Edit selected") . "\">\n" .
+ '<INPUT TYPE=submit NAME=deladdr VALUE="' .
+ _("Delete selected") . "\">\n",
+ 'center', '', 'colspan="5"' )
+ ) .
+ html_tag( 'tr',
+ html_tag( 'td', ' <br>', 'center', '', 'colspan="5"' )
+ ) ,
+ 'center' );
}
- echo '<TABLE WIDTH="95%" COLS=1 ALIGN=CENTER>' . "\n" .
- '<TR><TD BGCOLOR="' . $color[0] . '" ALIGN=CENTER>' . "\n" .
- '<STRONG>' . $row['source'] .
- "</STRONG>\n</TD></TR>\n</TABLE>\n" .
- '<TABLE COLS="5" BORDER="0" CELLPADDING="1" CELLSPACING="0"' .
- ' WIDTH="90%" ALIGN="center">' .
- '<TR BGCOLOR="' . $color[9] .
- '"><TH ALIGN=left WIDTH="1%"> <TH ALIGN=left WIDTH="1%">' .
- _("Nickname") . '<TH ALIGN=left WIDTH="1%">' . _("Name") .
- '<TH ALIGN=left WIDTH="1%">' . _("E-mail") .
- '<TH ALIGN=left WIDTH="%">' . _("Info") . "</TR>\n";
+ echo html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td', "\n" . '<strong>' . $row['source'] . '</strong>' . "\n", 'center', $color[0] )
+ ) ,
+ 'center', '', 'width="95%" cols="1"' ) ."\n"
+ . html_tag( 'table', '', 'center', '', 'cols="5" border="0" cellpadding="1" cellspacing="0" width="90%"' ) .
+ html_tag( 'tr', "\n" .
+ html_tag( 'th', ' ', 'left', '', 'width="1%"' ) .
+ html_tag( 'th', _("Nickname"), 'left', '', 'width="1%"' ) .
+ html_tag( 'th', _("Name"), 'left', '', 'width="1%"' ) .
+ html_tag( 'th', _("E-mail"), 'left', '', 'width="1%"' ) .
+ html_tag( 'th', _("Info"), 'left', '', 'width="1%"' ) ,
+ '', $color[9] ) . "\n";
$line = 0;
$headerprinted = true;
}
/* Print one row */
- echo '<TR';
- if ($line % 2) { echo ' bgcolor="' . $color[0]. '"'; }
- echo '><TD VALIGN=top ALIGN=center WIDTH="1%"><SMALL>' .
- '<INPUT TYPE=checkbox ' . $selected . ' NAME="sel[]" VALUE="' .
- $row['backend'] . ':' . $row['nickname'] . '"></SMALL></TD>' .
- '<TD VALIGN=top NOWRAP WIDTH="1%"> ' . $row['nickname'] .
- ' </TD>' .
- '<TD VALIGN=top NOWRAP WIDTH="1%"> ' . $row['name'] .
- ' </TD>',
- '<TD VALIGN=top NOWRAP WIDTH="1%"> ';
- if ($compose_new_win == '1') {
- echo '<a href="javascript:void(0)" onclick=comp_in_new(false,"compose.php?send_to='.rawurlencode($row['email']).'")>';
- }
- else {
- echo '<A HREF="compose.php?send_to=' . rawurlencode($row['email']).'">';
- }
- echo $row['email'] . '</A> </TD>'."\n",
- '<TD VALIGN=top WIDTH="1%"> ' . $row['label'] . ' </TD>' .
- "</TR>\n";
+ $tr_bgcolor = '';
+ if ($line % 2) { $tr_bgcolor = $color[0]; }
+ echo html_tag( 'tr', '') .
+ html_tag( 'td',
+ '<SMALL>' .
+ '<INPUT TYPE=checkbox ' . $selected . ' NAME="sel[]" VALUE="' .
+ $row['backend'] . ':' . $row['nickname'] . '"></SMALL>' ,
+ 'center', '', 'valign="top" width="1%"' ) .
+ html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
+ html_tag( 'td', ' ' . $row['name'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
+ html_tag( 'td', '', 'left', '', 'valign="top" width="1%" nowrap' ) . ' ';
+ if ($compose_new_win == '1') {
+ echo '<a href="javascript:void(0)" onclick=comp_in_new(false,"compose.php?send_to='.rawurlencode($row['email']).'")>';
+ }
+ else {
+ echo '<A HREF="compose.php?send_to=' . rawurlencode($row['email']).'">';
+ }
+ echo $row['email'] . '</A> </td>'."\n".
+ html_tag( 'td', ' ' . $row['label'] . ' ', 'left', '', 'valign="top" width="1%"' ) .
+ "</tr>\n";
$line++;
}
/* End of list. Close table. */
if ($headerprinted) {
- echo '<TR><TD COLSPAN=5 ALIGN=center>' . "\n" .
- '<INPUT TYPE=submit NAME=editaddr VALUE="' . _("Edit selected") .
- "\">\n" .
- '<INPUT TYPE=submit NAME=deladdr VALUE="' . _("Delete selected") .
- "\">\n" . '</TR></TABLE>';
+ echo html_tag( 'tr',
+ html_tag( 'td',
+ '<INPUT TYPE="submit" NAME="editaddr" VALUE="' . _("Edit selected") .
+ "\">\n" .
+ '<INPUT TYPE="submit" NAME="deladdr" VALUE="' . _("Delete selected") .
+ "\">\n",
+ 'center', '', 'colspan="5"' )
+ );
}
- echo '</FORM>';
+ echo '</table></FORM>';
}
} /* end of addresslist */
/* Display the "new address" form */
echo '<a name="AddAddress"></a>' . "\n" .
- '<FORM ACTION="' . $PHP_SELF . '" NAME=f_add METHOD="POST">' . "\n" .
- '<TABLE WIDTH="100%" COLS=1 ALIGN=CENTER>' . "\n" .
- '<TR><TD BGCOLOR="' . $color[0] . '" ALIGN=CENTER>' . "\n" . '<STRONG>',
- sprintf(_("Add to %s"), $abook->localbackendname) .
- "</STRONG>\n</TD></TR>\n" .
- "</TABLE>\n";
+ '<FORM ACTION="' . $PHP_SELF . '" NAME=f_add METHOD="POST">' . "\n" .
+ html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td', "\n". '<strong>' . sprintf(_("Add to %s"), $abook->localbackendname) . '</strong>' . "\n",
+ 'center', $color[0]
+ )
+ )
+ , 'center', '', 'width="100%" cols="1"' ) ."\n";
address_form('addaddr', _("Add address"), $defdata);
echo '</FORM>';