home *** CD-ROM | disk | FTP | other *** search
- <?php
- /*
- Copyright Intermesh 2003
- Author: Merijn Schering <mschering@intermesh.nl>
- Version: 1.0 Release date: 08 July 2003
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
- */
-
- require("../../Group-Office.php");
- require($GO_LANGUAGE->get_language_file('users'));
- require($GO_LANGUAGE->get_language_file('common'));
-
- $GO_SECURITY->authenticate(true);
-
- require($GO_CONFIG->class_path."users.class.inc");
- require($GO_CONFIG->class_path."validate.class.inc");
- $val = new validate();
- $users = new users();
-
- $return_to = (isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '') ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
-
- if ($_SERVER['REQUEST_METHOD'] == "POST")
- {
- if ($_REQUEST['pass1'] != '')
- {
- $val->error_min_length = $error_min_length;
- $val->error_max_length = $error_max_length;
- $val->error_match = $admin_pass_match;
-
- $val->name="pass1";
- $val->input=$_POST['pass1'];
- $val->min_length=3;
- $val->max_length=20;
- $val->validate_input();
-
- $val->name="pass2";
- $val->input=$_POST['pass2'];
- $val->min_length=3;
- $val->max_length=20;
- $val->validate_input();
-
- $val->name="pass";
- $val->match1=$_POST['pass1'];
- $val->match2=$_POST['pass2'];
- $val->validate_input();
-
- if ($val->validated)
- {
- if(!$users->update_password($_POST['id'], $_POST['pass1']))
- {
- $feedback = '<p class="Error">'.$strSaveError.'</p><br />';
- }
- }else
- {
- $feedback = '<p class="Error">'.$errors_in_form.'</p><br />';;
- }
- }
-
- $samba_user = isset($_POST['samba_user']) ? $_POST['samba_user'] : '';
- $has_samba_account = isset($_POST['has_samba_account']) ? $_POST['has_samba_account'] : false;
-
- if ($has_samba_account == 'true' && $samba_user != '1')
- {
- $users->delete_samba_account($_POST['id']);
- }
-
- if ($has_samba_account != 'true' && $samba_user == '1')
- {
- $users->create_samba_account($_POST['id']);
- }
-
- $GO_MODULES->get_modules();
- while ($GO_MODULES->next_record())
- {
- $was_granted = $GO_SECURITY->has_permission($_POST['id'], $GO_MODULES->f('acl_read'));
- $is_granted = isset($_POST['module_acl']) ? in_array($GO_MODULES->f('acl_read'), $_POST['module_acl']) : false;
-
- if ($was_granted && !$is_granted)
- {
- $GO_SECURITY->delete_user_from_acl($_POST['id'], $GO_MODULES->f('acl_read'));
- }
-
- if ($is_granted && !$was_granted)
- {
- $GO_SECURITY->add_user_to_acl($_POST['id'], $GO_MODULES->f('acl_read'));
- }
- }
- $val = new validate();
- //translate the given birthdayto gmt unix time
- $birthday = date_to_db_date($_POST['birthday']);
-
- $val->error_required = $error_required;
- $val->error_min_length = $error_min_length;
- $val->error_max_length = $error_max_length;
- $val->error_expression = $error_email;
- $val->error_match = $error_match_auth;
-
-
- $val->name="first_name";
- $val->input=$_POST['first_name'];
- $val->max_length=50;
- $val->required=true;
- $val->validate_input();
-
- $val->name="last_name";
- $val->input=$_POST['first_name'];
- $val->max_length=50;
- $val->required=true;
- $val->validate_input();
-
- $val->name="email";
- $val->input=$_POST['email'];
- $val->max_length=75;
- $val->required=true;
- $val->expression="^([a-z0-9]+)([._-]([a-z0-9]+))*[@]([a-z0-9]+)([._-]([a-z0-9]+))*[.]([a-z0-9]){2}([a-z0-9])?([a-z0-9])?$";
- $val->validate_input();
- if ($val->validated == true)
- {
- if (!$users->update_profile($_POST['id'], $_POST['first_name'],$_POST['middle_name'], $_POST['last_name'], $_POST['initials'], $_POST['title'], $_POST['sex'], $birthday, $_POST['email'], $_POST['work_phone'], $_POST['home_phone'], $_POST['fax'], $_POST['cellular'], $_POST['country'], $_POST['state'], $_POST['city'], $_POST['zip'], $_POST['address'], $_POST['company'], $_POST['work_country'], $_POST['work_state'], $_POST['work_city'], $_POST['work_zip'], $_POST['work_address'], $_POST['work_fax'], $_POST['homepage'], $_POST['department'], $_POST['function']))
- {
- $feedback = "<p class=\"Error\">".$strSaveError."</p>";
- }elseif ($_POST['close'] == 'true' && !isset($feedback))
- {
- header('Location: '.$return_to);
- exit();
- }
- }else
- {
- $feedback ="<p class='Error'>".$errors_in_form."</p>";
- }
- }
-
- $datepicker = new date_picker();
- $GO_HEADER['head'] = $datepicker->get_header();
-
- $page_title = $menu_users;
- require($GO_THEME->theme_path."header.inc");
-
- $profile = $users->get_user($_REQUEST['id']);
- if (!$profile)
- {
- $feedback = '<p class="Error">'.$strDataError.'</p>';
- }
- if ($profile["samba_user"] == 1) $samba_user_check = "checked";
- ?>
- <form method="post" name="user" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?>" />
- <input type="hidden" name="return_to" value="<?php echo $return_to; ?>" />
- <input type="hidden" name="close" value="false" />
- <input type="hidden" name="task" value="" />
- <table border="0" cellpadding="10" cellspacing="0">
- <tr>
- <td valign="top">
- <?php
- if (isset($feedback))
- {
- echo $feedback.'<br />';;
- }
- ?>
- <table border="0" cellpadding="0" cellspacing="3" width="600">
- <tr>
- <td colspan="2"><h1><?php echo $user_profile; ?> <?php echo $profile['username']; ?></h1></td>
- </tr>
- <tr>
- <td valign="top">
- <table border="0" class="normal" cellpadding="2" cellspacing="0">
-
- <?php
- if (isset($val->error["name"]))
- {
- ?>
- <tr>
- <td class="Error" colspan="2">
- <?php echo $val->error["name"]; ?>
- </td>
- </tr>
- <?php } ?>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strFirstName; ?>*: </td>
- <td width="100%"><input type="text" class="textbox" name="first_name" size="30" maxlength="50" value="<?php echo $profile["first_name"]; ?>"></td>
- </tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strMiddleName; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="middle_name" size="30" maxlength="50" value="<?php echo $profile["middle_name"]; ?>"></td>
- </tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strLastName; ?>*: </td>
- <td width="100%"><input type="text" class="textbox" name="last_name" size="30" maxlength="50" value="<?php echo $profile["last_name"]; ?>"></td>
- </tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strTitle; ?> / <?php echo $strInitials; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="title" size="11" maxlength="12" value="<?php echo $profile['title']; ?>"> / <input type="text" class="textbox" name="initials" size="11" maxlength="50" value="<?php echo $profile['initials']; ?>"></td>
- </tr>
- <tr>
- <td align="right" nowrap><?php echo $strSex; ?>:</td>
- <td>
- <?php
- $radiolist = new radio_list('sex', $profile['sex']);
- $radiolist->add_option('M', 'M', $strSexes['M']);
- echo ' ';
- $radiolist->add_option('F', 'F', $strSexes['F']);
- ?>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?php echo $strBirthday; ?>:</td>
- <td>
- <?php
- $birthday = db_date_to_date($profile['birthday']);
- $datepicker->print_date_picker('birthday', $_SESSION['GO_SESSION']['date_format'], $birthday);
- ?>
- </td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strAddress; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="address" size="30" maxlength="50" value="<?php echo $profile["address"]; ?>"></td>
- </tr>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strZip; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="zip" size="30" maxlength="20" value="<?php echo $profile["zip"]; ?>"></td>
- </tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strCity; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="city" size="30" maxlength="50" value="<?php echo $profile["city"]; ?>"> </td>
- </tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strState; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="state" size="30" maxlength="30" value="<?php echo $profile["state"]; ?>"></td>
- </tr>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strCountry; ?>: </td>
- <td width="100%"><input type="text" class="textbox" name="country" size="30" maxlength="30" value="<?php echo $profile["country"]; ?>"></td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <?php
- if (isset($val->error["email"]))
- {
- ?>
- <tr>
- <td class="Error" colspan="2">
- <?php echo $val->error["email"]; ?>
- </td>
- </tr>
- <?php } ?>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strEmail; ?>*: </td>
- <td><input type="text" class="textbox" name="email" size="30" value="<?php echo $profile["email"]; ?>" maxlength="50"></td>
- </tr>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strPhone; ?>: </td>
- <td><input type="text" class="textbox" name="home_phone" size="30" value="<?php echo $profile["home_phone"]; ?>" maxlength="20"></td>
- </tr>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strFax; ?>: </td>
- <td><input type="text" class="textbox" name="fax" size="30" value="<?php echo $profile["fax"]; ?>" maxlength="20"></td>
- </tr>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strCellular; ?>: </td>
- <td><input type="text" class="textbox" name="cellular" size="30" value="<?php echo $profile["cellular"]; ?>" maxlength="20"></td>
- </tr>
-
-
- </table>
- </td>
- <td valign="top">
- <table border="0" class="normal" cellpadding="2" cellspacing="0">
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strCompany; ?>: </td>
- <td><input type="text" class="textbox" name="company" size="30" value="<?php echo $profile["company"]; ?>" maxlength="50"></td>
- </tr>
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strDepartment; ?>: </td>
- <td><input type="text" class="textbox" name="department" size="30" value="<?php echo $profile["department"]; ?>" maxlength="50"></td>
- </tr>
-
- <tr heigth="25">
- <td align="right" nowrap><?php echo $strFunction; ?>: </td>
- <td><input type="text" class="textbox" name="function" size="30" value="<?php echo $profile["function"]; ?>" maxlength="50"></td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <td align="right" nowrap>
- <?php echo $strAddress; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_address" size="30" value="<?php echo $profile["work_address"]; ?>" maxlength="100">
- </td>
- </tr>
-
- <tr>
- <td align="right" nowrap>
- <?php echo $strZip; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_zip" size="30" value="<?php echo $profile["work_zip"]; ?>" maxlength="20">
- </td>
- </tr>
- <tr>
- <td align="right" nowrap>
- <?php echo $strCity; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_city" size="30" value="<?php echo $profile["work_city"]; ?>" maxlength="50">
- </td>
- </tr>
-
-
- <tr>
- <td align="right" nowrap>
- <?php echo $strState; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_state" size="30" value="<?php echo $profile["work_state"]; ?>" maxlength="50">
- </td>
- </tr>
-
- <tr>
- <td align="right" nowrap>
- <?php echo $strCountry; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_country" size="30" value="<?php echo $profile["work_country"]; ?>" maxlength="50">
- </td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <td align="right" nowrap>
- <?php echo $strPhone; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_phone" size="30" value="<?php echo $profile["work_phone"]; ?>" maxlength="20">
- </td>
- </tr>
- <tr>
- <td align="right" nowrap>
- <?php echo $strFax; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="work_fax" size="30" value="<?php echo $profile["work_fax"]; ?>" maxlength="20">
- </td>
- </tr>
- <tr>
- <td align="right" nowrap>
- <?php echo $strHomepage; ?>:
- </td>
- <td>
- <input type="text" class="textbox" name="homepage" size="30" value="<?php echo $profile["homepage"] ?>" maxlength="100">
- </td>
- </tr>
-
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="2">
-
- <table border="0" cellpadding="0" cellspacing="3">
- <tr>
- <td colspan="2"><h2><?php echo $ac_login_info; ?></h2></td>
- </tr>
- <tr>
- <td><?php echo $ac_registration_time; ?>:</td>
- <td><?php echo date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], $profile["registration_time"]+($_SESSION['GO_SESSION']['timezone']*3600)); ?></td>
- </tr>
- <tr>
- <td><?php echo $ac_lastlogin; ?>:</td>
- <td><?php echo date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], $profile["lastlogin"]+($_SESSION['GO_SESSION']['timezone']*3600)); ?></td>
- </tr>
- <tr>
- <td><?php echo $ac_logins; ?>:</td>
- <td><?php echo number_format($profile["logins"], 0, $_SESSION['GO_SESSION']['decimal_seperator'], $_SESSION['GO_SESSION']['thousands_seperator']); ?></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="2"><br /><h2><?php echo $admin_modules; ?></h2></td>
- </tr>
- <tr>
- <td colspan="2"><?php echo $admin_module_access; ?></td>
- </tr>
- <tr>
- <td colspan="2">
- <table border="0" cellpadding="4" cellspacing="0">
- <?php
-
- $column_count = 1;
- $columns=3;
-
-
- if ($GO_CONFIG->enable_samba_accounts)
- {
- if ($profile["samba_user"] == 1)
- {
- echo '<input type="hidden" name="has_samba_account" value="true" />';
- $samba_user_check = "checked";
- }else
- {
- $samba_user_check = "";
- }
- echo '<tr><td nowrap><input type="checkbox" name="samba_user" value="1" '.$samba_user_check.' />'.$registration_samba.'</td>';
- $column_count++;
- }
- $count = $GO_MODULES->get_modules();
- while ($GO_MODULES->next_record())
- {
- if ($column_count == 0)
- {
- echo '<tr>';
- $column_count++;
- }
- $check = $GO_SECURITY->has_permission($_REQUEST['id'], $GO_MODULES->f('acl_read')) ? 'checked' : '';
- $lang_var = isset($lang_modules[$GO_MODULES->f('id')]) ? $lang_modules[$GO_MODULES->f('id')] : $GO_MODULES->f('id');
- echo '<td nowrap><input type="checkbox" name="module_acl[]" value="'.$GO_MODULES->f('acl_read').'" '.$check.' />'.$lang_var.'</td>';
- if($column_count==$columns)
- {
- $column_count=0;
- echo '</tr>';
- }else
- {
- $column_count++;
- }
- }
- if ($column_count != 0)
- {
- for ($i=$column_count;$i<=$columns;$i++)
- {
- echo '<td> </td>';
- }
- echo '</tr>';
- }
- ?>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <br />
- <h2><?php echo $admin_change_password; ?></h2>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <table border="0">
- <?php
- if (isset($val->error['pass']))
- {
- echo '<tr><td colspan="2" class="Error">'.$val->error['pass'].'</td></tr>';
-
- }
-
- if (isset($val->error['pass1']))
- {
- echo '<tr><td colspan="2" class="Error">'.$val->error['pass1'].'</td></tr>';
-
- }
- ?>
- <tr>
- <td><?php echo $admin_password; ?>:</td>
- <td><input class="textbox" name="pass1" type="password" /></td>
- </tr>
- <?php
- if (isset($val->error['pass2']))
- {
- echo '<tr><td colspan="2" class="Error">'.$val->error['pass2'].'</td></tr>';
-
- }
- ?>
- <tr>
- <td><?php echo $admin_confirm_password; ?>:</td>
- <td><input class="textbox" name="pass2" type="password" /></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="cmd">
- <br />
- <?php
- $button = new button($cmdOk, "javascript:_save('save', 'true')");
- echo ' ';
- $button = new button($cmdApply, "javascript:_save('save', 'false')");
- echo ' ';
- $button = new button($cmdClose, 'javascript:document.location=\''.$return_to.'\';');
- ?>
- </td>
- </tr>
- </table>
- </td></tr></table>
- </form>
- <script type="text/javascript">
- function _save(task, close)
- {
- document.forms[0].task.value = task;
- document.forms[0].close.value = close;
- document.forms[0].submit();
- }
- </script>
-
- <?php
- require($GO_THEME->theme_path."footer.inc");
- ?>
-