Esempio n. 1
0
function USER_MAILBOX($uid)
{
    $users = new usersMenus();
    if ($users->ZARAFA_INSTALLED) {
        return ZARAFA_MAILBOX($uid);
    }
    $t = time();
    $uidenc = urlencode($uid);
    $html = "<div id='{$t}'></div>\n\t<script>LoadAjax('{$t}','domain.edit.user.cyrus-mailbox.php?uid={$uidenc}');</script>\n\t\n\t\n\t";
    return $html;
}
Esempio n. 2
0
function USER_MAILBOX($uid)
{
    $users = new usersMenus();
    if ($users->ZARAFA_INSTALLED) {
        return ZARAFA_MAILBOX($uid);
    }
    $page = CurrentPageName();
    $RealMailBox = false;
    $page = CurrentPageName();
    $user = new user($uid);
    $cyr = new cyrus();
    $sock = new sockets();
    $tpm = $sock->getfile('MbxStat:' . $uid);
    if (preg_match('#TRUE#', $tpm)) {
        $RealMailBox = true;
    }
    if (!$RealMailBox) {
        return USER_MAILBOX_NONEXISTENT($uid);
        $no_mailbox = "<p class=caption style='color:red'>{user_no_mailbox} !!</p>";
    }
    if ($user->MailboxActive == 'TRUE') {
        $cyrus = new cyrus();
        $res = $cyrus->get_quota_array($uid);
        $size = $cyrus->MailboxInfosSize($uid);
        $orgfree = $cyrus->USER_STORAGE_LIMIT - $cyrus->USER_STORAGE_USAGE;
        $free = FormatBytes($orgfree);
        if ($cyrus->MailBoxExists($uid)) {
            $graph1 = InsertChart('js/charts.swf', "js/charts_library", "listener.graphs.php?USER_STORAGE_USAGE={$cyrus->USER_STORAGE_USAGE}&STORAGE_LIMIT={$cyrus->USER_STORAGE_LIMIT}&FREE={$orgfree}", 200, 167, "", true, $users->ChartLicence);
        } else {
            $graph1 = "<H3>{no_mailbox_user}</H3>";
        }
        $mailboxInfos = "<div>\n\t\t\t<i>" . FormatBytes($cyrus->USER_STORAGE_USAGE) . "/" . FormatBytes($cyrus->USER_STORAGE_LIMIT) . "<br>\n\t\t\t ({$free} {free})</i><br><strong>" . FormatBytes($size) . " used</strong>\n\t\t\t </div>";
    }
    $tpl = new templates();
    $export_mailbox = $tpl->_ENGINE_parse_body('{export_mailbox}');
    $import_mailbox = $tpl->_ENGINE_parse_body('{import_mailbox}');
    if (strlen($import_mailbox) > strlen($export_mailbox)) {
        $import_mailbox = substr($import_mailbox, 0, strlen($export_mailbox) - 3) . "...";
    }
    //sudo -u cyrusimap /usr/bin/cyrus/bin/reconstruct -r -f user/shortname
    $repair = "<br>\n    <table style='width:100%;border: 1px solid #005447'>\n    <tr>\n    \t<td coslpan=2><H3 style='color:#005447'>{tools}</H3></td>\n    </tr>\n    \t<tr " . CellRollOver() . ">\n    \t\t\t<td width=99% class=legend nowrap>" . texttooltip('{repair_mailbox}', '{repair_mailbox_text}', "javascript:Loadjs('{$page}?script=repair_mailbox&uid={$uid}');") . "</td>\n\t\t\t\t<td width=1%>" . imgtootltip("icon_roles.gif", '{repair_mailbox_text}', "Loadjs('{$page}?script=repair_mailbox&uid={$uid}');") . "</td>    \t\t\t\n    \t</tr>\n    \t<tr " . CellRollOver() . ">\n    \t\t\t<td width=99% class=legend nowrap>" . texttooltip($export_mailbox, '{export_mailbox_text}', "javascript:Loadjs('{$page}?script=export_script&uid={$uid}');") . "</td>\n\t\t\t\t<td width=1%>" . imgtootltip("icon_roles.gif", '{export_mailbox_text}', "Loadjs('{$page}?script=export_script&uid={$uid}');") . "</td>    \t\t\t\n    \t</tr> \n    \t\n\t\t<tr " . CellRollOver() . ">\n    \t\t\t<td width=99% class=legend nowrap>" . texttooltip($import_mailbox, '{import_mailbox_text}', "javascript:Loadjs('mailsync.php?uid={$uid}');") . "</td>\n\t\t\t\t<td width=1%>" . imgtootltip("icon_sync.gif", '{export_mailbox_text}', "Loadjs('mailsync.php?uid={$uid}');") . "</td>    \t\t\t\n    \t</tr>  \n    \t\n    \t<tr " . CellRollOver() . ">\n    \t\t\t<td width=99% class=legend nowrap>" . texttooltip('{empty_this_mailbox}', '{empty_this_mailbox_text}', "javascript:Loadjs('domains.edit.user.empty.mailbox.php?&userid={$uid}');") . "</td>\n\t\t\t\t<td width=1%>" . imgtootltip("ed_delete.gif", '{delete_this_mailbox}', "Loadjs('domains.edit.user.empty.mailbox.php?&userid={$uid}');") . "</td>    \t\t\t\n    \t</tr>     \t     \t   \t\n    \t\n    \t   \t\n    \t<tr " . CellRollOver() . ">\n    \t\t\t<td width=99% class=legend nowrap>" . texttooltip('{delete_this_mailbox}', '{delete_this_mailbox_text}', "javascript:Loadjs('{$page}?script=delete_mailbox&uid={$uid}');") . "</td>\n\t\t\t\t<td width=1%>" . imgtootltip("ed_delete.gif", '{delete_this_mailbox}', "Loadjs('{$page}?script=delete_mailbox&uid={$uid}');") . "</td>    \t\t\t\n    \t</tr> \n    \t\n    \t\n    \t\n     \t   \t\n   \t\n    \t   \t\n    </table>";
    $img_left_mbx = imgtootltip('folder-mailbox-96.png', "{debug}", "Loadjs('{$page}?debug-mailbox-js={$uid}')");
    if (!$RealMailBox) {
        $repair = null;
    }
    $priv = new usersMenus();
    $ini = new Bs_IniHandler();
    $ini->loadString($user->MailboxSecurityParameters);
    $button = "    \n      \t<tr>\n      \t\t<td colspan=2 align='right'>\n      \t\t<hr>\n      \t\t" . button("{change}", "Loadjs('domains.edit.user.create.mbx.php?uid={$uid}')") . "\n      \t\t</td>\n      \t</tr>\n      \t";
    if ($priv->AllowAddUsers == false) {
        $button = null;
        $img_left_mbx = "<img src='img/folder-mailbox-96.png'>";
    }
    $subtitle = "{user_quota}";
    $main_graph = "<div style='border:1px solid #005447;padding:5px;margin:3px'><span id='mailbox_graph'>{$graph1}</span></div>";
    if ($user->MailBoxMaxSize == 0) {
        $subtitle = "{user_has_no_quota}";
        $graph1 = null;
        $mailboxInfos = "<strong>" . FormatBytes($size) . " used</strong>";
        $mailboxInfos = null;
        $main_graph = null;
    }
    if ($ldap->ldap_last_error != null) {
        return nl2br($ldap->ldap_last_error);
    }
    $html = "\n      \t<table style='width:100%'>\n      \t<tr>\n      \t<td width=1% valign='top'>{$img_left_mbx}</td>\n      \t\t<td>\n\t\t      \t<h1>{$user->DisplayName} {mailbox}</h1>\n\t\t      \t<form name='FFUserMailBox'>\n\t\t      \t<input type='hidden' name='UserMailBoxEdit' value='{$uid}'>\n\t\t      \t<table style='width:100%'>\n\t\t      \t<tr><td colspan=2>\n\t\t      \t\t<H3 style='font-size:18px;color:#005447'>{settings}</h3>\n\t\t      \t\t<hr style='border-color:#005447'>\n\t\t      \t</td>\n\t\t      \t<tr>\n\t\t      \t<td valign='top'>\n\t\t      \t{$no_mailbox}\n\t\t      \t<table style='width:100%'>\n\t\t      \t\n\t\t      \t<tr>\n\t\t      \t\t<td  align='right' width=1%>" . Field_TRUEFALSE_checkbox_img('MailboxActive', $user->MailboxActive) . "</td>\n\t\t\t      \t<td class=legend style='text-align:left'>{MailboxActive}</td>\t\t\t      \t\n\t\t      \t</tr>\n\t\t      \t<tr>\n\t\t\t      \t<td class=legend>{mailbox account}:</td>\n\t\t\t      \t<td>{$uid}</td>\n\t\t      \t</tr>      \t\n\t\t      \t<tr>\n\t\t\t      \t<td  align='right' nowrap class=legend valign='top'>{mailbox quota}:</td>\n\t\t\t      \t<td>\n\t\t\t      \t\t<table style='width:100%'>\n\t\t\t      \t\t\t<tr>\n\t\t\t      \t\t\t\t<td width=1% nowrap>" . Field_text('MailBoxMaxSize', $user->MailBoxMaxSize, 'width:45px') . "&nbsp;MB</td>\n\t\t\t      \t\t\t\t<td align='left'>" . help_icon($mailboxInfos, true) . "</td>\n\t\t\t      \t\t\t</tr>\n\t\t\t      \t\t\t<tr>\n\t\t\t      \t\t\t<td colspan=2><strong>{$subtitle}</strong></td>\n\t\t\t      \t\t\t</tr>\n\t\t\t      \t\t\t\n\t\t\t      \t\t</table>\n\t\t\t      \t</td>\n\t\t      \t</tr>\n\t\t      \t<tr><td colspan=2><br><H3 style='font-size:18px;color:#005447'>{mailbox_priv}</h3><hr style='border-color:#005447'></td>\n\t\t      \t<tr><td colspan=2 align='left'>\n\t\t      \t\t\t<table style='width:60%'>\n\t\t      \t\t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend>{mplt}:</td> \n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_l', 1, $ini->_params["mailbox"]["l"], null, '{mpl}') . "</td>\n\t\t\t      \t\t\t</tr>  \n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mprt}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_r', 1, $ini->_params["mailbox"]["r"], null, '{mpr}') . "</td>\n\t\t\t      \t\t\t</tr> \n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mpst}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_s', 1, $ini->_params["mailbox"]["s"], null, '{mps}') . "</td>\n\t\t\t      \t\t\t</tr> \n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mpwt}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_w', 1, $ini->_params["mailbox"]["w"], null, '{mpw}') . "</td>\n\t\t\t      \t\t\t</tr> \t\n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mpit}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_i', 1, $ini->_params["mailbox"]["i"], null, '{mpi}') . "</td>\n\t\t\t      \t\t\t</tr> \t\n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mppt}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_p', 1, $ini->_params["mailbox"]["p"], null, '{mpp}') . "</td>\n\t\t\t      \t\t\t</tr>\n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mpct}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_c', 1, $ini->_params["mailbox"]["c"], null, '{mpc}') . "</td>\n\t\t\t      \t\t\t</tr>\t\n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap>{mpdt}:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_d', 1, $ini->_params["mailbox"]["d"], null, '{mpd}') . "</td>\n\t\t\t      \t\t\t</tr>\t\n\t\t\t      \t\t\t<tr>\n\t\t\t\t      \t\t\t<td class=legend nowrap><strong>{mpat}</strong>:</td>\n\t\t\t\t      \t\t\t<td>" . Field_checkbox('mp_a', 1, $ini->_params["mailbox"]["a"], null, '{mpa}') . "</td>\n\t\t\t      \t\t\t</tr>\t\t      \t\t\t\t      \t\t\t\t\t      \t\t\t\t\t      \t\t\t\t      \t\t\t\t      \t\t\t\t\t      \t\t\t\t\t      \t\t\t\n\t\t\t      \t\t</table>\n\t\t      \t\t</td>\n\t\t      \t</tr>\n\t\t      \t\n\t\t      \t\n\t\t \t\t\t{$button}\n\t\t      \t</table>\n\t\t      \t</td>\n\t\t      \t<td valign='top' class=legend style='border-left:3px solid #005447;padding:5px'>\n\t\t\t\t\t\t{$main_graph}\n      \t\t\t\t\t{$mailboxInfos}\n      \t\t\t\t\t{$repair}\n      \t\t\t</td>\n\t\t      \t</table>\n\t\t      \t</form></td>\n\t\t  </tr>\n\t\t </table>";
    $html = "{$html}";
    return $tpl->_ENGINE_parse_body($html);
}