<?
require_once("common.php");
require_once("include/inputs.php");
require_once("include/edits.php");
require_once("include/modifies.php");
require_once("include/checks.php");
$edits = array(
new text_input(
"full name",
"cn",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"primary email",
"mail",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"spam whitelist",
"corpSpamConfig",
FALSE,
TRUE,
FALSE,
50,
array(
"check_notblank",
"check_spam_whiteblack_entry"
),
"displaymod_whitelist",
"ldap_modify_multival",
"whitelist_from ",
"/help/spam.php"
),
new text_input(
"spam blacklist",
"corpSpamConfig",
FALSE,
TRUE,
FALSE,
50,
array(
"check_notblank",
"check_spam_whiteblack_entry"
),
"displaymod_blacklist",
"ldap_modify_multival",
"blacklist_from ",
"/help/spam.php"
),
new radio_input(
"spam threshold",
"corpSpamConfig",
FALSE,
array(1, 2, 3, 4, 5, 6, 7, 9999),
array(
"check_notblank",
"check_spam_threshold"
),
"displaymod_threshold",
"ldap_modify_multival",
"required_hits ",
"/help/spam.php"
),
new text_input(
"email addresses",
"corpMailLocalAddress",
TRUE,
FALSE,
FALSE,
40,
array(
"check_notblank",
"check_email_valid",
"check_email_thiscorp"
),
"displaymod_strip_count",
"ldap_modify_multival",
NULL,
NULL
),
new text_input(
"email routes to",
"corpMailRoutingAddress",
TRUE,
FALSE,
FALSE,
40,
array(
"check_notblank",
"check_email_valid"
),
"displaymod_strip_count",
"ldap_modify_multival",
NULL,
NULL
),
new text_input(
"phone extension",
"corpTelephoneExtension",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"mobile number",
"mobile",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"non-company number",
"telephoneNumber",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"city of residence",
"l",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"state of residence",
"st",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new text_input(
"employer",
"o",
TRUE,
FALSE,
TRUE,
40,
array("check_nocheck"),
"displaymod_strip_count",
NULL,
NULL,
NULL
),
new radio_input(
"status",
"corpStatus",
TRUE,
array("active", "disabled", "gone"),
array("check_nocheck"),
"displaymod_strip_count",
"ldap_modify_multival",
NULL,
NULL
),
new radio_input(
"type",
"corpType",
TRUE,
array("employee", "contractor", "partner", "investor",
"customer", "hourly"),
array("check_nocheck"),
"displaymod_strip_count",
"ldap_modify_multival",
NULL,
NULL
),
);
if (isset($_GET["submitted"])) {
if (!isset($_GET["what"]))
die("useredit: submit: no submits!!\n");
foreach ($edits as $edit) {
$modfunc = $edit->modfunc;
foreach (array_keys($_GET["what"]) as $key) {
if (!strcmp($edit->name, $key)) {
$edit_what = $_GET["what"][$key];
$edit_whatkey = array_keys($edit_what);
$edit_idx = array_shift($edit_whatkey);
$edit_dn = $_GET["moddn"];
$edit_found = TRUE;
$edit_type = $_GET["what"][$key]
[$edit_idx];
$edit_new = $_GET["submitvals"][$key]
[$edit_idx];
@$edit_old = $_GET["oldvals"][$key]
[$edit_idx];
foreach ($edit->chkfuncs as $chkfunc)
if (!$chkfunc($edit_new))
die("useredit: modify: " .
"$chkfunc: failed");
if (!$modfunc($edit->prefix, $edit->ldapattr,
$edit_old, $edit_new, $edit_dn,
$edit_type))
die("useredit: modify: modfunc: fail");
redirect($_SESSION["requested_old"]);
print("user edit successful\n");
print("but redirection to edit page failed.\n");
}
}
}
} else
do_edit_page("User", $edits, "uid", LDAP_BASE_DN_PEOPLE,
"(&(objectClass=corpPerson)(uid=", "))");
?>