*/
/**
* Edit User's Profile in Directory Server. This form allows to edit certain
* attributes that can be defined by the user.
*/
/**
* Define's and include's
*/
include_once ('config.php');
if($ldq_standalone) {
include_once ('standalone/standalone.php');
} else {
$public_mode = false;
$logged_in = true;
if (file_exists('../../include/init.php')) {
include_once('../../include/init.php');
define('DIR_PATH', SM_PATH . "plugins/directory/");
} else if (file_exists('../../include/validate.php')) {
define('SM_PATH', "../../");
define('DIR_PATH', SM_PATH . "plugins/directory/");
include_once (SM_PATH . 'include/validate.php');
include_once (SM_PATH . 'include/load_prefs.php');
}
$language = $lang_iso = getPref($data_dir, $username, 'language');
}
$prev = bindtextdomain ('directory', DIR_PATH . 'locale');
textdomain ('directory');
include_once (DIR_PATH . "html.php");
include_once (DIR_PATH . "javascript.php");
include_once (DIR_PATH . "functions.php");
include_once (DIR_PATH . "constants.php");
include_once (DIR_PATH . "display.php");
if(isset($ldq_custom) && !(empty($ldq_custom)) &&
file_exists(DIR_PATH . "custom/$ldq_custom.php")) {
include_once (DIR_PATH . "custom/$ldq_custom.php");
}
/**
* Variable import
*/
$compose_new_win = getPref($data_dir, $username, 'compose_new_win');
if(!$ldq_standalone) {
$location = get_location();
}
directory_LoadPrefs();
sqgetGlobalVar('printform', $printform, SQ_GET);
sqgetGlobalVar('showvertical', $showvertical, SQ_GET);
if($ldq_standalone) {
displayPageHeader($color, _("Your Profile") . ' - ' . _("Directory Service"));
} else {
$prev = bindtextdomain ('squirrelmail', SM_PATH . 'locale');
textdomain ('squirrelmail');
displayPageHeader($color, "None");
}
$prev = bindtextdomain ('directory_editprofile', DIR_PATH . 'locale');
textdomain ('directory_editprofile');
include_once (DIR_PATH . "editprofile_functions.php");
include_once (DIR_PATH . "schemas/descriptions.php");
$ldq_lang = substr($lang_iso, 0, 2);
$charset = $languages[$lang_iso]['CHARSET'];
$showprofile = true;
if(!isset($showvertical)) {
$showvertical = false;
}
if(!isset($printform)) {
$printform = false;
} else {
if($printform) {
$showprofile = false;
}
}
/**
* ------------------ User validation ------------------
*/
if(isset($_POST['loginsubmit'])) {
$login_username = $_POST['login_username'];
$login_password = $_POST['login_password'];
$ldq_lds = 0;
$ldq_Server = $ldap_server[$ldq_lds]['host'];
$ldq_Port = $ldap_server[$ldq_lds]['port'];
$ldq_base = $ldap_server[$ldq_lds]['base'];
$ldq_maxres = $ldap_server[$ldq_lds]['maxrows'];
$ldq_timeout = $ldap_server[$ldq_lds]['timeout'];
if(isset($ldap_server[$ldq_lds]['binddn'])) {
$ldq_bind_dn = $ldap_server[$ldq_lds]['binddn'];
}
if(isset($ldap_server[$ldq_lds]['bindpw'])) {
$ldq_pass = $ldap_server[$ldq_lds]['bindpw'];
}
if(isset($ldap_server[$ldq_lds]['writedn'])) {
$ldq_write_dn = $ldap_server[$ldq_lds]['writedn'];
} else {
$ldq_bind_dn = $ldap_server[$ldq_lds]['binddn'];
}
if(isset($ldap_server[$ldq_lds]['writepw'])) {
$ldq_write_pass = $ldap_server[$ldq_lds]['writepw'];
} else {
$ldq_pass = $ldap_server[$ldq_lds]['bindpw'];
}
if (!($ldq_ldap=ldap_connect($ldq_Server,$ldq_Port))) {
echo ("Could not connect to LDAP server " . $ldq_Server);
exit;
}
if(isset($ldq_bind_dn)) {
if (!ldap_bind($ldq_ldap, $ldq_bind_dn, $ldq_pass)) {
echo ("Unable to bind to LDAP server
\n");
exit;
}
}
$ldq_filter = '(uid='.$login_username.')';
$ldq_tattr = array('uid', 'userpassword');
/** Perform search! */
if (!($ldq_result = ldap_search($ldq_ldap, $ldq_base, $ldq_filter,
$ldq_tattr, 0, $ldq_maxres, $ldq_timeout))) {
echo '
' . _("No entries found.") . '
'; } $entry = ldap_get_entries ($ldq_ldap, $ldq_result); sanitize_entry_array($entry); ldap_close($ldq_ldap); if($entry['count'] != 1 ) { $logged_in = false; } else { $dn = $entry[0]['dn']; $ldap_password=substr($entry[0]['userpassword'][0], 7); if($ldap_password == crypt($login_password,$ldap_password)) { $logged_in = true; $_SESSION['logged_in'] = true; $username = $login_username; $_SESSION['username'] = $login_username; } else { $logged_in = false; } } } /** * ---------- Login Form --------- */ if(!$logged_in) { echo ''. _("Login Failed: Unknown User or Password Incorrect."). '
'; if(isset($_GET['loggedout'])) { echo _("Successfully logged out. You can login again below:"); } else { echo _("To update your profile, you must first login:"); } echo '
'; directory_print_section_end(); if(isset($editprofile_url) && !empty($editprofile_url)) { directory_print_section_start(_("Attributes that need to be approved first")); echo '' . sprintf( _("If you would like to change other important attributes of your profile, you need to make an application through the User Services."), $editprofile_url) . '
'; directory_print_section_end(); directory_print_all_sections_end(); } echo '