Beispiel #1
0
 protected function read_from_db_postprocess($db_result)
 {
     foreach ($db_result as $key => $value) {
         # split comma-separated 'goto' into an array
         $db_result[$key]['goto'] = explode(',', $db_result[$key]['goto']);
         # Vacation enabled?
         list($db_result[$key]['on_vacation'], $db_result[$key]['goto']) = remove_from_array($db_result[$key]['goto'], $this->getVacationAlias());
         # if it is a mailbox, does the alias point to the mailbox?
         if ($db_result[$key]['is_mailbox']) {
             # this intentionally does not match mailbox targets with recipient delimiter.
             # if it would, we would have to make goto_mailbox a text instead of a bool (which would annoy 99% of the users)
             list($db_result[$key]['goto_mailbox'], $db_result[$key]['goto']) = remove_from_array($db_result[$key]['goto'], $key);
         } else {
             # not a mailbox
             $db_result[$key]['goto_mailbox'] = 0;
         }
         # editing a default alias (postmaster@ etc.) is only allowed if special_alias_control is allowed or if the user is a superadmin
         $tmp = preg_split('/\\@/', $db_result[$key]['address']);
         if (!$this->is_superadmin && !Config::bool('special_alias_control') && array_key_exists($tmp[0], Config::Read('default_aliases'))) {
             $db_result[$key]['_can_edit'] = 0;
             $db_result[$key]['_can_delete'] = 0;
         }
         if ($this->struct['status']['display_in_list'] && Config::Bool('show_status')) {
             $db_result[$key]['status'] = gen_show_status($db_result[$key]['address']);
         }
     }
     return $db_result;
 }
Beispiel #2
0
    if ($limit['mailboxes'] == 0) {
        $tCanAddMailbox = true;
    } elseif ($limit['mailbox_count'] < $limit['mailboxes']) {
        $tCanAddMailbox = true;
    }
    $limit['aliases'] = eval_size($limit['aliases']);
    $limit['mailboxes'] = eval_size($limit['mailboxes']);
    if (Config::bool('quota')) {
        $limit['maxquota'] = eval_size($limit['maxquota']);
    }
}
$gen_show_status_mailbox = array();
$divide_quota = array('current' => array(), 'quota' => array());
if (is_array($tMailbox) and sizeof($tMailbox) > 0) {
    for ($i = 0; $i < sizeof($tMailbox); $i++) {
        $gen_show_status_mailbox[$i] = gen_show_status($tMailbox[$i]['username']);
        if (isset($tMailbox[$i]['current'])) {
            $divide_quota['current'][$i] = divide_quota($tMailbox[$i]['current']);
        }
        if (isset($tMailbox[$i]['quota'])) {
            $divide_quota['quota'][$i] = divide_quota($tMailbox[$i]['quota']);
        }
        if (isset($tMailbox[$i]['quota']) && isset($tMailbox[$i]['current'])) {
            $divide_quota['percent'][$i] = min(100, round($divide_quota['current'][$i] / max(1, $divide_quota['quota'][$i]) * 100));
            $divide_quota['quota_width'][$i] = $divide_quota['percent'][$i] / 100 * 120;
        } else {
            $divide_quota['current'][$i] = Config::Lang('unknown');
            $divide_quota['quota_width'][$i] = 0;
            # TODO: use special value?
        }
    }
 }
 print "      <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
 print "      <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
 if ($CONF['quota'] == 'YES') {
     print "      <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
 }
 print "      <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n";
 print "      <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n";
 $colspan = $colspan - 6;
 print "      <td colspan=\"{$colspan}\">&nbsp;</td>\n";
 print "   </tr>\n";
 for ($i = 0; $i < sizeof($tMailbox); $i++) {
     if (is_array($tMailbox) and sizeof($tMailbox) > 0) {
         print "   <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
         if ($CONF['show_status'] == 'YES') {
             print "  <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n";
         }
         print "      <td>" . $tMailbox[$i]['username'] . "</td>\n";
         print "      <td>" . $tMailbox[$i]['name'] . "</td>\n";
         if ($CONF['quota'] == 'YES') {
             print "      <td>";
             if ($tMailbox[$i]['quota'] == 0) {
                 print $PALANG['pOverview_unlimited'];
             } elseif ($tMailbox[$i]['quota'] < 0) {
                 print $PALANG['pOverview_disabled'];
             } else {
                 print divide_quota($tMailbox[$i]['quota']);
             }
             print "</td>\n";
         }
         print "      <td>" . $tMailbox[$i]['modified'] . "</td>\n";