function reconstruct_mailbox(&$pDB, $arrConf, $credentials) { require_once "libs/paloSantoEmail.class.php"; $pACL = new paloACL(new paloDB($arrConf['elastix_dsn']['acl'])); $pEmail = new paloEmail($pDB); $jsonObject = new PaloSantoJSON(); $username = getParameter('username'); if (empty($username)) { $jsonObject->set_error('Invalid Username'); return $jsonObject->createJSON(); } $user = $pACL->getUserByUsername($username); if ($user == false) { $jsonObject->set_error($pACL->errMsg); return $jsonObject->createJSON(); } if ($credentials["userlevel"] == "administrator") { $user['id_organization'] != $credentials['id_organization']; $jsonObject->set_error(_tr('Invalid User')); return $jsonObject->createJSON(); } if ($pEmail->resconstruirMailBox($username)) { $jsonObject->set_message(_tr("The MailBox was reconstructed succefully")); return $jsonObject->createJSON(); } else { $jsonObject->set_error(_tr("The MailBox couldn't be reconstructed.\n" . $pEmail->errMsg)); return $jsonObject->createJSON(); } return $jsonObject->createJSON(); }
function reconstruir_mailBox($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrLang) { $pACL = new paloACL(new paloDB($arrConf['elastix_dsn']['acl'])); $pEmail = new paloEmail($pDB); $userAccount = isset($_SESSION['elastix_user']) ? $_SESSION['elastix_user'] : ""; $isAdmisnistrator = $pACL->isUserAdministratorGroup($userAccount); if ($isAdmisnistrator) { if ($pEmail->resconstruirMailBox(getParameter("username"))) { $smarty->assign("mb_title", _tr('MESSAGE') . ":"); $smarty->assign("mb_message", _tr("The MailBox was reconstructed succefully")); } else { $smarty->assign("mb_title", _tr('ERROR') . ":"); $smarty->assign("mb_message", _tr("The MailBox couldn't be reconstructed.\n" . $pEmail->errMsg)); } } unset($_GET['action']); return viewFormAccount($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang); }