function INDEX() { $ldap = new clladp(); $ou = $_GET["ou"]; $Hash_datas = $ldap->OUDatas($ou); $h_type = array("spam" => "spam", "ham" => "ham"); $domains1 = $ldap->hash_get_domains_ou($ou); $domainsF1 = Field_array_Hash($domains1, 'bogo_spam_domain', null, null, null, 0, 'width:150px'); $type = Field_array_Hash($h_type, 'bogo_type', null, null, null, 0, 'width:100px'); $hash_action = array("delete" => "{bogo_delete}", "quarantine" => "{bogo_quarantine}", "prepend" => "{bogo_prepend}"); $form_email = "\n\t<input type='hidden' id='ou' value='{$ou}'>\n\t<H5>{bogo_robots}</H5>\n\t<table style='width:100%'>\n\t<tr>\n\t<td align='right' nowrap><strong>{add_bogo_spam}:</strong></td>\n\t<td>" . Field_text('bogo_spam') . "</td>\n\t<td>{$domainsF1}</td>\n\t<td>{$type}</td>\n\t<td><input type='button' value='{add} »' OnClick=\"javascript:bogoAddSpamUser();\"></td>\n\t</tr>\n\t</table>\n\t\n\t"; for ($i = 1; $i < 10; $i++) { $h_level[$i . '0'] = $i . '0 %'; } $actions_datas = explode(';', $Hash_datas["BogoFilterAction"]); $action = "\n\t<H5>{spam_action}</H5>\n\t{spam_action_text} " . Field_array_Hash($h_level, 'exceed', $actions_datas[0], null, null, 0, 'width:60px') . " {then} " . Field_array_Hash($hash_action, 'action', $actions_datas[1], null, null, 0, 'width:160px') . "<br><br>\n\t{if_bogo_prepend} " . Field_text('bogo_prepend', $actions_datas[2], 'width:150px') . "\n\t<div style='width:100%;text-align:right'><input type='button' value='{edit} »»' OnClick=\"javascript:BogoFilterAction();\"></div>\n\t\n\t"; $area_robots = "<div id='robots'></div><script>LoadAjax('robots','{$page}?GetRobots={$ou}')</script>"; $area_robots = RoundedLightGrey($area_robots); $action = RoundedLightGrey($action); $form_email = RoundedLightGrey($form_email); $page = CurrentPageName(); $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/bg_bogofilter.jpg'></td>\n\t<td valign='top' width=99%>" . RoundedLightGreen("{bogo_intro}") . "</td>\n\t</tr>\n\t</table>\n\t{$form_email}\n\t<br>\n\t{$action}\n\t<br>\n\t{$area_robots}\n\t"; $cfg["JS"][] = "js/bogofilter.js"; $tpl = new template_users('{APP_BOGOFILTER}', $html, 0, 0, 0, 0, $cfg); echo $tpl->web_page; }
function popup() { $ldap = new clladp(); $info = $ldap->OUDatas($_GET["ou"]); $zarafaEnabled = 1; if (!$info["objectClass"]["zarafa-company"]) { $zarafaEnabled = 0; } $enable = Paragraphe_switch_img("{ENABLE_ZARAFA_COMPANY}", "{ENABLE_ZARAFA_COMPANY_TEXT}", "zarafaEnabled", $zarafaEnabled); $html = "\n\t{$enable}\n\t<hr>\n\t\t<div style='text-align:right'>" . button("{apply}", "ENABLE_ZARAFA_COMPANY()") . "</div>\n\t\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function INDEX() { $ldap = new clladp(); $page = CurrentPageName(); $hash = $ldap->OUDatas($_GET["ou"]); $hashD[1] = "1 {day}"; for ($i = 2; $i < 91; $i++) { $hashD[$i] = "{$i} {days}"; } $ArticaMaxDayQuarantine = Field_array_Hash($hashD, 'ArticaMaxDayQuarantine', $hash["ArticaMaxDayQuarantine"]); $html = "\n\t\t<input type='hidden' name='close_form' id='close_form' value='{close_form}'>\n\t<form name='FFMQ'>\n\n\t<input type='hidden' name='ou' id='ou' value='{$_GET["ou"]}'>\n\t" . RoundedLightGrey("<H5>{quarantine_max_day}</H5>\n\t<table style='width:100%'>\n\t<tr>\n\t<td align='left' class=caption>{quarantine_max_day_text}</td>\n\t<td>{$ArticaMaxDayQuarantine}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2 align='right'><input type='button' value='{edit} »' OnClick=\"javascript:ParseForm('FFMQ','{$page}',true);\"></td>\n\t</table>") . "\n\t</form><br>\n\t<div id=\"ButtonCloseIframe\" style='text-align:right'></div>\n\t<iframe id='template_forms' scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" vspace=\"0\" hspace=\"0\" style=\"overflow:visible; width:100%; display:none\">\n\t</iframe>" . TemplatesForms(); $cfg["JS"][] = "js/quarantine.ou.js"; $tpl = new template_users('{global_quarantine_rules}', $html, 0, 0, 0, 0, $cfg); echo $tpl->web_page; }
function popup() { $page = CurrentPageName(); $ldap = new clladp(); $sock = new sockets(); $info = $ldap->OUDatas($_GET["ou"]); $zarafaEnabled = 1; if (!$info["objectClass"]["zarafa-company"]) { $zarafaEnabled = 0; } $ZarafaUserSafeMode = $sock->GET_INFO("ZarafaUserSafeMode"); $languages = unserialize(base64_decode($sock->getFrameWork("zarafa.php?locales=yes"))); $langbox[null] = "{select}"; while (list($index, $data) = each($languages)) { $langbox[$data] = $data; } $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $oumd5 = md5(strtolower(trim($_GET["ou"]))); $OuDefaultLang = $sock->GET_INFO("zarafaMBXLang{$oumd5}"); $OuZarafaDeleteADM = $sock->GET_INFO("OuZarafaDeleteADM{$oumd5}"); $filter = "(&(objectClass=zarafa-user)(zarafaAdmin=1))"; $attrs = array("displayName", "uid", "mail"); $dn = "ou={$_GET["ou"]},dc=organizations,{$ldap->suffix}"; $hash = $ldap->Ldap_search($dn, $filter, $attrs); $number = $hash["count"]; $arruid[null] = "{select}"; for ($i = 0; $i < $number; $i++) { $userZ = $hash[$i]; $uid = $userZ["uid"][0]; $arruid[$uid] = $uid; } $admin_delete = Field_array_Hash($arruid, "OuZarafaDeleteADM{$t}", $OuZarafaDeleteADM, "style:font-size:16px;padding:3px"); $mailbox_language = Field_array_Hash($langbox, "zarafaMbxLang{$t}", $OuDefaultLang, "style:font-size:16px;padding:3px"); if ($OuDefaultLang != null) { $rescan = "<div style='width:100%;margin:10px'><center>" . button("{scan_mailboxes_language}", "zarafaDScanMBXLang{$t}()", "16") . "</center></div>"; } if ($ZarafaUserSafeMode == 1) { $warn = "\n\t\t\t<hr>\n\t\t\t<table style='width:99 %' class=form>\n\t\t\t<tr>\n\t\t\t<td valign='top'><img src='img/error-64.png'></td>\n\t\t\t<td valign='top'><strong style='font-size:14px'>{ZARAFA_SAFEMODE_EXPLAIN}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t\n\t\t\t"; } $enable = Paragraphe_switch_img("{ENABLE_ZARAFA_COMPANY}", "{ENABLE_ZARAFA_COMPANY_TEXT}", "zarafaEnabled", $zarafaEnabled, null, 400); $html = "\n\t<div id='{$t}-anim'></div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2>{$enable}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{default_language}:</td>\n\t\t<td>{$mailbox_language}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{delete_store_receiver}:</td>\n\t\t<td>{$admin_delete}</td>\n\t</tr>\t\n\t<tr>\n\t<td colspan=2 align='right'>\n\t<hr>" . button("{apply}", "ENABLE_ZARAFA_COMPANY()", 16) . "{$warn}</td>\n\t</tr>\n\t</table>\n\t{$rescan}\n\t</div>\n\t<script>\nvar X_ENABLE_ZARAFA_COMPANY= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\tdocument.getElementById('{$t}-anim').innerHTML='';\n\t\$('#table-{$t}').flexReload();\n\tif(document.getElementById('organization-find')){SearchOrgs();YahooWin3Hide();return;}\n\tZARAFA_OU_LOAD();\n\t\n\t}\t\n\t\nfunction ENABLE_ZARAFA_COMPANY(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zarafaEnabled',document.getElementById('zarafaEnabled').value);\n\tXHR.appendData('zarafaMbxLang',document.getElementById('zarafaMbxLang{$t}').value);\n\tXHR.appendData('OuZarafaDeleteADM',document.getElementById('OuZarafaDeleteADM{$t}').value);\n\tXHR.appendData('ou','{$_GET["ou"]}');\n\tAnimateDiv('{$t}-anim');\n\tXHR.sendAndLoad('{$page}', 'GET',X_ENABLE_ZARAFA_COMPANY);\t\n}\n\n\nfunction zarafaDScanMBXLang{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zarafaScanMbxLang','yes');\n\tXHR.appendData('ou','{$_GET["ou"]}');\n\tAnimateDiv('{$t}-anim');\n\tXHR.sendAndLoad('{$page}', 'POST',X_ENABLE_ZARAFA_COMPANY);\t\n}\n\n</script>\t\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function popup() { $ldap = new clladp(); $sock = new sockets(); $info = $ldap->OUDatas($_GET["ou"]); $zarafaEnabled = 1; if (!$info["objectClass"]["zarafa-company"]) { $zarafaEnabled = 0; } $ZarafaUserSafeMode = $sock->GET_INFO("ZarafaUserSafeMode"); if ($ZarafaUserSafeMode == 1) { $warn = "\n\t\t\t<hr>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='top'><img src='img/error-64.png'></td>\n\t\t\t<td valign='top'><strong style='font-size:14px'>{ZARAFA_SAFEMODE_EXPLAIN}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t\n\t\t\t"; } $enable = Paragraphe_switch_img("{ENABLE_ZARAFA_COMPANY}", "{ENABLE_ZARAFA_COMPANY_TEXT}", "zarafaEnabled", $zarafaEnabled, null, 400); $html = "\n\t{$enable}\n\t<hr>\n\t\t<div style='text-align:right'>" . button("{apply}", "ENABLE_ZARAFA_COMPANY()") . "</div>\n\t{$warn}\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function INDEX() { if (!isset($_GET["ou"])) { header('location:domains.index.php'); exit; } $page = CurrentPageName(); $ou = $_GET["ou"]; $ldap = new clladp(); $hash = $ldap->OUDatas($ou); $ArticaFakedMailFrom_table = array("pass" => '{pass}', "quarantine" => "{quarantine}", "delete" => "{delete}"); $ArticaFakedMailFrom_field = Field_array_Hash($ArticaFakedMailFrom_table, "ArticaFakedMailFrom", $hash["ArticaFakedMailFrom"], null, null, null, 'width:100px'); $ArticaDenyNoMXRecords_table = array('pass' => '{pass}', "reject" => "{reject}"); $ArticaDenyNoMXRecords_field = Field_array_Hash($ArticaDenyNoMXRecords_table, "ArticaDenyNoMXRecords", $hash["ArticaDenyNoMXRecords"], null, null, null, 'width:100px'); $ArticaOuTrustMyUSers_field = Field_yesno_checkbox_img('OuTrustMyUSers', $hash["OuTrustMyUSers"], '{enable_disable}'); $ArticaOuTrustMyUSers = "<H5>{trust_users}</H5>\n\t<div class=caption>{trust_users_text}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td align='right' valign='top' nowrap><strong>{trust_users}</strong></td>\n\t\t<td align='left' valign='top'>{$ArticaOuTrustMyUSers_field}</td>\n\t\t\n\t</tr>\t\n\t</table>\n\t\n\t"; $ArticaOuTrustMyUSers = RoundedLightGreen($ArticaOuTrustMyUSers); $html = "\n\t<form name='FFMQ'>\n\t<table style='width:100%;'>\n\t<tr>\n\t\t<td width=50% valign='top' style='margin:4px;padding:4px'>\n\t<input type='hidden' name='ou' value='{$ou}'>\n\t" . RoundedLightGrey("<H5>{ArticaFakedMailFrom}</H5>\n\t<div class=caption>{ArticaFakedMailFrom_text}</div>\n\t<table style='width:90%;border:1px solid #CCCCCC;padding:5px;margin:5px'>\n\t<tr>\n\t\t<td align='right' valign='top' nowrap><strong>{ArticaFakedMailFrom}</strong></td>\n\t\t<td align='left' valign='top'>{$ArticaFakedMailFrom_field}</td>\n\t\t\n\t</tr>\n\t</table>") . "</td>\n\t\n\t\n\t<td width=50% valign='top' style='margin:4px;padding:4px'>" . RoundedLightGrey("\n\t<H5>{ArticaDenyNoMXRecords}</H5>\n\t<div class=caption>{ArticaDenyNoMXRecords_text}</div>\n\t<table style='width:90%;border:1px solid #CCCCCC;padding:5px;margin:5px'>\n\t<tr>\n\t\t<td align='right' valign='top' nowrap><strong>{ArticaDenyNoMXRecords}</strong></td>\n\t\t<td align='left' valign='top'>{$ArticaDenyNoMXRecords_field}</td>\n\t\t\n\t</tr>\t\n\t</table>\n\t") . "\n\t<br>\n\t{$ArticaOuTrustMyUSers}\n\t</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2 align='right' style='border-top:1px solid #CCCCCC'><input type='submit' value='{apply} »' style='width:150px'></td>\n\t</tr>\n\t</table>\n\t</form>"; $cfg["JS"][] = "js/quarantine.ou.js"; $tpl = new template_users('{artica_filters_rules}', $html, 0, 0, 0, 0, $cfg); echo $tpl->web_page; }
function save() { $tpl = new templates(); $users = new user($_GET["login"]); if ($users->password != null) { writelogs("User already exists {$_GET["login"]} ", __FUNCTION__, __FILE__); echo $tpl->_ENGINE_parse_body('{account_already_exists}'); exit; } $ou = $_REQUEST["ou"]; $password = $_REQUEST["password"]; writelogs("Add new user {$_REQUEST["login"]} {$_REQUEST["ou"]} {$_REQUEST["gpid"]}", __FUNCTION__, __FILE__); $users->ou = $_REQUEST["ou"]; $users->password = $_REQUEST["password"]; $users->mail = "{$_REQUEST["email"]}@{$_REQUEST["internet_domain"]}"; $users->DisplayName = "{$_REQUEST["firstname"]} {$_REQUEST["lastname"]}"; $users->givenName = $_REQUEST["firstname"]; $users->sn = $_REQUEST["lastname"]; $users->group_id = $_REQUEST["gpid"]; if (is_numeric($_REQUEST["gpid"])) { $gp = new groups($_REQUEST["gpid"]); writelogs("privileges: {$_REQUEST["gpid"]} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__); if ($gp->Privileges_array["AsComplexPassword"] == "yes") { $ldap = new clladp(); $hash = $ldap->OUDatas($ou); $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true); $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"])); if (is_array($policiespwd)) { $priv = new privileges(); if (!$priv->PolicyPassword($password, $policiespwd)) { return false; } } } return false; } $users->add_user(); }
function OUSettings() { $ldap = new clladp(); $ou = $_GET["ou"]; $hash = $ldap->OUDatas($ou); $users = new usersMenus(); $privs = $users->_ParsePrivieleges($hash["ArticaGroupPrivileges"]); $privs["ForceLanguageUsers"] = $_GET["OUlanguage"]; $conf = $users->_BuildPrivileges($privs); $dn = "ou={$ou},dc=organizations,{$ldap->suffix}"; $upd["ArticaGroupPrivileges"][0] = $conf; if (!$ldap->Ldap_modify($dn, $upd)) { echo $ldap->ldap_last_error; } }
function quarantine_ou_settings() { $ou = $_GET["ou"]; $ouU = strtoupper($ou); $ldap = new clladp(); $hash = $ldap->OUDatas($ou); $sock = new sockets(); $users = new usersMenus(); $ini = new Bs_IniHandler(); $ini->loadString($sock->GET_INFO("OuSendQuarantineReports{$ouU}")); if ($ini->_params["NEXT"]["hour"] == null) { $ini->_params["NEXT"]["hour"] = "23"; } if ($ini->_params["NEXT"]["Min"] == null) { $ini->_params["NEXT"]["Min"] = "59"; } if ($ini->_params["NEXT"]["Enabled"] == null) { $ini->_params["NEXT"]["Enabled"] = "0"; } if ($ini->_params["NEXT"]["days"] == null) { $ini->_params["NEXT"]["days"] = "2"; } if ($ini->_params["NEXT"]["mailfrom"] == null) { $ini->_params["NEXT"]["mailfrom"] = "reports@{$users->hostname}"; } if ($ini->_params["NEXT"]["subject"] == null) { $ini->_params["NEXT"]["subject"] = "Daily Quarantine report"; } if ($ini->_params["NEXT"]["title1"] == null) { $ini->_params["NEXT"]["title1"] = "Quarantine domain senders"; } if ($ini->_params["NEXT"]["title2"] == null) { $ini->_params["NEXT"]["title2"] = "Quarantine list"; } if ($ini->_params["NEXT"]["explain"] == null) { $ini->_params["NEXT"]["explain"] = "You will find here all mails stored in your quarantine area"; } if ($ini->_params["NEXT"]["externalLink"] == null) { $ini->_params["NEXT"]["externalLink"] = "https://{$_SERVER["SERVER_NAME"]}/user.quarantine.query.php"; } $OuSendQuarantineReports = $ini->_params["NEXT"]["Enabled"]; for ($i = 0; $i < 60; $i++) { $text = $i; if ($i < 10) { $text = "0{$i}"; } $M[$i] = $text; } for ($i = 0; $i < 24; $i++) { $text = $i; if ($i < 10) { $text = "0{$i}"; } $H[$i] = $text; } for ($i = 0; $i < 30; $i++) { $text = $i; if ($i < 10) { $text = "{$i}"; } $D[$i] = $text; } $minutes = Field_array_Hash($M, "Min", $ini->_params["NEXT"]["Min"]); $hours = Field_array_Hash($H, "hour", $ini->_params["NEXT"]["hour"]); $report = Field_array_Hash($D, "days", $ini->_params["NEXT"]["days"]); $time = "\n\t\n\t<table style='width:9%;margin-top:0px;' class=form>\n\t<tr>\n\t<td class=caption nowrap>{timetosendreport}:</td>\n\t<td>{$hours}</td>\n\t<td><strong>:</strong>\n\t<td>{$minutes}</td>\n\t</tr>\n\t</table>\n\t<br>\n\t<table style='width:99%;margin-top:0px;' class=form>\n\t<tr>\n\t\t<td class=legend nowrap>{build_report_for}:</td>\n\t\t<td>{$report} {days}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{externalLink}:</td>\n\t\t<td>" . Field_text('externalLink', $ini->_params["NEXT"]["externalLink"], "width:250px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{sender}:</td>\n\t\t<td>" . Field_text('mailfrom', $ini->_params["NEXT"]["mailfrom"], "width:200px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{subject}:</td>\n\t\t<td>" . Field_text('subject', $ini->_params["NEXT"]["subject"], "width:250px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{explain}:</td>\n\t\t<td>" . Field_text('explain', $ini->_params["NEXT"]["explain"], "width:250px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>title 1:</td>\n\t\t<td>" . Field_text('title1', $ini->_params["NEXT"]["title1"], "width:250px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>title 2:</td>\n\t\t<td>" . Field_text('title2', $ini->_params["NEXT"]["title2"], "width:250px") . "</td>\n\t</tr>\t\t\t\t\t\t\t\n\t</table>\n\t<div style='margin:0px;width:100%;text-align:right;border-top:1px solid #CCCCCC'><input type='button' OnClick=\"javascript:QuarantineMailSettingsSave();\" value='{apply} »'></div>\n\t"; $field = Paragraphe_switch_img('{enable_html_reports}', '{ou_quarantine_reports_explain}', "OuSendQuarantineReports", $OuSendQuarantineReports); $tpl = new templates(); $html = "\n\t<H1>{quarantine_reports}</H1>\n\t<div id='quarantine_ou_settings'>\n\t<p class=caption>{quarantine_reports_text}</p>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' align='center'>\n\t\t{$field}\n\t\t<br>{$quarantine_robot}\n\t</td>\n\t<td valign='top'>\n\t{$time}\n\t\n\t</td>\n\t</tr>\n\t</table>\n\t</div>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function EditGroup() { $gid = $_GET["PrivilegesGroup"]; $ldap = new clladp(); $update_array = array(); writelogs("Save privileges for {$gid}", __CLASS__, __FUNCTION__, __FILE__, __LINE__); $loadGPID = true; if ($gid == -1) { $loadGPID = false; $Hash = $ldap->OUDatas($_GET["ou"]); writelogs("Loading ou datas of \"{$_GET["ou"]}\" ArticaGroupPrivileges=" . strlen($Hash["ArticaGroupPrivileges"]) . " bytes", __FUNCTION__, __FILE__, __LINE__); $dn = $Hash["dn"]; } if ($gid == -2) { $loadGPID = false; $user = new user($_GET["userid"]); $Hash["ArticaGroupPrivileges"] = $user->ArticaGroupPrivileges; writelogs("Loading datas of \"{$_GET["userid"]}\" ArticaGroupPrivileges={$user->ArticaGroupPrivileges} bytes", __FUNCTION__, __FILE__, __LINE__); } if ($gid > 0) { writelogs("Loading datas of ldap->GroupDatas(\"{$_GET["{$gid}"]}\") ", __FUNCTION__, __FILE__, __LINE__); $Hash = $ldap->GroupDatas($gid); } if (!is_array($Hash["ArticaGroupPrivileges"])) { writelogs("ldap->_ParsePrivieleges(...)", __FUNCTION__, __FILE__, __LINE__); $ArticaGroupPrivileges = $ldap->_ParsePrivieleges($Hash["ArticaGroupPrivileges"]); } else { $ArticaGroupPrivileges = $Hash["ArticaGroupPrivileges"]; } if (!is_array($ArticaGroupPrivileges)) { writelogs("ArticaGroupPrivileges[] is not an array !", __FUNCTION__, __FILE__, __LINE__); } if (is_array($ArticaGroupPrivileges)) { while (list($num, $val) = each($ArticaGroupPrivileges)) { $GroupPrivilege[$num] = $val; } } while (list($num, $val) = each($_GET)) { writelogs("ADD GroupPrivilege[{$num}]={$val}", __FUNCTION__, __FILE__, __LINE__); $GroupPrivilege[$num] = $val; } while (list($num, $val) = each($GroupPrivilege)) { if ($val == "no") { writelogs("[{$num}]=SKIP", __FUNCTION__, __FILE__, __LINE__); continue; } writelogs("[{$num}]=\"{$val}\"", __FUNCTION__, __FILE__, __LINE__); $GroupPrivilegeNew[] = "[{$num}]=\"{$val}\""; } $values = @implode($GroupPrivilegeNew, "\n"); if ($gid == -2) { writelogs("ArticaGroupPrivileges -> {$gid} -> user->SavePrivileges() values={$values}", __FUNCTION__, __FILE__, __LINE__); $user->SavePrivileges($values); return; } if (strpos($gid, ",") > 0) { $gp = new external_ad_search(); $gp->SaveGroupPrivileges($values, $gid); return; } $update_array["ArticaGroupPrivileges"][0] = $values; writelogs("ArticaGroupPrivileges -> {$Hash["dn"]} -> group->SavePrivileges() values={$values}", __FUNCTION__, __FILE__, __LINE__); if (!$ldap->Ldap_modify($Hash["dn"], $update_array)) { echo basename(__FILE__) . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error; } }
function create_user($filename) { $tpl = new templates(); $unix = new unix(); $nohup = null; $path = "/usr/share/artica-postfix/ressources/logs/web/create-users/{$filename}"; echo "Path:{$path}\n"; build_progress("Open {$filename}", 10); if (!is_file($path)) { echo "{$path} no such file...\n"; return false; } $MAIN = unserialize(base64_decode(@file_get_contents($path))); build_progress("Create new member {$MAIN["login"]}", 15); $users = new user($MAIN["login"]); if ($users->password != null) { echo "User already exists {$MAIN["login"]}\n"; build_progress("{account_already_exists}", 110); @unlink($path); return; } $ou = $MAIN["ou"]; $password = url_decode_special_tool($MAIN["password"]); $MAIN["firstname"] = url_decode_special_tool($MAIN["firstname"]); $MAIN["lastname"] = url_decode_special_tool($MAIN["lastname"]); build_progress("{$MAIN["firstname"]} {$MAIN["lastname"]}", 20); if (trim($MAIN["internet_domain"]) == null) { $MAIN["internet_domain"] = "localhost.localdomain"; } echo "Add new user {$MAIN["login"]} {$MAIN["ou"]} {$MAIN["gpid"]}\n"; $users->ou = $MAIN["ou"]; $users->password = url_decode_special_tool($MAIN["password"]); $users->mail = "{$MAIN["email"]}@{$MAIN["internet_domain"]}"; $users->DisplayName = "{$MAIN["firstname"]} {$MAIN["lastname"]}"; $users->givenName = $MAIN["firstname"]; $users->sn = $MAIN["lastname"]; $users->group_id = $MAIN["gpid"]; $users->homeDirectory = "/home/{$MAIN["login"]}"; if (is_numeric($MAIN["gpid"])) { $gp = new groups($MAIN["gpid"]); echo "privileges: {$MAIN["gpid"]} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"\n"; if ($gp->Privileges_array["AsComplexPassword"] == "yes") { $ldap = new clladp(); $hash = $ldap->OUDatas($ou); $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true); $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"])); if (is_array($policiespwd)) { $priv = new privileges(); if (!$priv->PolicyPassword($password, $policiespwd)) { build_progress("Need complex password", 110); echo "Need complex password"; @unlink($path); return; } } } } build_progress("{$MAIN["firstname"]} {$MAIN["lastname"]} {save}", 25); if (!$users->add_user()) { echo $users->error . "\n" . $users->ldap_error; build_progress("{failed}", 110); @unlink($path); return; } @mkdir("{$users->homeDirectory}"); @chown("{$users->homeDirectory}", $users->uid); if ($MAIN["ByZarafa"] == "yes") { $terminated = " >/dev/null"; $zarafa_admin = $unix->find_program("zarafa-admin"); if (!$GLOBALS["WAIT"]) { $nohup = $unix->find_program("nohup"); $terminated = null; } if (isset($MAIN["ZARAFA_LANG"])) { $users->SaveZarafaMbxLang($MAIN["ZARAFA_LANG"]); $langcmd = " --lang {$MAIN["ZARAFA_LANG"]} "; } $ldap = new clladp(); $dn = "ou={$MAIN["ou"]},dc=organizations,{$ldap->suffix}"; $upd["objectClass"] = "zarafa-company"; $upd["cn"] = $MAIN["ou"]; if (!$ldap->Ldap_add_mod("{$dn}", $upd)) { echo $ldap->ldap_last_error; build_progress("{failed} OpenLDAP Error", 110); @unlink($path); return; } build_progress("{create_store} {language}: {$MAIN["ZARAFA_LANG"]}", 30); $cmd = "{$nohup} {$zarafa_admin} {$langcmd}--create-store {$MAIN["login"]} >/dev/null 2>&1 &"; system(trim($cmd)); if (!$GLOBALS["WAIT"]) { $sock = new sockets(); $sock->getFrameWork("cmd.php?zarafa-hash=yes&rebuild=yes"); return; } @unlink("/usr/share/artica-postfix/ressources/databases/ZARAFA_DB_STATUS.db"); @unlink("/etc/artica-postfix/zarafa-export.db"); $cmd = LOCATE_PHP5_BIN2() . " /usr/share/artica-postfix/exec.zarafa.build.stores.php --export-hash"; build_progress("{export_stores_data}", 35); echo "{$cmd}\n"; system($cmd); } echo "Remove {$path}\n"; @unlink($path); return true; }
function USER_ADD() { $userid = $_REQUEST["new_userid"]; $password = $_REQUEST["password"]; $group_id = $_REQUEST["group_id"]; if (isset($_GET["encpass"])) { $password = url_decode_special_tool($password); } $ou = $_REQUEST["ou"]; $tpl = new templates(); if (preg_match("#(.+?)@(.+)#", $_REQUEST["email"], $re)) { $_REQUEST["user_domain"] = $re[2]; $_REQUEST["email"] = $re[1]; } $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"]; $email = strtolower($email); $user = new usersMenus(); if ($user->EnableVirtualDomainsInMailBoxes == 1) { writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__); $userid = $email; } if (is_numeric($group_id)) { $gp = new groups($group_id); writelogs("privileges: {$group_id} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__); if ($gp->Privileges_array["AsComplexPassword"] == "yes") { $ldap = new clladp(); $hash = $ldap->OUDatas($ou); $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true); $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"])); if (is_array($policiespwd)) { $priv = new privileges(); if (!$priv->PolicyPassword($password, $policiespwd)) { return false; } } } else { writelogs("privileges: {$group_id} -> AsComplexPassword = \"No\" -> continue", __FUNCTION__, __FILE__, __LINE__); } } $users = new user($userid); if ($users->UserExists) { echo $tpl->javascript_parse_text('ERROR: {account_already_exists}'); return false; } writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__); $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"]; if ($ou == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}')); exit; } if ($userid == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}')); exit; } if ($password == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}')); exit; } if ($email == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}')); exit; } $ldap = new clladp(); if (!is_numeric($group_id)) { writelogs("Groupid is not numeric", __FUNCTION__, __FILE__, __LINE__); $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}"; if (!$ldap->ExistsDN($default_dn_group)) { $ldap->AddGroup("nogroup", $ou); } $group_id = $ldap->GroupIDFromName($ou, "nogroup"); if (!is_numeric($group_id)) { $group_id = 0; } } $emT = explode('@', $email); //Verify domains --------------------------------------------------------------- 2008 10 05,P3 $hash_domains_table = $ldap->hash_get_domains_ou($ou); if (!isset($hash_domains_table[$_REQUEST["user_domain"]])) { writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__); writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__); $ldap->AddDomainEntity($ou, $_REQUEST["user_domain"]); } //------------------------------------------------------------------------------ $domains = $ldap->domains_get_locals_domains($ou); $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}"; if ($ldap->ExistsDN($dn)) { writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__); echo $userid; exit; } $users = new user($userid); $users->mail = $email; $users->accountGroup = $group_id; $users->domainname = $_REQUEST["user_domain"]; if ($password != null) { $users->password = $password; } $users->ou = $ou; if ($domains[$_REQUEST["user_domain"]] == true) { $upd = array(); writelogs("is a local domain {$_REQUEST["user_domain"]}={$domains[$_REQUEST["user_domain"]]}", __FUNCTION__, __FILE__, __LINE__); $upd["ObjectClass"][] = 'ArticaSettings'; $users->MailboxActive = "TRUE"; } if (!$users->add_user()) { echo "ERROR: add_user(): " . $users->ldap_error . "\n" . basename(__FILE__) . "\nLine:" . __LINE__; exit; } writelogs("Success adding user, now, add user {$users->uid} to group {$group_id} ", __FUNCTION__, __FILE__, __LINE__); if ($group_id > 0) { $ldap->AddUserToGroup($group_id, $users->uid); } echo $users->uid; }
function RblDelete() { $ldap = new clladp(); $ou = $_GET["ou"]; $hash = $ldap->OUDatas($ou); $upd["SURBLServers"] = $hash["SURBLServers"][$_GET["SURBLServers"]]; $dn = "ou={$ou},dc=organizations,{$ldap->suffix}"; if (!$ldap->Ldap_del_mod($dn, $upd)) { echo $ldap->ldap_last_error; } }
function ORGANISATIONS_LIST() { $page = CurrentPageName(); $search = $_GET["search"]; if ($search == null) { $search = "*"; } if (strpos(" {$search}", "*") == 0) { $search = $search . "*"; } $users = new usersMenus(); $sock = new sockets(); $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } $AllowInternetUsersCreateOrg = $sock->GET_INFO("AllowInternetUsersCreateOrg"); if ($EnableManageUsersTroughActiveDirectory == 1) { $ldap = new ldapAD(); $hash = $ldap->hash_get_ou(true); } else { $ldap = new clladp(); $hash = $ldap->hash_get_ou(true); } if (!is_array($hash)) { return null; } ksort($hash); if ($EnableManageUsersTroughActiveDirectory == 0) { if (!$ldap->BuildOrganizationBranch()) { $error = "<div style='float:left'>" . Paragraphe("danger64.png", "{GENERIC_LDAP_ERROR}", $ldap->ldap_last_error) . "</div>"; } } $page = CurrentPageName(); if (isset($_GET["ajaxmenu"])) { $header = "\n\t<input type='hidden' name='add_new_organisation_text' id='add_new_organisation_text' value='{add_new_organisation_text}'>\n\t<input type='hidden' name='ajaxmenu' id='ajaxmenu' value='yes'>"; } $add = butadm(); $html = "\n\t{$header}\n\t{$error}<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>{$add}</th>\n\t\t<th>{organizations}</th>"; if ($users->ZARAFA_INSTALLED) { if ($users->AsMailBoxAdministrator) { $html = $html . "<th>Zarafa</th>"; } } $html = $html . "<th colspan=2>{users}</th>\n\t\t<th colspan=2>{groups}</th>\n\t\t<th>{domains}</th>\n\t\t<th> </th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; if (isset($_GET["ajaxmenu"])) { $ajax = true; } $pic = "32-environement.png"; $search = str_replace(".", "\\.", $search); $search = str_replace("*", ".*?", $search); $style = "style='font-size:16px;'"; while (list($num, $ligne) = each($hash)) { $ou = $ligne; $ou_encoded = base64_encode($ou); if (!preg_match("#{$search}#i", $ligne)) { writelogs("'{$ligne}' NO MATCH {$search}", __FUNCTION__, __FILE__, __LINE__); continue; } $md = md5($ligne); $uri = "javascript:Loadjs('domains.manage.org.index.php?js=yes&ou={$ligne}');"; if ($ajax) { $uri = "javascript:Loadjs('{$page}?LoadOrgPopup={$ligne}');"; } if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } Paragraphe($img, "{manage} {$ligne}", "<strong>{$ligne}:{$usersNB}<br></strong>{manage_organisations_text}", $uri, null); if ($EnableManageUsersTroughActiveDirectory == 0) { $img = $ldap->get_organization_picture($ligne, 32); $usersNB = $ldap->CountDeUSerOu($ligne); $usersNB = "{$usersNB}"; } else { $img = $pic; $usersNB = $ldap->CountDeUSerOu($ligne); $usersNB = "{$usersNB}"; } $delete = imgtootltip("delete-32-grey.png", "<b>{delete_ou} {$ligne}</b><br><i>{delete_ou_text}</i>"); if ($users->AsArticaAdministrator) { $delete = Paragraphe('64-cancel.png', "{delete_ou} {$ligne}", '{delete_ou_text}', "javascript:Loadjs('domains.delete.org.php?ou={$ligne}');", null, 210, 100, 0, true); $delete = imgtootltip("delete-32.png", "<b>{delete_ou} {$ligne}</b><br><i>{delete_ou_text}</i>", "javascript:Loadjs('domains.delete.org.php?ou={$ligne}');"); } if ($users->ZARAFA_INSTALLED) { if ($users->AsMailBoxAdministrator) { Paragraphe("zarafa-logo-64.png", "{$ou}:{APP_ZARAFA}", "{ZARAFA_OU_ICON_TEXT}", "javascript:Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}')", null, 210, 100, 0, true); $info = $ldap->OUDatas($ou); $zarafaEnabled = "zarafa-logo-32.png"; if (!$info["objectClass"]["zarafa-company"]) { $zarafaEnabled = "zarafa-logo-32-grey.png"; } $zarafa = "<td width=1% {$style} nowrap align='center'><strong style='font-size:16px'>" . imgtootltip($zarafaEnabled, "<b>{$ou}:{APP_ZARAFA}</b><br>{ZARAFA_OU_ICON_TEXT}", "Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}')") . "</td>"; } } $DomainsNB = $ldap->CountDeDomainsOU($ligne); $GroupsNB = $ldap->CountDeGroups($ou); Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); Paragraphe('64-folder-group-add.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); Paragraphe("64-folder-group-add.png", "{$ou}:{add_group}", "{add_a_new_group_in_this_org}:<b>{$ou}</b>", "javascript:Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}')"); $select = imgtootltip($img, "{manage_organisations_text}", $uri); $adduser = imgtootltip("folder-useradd-32.png", "<b>{create_user}</b><br><i>{create_user_text}</i>", "Loadjs('domains.add.user.php?ou={$ou_encoded}&encoded=yes');"); $addgroup = imgtootltip("32-folder-group-add.png", "<b>{add_group}</b><br><i>{add_a_new_group_in_this_org}</i>", "Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}');"); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1% {$style} nowrap>{$select}</td>\n\t\t\t<td width=99% {$style} nowrap><a href=\"javascript:blur();\" OnClick=\"{$uri}\" style='font-size:18px;font-weight:bolder;text-transform:capitalize;text-decoration:underline'>{$ligne}</strong></a></td>\n\t\t\t{$zarafa}\n\t\t\t<td width=1% {$style} nowrap align='center'><strong style='font-size:16px'>{$usersNB}</strong></td>\n\t\t\t<td width=1% {$style} nowrap align='center'><strong style='font-size:16px'>{$adduser}</strong></td>\n\t\t\t<td width=1% {$style} nowrap align='center'><strong style='font-size:16px'>{$GroupsNB}</strong></td>\n\t\t\t<td width=1% {$style} nowrap align='center'><strong style='font-size:16px'>{$addgroup}</strong></td>\n\t\t\t<td width=1% {$style} nowrap align='center'><strong style='font-size:16px'>{$DomainsNB}</strong></td>\n\t\t\t<td width=1%>{$delete}</td>\n\t\t</tr>"; } $pic = "32-environement.png"; if ($AllowInternetUsersCreateOrg == 1) { $sql = "SELECT * FROM register_orgs WHERE sended=0 ORDER BY ou"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $uri = "javascript:Loadjs('domains.organizations.parameters.php?ou-sql-js={$ligne["zmd5"]}')"; Paragraphe("img/org-warning-64.png", "{$name}", "<strong>{$time}:<br></strong>{waiting}", $uri); $name = $ligne["ou"]; $time = $ligne["register_date"]; $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1% {$style} nowrap>{$select}</td>\n\t\t\t<td width=99% {$style} nowrap><strong style='font-size:16px'>{$ligne}</strong></td>\n\t\t\t<td width=1% {$style} nowrap><strong style='font-size:16px'>-</strong></td>\n\t\t\t<td width=1%>{$delete}</td>\n\t\t</tr>"; } } $html = $html . "</tbody></table>"; if ($users->POSTFIX_INSTALLED) { Buildicon64('DEF_ICO_SENDTOALL', 220, 100); } if ($EnableManageUsersTroughActiveDirectory == 0) { $ldap->ldap_close(); } return "{$parameters}" . $html . "{$sendmail}</div>\n\t<script>\n\tOrgfillpageButton();\n\t</script>\n\t\n\t"; }
function OUSettings() { $ldap = new clladp(); $ou = $_GET["ou"]; $upd = array(); $hash = $ldap->OUDatas($ou); writelogs("[{$ou}]:: ldap->_ParsePrivieleges({$hash["ArticaGroupPrivileges"]});", __FUNCTION__, __FILE__, __LINE__); $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"]); $privs["ForceLanguageUsers"] = $_GET["OUlanguage"]; while (list($num, $val) = each($privs)) { writelogs("[{$ou}]:: Save {$num} = {$val}", __FUNCTION__, __FILE__, __LINE__); $values = $values . "[{$num}]=\"{$val}\"\n"; } $dn = "ou={$ou},dc=organizations,{$ldap->suffix}"; $upd["ArticaGroupPrivileges"][0] = $values; if (!$ldap->Ldap_modify($dn, $upd)) { echo $ldap->ldap_last_error; } }
function ORGANISATIONS_LIST() { $tpl = new templates(); $ldap = new clladp(); if ($ldap->IsKerbAuth()) { return ORGANISATIONS_LIST_ACTIVE_DIRECTORY(); } include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $Mypage = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); $ou_nozarafa_explain = $tpl->_ENGINE_parse_body("{ou_nozarafa_explain}"); $t = $_GET["t"]; $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } $AllowInternetUsersCreateOrg = $sock->GET_INFO("AllowInternetUsersCreateOrg"); if ($EnableManageUsersTroughActiveDirectory == 1) { $ldap = new ldapAD(); $hash = $ldap->hash_get_ou(true); } else { $ldap = new clladp(); $hash = $ldap->hash_get_ou(true); } if (!is_array($hash)) { json_error_show("No data..."); } ksort($hash); if ($EnableManageUsersTroughActiveDirectory == 0) { if (!$ldap->BuildOrganizationBranch()) { json_error_show("{GENERIC_LDAP_ERROR}<br>{$ldap->ldap_last_error}"); } } if ($_POST["query"] != null) { $search = $_POST["query"]; $search = str_replace(".", "\\.", $search); $search = str_replace("*", ".*?", $search); } if (isset($_GET["ajaxmenu"])) { $ajax = true; } $pic = "32-environement.png"; $style = "style='font-size:16px;'"; $c = 0; $ldap2 = new clladp(); if (count($hash) == 0) { json_error_show("no data"); } while (list($num, $ligne) = each($hash)) { $ou = $ligne; $ou_encoded = base64_encode($ou); if (!preg_match("#{$search}#i", $ligne)) { writelogs("'{$ligne}' NO MATCH {$search}", __FUNCTION__, __FILE__, __LINE__); continue; } $md = md5(serialize($hash) . time()); $md5S = $md; $uri = "javascript:Loadjs('domains.manage.org.index.php?js=yes&ou={$ligne}');"; if ($ajax) { $uri = "javascript:Loadjs('{$Mypage}?LoadOrgPopup={$ligne}');"; } $IsOUUnderActiveDirectory = $ldap2->IsOUUnderActiveDirectory($ou); $GroupsNB = 0; if ($EnableManageUsersTroughActiveDirectory == 0) { $img = $ldap->get_organization_picture($ligne, 32); writelogs("ldap->CountDeUSerOu({$ligne})", __FUNCTION__, __FILE__, __LINE__); $usersNB = $ldap->CountDeUSerOu($ligne); $usersNB = "{$usersNB}"; } else { $img = $pic; if ($IsOUUnderActiveDirectory) { $ad = new external_ad_search(); writelogs("ldap->CountDeUSerOu({$ligne})", __FUNCTION__, __FILE__, __LINE__); $usersNB = $ad->CountDeUSerOu($ligne); } else { writelogs("ldap->CountDeUSerOu({$ligne})", __FUNCTION__, __FILE__, __LINE__); $usersNB = $ldap->CountDeUSerOu($ligne); $usersNB = "{$usersNB}"; } } $delete = imgtootltip("delete-32-grey.png", "<b>{delete_ou} {$ligne}</b><br><i>{delete_ou_text}</i>"); if ($users->AsArticaAdministrator) { $delete = Paragraphe('64-cancel.png', "{delete_ou} {$ligne}", '{delete_ou_text}', "javascript:Loadjs('domains.delete.org.php?ou={$ligne}');", null, 210, 100, 0, true); $delete = imgsimple("delete-32.png", "<b>{delete_ou} {$ligne}</b><br><i>{delete_ou_text}</i>", "javascript:Loadjs('domains.delete.org.php?ou={$ligne}&t={$t}&id-table={$md5S}');"); } $DomainsNB = $ldap->CountDeDomainsOU($ligne); if ($GroupsNB == 0) { if ($IsOUUnderActiveDirectory) { $ad = new external_ad_search(); writelogs("->CountDeGroups({$ou})", __FUNCTION__, __FILE__, __LINE__); $GroupsNB = $ad->CountDeGroups($ou); } else { writelogs("->CountDeGroups({$ou})", __FUNCTION__, __FILE__, __LINE__); $GroupsNB = $ldap->CountDeGroups($ou); } } Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); Paragraphe('64-folder-group-add.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); Paragraphe("64-folder-group-add.png", "{$ou}:{add_group}", "{add_a_new_group_in_this_org}:<b>{$ou}</b>", "javascript:Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}&t={$t}')"); $select = imgsimple("domain-32.png", "{manage_organisations_text}", $uri); $adduser = imgsimple("folder-useradd-32.png", "{$ou}<hr><b>{create_user}</b><br><i>{create_user_text}</i>", "Loadjs('domains.add.user.php?ou={$ou_encoded}&encoded=yes');"); $addgroup = imgsimple("32-folder-group-add.png", "{$ou}<hr><b>{add_group}</b><br><i>{add_a_new_group_in_this_org}</i>", "Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}&t={$t}');"); $SearchUser = imgsimple("loupe-32.png", "{$ou}<hr><b>{search}</b>:<i>{members}</i>", "Loadjs('domains.find.user.php?ou={$ou_encoded}&encoded=yes');"); $SearchGroup = imgsimple("loupe-32.png", "{$ou}<hr><b>{search}</b>:<i>{groups}</i>", "Loadjs('domains.find.groups.php?ou={$ou_encoded}&encoded=yes&t={$t}');"); $searchDomain = imgsimple("loupe-32.png", "{$ou}<hr><b>{localdomains}</b>:<i>{localdomains_text}</i>", "Loadjs('domains.edit.domains.php?js=yes&ou={$ou}&master-t={$t}');"); $NOZARAFA = 0; $OuZarafaText = null; if ($IsOUUnderActiveDirectory) { $delete = imgtootltip("delete-24-grey.png", "", ""); $adduser = imgsimple("folder-useradd-32-grey.png"); $addgroup = imgsimple("32-folder-group-add-grey.png"); } if ($_GET["zarafaF"] == 1) { $info = $ldap->OUDatas($ou); if (!$info["objectClass"]["zarafa-company"]) { $NOZARAFA = 1; $OuZarafaText = "<br><a href=\"javascript:blur()\" style='color:#B20808;text-decoration:underline;font-style:italic' \n\t\t\t\tOnClick=\"javascript:Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}&t={$t}')\">{$ou_nozarafa_explain}</a>"; } } $array = array(); $array[] = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"{$uri}\" style='font-size:26px;font-weight:bolder;text-transform:capitalize;\n\t\ttext-decoration:underline'>{$ligne}</strong></a>{$OuZarafaText}"; if ($_GET["zarafaF"] == 1) { $zarafaEnabled = "zarafa-logo-32.png"; if ($NOZARAFA == 1) { $zarafaEnabled = "zarafa-logo-32-grey.png"; } $array[] = "<center>" . imgsimple($zarafaEnabled, "<strong style=font-size:26px>{$ou}:{APP_ZARAFA}</strong>\n\t\t\t\t\t<br>{ZARAFA_OU_ICON_TEXT}", "Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}&t={$t}')") . "</center>"; } else { $array[] = " "; } $array[] = "<strong style='font-size:26px'>{$usersNB}</strong>"; $array[] = "<center style='font-size:16px'>{$SearchUser}</center>"; $array[] = "<strong style='font-size:26px'>{$GroupsNB}</strong>"; $array[] = "<center style='font-size:16px'>{$SearchGroup}</center>"; $array[] = "<strong style='font-size:26px'>{$DomainsNB}</strong>"; $array[] = "<center style='font-size:16px'>{$searchDomain}</center>"; $array[] = "<center style='font-size:16px'>{$adduser}</center>"; $array[] = "<center style='font-size:16px'>{$addgroup}</center>"; $array[] = "<center style='font-size:16px'>{$delete}</center>"; $c++; $data['rows'][] = array('id' => $md5S, 'cell' => $array); } $total = $c; $data['page'] = 1; $data['total'] = $total; echo json_encode($data); }
function EditGroup(){ $gid=$_GET["PrivilegesGroup"]; $ldap=new clladp(); $update_array=array(); writelogs("Save privileges for $gid",__CLASS__,__FUNCTION__,__FILE__,__LINE__); switch ($gid) { case -1: $Hash=$ldap->OUDatas($_GET["ou"]); writelogs("Loading ou datas of \"{$_GET["ou"]}\" ArticaGroupPrivileges=". strlen($Hash["ArticaGroupPrivileges"]) ." bytes",__FUNCTION__,__FILE__,__LINE__); break; case -2: $user=new user($_GET["userid"]); $Hash=$user->ArticaGroupPrivileges; break; default:$Hash=$ldap->GroupDatas($gid);break; } if(!is_array($Hash["ArticaGroupPrivileges"])){ $ArticaGroupPrivileges=$ldap->_ParsePrivieleges($Hash["ArticaGroupPrivileges"]); }else{ $ArticaGroupPrivileges=$Hash["ArticaGroupPrivileges"]; } if(is_array($ArticaGroupPrivileges)){while (list ($num, $val) = each ($ArticaGroupPrivileges) ){$GroupPrivilege[$num]=$val;}} while (list ($num, $val) = each ($_GET) ){$GroupPrivilege[$num]=$val;} while (list ($num, $val) = each ($GroupPrivilege) ){if($val=="no"){continue;} $values=$values . "[$num]=\"$val\"\n";} if($gid==-2){ $user->SavePrivileges($values); return; } $update_array["ArticaGroupPrivileges"][0]=$values; writelogs("Modify: {$Hash["dn"]}",__FUNCTION__,__FILE__,__LINE__); if(!$ldap->Ldap_modify($Hash["dn"],$update_array)){ echo basename(__FILE__)."\nline: ".__LINE__."\n".$ldap->ldap_last_error; } }
function emergency_user($uid) { if ($uid == null) { return; } if ($GLOBALS["VERBOSE"]) { echo "Checking uid:{$uid}\n"; } $user = new user($uid); $ou = $user->ou; if ($GLOBALS["VERBOSE"]) { echo "Checking OU:{$ou}\n"; } if ($ou == null) { echo "Checking {$uid} no such organization\n"; return; } $ldap = new clladp(); $info = $ldap->OUDatas($ou); $zarafaEnabled = 1; if (!$info["objectClass"]["zarafa-company"]) { $dn = "ou={$ou},dc=organizations,{$ldap->suffix}"; $upd["objectClass"] = "zarafa-company"; if (!$ldap->Ldap_add_mod("{$dn}", $upd)) { echo $ldap->ldap_last_error; return; } } sync_users(); orphans(); }