Esempio n. 1
0
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>";
}
Esempio n. 2
0
function ORGANISTATION_FROM_USER()
{
    $ldap = new clladp();
    $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1);
    $ldap->ldap_close();
    if (!is_array($hash)) {
        return null;
    }
    return Paragraphe('folder-org-64.jpg', "{manage} &laquo;{$hash[0]}&raquo;", "<strong>{$hash[0]}:<br></strong>{manage_organisations_text}", 'domains.manage.org.index.php?ou=' . $hash[0]) . "\t\n\t<script>\n\tOrgfillpageButton();\n\t</script>";
}
Esempio n. 3
0
function TreeAddNewOrganisation()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AsArticaAdministrator == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $ou = $_GET["TreeAddNewOrganisation"];
    if ($ou == "_Global") {
        echo "Reserved!";
        exit;
    }
    $ldap = new clladp();
    $ldap->AddOrganization($ou);
    if ($ldap->ldap_last_error != null) {
        if ($ldap->ldap_last_error_num != 68) {
            echo "\n****************************************\nAdding Organization \"{$ou}\"\n********************\n";
            echo $ldap->ldap_last_error;
            exit;
        }
    }
    $ldap->ldap_close();
    REMOVE_CACHED("domains.index.php");
    $sock = new sockets();
    $sock->getFrameWork("status.php?force-front-end=yes");
}
function daemons_status()
{
    $users = new usersMenus();
    $artica = new artica_general();
    $tpl = new templates();
    $soc = new sockets();
    $ONLY_SAMBA = false;
    if (!$users->SQUID_INSTALLED) {
        if (!$users->POSTFIX_INSTALLED) {
            if ($users->SAMBA_INSTALLED) {
                $ONLY_SAMBA = true;
            }
        }
    }
    if ($users->collectd_installed) {
        if ($artica->EnableCollectdDaemon == 1) {
            $collectd = Paragraphe("64-charts.png", "{collectd_statistics}", "{collectd_statistics_text}", "javascript:YahooWin(790,'collectd.index.php?PopUp=yes')", "services_status_text", 300, 76);
        }
    }
    $interface = new networking();
    if (is_array($interface->array_TCP)) {
        while (list($num, $val) = each($interface->array_TCP)) {
            if ($val == null) {
                continue;
            }
            $i++;
            $iptext = $iptext . "<div style='font-size:11px'><strong>{nic}:{$num}:<a href='#' OnClick=\"javascript:Loadjs('system.nic.config.php?js=yes')\">{$val}</a></strong></div>";
            if ($i > 2) {
                break;
            }
        }
    }
    if ($users->POSTFIX_INSTALLED) {
        $monthly_stats = Paragraphe("statistics-network-64.png", "{monthly_statistics}", "{monthly_statistics_text}", "javascript:Loadjs('smtp.daily.statistics.php')", "{monthly_statistics_text}", 300, 76, 1);
    }
    $services = "\n\t{$interfaces_text}\n\t{$collectd}\n\t{$curlinit}\n\t";
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadFile("/etc/artica-postfix/smtpnotif.conf");
    if ($sock->GET_INFO("DisableWarnNotif") != 1) {
        if (trim($ini->_params["SMTP"]["enabled"] == null)) {
            $js = "javascript:Loadjs('artica.settings.php?ajax-notif=yes')";
            $services = Paragraphe('danger64.png', "{smtp_notification_not_saved}", "{smtp_notification_not_saved_text}", "{$js}", "{smtp_notification_not_saved}", 300, 80);
        }
    }
    if ($sock->GET_INFO("WizardBackupSeen") != 1) {
        $js = "javascript:Loadjs('wizard.backup-all.php')";
        $nobackup = Paragraphe('danger64.png', "{BACKUP_WARNING_NOT_CONFIGURED}", "{BACKUP_WARNING_NOT_CONFIGURED_TEXT}", "{$js}", "{BACKUP_WARNING_NOT_CONFIGURED_TEXT}", 300, 80);
    }
    $datas = trim($sock->getfile('aptcheck'));
    if (preg_match('#nb:([0-9]+)\\s+#is', $datas, $re)) {
        $services = Paragraphe('i64.png', "{upgrade_your_system}", "{$re[1]}&nbsp;{packages_to_upgrade}", "javascript:Loadjs('artica.repositories.php?show=update')", null, 300, 76);
    }
    $ldap = new clladp();
    $hash = $ldap->hash_get_ou();
    $ldap->ldap_close();
    if (count($hash) < 1) {
        $no_orgs = Paragraphe('org-warning-64.png', "{no_organization}", "{no_organization_text_jgrowl}", "javascript:TreeAddNewOrganisation()", null, 300, 76);
    }
    if ($users->POSTFIX_INSTALLED) {
        if (!$users->POSTFIX_LDAP_COMPLIANCE) {
            $services = "\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' width=1%><img src='img/rouage_off.png'></td>\n\t\t\t\t\t<td valign='top'><a href='#' OnClick=\"javascript:YahooWin(600,'index.remoteinstall.php','Install');\">\n\t\t\t\t\t<H5>{error_postfix_ldap_compliance}</H5><p class=caption>{error_postfix_ldap_compliance_text}\n\t\t\t\t\t</A>\n\t\t\t\t\t</p></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>";
            $services = RoundedLightYellow($services);
        } else {
            $ok = true;
            $main = new main_cf();
            if (!$main->CheckMyNetwork()) {
                $services = "\n\t\t\t\t<div id='servinfos'>\n\t\t\t\t\t" . Paragraphe('pluswarning64.png', '{postfix_mynet_not_conf}', '{postfix_mynet_not_conf_text}', "javascript:Loadjs('postfix.network.php?ajax=yes');", "{postfix_mynet_not_conf}", 300, 73) . "\n\t\t\t\t</div>";
            }
        }
    }
    if ($users->BadMysqlPassword == 1) {
        $services = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/superuser-64-bad.png'></td>\n\t<td valign='top'><H5>{error_mysql_user}</H5><p class=caption>{error_mysql_user_text}</p></td>\n\t</tr>\n\t</table>";
        $services = RoundedLightGrey($services, "artica.settings.php", 1);
    }
    if ($ONLY_SAMBA) {
        $computers = Paragraphe("64-win-nic-browse.png", '{browse_computers}', '{browse_computers_text}', "javascript:Loadjs('computer-browse.php');", "{browse_computers_text}", 300, 76, 1);
        $samba = Paragraphe("explorer-64.png", '{explorer}', '{SHARE_FOLDER_TEXT}', "javascript:Loadjs('tree.php');", "{SHARE_FOLDER_TEXT}", 300, 76, 1);
    }
    if (!is_file("/etc/artica-postfix/KASPER_MAIL_APP")) {
        if ($users->ZABBIX_INSTALLED) {
            $EnableZabbixServer = $sock->GET_INFO("EnableZabbixServer");
            if ($EnableZabbixServer == null) {
                $EnableZabbixServer = 1;
            }
            if ($EnableZabbixServer == 1) {
                $zabbix = Paragraphe("zabbix_med.gif", '{APP_ZABIX_SERVER}', '{APP_ZABIX_SERVER_TEXT}', "javascript:Loadjs('zabbix.php')", "{APP_ZABIX_SERVER_TEXT}", 300, 76, 1);
            }
        }
    }
    if ($sock->GET_INFO("DisableFrontEndArticaEvents") != 1) {
        $q = new mysql();
        $sql = "SELECT COUNT(ID) as tcount FROM events";
        $events_sql = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        if ($events_sql["tcount"] > 0) {
            $events_paragraphe = Paragraphe("events-64.png", '{artica_events}', "{artica_events_text}", "javascript:Loadjs('artica.events.php')", "{$events_sql["tcount"]} {events}", 300, 76, 1);
        }
    }
    $kernel_mismatch = kernel_mismatch();
    $newversion = null;
    $kavicap_license_error = kavicap_license_error();
    $final = "\n\t{$no_orgs}\n\t{$kernel_mismatch}\n\t{$kavicap_license_error}\n\t{$services}\n\t{$nobackup}\n\t{$events_paragraphe}\n\t{$all}\n\t{$zabbix}\n\t{$disks}\n\t{$monthly_stats}\n\t{$pureftp_error}\n\t{$newversion}\n\t{$roundcube}\n\t{$samba}\n\t{$computers}\n\t{$check_apt}";
    events(__FUNCTION__ . "/usr/share/artica-postfix/ressources/logs/status.global.html ok");
    file_put_contents('/usr/share/artica-postfix/ressources/logs/status.global.html', $final);
    system('/bin/chmod 755 /usr/share/artica-postfix/ressources/logs/status.global.html');
}
Esempio n. 5
0
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>";
}
Esempio n. 6
0
function norogs()
{
    $ldap = new clladp();
    $hash = $ldap->hash_get_ou();
    $ldap->ldap_close();
    if (count($hash) > 0) {
        return;
    }
    $link = "<center><a href='#' OnClick=javascript:TreeAddNewOrganisation(); style=font-weight:bolder;text-decoration:underline;font-size:11px>{add_new_org}</a></center>";
    $tpl = new templates();
    $title = $tpl->_ENGINE_parse_body("{no_organization}");
    $html[] = "";
    $html[] = "\$.jGrowl(\"";
    $html[] = "<table>";
    $html[] = "<tr>";
    $html[] = "<td width=1% valign='top'>";
    $html[] = "<img src=img/org-warning-48.png>";
    $html[] = "</td>";
    $html[] = "<td valign=top>";
    $html[] = "<span style=color:red;font-size:16px>{$title}";
    $html[] = "</span><hr>";
    $html[] = $tpl->_ENGINE_parse_body("<span style=font-size:13px>{no_organization_text_jgrowl}</span><p>{$link}</p>", "samba.index.php");
    $html[] = "\",";
    $html[] = "{header: '{$title}',life:25000});";
    echo implode("", $html) . "\n";
}
Esempio n. 7
0
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: '&nbsp;', 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}:&nbsp;<strong>{$usersnumber}</strong>&nbsp;{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},";
    }
    if (!$users->AsArticaAdministrator) {
        if (!$users->AsPostfixAdministrator) {
            $bt_add_new = null;
            $parametersBT = null;
            $CsvToLdap = null;
            $Totalusers = $tpl->_ENGINE_parse_body("{my_organizations}");
        }
    }
    $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>&nbsp;</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>&nbsp;</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>&nbsp;</span>', name : 'nonex3', width : 50, sortable : false, align: 'center'},\t\t\n\t\t{display: '<span style=font-size:20px>&nbsp;</span>', name : 'nonex4', width : 50, sortable : false, align: 'center'},\n\t\t{display: '<span style=font-size:20px>&nbsp;</span>', name : 'nonex5', width : 50, sortable : false, align: 'center'},\n\t\t\n\t\t{display: '&nbsp;', 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: 550,\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 = new templates();
    $html = $tpl->_ENGINE_parse_body($html);
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    echo $html;
}
Esempio n. 8
0
function TreeAddNewOrganisation()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AsArticaAdministrator == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $ou = $_GET["TreeAddNewOrganisation"];
    if ($ou == "_Global") {
        echo "Reserved!";
        exit;
    }
    $ldap = new clladp();
    $ldap->AddOrganization($ou);
    if ($ldap->ldap_last_error != null) {
        if ($ldap->ldap_last_error_num != 68) {
            echo $ldap->ldap_last_error;
            exit;
        }
    }
    $ldap->ldap_close();
    REMOVE_CACHED("domains.index.php");
}
function daemons_status(){
if(!isset($GLOBALS["CLASS_USERS_MENUS"])){$users=new usersMenus();$GLOBALS["CLASS_USERS_MENUS"]=$users;}else{$users=$GLOBALS["CLASS_USERS_MENUS"];}
	$artica=new artica_general();
	$tpl=new templates();
	$sock=new sockets();
	$ONLY_SAMBA=false;
	if($GLOBALS["VERBOSE"]){echo "daemons_status:: -> Stating...\n";}
	$EnableArticaSMTPStatistics=$sock->GET_INFO("EnableArticaSMTPStatistics");
	if(!is_numeric($EnableArticaSMTPStatistics)){$EnableArticaSMTPStatistics=1;}
	$nobackup=null;
	
	
	
	
	if(!$users->SQUID_INSTALLED){
		if(!$users->POSTFIX_INSTALLED){
			if($users->SAMBA_INSTALLED){
				$ONLY_SAMBA=true;
			}
		}
	}
	
	if($users->collectd_installed){
		if($artica->EnableCollectdDaemon==1){
			$collectd=Paragraphe("64-charts.png","{collectd_statistics}","{collectd_statistics_text}","javascript:YahooWin(790,'collectd.index.php?PopUp=yes')","services_status_text",300,76);
		}
	}
	
	$interface=new networking();
	$i=0;
	if(is_array($interface->array_TCP)){
		while (list ($num, $val) = each ($interface->array_TCP) ){
			if($val==null){continue;}
			$i++;
			$iptext=$iptext."<div style='font-size:11px'><strong>{nic}:$num:<a href='#' OnClick=\"javascript:Loadjs('system.nic.config.php?js=yes')\">$val</a></strong></div>";
			if($i>2){break;}
		}
	}
	
	if($EnableArticaSMTPStatistics==1){
		if(!$users->KASPERSKY_WEB_APPLIANCE){
			if($users->POSTFIX_INSTALLED){
			$monthly_stats=Paragraphe("statistics-network-64.png","{monthly_statistics}","{monthly_statistics_text}","javascript:Loadjs('smtp.daily.statistics.php')","{monthly_statistics_text}",300,76,1);
			}
	}}
	
	$services="
	$collectd
	";
	
	
	
	
	$ini=new Bs_IniHandler();
	$ini->loadFile("/etc/artica-postfix/smtpnotif.conf");
	$ArticaMetaEnabled=$sock->GET_INFO($ArticaMetaEnabled);
	
	$RootPasswordChanged=$sock->GET_INFO("RootPasswordChanged");
	if($RootPasswordChanged<>1){
		$RootPasswordChangedTXT=Paragraphe('warning64.png',
		"{root_password_not_changed}",
		"{root_password_not_changed_text}",
		"javascript:Loadjs('system.root.pwd.php')",
		"{root_password_not_changed_text}",300,80);
	}
	
	
	
	if($ArticaMetaEnabled<>1){
	if($sock->GET_INFO("DisableWarnNotif")<>1){
		if(trim($ini->_params["SMTP"]["enabled"]==null)){
		$js="javascript:Loadjs('artica.settings.php?ajax-notif=yes')";
		$services=Paragraphe('danger64.png',
		"{smtp_notification_not_saved}",
		"{smtp_notification_not_saved_text}",
		"$js",
		"{smtp_notification_not_saved}",300,80);
		
	}}}
	
	
	if(!$users->KASPERSKY_WEB_APPLIANCE){
		if($ArticaMetaEnabled<>1){
		if($sock->GET_INFO("WizardBackupSeen")<>1){
			$js="javascript:Loadjs('wizard.backup-all.php')";
			$nobackup=Paragraphe('danger64.png',"{BACKUP_WARNING_NOT_CONFIGURED}","{BACKUP_WARNING_NOT_CONFIGURED_TEXT}","$js","{BACKUP_WARNING_NOT_CONFIGURED_TEXT}",300,80);
		}}}
	
	
	
	$datas=trim(@file_get_contents("/etc/artica-postfix/apt.upgrade.cache"));
	if(preg_match('#nb:([0-9]+)\s+#is',$datas,$re)){
		$check_apt=Paragraphe('i64.png',"{upgrade_your_system}","{$re[1]}&nbsp;{packages_to_upgrade}","javascript:Loadjs('artica.repositories.php?show=update')",null,300,76);
		
	}
	
	$ldap=new clladp();
	$hash=$ldap->hash_get_ou();
	$ldap->ldap_close();
	if(count($hash)<1){
		$no_orgs=Paragraphe('org-warning-64.png',"{no_organization}","{no_organization_text_jgrowl}","javascript:TreeAddNewOrganisation()",null,300,76);
	}
	
	
	if(!$users->KASPERSKY_WEB_APPLIANCE){
		if($users->POSTFIX_INSTALLED){
				$ok=true;
				$main=new main_cf();
				if(!$main->CheckMyNetwork()){		
					$services="
					<div id='servinfos'>
						".	Paragraphe('pluswarning64.png','{postfix_mynet_not_conf}','{postfix_mynet_not_conf_text}',"javascript:Loadjs('postfix.network.php?ajax=yes');","{postfix_mynet_not_conf}",300,73)."
					</div>";
					}
				}
	}
		
	
	
	
	if($users->BadMysqlPassword==1){
			$services="
	<table style='width:100%'>
	<tr>
	<td valign='top' width=1%><img src='img/superuser-64-bad.png'></td>
	<td valign='top'><H5>{error_mysql_user}</H5><p class=caption>{error_mysql_user_text}</p></td>
	</tr>
	</table>";
	$services=RoundedLightGrey($services,"artica.settings.php",1);	
	}


		
		
	if($ONLY_SAMBA){
			$computers=Paragraphe("64-win-nic-browse.png",'{browse_computers}','{browse_computers_text}',"javascript:Loadjs('computer-browse.php');","{browse_computers_text}",300,76,1);
			$samba=Paragraphe("explorer-64.png",'{explorer}','{SHARE_FOLDER_TEXT}',"javascript:Loadjs('tree.php');","{SHARE_FOLDER_TEXT}",300,76,1);
		}

		
	if(!$users->KASPERSKY_WEB_APPLIANCE){
			if(!is_file("/etc/artica-postfix/KASPER_MAIL_APP")){
				if($users->ZABBIX_INSTALLED){
				$EnableZabbixServer=$sock->GET_INFO("EnableZabbixServer");
				if($EnableZabbixServer==null){$EnableZabbixServer=1;}
				if($EnableZabbixServer==1){
					$zabbix=Paragraphe("zabbix_med.gif",'{APP_ZABIX_SERVER}','{APP_ZABIX_SERVER_TEXT}',
					"javascript:Loadjs('zabbix.php')","{APP_ZABIX_SERVER_TEXT}",300,76,1);
					}
				}
			}
	}	
	
	if($sock->GET_INFO("DisableFrontEndArticaEvents")<>1){
		$q=new mysql();
		$sql="SELECT COUNT(ID) as tcount FROM events";
		$events_sql=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_events"));
		
		if($events_sql["tcount"]>0){
			$events_paragraphe=Paragraphe("events-64.png",'{artica_events}',"{artica_events_text}",
			"javascript:Loadjs('artica.events.php')","{$events_sql["tcount"]} {events}",300,76,1);
		}
	}
	
	$kernel_mismatch=kernel_mismatch();
	$newversion=null;
	$kavicap_license_error=kavicap_license_error();
	$cicap_bad=CicapBadParams();
	if($GLOBALS["VERBOSE"]){echo "daemons_status:: -> squid_filters_infos()\n";}
	$squidfilters=squid_filters_infos();
	if($users->POSTFIX_INSTALLED){
		if(is_file("ressources/logs/web/blacklisted.html")){
			$blacklist=@file_get_contents("ressources/logs/web/blacklisted.html");
		}
	}
	
	if($users->KASPERSKY_WEB_APPLIANCE){
		kavproxyInfos();
	}
	$informer=0;
	if($RootPasswordChangedTXT<>null){$informer++;}
	if($kernel_mismatch<>null){$informer++;}
	if($blacklist<>null){$informer++;}
	if($kavicap_license_error<>null){$informer++;}
	if($nobackup<>null){$informer++;}
	if($services<>null){$informer++;}
	
	writelogs("Inform: $informer",__FILE__,__FUNCTION__,__LINE__);
	
	if($informer>0){
		$inform=Paragraphe("warning64.png","$informer {warnings}","$informer {index_warnings_text}","javascript:Loadjs('admin.index.php?warnings=yes&count=$informer')","",300,76,1);
		file_put_contents('/usr/share/artica-postfix/ressources/logs/status.warnings.html',"$RootPasswordChangedTXT$kernel_mismatch$nobackup$blacklist$kavicap_license_error$services");
		system('/bin/chmod 755 /usr/share/artica-postfix/ressources/logs/status.warnings.html');	
	}
	

	$final="
	$inform
	$no_orgs
	<span id='loadavggraph'></span>	
	$squidfilters
	$cicap_bad
	$events_paragraphe
	$zabbix
	$monthly_stats
	$newversion
	$samba
	$computers
	$check_apt";

events(__FUNCTION__."/usr/share/artica-postfix/ressources/logs/status.global.html ok");	
file_put_contents('/usr/share/artica-postfix/ressources/logs/status.global.html',$final);
system('/bin/chmod 755 /usr/share/artica-postfix/ressources/logs/status.global.html');	
	
}
Esempio n. 10
0
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>&nbsp;</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";
}