本文整理汇总了PHP中clladp::_ParsePrivieleges方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::_ParsePrivieleges方法的具体用法?PHP clladp::_ParsePrivieleges怎么用?PHP clladp::_ParsePrivieleges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::_ParsePrivieleges方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: popup
function popup()
{
$ou = base64_decode($_GET["ou"]);
$users = new usersMenus();
$ldap = new clladp();
$hash = $ldap->OUDatas($ou);
$privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"]);
$langdef = $privs["ForceLanguageUsers"];
$lang["en"] = "English";
$lang["fr"] = "Francais";
$lang["po"] = "Portugues";
$lang["br"] = "Brazilian";
$lang["es"] = "Espanol";
$lang["it"] = "Italiano";
$lang["de"] = "Deutsch";
unset($lang["language"]);
$lang[null] = "{default}";
$language = Field_array_Hash($lang, 'OUlanguage', $langdef, null, null, 0, "font-size:13px;padding:5px");
//ArticaGroupPrivileges
$form = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' class=legend nowrap style='font-size:13px'>{rename_org}:</td>\n\t<td valign='top'>" . Field_text('organization_name', $ou, "font-size:13px;padding:3px") . "</td>\n\t<td valign='top'><input type='button' OnClick=\"javascript:RenameOrganization();\" value='{rename} »'></td>\n\t</tr>\n\t</table>\n\t\n\t";
$form3 = "<table style='width:100%'>\n\t<tr>\n\t<td valign='top' class=legend nowrap style='font-size:13px'>{default_language}:</td>\n\t<td valign='top'>{$language}</td>\n\t<td valign='top'>" . button("{apply}", "SaveOUDefSettings()") . "</td>\n\t</tr>\n\t</table>";
$ldap = new clladp();
$img = $ldap->get_organization_picture(base64_decode($_GET["ou"]), 128);
$html = "\n\t<p class=caption style='font-size:13px'>{ORG_SETTINGS_TEXT}</p>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>\n\t\t<H3>LOGO</H3>\n\t\t<div style='width:135px;height:135px;margin:3px;border:1px solid #CCCCCC;padding:5px;margin:5px'>\n\t\t\t<img src='{$img}'>\n\t\t</div>\n\t\t<center><input type='button' OnClick=\"javascript:OrgPictureChange();\" value='{change} »'></center>\n\t\t</td>\n\t<td valign='top'>\n\t\t<div id='{$ou}_div'>\n\t\t\t<div style='border:1px solid #CCCCCC;padding:5px;margin:5px'>{$form3}</div>\n\t\t\t<br>\n\t\t\t<div style='border:1px solid #CCCCCC;padding:5px;margin:5px'>{$form}</div>\n\t\t</div>\n\t</td>\n\t</table>\n\t\n\t";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html, "domains.manage.org.index.php");
}
示例2: EditGroup
function EditGroup()
{
$gid = $_GET["PrivilegesGroup"];
$ldap = new clladp();
$update_array = array();
writelogs("Save privileges for {$gid}", __CLASS__, __FUNCTION__, __FILE__, __LINE__);
$loadGPID = true;
if ($gid == -1) {
$loadGPID = false;
$Hash = $ldap->OUDatas($_GET["ou"]);
writelogs("Loading ou datas of \"{$_GET["ou"]}\" ArticaGroupPrivileges=" . strlen($Hash["ArticaGroupPrivileges"]) . " bytes", __FUNCTION__, __FILE__, __LINE__);
$dn = $Hash["dn"];
}
if ($gid == -2) {
$loadGPID = false;
$user = new user($_GET["userid"]);
$Hash["ArticaGroupPrivileges"] = $user->ArticaGroupPrivileges;
writelogs("Loading datas of \"{$_GET["userid"]}\" ArticaGroupPrivileges={$user->ArticaGroupPrivileges} bytes", __FUNCTION__, __FILE__, __LINE__);
}
if ($gid > 0) {
writelogs("Loading datas of ldap->GroupDatas(\"{$_GET["{$gid}"]}\") ", __FUNCTION__, __FILE__, __LINE__);
$Hash = $ldap->GroupDatas($gid);
}
if (!is_array($Hash["ArticaGroupPrivileges"])) {
writelogs("ldap->_ParsePrivieleges(...)", __FUNCTION__, __FILE__, __LINE__);
$ArticaGroupPrivileges = $ldap->_ParsePrivieleges($Hash["ArticaGroupPrivileges"]);
} else {
$ArticaGroupPrivileges = $Hash["ArticaGroupPrivileges"];
}
if (!is_array($ArticaGroupPrivileges)) {
writelogs("ArticaGroupPrivileges[] is not an array !", __FUNCTION__, __FILE__, __LINE__);
}
if (is_array($ArticaGroupPrivileges)) {
while (list($num, $val) = each($ArticaGroupPrivileges)) {
$GroupPrivilege[$num] = $val;
}
}
while (list($num, $val) = each($_GET)) {
writelogs("ADD GroupPrivilege[{$num}]={$val}", __FUNCTION__, __FILE__, __LINE__);
$GroupPrivilege[$num] = $val;
}
while (list($num, $val) = each($GroupPrivilege)) {
if ($val == "no") {
writelogs("[{$num}]=SKIP", __FUNCTION__, __FILE__, __LINE__);
continue;
}
writelogs("[{$num}]=\"{$val}\"", __FUNCTION__, __FILE__, __LINE__);
$GroupPrivilegeNew[] = "[{$num}]=\"{$val}\"";
}
$values = @implode($GroupPrivilegeNew, "\n");
if ($gid == -2) {
writelogs("ArticaGroupPrivileges -> {$gid} -> user->SavePrivileges() values={$values}", __FUNCTION__, __FILE__, __LINE__);
$user->SavePrivileges($values);
return;
}
if (strpos($gid, ",") > 0) {
$gp = new external_ad_search();
$gp->SaveGroupPrivileges($values, $gid);
return;
}
$update_array["ArticaGroupPrivileges"][0] = $values;
writelogs("ArticaGroupPrivileges -> {$Hash["dn"]} -> group->SavePrivileges() values={$values}", __FUNCTION__, __FILE__, __LINE__);
if (!$ldap->Ldap_modify($Hash["dn"], $update_array)) {
echo basename(__FILE__) . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
}
}
示例3: create_user
function create_user($filename)
{
$tpl = new templates();
$unix = new unix();
$nohup = null;
$path = "/usr/share/artica-postfix/ressources/logs/web/create-users/{$filename}";
echo "Path:{$path}\n";
build_progress("Open {$filename}", 10);
if (!is_file($path)) {
echo "{$path} no such file...\n";
return false;
}
$MAIN = unserialize(base64_decode(@file_get_contents($path)));
build_progress("Create new member {$MAIN["login"]}", 15);
$users = new user($MAIN["login"]);
if ($users->password != null) {
echo "User already exists {$MAIN["login"]}\n";
build_progress("{account_already_exists}", 110);
@unlink($path);
return;
}
$ou = $MAIN["ou"];
$password = url_decode_special_tool($MAIN["password"]);
$MAIN["firstname"] = url_decode_special_tool($MAIN["firstname"]);
$MAIN["lastname"] = url_decode_special_tool($MAIN["lastname"]);
build_progress("{$MAIN["firstname"]} {$MAIN["lastname"]}", 20);
if (trim($MAIN["internet_domain"]) == null) {
$MAIN["internet_domain"] = "localhost.localdomain";
}
echo "Add new user {$MAIN["login"]} {$MAIN["ou"]} {$MAIN["gpid"]}\n";
$users->ou = $MAIN["ou"];
$users->password = url_decode_special_tool($MAIN["password"]);
$users->mail = "{$MAIN["email"]}@{$MAIN["internet_domain"]}";
$users->DisplayName = "{$MAIN["firstname"]} {$MAIN["lastname"]}";
$users->givenName = $MAIN["firstname"];
$users->sn = $MAIN["lastname"];
$users->group_id = $MAIN["gpid"];
$users->homeDirectory = "/home/{$MAIN["login"]}";
if (is_numeric($MAIN["gpid"])) {
$gp = new groups($MAIN["gpid"]);
echo "privileges: {$MAIN["gpid"]} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"\n";
if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
$ldap = new clladp();
$hash = $ldap->OUDatas($ou);
$privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
$policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
if (is_array($policiespwd)) {
$priv = new privileges();
if (!$priv->PolicyPassword($password, $policiespwd)) {
build_progress("Need complex password", 110);
echo "Need complex password";
@unlink($path);
return;
}
}
}
}
build_progress("{$MAIN["firstname"]} {$MAIN["lastname"]} {save}", 25);
if (!$users->add_user()) {
echo $users->error . "\n" . $users->ldap_error;
build_progress("{failed}", 110);
@unlink($path);
return;
}
@mkdir("{$users->homeDirectory}");
@chown("{$users->homeDirectory}", $users->uid);
if ($MAIN["ByZarafa"] == "yes") {
$terminated = " >/dev/null";
$zarafa_admin = $unix->find_program("zarafa-admin");
if (!$GLOBALS["WAIT"]) {
$nohup = $unix->find_program("nohup");
$terminated = null;
}
if (isset($MAIN["ZARAFA_LANG"])) {
$users->SaveZarafaMbxLang($MAIN["ZARAFA_LANG"]);
$langcmd = " --lang {$MAIN["ZARAFA_LANG"]} ";
}
$ldap = new clladp();
$dn = "ou={$MAIN["ou"]},dc=organizations,{$ldap->suffix}";
$upd["objectClass"] = "zarafa-company";
$upd["cn"] = $MAIN["ou"];
if (!$ldap->Ldap_add_mod("{$dn}", $upd)) {
echo $ldap->ldap_last_error;
build_progress("{failed} OpenLDAP Error", 110);
@unlink($path);
return;
}
build_progress("{create_store} {language}: {$MAIN["ZARAFA_LANG"]}", 30);
$cmd = "{$nohup} {$zarafa_admin} {$langcmd}--create-store {$MAIN["login"]} >/dev/null 2>&1 &";
system(trim($cmd));
if (!$GLOBALS["WAIT"]) {
$sock = new sockets();
$sock->getFrameWork("cmd.php?zarafa-hash=yes&rebuild=yes");
return;
}
@unlink("/usr/share/artica-postfix/ressources/databases/ZARAFA_DB_STATUS.db");
@unlink("/etc/artica-postfix/zarafa-export.db");
$cmd = LOCATE_PHP5_BIN2() . " /usr/share/artica-postfix/exec.zarafa.build.stores.php --export-hash";
build_progress("{export_stores_data}", 35);
echo "{$cmd}\n";
//.........这里部分代码省略.........
示例4: USER_ADD
function USER_ADD()
{
$userid = $_REQUEST["new_userid"];
$password = $_REQUEST["password"];
$group_id = $_REQUEST["group_id"];
if (isset($_GET["encpass"])) {
$password = url_decode_special_tool($password);
}
$ou = $_REQUEST["ou"];
$tpl = new templates();
if (preg_match("#(.+?)@(.+)#", $_REQUEST["email"], $re)) {
$_REQUEST["user_domain"] = $re[2];
$_REQUEST["email"] = $re[1];
}
$email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
$email = strtolower($email);
$user = new usersMenus();
if ($user->EnableVirtualDomainsInMailBoxes == 1) {
writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
$userid = $email;
}
if (is_numeric($group_id)) {
$gp = new groups($group_id);
writelogs("privileges: {$group_id} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__);
if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
$ldap = new clladp();
$hash = $ldap->OUDatas($ou);
$privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
$policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
if (is_array($policiespwd)) {
$priv = new privileges();
if (!$priv->PolicyPassword($password, $policiespwd)) {
return false;
}
}
} else {
writelogs("privileges: {$group_id} -> AsComplexPassword = \"No\" -> continue", __FUNCTION__, __FILE__, __LINE__);
}
}
$users = new user($userid);
if ($users->UserExists) {
echo $tpl->javascript_parse_text('ERROR: {account_already_exists}');
return false;
}
writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
$email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
if ($ou == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}'));
exit;
}
if ($userid == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}'));
exit;
}
if ($password == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}'));
exit;
}
if ($email == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}'));
exit;
}
$ldap = new clladp();
if (!is_numeric($group_id)) {
writelogs("Groupid is not numeric", __FUNCTION__, __FILE__, __LINE__);
$default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($default_dn_group)) {
$ldap->AddGroup("nogroup", $ou);
}
$group_id = $ldap->GroupIDFromName($ou, "nogroup");
if (!is_numeric($group_id)) {
$group_id = 0;
}
}
$emT = explode('@', $email);
//Verify domains --------------------------------------------------------------- 2008 10 05,P3
$hash_domains_table = $ldap->hash_get_domains_ou($ou);
if (!isset($hash_domains_table[$_REQUEST["user_domain"]])) {
writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__);
writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__);
$ldap->AddDomainEntity($ou, $_REQUEST["user_domain"]);
}
//------------------------------------------------------------------------------
$domains = $ldap->domains_get_locals_domains($ou);
$dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__);
echo $userid;
exit;
}
$users = new user($userid);
$users->mail = $email;
$users->accountGroup = $group_id;
$users->domainname = $_REQUEST["user_domain"];
if ($password != null) {
$users->password = $password;
}
$users->ou = $ou;
if ($domains[$_REQUEST["user_domain"]] == true) {
$upd = array();
//.........这里部分代码省略.........
示例5: EditGroup
function EditGroup(){
$gid=$_GET["PrivilegesGroup"];
$ldap=new clladp();
$update_array=array();
writelogs("Save privileges for $gid",__CLASS__,__FUNCTION__,__FILE__,__LINE__);
switch ($gid) {
case -1:
$Hash=$ldap->OUDatas($_GET["ou"]);
writelogs("Loading ou datas of \"{$_GET["ou"]}\" ArticaGroupPrivileges=". strlen($Hash["ArticaGroupPrivileges"]) ." bytes",__FUNCTION__,__FILE__,__LINE__);
break;
case -2:
$user=new user($_GET["userid"]);
$Hash=$user->ArticaGroupPrivileges;
break;
default:$Hash=$ldap->GroupDatas($gid);break;
}
if(!is_array($Hash["ArticaGroupPrivileges"])){
$ArticaGroupPrivileges=$ldap->_ParsePrivieleges($Hash["ArticaGroupPrivileges"]);
}else{
$ArticaGroupPrivileges=$Hash["ArticaGroupPrivileges"];
}
if(is_array($ArticaGroupPrivileges)){while (list ($num, $val) = each ($ArticaGroupPrivileges) ){$GroupPrivilege[$num]=$val;}}
while (list ($num, $val) = each ($_GET) ){$GroupPrivilege[$num]=$val;}
while (list ($num, $val) = each ($GroupPrivilege) ){if($val=="no"){continue;} $values=$values . "[$num]=\"$val\"\n";}
if($gid==-2){
$user->SavePrivileges($values);
return;
}
$update_array["ArticaGroupPrivileges"][0]=$values;
writelogs("Modify: {$Hash["dn"]}",__FUNCTION__,__FILE__,__LINE__);
if(!$ldap->Ldap_modify($Hash["dn"],$update_array)){
echo basename(__FILE__)."\nline: ".__LINE__."\n".$ldap->ldap_last_error;
}
}