function popup() { $users = new usersMenus(); $ct = new user($_GET["uid"]); $tpl = new templates(); $title = $ct->DisplayName; $GRPS = $ct->GetGroups($_GET["uid"], 1); while (list($num, $GroupName) = each($ct->GroupsOf)) { $jsGRP = "Loadjs('domains.edit.group.php?js=yes&group-id={$num}',true)"; $XTRG[] = "<tr>\n\t\t\t\t\t<td style='width:16px'><img src='img/wingroup.png'></td>\n\t\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" style='text-decoration:underline'>{$GroupName}</a></td>\n\t\t\t\t</tr>"; } $editjs = MEMBER_JS($_GET["uid"], 1, 1); $bouton = button("{edit_member}", $editjs, 18, 185); if ($users->cyrus_imapd_installed) { include_once dirname(__FILE__) . "/ressources/class.cyrus.inc"; $cyr = new cyrus(); $RealMailBox = $cyr->IfMailBoxExists($_GET["uid"]); $button2 = "<div style='margin-top:10px'>" . button("{mailbox}", "Loadjs('domain.edit.user.cyrus-mailbox.php?js=yes&uid={$_GET["uid"]}')", 18, 185) . "</div>"; if (!$RealMailBox) { if (preg_match("#Authentication failed#i", $cyr->cyrus_infos)) { $error = "<p class=text-error>{authentication_failed_cyrus}</p>"; } else { $error = "<p class=text-error>{user_no_mailbox} !!</p>"; $button2 = "<div style='margin-top:10px'>" . button("{create_mailbox2}", "Loadjs('domains.edit.user.php?create-mailbox-wizard=yes&uid={$_GET["uid"]}&MailBoxMaxSize=0')", 18, 185) . "</div>"; } } } $picture_link = "img/impersonate-photo.png"; $html = "\n\t{$error}\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:190px;vertical-align:top'>\n\t\t<center style='margin-top:15px'>\n\t\t<img style='border-radius: 50% 50% 50% 50%;\n \t\tbox-shadow: 0 0 5px silver;height: 180px;margin: 0 32px;width: 180px;' src='{$picture_link}'></a>\n <center style='font-size: 24px;line-height: 1.2;word-wrap: break-word;margin-top:30px;margin-bottom:30px'>\n {$title}</center>\n\n {$bouton}{$button2}\n </center>\t\n\t</td>\n\t\t<td style='width:80%;vertical-aglin:top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend><div>{Contact_Information}:</div>\n\t\t\t\t<i style='font-size:16px'>{$description}</i></td>\n\t\t\t</tr>\n\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{member}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->givenName} {$ct->sn}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{account}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->uid}</strong></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{email}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->mail}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{telephoneNumber}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->telephoneNumber}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{mobile}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->mobile}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend>" . count($GRPS) . " {groups}:</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td><table style='width:100%'>" . @implode("", $XTRG) . "</table></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<p> </p>\n\t</div>\n\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function CreateMBX($uid, $MailBoxMaxSize = 0) { $cyrus = new cyrus(); if (!$cyrus->MailBoxExists($uid)) { build_progress("Check privileges...", 10); if (!checkrights($uid, $MailBoxMaxSize)) { build_progress("{error_creating_mailbox}", 110); return; } build_progress("{create_mailbox2}", 50); if (!$cyrus->CreateMailbox($uid, 1, 50)) { build_progress("{error_creating_mailbox}", 110); return; } build_progress("Building privileges", 80); $cyrus = new cyrus(); $cyrus->CreateACLS($uid); build_progress("{success}", 100); echo $cyrus->cyrus_infos . "\n"; return; } build_progress("Building privileges", 80); $cyrus = new cyrus(); $cyrus->CreateACLS($uid); build_progress("{$uid}: {mailbox_already_exists} {success}", 100); }
function popup() { $cyrus = new cyrus(); $array = $cyrus->ListMailboxes($_GET["userid"]); $array[null] = "{all}"; unset($array["INBOX"]); $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td width=1% valign='top'><div id='empty-div'>\n\t\t<img src='img/poubelle-128.png'></td>\n\t\t</div>\n\t<td valign='top'>\n\t\t\t<div class=explain>{empty_this_mailbox_explain}</div>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{size_of_message}:</td>\n\t\t\t\t<td style='font-size:14px'>" . Field_text("size_of_message", null, "width:50px;font-size:14px;padding:3px", null, null, null, false, "empty_this_mailbox_perform_check(event)") . " MB</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{age_of_message}:</td>\n\t\t\t\t<td style='font-size:14px'>" . Field_text("age_of_message", 30, "width:50px;font-size:14px;padding:3px", null, null, null, false, "empty_this_mailbox_perform_check(event)") . " {days}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{submailbox}:</td>\n\t\t\t\t<td style='font-size:14px'>" . Field_array_Hash($array, "submailbox", "Junk", null, null, 0, "font-size:14px;padding:3px") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align='right'><hr>\n\t\t\t\t\t" . button("{delete}", "empty_this_mailbox_perform()") . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function items() { $cyrus = new cyrus(); $array = $cyrus->ListUsersBoxes($_POST["query"], $_GET["domain"]); if (!is_array($array)) { json_error_show("No mailbox"); } if (count($array) == 0) { json_error_show("No mailbox"); } $t = $_GET["t"]; $c = 0; $data = array(); $data['page'] = 1; $data['total'] = count($array); $data['rows'] = array(); $search = null; if ($_POST["query"] != null) { $search = string_to_regex($_POST["query"]); } while (list($mailbox_name, $ligne) = each($array)) { $mailbox_name = trim($mailbox_name); if ($mailbox_name == null) { continue; } if ($search != null) { if (!preg_match("#{$search}#", $ligne)) { continue; } } if ($_GET["domain"] != null) { $mailbox_name = "{$mailbox_name}@{$_GET["domain"]}"; } $delete = imgsimple("delete-24.png", "", "DeleteRealMailBox{$t}('{$mailbox_name}','" . md5($ligne) . "');"); $c++; $data['rows'][] = array('id' => md5($ligne), 'cell' => array("<span style='font-size:16px;color:{$color}'><img src='img/32-mailbox.png'></span>", "<span style='font-size:16px;color:{$color}'>{$mailbox_name}</a></span>", "<span style='font-size:16px;color:{$color}'>{$delete}</a></span>")); } if ($c == 0) { json_error_show("No mailbox"); } $data['total'] = $c; echo json_encode($data); }
function Start_sync() { build_progress("{restarting}: Saslauthd", 20); system('/etc/init.d/saslauthd restart'); sleep(2); build_progress("{restarting}: Cyrus-Imap", 50); system('/etc/init.d/cyrus-imapd restart'); sleep(2); build_progress("{restarting}: Postfix", 80); system('/etc/init.d/postfix restart'); sleep(2); build_progress("{listing_mailboxes}", 90); $cyrus = new cyrus(); $mbx = $cyrus->ListMailboxes($cn); while (list($num, $box) = each($mbx)) { echo "Found Mailbox \"{$num}\"\n"; } sleep(10); build_progress("{done}", 100); }
function users_table($ou = null, $domain = null) { $ldap = new clladp(); $cyrus = new cyrus(); $cyrus->LoadMailBox(); $array_mailboxes = $_SESSION["array_mailboxes"]; if ($ou == null) { $ou = $_GET["ou"]; } else { $_GET["ou"] = $ou; } if ($domain == null) { $domain = $_GET["domain"]; } $_GET["domain"] = $domain; $hash = $ldap->HashGetUsersAccounts($ou, $_GET["domain"]); if (is_array($hash)) { $html = "\n\t\t<center>\n\t\t<table>\n\t\t<tr class='rowT'>\n\t\t\t<td nowrap width=1% colspan=2> </td>\n\t\t\t<td nowrap width=1%>{firstname}</td>\n\t\t\t<td nowrap width=1%>{lastname}</td>\t\t\t\n\t\t\t<td nowrap width=1%>{email}</td>\n\t\t\t<td nowrap width=1%> </td>\n\t\t\t\n\t\t</tr>"; while (list($num, $ligne) = each($hash)) { if ($ligne["cn"] != null) { if ($_SESSION["LOCK_IMAP"] == true) { $mailbox = "<img src='img/mailbox_bad_status.gif'>"; } else { if ($array_mailboxes[$ligne["uid"]] == "yes") { $mailbox = "<img src='img/mailbox.gif'>"; } else { $mailbox = " "; } } $html = $html . "<tr class='rowA' OnMouseOver=\"javascript:this.className = 'rowB';\" OnMouseOut=\"javascript:this.className = 'rowA';\">\n\t\t\t<td width=1%><img src='img/nomail.gif' style='border:0px;cursor:pointer' OnClick=\"javascript:editmailbox('{$ligne["dn"]}','{$ou}','{$domain}','0');\" onMouseOver=\"javascript:AffBulle('{edit_user}');\" OnMouseOut=\"javascript:HideBulle();\"></td>\n\t\t\t<td width=1%>{$mailbox}</td>\n\t\t\t<td> {$ligne["first_name"]} </td>\n\t\t\t<td> {$ligne["last_name"]} </td>\n\t\t\t<td> {$ligne["mail"]} </td>\n\t\t\t<td> <a href=\"#\" OnClick=\"javascript:del_user('{$ligne["dn"]}','{$ou}','{$domain}');\"><img src='img/x.gif' onMouseOver=\"javascript:AffBulle('{delete_thisuser}');\" OnMouseOut=\"javascript:HideBulle();\"></a> </td>\n\t\t\t</tr>"; } } $html = $html . "</table></center>"; } if ($html != null) { $tpl = new templates(); return $tpl->_parse_body($html); } }
function restorembx($basedContent) { $GLOBALS["ONNLY_MOUNT"] = true; $unix = new unix(); $rsync = $unix->find_program("rsync"); $chown = $unix->find_program("chown"); $sudo = $unix->find_program("sudo"); $reconstruct = $unix->LOCATE_CYRRECONSTRUCT(); if (!is_file($rsync)) { writelogs(date('m-d H:i:s') . " " . "Unable to stat rsync program", __FUNCTION__, __FILE__, __LINE__); return; } if (!is_file($reconstruct)) { writelogs(date('m-d H:i:s') . " " . "Unable to stat reconstruct program", __FUNCTION__, __FILE__, __LINE__); return; } $array = unserialize(base64_decode($basedContent)); $id = $array["taskid"]; writelogs(date('m-d H:i:s') . " " . "mounting {$id}", __FUNCTION__, __FILE__); $mounted_dir = backup($id); if ($mounted_dir == null) { writelogs(date('m-d H:i:s') . " " . "cannot mount task id {$id}", __FUNCTION__, __FILE__); return; } $path = $array["path"]; $uid = $array["uid"]; if (preg_match("#INBOX\\/(.+)#", $array["mailbox"], $re)) { $mailbox = $re[1]; $cyrus = new cyrus(); $cyrus->CreateSubDir($uid, $mailbox); } else { $mailbox = $array["mailbox"]; } $localimapdir = $unix->IMAPD_GET("partition-default"); if (!is_dir($localimapdir)) { writelogs(date('m-d H:i:s') . " " . "Unable to stat local partition-default", __FUNCTION__, __FILE__, __LINE__); return; } $userfs = str_replace(".", "^", $uid); $firstletter = substr($userfs, 0, 1); $localuserfs = "{$localimapdir}/{$firstletter}/user/{$userfs}"; $localimapdir = "{$localimapdir}/{$firstletter}/user/{$userfs}/"; if (!is_dir($localimapdir)) { writelogs(date('m-d H:i:s') . " " . "Unable to stat local \"{$localimapdir}\"", __FUNCTION__, __FILE__, __LINE__); return; } $remoteimapdir = "{$mounted_dir}/{$path}/{$mailbox}"; @mkdir($localimapdir, null, true); if (substr($remoteimapdir, strlen($remoteimapdir) - 1, 1) != "/") { $remoteimapdir = $remoteimapdir . "/"; } $cmd = "{$rsync} -z --stats {$remoteimapdir}* {$localimapdir} 2>&1"; if ($GLOBALS["USE_RSYNC"]) { $backup = new backup_protocols(); writelogs(date('m-d H:i:s') . " " . "Using rsync protocol", __FUNCTION__, __FILE__, __LINE__); $array_config = $backup->extract_rsync_protocol($remoteimapdir); if (!is_array($array)) { writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}]: rsync protocol error", __FUNCTION__, __FILE__, __LINE__); return false; } if ($array_config["PASSWORD"] != null) { $tmpstr = "/opt/artica/passwords/" . md5($array_config["PASSWORD"]); @mkdir("/opt/artica/passwords", null, true); @file_put_contents($tmpstr, $array_config["PASSWORD"]); $pwd = " --password-file={$tmpstr}"; } if ($array["USER"] != null) { $user = "******"USER"]}@"; } $cmd = "{$rsync}{$pwd} --stats rsync://{$user}{$array_config["SERVER"]}/{$array_config["FOLDER"]}* {$localimapdir} 2>&1"; } writelogs(date('m-d H:i:s') . " " . "Restore from {$remoteimapdir}", __FUNCTION__, __FILE__, __LINE__); writelogs(date('m-d H:i:s') . " " . "Restore to {$localimapdir}", __FUNCTION__, __FILE__, __LINE__); writelogs(date('m-d H:i:s') . " " . "reconstruct path {$reconstruct}", __FUNCTION__, __FILE__, __LINE__); writelogs(date('m-d H:i:s') . " " . "{$cmd}", __FUNCTION__, __FILE__, __LINE__); exec($cmd, $rsynclogs); $i = 0; while (list($num, $line) = each($rsynclogs)) { if (preg_match("#Number of files transferred:\\s+([0-9]+)#", $line, $re)) { $GLOBALS["events"][] = "Files restored: {$re[1]}"; } if (preg_match("#Total transferred file size:\\s+([0-9]+)#", $line, $re)) { $bytes = $re[1]; $re[1] = round($re[1] / 1024 / 1000) . "M"; $GLOBALS["events"][] = "{$re[1]} size restored ({$bytes} bytes)"; } if (preg_match("#Permission denied#", $line)) { $i = $i + 1; } } $GLOBALS["events"][] = "{$i} file(s) on error"; shell_exec("{$chown} -R cyrus:mail {$localuserfs}"); shell_exec("/bin/chmod -R 755 {$localuserfs}"); $cmd = "{$sudo} -u cyrus {$reconstruct} -r -f user/{$uid} 2>&1"; writelogs(date('m-d H:i:s') . " " . "{$cmd}", __FUNCTION__, __FILE__, __LINE__); exec($cmd, $rsynclogs); $GLOBALS["events"][] = "Reconstruct information: "; while (list($num, $line) = each($rsynclogs)) { $GLOBALS["events"][] = "reconstructed path: {$line}"; } writelogs(date('m-d H:i:s') . " " . "restarting imap service", __FUNCTION__, __FILE__, __LINE__); system("/etc/init.d/cyrus-imapd restart"); print_r($GLOBALS["events"]); }
function page() { $uid = $_GET["uid"]; $uidenc = urlencode($uid); $users = new usersMenus(); $page = CurrentPageName(); $RealMailBox = false; $tpl = new templates(); $page = CurrentPageName(); $user = new user($uid); $t = time(); $cyr = new cyrus(); if ($GLOBALS["VERBOSE"]) { echo "<H1> cyrus ( ) -> IfMailBoxExists({$uid})</H1>\n"; } $RealMailBox = $cyr->IfMailBoxExists($uid); if (!$RealMailBox) { if (preg_match("#Authentication failed#i", $cyr->cyrus_infos)) { echo USER_MAILBOX_AUTHENTICATION_FAILED($uid, nl2br($cyr->cyrus_infos)); return; } echo USER_MAILBOX_NONEXISTENT($uid, nl2br($cyr->cyrus_infos)); $no_mailbox = "<p class=caption style='color:#d32d2d'>{user_no_mailbox} !!</p>"; return; } if ($user->MailboxActive == 'TRUE') { $MailboxActive = 1; $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>"; } $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 $tr[] = button("{repair_mailbox}", "Loadjs('domains.edit.user.php?script=repair_mailbox&uid={$uidenc}');", 18, 286); $tr[] = button("{export_mailbox}", "Loadjs('domains.edit.user.php?script=export_script&uid={$uidenc}');", 18, 286); $tr[] = button("{empty_this_mailbox}", "Loadjs('domains.edit.user.empty.mailbox.php?&userid={$uidenc}');", 18, 286); $tr[] = button("{delete_this_mailbox}", "Loadjs('domains.edit.user.php?script=delete_mailbox&uid={$uidenc}');", 18, 286); while (list($key, $line) = each($tr)) { $buttons = $buttons . "\n\t<tr>\n\t\t<td><center style='margin-bottom:15px'>{$line}</center></td>\n\t</tr>\t\t\n\t\t\t\n\t"; } if (!$RealMailBox) { $buttons = 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("{apply}", "Save{$t}()", 26) . "\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 = "<i>{user_has_no_quota}</i>"; $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); } $ADDisable = 0; if ($priv->EnableManageUsersTroughActiveDirectory) { $ADDisable = 1; $button = null; } if ($subtitle != null) { $subtitle = "<p class=explain style='font-size:16px'>{$subtitle}</p>"; } $html = "\n<div id='usermailboxformdiv'>\n<table style='width:100%'>\n<form name='FFUserMailBox'>\n<input type='hidden' name='UserMailBoxEdit' value='{$uid}'>\n<table style='width:100%'>\n<tr>\t\n\t<td valign='top' style='width:288px'><table style='width:100%'>{$buttons}</table></td>\n\t<td valign='top'>\n<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=3>\n\t\t\t<div style='font-size:30px;margin-bottom:20px'>{mailbox} {mailbox account}: {$uid}</div>{$mailboxInfo}\n\t\t</td>\n\t</tr>\n\t\t<td class=legend style='font-size:18px' class=legend>{MailboxActive}</td>\n\t\t<td>" . Field_checkbox_design("MailboxActive-{$t}", 1, $MailboxActive) . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap class=legend valign='middle' \n\t\t\tstyle='vertical-align:middle;font-size:18px'>{mailbox quota}:</td>\n\t\t<td style='font-size:18px'>" . Field_text('MailBoxMaxSize', $user->MailBoxMaxSize, 'width:95px;font-size:18px') . " MB</td>\n\t\t<td align='left'>" . help_icon($mailboxInfos, true) . "</td>\n\t</tr>\n\t<tr>\n\t<td colspan=3>{$subtitle}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=3><div style='font-size:30px;margin-bottom:20px'>{mailbox_priv}</div></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='text-align:rigth;font-size:18px'>{mplt}:</td>\n\t\t<td>" . Field_checkbox_design("mp_l-{$t}", 1, $ini->_params["mailbox"]["l"], null, '{mpl}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mprt}:</td>\n\t\t<td>" . Field_checkbox_design("mp_r-{$t}", 1, $ini->_params["mailbox"]["r"], null, '{mpr}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mpst}:</td>\n\t\t<td>" . Field_checkbox_design("mp_s-{$t}", 1, $ini->_params["mailbox"]["s"], null, '{mps}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mpwt}:</td>\n\t\t<td>" . Field_checkbox_design("mp_w-{$t}", 1, $ini->_params["mailbox"]["w"], null, '{mpw}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mpit}:</td>\n\t\t<td>" . Field_checkbox_design("mp_i-{$t}", 1, $ini->_params["mailbox"]["i"], null, '{mpi}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mppt}:</td>\n\t\t<td>" . Field_checkbox_design("mp_p-{$t}", 1, $ini->_params["mailbox"]["p"], null, '{mpp}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mpct}:</td>\n\t\t<td>" . Field_checkbox_design("mp_c-{$t}", 1, $ini->_params["mailbox"]["c"], null, '{mpc}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='text-align:rigth;font-size:18px'>{mpdt}:</td>\n\t\t<td>" . Field_checkbox_design("mp_d-{$t}", 1, $ini->_params["mailbox"]["d"], null, '{mpd}') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t<td class=legend nowrap style='text-align:rigth;font-size:18px'><strong>{mpat}</strong>:</td>\n\t<td>" . Field_checkbox_design("mp_a-{$t}", 1, $ini->_params["mailbox"]["a"], null, '{mpa}') . "</td>\n\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 align='right'>{$button}</td>\n\t</tr>\n\t</table>\n</td>\n</tr>\n</table>\n<p> </p>\n\n{$main_graph}\n\n<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar MailBoxMaxSize='0';\n\t\tvar tempvalue=obj.responseText;\n\t\tif(document.getElementById('MailBoxMaxSize')){\n\t\t\tvar MailBoxMaxSize=document.getElementById('MailBoxMaxSize').value;\n\t\t}\n\t\tif(tempvalue.length>3){\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t\tLoadjs('domains.edit.user.create.mbx.php?uid={$uidenc}&MailBoxMaxSize='+MailBoxMaxSize);\n\t}\t\t\n\n\tfunction Save{$t}(){\n\t\t\n\t\tvar mp_l=1;\n\t\tvar mp_r=1;\n\t\tvar mp_s=1;\n\t\tvar mp_w=1;\n\t\tvar mp_i=1;\n\t\tvar mp_p=1;\n\t\tvar mp_c=1;\n\t\tvar mp_d=1;\n\t\tvar mp_a=1;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Save','{$uid}');\n\t\tif(document.getElementById('MailboxActive-{$t}').checked){XHR.appendData('MailboxActive','TRUE');}else{XHR.appendData('MailboxActive','FALSE');}\n\t\tXHR.appendData('MailBoxMaxSize',document.getElementById('MailBoxMaxSize').value);\n\t\tif(document.getElementById('mp_l-{$t}').checked){mp_l=1;}else{mp_l=0;}\n\t\tif(document.getElementById('mp_r-{$t}').checked){mp_r=1;}else{mp_r=0;}\n\t\tif(document.getElementById('mp_s-{$t}').checked){mp_s=1;}else{mp_s=0;}\n\t\tif(document.getElementById('mp_w-{$t}').checked){mp_w=1;}else{mp_w=0;}\n\t\tif(document.getElementById('mp_i-{$t}').checked){mp_i=1;}else{mp_i=0;}\n\t\tif(document.getElementById('mp_p-{$t}').checked){mp_p=1;}else{mp_p=0;}\n\t\tif(document.getElementById('mp_c-{$t}').checked){mp_c=1;}else{mp_c=0;}\n\t\tif(document.getElementById('mp_d-{$t}').checked){mp_d=1;}else{mp_d=0;}\n\t\tif(document.getElementById('mp_a-{$t}').checked){mp_a=1;}else{mp_a=0;}\t\n\t\t\n\t\tXHR.appendData('mp_l',mp_l);\n\t\tXHR.appendData('mp_r',mp_r);\n\t\tXHR.appendData('mp_s',mp_s);\n\t\tXHR.appendData('mp_w',mp_w);\n\t\tXHR.appendData('mp_i',mp_i);\n\t\tXHR.appendData('mp_p',mp_p);\n\t\tXHR.appendData('mp_c',mp_c);\n\t\tXHR.appendData('mp_d',mp_d);\n\t\tXHR.appendData('mp_a',mp_a);\n\t\t\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\t\t\t\t\t\t\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function ApplyConfigMbx() { $artica = new artica_general(); $tpl = new templates(); if ($artica->RelayType == "single") { echo $tpl->_parse_body(Infos('mailbox_main_settings', 'feature_disabled')); exit; } $ldap = new clladp(); $hash = $ldap->Hash_all_mailboxesActives(); if (!is_array($hash)) { echo $tpl->_parse_body(Infos('mailbox_main_settings', 'no_mailboxes')); exit; } $cyrus = new cyrus(); $cyrconf = new cyrus_conf(); $cyrconf->SaveToLdap(); while (list($uid, $password) = each($hash)) { writelogs("Creating Mailbox {$uid}", __FUNCTION__, __FILE__); if (!$cyrus->CreateMailbox($uid, 1)) { writelogs("Creating Mailbox {$uid} failed aborting", __FUNCTION__, __FILE__); echo $tpl->_parse_body(InfosError('mailbox_main_settings', "{error_creating_mailbox} <strong>{$uid}</strong>")); exit; } } echo $tpl->_ENGINE_parse_body(Success('mailbox_main_settings')); }
function Cyrus_mailbox_apply_settings() { $usr = new usersMenus(); $tpl = new Templates(); $uid = $_GET["Cyrus_mailbox_apply_settings"]; if ($usr->AsMailBoxAdministrator == false) { echo $tpl->_ENGINE_parse_body('{no_privileges}'); exit; } $cyrus = new cyrus(); $ldap = new clladp(); $hash = $ldap->UserDatas($uid); if ($hash["MailboxActive"] == "TRUE") { $createMailbox = true; if ($cyrus->CreateMailbox($uid) == false) { $createMailbox = false; $error = "{failed}:{creating_mailbox}:{$uid}\n{$cyrus->cyrus_last_error}\n"; } else { $error = "{success}:{creating_mailbox}:{$uid}\n"; } } echo html_entity_decode($tpl->_ENGINE_parse_body($error)); }
function postfix_status() { if ($GLOBALS['VERBOSE']) { echo "<h1>postfix_status()</H1>\n"; } $page = CurrentPageName(); $ini = new Bs_IniHandler(); $users = new usersMenus(); $tpl = new templates(); $sock = new sockets(); $stats = array(); $createamailbox = null; if ($GLOBALS['VERBOSE']) { echo "<span style='color:red'>AsPostfixAdministrator: {$users->AsPostfixAdministrator}</span>\n"; } if (!$users->AsPostfixAdministrator) { if ($GLOBALS['VERBOSE']) { echo "<h1>postfix_notadmin()</H1>\n"; } return postfix_notadmin(); } $version = $sock->getFrameWork("influx.php?version=yes"); $GoToMessaging = "GoToMessaging()"; $stat = unserialize(base64_decode($sock->getFrameWork("cmd.php?postfix-stat=yes"))); $queues = unserialize($sock->getFrameWork("cmd.php?postfixQueues=yes")); $total = base64_decode($sock->getFrameWork("cmd.php?postfix-multi-postqueue=MASTER")); $SMTP_SUM_DOMAINS = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_DOMAINS")); $SMTP_SUM_CDIR = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_CDIR")); $SMTP_REFUSED = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_REFUSED")); $EnableStopPostfix = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableStopPostfix")); $SUM_BACK = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_BACK")); $SUM_BACKSIZE = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_BACKSIZE")); $SMTP_SUM_QUAR = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_QUAR")); $SMTP_SUM_QUARSIZE = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_QUARSIZE")); if ($GLOBALS['VERBOSE']) { echo "<h1>/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_BACKSIZE = {$SUM_BACKSIZE}</H1>\n"; } $MimeDefangAutoWhiteList = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/MimeDefangAutoWhiteList")); $MimeDefangEnabled = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/MimeDefangEnabled")); $MimeDefangSpamAssassin = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/MimeDefangSpamAssassin")); if ($MimeDefangEnabled == 0) { $MimeDefangAutoWhiteList = 0; $MimeDefangSpamAssassin = 0; } $SUM_TRANSCATS = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SUM_TRANSCATS")); $SUM_TRANSCATS_SIZE = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SUM_TRANSCATS_SIZE")); $SMTP_SUM_ATTACH = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_ATTACH")); $SMTP_SUM_ATTACHSIZE = intval(@file_get_contents("/usr/share/artica-postfix/ressources/smtp-cache/SMTP_SUM_ATTACHSIZE")); if ($users->cyrus_imapd_installed) { $createamailbox = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('create-user.php')\"\n\t\tstyle='text-decoration:underline'>\n\t\t<table style='width:100%'>\n\t\t<td width=32px><img src='img/mailbox-add-32.png'>\n\t\t<td style='font-size:18px;text-decoration:underline'>{new_mailbox}</td>\n\t\t\t\t</tr></table>\n\t\t</td>\n\t\t</tr>"; } if ($GLOBALS['VERBOSE']) { echo "<h1>MimeDefangEnabled={$MimeDefangEnabled}; SUM_TRANSCATS = {$SUM_TRANSCATS}</H1>\n"; } if ($MimeDefangEnabled == 1) { if ($SUM_TRANSCATS > 0) { if ($GLOBALS['VERBOSE']) { echo "<h1> SUM_TRANSCATS - BUILD !</H1>\n"; } $stats[] = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoSMTPTransactions()\"\n\t\t\tstyle='text-decoration:underline'>{transactions}: " . FormatNumber($SUM_TRANSCATS) . " <span style='font-size:16px'>" . FormatBytes($SUM_TRANSCATS_SIZE / 1024) . "</span></a></td>\n\t\t\t</tr>"; } if ($SMTP_SUM_ATTACH > 0) { $stats[] = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoSMTPAttachments()\"\n\t\t\tstyle='text-decoration:underline'>{attachments}: " . FormatNumber($SMTP_SUM_ATTACH) . " <span style='font-size:16px'>" . FormatBytes($SMTP_SUM_ATTACHSIZE / 1024) . "</span></a></td>\n\t\t\t</tr>"; } } if ($GLOBALS['VERBOSE']) { echo "<h1>SMTP_REFUSED = {$SMTP_REFUSED}</H1>\n"; } if ($SMTP_REFUSED > 0) { $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoSMTPRefused()\"\n\t\tstyle='text-decoration:underline'>{refused}: " . FormatNumber($SMTP_REFUSED) . "</a></td>\n\t\t</tr>"; } if ($GLOBALS['VERBOSE']) { echo "<h1>SMTP_SUM_DOMAINS = {$SMTP_SUM_DOMAINS}</H1>\n"; } if ($SMTP_SUM_DOMAINS > 0) { $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoSMTPTableDomains()\"\n\t\tstyle='text-decoration:underline'>{domains}: " . FormatNumber($SMTP_SUM_DOMAINS) . "</a></td>\n\t\t</tr>"; } if ($GLOBALS['VERBOSE']) { echo "<h1>SMTP_SUM_CDIR = {$SMTP_SUM_CDIR}</H1>\n"; } if ($SMTP_SUM_CDIR > 0) { $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoSMTPTableCDIR()\"\n\t\tstyle='text-decoration:underline'>{networks}: " . FormatNumber($SMTP_SUM_CDIR) . "</a></td>\n\t\t</tr>"; } if ($GLOBALS['VERBOSE']) { echo "<h1>SUM_BACK = {$SUM_BACK}</H1>\n"; } if ($SUM_BACK > 0) { $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoBackupMails()\"\n\t\tstyle='text-decoration:underline'>{backuped_mails}: " . FormatNumber($SUM_BACK) . " (" . FormatBytes($SUM_BACKSIZE / 1024) . ")</a></td>\n\t\t</tr>"; } if ($MimeDefangSpamAssassin == 1) { if ($SMTP_SUM_QUAR > 0) { $stats[] = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoQuarantineMails()\"\n\t\t\tstyle='text-decoration:underline'>{quarantine}: " . FormatNumber($SMTP_SUM_QUAR) . " <span style='font-size:16px'>" . FormatBytes($SMTP_SUM_QUARSIZE / 1024) . "</span></a></td>\n\t\t\t</tr>"; } } $q = new mysql(); if ($MimeDefangAutoWhiteList == 1) { $whitelisted = $q->COUNT_ROWS("autowhite", "artica_backup"); $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoAutoWhite()\"\n\t\tstyle='text-decoration:underline'>{smtp_AutoWhiteList}: " . FormatNumber($whitelisted) . " </a></td>\n\t\t</tr>"; } if (is_file("{$GLOBALS["BASEDIR"]}/SMTP_TOTALS")) { $SMTP_TOTALS = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/SMTP_TOTALS")); $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{received}: " . FormatNumber($SMTP_TOTALS["received"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{delivered}: " . FormatNumber($SMTP_TOTALS["delivered"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{rejected}: " . FormatNumber($SMTP_TOTALS["rejected"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{senders}: " . FormatNumber($SMTP_TOTALS["senders"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{recipients}: " . FormatNumber($SMTP_TOTALS["recipients"]) . "</a></td>\n\t\t</tr>"; } $postfix_status = $stat[0]; $postfix_version = $stat[1]; $icon = "disks-128-ok.png"; $err = array(); $errT = array(); $c = 0; if (is_file(dirname(__FILE__) . '/logs/artica-backup-size.ini')) { $ini = new Bs_IniHandler(dirname(__FILE__) . '/logs/artica-backup-size.ini'); if ($ini->_params["artica_backup"]["original_messages"] == null) { $ini->_params["artica_backup"]["original_messages"] = 0; } if ($ini->_params["artica_backup"]["attachments"] == null) { $ini->_params["artica_backup"]["attachments"] = 0; } $size = $ini->_params["artica_backup"]["original_messages"] + $ini->_params["artica_backup"]["attachments"]; $size = FormatBytes($size); $link2 = CellRollOver("Loadjs('postfix.backup.monitoring.php')"); if (!isset($queues["backup"])) { $queues["backup"] = 0; } if (!isset($queues["quarantine"])) { $queues["quarantine"] = 0; } $artica_backup = "<tr>\n\t\t<td align='right' {$link2} style='{$textFONTStyle}'>{backup_size}:</a> </td>\n\t\t<td {$link2} ><strong style='{$textFONTStyle}'>{$size}</td>\n\t\t</tr>"; if ($queues["quarantine"] > 0) { $link_quarantine_progress = CellRollOver("Loadjs('postfix.quarantine.progress.php')"); } } if ($users->cyrus_imapd_installed) { include_once dirname(__FILE__) . "/ressources/class.cyrus.inc"; $cyr = new cyrus(); if (!$cyr->TestConnection()) { $err[] = proxy_status_warning("{unable_to_connect_imap}", "{unable_to_connect_imap}", "Loadjs('cyrus.sync-services.progress.php')"); $icon = "disks-128-red.png"; } } if ($EnableStopPostfix == 1) { $icon = "disks-128-red.png"; $err[] = proxy_status_warning("{messaging_stopped}", "{messaging_stopped_explain}", "Loadjs('postfix.stop.php')"); $icon = "disks-128-red.png"; } $link_corrupt = "Loadjs('postfix.corrupt.queue.php')"; $link_incoming = CellRollOver("Loadjs('postfix.queue.monitoring.php?show-queue=incoming&count={$queues["incoming"]}');"); $link_active = CellRollOver("Loadjs('postfix.queue.monitoring.php?show-queue=active&count={$queues["active"]}');"); $link_deferred = CellRollOver("Loadjs('postfix.queue.monitoring.php?show-queue=deferred&count={$queues["deferred"]}');"); $q = new mysql(); $sql = "SELECT SUM(`size`) as tsize,COUNT(msgid) as tcount FROM postqueue WHERE `instance`='master'"; if (function_exists("mysql_fetch_array")) { $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events')); } $postfix_admin_mysql = $q->COUNT_ROWS("postfix_admin_mysql", "artica_events"); if ($postfix_admin_mysql > 0) { $postfix_admin_mysql_text = "\t\t\n\t\t<td style='font-size:18px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GoToPostfixWatchdog()\"\n\t\tstyle='text-decoration:underline'>{watchdog}: {$postfix_admin_mysql} {events}</a></td>\n\t\t</tr>\n\t\t<tr><td> </td></tr>"; } $tot = $ligne["tcount"]; $tot_size = $ligne["tsize"] / 1024; $tot_size = FormatBytes($tot_size); if ($GLOBALS['VERBOSE']) { echo "<h1>stats arrayof " . count($stats) . " elements</H1>\n"; } $icon = imgtootltip($icon, "position:right:{messaging}", "{$GoToMessaging}"); $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' style='width:128px' >\n\t\t{$icon}\n\t\t</td>\n\t\t<td>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td style='font-size:30px'>\n\t\t" . $tpl->_ENGINE_parse_body(texttooltip("{APP_POSTFIX}", "{messaging}", "{$GoToMessaging}")) . "\n\t\t<div style='width:100%;text-align:right'><span style='font-size:16px'>{version}:{$postfix_version}</div>\n\t\t</td>\n\t\t</tr>\n\t\t{$createamailbox}\n\t\t<tr>\n\t\t\t<td colspan=2> </td>\n\t\t</tR>\n\t\t\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:PostfixQueueMonitoring()\"\n\t\tstyle='text-decoration:underline'>{smtp_queues}: {$tot_size}</a></td>\n\t\t</tr>{$postfix_admin_mysql_text}\n\t\t" . @implode("\n", $stats) . "\n\n\t\t{$perc_cache}\n\t\t{$SUM_FAMILYSITES_TEXT}\n\t\t" . @implode("", $errT) . "\n\t\t" . @implode("", $err) . "\n\t\t{$important_events_text}\n\t\t</table>\n\t\t</td>\n\t</tr>\n</table>\n\t\t\t"; $html = $tpl->_ENGINE_parse_body($html); return $html; }
function MBXSetACL() { $tpl = new templates(); $uid = $_GET["MBXSetACL"]; $cyrus = new cyrus(); $cyrus->CreateACLS($uid); echo $tpl->_ENGINE_parse_body($cyrus->cyrus_infos); }
function user_set_quota() { $dn = $_GET["user_set_quota"]; $ldap = new clladp(); $hash = $ldap->GetDNValues($_GET["user_set_quota"]); $cyrus = new cyrus(); $cyrus->SetQuotaDN($hash[0]["uid"][0], $_GET["quota"]); echo users_mailbox($dn); }
function pie_single_mailbox_user() { $tpl = new Templates(); $users = new usersMenus(); $uid = $_SESSION["uid"]; if ($users->cyrus_imapd_installed == 0) { return null; } $ldap = new clladp(); $hash = $ldap->UserDatas($_SESSION["uid"]); if ($hash["MailboxActive"] != 'TRUE') { return null; } $cyrus = new cyrus(); $res = $cyrus->get_quota_array($uid); $size = $cyrus->MailboxInfosSize($uid); $free = $cyrus->USER_STORAGE_LIMIT - $cyrus->USER_STORAGE_USAGE; if (!$cyrus->MailBoxExists($uid)) { return null; } $USER_STORAGE_USAGE = $cyrus->USER_STORAGE_USAGE; $USER_STORAGE_LIMIT = $cyrus->USER_STORAGE_LIMIT; $FREE = $free; writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE}", __FUNCTION__, __FILE__); writelogs("STORAGE_LIMIT={$USER_STORAGE_LIMIT}", __FUNCTION__, __FILE__); if ($USER_STORAGE_LIMIT == null) { $USER_STORAGE_LIMIT = 1000000; $USER_STORAGE_USAGE = 0; $FREE = $USER_STORAGE_LIMIT; } $USER_STORAGE_RESTANT = $USER_STORAGE_LIMIT - $USER_STORAGE_USAGE; if ($USER_STORAGE_RESTANT > 1) { $reste = round($USER_STORAGE_RESTANT / 1024); $data = array($USER_STORAGE_USAGE, $USER_STORAGE_RESTANT); } else { $data = array($USER_STORAGE_USAGE); } $title = $tpl->_ENGINE_parse_body("{your mailbox usage} ({$reste} mb free)"); writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE} - USER_STORAGE_LIMIT={$USER_STORAGE_LIMIT} FREE={$FREE}", __FUNCTION__, __FILE__); $date = date('Y-m-d'); $textes = array(); $donnees = array(); $zlabel = array(); $date = date('Y-m-d'); $donnees[] = $FREE; $textes[] = "{$FREE} Free"; $donnees[] = $USER_STORAGE_USAGE; $textes[] = "{$USER_STORAGE_USAGE} used"; $data = $donnees; $graph = new PieGraph(370, 350, 'auto'); //$graph->SetShadow(); $graph->title->Set($title); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->SetLabels($textes, 1); $p1->SetEdge('black', 0); $p1->SetAngle(55); $p1->SetLabelMargin(2); $p1->SetCenter(0.4, 0.5); $p1->ExplodeAll(10); $graph->Add($p1); $graph->SetFrame(false); $graph->StrokeCSIM(); }
function Cyrus_mailbox_apply_settings() { $usr = new usersMenus(); $tpl = new Templates(); $show = array(); $uid = $_GET["Cyrus_mailbox_apply_settings"]; if ($usr->AsMailBoxAdministrator == false) { echo $tpl->_ENGINE_parse_body('{no_privileges}'); exit; } $cyrus = new cyrus(); $ldap = new clladp(); $show[] = "{mailbox_creation_results}: {$uid}"; $hash = $ldap->UserDatas($uid); if ($hash["MailboxActive"] == "TRUE") { $show[] = "{mailbox_enabled}"; $createMailbox = true; if ($cyrus->CreateMailbox($uid) == false) { $createMailbox = false; $error = "{failed}:{creating_mailbox}:{$uid}\n{$cyrus->cyrus_last_error}\n"; } else { $error = "{success}:{creating_mailbox}:{$uid}\n"; } $show[] = $cyrus->cyrus_infos; } else { $show[] = "{mailbox_not_enabled}"; } while (list($num, $ligne) = each($show)) { $html = $html . "<div style='font-size:12px;font-weight:bold;'>{$ligne}</div>\n"; } echo "<div style='width:100%;height:250px;overflow:auto'>" . $tpl->_ENGINE_parse_body($html) . "</div>"; }
function ActiveDirectorySync() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $cache_file = "/etc/artica-postfix/pids/mailboxes.sync.ad.cache"; $sock = new sockets(); $unix = new unix(); $users = new usersMenus(); if (!$users->cyrus_imapd_installed) { echo "Sync client:: Cyrus-imapd is not installed\n"; return; } $CyrusToAD = $sock->GET_INFO("CyrusToAD"); if (!is_numeric($CyrusToAD)) { echo "Sync client:: Connexion to Active Directory is not enabled\n"; return; } if ($CyrusToAD == 0) { echo "Sync client:: Connexion to Active Directory is not enabled\n"; return; } $oldpid = @file_get_contents($pidfile); if ($unix->process_exists($oldpid)) { echo "Sync client:: Already {$oldpid} process executed\n"; return; } @file_put_contents($pidfile, getmypid()); $CyrusToADSyncTime = $sock->GET_INFO("CyrusToADSyncTime"); if (!is_numeric($CyrusToADSyncTime)) { $CyrusToADSyncTime = 10; } if ($CyrusToADSyncTime < 3) { $CyrusToADSyncTime = 3; } if (!$GLOBALS["FORCE"]) { $time = file_time_min($cache_file); if ($time < $CyrusToADSyncTime) { echo "Sync client:: {$time}Mn, need {$CyrusToADSyncTime}Mn, aborting\n"; return; } } @unlink($cache_file); $ldap = new clladp(); $hashUsers = $ldap->Hash_GetALLUsers(); if (!is_array($hashUsers)) { echo "Sync client:: no users\n"; } $failed = 0; while (list($uid, $emailaddr) = each($hashUsers)) { if ($emailaddr == null) { echo "Sync client:: {$uid} skip (no email address set)\n"; continue; } $cyrus = new cyrus(); if ($cyrus->MailBoxExists($uid)) { echo "Sync client:: {$uid} Mailbox already exists\n"; continue; } echo "Sync client:: {$uid} Creating mailbox\n"; if ($cyrus->CreateMailbox($uid)) { $array[$uid] = "OK"; } else { $array[$uid] = "Failed"; $failed++; } } if (count($array) > 0) { while (list($uid, $rr) = each($array)) { $result[] = "{$uid}:{$rr}"; } $unix = new unix(); if ($failed > 0) { $failed_text = " {$failed} failed"; } $unix->send_email_events(count($array) . " new created mailboxes {$failed_text} ", @implode("\n", $result), "mailboxes"); } }
function create_mbx() { if (!islogged(1)) { return false; } $users = new usersMenus(); $cyrus = new cyrus(); $uid = $_GET["mbx"]; if ($cyrus->CreateMailbox($uid) == false) { $error = "{failed}:{creating_mailbox}:{$uid}\n{$cyrus->cyrus_last_error}\n"; } else { $error = "{success}:{creating_mailbox}:{$uid}\n"; } echo "Message from: {$users->hostname}\n"; echo $error; echo "\n"; echo $cyrus->cyrus_infos_cleaned; }
function postfix_status() { $page = CurrentPageName(); $ini = new Bs_IniHandler(); $users = new usersMenus(); $tpl = new templates(); $sock = new sockets(); $version = $sock->getFrameWork("influx.php?version=yes"); $GoToMessaging = "GoToMessaging()"; $stats = array(); $stat = unserialize(base64_decode($sock->getFrameWork("cmd.php?postfix-stat=yes"))); $queues = unserialize($sock->getFrameWork("cmd.php?postfixQueues=yes")); $total = base64_decode($sock->getFrameWork("cmd.php?postfix-multi-postqueue=MASTER")); $SMTP_SUM_DOMAINS = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/SMTP_SUM_DOMAINS")); $SMTP_SUM_CDIR = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/SMTP_SUM_CDIR")); if ($SMTP_SUM_DOMAINS > 0) { $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoSMTPTableDomains()\"\n\t\tstyle='text-decoration:underline'>{domains}: " . FormatNumber($SMTP_SUM_DOMAINS) . "</a></td>\n\t\t</tr>"; } if ($SMTP_SUM_CDIR > 0) { $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoSMTPTableCDIR()\"\n\t\tstyle='text-decoration:underline'>{networks}: " . FormatNumber($SMTP_SUM_CDIR) . "</a></td>\n\t\t</tr>"; } if (is_file("{$GLOBALS["BASEDIR"]}/SMTP_TOTALS")) { $SMTP_TOTALS = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/SMTP_TOTALS")); $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{received}: " . FormatNumber($SMTP_TOTALS["received"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{delivered}: " . FormatNumber($SMTP_TOTALS["delivered"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{rejected}: " . FormatNumber($SMTP_TOTALS["rejected"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{senders}: " . FormatNumber($SMTP_TOTALS["senders"]) . "</a></td>\n\t\t</tr>"; $stats[] = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoPflogsummDetails()\"\n\t\tstyle='text-decoration:underline'>{recipients}: " . FormatNumber($SMTP_TOTALS["recipients"]) . "</a></td>\n\t\t</tr>"; } $postfix_status = $stat[0]; $postfix_version = $stat[1]; $icon = "disks-128-ok.png"; $err = array(); $errT = array(); $c = 0; if (is_file(dirname(__FILE__) . '/logs/artica-backup-size.ini')) { $ini = new Bs_IniHandler(dirname(__FILE__) . '/logs/artica-backup-size.ini'); if ($ini->_params["artica_backup"]["original_messages"] == null) { $ini->_params["artica_backup"]["original_messages"] = 0; } if ($ini->_params["artica_backup"]["attachments"] == null) { $ini->_params["artica_backup"]["attachments"] = 0; } $size = $ini->_params["artica_backup"]["original_messages"] + $ini->_params["artica_backup"]["attachments"]; $size = FormatBytes($size); $link2 = CellRollOver("Loadjs('postfix.backup.monitoring.php')"); if (!isset($queues["backup"])) { $queues["backup"] = 0; } if (!isset($queues["quarantine"])) { $queues["quarantine"] = 0; } $artica_backup = "<tr>\n\t\t<td align='right' {$link2} style='{$textFONTStyle}'>{backup_size}:</a> </td>\n\t\t<td {$link2} ><strong style='{$textFONTStyle}'>{$size}</td>\n\t\t</tr>"; if ($queues["quarantine"] > 0) { $link_quarantine_progress = CellRollOver("Loadjs('postfix.quarantine.progress.php')"); } } if ($users->cyrus_imapd_installed) { include_once dirname(__FILE__) . "/ressources/class.cyrus.inc"; $cyr = new cyrus(); if (!$cyr->TestConnection()) { $err[] = proxy_status_warning("{unable_to_connect_imap}", "{unable_to_connect_imap}", "Loadjs('cyrus.sync-services.progress.php')"); $icon = "disks-128-red.png"; } } $link_corrupt = "Loadjs('postfix.corrupt.queue.php')"; $link_incoming = CellRollOver("Loadjs('postfix.queue.monitoring.php?show-queue=incoming&count={$queues["incoming"]}');"); $link_active = CellRollOver("Loadjs('postfix.queue.monitoring.php?show-queue=active&count={$queues["active"]}');"); $link_deferred = CellRollOver("Loadjs('postfix.queue.monitoring.php?show-queue=deferred&count={$queues["deferred"]}');"); $q = new mysql(); $sql = "SELECT SUM(`size`) as tsize,COUNT(msgid) as tcount FROM postqueue WHERE `instance`='master'"; if (function_exists("mysql_fetch_array")) { $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events')); } $tot = $ligne["tcount"]; $tot_size = $ligne["tsize"] / 1024; $tot_size = FormatBytes($tot_size); $icon = imgtootltip($icon, "position:right:{messaging}", "{$GoToMessaging}"); $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' style='width:128px' >\n\t\t{$icon}\n\t\t</td>\n\t\t<td>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td style='font-size:30px'>\n\t\t" . $tpl->_ENGINE_parse_body(texttooltip("{APP_POSTFIX}", "{messaging}", "{$GoToMessaging}")) . "\n\t\t<div style='width:100%;text-align:right'><span style='font-size:16px'>{version}:{$postfix_version}</div>\n\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2> </td>\n\t\t</tR>\n\t\t\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:PostfixQueueMonitoring()\"\n\t\tstyle='text-decoration:underline'>{smtp_queues}: {$tot_size}</a></td>\n\t\t</tr>\n\t\t" . @implode("\n", $stats) . "\n\n\t\t{$perc_cache}\n\t\t{$SUM_FAMILYSITES_TEXT}\n\t\t" . @implode("", $errT) . "\n\t\t" . @implode("", $err) . "\n\t\t{$important_events_text}\n\t\t</table>\n\t\t</td>\n\t</tr>\n\t\t\t</table>\n\t\t\t"; $html = $tpl->_ENGINE_parse_body($html); return $html; }
function TreeSynchronyzeMailBoxes() { $usr = new usersMenus(); $tpl = new templates(); if ($usr->AsMailBoxAdministrator == false) { echo $tpl->_ENGINE_parse_body('{no_privileges}'); exit; } include_once "ressources/class.cyrus.inc"; $cyrus = new cyrus(); echo $tpl->_ENGINE_parse_body($cyrus->SynchronizeMailBoxes()); }
function rebuild_all_mailboxes($ou_encoded) { if (!Build_pid_func(__FILE__, "rebuild_all_mailboxes_{$ou_encoded}")) { rebuild_all_mailboxes_events("Already executed", $ou_encoded); return; } $ldap = new clladp(); $filter = "(&(objectClass=userAccount)(|(cn=*)(mail=*)))"; $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber"); $dn = "ou=" . base64_decode($ou_encoded) . ",dc=organizations,{$ldap->suffix}"; $hash = $ldap->Ldap_search($dn, $filter, $attrs); $number = $hash["count"]; rebuild_all_mailboxes_events("{$number} user(s) in {$dn}", $ou_encoded); for ($i = 0; $i < $number; $i++) { $userARR = $hash[$i]; $uid = $userARR["uid"][0]; $ct = new user($uid); if (strpos($uid, '$') > 0) { rebuild_all_mailboxes_events("{$ct->DisplayName} SKIP {computer}=TRUE", $ou_encoded); continue; } if ($ct->MailboxActive != 'TRUE') { rebuild_all_mailboxes_events("{$ct->DisplayName} SKIP MailboxActive=FALSE", $ou_encoded); continue; } $cyrus = new cyrus(); if ($cyrus->MailBoxExists($uid)) { rebuild_all_mailboxes_events("[{$number}/{$i}]:: {$uid}: {mailbox_already_exists}", $ou_encoded); continue; } $cyrus->CreateMailbox($uid); rebuild_all_mailboxes_events("[{$number}/{$i}]::{$uid}: {$cyrus->cyrus_infos}", $ou_encoded); } rebuild_all_mailboxes_events("{success}", $ou_encoded); }
monit(); die; } $sock = new sockets(); $ArticaFirstWizard = $sock->GET_INFO('ArticaFirstWizard'); if ($ArticaFirstWizard == 1) { die; } if ($users->POSTFIX_INSTALLED) { $ldap->AddDomainEntity($domainname, "{$domainname}"); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } if ($users->cyrus_imapd_installed) { $cyr = new cyrus(); $cyr->CreateMailbox("postmaster"); } $sock->SET_INFO("ArticaFirstWizard", 1); die; function events($text) { $logFile = "/var/log/artica-postfix/artica-status.debug"; $pid = getmypid(); $date = date('Y-m-d H:i:s'); $size = @filesize($logFile); if ($size > 1000000) { @unlink($logFile); } $f = @fopen($logFile, 'a'); $page = CurrentPageName();