本文整理汇总了PHP中clladp::Ldap_modify方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::Ldap_modify方法的具体用法?PHP clladp::Ldap_modify怎么用?PHP clladp::Ldap_modify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::Ldap_modify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveCyrusPassword
function SaveCyrusPassword()
{
$ldap = new clladp();
$_POST["SaveCyrusPassword"] = url_decode_special_tool(trim($_POST["SaveCyrusPassword"]));
if ($_POST["SaveCyrusPassword"] == null) {
echo "Error: No password defined\n";
return;
}
if (strpos($_POST["SaveCyrusPassword"], '@') > 0) {
echo "@,: denied character\n";
return;
}
if (strpos($_POST["SaveCyrusPassword"], ':') > 0) {
echo "@,: denied character\n";
return;
}
$attrs["userPassword"][0] = $_POST["SaveCyrusPassword"];
$dn = "cn=cyrus,dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->Ldap_modify($dn, $attrs)) {
echo $ldap->ldap_last_error;
return;
}
}
$dn = "cn=cyrus,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->Ldap_modify($dn, $attrs)) {
echo $ldap->ldap_last_error;
return;
}
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?cyrus-change-password=" . base64_encode($_POST["SaveCyrusPassword"]));
}
示例2: SaveSettings
function SaveSettings()
{
$ou = $_GET["ou"];
$upd["ArticaFakedMailFrom"][0] = $_GET["ArticaFakedMailFrom"];
$upd["ArticaDenyNoMXRecords"][0] = $_GET["ArticaDenyNoMXRecords"];
$upd["OuTrustMyUSers"][0] = $_GET["OuTrustMyUSers"];
$ldap = new clladp();
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
$ldap->Ldap_modify($dn, $upd);
}
示例3: changecomputername
function changecomputername()
{
if (substr($_POST["userid"], strlen($_POST["userid"]) - 1, 1) != "\$") {
$_POST["userid"] = $_POST["userid"] . "\$";
}
$comp = new computers($_POST["userid"]);
$MAC = $comp->ComputerMacAddress;
$_POST["NewHostname"] = trim(strtolower($_POST["NewHostname"]));
$_POST["NewHostname"] = str_replace('$', '', $_POST["NewHostname"]);
$actualdn = $comp->dn;
$newrdn = "cn={$_POST["NewHostname"]}\$";
$ldap = new clladp();
if (!preg_match("#^cn=(.+?),[a-zA-Z\\s]+#", $actualdn, $re)) {
echo "Unable to preg_match {$actualdn}\n";
return;
}
$newDN = str_replace($re[1], $_POST["NewHostname"] . '$', $actualdn);
if ($newDN == null) {
echo "Unable to preg_match {$actualdn} -> {$re[1]}\n";
return;
}
if ($ldap->ExistsDN("{$newrdn},ou=Computer,dc=samba,dc=organizations,{$ldap->suffix}")) {
$ldap->ldap_delete("{$newrdn},ou=Computer,dc=samba,dc=organizations,{$ldap->suffix}");
}
$newParent = "ou=Computer,dc=samba,dc=organizations,{$ldap->suffix}";
if (!$ldap->Ldap_rename_dn($newrdn, $actualdn, $newParent)) {
echo "Rename failed {$ldap->ldap_last_error}\nFunction:" . __FUNCTION__ . "\nFile:" . __FILE__ . "\nLine" . __LINE__ . "\n\nActual DN:{$actualdn}\nExpected DN:{$newrdn}";
return;
}
$upd["uid"][0] = $_POST["NewHostname"] . '$';
if (!$ldap->Ldap_modify($newDN, $upd)) {
echo "Update UID {$upd["uid"][0]} failed:\n{$ldap->ldap_last_error}\nFunction:" . __FUNCTION__ . "\nFile:" . __FILE__ . "\nLine" . __LINE__ . "\nExpected DN:{$newDN}\nExpected value:{$_POST["NewHostname"]}";
return;
}
$ocs = new ocs($MAC);
$ocs->ComputerName = $_POST["NewHostname"];
$ocs->ComputerIP = $comp->ComputerIP;
$ocs->EditComputer();
if (IsPhysicalAddress($comp->ComputerMacAddress)) {
include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
$uid = $comp->ComputerIDFromMAC($comp->ComputerMacAddress);
$comp = new computers($uid);
$sql = "UPDATE dhcpd_fixed SET `hostname`='{$comp->ComputerRealName}' WHERE `mac`='{$comp->ComputerMacAddress}'";
$q = new mysql();
$q->QUERY_SQL($sql, "artica_backup");
}
}
示例4: Loadtemplate
function Loadtemplate()
{
$ou = $_GET["ou"];
$template_name = $_GET["template"];
writequeries();
$ldap = new clladp();
$dn = "cn=artica_quarantine_settings,ou={$ou},dc=organizations,{$ldap->suffix}";
if (isset($_GET["ArticaMaxDayTemplate"])) {
$template_data = "<SUBJECT>{$_GET["subject"]}</SUBJECT>\n\t\t<FROM>{$_GET["from"]}</FROM>\n\t\t<TEMPLATE>{$_GET["ArticaMaxDayTemplate"]}</TEMPLATE>";
$upd[$template_name][0] = $template_data;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo "<H2>{$ldap->ldap_last_error}</H2>";
exit;
}
}
if (!$ldap->ExistsDN($dn)) {
$upd["cn"][] = "artica_quarantine_settings";
$upd["objectClass"][] = 'top';
$upd["objectClass"][] = 'ArticaQuarantineTemplates';
$upd["{$template_name}"][] = "DEFAULT";
$ldap->ldap_add($dn, $upd);
$template_data = "DEFAULT";
} else {
$hash = $ldap->Ldap_read($dn, '(ObjectClass=ArticaQuarantineTemplates)', array(strtolower($template_name)));
if (!is_array($hash[0][strtolower($template_name)])) {
unset($upd);
$upd[$template_name] = "DEFAULT";
$ldap->Ldap_add_mod($dn, $upd);
$hash = $ldap->Ldap_read($dn, '(ObjectClass=ArticaQuarantineTemplates)', array(strtolower($template_name)));
}
$template_data = $hash[0][strtolower($template_name)][0];
}
if ($template_data == "DEFAULT") {
$template_data = file_get_contents("ressources/databases/{$template_name}.cf");
}
if (preg_match('#<SUBJECT>(.+?)</SUBJECT>\\s+<FROM>(.+?)</FROM>\\s+<TEMPLATE>(.+?)</TEMPLATE>#is', $template_data, $reg)) {
$subject = $reg[1];
$from = $reg[2];
$template_d = $reg[3];
}
$tiny = TinyMce('ArticaMaxDayTemplate', $template_d);
$html = "\n\t<html>\n\t<head>\n\t<link href='css/styles_main.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_header.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_middle.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_forms.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_tables.css' rel=\"styleSheet\" type='text/css' />\n\t<script type='text/javascript' language='JavaScript' src='mouse.js'></script>\n\t<script type='text/javascript' language='javascript' src='XHRConnection.js'></script>\n\t<script type='text/javascript' language='javascript' src='default.js'></script>\n\t<script type='text/javascript' language='javascript' src='js/quarantine.ou.js'></script>\t\n\t</head>\n\t<body width=100% style='background-color:white'> \n\t\t<H5>{" . "{$template_name}}</H5>\n\t<form name='FFM1'>\n\t<table style='width:100%;margin:10px'>\n\t<tr>\n\t<td align='right'><strong>{from}:</strong></td>\n\t<td><input type='text' name='from' value='{$from}'></td>\n\t</tr>\n\t<tr>\n\t<td align='right'><strong>{subject}:</strong></td>\n\t<td><input type='text' name='subject' value='{$subject}'></td>\n\t</tr>\t\n\t</table>\n\t<div style='width:450px'>{$tiny}</div>\n\t<p class=caption>{template_token}</p>\n\t<input type='hidden' name='ou' value='{$ou}'>\n\t<input type='hidden' name='template' value='{$template_name}'>\n\t</form>\n\t</body>\n\t</html>";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例5: main_rules_group_move
function main_rules_group_move()
{
$kav = new kav4proxy();
$number = $_GET["Kav4ProxyMoveGroup"];
$move = $_GET["move"];
$ldap = new clladp();
$res = @ldap_read($ldap->ldap_connection, $kav->dn, "(objectClass=*)", array());
if ($res) {
$hash = ldap_get_entries($ldap->ldap_connection, $res);
for ($i = 0; $i < $hash[0][strtolower('kav4proxygroupsconf')]["count"]; $i++) {
$array[$i] = $hash[0][strtolower('kav4proxygroupsconf')][$i];
}
}
$new = array_move_element($array, $array[$number], $move);
while (list($num, $ligne) = each($new)) {
$upd["Kav4ProxyGroupsConf"][] = $ligne;
}
$ldap->Ldap_modify($kav->dn, $upd);
$kav = new kav4proxy();
$kav->SaveToLdap();
}
示例6: SaveActionsRules
function SaveActionsRules()
{
$gidNumber = $_GET["gidnumber"];
unset($_GET["gidnumber"]);
$ldap = new clladp();
$tpl = new templates();
$HashGroup = $ldap->GroupDatas($gidNumber);
$DN = $HashGroup["dn"];
$HashGroup["KasperskyASGroupNumber"] = $gidNumber;
$tpl = new templates();
$kas = new kas_groups();
$SettingsDatas = $kas->SaveArrayRules();
$FileToSave = $kas->BuildRulesFile($HashGroup, $SettingsDatas);
if (!is_array_key('KasperkyASDatasRules', $HashGroup)) {
$hash_add_array2["KasperkyASDatasRules"] = $FileToSave;
$ldap->Ldap_add_mod($DN, $hash_add_array2);
if ($ldap->ldap_last_error != null) {
echo '{SaveActionsRules} -> add Mod:' . $ldap->ldap_last_error;
}
}
$error = $ldap->ldap_last_error;
$hash_update_array["KasperkyASDatasRules"] = $FileToSave;
$ldap->Ldap_modify($DN, $hash_update_array);
$error = $error . " " . $ldap->ldap_last_error;
$kas = new kas_groups($FileToSave);
$kas->PrepareFiles($gidNumber);
if (strlen($error) < 5) {
$error = "{success} {group rules}";
}
echo $tpl->_ENGINE_parse_body($error);
}
示例7: TreePostfixDeleteHeaderCheckRule
function TreePostfixDeleteHeaderCheckRule()
{
include_once "ressources/class.main_cf_filtering.inc";
$id = $_GET["TreePostfixDeleteHeaderCheckRule"];
$filters = new main_header_check();
$datas = $filters->array_ldap_source[$id];
unset($filters->array_ldap_source[$id]);
if (count($filters->array_ldap_source) == 0) {
$update_array["PostfixHeadersRegex"] = $datas;
$ldap = new clladp();
$ldap->Ldap_del_mod("cn=artica,{$ldap->suffix}", $update_array);
} else {
while (list($num, $ligne) = each($filters->array_ldap_source)) {
$update_array["PostfixHeadersRegex"][] = $filters->array_ldap_source[$num];
}
$ldap = new clladp();
$ldap->Ldap_modify("cn=artica,{$ldap->suffix}", $update_array);
if ($ldap->ldap_last_error != null) {
echo nl2br("ID=[{$_GET["TreePostfixDeleteHeaderCheckRule"]}]\n{$ldap->ldap_last_error}");
}
}
$pages = new HtmlPages();
if ($pages->AutomaticConfig == true) {
$filters->SaveToDaemon();
}
echo $pages->PagePostfixRules();
}
示例8: bogospam_action
function bogospam_action()
{
$ldap = new clladp();
$tpl = new templates();
$upd["BogoFilterAction"] = "{$_GET["exceed"]};{$_GET["bogospam_action"]};{$_GET["prepend"]}";
$dn = "ou={$_GET["ou"]},{$ldap->suffix}";
if (!$ldap->Ldap_modify($dn, $upd)) {
echo $tpl->_ENGINE_parse_body($ldap->ldap_last_error);
} else {
echo $tpl->_ENGINE_parse_body('{success}');
}
}
示例9: ZARAFA_DISABLE_FEATURES_SAVE
function ZARAFA_DISABLE_FEATURES_SAVE()
{
$zarafaEnabledFeatures = null;
$zarafaDisabledFeatures = null;
$array = array();
if ($_POST["user_zarafa_enable_imap"] == 1) {
$zarafaEnabledFeatures = "imap";
}
if ($_POST["user_zarafa_enable_pop3"] == 1) {
$zarafaEnabledFeatures = $zarafaEnabledFeatures . " pop3";
}
if ($_POST["user_zarafa_enable_imap"] == 0) {
$zarafaDisabledFeatures = "imap";
}
if ($_POST["user_zarafa_enable_pop3"] == 0) {
$zarafaDisabledFeatures = $zarafaDisabledFeatures . " pop3";
}
$u = new user($_POST["uid"]);
$ldap = new clladp();
if ($zarafaEnabledFeatures == null) {
if (!$ldap->Ldap_del_mod($u->dn, $array["zarafaEnabledFeatures"])) {
echo "zarafaEnabledFeatures = '{$zarafaEnabledFeatures}'\nzarafaDisabledFeatures = '{$zarafaDisabledFeatures}'\nLDAP ERROR :\nFunction: " . __FUNCTION__ . "\nPage: " . basename(__FILE__) . "\nLine:" . __LINE__ . "\nError:\n" . $ldap->ldap_last_error;
}
}
if ($zarafaDisabledFeatures == null) {
if (!$ldap->Ldap_del_mod($u->dn, $array["zarafaDisabledFeatures"])) {
echo "zarafaEnabledFeatures = '{$zarafaEnabledFeatures}'\nzarafaDisabledFeatures = '{$zarafaDisabledFeatures}'\nLDAP ERROR :\nFunction: " . __FUNCTION__ . "\nPage: " . basename(__FILE__) . "\nLine:" . __LINE__ . "\nError:\n" . $ldap->ldap_last_error;
}
}
if ($zarafaEnabledFeatures != null) {
$upd["zarafaEnabledFeatures"][0] = $zarafaEnabledFeatures;
}
if ($zarafaDisabledFeatures != null) {
$upd["zarafaDisabledFeatures"][0] = $zarafaDisabledFeatures;
}
if (!$ldap->Ldap_modify($u->dn, $upd)) {
echo "zarafaEnabledFeatures = '{$zarafaEnabledFeatures}'\nzarafaDisabledFeatures = '{$zarafaDisabledFeatures}'\nLDAP ERROR :\nFunction: " . __FUNCTION__ . "\nPage: " . basename(__FILE__) . "\nLine:" . __LINE__ . "\nError:\n" . $ldap->ldap_last_error;
return;
}
}
示例10: Save
function Save()
{
$tpl = new templates();
writelogs("enabled={$this->BigMailHTMLEnabled}", __FUNCTION__, __FILE__);
$upd["BigMailHTMLEnabled"][0] = $this->BigMailHTMLEnabled;
$ini = new Bs_IniHandler();
$ini->_params = $this->params;
$upd["BigMailHtmlConfig"][0] = $ini->toString();
$upd["BigMailHtmlBody"][0] = $this->BigMailHtmlBody;
$ldap = new clladp();
if ($ldap->Ldap_modify($this->dn, $upd)) {
echo $tpl->_ENGINE_parse_body('{success}');
} else {
echo $ldap->ldap_last_error;
}
}
示例11: round_robin_save
function round_robin_save()
{
$ou = $_GET["ou"];
$tpl = new templates();
$roundrobin_nameserver = $_GET["roundrobin_nameserver"];
$roundrobin_ipaddress = $_GET["roundrobin_ipaddress"];
$domain = $_GET["domain"];
if (IsIPValid($roundrobin_nameserver)) {
echo $tpl->_ENGINE_parse_body("{servername}:\n{$roundrobin_nameserver}\n {error_cannot_be_ip_address}");
exit;
}
if (!IsIPValid($roundrobin_ipaddress)) {
echo $tpl->_ENGINE_parse_body("{add_ip_address}:\n{$roundrobin_ipaddress}\n {error_must_be_ip_address}");
exit;
}
$ini = new Bs_IniHandler();
$sock = new sockets();
$datas = $sock->GET_INFO('RoundRobinHosts');
$ini->loadString($datas);
$ips = explode(",", $ini->_params["{$domain}"]["IP"]);
$ips[] = $roundrobin_ipaddress;
$ini->_params["{$domain}"]["servername"] = $roundrobin_nameserver;
$ini->_params["{$domain}"]["IP"] = implode(",", $ips);
$sock->SaveConfigFile($ini->toString(), "RoundRobinHosts");
$sock->getfile("RoundRobinHosts");
$ldap = new clladp();
$dn = "cn={$domain},cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
$upd["transport"][0] = "[{$roundrobin_nameserver}]";
if (!$ldap->Ldap_modify($dn, $upd)) {
echo $ldap->ldap_last_error;
exit;
}
echo html_entity_decode($tpl->_ENGINE_parse_body('{success}'));
}
示例12: smtpd_client_restrictions_save
function smtpd_client_restrictions_save()
{
$ldap = new clladp();
if (!$ldap->ExistsDN("cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "PostFixStructuralClass";
$upd["cn"][0] = "restrictions_classes";
if (!$ldap->ldap_add("cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd)) {
echo "cn=restrictions_classes,cn=artica,{$ldap->suffix}\n{$ldap->ldap_last_error}";
return null;
}
}
if ($ldap->ExistsDN("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$ldap->ldap_delete("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", false);
$upd1["objectClass"][] = "top";
$upd1["objectClass"][] = "PostFixRestrictionStandardClasses";
$upd1["cn"][0] = "smtpd_client_restrictions";
if (!$ldap->ldap_add("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd1)) {
echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
}
unset($upd1);
if ($ldap->ExistsDN("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$ldap->ldap_delete("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", false);
}
if (!$ldap->ExistsDN("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$upd1["objectClass"][] = "top";
$upd1["objectClass"][] = "PostFixRestrictionStandardClasses";
$upd1["cn"][0] = "smtpd_helo_restrictions";
if (!$ldap->ldap_add("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd1)) {
echo "Modify smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
}
$EnablePostfixAntispamPack = $_GET["EnablePostfixAntispamPack"];
$upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
if ($_GET["reject_unknown_client_hostname"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_client_hostname=\"\"";
}
if ($_GET["reject_invalid_hostname"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
}
if ($_GET["reject_unknown_reverse_client_hostname"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_reverse_client_hostname=\"\"";
}
if ($_GET["reject_unknown_sender_domain"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_sender_domain=\"\"";
}
if ($_GET["reject_non_fqdn_sender"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_sender=\"\"";
}
if ($EnablePostfixAntispamPack == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"zen.spamhaus.org\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"sbl.spamhaus.org\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"cbl.abuseat.org\"";
}
$upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
$sock = new sockets();
$sock->SET_INFO('EnablePostfixAntispamPack', $EnablePostfixAntispamPack);
$sock->SET_INFO('reject_forged_mails', $_GET["reject_forged_mails"]);
if (!$ldap->Ldap_modify("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
unset($upd_vals);
if ($EnablePostfixAntispamPack == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_hostname=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
if (!$ldap->Ldap_modify("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
echo "Modify datas in smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
}
$main = new main_cf();
$main->save_conf_to_server(1);
$sock = new sockets();
$tpl = new templates();
$sock->getFrameWork("cmd.php?reconfigure-postfix=yes");
}
示例13: autofs_connect
function autofs_connect()
{
$auto = new autofs();
$ldap = new clladp();
$sock = new sockets();
$_GET["LOCAL_DIR"] = strtolower($ldap->StripSpecialsChars($_GET["LOCAL_DIR"]));
$upd = array();
$dn = "cn={$_GET["LOCAL_DIR"]},ou=auto.automounts,ou=mounts,{$ldap->suffix}";
if ($_GET["fs"] == null) {
$prefix_pattern = "-fstype=auto,check=none,noatime";
}
if ($_GET["fs"] == "ext2") {
$prefix_pattern = "-fstype=ext2,check=none,noatime";
}
if ($_GET["fs"] == "ext3") {
$prefix_pattern = "-fstype=ext3,check=none,noatime,nodiratime,data=journal,user";
}
if ($_GET["fs"] == "ext4") {
$prefix_pattern = "-fstype=ext4,check=none,noatime,commit=60,nodiratime,data=journal,user";
}
if ($_GET["fs"] == "vfat") {
$prefix_pattern = "-fstype=vfat,uid=1000,gid=1010";
}
if ($_GET["fs"] == "ntfs") {
$prefix_pattern = "-fstype=ntfs-3g,uid=1000,gid=1010";
}
if ($prefix_pattern == null) {
$prefix_pattern = "-fstype=auto,check=none,noatime";
}
$pattern = "{$prefix_pattern} :{$_GET["dev"]}";
if (!$ldap->ExistsDN($dn)) {
$upd["ObjectClass"][] = 'top';
$upd["ObjectClass"][] = 'automount';
$upd["cn"][] = "{$_GET["LOCAL_DIR"]}";
$upd["automountInformation"][] = $pattern;
if (!$ldap->ldap_add($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return;
}
$sock->getFrameWork("cmd.php?autofs-reload=yes");
return;
}
$upd["automountInformation"][] = $pattern;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return false;
}
$sock->getFrameWork("cmd.php?autofs-reload=yes");
}
示例14: add_auto_mount
function add_auto_mount()
{
$type = $_GET["type"];
$mount_point = $_GET["mount-point"];
$computer = $_GET["computer"];
$src = $_GET["src"];
if ($type == 'smbfs') {
$cmp = new computers($computer);
$ini = new Bs_IniHandler();
$ini->loadString($cmp->ComputerCryptedInfos);
$username = $ini->_params["ACCOUNT"]["USERNAME"];
$password = $ini->_params["ACCOUNT"]["PASSWORD"];
if ($username != null) {
$options = ",username={$username},password={$password}";
}
$pattern = "-fstype=smbfs{$options} ://{$cmp->ComputerIP}/{$src}";
}
if (preg_match("#nfs[0-9]+#", $type)) {
if ($type == 'nfs3') {
$pattern = "-fstype={$type} {$cmp->ComputerIP}:{$src}";
}
if ($type == 'nfs4') {
$pattern = "-fstype={$type} {$cmp->ComputerIP}:/";
}
}
$ldap = new clladp();
$autofs = new autofs();
$dn = "cn={$mount_point},ou=auto.automounts,ou=mounts,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd["ObjectClass"][] = 'top';
$upd["ObjectClass"][] = 'automount';
$upd["cn"][] = $mount_point;
$upd["automountInformation"][] = $pattern;
if (!$ldap->ldap_add($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return false;
}
} else {
$upd["automountInformation"][] = $pattern;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return false;
}
}
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{success}');
}
示例15: SaveLdapUser
function SaveLdapUser()
{
$ldap = new clladp();
$dn = $_GET["dn"];
unset($_GET["dn"]);
unset($_GET["SaveLdapUser"]);
$hash = $ldap->getobjectDNClass($dn, 1);
if (!isset($hash["ArticaSettings"])) {
$add_array["objectClass"][] = "ArticaSettings";
$ldap->Ldap_add_mod($dn, $add_array);
}
if (trim($_GET["SenderCanonical"]) == null) {
$hash = $ldap->UserDatas($_GET["uid"]);
if ($hash['SenderCanonical'] != null) {
writelogs("delete SenderCanonical:{$_GET["uid"]}=>{$hash['SenderCanonical']}", __FUNCTION__, __FILE__);
$upd["SenderCanonical"][0] = $hash['SenderCanonical'];
$ldap->Ldap_del_mod($dn, $upd);
}
unset($_GET["SenderCanonical"]);
}
while (list($num, $ligne) = each($_GET)) {
if ($ligne == 'true') {
$ligne = 'TRUE';
}
if ($ligne == 'false') {
$ligne = 'FALSE';
}
if ($ligne != null) {
$update_array[$num][] = $ligne;
}
}
$ldap->Ldap_modify($dn, $update_array);
if ($ldap->ldap_last_error != null) {
echo $ldap->ldap_last_error;
} else {
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{success}');
}
}