removed $post parameter
This commit is contained in:
parent
53f96dc6bb
commit
a65279dc5c
|
@ -128,8 +128,8 @@ class account extends baseModule {
|
|||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('posixAccount', $modules) && $this->attributes['uid'][0] == '') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls if the module button the account page is visible and activated.
|
||||
*
|
||||
|
@ -169,17 +169,16 @@ class account extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes($post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
// Load attributes
|
||||
$this->attributes['description'][0] = $post['description'];
|
||||
$this->attributes['description'][0] = $_POST['description'];
|
||||
// user name if no posixAccount
|
||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('posixAccount', $modules)) {
|
||||
$this->attributes['uid'][0] = $post['uid'];
|
||||
$this->attributes['uid'][0] = $_POST['uid'];
|
||||
if (!get_preg($this->attributes['uid'][0], '!upper')) $errors['uid'][] = $this->messages['uid'][2];
|
||||
if (!get_preg($this->attributes['uid'][0], 'username')) $errors['uid'][] = $this->messages['uid'][3];
|
||||
}
|
||||
|
@ -190,7 +189,7 @@ class account extends baseModule {
|
|||
* to show a page with all attributes.
|
||||
* It will output a complete html-table
|
||||
*/
|
||||
function display_html_attributes($post) {
|
||||
function display_html_attributes() {
|
||||
// user name if no posixAccount
|
||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('posixAccount', $modules)) {
|
||||
|
@ -210,7 +209,7 @@ class account extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
@ -236,7 +235,7 @@ class account extends baseModule {
|
|||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('posixAccount', $modules)) {
|
||||
// description
|
||||
if ($rawAccounts[$i][$ids['account_description']] && ($rawAccounts[$i][$ids['account_description']] != '')) {
|
||||
if ($rawAccounts[$i][$ids['account_description']] && ($rawAccounts[$i][$ids['account_description']] != '')) {
|
||||
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['account_description']];
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -33,7 +33,7 @@ $Id$
|
|||
* @package modules
|
||||
*/
|
||||
class ieee802Device extends baseModule {
|
||||
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -84,13 +84,12 @@ class ieee802Device extends baseModule {
|
|||
$this->messages['mac'][0] = array('ERROR', 'MAC address is invalid!'); // third array value is set dynamically
|
||||
$this->messages['mac'][1] = array('ERROR', _('Account %s:') . ' ieee802Device_mac', 'MAC address is invalid!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will create the meta HTML code to show a page with all attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function display_html_attributes(&$post) {
|
||||
function display_html_attributes() {
|
||||
$return = array();
|
||||
// list current MACs
|
||||
for ($i = 0; $i < sizeof($this->attributes['macAddress']); $i++) {
|
||||
|
@ -114,36 +113,35 @@ class ieee802Device extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
$this->attributes['macAddress'] = array();
|
||||
// check old MACs
|
||||
if (isset($post['mac_number'])) {
|
||||
for ($i = 0; $i < $post['mac_number']; $i++) {
|
||||
if (isset($post['delMAC' . $i])) continue;
|
||||
if (isset($post['macAddress' . $i]) && ($post['macAddress' . $i] != "")) {
|
||||
if (isset($_POST['mac_number'])) {
|
||||
for ($i = 0; $i < $_POST['mac_number']; $i++) {
|
||||
if (isset($_POST['delMAC' . $i])) continue;
|
||||
if (isset($_POST['macAddress' . $i]) && ($_POST['macAddress' . $i] != "")) {
|
||||
// check if address has correct format
|
||||
if (!get_preg($post['macAddress' . $i], 'macAddress')) {
|
||||
if (!get_preg($_POST['macAddress' . $i], 'macAddress')) {
|
||||
$message = $this->messages['mac'][0];
|
||||
$message[] = $post['macAddress' . $i];
|
||||
$message[] = $_POST['macAddress' . $i];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
$this->attributes['macAddress'][] = $post['macAddress' . $i];
|
||||
$this->attributes['macAddress'][] = $_POST['macAddress' . $i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// check new MAC
|
||||
if (isset($post['macAddress']) && ($post['macAddress'] != "")) {
|
||||
if (isset($_POST['macAddress']) && ($_POST['macAddress'] != "")) {
|
||||
// check if address has correct format
|
||||
if (get_preg($post['macAddress'], 'macAddress')) {
|
||||
$this->attributes['macAddress'][] = $post['macAddress'];
|
||||
if (get_preg($_POST['macAddress'], 'macAddress')) {
|
||||
$this->attributes['macAddress'][] = $_POST['macAddress'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['mac'][0];
|
||||
$message[] = $post['macAddress'];
|
||||
$message[] = $_POST['macAddress'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +183,7 @@ class ieee802Device extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
|
|
@ -33,7 +33,7 @@ $Id$
|
|||
* @package modules
|
||||
*/
|
||||
class inetLocalMailRecipient extends baseModule {
|
||||
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -124,13 +124,11 @@ class inetLocalMailRecipient extends baseModule {
|
|||
$this->messages['host'][0] = array('ERROR', 'Mail server is invalid!'); // third array value is set dynamically
|
||||
$this->messages['host'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_server', 'Mail server is invalid!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will create the meta HTML code to show a page with all attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function display_html_attributes(&$post) {
|
||||
function display_html_attributes() {
|
||||
$return = array();
|
||||
// mail routing address
|
||||
$routingAddress = '';
|
||||
|
@ -170,72 +168,71 @@ class inetLocalMailRecipient extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
$this->attributes['mailRoutingAddress'] = array();
|
||||
$this->attributes['mailLocalAddress'] = array();
|
||||
$this->attributes['mailHost'] = array();
|
||||
// check routing address
|
||||
if (isset($post['routingAdr']) && ($post['routingAdr'] != "")) {
|
||||
if (isset($_POST['routingAdr']) && ($_POST['routingAdr'] != "")) {
|
||||
// check if address has correct format
|
||||
if (get_preg($post['routingAdr'], 'email')) {
|
||||
$this->attributes['mailRoutingAddress'][0] = $post['routingAdr'];
|
||||
if (get_preg($_POST['routingAdr'], 'email')) {
|
||||
$this->attributes['mailRoutingAddress'][0] = $_POST['routingAdr'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['routingAdr'][0];
|
||||
$message[] = $post['routingAdr'];
|
||||
$message[] = $_POST['routingAdr'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
// check mail server
|
||||
if (isset($post['host']) && ($post['host'] != "")) {
|
||||
if (isset($_POST['host']) && ($_POST['host'] != "")) {
|
||||
// check if address has correct format
|
||||
if (get_preg($post['host'], 'DNSname')) {
|
||||
$this->attributes['mailHost'][0] = $post['host'];
|
||||
if (get_preg($_POST['host'], 'DNSname')) {
|
||||
$this->attributes['mailHost'][0] = $_POST['host'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['host'][0];
|
||||
$message[] = $post['host'];
|
||||
$message[] = $_POST['host'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
// check old local addresses
|
||||
if (isset($post['adr_number'])) {
|
||||
for ($i = 0; $i < $post['adr_number']; $i++) {
|
||||
if (isset($post['delAdr' . $i])) continue;
|
||||
if (isset($post['localAdr' . $i]) && ($post['localAdr' . $i] != "")) {
|
||||
if (isset($_POST['adr_number'])) {
|
||||
for ($i = 0; $i < $_POST['adr_number']; $i++) {
|
||||
if (isset($_POST['delAdr' . $i])) continue;
|
||||
if (isset($_POST['localAdr' . $i]) && ($_POST['localAdr' . $i] != "")) {
|
||||
// check if address has correct format
|
||||
if (!get_preg($post['localAdr' . $i], 'mailLocalAddress')) {
|
||||
if (!get_preg($_POST['localAdr' . $i], 'mailLocalAddress')) {
|
||||
$message = $this->messages['localAdr'][0];
|
||||
$message[] = $post['localAdr' . $i];
|
||||
$message[] = $_POST['localAdr' . $i];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
$this->attributes['mailLocalAddress'][] = $post['localAdr' . $i];
|
||||
$this->attributes['mailLocalAddress'][] = $_POST['localAdr' . $i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// check new local address
|
||||
if (isset($post['localAdr']) && ($post['localAdr'] != "")) {
|
||||
if (isset($_POST['localAdr']) && ($_POST['localAdr'] != "")) {
|
||||
// check if address has correct format
|
||||
if (get_preg($post['localAdr'], 'mailLocalAddress')) {
|
||||
if (get_preg($_POST['localAdr'], 'mailLocalAddress')) {
|
||||
// check if new address is not already in database
|
||||
$data = $_SESSION['cache']->get_cache('mailLocalAddress', 'inetLocalMailRecipient', 'user');
|
||||
$keys = array_keys($data);
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
$adrList = $data[$keys[$i]];
|
||||
if (in_array_ignore_case($post['localAdr'], $adrList)) {
|
||||
$errors['localAdr'][] = array('WARN', _('This mail address is already in use:') . " " . $post['localAdr'], $keys[$i]);
|
||||
if (in_array_ignore_case($_POST['localAdr'], $adrList)) {
|
||||
$errors['localAdr'][] = array('WARN', _('This mail address is already in use:') . " " . $_POST['localAdr'], $keys[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->attributes['mailLocalAddress'][] = $post['localAdr'];
|
||||
$this->attributes['mailLocalAddress'][] = $_POST['localAdr'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['localAdr'][0];
|
||||
$message[] = $post['localAdr'];
|
||||
$message[] = $_POST['localAdr'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +298,7 @@ class inetLocalMailRecipient extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
|
|
@ -75,8 +75,8 @@ class inetOrgPerson extends baseModule {
|
|||
$this->messages['userPassword'][1] = array('ERROR', _('Password'), _('Password contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and #*,.;:_-+!$%&/|?{[()]}=@$ !'));
|
||||
$this->messages['userPassword'][2] = array('ERROR', _('Account %s:') . ' posixAccount_password', _('Password contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and #*,.;:_-+!$%&/|?{[()]}=@$ !'));
|
||||
$this->messages['photo'][0] = array('ERROR', _('No file selected.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -283,7 +283,7 @@ class inetOrgPerson extends baseModule {
|
|||
}
|
||||
// help Entries
|
||||
$return['help'] = array (
|
||||
'user' => array (
|
||||
'user' => array (
|
||||
'description' => array (
|
||||
"Headline" => _("Description"),
|
||||
"Text" => _("User description. If left empty sur- and give name will be used.")
|
||||
|
@ -362,7 +362,7 @@ class inetOrgPerson extends baseModule {
|
|||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -381,8 +381,8 @@ class inetOrgPerson extends baseModule {
|
|||
}
|
||||
if (!isset($this->attributes['sn'][0]) || ($this->attributes['sn'][0] == '')) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls if the module button the account page is visible and activated.
|
||||
*
|
||||
|
@ -417,7 +417,7 @@ class inetOrgPerson extends baseModule {
|
|||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (in_array('posixAccount', $modules)) {
|
||||
if (isset($return[$_SESSION[$this->base]->dn]['modify']['userPassword'])) {
|
||||
unset($return[$_SESSION[$this->base]->dn]['modify']['userPassword']);
|
||||
unset($return[$_SESSION[$this->base]->dn]['modify']['userPassword']);
|
||||
}
|
||||
if (isset($return[$_SESSION[$this->base]->dn]['add']['userPassword'])) {
|
||||
unset($return[$_SESSION[$this->base]->dn]['add']['userPassword']);
|
||||
|
@ -443,27 +443,26 @@ class inetOrgPerson extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes($post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
// Load attributes
|
||||
$this->attributes['description'][0] = $post['description'];
|
||||
$this->attributes['sn'][0] = $post['sn'];
|
||||
$this->attributes['givenName'][0] = $post['givenName'];
|
||||
$this->attributes['title'][0] = $post['title'];
|
||||
$this->attributes['mail'][0] = $post['mail'];
|
||||
$this->attributes['telephoneNumber'][0] = $post['telephoneNumber'];
|
||||
$this->attributes['mobile'][0] = $post['mobileTelephoneNumber'];
|
||||
$this->attributes['facsimileTelephoneNumber'][0] = $post['facsimileTelephoneNumber'];
|
||||
$this->attributes['street'][0] = $post['street'];
|
||||
$this->attributes['postOfficeBox'][0] = $post['postOfficeBox'];
|
||||
$this->attributes['postalCode'][0] = $post['postalCode'];
|
||||
$this->attributes['postalAddress'][0] = $post['postalAddress'];
|
||||
$this->attributes['employeeType'][0] = $post['employeeType'];
|
||||
if ($post['manager'] != '-') {
|
||||
$this->attributes['manager'][0] = $post['manager'];
|
||||
$this->attributes['description'][0] = $_POST['description'];
|
||||
$this->attributes['sn'][0] = $_POST['sn'];
|
||||
$this->attributes['givenName'][0] = $_POST['givenName'];
|
||||
$this->attributes['title'][0] = $_POST['title'];
|
||||
$this->attributes['mail'][0] = $_POST['mail'];
|
||||
$this->attributes['telephoneNumber'][0] = $_POST['telephoneNumber'];
|
||||
$this->attributes['mobile'][0] = $_POST['mobileTelephoneNumber'];
|
||||
$this->attributes['facsimileTelephoneNumber'][0] = $_POST['facsimileTelephoneNumber'];
|
||||
$this->attributes['street'][0] = $_POST['street'];
|
||||
$this->attributes['postOfficeBox'][0] = $_POST['postOfficeBox'];
|
||||
$this->attributes['postalCode'][0] = $_POST['postalCode'];
|
||||
$this->attributes['postalAddress'][0] = $_POST['postalAddress'];
|
||||
$this->attributes['employeeType'][0] = $_POST['employeeType'];
|
||||
if ($_POST['manager'] != '-') {
|
||||
$this->attributes['manager'][0] = $_POST['manager'];
|
||||
}
|
||||
else {
|
||||
unset($this->attributes['manager'][0]);
|
||||
|
@ -472,23 +471,23 @@ class inetOrgPerson extends baseModule {
|
|||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('posixAccount', $modules)) {
|
||||
// uid
|
||||
if (!get_preg($post['userName'], 'username')) {
|
||||
if (!get_preg($_POST['userName'], 'username')) {
|
||||
$errors['uid'][] = $this->messages['uid'][0];
|
||||
}
|
||||
else {
|
||||
$this->attributes['uid'][0] = $post['userName'];
|
||||
$this->attributes['uid'][0] = $_POST['userName'];
|
||||
}
|
||||
// cn
|
||||
if ($post['cn'] == '') {
|
||||
if ($post['givenName'] != '') {
|
||||
$this->attributes['cn'][0] = $post['givenName'] . " " . $post['sn'];
|
||||
if ($_POST['cn'] == '') {
|
||||
if ($_POST['givenName'] != '') {
|
||||
$this->attributes['cn'][0] = $_POST['givenName'] . " " . $_POST['sn'];
|
||||
}
|
||||
else {
|
||||
$this->attributes['cn'][0] = $post['sn'];
|
||||
$this->attributes['cn'][0] = $_POST['sn'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->attributes['cn'][0] = $post['cn'];
|
||||
$this->attributes['cn'][0] = $_POST['cn'];
|
||||
}
|
||||
if (!get_preg($this->attributes['cn'][0], 'cn')) {
|
||||
$errors['cn'][] = $this->messages['cn'][0];
|
||||
|
@ -497,7 +496,7 @@ class inetOrgPerson extends baseModule {
|
|||
|
||||
// handle host-attribute in on epice because it's not set by default
|
||||
if ($_SESSION['ldap']->supports_unix_hosts) {
|
||||
$host = $post['host'];
|
||||
$host = $_POST['host'];
|
||||
if (!get_preg($host,'unixhost')) {
|
||||
$errors['host'][] = $this->messages['host'][0];
|
||||
}
|
||||
|
@ -521,20 +520,20 @@ class inetOrgPerson extends baseModule {
|
|||
if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors['personal_postalCode'][] = $this->messages['postalCode'][0];
|
||||
if ( !get_preg($this->attributes['title'][0], 'title')) $errors['title'][] = $this->messages['title'][0];
|
||||
if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors['employeeType'][] = $this->messages['employeeType'][0];
|
||||
if ($post['userPassword']) {
|
||||
if ($post['userPassword'] != $post['userPassword2']) {
|
||||
if ($_POST['userPassword']) {
|
||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][0];
|
||||
}
|
||||
else {
|
||||
if (!get_preg($post['userPassword'], 'password')) {
|
||||
if (!get_preg($_POST['userPassword'], 'password')) {
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
else {
|
||||
$this->attributes['userPassword'][0] = $post['userPassword'];
|
||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($post['delPhoto']) $this->attributes['jpegPhoto'] = array();
|
||||
if ($_POST['delPhoto']) $this->attributes['jpegPhoto'] = array();
|
||||
// Return error-messages
|
||||
return $errors;
|
||||
}
|
||||
|
@ -543,7 +542,7 @@ class inetOrgPerson extends baseModule {
|
|||
* to show a page with all attributes.
|
||||
* It will output a complete html-table
|
||||
*/
|
||||
function display_html_attributes($post) {
|
||||
function display_html_attributes() {
|
||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('posixAccount', $modules)) {
|
||||
$uid = '';
|
||||
|
@ -724,21 +723,19 @@ class inetOrgPerson extends baseModule {
|
|||
|
||||
/**
|
||||
* Sets a new password.
|
||||
*
|
||||
* @param $post HTTP POST
|
||||
*/
|
||||
function process_password($post) {
|
||||
if ($post['form_subpage_inetOrgPerson_attributes_back']) return array();
|
||||
function process_password() {
|
||||
if ($_POST['form_subpage_inetOrgPerson_attributes_back']) return array();
|
||||
$messages = array();
|
||||
if ($post['userPassword'] != $post['userPassword2']) {
|
||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||
$messages['userPassword'][] = $this->messages['userPassword'][0];
|
||||
}
|
||||
else {
|
||||
if (!get_preg($post['userPassword'], 'password')) {
|
||||
if (!get_preg($_POST['userPassword'], 'password')) {
|
||||
$messages['userPassword'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
else {
|
||||
$this->attributes['userPassword'][0] = $post['userPassword'];
|
||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||
}
|
||||
}
|
||||
return $messages;
|
||||
|
@ -747,10 +744,9 @@ class inetOrgPerson extends baseModule {
|
|||
/**
|
||||
* Displays the password changing dialog.
|
||||
*
|
||||
* @param array $post HTTP-POST
|
||||
* @return array meta HTML code
|
||||
*/
|
||||
function display_html_password($post) {
|
||||
function display_html_password() {
|
||||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Password') ),
|
||||
1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""),
|
||||
|
@ -769,11 +765,9 @@ class inetOrgPerson extends baseModule {
|
|||
|
||||
/**
|
||||
* Sets a new photo.
|
||||
*
|
||||
* @param $post HTTP POST
|
||||
*/
|
||||
function process_photo($post) {
|
||||
if ($post['form_subpage_inetOrgPerson_attributes_back']) return array();
|
||||
function process_photo() {
|
||||
if ($_POST['form_subpage_inetOrgPerson_attributes_back']) return array();
|
||||
$messages = array();
|
||||
if ($_FILES['photoFile'] && ($_FILES['photoFile']['size'] > 0)) {
|
||||
$handle = fopen($_FILES['photoFile']['tmp_name'], "r");
|
||||
|
@ -790,10 +784,9 @@ class inetOrgPerson extends baseModule {
|
|||
/**
|
||||
* Displays the photo upload page.
|
||||
*
|
||||
* @param array $post HTTP-POST
|
||||
* @return array meta HTML code
|
||||
*/
|
||||
function display_html_photo($post) {
|
||||
function display_html_photo() {
|
||||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Photo file (JPG format)') ),
|
||||
1 => array('kind' => 'input', 'name' => 'photoFile', 'type' => 'file'),
|
||||
|
@ -809,7 +802,7 @@ class inetOrgPerson extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
@ -1262,7 +1255,7 @@ class inetOrgPerson extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -33,7 +33,7 @@ $Id$
|
|||
* @package modules
|
||||
*/
|
||||
class kolabUser extends baseModule {
|
||||
|
||||
|
||||
/** list of invitation policies */
|
||||
var $invitationPolicies;
|
||||
|
||||
|
@ -236,7 +236,7 @@ class kolabUser extends baseModule {
|
|||
$this->messages['quota'][0] = array('ERROR', _('Mail quota must be a number!')); // third array value is set dynamically
|
||||
$this->messages['quota'][1] = array('ERROR', _('Account %s:') . ' kolabUser_quota', _('Mail quota must be a number!'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of modifications which have to be made to the LDAP account.
|
||||
*
|
||||
|
@ -258,10 +258,8 @@ class kolabUser extends baseModule {
|
|||
|
||||
/**
|
||||
* This function will create the meta HTML code to show a page with all attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function display_html_attributes(&$post) {
|
||||
function display_html_attributes() {
|
||||
if ($_SESSION[$this->base]->isNewAccount) {
|
||||
if (isset($_SESSION[$this->base]->module['posixAccount'])) {
|
||||
if (!$_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]) {
|
||||
|
@ -409,35 +407,34 @@ class kolabUser extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
if ($post['form_subpage_kolabUser_deleteUser_open']) return;
|
||||
if ($_POST['form_subpage_kolabUser_deleteUser_open']) return array();
|
||||
$this->attributes['kolabInvitationPolicy'] = array();
|
||||
// country
|
||||
if (isset($post['country'])) {
|
||||
if (($post['country'] == "") || get_preg($post['country'], 'country')) {
|
||||
$this->attributes['c'][0] = $post['country'];
|
||||
if (isset($_POST['country'])) {
|
||||
if (($_POST['country'] == "") || get_preg($_POST['country'], 'country')) {
|
||||
$this->attributes['c'][0] = $_POST['country'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['country'][0];
|
||||
$message[] = $post['country'];
|
||||
$message[] = $_POST['country'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
// mailbox server
|
||||
if (isset($post['homeServer'])) {
|
||||
if ($post['homeServer'] == "") {
|
||||
if (isset($_POST['homeServer'])) {
|
||||
if ($_POST['homeServer'] == "") {
|
||||
$errors[] = array($this->messages['homeServer'][2]);
|
||||
}
|
||||
elseif (get_preg($post['homeServer'], 'DNSname')) {
|
||||
$this->attributes['kolabHomeServer'][0] = $post['homeServer'];
|
||||
elseif (get_preg($_POST['homeServer'], 'DNSname')) {
|
||||
$this->attributes['kolabHomeServer'][0] = $_POST['homeServer'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['homeServer'][0];
|
||||
$message[] = $post['homeServer'];
|
||||
$message[] = $_POST['homeServer'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
|
@ -445,108 +442,108 @@ class kolabUser extends baseModule {
|
|||
$policies = array_flip($this->invitationPolicies);
|
||||
$targets = array();
|
||||
$i = 0;
|
||||
while (isset($post['invPol1' . $i])) {
|
||||
if (isset($post['delInvPol' . $i])) {
|
||||
while (isset($_POST['invPol1' . $i])) {
|
||||
if (isset($_POST['delInvPol' . $i])) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if (isset($post['invPol2' . $i]) && ($post['invPol1' . $i] != "") && !in_array($post['invPol1' . $i], $targets)) {
|
||||
$targets[] = $post['invPol1' . $i];
|
||||
if (isset($_POST['invPol2' . $i]) && ($_POST['invPol1' . $i] != "") && !in_array($_POST['invPol1' . $i], $targets)) {
|
||||
$targets[] = $_POST['invPol1' . $i];
|
||||
// check invitation policy
|
||||
if (!get_preg($post['invPol1' . $i], 'email')) {
|
||||
if (!get_preg($_POST['invPol1' . $i], 'email')) {
|
||||
$message = $this->messages['invPol'][0];
|
||||
$message[] = $post['invPol1' . $i];
|
||||
$message[] = $_POST['invPol1' . $i];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
else {
|
||||
$this->attributes['kolabInvitationPolicy'][] = $post['invPol1' . $i] . ':' . $policies[$post['invPol2' . $i]];
|
||||
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1' . $i] . ':' . $policies[$_POST['invPol2' . $i]];
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
// check new invitation policy
|
||||
if (isset($post['invPol1']) && ($post['invPol1'] != "") && !in_array($post['invPol1'], $targets)) {
|
||||
if (isset($_POST['invPol1']) && ($_POST['invPol1'] != "") && !in_array($_POST['invPol1'], $targets)) {
|
||||
// check new invitation policy
|
||||
if (!get_preg($post['invPol1'], 'email')) {
|
||||
if (!get_preg($_POST['invPol1'], 'email')) {
|
||||
$message = $this->messages['invPol'][0];
|
||||
$message[] = $post['invPol1'];
|
||||
$message[] = $_POST['invPol1'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
else {
|
||||
$this->attributes['kolabInvitationPolicy'][] = $post['invPol1'] . ':' . $policies[$post['invPol2']];
|
||||
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1'] . ':' . $policies[$_POST['invPol2']];
|
||||
}
|
||||
}
|
||||
// default invitation policy
|
||||
if (isset($post['defaultInvPol']) && ($post['defaultInvPol'] != "")) {
|
||||
$this->attributes['kolabInvitationPolicy'][] = $policies[$post['defaultInvPol']];
|
||||
if (isset($_POST['defaultInvPol']) && ($_POST['defaultInvPol'] != "")) {
|
||||
$this->attributes['kolabInvitationPolicy'][] = $policies[$_POST['defaultInvPol']];
|
||||
}
|
||||
// check old mail aliases
|
||||
$this->attributes['alias'] = array();
|
||||
$i = 0;
|
||||
while (isset($post['alias' . $i])) {
|
||||
if (isset($post['delAlias' . $i])) {
|
||||
while (isset($_POST['alias' . $i])) {
|
||||
if (isset($_POST['delAlias' . $i])) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if (isset($post['alias' . $i]) && ($post['alias' . $i] != "") && !in_array($post['alias' . $i], $this->attributes['alias'])) {
|
||||
if (isset($_POST['alias' . $i]) && ($_POST['alias' . $i] != "") && !in_array($_POST['alias' . $i], $this->attributes['alias'])) {
|
||||
// check mail alias
|
||||
if (!get_preg($post['alias' . $i], 'email')) {
|
||||
if (!get_preg($_POST['alias' . $i], 'email')) {
|
||||
$message = $this->messages['alias'][0];
|
||||
$message[] = $post['alias' . $i];
|
||||
$message[] = $_POST['alias' . $i];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
$this->attributes['alias'][] = $post['alias' . $i];
|
||||
$this->attributes['alias'][] = $_POST['alias' . $i];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
// check new mail alias
|
||||
if (isset($post['alias']) && ($post['alias'] != "")) {
|
||||
if (isset($_POST['alias']) && ($_POST['alias'] != "")) {
|
||||
// check new mail alias
|
||||
if (!get_preg($post['alias'], 'email')) {
|
||||
if (!get_preg($_POST['alias'], 'email')) {
|
||||
$message = $this->messages['alias'][0];
|
||||
$message[] = $post['alias'];
|
||||
$message[] = $_POST['alias'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
else {
|
||||
$this->attributes['alias'][] = $post['alias'];
|
||||
$this->attributes['alias'][] = $_POST['alias'];
|
||||
}
|
||||
}
|
||||
$this->attributes['alias'] = array_unique($this->attributes['alias']);
|
||||
// check old delegates
|
||||
$this->attributes['kolabDelegate'] = array();
|
||||
$i = 0;
|
||||
while (isset($post['delegate' . $i])) {
|
||||
if (isset($post['delDelegate' . $i])) {
|
||||
while (isset($_POST['delegate' . $i])) {
|
||||
if (isset($_POST['delDelegate' . $i])) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
$this->attributes['kolabDelegate'][] = $post['delegate' . $i];
|
||||
$this->attributes['kolabDelegate'][] = $_POST['delegate' . $i];
|
||||
$i++;
|
||||
}
|
||||
// check new delegate
|
||||
if (isset($post['addDelegate']) && ($post['delegate'] != "")) {
|
||||
$this->attributes['kolabDelegate'][] = $post['delegate'];
|
||||
if (isset($_POST['addDelegate']) && ($_POST['delegate'] != "")) {
|
||||
$this->attributes['kolabDelegate'][] = $_POST['delegate'];
|
||||
}
|
||||
$this->attributes['kolabDelegate'] = array_unique($this->attributes['kolabDelegate']);
|
||||
// free/busy future
|
||||
if (isset($post['freeBusy'])) {
|
||||
if (($post['freeBusy'] == "") || get_preg($post['freeBusy'], 'digit')) {
|
||||
$this->attributes['kolabFreeBusyFuture'][0] = $post['freeBusy'];
|
||||
if (isset($_POST['freeBusy'])) {
|
||||
if (($_POST['freeBusy'] == "") || get_preg($_POST['freeBusy'], 'digit')) {
|
||||
$this->attributes['kolabFreeBusyFuture'][0] = $_POST['freeBusy'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['freeBusy'][0];
|
||||
$message[] = $post['freeBusy'];
|
||||
$message[] = $_POST['freeBusy'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
// Cyrus mail quota
|
||||
if (isset($post['quota'])) {
|
||||
if (($post['quota'] == "") || get_preg($post['quota'], 'digit')) {
|
||||
$this->attributes['cyrus-userquota'][0] = $post['quota'];
|
||||
if (isset($_POST['quota'])) {
|
||||
if (($_POST['quota'] == "") || get_preg($_POST['quota'], 'digit')) {
|
||||
$this->attributes['cyrus-userquota'][0] = $_POST['quota'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['quota'][0];
|
||||
$message[] = $post['quota'];
|
||||
$message[] = $_POST['quota'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
|
@ -555,10 +552,8 @@ class kolabUser extends baseModule {
|
|||
|
||||
/**
|
||||
* This function will create the meta HTML code to show a page to delete accounts.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function display_html_deleteUser(&$post) {
|
||||
function display_html_deleteUser() {
|
||||
$return = array();
|
||||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Do you really want to mark this account for deletion?'), 'td' => array('colspan' => 2)));
|
||||
|
@ -569,14 +564,12 @@ class kolabUser extends baseModule {
|
|||
1 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Cancel'), 'name' => 'form_subpage_kolabUser_attributes_cancel'));
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write variables into object and do some regex checks
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function process_deleteUser(&$post) {
|
||||
if ($post['form_subpage_kolabUser_attributes_confirm']) {
|
||||
function process_deleteUser() {
|
||||
if ($_POST['form_subpage_kolabUser_attributes_confirm']) {
|
||||
// set delete flag
|
||||
$this->attributes['kolabDeleteflag'][0] = $this->attributes['kolabHomeServer'][0];
|
||||
}
|
||||
|
@ -599,7 +592,7 @@ class kolabUser extends baseModule {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* In this function the LDAP account is built up.
|
||||
*
|
||||
|
@ -743,7 +736,7 @@ class kolabUser extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
|
|
@ -34,7 +34,7 @@ $Id$
|
|||
* @package modules
|
||||
*/
|
||||
class ldapPublicKey extends baseModule {
|
||||
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -81,10 +81,8 @@ class ldapPublicKey extends baseModule {
|
|||
|
||||
/**
|
||||
* This function will create the meta HTML code to show a page with all attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function display_html_attributes(&$post) {
|
||||
function display_html_attributes() {
|
||||
$return = array();
|
||||
// list current keys
|
||||
for ($i = 0; $i < sizeof($this->attributes['sshPublicKey']); $i++) {
|
||||
|
@ -108,23 +106,22 @@ class ldapPublicKey extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$this->attributes['sshPublicKey'] = array();
|
||||
// check old keys
|
||||
if (isset($post['key_number'])) {
|
||||
for ($i = 0; $i < $post['key_number']; $i++) {
|
||||
if (isset($post['delKey' . $i])) continue;
|
||||
if (isset($post['sshPublicKey' . $i]) && ($post['sshPublicKey' . $i] != "")) {
|
||||
$this->attributes['sshPublicKey'][] = $post['sshPublicKey' . $i];
|
||||
if (isset($_POST['key_number'])) {
|
||||
for ($i = 0; $i < $_POST['key_number']; $i++) {
|
||||
if (isset($_POST['delKey' . $i])) continue;
|
||||
if (isset($_POST['sshPublicKey' . $i]) && ($_POST['sshPublicKey' . $i] != "")) {
|
||||
$this->attributes['sshPublicKey'][] = $_POST['sshPublicKey' . $i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// check new key
|
||||
if (isset($post['sshPublicKey']) && ($post['sshPublicKey'] != "")) {
|
||||
$this->attributes['sshPublicKey'][] = $post['sshPublicKey'];
|
||||
if (isset($_POST['sshPublicKey']) && ($_POST['sshPublicKey'] != "")) {
|
||||
$this->attributes['sshPublicKey'][] = $_POST['sshPublicKey'];
|
||||
}
|
||||
$this->attributes['sshPublicKey'] = array_unique($this->attributes['sshPublicKey']);
|
||||
return array();
|
||||
|
|
|
@ -33,7 +33,7 @@ $Id$
|
|||
* @package modules
|
||||
*/
|
||||
class nisMailAlias extends baseModule {
|
||||
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -103,7 +103,7 @@ class nisMailAlias extends baseModule {
|
|||
$this->messages['recipient'][0] = array('ERROR', 'Recipient is invalid!'); // third array value is set dynamically
|
||||
$this->messages['recipient'][1] = array('ERROR', _('Account %s:') . ' nisMailAlias_recipient', 'Recipient is invalid!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of modifications which have to be made to the LDAP account.
|
||||
*
|
||||
|
@ -125,10 +125,8 @@ class nisMailAlias extends baseModule {
|
|||
|
||||
/**
|
||||
* This function will create the meta HTML code to show a page with all attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
*/
|
||||
function display_html_attributes(&$post) {
|
||||
function display_html_attributes() {
|
||||
$return = array();
|
||||
// alias name
|
||||
$return[] = array(
|
||||
|
@ -157,46 +155,45 @@ class nisMailAlias extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
$this->attributes['cn'] = array();
|
||||
$this->attributes['rfc822MailMember'] = array();
|
||||
// check alias name
|
||||
if (isset($post['cn']) && ($post['cn'] != "") && get_preg($post['cn'], 'nis_alias')) {
|
||||
$this->attributes['cn'][] = $post['cn'];
|
||||
if (isset($_POST['cn']) && ($_POST['cn'] != "") && get_preg($_POST['cn'], 'nis_alias')) {
|
||||
$this->attributes['cn'][] = $_POST['cn'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['alias'][0];
|
||||
$message[] = $post['cn'];
|
||||
$message[] = $_POST['cn'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
// check old recipients
|
||||
if (isset($post['rec_number'])) {
|
||||
for ($i = 0; $i < $post['rec_number']; $i++) {
|
||||
if (isset($post['delRec' . $i])) continue;
|
||||
if (isset($post['rfc822MailMember' . $i]) && ($post['rfc822MailMember' . $i] != "")) {
|
||||
if (isset($_POST['rec_number'])) {
|
||||
for ($i = 0; $i < $_POST['rec_number']; $i++) {
|
||||
if (isset($_POST['delRec' . $i])) continue;
|
||||
if (isset($_POST['rfc822MailMember' . $i]) && ($_POST['rfc822MailMember' . $i] != "")) {
|
||||
// check if address has correct format
|
||||
if (!get_preg($post['rfc822MailMember' . $i], 'nis_recipient')) {
|
||||
if (!get_preg($_POST['rfc822MailMember' . $i], 'nis_recipient')) {
|
||||
$message = $this->messages['recipient'][0];
|
||||
$message[] = $post['rfc822MailMember' . $i];
|
||||
$message[] = $_POST['rfc822MailMember' . $i];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
$this->attributes['rfc822MailMember'][] = $post['rfc822MailMember' . $i];
|
||||
$this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember' . $i];
|
||||
}
|
||||
}
|
||||
}
|
||||
// check new recipient
|
||||
if (isset($post['rfc822MailMember']) && ($post['rfc822MailMember'] != "")) {
|
||||
if (isset($_POST['rfc822MailMember']) && ($_POST['rfc822MailMember'] != "")) {
|
||||
// check if address has correct format
|
||||
if (get_preg($post['rfc822MailMember'], 'nis_recipient')) {
|
||||
$this->attributes['rfc822MailMember'][] = $post['rfc822MailMember'];
|
||||
if (get_preg($_POST['rfc822MailMember'], 'nis_recipient')) {
|
||||
$this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember'];
|
||||
}
|
||||
else {
|
||||
$message = $this->messages['recipient'][0];
|
||||
$message[] = $post['rfc822MailMember'];
|
||||
$message[] = $_POST['rfc822MailMember'];
|
||||
$errors[] = array($message);
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +261,7 @@ class nisMailAlias extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
/*
|
||||
$Id$
|
||||
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
||||
Copyright (C) 2003 - 2006 Tilo Lutz
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
@ -464,7 +464,7 @@ class posixAccount extends baseModule {
|
|||
|
||||
/**
|
||||
* This function loads all needed LDAP attributes.
|
||||
*
|
||||
*
|
||||
* @param array $attr list of attributes
|
||||
*/
|
||||
function load_attributes($attr) {
|
||||
|
@ -570,7 +570,12 @@ class posixAccount extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
function delete_attributes($post) {
|
||||
/**
|
||||
* Additional LDAP operations on delete.
|
||||
*
|
||||
* @return List of LDAP operations, same as for save_attributes()
|
||||
*/
|
||||
function delete_attributes() {
|
||||
$return = array();
|
||||
// remove memberUids if set
|
||||
$groups = $_SESSION['cache']->get_cache('memberUid', 'posixGroup', 'group');
|
||||
|
@ -579,7 +584,7 @@ class posixAccount extends baseModule {
|
|||
for ($i=0; $i<count($DNs); $i++) {
|
||||
if (in_array($this->attributes['uid'][0], $groups[$DNs[$i]])) $return[$DNs[$i]]['remove']['memberUid'][] = $this->attributes['uid'][0];
|
||||
}
|
||||
if ($post['deletehomedir']) $return[$_SESSION[$this->base]->dn_orig]['lamdaemon']['command'][] = $this->attributes['uid'][0] . " home rem";
|
||||
if ($_POST['deletehomedir']) $return[$_SESSION[$this->base]->dn_orig]['lamdaemon']['command'][] = $this->attributes['uid'][0] . " home rem";
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -587,34 +592,33 @@ class posixAccount extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
$groups = $_SESSION['cache']->findgroups(); // list of all groupnames
|
||||
if (count($groups)==0) {
|
||||
return array(array(array("ERROR", _('No Unix groups found in LDAP! Please create one first.'), '')));
|
||||
}
|
||||
$this->attributes['homeDirectory'][0] = $post['homeDirectory'];
|
||||
$this->attributes['loginShell'][0] = $post['loginShell'];
|
||||
if (isset($post['gecos'])) $this->attributes['gecos'][0] = $post['gecos'];
|
||||
if (isset($post['createhomedir'])) $this->createhomedir = true;
|
||||
$this->attributes['homeDirectory'][0] = $_POST['homeDirectory'];
|
||||
$this->attributes['loginShell'][0] = $_POST['loginShell'];
|
||||
if (isset($_POST['gecos'])) $this->attributes['gecos'][0] = $_POST['gecos'];
|
||||
if (isset($_POST['createhomedir'])) $this->createhomedir = true;
|
||||
else $this->createhomedir = false;
|
||||
if ($this->orig['uid'][0]!='' && $post['uid']!=$this->attributes['uid'][0])
|
||||
if ($this->orig['uid'][0]!='' && $_POST['uid']!=$this->attributes['uid'][0])
|
||||
$errors['uid'][] = $this->messages['uid'][0];
|
||||
if ($this->orig['gidNumber'][0]!='' && $_SESSION['cache']->getgid($post['gidNumber'])!=$this->attributes['gidNumber'][0])
|
||||
if ($this->orig['gidNumber'][0]!='' && $_SESSION['cache']->getgid($_POST['gidNumber'])!=$this->attributes['gidNumber'][0])
|
||||
$errors['gidNumber'][] = $this->dynamic_Message('gidNumber',0);
|
||||
if ($this->orig['uidNumber'][0]!='' && $post['uidNumber']!=$this->attributes['uidNumber'][0])
|
||||
if ($this->orig['uidNumber'][0]!='' && $_POST['uidNumber']!=$this->attributes['uidNumber'][0])
|
||||
$errors['uidNumber'][] = $this->dynamic_Message('uidNumber',0);
|
||||
if (isset($post['homeDirectory']) && $this->orig['homeDirectory'][0]!='' && $post['homeDirectory']!=$this->attributes['homeDirectory'][0])
|
||||
if (isset($_POST['homeDirectory']) && $this->orig['homeDirectory'][0]!='' && $_POST['homeDirectory']!=$this->attributes['homeDirectory'][0])
|
||||
$errors['homeDirectory'][] = $this->dynamic_Message('homeDirectory',0);
|
||||
// Load attributes
|
||||
$this->attributes['uid'][0] = $post['uid'];
|
||||
$this->attributes['cn'][0] = $post['cn'];
|
||||
$this->attributes['uid'][0] = $_POST['uid'];
|
||||
$this->attributes['cn'][0] = $_POST['cn'];
|
||||
if ($this->attributes['cn'][0] == '') {
|
||||
if (($this->scope == 'host') && (substr($post['uid'], -1, 1) == '$')) {
|
||||
$this->attributes['cn'][0] = substr($post['uid'], 0, strlen($post['uid']) - 1);
|
||||
if (($this->scope == 'host') && (substr($_POST['uid'], -1, 1) == '$')) {
|
||||
$this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 1);
|
||||
}
|
||||
elseif (isset($_SESSION[$this->base]->module['inetOrgPerson'])) {
|
||||
if ($_SESSION[$this->base]->module['inetOrgPerson']->attributes['givenName'][0]) {
|
||||
|
@ -624,18 +628,18 @@ class posixAccount extends baseModule {
|
|||
$this->attributes['cn'][0] = $_SESSION[$this->base]->module['inetOrgPerson']->attributes['sn'][0];
|
||||
}
|
||||
else {
|
||||
$this->attributes['cn'][0] = $post['uid'];
|
||||
$this->attributes['cn'][0] = $_POST['uid'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->attributes['cn'][0] = $post['uid'];
|
||||
$this->attributes['cn'][0] = $_POST['uid'];
|
||||
}
|
||||
}
|
||||
if (!get_preg($this->attributes['cn'][0], 'cn')) {
|
||||
$errors['cn'][] = $this->messages['cn'][0];
|
||||
}
|
||||
$this->attributes['uidNumber'][0] = $post['uidNumber'];
|
||||
$this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($post['gidNumber']);
|
||||
$this->attributes['uidNumber'][0] = $_POST['uidNumber'];
|
||||
$this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($_POST['gidNumber']);
|
||||
// Check if UID is valid. If none value was entered, the next useable value will be inserted
|
||||
// load min and may uidNumber
|
||||
if ($_SESSION[$this->base]->type=='user') {
|
||||
|
@ -683,42 +687,42 @@ class posixAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
if ($_SESSION[$this->base]->type=='user') {
|
||||
if (($this->attributes['uid'][0] != $post['uid']) && !get_preg($post['uid'], '!upper'))
|
||||
if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper'))
|
||||
$errors['uid'][] = $this->messages['uid'][1];
|
||||
if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' ))
|
||||
$errors['homeDirecotry'][] = $this->messages['homeDirectory'][0];
|
||||
}
|
||||
if (isset($post['userPassword_lock']) && isset($post['userPassword_nopassword'])) {
|
||||
if (isset($_POST['userPassword_lock']) && isset($_POST['userPassword_nopassword'])) {
|
||||
// found invalid password parameter combination
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][3];
|
||||
}
|
||||
else {
|
||||
if (isset($post['userPassword_nopassword'])) {
|
||||
if (isset($_POST['userPassword_nopassword'])) {
|
||||
$this->userPassword_nopassword=true;
|
||||
$this->attributes['userPassword'][0] = '';
|
||||
$post['userPassword2'] = '';
|
||||
if (isset($post['userPassword_lock']))
|
||||
$_POST['userPassword2'] = '';
|
||||
if (isset($_POST['userPassword_lock']))
|
||||
$this->userPassword_lock=true;
|
||||
else $this->userPassword_lock=false;
|
||||
}
|
||||
else {
|
||||
$this->userPassword_nopassword=false;
|
||||
if (isset($post['genpass'])) $this->attributes['userPassword'][0] = genpasswd();
|
||||
if (isset($_POST['genpass'])) $this->attributes['userPassword'][0] = genpasswd();
|
||||
elseif ($_SESSION[$this->base]->isNewAccount) {
|
||||
if ($post['userPassword'] != $post['userPassword2'])
|
||||
if ($_POST['userPassword'] != $_POST['userPassword2'])
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][0];
|
||||
else $this->attributes['userPassword'][0] = $post['userPassword'];
|
||||
else $this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||
if (!get_preg($this->attributes['userPassword'][0], 'password'))
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
if (isset($post['userPassword_lock'])) $this->userPassword_lock=true;
|
||||
if (isset($_POST['userPassword_lock'])) $this->userPassword_lock=true;
|
||||
else $this->userPassword_lock=false;
|
||||
}
|
||||
if ($_SESSION[$this->base]->type=='user') {
|
||||
$this->attributes['homeDirectory'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]), $this->attributes['homeDirectory'][0]);
|
||||
if ($this->attributes['uid'][0] != '')
|
||||
$this->attributes['homeDirectory'][0] = str_replace('$user', $this->attributes['uid'][0], $this->attributes['homeDirectory'][0]);
|
||||
if ($this->attributes['homeDirectory'][0] != $post['homeDirectory']) $errors['homeDirecotry'][] = array('INFO', _('Home directory'), _('Replaced $user or $group in homedir.'));
|
||||
if ($this->attributes['homeDirectory'][0] != $_POST['homeDirectory']) $errors['homeDirecotry'][] = array('INFO', _('Home directory'), _('Replaced $user or $group in homedir.'));
|
||||
// Check if Username contains only valid characters
|
||||
if ( !get_preg($this->attributes['uid'][0], 'username'))
|
||||
$errors['uid'][] = $this->messages['uid'][2];
|
||||
|
@ -727,7 +731,7 @@ class posixAccount extends baseModule {
|
|||
// add "$" to uid if needed
|
||||
if (substr($this->attributes['uid'][0], -1, 1) != '$') {
|
||||
$this->attributes['uid'][0] .= '$';
|
||||
$post['uid'] .= '$';
|
||||
$_POST['uid'] .= '$';
|
||||
}
|
||||
// Check if Hostname contains only valid characters
|
||||
if ( !get_preg($this->attributes['uid'][0], 'hostname'))
|
||||
|
@ -779,7 +783,7 @@ class posixAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
// Show warning if lam has changed username
|
||||
if ($this->attributes['uid'][0] != $post['uid']) {
|
||||
if ($this->attributes['uid'][0] != $_POST['uid']) {
|
||||
if ($_SESSION[$this->base]->type=='user') $errors['uid'][] = $this->messages['uid'][5];
|
||||
if ($_SESSION[$this->base]->type=='host') $errors['uid'][] = $this->messages['uid'][6];
|
||||
}
|
||||
|
@ -830,16 +834,15 @@ class posixAccount extends baseModule {
|
|||
* Processes user input of the group selection page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_group($post) {
|
||||
if (isset($post['addgroups']) && isset($post['addgroups_button'])) { // Add groups to list
|
||||
function process_group() {
|
||||
if (isset($_POST['addgroups']) && isset($_POST['addgroups_button'])) { // Add groups to list
|
||||
// Add new group
|
||||
$this->groups = @array_merge($this->groups, $post['addgroups']);
|
||||
$this->groups = @array_merge($this->groups, $_POST['addgroups']);
|
||||
}
|
||||
elseif (isset($post['removegroups']) && isset($post['removegroups_button'])) { // remove groups from list
|
||||
$this->groups = array_delete($post['removegroups'], $this->groups);
|
||||
elseif (isset($_POST['removegroups']) && isset($_POST['removegroups_button'])) { // remove groups from list
|
||||
$this->groups = array_delete($_POST['removegroups'], $this->groups);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -847,33 +850,32 @@ class posixAccount extends baseModule {
|
|||
* Processes user input of the password page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_password($post) {
|
||||
if ($post['form_subpage_posixAccount_attributes_back']) return array();
|
||||
function process_password() {
|
||||
if ($_POST['form_subpage_posixAccount_attributes_back']) return array();
|
||||
$messages = array();
|
||||
if ($post['userPassword'] != $post['userPassword2']) {
|
||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||
$messages['userPassword'][] = $this->messages['userPassword'][0];
|
||||
}
|
||||
else {
|
||||
if (!get_preg($post['userPassword'], 'password')) {
|
||||
if (!get_preg($_POST['userPassword'], 'password')) {
|
||||
$messages['userPassword'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
else {
|
||||
$this->attributes['userPassword'][0] = $post['userPassword'];
|
||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||
$this->userPassword_lock = false;
|
||||
$this->userPassword_nopassword = false;
|
||||
}
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
||||
|
||||
/* This function will create the html-page
|
||||
* to show a page with all attributes.
|
||||
* It will output a complete html-table
|
||||
*/
|
||||
function display_html_attributes($post) {
|
||||
function display_html_attributes() {
|
||||
// check password format if called the first time
|
||||
if (isset($this->attributes['userPassword'][0])) {
|
||||
if (pwd_is_enabled($this->attributes['userPassword'][0])) $this->userPassword_lock = false;
|
||||
|
@ -965,7 +967,7 @@ class posixAccount extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
function display_html_delete($post) {
|
||||
function display_html_delete() {
|
||||
if ($this->scope == 'user' && isset($_SESSION['config']->scriptPath)) {
|
||||
$return[] = array (
|
||||
0 => array('kind' => 'text', 'text' => _('Delete home directory')),
|
||||
|
@ -978,10 +980,9 @@ class posixAccount extends baseModule {
|
|||
/**
|
||||
* Displays the group selection.
|
||||
*
|
||||
* @param array $post HTTP-POST
|
||||
* @return array meta HTML code
|
||||
*/
|
||||
function display_html_group($post) {
|
||||
function display_html_group() {
|
||||
// load list with all groups
|
||||
$dn_groups = $_SESSION['cache']->get_cache('cn', 'posixGroup', 'group');
|
||||
$DNs = array_keys($dn_groups);
|
||||
|
@ -1024,10 +1025,9 @@ class posixAccount extends baseModule {
|
|||
/**
|
||||
* Displays the password changing dialog.
|
||||
*
|
||||
* @param array $post HTTP-POST
|
||||
* @return array meta HTML code
|
||||
*/
|
||||
function display_html_password($post) {
|
||||
function display_html_password() {
|
||||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Password') ),
|
||||
1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""),
|
||||
|
@ -1128,7 +1128,7 @@ class posixAccount extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
@ -1367,7 +1367,7 @@ class posixAccount extends baseModule {
|
|||
// description
|
||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||
if (!in_array('inetOrgPerson', $modules)) {
|
||||
if ($rawAccounts[$i][$ids['posixAccount_description']] && ($rawAccounts[$i][$ids['posixAccount_description']] != '')) {
|
||||
if ($rawAccounts[$i][$ids['posixAccount_description']] && ($rawAccounts[$i][$ids['posixAccount_description']] != '')) {
|
||||
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['posixAccount_description']];
|
||||
}
|
||||
else {
|
||||
|
@ -1415,7 +1415,7 @@ class posixAccount extends baseModule {
|
|||
$errors[] = $errMsg;
|
||||
}
|
||||
// description
|
||||
if ($rawAccounts[$i][$ids['posixAccount_description']] && ($rawAccounts[$i][$ids['posixAccount_description']] != '')) {
|
||||
if ($rawAccounts[$i][$ids['posixAccount_description']] && ($rawAccounts[$i][$ids['posixAccount_description']] != '')) {
|
||||
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['posixAccount_description']];
|
||||
}
|
||||
else {
|
||||
|
@ -1440,7 +1440,7 @@ class posixAccount extends baseModule {
|
|||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function executes one post upload action.
|
||||
*
|
||||
|
@ -1535,7 +1535,7 @@ class posixAccount extends baseModule {
|
|||
*
|
||||
* @param integer $count Number of needed free UIDs.
|
||||
* @param array $errors list of error messages where errors can be added
|
||||
* @return mixed Null if no UIDs are free else an array of free UIDs.
|
||||
* @return mixed Null if no UIDs are free else an array of free UIDs.
|
||||
*/
|
||||
function getNextUIDs($count, &$errors) {
|
||||
$ret = array();
|
||||
|
@ -1631,7 +1631,7 @@ class posixAccount extends baseModule {
|
|||
$return['messages'][] = $this->messages['userPassword'][0];
|
||||
}
|
||||
else {
|
||||
if (!get_preg($post['posixAccount_password'], 'password')) {
|
||||
if (!get_preg($_POST['posixAccount_password'], 'password')) {
|
||||
$return['messages'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -127,7 +127,7 @@ class posixGroup extends baseModule {
|
|||
}
|
||||
|
||||
|
||||
function delete_attributes($post) {
|
||||
function delete_attributes() {
|
||||
$data = $_SESSION['cache']->get_cache('gidNumber', 'posixAccount', 'user');
|
||||
$DNs = array_keys($data);
|
||||
$found = false;
|
||||
|
@ -148,7 +148,7 @@ class posixGroup extends baseModule {
|
|||
* to show a page with all attributes.
|
||||
* It will output a complete html-table
|
||||
*/
|
||||
function display_html_attributes($post) {
|
||||
function display_html_attributes() {
|
||||
// check password format if called the first time
|
||||
if (isset($this->attributes['userPassword'][0])) {
|
||||
if (pwd_is_enabled($this->attributes['userPassword'][0])) $this->userPassword_lock = false;
|
||||
|
@ -208,10 +208,9 @@ class posixGroup extends baseModule {
|
|||
/**
|
||||
* Displays selections to add or remove users from current group.
|
||||
*
|
||||
* @param array $post HTTP-POST
|
||||
* @return array meta HTML output
|
||||
*/
|
||||
function display_html_user($post) {
|
||||
function display_html_user() {
|
||||
// load list with all users
|
||||
$dn_users = $_SESSION['cache']->get_cache(array('uid', 'gidNumber'), 'posixAccount', 'user');
|
||||
$users = array();
|
||||
|
@ -256,10 +255,9 @@ class posixGroup extends baseModule {
|
|||
/**
|
||||
* Displays the password changing dialog.
|
||||
*
|
||||
* @param array $post HTTP-POST
|
||||
* @return array meta HTML code
|
||||
*/
|
||||
function display_html_password($post) {
|
||||
function display_html_password() {
|
||||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Password') ),
|
||||
1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""),
|
||||
|
@ -275,7 +273,7 @@ class posixGroup extends baseModule {
|
|||
2 => array('kind' => 'text')))));
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -455,7 +453,7 @@ class posixGroup extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
@ -539,43 +537,42 @@ class posixGroup extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
$this->attributes['description'][0] = $post['description'];
|
||||
$this->attributes['description'][0] = $_POST['description'];
|
||||
|
||||
if ($post['userPassword_lock'] && $post['userPassword_nopassword']) {
|
||||
if ($_POST['userPassword_lock'] && $_POST['userPassword_nopassword']) {
|
||||
// found invalid password parameter combination
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][3];
|
||||
}
|
||||
else {
|
||||
if ($post['userPassword_nopassword']) {
|
||||
if ($_POST['userPassword_nopassword']) {
|
||||
$this->userPassword_nopassword=true;
|
||||
$this->attributes['userPassword'][0] = '';
|
||||
$post['userPassword2'] = '';
|
||||
if ($post['userPassword_lock'])
|
||||
$_POST['userPassword2'] = '';
|
||||
if ($_POST['userPassword_lock'])
|
||||
$this->userPassword_lock=true;
|
||||
else $this->userPassword_lock=false;
|
||||
}
|
||||
else {
|
||||
$this->userPassword_nopassword=false;
|
||||
if ($post['genpass']) $this->attributes['userPassword'][0] = genpasswd();
|
||||
if ($_POST['genpass']) $this->attributes['userPassword'][0] = genpasswd();
|
||||
elseif ($_SESSION[$this->base]->isNewAccount) {
|
||||
if ($post['userPassword'] != $post['userPassword2'])
|
||||
if ($_POST['userPassword'] != $_POST['userPassword2'])
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][0];
|
||||
else $this->attributes['userPassword'][0] = $post['userPassword'];
|
||||
else $this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||
if (!get_preg($this->attributes['userPassword'][0], 'password'))
|
||||
$errors['userPassword'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
if ($post['userPassword_lock']) $this->userPassword_lock=true;
|
||||
if ($_POST['userPassword_lock']) $this->userPassword_lock=true;
|
||||
else $this->userPassword_lock=false;
|
||||
}
|
||||
}
|
||||
if ($post['changegids']) $this->changegids=true;
|
||||
if ($_POST['changegids']) $this->changegids=true;
|
||||
else $this->changegids=false;
|
||||
if (($this->attributes['gidNumber'][0] != $post['gidNumber']) || !isset($this->attributes['gidNumber'][0])) {
|
||||
if (($this->attributes['gidNumber'][0] != $_POST['gidNumber']) || !isset($this->attributes['gidNumber'][0])) {
|
||||
// Check if GID is valid. If none value was entered, the next useable value will be inserted
|
||||
// load min and max GID number
|
||||
$minID = intval($this->moduleSettings['posixGroup_minGID'][0]);
|
||||
|
@ -586,7 +583,7 @@ class posixGroup extends baseModule {
|
|||
foreach ($dn_gids as $gid) $gids[] = $gid[0];
|
||||
sort ($gids, SORT_NUMERIC);
|
||||
}
|
||||
$this->attributes['gidNumber'][0] = $post['gidNumber'];
|
||||
$this->attributes['gidNumber'][0] = $_POST['gidNumber'];
|
||||
if ($this->attributes['gidNumber'][0]=='') {
|
||||
// No id-number given, find free GID
|
||||
if ($this->orig['gidNumber'][0]=='') {
|
||||
|
@ -624,9 +621,9 @@ class posixGroup extends baseModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($this->attributes['cn'][0]!=$post['cn']) {
|
||||
$this->attributes['cn'][0] = $post['cn'];
|
||||
if (($this->attributes['cn'][0] != $post['cn']) && ereg('[A-Z]$', $post['cn']))
|
||||
if ($this->attributes['cn'][0]!=$_POST['cn']) {
|
||||
$this->attributes['cn'][0] = $_POST['cn'];
|
||||
if (($this->attributes['cn'][0] != $_POST['cn']) && ereg('[A-Z]$', $_POST['cn']))
|
||||
$errors['cn'][] = $this->messages['cn'][0];
|
||||
// Check if Groupname contains only valid characters
|
||||
if ( !get_preg($this->attributes['cn'][0],'groupname'))
|
||||
|
@ -669,11 +666,11 @@ class posixGroup extends baseModule {
|
|||
}
|
||||
}
|
||||
// Show warning if lam has changed username
|
||||
if ($this->attributes['cn'][0] != $post['cn']) {
|
||||
if ($this->attributes['cn'][0] != $_POST['cn']) {
|
||||
$errors['cn'][] = $this->messages['cn'][0];
|
||||
}
|
||||
// show info when gidnumber has changed
|
||||
if (($this->orig['gidNumber'][0]!=$this->attributes['gidNumber'][0]) && $this->orig['gidNumber'][0]!='' && $post['gidNumber']!=$this->attributes['gidNumber'][0]) {
|
||||
if (($this->orig['gidNumber'][0]!=$this->attributes['gidNumber'][0]) && $this->orig['gidNumber'][0]!='' && $_POST['gidNumber']!=$this->attributes['gidNumber'][0]) {
|
||||
$errors['gidNumber'][] = $this->messages['gidNumber'][0];
|
||||
}
|
||||
}
|
||||
|
@ -686,17 +683,16 @@ class posixGroup extends baseModule {
|
|||
* Processes user input of the user selection page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_user($post) {
|
||||
function process_user() {
|
||||
if (!isset($this->attributes['memberUid'])) $this->attributes['memberUid'] = array();
|
||||
if (isset($post['addusers']) && isset($post['addusers_button'])) { // Add users to list
|
||||
if (isset($_POST['addusers']) && isset($_POST['addusers_button'])) { // Add users to list
|
||||
// Add new user
|
||||
$this->attributes['memberUid'] = @array_merge($this->attributes['memberUid'], $post['addusers']);
|
||||
$this->attributes['memberUid'] = @array_merge($this->attributes['memberUid'], $_POST['addusers']);
|
||||
}
|
||||
elseif (isset($post['removeusers']) && isset($post['removeusers_button'])) { // remove users from list
|
||||
$this->attributes['memberUid'] = array_delete($post['removeusers'], $this->attributes['memberUid']);
|
||||
elseif (isset($_POST['removeusers']) && isset($_POST['removeusers_button'])) { // remove users from list
|
||||
$this->attributes['memberUid'] = array_delete($_POST['removeusers'], $this->attributes['memberUid']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -705,28 +701,27 @@ class posixGroup extends baseModule {
|
|||
* Processes user input of the password page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_password($post) {
|
||||
if ($post['form_subpage_posixGroup_attributes_back']) return array();
|
||||
function process_password() {
|
||||
if ($_POST['form_subpage_posixGroup_attributes_back']) return array();
|
||||
$messages = array();
|
||||
if ($post['userPassword'] != $post['userPassword2']) {
|
||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||
$messages['userPassword'][] = $this->messages['userPassword'][0];
|
||||
if (!get_preg($post['userPassword'], 'password'))
|
||||
if (!get_preg($_POST['userPassword'], 'password'))
|
||||
$messages['userPassword'][] = $this->messages['userPassword'][1];
|
||||
}
|
||||
else {
|
||||
$this->attributes['userPassword'][0] = $post['userPassword'];
|
||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||
$this->userPassword_lock = false;
|
||||
$this->userPassword_nopassword = false;
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function loads all needed LDAP attributes.
|
||||
*
|
||||
*
|
||||
* @param array $attr list of attributes
|
||||
*/
|
||||
function load_attributes($attr) {
|
||||
|
@ -824,7 +819,7 @@ class posixGroup extends baseModule {
|
|||
*
|
||||
* @param integer $count Number of needed free GIDs.
|
||||
* @param array $errors list of error messages where errors can be added
|
||||
* @return mixed Null if no GIDs are free else an array of free GIDs.
|
||||
* @return mixed Null if no GIDs are free else an array of free GIDs.
|
||||
*/
|
||||
function getNextGIDs($count, &$errors) {
|
||||
$ret = array();
|
||||
|
@ -878,5 +873,5 @@ class posixGroup extends baseModule {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -56,7 +56,7 @@ class quota extends baseModule {
|
|||
$this->messages['inode_cmp'][1] = array('ERROR', _('Account %s:') . ' %s', _('Inode soft quota must be smaller than inode hard quota.'));
|
||||
$this->messages['upload'][0] = array('ERROR', _('Account %s:') . ' %s', _('Quota has wrong format!'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns meta data that is interpreted by parent class
|
||||
*
|
||||
|
@ -173,7 +173,7 @@ class quota extends baseModule {
|
|||
if (!$this->module_ready()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* This function loads all attributes into the object
|
||||
* $attr is an array as it's retured from ldap_get_attributes
|
||||
*/
|
||||
|
@ -229,6 +229,7 @@ class quota extends baseModule {
|
|||
*/
|
||||
|
||||
$i=0;
|
||||
$quotastring = "";
|
||||
while ($this->quota[$i][0]) {
|
||||
$quotastring = $quotastring . $this->quota[$i][0] . ',' . $this->quota[$i][2] . ',' . $this->quota[$i][3]
|
||||
. ',' . $this->quota[$i][6] . ',' . $this->quota[$i][7] . ':';
|
||||
|
@ -242,8 +243,9 @@ class quota extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
function delete_attributes($post) {
|
||||
function delete_attributes() {
|
||||
$i=0;
|
||||
$quotastring = "";
|
||||
while ($this->quota[$i][0]) {
|
||||
$quotastring = $quotastring . $this->quota[$i][0] . ',0,0,0,0:';
|
||||
$i++;
|
||||
|
@ -258,19 +260,18 @@ class quota extends baseModule {
|
|||
* Processes user input of the primary module page.
|
||||
* It checks if all input values are correct and updates the associated LDAP attributes.
|
||||
*
|
||||
* @param array $post HTTP-POST values
|
||||
* @return array list of info/error messages
|
||||
*/
|
||||
function process_attributes(&$post) {
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
// Write all general values into $account_new
|
||||
$i=0;
|
||||
// loop for every mointpoint with quotas
|
||||
while ($this->quota[$i][0]) {
|
||||
$this->quota[$i][2] = $post[$i . '_2'];
|
||||
$this->quota[$i][3] = $post[$i . '_3'];
|
||||
$this->quota[$i][6] = $post[$i . '_6'];
|
||||
$this->quota[$i][7] = $post[$i . '_7'];
|
||||
$this->quota[$i][2] = $_POST[$i . '_2'];
|
||||
$this->quota[$i][3] = $_POST[$i . '_3'];
|
||||
$this->quota[$i][6] = $_POST[$i . '_6'];
|
||||
$this->quota[$i][7] = $_POST[$i . '_7'];
|
||||
// Check if values are OK and set automatic values. if not error-variable will be set
|
||||
if (!get_preg($this->quota[$i][2], 'digit'))
|
||||
$errors[$this->quota[$i][2]][] = $this->messages['softblock'][0];
|
||||
|
@ -293,7 +294,7 @@ class quota extends baseModule {
|
|||
* to show a page with all attributes.
|
||||
* It will output a complete html-table
|
||||
*/
|
||||
function display_html_attributes(&$post) {
|
||||
function display_html_attributes() {
|
||||
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mountpoint') ),
|
||||
1 => array ( 'kind' => 'text', 'text' => _('Used blocks') ),
|
||||
|
@ -332,10 +333,6 @@ class quota extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
function display_html_delete(&$post) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of elements for the account profiles.
|
||||
*
|
||||
|
@ -405,7 +402,7 @@ class quota extends baseModule {
|
|||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads the values of an account profile into internal variables.
|
||||
*
|
||||
|
@ -423,7 +420,7 @@ class quota extends baseModule {
|
|||
|
||||
/**
|
||||
* Returns the PDF entries for this module.
|
||||
*
|
||||
*
|
||||
* @return array list of possible PDF entries
|
||||
*/
|
||||
function get_pdfEntries() {
|
||||
|
@ -485,19 +482,6 @@ class quota extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* In this function the LDAP account is built up.
|
||||
*
|
||||
* @param array $rawAccounts list of hash arrays (name => value) from user input
|
||||
* @param array $partialAccounts list of hash arrays (name => value) which are later added to LDAP
|
||||
* @param array $ids list of IDs for column position (e.g. "posixAccount_uid" => 5)
|
||||
* @return array list of error messages if any
|
||||
*/
|
||||
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts) {
|
||||
// Quota changes no LDAP attributes, all actions are done in doUploadPostActions()
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function executes one post upload action.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue