[Hastymail-cvs] hastymail/lib bodystructure.php,1.10,1.11 html_functions.php,1.175,1.176
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2003-11-28 23:13:06
|
Update of /cvsroot/hastymail/hastymail/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21758/lib Modified Files: bodystructure.php html_functions.php Log Message: lots more changes here. created a function to print out one row of a message listing. This removes quite a bit from the mailbox, new, and search pages, and makes them more consistant. Index: bodystructure.php =================================================================== RCS file: /cvsroot/hastymail/hastymail/lib/bodystructure.php,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- bodystructure.php 25 Nov 2003 03:08:05 -0000 1.10 +++ bodystructure.php 28 Nov 2003 23:13:03 -0000 1.11 @@ -125,13 +125,7 @@ $string = ltrim(substr($string, strlen($regs[1]))); } else { - echo '<table align="center" class="tables4"> - <tr> - <td align="center"> - ',$str[212],' - </td> - </tr> -</table>',"\n"; + $_SESSION['notices'][] = $str[212]; break; } } Index: html_functions.php =================================================================== RCS file: /cvsroot/hastymail/hastymail/lib/html_functions.php,v retrieving revision 1.175 retrieving revision 1.176 diff -u -d -r1.175 -r1.176 --- html_functions.php 28 Nov 2003 17:21:11 -0000 1.175 +++ html_functions.php 28 Nov 2003 23:13:03 -0000 1.176 @@ -588,4 +588,270 @@ return array($result, $pre, $nex, $pre_new, $nex_new, $headers[$uid][5]); } +/** + * Print out one row of message details + * + * @param $headers array message header data + * @param $simple boolean simple mode flag + * @param $t_all boolean toggle all flag + * @param $mailbox string current mailbox + * @param $id string session id + * @param $uid int message id + * @param $sort_info array sort information for thread view + * @return void + * + */ +function hm_print_row($headers, $simple, $t_all, $mailbox, $id, $uid, $sort_info=array(), + $hilite=true, $chk_folder=false) { + $str = $_SESSION['str']; + if (!$simple) { + echo " <tr class=\"tables3\">\n"; + } + /* content type */ + if (isset($headers[4])) { + $content = $headers[4]; + } + else { + $content = ''; + } + + /* subject */ + if (!isset($headers[0]) || + $headers[0] == '') { + $subject = $str[229]; + } + else { + $subject = $headers[0]; + } + + /* from */ + if (!isset($headers[1]) || + $headers[1] == '') { + $from = $str[230]; + } + else { + $from = str_replace('"', '', $headers[1]); + if (substr(ltrim($from), 0, 4) != '<') { + $from = preg_replace("/<.*>/", '', $from); + } + else { + $from = str_replace(array('<', '>'), '', $from); + } + } + /* To */ + if (!isset($headers[6]) || $headers[6] == '') { + $to = $str[232]; + } + else { + $to = str_replace('"', '', $headers[6]); + if (substr($to, 0, 4) != '<') { + $to = preg_replace("/<.*>/", '', $to); + } + else { + $to = str_replace(array('<', '>'), '', $to); + } + } + /* date */ + if (!isset($headers[2]) || + $headers[2] == '') { + $date = $str[231]; + } + else { + $date = $headers[2]; + } + /* flags */ + if (isset($headers[5])) { + $flags = $headers[5]; + } + else { + $flags = ''; + } + /* unseen status */ + if (!stristr($flags, 'seen')) { + $new = 1; + if ($hilite) { + $class = 'tables6'; + $font = 'font2'; + } + else { + $class = 'tables3'; + $font = 'font1'; + } + } + else { + $new = 0; + $class = 'tables3'; + $font = 'font1'; + } + + /* answered status */ + if (!stristr($flags, 'answered')) { + $ans = false; + } + else { + $ans = true; + } + /* size */ + if (isset($headers[7])) { + $size = $headers[7]; + } + else { + $size = ''; + } + /* print out a table row */ + if (!$simple) { + echo ' <td width="1%" valign="top" class="tables1">'; + } + else { + echo '<tr><td>',"\n"; + } + /* checkbox */ + if (!$chk_folder) { + echo ' <input type="checkbox" name="',$uid, + '" value="mark" class="tables1" '; + if ($t_all) { + if (!isset($_POST[$uid])) { + echo 'CHECKED '; + } + } + } + else { + echo ' <input type="checkbox" name="',$chk_folder, + '[]" value="',$uid,'" class="tables1" '; + if ($t_all) { + if (!isset($_POST[$chk_folder])) { + echo 'CHECKED '; + } + else { + if (!in_array($uid, $_POST[$chk_folder])) { + echo 'CHECKED '; + } + } + } + } + echo ">\n"; + /* subject */ + if (!$simple) { + echo ' </td> + <td valign="top" class="',$class,'" width="48%"> + <table width="100%" cellpadding="0" cellspacing="0"> + <tr> + <td width="1%" nowrap valign="top">',"\n"; + } + if (isset($sort_info[3]) && !empty($sort_info[3]) && isset($sort_info[3][$uid])) { + if ($sort_info[3][$uid] > 1) { + echo " ",str_repeat(" ", + $sort_info[3][$uid]), + "<font class=\"font2\">|_</font> \n"; + } + else { + echo " \n"; + } + } + $tag = 'mailbox='.urlencode($mailbox).'&uid='.$uid.'&id='. + urlencode($id).'&new='.$new; + if (!$simple) { + echo ' </td> + <td valign="top">',"\n"; + } + else { + echo '</td><td>'; + if ($new == 1) { + echo '[unread]'; + } + } + echo ' <small><a class="',$font,'" href="message.php?',$tag,'"> + ',$subject,' + </a></small>',"\n"; + /* from (or to for sent folder) */ + if (!$simple) { + echo ' </td> + </tr> + </table> + </td> + <td class="',$class,'" width="30%" valign="top" nowrap> + <table width="100%" cellpadding="0" cellspacing="0"> + <tr> + <td width="1%"> + + </td> + <td valign="top">',"\n"; + } + else { + echo '</td><td>'; + } + echo ' <small>'; + if (!$simple) { + echo '<a class="',$font,'" href="message.php?',$tag,'">'; + } + if (isset($_SESSION['settings']['sent_folder']) && + ($_SESSION['settings']['sent_folder'] == + urldecode($mailbox))) { + echo $to; + } + else { + echo $from; + } + /* date */ + if ($simple) { + echo '</small>',"\n"; + echo '</td><td>'; + } + else { + echo "\n",' </a></small> + </td> + </tr> + </table> + </td> + <td width="15%" valign="top" nowrap class="',$class,'">',"\n"; + } + echo ' <small> '."\n"; + if (!$simple) { + echo ' <a class="',$font,'" href="message.php?',$tag,'">'; + } + echo htmlspecialchars($date, ENT_QUOTES, $str['charset']); + if ($simple) { + echo '</small>',"\n"; + } + else { + echo '</a></small>',"\n"; + echo ' </td> + <td valign="top" class="',$class,'" width="5%" nowrap>',"\n"; + } + /* size */ + echo ' <small> ',"\n "; + if ($size != '') { + $kb = intval($size/1024); + if ($kb < 1) { + echo $size," b\n"; + } + elseif ($kb > 1000) { + echo intval($kb/1024)," mb\n"; + } + else { + echo $kb," kb\n"; + } + } + echo " </small>\n"; + if (!$simple) { + echo " </td>\n"; + /* multipart */ + echo ' <td class="tables1" align="center" width="1%" nowrap>'; + if (stristr($content, 'multipart') + || stristr($content, 'mixed')) { + echo "\n <b><small>+ </small></b>\n"; + } + else { + echo "\n \n"; + } + if ($ans) { + echo "\n <b><small>r </small></b>\n"; + } + echo " </td>\n", + " </tr>\n"; + } + else { + echo '</td></tr>'; + } +} ?> |