function ORGANISATIONS_LIST(){ $ldap=new clladp(); $page=CurrentPageName(); $hash=$ldap->hash_get_ou(true); $users=new usersMenus(); $sock=new sockets(); $AllowInternetUsersCreateOrg=$sock->GET_INFO("AllowInternetUsersCreateOrg"); if(!is_array($hash)){return null;} ksort($hash); 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=" <input type='hidden' name='add_new_organisation_text' id='add_new_organisation_text' value='{add_new_organisation_text}'> <input type='hidden' name='ajaxmenu' id='ajaxmenu' value='yes'>"; } $html=" $header <div style='width:700px;height:550px'>$error"; if(isset($_GET["ajaxmenu"])){$ajax=true;} $html=$html."<div style='float:left'>".butadm()."</div>"; while (list ($num, $ligne) = each ($hash) ){ $md=md5($ligne); $uri="javascript:Loadjs('domains.manage.org.index.php?js=yes&ou=$ligne');"; if($ajax){ $uri="javascript:Loadjs('$page?LoadOrgPopup=$ligne');"; } $img=$ldap->get_organization_picture($ligne,64); $html=$html . "<div style='float:left'>" . Paragraphe($img,"{manage} $ligne"," <strong>$ligne:<br></strong>{manage_organisations_text}",$uri,null,220,100) . "</div> "; } 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)){ $uri="javascript:Loadjs('domains.organizations.parameters.php?ou-sql-js={$ligne["zmd5"]}')"; $name=$ligne["ou"]; $time=$ligne["register_date"]; $html=$html . "<div style='float:left'>" . Paragraphe("img/org-warning-64.png","$name"," <strong>$time:<br></strong>{waiting}",$uri,null,220,100) . "</div> "; } } if($users->POSTFIX_INSTALLED){ $sendmail="<div style='float:left'>".Buildicon64('DEF_ICO_SENDTOALL',220,100)."</div>"; } if(isset($_GET["ajaxmenu"])){ $html=$html." <div style='float:left'>" .butadm()."</div>"; } if($users->AsArticaAdministrator){ $parameters="<div style='float:left'>".Paragraphe("parameters2-64.png","{organizations_parameters}"," {organizations_parameters_text}","javascript:Loadjs('domains.organizations.parameters.php')",null,220,100)."</div>"; } $ldap->ldap_close(); return "$parameters".$html."$sendmail</div>"; }
function ORGANISATIONS_LIST() { $ldap = new clladp(); $page = CurrentPageName(); $hash = $ldap->hash_get_ou(true); $users = new usersMenus(); if (!is_array($hash)) { return null; } ksort($hash); 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'>"; } $html = "\n\t{$header}\n\t<div style='width:700px;height:300px'>{$error}"; if (isset($_GET["ajaxmenu"])) { $ajax = true; } $html = $html . "<div style='float:left'>" . butadm() . "</div>"; while (list($num, $ligne) = each($hash)) { $md = md5($ligne); $uri = "javascript:Loadjs('domains.manage.org.index.php?js=yes&ou={$ligne}');"; if ($ajax) { $uri = "javascript:Loadjs('{$page}?LoadOrgPopup={$ligne}');"; } $img = $ldap->get_organization_picture($ligne, 64); $html = $html . "<div style='float:left'>" . Paragraphe($img, "{manage} {$ligne}", "\n\t\t<strong>{$ligne}:<br></strong>{manage_organisations_text}", $uri, null, 220, 100) . "</div>\n\t\t"; } if ($users->POSTFIX_INSTALLED) { $sendmail = "<div style='float:left'>" . Buildicon64('DEF_ICO_SENDTOALL', 220, 100) . "</div>"; } if (isset($_GET["ajaxmenu"])) { $html = $html . "\n\t\t<div style='float:left'>" . butadm() . "</div>"; } $ldap->ldap_close(); return $html . "{$sendmail}</div>"; }
function popup() { $users = new usersMenus(); $userClasse = new usersMenus(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $t = time(); $ldap = new clladp(); if ($ldap->IsKerbAuth()) { popup_activedirectory(); return; } if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) { return; } $ZarafaField = "{display: ' ', name : 'Zarafa', width :31, sortable : false, align: 'center'},"; $online_help = $tpl->_ENGINE_parse_body("{online_help}"); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($EnableWebProxyStatsAppliance == 1) { $userClasse->WEBSTATS_APPLIANCE = true; } if ($userClasse->WEBSTATS_APPLIANCE) { $userClasse->SQUID_INSTALLED = true; } if ($users->ZARAFA_INSTALLED) { $ZarafaEnableServer = $sock->GET_INFO("ZarafaEnableServer"); if (!is_numeric($ZarafaEnableServer)) { $ZarafaEnableServer = 1; } if ($ZarafaEnableServer == 1) { if ($users->AsMailBoxAdministrator) { $ZarafaField = "{display: '<span style=font-size:20px>Zarafa</span>', name : 'Zarafa', width :98, sortable : false, align: 'center'},"; $ZarafaUri = "&zarafaF=1"; $help = "{name: '{$online_help}', bclass: 'Help', onpress : Zhelp{$t}},"; } } } $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } $users = new usersMenus(); if ($EnableManageUsersTroughActiveDirectory == 1) { $ldap = new ldapAD(); $usersnumber = $ldap->COUNT_DE_USERS(); } else { $ldap = new clladp(); $usersnumber = $ldap->COUNT_DE_USERS(); $ldap->ldap_close(); } $Totalusers = $tpl->_ENGINE_parse_body("{my_organizations}::<i>{this_server_store}: <strong>{$usersnumber}</strong> {users}</i>"); $organizations_parameters = $tpl->_ENGINE_parse_body("{organizations_parameters}"); $add_new_organisation = $tpl->_ENGINE_parse_body("{add_new_organisation}"); $organizations = $tpl->_ENGINE_parse_body("{organizations}"); $users = $tpl->_ENGINE_parse_body("{users}"); $groupsF = $tpl->_ENGINE_parse_body("{groupsF}"); $domains = $tpl->_ENGINE_parse_body("{domains}"); $actions = $tpl->_ENGINE_parse_body("{actions}"); $add_new_organisation_text = $tpl->javascript_parse_text("{add_new_organisation_text}"); $update = $tpl->_ENGINE_parse_body("{update2}"); if ($users->AsArticaAdministrator) { $parametersBT = "{name: '<strong style=font-size:18px>{$organizations_parameters}</strong>', bclass: 'Reconf', onpress : organizations_parameters},"; } if (butadm() != null) { $jsadd = "TreeAddNewOrganisation{$t}"; } else { $jsadd = "nothingtodo"; } $bb = "<input type='hidden' name='add_new_organisation_text' id='add_new_organisation_text' value='" . $tpl->javascript_parse_text("{add_new_organisation_text}") . "'>"; if (isset($_GET["ajaxmenu"])) { $bc = "&ajaxmenu=yes"; } $bt_add_new = "{name: '<strong style=font-size:18px>{$add_new_organisation}</strong>', bclass: 'add', onpress : {$jsadd}},"; $ldap = new clladp(); if ($ldap->IsKerbAuth()) { $bt_add_new = null; $Totalusers = $tpl->_ENGINE_parse_body("{my_organizations}"); } else { $TEXT_TO_CSV = $tpl->_ENGINE_parse_body("{TEXT_TO_CSV}"); $CsvToLdap = "{name: '<strong style=font-size:18px>{$TEXT_TO_CSV}</strong>', bclass: 'Copy', onpress : TEXT_TO_CSV},"; } $buttons = "\n\tbuttons : [\n\t{$bt_add_new}{$parametersBT}{$CsvToLdap}\n\t\t],"; $html = "\n\t{$bb}\n\t<input type='hidden' name='MAIN_PAGE_ORGANIZATION_LIST' id='MAIN_PAGE_ORGANIZATION_LIST' value='{$t}'>\n\t<table class='table-{$t}' style='display: none' id='table-{$t}' style='width:100%;margin:-10px'></table>\n<script>\nOUIDMEM='';\n\$(document).ready(function(){\n\$('#table-{$t}').flexigrid({\n\turl: '{$page}?ShowOrganizations=yes&t={$t}{$ZarafaUri}{$bc}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t\n\t\t{display: '<span style=font-size:20px>{$organizations}</span>', name : 'ou', width :237, sortable : false, align: 'left'},\n\t\t{$ZarafaField}\n\t\t{display: '<span style=font-size:20px>{$users}</span>', name : 'users', width :153, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px> </span>', name : 'nonex1', width : 50, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px>{$groupsF}</span>', name : 'groups', width : 153, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px> </span>', name : 'nonex2', width : 50, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px>{$domains}</span>', name : 'domains', width : 153, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px> </span>', name : 'nonex3', width : 50, sortable : false, align: 'center'},\t\t\n\t\t{display: '<span style=font-size:20px> </span>', name : 'nonex4', width : 50, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px> </span>', name : 'nonex5', width : 50, sortable : false, align: 'center'},\n\t\t\n\t\t{display: ' ', name : 'none1', width : 31, sortable : false, align: 'left'},\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$organizations}', name : 'ou'},\n\t\t],\n\tsortname: 'ou',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$Totalusers}</span>',\n\tuseRp: false,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 320,\n\tsingleSelect: true\n\t\n\t}); \n});\n\nfunction Zhelp{$t}(){\n\ts_PopUpFull('http://www.mail-appliance.org/index.php?cID=202','1024','900');\n}\n\nfunction ActiveDirectorySquid{$t}(){\n\tLoadjs('squid.adker.php',true);\n}\n\nfunction TEXT_TO_CSV(){\n\tLoadjs('csvToLdap.php',true);\n}\n\n\tvar x_TreeAddNewOrganisation{$t}= function (obj) {\n\t\tvar response=obj.responseText;\n\t\tif(response){alert(response);}\n\t\t\$('#table-{$t}').flexReload();\n\t}\n\t\n\tfunction TreeAddNewOrganisation{$t}(){\n\t\tvar texte='{$add_new_organisation_text}'\n\t\tvar org=prompt(texte,'');\n\t\tif(org){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('TreeAddNewOrganisation',org);\n\t\t\tXHR.sendAndLoad('domains.php', 'GET',x_TreeAddNewOrganisation{$t});\n\t\t\t}\n\t}\n\n\t\tfunction organizations_parameters(){\n\t\t\tLoadjs('domains.organizations.parameters.php');\n\t\t\t\n\t\t}\n\t\t\n\t\tfunction ActiveDirectoryUpdate{$t}(){\n\t\t\tLoadjs('domains.activedirectory.update.php?flexigrid=table-{$t}');\n\t\t}\n\t\t\n\t\tfunction nothingtodo(){\n\t\t\talert('{$ERROR_NO_PRIVS}');\n\t\t}\n\n</script>\n" . $tpl->_ENGINE_parse_body("<div class=explain>{about_organization}</div>"); $tpl = new templates(); $html = $tpl->_ENGINE_parse_body($html); SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html); echo $html; }
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"; }