<?php
require_once($cbDirLib."CB_user.class.php");
if(!isset($id)) {
$id = false;
}
$userManager = & new CB_user($id, $cbUserID, $cbPerms);
$hasEditPerms = $userManager->hasEditPerm();
// Darf der User alle Benutzer berbeiten, oder nicht?
if($hasEditPerms) {
// Beginn Verarbeitung Plugin Whitelist
if(isset($updatePermanentWhitelist) && isset($id)) {
$editPermanentWhitelist = $userManager->setPermanentWhitelist($permanentWLValues);
}
// Ende Verarbeitung Plugin Whitlist
if(!empty($passUpdate)) {
$result = $userManager->setNewPassword($pass1, $pass2);
if(get_class($result) == "PEAR_Error") {
$errorList[] = $usr_msg[$result->getCode()];
}
}
if(!empty($generalUpdate)) {
$_infoArr = array (
"username" => $username,
"fullname" => $fullname,
"email" => $email,
"initial" => $initial
);
$result = $userManager->setGeneralInformation($_infoArr);
if(get_class($result) == "PEAR_Error") {
$errorList[] = $usr_msg[$result->getCode()];
} else {
$id = $result;
}
}
if(!empty($profileUpdate)) {
$_infoArr = array(
"company" => $company,
"city" => $city,
"street" => $street,
"tel" => $tel,
"fax" => $fax,
"icq" => $icq,
"website" => $website,
"describt" => $description,
"skills" => $skills,
"birth_day" => $birth_day,
"birth_month" => $birth_month,
"birth_year" => $birth_year
);
$result = $userManager->setProfile($_infoArr);
}
$tpl->assign("EDITUID", $id);
$cbUserObj = mysql_fetch_object(mysql_query("SELECT profile.company, profile.city, profile.street, profile.tel, profile.fax, profile.icq, profile.describt, profile.website, profile.skills, profile.birthday, profile.portraitID, user.* FROM ".TABLE."_user AS user LEFT JOIN ".TABLE."_profile AS profile ON user.userid = profile.userid WHERE user.userid = '$id'"));
$tpl->assign("userGeneralElement",
array( "USERNAME" => $cbUserObj->name,
"FULLNAME" => $cbUserObj->fullname,
"INITIAL" => $cbUserObj->initial,
"EMAIL" => $cbUserObj->email
)
);
if(!(USR_MNG & $cbPerms)) {
if(!(ADMIN & $cbPerms)) {
$tpl->assign("userRightElementVisibility", "hidden");
}
}
$birthday = $cbUserObj->birthday;
$birthDay = substr($birthday, 8,2);
$birthMonth = substr($birthday, 5,2);
$birthYear = substr($birthday, 0,4);
$tpl->assign("userProfileElement",
array( "USERNAME" => $cbUserObj->name,
"COMPANY" => $cbUserObj->company,
"CITY" => $cbUserObj->city,
"STREET" => $cbUserObj->street,
"TEL" => $cbUserObj->tel,
"FAX" => $cbUserObj->fax,
"ICQ" => $cbUserObj->icq,
"WEBSITE" => $cbUserObj->website,
"DESCRIPTION" => $cbUserObj->describt,
"SKILLS" => $cbUserObj->skills,
"BIRTHDAY" => $birthDay,
"BIRTHMONTH" => $birthMonth,
"BIRTHYEAR" => $birthYear
)
);
/*
* Permanent White List Feature. Welche Permanents will der
* User sehen?
*
* $permanentWhitelist wurde schon in der main.php gesetzt
*/
// Permanent Plugins werden in der main.php bereits abgerufen
if($permanentPlugins != false) {
$editPermanentWhitelistString = $userManager->userOption->getSingleOption("permanentWhitelist");
$editPermanentWhitelist = explode("|^|", $editPermanentWhitelistString);
foreach($permanentPlugins as $v) {
/*
* Wenn Name im Language Array abgelegt ist, nimm diesen,
* ansonsten den, den das Plugin angegeben hat
*/
if($lang_plugin_plugin[$v->getValue("ident")] != "") {
$editPermanentWLName[] = $lang_plugin_plugin[$v->getValue("ident")];
} else {
$editPermanentWLName[] = $v->getValue("name");
}
if(in_array($v->getValue("ident"), $editPermanentWhitelist)) {
$editPermanentWLSelected[] = "checked";
} else {
$editPermanentWLSelected[] = "";
}
$editPermanentWLIdent[] = $v->getValue("ident");
}
$tpl->assign("whitelistPermanentRow",
array ( "PERMNAME" => $editPermanentWLName,
"PERMID" => $editPermanentWLIdent,
"SELECTED" => $editPermanentWLSelected
)
);
$tpl->assign("whitelistPermanent",
array( "USERNAME" => $mUser->name." ( ".$mUser->fullname." ) ",
"VAL_USRID" => $id
)
);
$tpl->assign("whitelistPermanentSet", "1");
}
if($sub == "usrAdd" && empty($step)) {
$tpl->assign("userPassElementVisibility", "hidden");
$tpl->assign("userRightElementVisibility", "hidden");
$tpl->assign("userProfileElementVisibility", "hidden");
$tpl->assign("whitelistPermanentSet", "0");
} elseif($sub == "usrAdd" && $step == '2') {
$tpl->assign("userGeneralElementVisibility", "hidden");
$tpl->assign("userRightElementVisibility", "hidden");
$tpl->assign("userProfileElementVisibility", "hidden");
$tpl->assign("whitelistPermanentSet", "0");
}
} else {
$errorList[] = $usr_msg["cannot_modify"];
}
if(count($errorList) > 0) {
$tpl->assign("errorSet", "1");
$tpl->assign("errorList", $errorList);
}
$mainPluginContent[] = $tpl->fetch($config['templates']."usrDetails.template", null, "pluginUsr".$cbUserID);
$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginUsr".$cbUserID);
?>