<?php
/*
 $Id$
 ----------------------------------------------------------------------
 AlternC - Web Hosting System
 Copyright (C) 2002 by the AlternC Development Team.
 http://alternc.org/
 ----------------------------------------------------------------------
 Based on:
 Valentin Lacambre's web hosting softwares: http://altern.org/
 ----------------------------------------------------------------------
 LICENSE

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License (GPL)
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html
 ----------------------------------------------------------------------
 Original Author of file: Mathieu Lutfy (mlutfy@koumbit.org)
 Purpose of file: List bounces received for a specific account
 ----------------------------------------------------------------------
*/
require_once("../class/config.php");

include("head.php");

echo "</head>";
echo "<body>";

echo "<h3>" . _("E-mail bounces review") . '</h3>';

echo "<p>" . _("E-mail bounces are messages that are usually sent by a PHP script hosted in your account (ex: a Drupal/Wordpress/Spip site). The messages may have not been correctly delivered because of the destination does not exist or because the destination mail server considered the e-mail to be spam. You are strongly encouraged to review bounces and correct the situation (unsubscribe the user from your newsletter, install a captcha to avoid spam robots) so that we do not receive complaints that your account is sending spam.") . '</p>';

if ($GLOBALS['error']) {
  echo "<p class=\"error\">" . $GLOBALS['error'] . "</p>";
}

global $cuid;
$r = m_mail_bounces::get_list($cuid);

if ($r) {
  echo '<form method="post" action="mail_bounces_del.php" id="main">';
  echo '<table cellspacing="0" cellpadding="4">';
  echo '<tr><th>' . _("Delete") . '</th><th>' . _("ID") . '</th><th>' . _("Date") . '</th><th>' . _("Subject") . '</th><th>' . _("View") . '</th></tr>';

  $col = 1;
  $i = 0;

  while (list($key,$val) = each($r)) {
    $col=3-$col;

    echo '<tr class="lst' . $col . '">';
    echo '<td align="center"><input class="inc" type="checkbox" id="del_' . $i . '" name="d[]" value="' . $val["mid"] . '" /></td>';

    echo '<td><label for="del_' . $i . '">' . $val["mid"] . '</label></td>';
    echo '<td><label for="del_' . $i . '">' . $val["date"] . '</label></td>';
    echo '<td><label for="del_' . $i . '">' . $val["subject"] . '</label></td>';
    echo '<td><a href="mail_bounces_view.php?mid=' . $val["mid"] . '">' . _("View") . '</a></td>';

    if ($val["pop"]) {
      echo "<td>".format_size($val["size"])."</td>";
    } else {
      echo "<td>&nbsp;</td>";
    }

    echo "</tr>";
    $i++;
  }

  echo '</table>';

  echo '<p><input type="submit" class="inb" name="submit" value="' . _("Delete the selected bounces") . '" /></p>';
  echo '</form>';
} else {
  echo "<p>" . _("There are no bounces, good!") . '</p>';
}

?>

</body>
</html>
