Exemplo n.º 1
0
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
/**
 * module declaration
 */
require_once "modules/mail/includes/mail-xmlrpc.php";
$mod = new Module("mail");
$mod->setVersion("2.4.92");
$mod->setRevision('$Rev$');
$mod->setDescription(_T("Mail management", "mail"));
$mod->setAPIVersion("7:0:0");
$mod->setPriority(10);
$attrs = getMailAttributes();
$mod->addACL("mailaccess", _T("Mail access", "mail"));
$mod->addACL("maildisable", _T("Disable mail delivery", "mail"));
$mod->addACL($attrs["mailalias"], _T("Mail aliases", "mail"));
$mod->addACL($attrs["mailbox"], _T("Mail delivery path", "mail"));
$mod->addACL($attrs["mailhost"], _T("Mail server host", "mail"));
$mod->addACL($attrs["mailuserquota"], _T("Mail user quota", "mail"));
$mod->addACL("mailgroupaccess", _T("Mail group alias access", "mail"));
$showAliasesModule = True;
if (hasVDomainSupport()) {
    $showAliasesModule = False;
    $submod = new SubModule("domains");
    $submod->setDescription(_T("Mail", "mail"));
    $submod->setImg('modules/mail/graph/img/mail');
    $submod->setDefaultPage("mail/domains/index");
    $submod->setPriority(10);
Exemplo n.º 2
0
/**
 * Function called for changing user attributes
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _mail_changeUser($FH, $mode)
{
    global $result;
    $uid = $FH->getPostValue("uid");
    if ($FH->getPostValue("mailaccess")) {
        $attrs = getMailAttributes();
        if (hasMailObjectClass($uid)) {
            if ($FH->getValue("unlimitedquota") == "on") {
                $FH->setPostValue($attrs["mailuserquota"], "0");
                $FH->setValue($attrs["mailuserquota"], "0");
            }
        } else {
            addMailObjectClass($uid);
            $result .= _T("Mail attributes added.", "mail") . "<br />";
        }
        if ($FH->isUpdated($attrs["maildrop"])) {
            changeMaildrop($uid, $FH->getValue($attrs['maildrop']));
        }
        if ($FH->isUpdated($attrs["mailalias"])) {
            changeMailalias($uid, $FH->getValue($attrs['mailalias']));
        }
        if ($FH->isUpdated($attrs["mailbox"])) {
            changeMailbox($uid, $FH->getValue($attrs['mailbox']));
        }
        if ($FH->isUpdated($attrs["mailhost"])) {
            changeMailhost($uid, $FH->getValue($attrs["mailhost"]));
        }
        if ($FH->isUpdated($attrs["mailuserquota"])) {
            changeQuota($uid, $FH->getValue($attrs["mailuserquota"]));
        }
        if ($FH->isUpdated('maildisable')) {
            // disable mail
            if ($FH->getValue('maildisable') == "on") {
                changeMailEnable($uid, False);
                $result .= _T("Mail delivery disabled.", "mail") . "<br />";
            } else {
                changeMailEnable($uid, True);
                $result .= _T("Mail delivery enabled.", "mail") . "<br />";
            }
        } else {
            changeMailEnable($uid, True);
        }
        /* Zarafa only */
        if (hasZarafaSupport()) {
            $fields = array("zarafaAdmin", "zarafaSharedStoreOnly", "zarafaAccount");
            foreach ($fields as $field) {
                if ($FH->isUpdated($field)) {
                    modifyZarafa($uid, $field, $FH->getValue($field) == "on" ? True : False);
                }
            }
            if ($FH->isUpdated("zarafaSendAsPrivilege")) {
                $values = $FH->getValue("zarafaSendAsPrivilege");
                $newvalues = array();
                foreach ($values as $value) {
                    if (!empty($value)) {
                        $newvalues[] = $value;
                    }
                }
                modifyZarafa($uid, "zarafaSendAsPrivilege", $newvalues);
            }
        }
        /* When mail service is activated for an user, add mail group aliases */
        syncMailGroupAliases($FH->getPostValue("primary"));
        if ($FH->isUpdated('secondary')) {
            if ($FH->getValue("secondary")) {
                foreach ($FH->getValue("secondary") as $group) {
                    syncMailGroupAliases($group);
                }
            }
        }
    } else {
        // mail access not checked
        if (hasMailObjectClass($uid)) {
            //and mail access still present
            removemail($uid);
            $result .= _T("Mail attributes deleted.", "mail") . "<br />";
        }
    }
    return 0;
}