本文整理汇总了PHP中clladp::AddOrganization方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::AddOrganization方法的具体用法?PHP clladp::AddOrganization怎么用?PHP clladp::AddOrganization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::AddOrganization方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finish
function finish()
{
$company_name = $_GET["company_name"];
$hook = $_GET["nic_hook"];
$tpl = new templates();
if ($hook == null) {
echo $tpl->_ENGINE_parse_body('{error}: {no} {inet_interfaces_title}');
return null;
}
if ($company_name == null) {
echo $tpl->_ENGINE_parse_body('{error}: {no} {company_name}');
return null;
}
$ldap = new clladp();
$ldap->AddOrganization($company_name);
include_once "ressources/class.sockets.inc";
$sock = new sockets();
$sock->getfile('PostFixChangeAutoInterface:' . $_GET["nic_hook"]);
}
示例2: create_ou
function create_ou()
{
$ldap = new clladp();
$tpl = new templates();
$page = CurrentPageName();
$q = new mysql();
$sql = "SELECT * FROM register_orgs WHERE `zmd5`='{$_GET["key"]}'";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$ou = $ligne["ou"];
if ($ligne["ou"] == null) {
echo $tpl->_ENGINE_parse_body("{please_register_first}");
return;
}
if (!$ldap->AddOrganization($ou)) {
$html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-red.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{organization}: {$ligne["ou"]} {failed}</td>\n\t\t</tr>\n\t\t</table>\n\t\t";
echo $tpl->_ENGINE_parse_body($html);
return;
}
$html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-green.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{organization}: {$ligne["ou"]} {success}</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div id='step-2'></div>\n\t\t<script>\n\t\t\tLoadAjax('step-2','{$page}?create-domain=yes&key={$_GET["key"]}');\n\t\t</script>\t\t\n\t\t\n\t\t\n\t\t";
echo $tpl->_ENGINE_parse_body($html);
return;
}
示例3: main_fetchmail_build
function main_fetchmail_build(){
include_once('ressources/class.user.inc');
include_once('ressources/class.main_cf.inc');
include_once('ressources/class.fetchmail.inc');
$failed=false;
$isp_address_mail=$_GET["isp_address_mail"];
$isp_pop3_server=$_GET["isp_pop3_server"];
$isp_smtp_server=$_GET["isp_smtp_server"];
$isp_account=$_GET["isp_account"];
$isp_password=$_GET["isp_password"];
$local_email=$_GET["local_email"];
$local_password=$_GET["local_password"];
$isp_smtp_account=$_GET["isp_smtp_account"];
$isp_smtp_password=$_GET["isp_smtp_password"];
$relay_server=$_GET["relay_server"];
if($local_email==null){
echo main_fetchmail_build_results(true,'local mail (False)');
exit;
}
$ldap=new clladp();
writelogs("i try to found if user exists",__FUNCTION__,__FILE__);
$uid=$ldap->uid_from_email($local_email);
if($uid<>null){
$user=new user($local_email);
$ou=$user->ou;
}else{
writelogs("no user found, create it",__FUNCTION__,__FILE__);
$tb=explode("@",$local_email);
$local_domain=$tb[1];
$user=new user($tb[0]);
$ou=$ldap->ou_by_smtp_domain($local_domain);
if($ou==null){
$ou=$local_domain;
writelogs("Adding new organization $ou",__FUNCTION__,__FILE__);
$ldap->AddOrganization($ou);
}
}
writelogs("Creating user",__FUNCTION__,__FILE__);
$user=new user($local_email);
$user->mail=$local_email;
$user->password=$local_password;
$user->ou=$ou;
$user->SenderCanonical=$isp_address_mail;
if(!$user->add_user()){
echo main_fetchmail_build_results(true,$user->ldap_error);
exit;
}
if($isp_smtp_account<>null){
writelogs("Creating SMTP authentification for $isp_smtp_server width $isp_smtp_account",__FUNCTION__,__FILE__);
$sasl=new smtp_sasl_password_maps();
$sasl->add($isp_address_mail,$isp_smtp_account,$isp_password);
$main=new main_cf();
writelogs("Enable sasl engine in postfix",__FUNCTION__,__FILE__);
$main->smtp_sasl_password_maps_enable_2();
}
writelogs("Creating sender_dependent_relayhost_maps -> $isp_smtp_server",__FUNCTION__,__FILE__);
$sender=new sender_dependent_relayhost_maps();
if(!$sender->Add($isp_address_mail,$isp_smtp_server)){
echo main_fetchmail_build_results(true,"sender_dependent_relayhost_maps:$sender->ldap_error");
exit;
}
$fetchmail=new Fetchmail_settings();
$array["poll"]=$isp_pop3_server;
$array["proto"]="auto";
$array["keep"]="yes";
$array["user"]=$isp_account;
$array["pass"]=$isp_password;
$array["is"]=$local_email;
$array["fetchall"]="yes";
$line=$fetchmail->compile($array);
if(!$user->fetchmail_add_rule($line)){
echo main_fetchmail_build_results(true,"fetchmail rule:$user->ldap_error");
exit;
}
$relay=new Routing($ou);
if($relay_server<>null){
if(!$relay->create_relay_server($local_domain,$relay_server,$ou)){
echo main_fetchmail_build_results(true,"relay:$relay->ldap_error");
}
}else{
if(!$relay->create_localdomain($ou,$local_domain)){
//.........这里部分代码省略.........
示例4: SaveSettings
function SaveSettings()
{
echo "<div><code>";
$ldap = new clladp();
$usersMenus = new usersMenus();
$ldap->AddOrganization($_COOKIE["company"]);
echo "</div></code>";
echo "<div><code>";
if (!$usersMenus->cyrus_imapd_installed) {
$ldap->AddRelayDomain($_COOKIE["company"], $_COOKIE["smtp_domain"], $_COOKIE["smtp_relay"], 25);
} else {
$ldap->AddDomainEntity($_COOKIE["company"], $_COOKIE["smtp_domain"]);
}
echo "</div></code>";
echo "<div><code>";
$users = new user($_COOKIE["username"]);
$users->mail = "{$_COOKIE["username"]}@{$_COOKIE["smtp_domain"]}";
$users->password = $_COOKIE["password"];
$users->ou = $_COOKIE["company"];
$users->add_user();
$users->add_alias("root");
$users->add_alias("mailflt3");
$users->add_alias("root@localhost.localdomain");
$users->add_alias("root@{$usersMenus->fqdn}");
$users->add_alias("postmaster@{$usersMenus->fqdn}");
$users->add_alias("postmaster@localhost.localdomain");
$users->add_alias("postmaster");
echo "</div></code>";
$sock = new sockets();
$sock->SET_INFO("PostmasterAdress", $users->mail);
$sock->SET_INFO("MasterSMTPDomainName", $_COOKIE["smtp_domain"]);
$sock->SET_INFO("SmtpWizardFinish", 1);
if ($usersMenus->AMAVIS_INSTALLED) {
echo "<div><code>";
include_once "ressources/class.amavis.inc";
$amavis = new amavis();
$amavis->Save();
$sock->SET_INFO("EnableAmavisDaemon", "1");
$sock->getFrameWork("cmd.php?artica-filter-reload=yes");
$amavis->SaveToServer();
echo "</div></code>";
}
if ($usersMenus->BIND9_INSTALLED) {
include_once "ressources/class.bind9.inc";
include_once "ressources/class.system.network.inc";
$net = new networking();
if (is_array($net->arrayNameServers)) {
$dns = implode("\n", $net->arrayNameServers);
$sock->SaveConfigFile($dns, "PostfixBind9DNSList");
$sock->SET_INFO('PostfixEnabledInBind9', 1);
}
}
echo "<div><code>";
$main = new main_cf();
$main->save_conf();
$main->save_conf_to_server();
echo "</div></code>";
}
示例5: TreeAddNewOrganisation
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");
}
示例6: TASK_USER_EDIT
function TASK_USER_EDIT($zmd5)
{
$meta = new artica_meta(true);
include_once dirname(__FILE__) . '/ressources/class.user.inc';
events("Get user informations from {$zmd5}", __FUNCTION__, __FILE__, __LINE__);
$http = new httpget();
$datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
$body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "GET_USER_INFO" => $zmd5));
if (preg_match("#<RESULTS>(.+?)</RESULTS>#", $body, $re)) {
$array = unserialize(base64_decode($re[1]));
}
if (!is_array($array)) {
events("Get user informations ERROR not an Array", __FUNCTION__, __FILE__, __LINE__);
send_email_events("Failed to add user task id \"{$zmd5}\"", "Error detected\nGet user informations ERROR not an Array", "CLOUD");
return true;
}
foreach ($array as $key => $value) {
$userArray[$key] = $value;
}
$user = new user($userArray["uid"]);
$user->ou = $userArray["ou"];
events("Get user informations {$userArray["uid"]} done", __FUNCTION__, __FILE__, __LINE__);
$ldap = new clladp();
$ldap->AddOrganization($user->ou);
$user->password = $userArray["userpassword"];
$user->mail = $userArray["mail"];
$user->DisplayName = $userArray["displayname"];
$user->homeDirectory = $userArray["homedirectory"];
$user->sn = $userArray["sn"];
$user->group_id = $userArray["gidnumber"];
$user->FTPDownloadBandwidth = $userArray["ftpdownloadbandwidth"];
$user->FTPDownloadRatio = $userArray["ftpdownloadratio"];
$user->FTPQuotaFiles = $userArray["ftpquotafiles"];
$user->FTPQuotaMBytes = $userArray["ftpquotambytes"];
$user->FTPUploadRatio = $userArray["ftpuploadratio"];
$user->postalCode = $userArray["postalcode"];
$user->postalAddress = $userArray["postaladdress"];
$user->street = $userArray["street"];
$user->givenName = $userArray["givenname"];
$user->mobile = $userArray["mobile"];
$user->telephoneNumber = $userArray["telephonenumber"];
$user->zarafaQuotaHard = $userArray["zarafaQuotaHard"];
$user->zarafaQuotaWarn = $userArray["zarafaQuotaWarn"];
$user->zarafaQuotaSoft = $userArray["zarafaQuotaSoft"];
if (trim($userArray["mailboxsecurityparameters"]) == null) {
$userArray["mailboxsecurityparameters"] = "[mailbox]\nl=1\nr=1\ns=1\nw=1\ni=1\np=1\nc=1\nd=1\na=1";
}
if (trim($userArray["mailboxactive"]) == null) {
$userArray["mailboxactive"] = "TRUE";
}
if ($userArray["mailboxactive"] == 1) {
$userArray["mailboxactive"] = "TRUE";
} else {
$userArray["mailboxactive"] = "FALSE";
}
$user->MailboxSecurityParameters = $userArray["mailboxsecurityparameters"];
$user->MailboxActive = $userArray["mailboxactive"];
$user->MailBoxMaxSize = $userArray["mailboxmaxsize"];
events("Saving user information...", __FUNCTION__, __FILE__, __LINE__);
if (!$user->add_user()) {
events("Failed to add user {$userArray["uid"]}", __FUNCTION__, __FILE__, __LINE__);
send_email_events("Failed to add {$userArray["uid"]}", "reason {$user->error}", "CLOUD");
return false;
} else {
events("Call to unlock user", __FUNCTION__, __FILE__, __LINE__);
$http = new httpget();
send_email_events("Success to add {$userArray["uid"]}", "Adding this user:\n{$userArray["mail"]}\nOrganization:{$userArray["ou"]}\n", "CLOUD");
$body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "UNLOCK_USER" => $zmd5));
return true;
}
}
示例7: WizardExecute
//.........这里部分代码省略.........
}
$cyrus = $unix->LOCATE_CYRUS_DAEMON();
if (is_file($cyrus)) {
writeprogress(28, "{restarting_service} SaslAuthd Daemon");
shell_exec("/etc/init.d/saslauthd restart");
writeprogress(29, "{restarting_service} Cyrus IMAP Daemon");
shell_exec("/etc/init.d/cyrus-imapd restart");
writeprogress(30, "{restarting_service} Postfix Daemon");
shell_exec("/etc/init.d/postfix restart");
}
if (isset($savedsettings["GoldKey"])) {
if (!$sock->IsGoldKey($savedsettings["GoldKey"])) {
unset($savedsettings["GoldKey"]);
}
}
if (isset($savedsettings["GoldKey"])) {
if ($sock->IsGoldKey($savedsettings["GoldKey"])) {
$WORKDIR = base64_decode("L3Vzci9sb2NhbC9zaGFyZS9hcnRpY2E=");
$WORKFILE = base64_decode('LmxpYw==');
$WORKPATH = "{$WORKDIR}/{$WORKFILE}";
@file_put_contents($WORKPATH, "TRUE");
$LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
$LicenseInfos["UUID"] = $savedsettings["UUID_FIRST"];
$LicenseInfos["TIME"] = time();
$sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
writeprogress(31, "{register_license}");
shell_exec("{$php5} /usr/share/artica-postfix/exec.web-community-filter.php --register >/dev/null 2>&1");
writeprogress(32, "{saving_license}");
shell_exec("{$php5} /usr/share/artica-postfix/exec.web-community-filter.php --register-lic >/dev/null 2>&1");
}
}
$ldap = new clladp();
writeprogress(40, "{building_organization} {$savedsettings["organization"]}");
if (!$ldap->AddOrganization($savedsettings["organization"])) {
debug_logs("Building organization failed {$ldap->ldap_last_error}");
sleep(2);
if (!$ldap->AddOrganization($savedsettings["organization"])) {
debug_logs("Building organization failed 2/2 {$ldap->ldap_last_error}");
}
}
sleep(2);
writeprogress(40, "{creating_domain} {$savedsettings["smtp_domainname"]}");
if (!$ldap->AddDomainEntity($savedsettings["organization"], $savedsettings["smtp_domainname"])) {
debug_logs("AddDomainEntity failed {$ldap->ldap_last_error}");
}
sleep(2);
$timezone = $savedsettings["timezones"];
$sourcefile = "/usr/share/zoneinfo/{$timezone}";
if (is_file($sourcefile)) {
writeprogress(60, "{timezone} {$timezone}");
@unlink("/etc/localtime");
@copy($sourcefile, "/etc/localtime");
@file_put_contents("/etc/timezone", $timezone);
} else {
writeprogress(60, "{$sourcefile} no such file");
}
sleep(2);
BUILD_NETWORK();
shell_exec("{$nohup} /etc/init.d/artica-status restart >/dev/null 2>&1 &");
shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
$unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --reconfigure");
$unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --reconfigure-cyrus");
$FreeWebAdded = false;
sleep(3);
if (!is_file("/etc/artica-postfix/WIZARD_INSTALL_EXECUTED")) {
if (!$GLOBALS["NOREBOOT"]) {
示例8: COMPILE
function COMPILE()
{
$sock = new sockets();
$sock->SET_INFO("KasxFilterEnabled", 1);
$sock->SET_INFO("kavmilterEnable", 1);
$domain = trim(strtolower($_SESSION["WIZARD"]["ORGANIZATION"]));
$ou = $_SESSION["WIZARD"]["ORGANIZATION"];
$ou = str_replace(" ", "_", $ou);
$ldap = new clladp();
$ldap->AddOrganization($_SESSION["WIZARD"]["ORGANIZATION"]);
$hashdoms = $ldap->hash_get_all_domains();
if ($hashdoms[$domain] == null) {
$ldap->AddRelayDomain($ou, $domain, $_SESSION["WIZARD"]["MAILBOX_IP"], 25);
}
$kas = new kas_mysql($ou);
$kas->SET_VALUE("OPT_FILTRATION_ON", 1);
$main = new main_cf();
$main->add_my_networks($_SESSION["WIZARD"]["SMTP_NET"]);
$main->save_conf_to_server();
$sock->getFrameWork("cmd.php?kas-reconfigure=yes");
$sock->getFrameWork("cmd.php?kavmilter-configure");
$tpl = new templates();
$html = "\n\t\t\n\t\t<H3>{success}</H3><center>" . button("{close}", "CloseTimeOut()") . "</center>";
echo $tpl->_ENGINE_parse_body("{success}");
}
示例9: TreeAddNewOrganisation
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");
}
示例10: import
function import($ou, $path)
{
$usersM = new usersMenus();
$unix = new unix();
if (!is_file($path)) {
echo "{$path}, no such file\n";
die;
}
$ldap = new clladp();
$oudn = "ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($oudn)) {
$ldap->AddOrganization($ou);
}
$tmpfile = $unix->FILE_TEMP();
uncompress($path, $tmpfile);
$datas = unserialize(base64_decode(@file_get_contents($tmpfile)));
if (!is_array($datas)) {
if ($GLOBALS["VERBOSE"]) {
echo "Unable to import {$ou} {$path}, no such array\n";
return;
}
$unix->send_email_events(basename(__FILE__) . "::Unable to import {$ou} {$path}, no such array", null, "import");
die;
}
$usersArray = $datas["USERS"];
$groupsArray = $datas["GROUPS"];
unset($datas);
echo "Creating groups in `{$ou}`";
while (list($num, $hash) = each($groupsArray)) {
$ORG_GID = $hash["main_array"]["gid"];
$gp = new groups();
$gpid = $gp->GroupIDFromName($ou, $hash["groupName"]);
if (!is_numeric($gpid)) {
$gp->groupName = $hash["groupName"];
$gp->add_new_group($hash["groupName"], $ou);
$gpid = $gp->GroupIDFromName($ou, $hash["groupName"]);
}
$gp = new groups($gpid);
$members = $hash["members"];
while (list($a, $b) = each($members)) {
echo "Insert {$b} user to {$hash["groupName"]}/{$gpid}\n";
$gp->AddUsertoThisGroup($b);
}
$gp->saveDescription($hash["main_array"]["description"]);
$gp->ArticaGroupPrivileges = $hash["main_array"]["ArticaGroupPrivileges"];
$gp->Privileges_array = $hash["Privileges_array"];
$gp->SavePrivileges();
$GROUPSORGS[$ORG_GID] = $gpid;
}
while (list($num, $hash) = each($usersArray)) {
$array_groups = $hash["array_groups"];
unset($hash["dn"]);
unset($hash["UserExists"]);
unset($hash["ou"]);
unset($hash["local_sid"]);
unset($hash["objectClass_array"]);
unset($hash["group_id"]);
unset($hash["sambaPrimaryGroupSID"]);
unset($hash["accountGroup"]);
unset($hash["uidNumber"]);
unset($hash["sambaSID"]);
unset($hash["sambaPrimaryGroupGID"]);
unset($hash["gidNumber_array"]);
$samba_groups = $hash["samba_groups"];
unset($hash["ldapClass"]);
unset($hash["attributs_array"]);
unset($hash["samba_groups"]);
$users = new user($hash["uid"]);
$users->ou = $ou;
$users->group_id = $GROUPSORGS[$array_groups[0]];
while (list($a, $orgd) = each($hash)) {
$users->a = $orgd;
}
$users->add_user();
if ($usersM->SAMBA_INSTALLED) {
if (!$hash["NotASambaUser"]) {
$users->Samba_edit_user();
}
}
}
}
示例11: verif_organization
function verif_organization()
{
$unix = new unix();
$EnableOpenLDAP = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableOpenLDAP"));
if ($EnableOpenLDAP == 0) {
return;
}
if (!isset($GLOBALS["SQUID_INSTALLED"])) {
$squidbin = $unix->LOCATE_SQUID_BIN();
if (is_file($squidbin)) {
$GLOBALS["SQUID_INSTALLED"] = true;
} else {
$GLOBALS["SQUID_INSTALLED"] = false;
}
}
$timeStamp = "/etc/artica-postfix/pids/exec.verifldap.php.verif_organization.time";
if ($GLOBALS["VERBOSE"]) {
echo "{$timeStamp}\n";
}
$pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidFile);
if ($unix->process_exists($pid, basename(__FILE__))) {
return;
}
@unlink($pidFile);
@file_put_contents($pidFile, getmypid());
if (!$GLOBALS["FORCE"]) {
$TimeEx = $unix->file_time_min($timeStamp);
if ($TimeEx < 240) {
return;
}
}
@unlink($timeStamp);
@file_put_contents($timeStamp, time());
$sock = new sockets();
if ($sock->EnableIntelCeleron == 1) {
die;
exit;
}
$WizardSavedSettings = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/WizardSavedSettings")));
if (!isset($WizardSavedSettings["organization"])) {
return;
}
$organization = $WizardSavedSettings["organization"];
if ($organization == null) {
return;
}
$ldap = new clladp();
if ($GLOBALS["VERBOSE"]) {
echo "Loading LDAP\n";
}
if ($ldap->ldapFailed) {
if ($GLOBALS["VERBOSE"]) {
echo "Unable to connect to the LDAP server {$ldap->ldap_host}!\n";
}
if ($ldap->ldap_host == "127.0.0.1") {
$unix->ToSyslog("LDAP error {$ldap->ldap_last_error}", false, basename(__FILE__));
if ($GLOBALS["SQUID_INSTALLED"]) {
squid_admin_mysql(1, "Connecting to local LDAP server failed [action=restart LDAP]", "Error: {$ldap->ldap_last_error}\nLdap host:{$ldap->ldap_host}", __FILE__, __LINE__);
}
system_admin_events("Error, Connecting to local LDAP server failed [action=restart LDAP]", __FUNCTION__, __FILE__, __LINE__);
shell_exec("/etc/init.d/slapd restart --framework=" . basename(__FILE__));
$ldap = new clladp();
if ($GLOBALS["VERBOSE"]) {
echo "Loading LDAP\n";
}
if ($ldap->ldapFailed) {
echo $unix->ToSyslog("Unable to connect to the LDAP server {$ldap->ldap_host}! -> Abort..", false, __FILE__);
return;
}
} else {
return;
}
}
$hash = $ldap->hash_get_ou(false);
$CountDeOU = count($hash);
if ($GLOBALS["VERBOSE"]) {
echo "{$CountDeOU} Organization(s)\n";
}
if (count($hash) > 0) {
return;
}
system_admin_events("Error, no organization found, create the first one {$organization}", __FUNCTION__, __FILE__, __LINE__);
if (!$ldap->AddOrganization($organization)) {
system_admin_events("Error, unable to create first organization {$organization}\n{$ldap->ldap_last_error}", __FUNCTION__, __FILE__, __LINE__);
if ($GLOBALS["SQUID_INSTALLED"]) {
squid_admin_mysql(0, "Error, unable to create first organization {$organization}", $ldap->ldap_last_error, __FILE__, __LINE__);
}
}
}
示例12: IMPORT_OUS
function IMPORT_OUS()
{
$me = $_SERVER["SERVER_NAME"];
$error = array();
$ldap = new clladp();
$ous = unserialize(base64_decode($_POST["OUS"]));
while (list($num, $org) = each($ous)) {
if (trim($org) == null) {
continue;
}
if (!$ldap->AddOrganization($org)) {
$error[] = "Unable to add {$org} in LDAP database\n {$ldap->ldap_last_error}";
continue;
} else {
$success[] = "Success adding {$org} in LDAP database";
}
}
if (count($error) > 0) {
echo "<ERROR>" . @implode("\n", $error) . "</ERROR>";
}
if (count($success) > 0) {
echo "<SUCCESS>" . @implode("\n", $success) . "</SUCCESS>";
}
}
示例13: CreateOU
function CreateOU()
{
$ldap = new clladp();
$ldap->AddOrganization($_GET["ou"]);
$tpl = new templates();
if ($ldap->ldap_last_error != null) {
if ($ldap->ldap_last_error_num != 68) {
echo $ldap->ldap_last_error;
exit;
}
}
echo $tpl->_ENGINE_parse_body("{$_GET["ou"]} {added}");
}
示例14: import
//.........这里部分代码省略.........
}
if ($account == "account") {
continue;
}
$Telephon = $tr[5];
$mobile = $tr[6];
$d++;
if (isset($SCANNED[$SCANMD])) {
continue;
}
if ($GLOBALS["VERBOSE"]) {
echo "--------------- {$d} ----------------- {$SCANMD}\n";
}
if ($organization == null) {
if ($defaultgroup == 0) {
continue;
}
}
if ($organization == null) {
if ($DefaultOu != null) {
$organization = $DefaultOu;
}
}
if ($groupname == null) {
$groupname = $defaultGroupName;
}
if ($groupname == null) {
if ($GLOBALS["VERBOSE"]) {
echo "{$organization} NO GroupName !!\n";
}
continue;
}
if (!isset($OUS[$organization])) {
if (!$ldap->AddOrganization($organization)) {
system_admin_events("fatal error failed to create entry {$organization}", __FUNCTION__, __FILE__, __LINE__, "import", $GLOBALS["SCHEDULE_ID"]);
return;
}
$OUS = $ldap->hash_get_ou(true);
}
if (!isset($GLOBALS["GROUPS"][$organization])) {
$GLOBALS["GROUPS"][$organization] = $ldap->hash_groups($organization);
}
if (!isset($GLOBALS["GROUPS"][$organization][$groupname])) {
$gp = new groups();
$gp->ou = $organization;
$gp->groupName = $groupname;
if (!$gp->add_new_group($groupname, $organization)) {
system_admin_events("fatal error failed to create entry {$groupname}/{$organization}", __FUNCTION__, __FILE__, __LINE__, "import", $GLOBALS["SCHEDULE_ID"]);
return;
}
$GLOBALS["GROUPS"][$organization] = $ldap->hash_groups($organization);
}
if (!isset($GLOBALS["GROUPS"][$organization][$groupname]["gid"])) {
if ($GLOBALS["VERBOSE"]) {
echo "{$groupname}/{$organization} NO GID!!\n";
}
continue;
}
$gid = $GLOBALS["GROUPS"][$organization][$groupname]["gid"];
if ($password == null) {
$password = $account;
}
$UPDATE = FALSE;
$user = new user($account);
if (!is_numeric($user->uidNumber)) {
$UPDATE = true;
示例15: finish
function finish()
{
include_once 'ressources/class.artica.inc';
$company_name = $_GET["company_name"];
$domain_name = $_GET["domain_name"];
$relay_behavior = $_GET["relay"];
$relay_infos = $_GET["relay_infos"];
$artica = new artica_general();
$artica->RelayType = $relay_behavior;
$artica->Save();
$ldap = new clladp();
$ldap->AddOrganization($company_name);
if ($relay_behavior == "single") {
if ($relay_infos == null) {
$relay_infos = "127.0.0.1";
}
$ldap->AddDomainTransport($company_name, $domain_name, $relay_infos, '25', 'smtp');
} else {
$ldap->AddDomainEntity($company_name, $domain_name);
}
$html = "<div style='padding:5px;margin:5px'>\n\t\t<H2>{finish}</H2>\n\t<table>\n\t<tr>\n\t<td><img src='img/150-org.jpg'></td>\n\t<td valign='top'>\t\n\t<table>\n\t<tr>\n\t\t<td width=60% class='caption' nowrap align='right'><strong>{all_settings_saved}:</strong></td >\n\t\t\n\t</tr>\t\n\t</table>\n\t</div>";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}