removed $post parameter

This commit is contained in:
Roland Gruber 2006-08-14 17:24:27 +00:00
parent a65279dc5c
commit 44701eca3c
5 changed files with 148 additions and 160 deletions

View File

@ -499,39 +499,38 @@ class sambaAccount 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['domain'][0] = $post['domain'];
$this->attributes['domain'][0] = $_POST['domain'];
// Start character
$flag = "[";
if ($post['acctFlagsD']) {
if ($_POST['acctFlagsD']) {
$flag .= "D";
$this->deactivated = true;
}
else {
$this->deactivated = false;
}
if ($post['acctFlagsX']) {
if ($_POST['acctFlagsX']) {
$flag .= "X";
$this->noexpire = true;
}
else {
$this->noexpire = false;
}
if ($post['acctFlagsN']) {
if ($_POST['acctFlagsN']) {
$flag .= "N";
$this->nopwd = true;
}
else {
$this->nopwd = false;
}
if ($post['acctFlagsS']) $flag .= "S";
if ($post['acctFlagsH']) $flag .= "H";
if ($post['acctFlagsW']) $flag .= "W";
if ($post['acctFlagsU']) $flag .= "U";
if ($_POST['acctFlagsS']) $flag .= "S";
if ($_POST['acctFlagsH']) $flag .= "H";
if ($_POST['acctFlagsW']) $flag .= "W";
if ($_POST['acctFlagsU']) $flag .= "U";
// Expand string to fixed length
$flag = str_pad($flag, 12);
// End character
@ -539,7 +538,7 @@ class sambaAccount extends baseModule {
$this->attributes['acctFlags'][0] = $flag;
// display name
$this->attributes['displayName'][0] = $post['displayName'];
$this->attributes['displayName'][0] = $_POST['displayName'];
if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) {
$errors['displayName'][] = $this->messages['displayName'][1];
}
@ -547,7 +546,7 @@ class sambaAccount extends baseModule {
// host attributes
if ($_SESSION[$this->base]->type=='host') {
$this->attributes['primaryGroupID'][0] = $this->rids[_('Domain Computers')];
if ($post['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) {
if ($_POST['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) {
$hostname = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0];
$hostname = substr($hostname, 0, strlen($hostname) - 1);
$this->attributes['lmPassword'][0] = lmPassword($hostname);
@ -557,66 +556,66 @@ class sambaAccount extends baseModule {
}
// check values for user account
if ($this->scope == 'user') {
$this->attributes['pwdCanChange'][0] = mktime(intval($post['pwdCanChange_h']), intval($post['pwdCanChange_m']),
intval($post['pwdCanChange_s']), intval($post['pwdCanChange_mon']), intval($post['pwdCanChange_day']),
intval($post['pwdCanChange_yea']));
$this->attributes['pwdMustChange'][0] = mktime(intval($post['pwdMustChange_h']), intval($post['pwdMustChange_m']),
intval($post['pwdMustChange_s']), intval($post['pwdMustChange_mon']), intval($post['pwdMustChange_day']),
intval($post['pwdMustChange_yea']));
$this->attributes['smbHome'][0] = $post['smbHome'];
$this->attributes['homeDrive'][0] = $post['homeDrive'];
$this->attributes['scriptPath'][0] = $post['scriptPath'];
$this->attributes['profilePath'][0] = $post['profilePath'];
$this->attributes['pwdCanChange'][0] = mktime(intval($_POST['pwdCanChange_h']), intval($_POST['pwdCanChange_m']),
intval($_POST['pwdCanChange_s']), intval($_POST['pwdCanChange_mon']), intval($_POST['pwdCanChange_day']),
intval($_POST['pwdCanChange_yea']));
$this->attributes['pwdMustChange'][0] = mktime(intval($_POST['pwdMustChange_h']), intval($_POST['pwdMustChange_m']),
intval($_POST['pwdMustChange_s']), intval($_POST['pwdMustChange_mon']), intval($_POST['pwdMustChange_day']),
intval($_POST['pwdMustChange_yea']));
$this->attributes['smbHome'][0] = $_POST['smbHome'];
$this->attributes['homeDrive'][0] = $_POST['homeDrive'];
$this->attributes['scriptPath'][0] = $_POST['scriptPath'];
$this->attributes['profilePath'][0] = $_POST['profilePath'];
$rids = array_keys($this->rids);
$wrid = false;
for ($i=0; $i<count($rids); $i++) {
if ($post['primaryGroupID'] == $rids[$i]) {
if ($_POST['primaryGroupID'] == $rids[$i]) {
$wrid = true;
$this->attributes['primaryGroupID'][0] = $this->rids[$rids[$i]];
break;
}
}
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
if ($post['useunixpwd']) $this->useunixpwd = true;
if ($_POST['useunixpwd']) $this->useunixpwd = true;
else $this->useunixpwd = false;
if ($post['useunixpwd']) {
if ($_POST['useunixpwd']) {
$this->useunixpwd = true;
$this->attributes['lmPassword'][0] = lmPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]);
$this->attributes['ntPassword'][0] = ntPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]);
$this->attributes['pwdLastSet'][0] = time();
}
else $this->useunixpwd = false;
if (!$this->useunixpwd && isset($post['lmPassword']) && ($post['lmPassword'] != '')) {
if ($post['lmPassword'] != $post['lmPassword2']) {
if (!$this->useunixpwd && isset($_POST['lmPassword']) && ($_POST['lmPassword'] != '')) {
if ($_POST['lmPassword'] != $_POST['lmPassword2']) {
$errors['lmPassword'][] = $this->messages['lmPassword'][0];
unset ($post['lmPassword2']);
unset ($_POST['lmPassword2']);
}
else {
if ( !get_preg($post['lmPassword'], 'password')) $errors['lmPassword'][] = $this->messages['lmPassword'][1];
if ( !get_preg($_POST['lmPassword'], 'password')) $errors['lmPassword'][] = $this->messages['lmPassword'][1];
else {
$this->attributes['lmPassword'][0] = lmPassword($post['lmPassword']);
$this->attributes['ntPassword'][0] = ntPassword($post['lmPassword']);
$this->attributes['lmPassword'][0] = lmPassword($_POST['lmPassword']);
$this->attributes['ntPassword'][0] = ntPassword($_POST['lmPassword']);
$this->attributes['pwdLastSet'][0] = time();
}
}
}
// rid
$specialNames = array_keys($this->rids);
if (in_array($post['rid'], $specialNames)) {
$this->attributes['rid'][0] = $this->rids[$post['rid']];
if (in_array($_POST['rid'], $specialNames)) {
$this->attributes['rid'][0] = $this->rids[$_POST['rid']];
}
else {
$this->attributes['rid'][0] = $_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
}
$this->attributes['smbHome'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['smbHome'][0]);
$this->attributes['smbHome'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]);
if ($this->attributes['smbHome'][0] != $post['smbHome']) $errors['smbHome'][] = $this->messages['homePath'][1];
if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors['smbHome'][] = $this->messages['homePath'][1];
$this->attributes['scriptPath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['scriptPath'][0]);
$this->attributes['scriptPath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]);
if ($this->attributes['scriptPath'][0] != $post['scriptPath']) $errors['scriptPath'][] = $this->messages['logonScript'][1];
if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors['scriptPath'][] = $this->messages['logonScript'][1];
$this->attributes['profilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['profilePath'][0]);
$this->attributes['profilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]);
if ($this->attributes['profiletPath'][0] != $post['profilePath']) $errors['profilePath'][] = $this->messages['profilePath'][1];
if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors['profilePath'][] = $this->messages['profilePath'][1];
if ( (!$this->attributes['smbHome'][0]=='') && (!get_preg($this->attributes['smbHome'][0], 'UNC')))
$errors['smbHome'][] = $this->messages['homePath'][0];
if ( (!$this->attributes['scriptPath'][0]=='') && (!get_preg($this->attributes['scriptPath'][0], 'logonscript')))
@ -644,13 +643,12 @@ class sambaAccount extends baseModule {
* Processes user input of the workstation 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_userWorkstations(&$post) {
function process_userWorkstations() {
// Load attributes
if ($_SESSION[$this->base]->type=='user') {
if (isset($post['availableUserWorkstations']) && isset($post['userWorkstations_add'])) { // Add workstations to list
if (isset($_POST['availableUserWorkstations']) && isset($_POST['userWorkstations_add'])) { // Add workstations to list
$temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]);
$workstations = explode (',', $temp);
for ($i=0; $i<count($workstations); $i++) {
@ -658,7 +656,7 @@ class sambaAccount extends baseModule {
}
$workstations = array_values($workstations);
// Add new // Add workstations
$workstations = array_merge($workstations, $post['availableUserWorkstations']);
$workstations = array_merge($workstations, $_POST['availableUserWorkstations']);
// remove doubles
$workstations = array_flip($workstations);
array_unique($workstations);
@ -671,7 +669,7 @@ class sambaAccount extends baseModule {
$this->attributes['userWorkstations'][0] = $this->attributes['userWorkstations'][0] . "," . $workstations[$i];
}
}
elseif (isset($post['userWorkstations']) && isset($post['userWorkstations_remove'])) { // remove // Add workstations from list
elseif (isset($_POST['userWorkstations']) && isset($_POST['userWorkstations_remove'])) { // remove // Add workstations from list
// Put all workstations in array
$temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]);
$workstations = explode (',', $temp);
@ -680,7 +678,7 @@ class sambaAccount extends baseModule {
}
$workstations = array_values($workstations);
// Remove unwanted workstations from array
$workstations = array_delete($post['userWorkstations'], $workstations);
$workstations = array_delete($_POST['userWorkstations'], $workstations);
// Recreate workstation string
$this->attributes['userWorkstations'][0] = $workstations[0];
for ($i=1; $i<count($workstations); $i++) {
@ -694,7 +692,7 @@ class sambaAccount 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' => _('Display name')),
1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]),
@ -817,7 +815,7 @@ class sambaAccount extends baseModule {
* to show a page with all attributes.
* It will output a complete html-table
*/
function display_html_userWorkstations(&$post) {
function display_html_userWorkstations() {
if ($_SESSION[$this->base]->type=='user') {
// Get list of all hosts.
$result = $_SESSION['cache']->get_cache('uid', 'sambaAccount', 'host');

View File

@ -202,10 +202,8 @@ class sambaDomain 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();
// domain name
if ($_SESSION[$this->base]->isNewAccount) {
@ -347,10 +345,9 @@ class sambaDomain 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 ($_SESSION[$this->base]->isNewAccount) {
// domain SID

View File

@ -167,7 +167,7 @@ class sambaGroupMapping 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() {
$sambaDomains = search_domains();
if (sizeof($sambaDomains) == 0) {
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
@ -399,33 +399,32 @@ class sambaGroupMapping 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();
$sambaDomains = search_domains();
if (sizeof($sambaDomains) == 0) {
return array(array(array("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'))));
}
// Save attributes
$this->attributes['displayName'][0] = $post['displayName'];
$this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$post['sambaGroupType']];
$this->attributes['displayName'][0] = $_POST['displayName'];
$this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$_POST['sambaGroupType']];
// Get Domain SID from name
for ($i=0; $i<count($sambaDomains); $i++ ) {
if (!isset($post['sambaDomainName'])) break;
if ($post['sambaDomainName'] == $sambaDomains[$i]->name) {
if (!isset($_POST['sambaDomainName'])) break;
if ($_POST['sambaDomainName'] == $sambaDomains[$i]->name) {
$SID = $sambaDomains[$i]->SID;
$RIDbase = $sambaDomains[$i]->RIDbase;
}
}
// Load attributes
$this->attributes['displayName'][0] = $post['displayName'];
$this->attributes['displayName'][0] = $_POST['displayName'];
$rids = array_keys($this->rids);
$wrid = false;
for ($i=0; $i<count($rids); $i++) {
if ($post['sambaSID'] == $rids[$i]) {
if ($_POST['sambaSID'] == $rids[$i]) {
$wrid = true;
// Get Domain SID
$this->attributes['sambaSID'][0] = $SID."-".$this->rids[$rids[$i]];

View File

@ -544,17 +544,16 @@ class sambaSamAccount 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();
$sambaDomains = search_domains();
if (sizeof($sambaDomains) == 0) {
return array(array(array("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'))));
}
// Save attributes
$this->attributes['sambaDomainName'][0] = $post['sambaDomainName'];
$this->attributes['sambaDomainName'][0] = $_POST['sambaDomainName'];
// Get Domain SID from name
for ($i=0; $i<count($sambaDomains); $i++ )
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) {
@ -562,31 +561,31 @@ class sambaSamAccount extends baseModule {
$RIDbase = $sambaDomains[$i]->RIDbase;
}
$flag = "[";
if ($post['sambaAcctFlagsD']) {
if ($_POST['sambaAcctFlagsD']) {
$flag .= "D";
$this->deactivated = true;
}
else {
$this->deactivated = false;
}
if ($post['sambaAcctFlagsX']) {
if ($_POST['sambaAcctFlagsX']) {
$flag .= "X";
$this->noexpire = true;
}
else {
$this->noexpire = false;
}
if ($post['sambaAcctFlagsN']) {
if ($_POST['sambaAcctFlagsN']) {
$flag .= "N";
$this->nopwd = true;
}
else {
$this->nopwd = false;
}
if ($post['sambaAcctFlagsS']) $flag .= "S";
if ($post['sambaAcctFlagsH']) $flag .= "H";
if ($post['sambaAcctFlagsW']) $flag .= "W";
if ($post['sambaAcctFlagsU']) $flag .= "U";
if ($_POST['sambaAcctFlagsS']) $flag .= "S";
if ($_POST['sambaAcctFlagsH']) $flag .= "H";
if ($_POST['sambaAcctFlagsW']) $flag .= "W";
if ($_POST['sambaAcctFlagsU']) $flag .= "U";
// Expand string to fixed length
$flag = str_pad($flag, 12);
// End character
@ -594,7 +593,7 @@ class sambaSamAccount extends baseModule {
$this->attributes['sambaAcctFlags'][0] = $flag;
// display name
$this->attributes['displayName'][0] = $post['displayName'];
$this->attributes['displayName'][0] = $_POST['displayName'];
if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) {
$errors['displayName'][] = $this->messages['displayName'][1];
}
@ -602,7 +601,7 @@ class sambaSamAccount extends baseModule {
// host attributes
if ($_SESSION[$this->base]->type=='host') {
$this->attributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[_('Domain Computers')];
if ($post['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) {
if ($_POST['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) {
$hostname = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0];
$hostname = substr($hostname, 0, strlen($hostname) - 1);
$this->attributes['sambaLMPassword'][0] = lmPassword($hostname);
@ -612,26 +611,26 @@ class sambaSamAccount extends baseModule {
}
// user attributes
if ($_SESSION[$this->base]->type=='user') {
$this->attributes['sambaPwdCanChange'][0] = mktime(intval($post['sambaPwdCanChange_h']), intval($post['sambaPwdCanChange_m']),
intval($post['sambaPwdCanChange_s']), intval($post['sambaPwdCanChange_mon']), intval($post['sambaPwdCanChange_day']),
intval($post['sambaPwdCanChange_yea']));
$this->attributes['sambaPwdMustChange'][0] = mktime(intval($post['sambaPwdMustChange_h']), intval($post['sambaPwdMustChange_m']),
intval($post['sambaPwdMustChange_s']), intval($post['sambaPwdMustChange_mon']), intval($post['sambaPwdMustChange_day']),
intval($post['sambaPwdMustChange_yea']));
$this->attributes['sambaKickoffTime'][0] = mktime(intval($post['sambaExpire_h']), intval($post['sambaExpire_m']),
intval($post['sambaExpire_s']), intval($post['sambaExpire_mon']), intval($post['sambaExpire_day']),
intval($post['sambaExpire_yea']));
$this->attributes['sambaHomePath'][0] = $post['sambaHomePath'];
if ($post['sambaHomeDrive'] == "-")
$this->attributes['sambaPwdCanChange'][0] = mktime(intval($_POST['sambaPwdCanChange_h']), intval($_POST['sambaPwdCanChange_m']),
intval($_POST['sambaPwdCanChange_s']), intval($_POST['sambaPwdCanChange_mon']), intval($_POST['sambaPwdCanChange_day']),
intval($_POST['sambaPwdCanChange_yea']));
$this->attributes['sambaPwdMustChange'][0] = mktime(intval($_POST['sambaPwdMustChange_h']), intval($_POST['sambaPwdMustChange_m']),
intval($_POST['sambaPwdMustChange_s']), intval($_POST['sambaPwdMustChange_mon']), intval($_POST['sambaPwdMustChange_day']),
intval($_POST['sambaPwdMustChange_yea']));
$this->attributes['sambaKickoffTime'][0] = mktime(intval($_POST['sambaExpire_h']), intval($_POST['sambaExpire_m']),
intval($_POST['sambaExpire_s']), intval($_POST['sambaExpire_mon']), intval($_POST['sambaExpire_day']),
intval($_POST['sambaExpire_yea']));
$this->attributes['sambaHomePath'][0] = $_POST['sambaHomePath'];
if ($_POST['sambaHomeDrive'] == "-")
$this->attributes['sambaHomeDrive'][0] = '';
else
$this->attributes['sambaHomeDrive'][0] = $post['sambaHomeDrive'];
$this->attributes['sambaLogonScript'][0] = $post['sambaLogonScript'];
$this->attributes['sambaProfilePath'][0] = $post['sambaProfilePath'];
$this->attributes['sambaHomeDrive'][0] = $_POST['sambaHomeDrive'];
$this->attributes['sambaLogonScript'][0] = $_POST['sambaLogonScript'];
$this->attributes['sambaProfilePath'][0] = $_POST['sambaProfilePath'];
$rids = array_keys($this->rids);
$wrid = false;
for ($i=0; $i<count($rids); $i++) {
if ($post['sambaPrimaryGroupSID'] == $rids[$i]) {
if ($_POST['sambaPrimaryGroupSID'] == $rids[$i]) {
$wrid = true;
// Get Domain SID
$this->attributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[$rids[$i]];
@ -651,34 +650,34 @@ class sambaSamAccount extends baseModule {
}
}
if ($post['useunixpwd']) {
if ($_POST['useunixpwd']) {
$this->useunixpwd = true;
$this->attributes['sambaLMPassword'][0] = lmPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]);
$this->attributes['sambaNTPassword'][0] = ntPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]);
$this->attributes['sambaPwdLastSet'][0] = time();
}
else $this->useunixpwd = false;
if (!$this->useunixpwd && isset($post['sambaLMPassword']) && ($post['sambaLMPassword'] != '')) {
if ($post['sambaLMPassword'] != $post['sambaLMPassword2']) {
if (!$this->useunixpwd && isset($_POST['sambaLMPassword']) && ($_POST['sambaLMPassword'] != '')) {
if ($_POST['sambaLMPassword'] != $_POST['sambaLMPassword2']) {
$errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][0];
unset ($post['sambaLMPassword2']);
unset ($_POST['sambaLMPassword2']);
}
else {
if (!get_preg($post['sambaLMPassword'], 'password')) $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][1];
if (!get_preg($_POST['sambaLMPassword'], 'password')) $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][1];
else {
$this->attributes['sambaLMPassword'][0] = lmPassword($post['sambaLMPassword']);
$this->attributes['sambaNTPassword'][0] = ntPassword($post['sambaLMPassword']);
$this->attributes['sambaLMPassword'][0] = lmPassword($_POST['sambaLMPassword']);
$this->attributes['sambaNTPassword'][0] = ntPassword($_POST['sambaLMPassword']);
$this->attributes['sambaPwdLastSet'][0] = time();
}
}
}
$specialRids = array_flip($this->rids);
// set special RID if selected
if (in_array($post['sambaSID'], $specialRids)) {
$this->attributes['sambaSID'][0] = $SID . '-' . $this->rids[$post['sambaSID']];
if (in_array($_POST['sambaSID'], $specialRids)) {
$this->attributes['sambaSID'][0] = $SID . '-' . $this->rids[$_POST['sambaSID']];
}
// standard RID
else if ($post['sambaSID'] == "-") {
else if ($_POST['sambaSID'] == "-") {
$rid = substr($this->attributes['sambaSID'][0], strrpos($this->attributes['sambaSID'][0], '-') + 1, strlen($this->attributes['sambaSID'][0]));
// change only if not yet set or previously set to special SID
if (!$this->attributes['sambaSID'][0] || in_array($rid, $this->rids)) {
@ -688,13 +687,13 @@ class sambaSamAccount extends baseModule {
// Check values
$this->attributes['sambaHomePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaHomePath'][0]);
$this->attributes['sambaHomePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]);
if ($this->attributes['sambaHomePath'][0] != $post['sambaHomePath']) $errors['sambaHomePath'][] = $this->messages['homePath'][1];
if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors['sambaHomePath'][] = $this->messages['homePath'][1];
$this->attributes['sambaLogonScript'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaLogonScript'][0]);
$this->attributes['sambaLogonScript'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]);
if ($this->attributes['sambaLogonScript'][0] != $post['sambaLogonScript']) $errors['sambaLogonScript'][] = $this->messages['logonScript'][1];
if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors['sambaLogonScript'][] = $this->messages['logonScript'][1];
$this->attributes['sambaProfilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaProfilePath'][0]);
$this->attributes['sambaProfilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]);
if ($this->attributes['sambaProfilePath'][0] != $post['sambaProfilePath']) $errors['sambaProfilePath'][] = $this->messages['profilePath'][1];
if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors['sambaProfilePath'][] = $this->messages['profilePath'][1];
if ( (!$this->attributes['sambaHomePath'][0]=='') && (!get_preg($this->attributes['sambaHomePath'][0], 'UNC')))
$errors['sambaHomePath'][] = $this->messages['homePath'][0];
if ( (!$this->attributes['sambaLogonScript'][0]=='') && (!get_preg($this->attributes['sambaLogonScript'][0], 'logonscript')))
@ -715,13 +714,12 @@ class sambaSamAccount 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_sambaUserWorkstations($post) {
function process_sambaUserWorkstations() {
// Load attributes
if ($_SESSION[$this->base]->type=='user') {
if (isset($post['availableSambaUserWorkstations']) && isset($post['sambaUserWorkstations_add'])) { // Add workstations to list
if (isset($_POST['availableSambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_add'])) { // Add workstations to list
$temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]);
$workstations = explode (',', $temp);
for ($i=0; $i<count($workstations); $i++) {
@ -729,7 +727,7 @@ class sambaSamAccount extends baseModule {
}
$workstations = array_values($workstations);
// Add new // Add workstations
$workstations = array_merge($workstations, $post['availableSambaUserWorkstations']);
$workstations = array_merge($workstations, $_POST['availableSambaUserWorkstations']);
// remove doubles
$workstations = array_flip($workstations);
array_unique($workstations);
@ -742,7 +740,7 @@ class sambaSamAccount extends baseModule {
$this->attributes['sambaUserWorkstations'][0] = $this->attributes['sambaUserWorkstations'][0] . "," . $workstations[$i];
}
}
elseif (isset($post['sambaUserWorkstations']) && isset($post['sambaUserWorkstations_remove'])) { // remove // Add workstations from list
elseif (isset($_POST['sambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_remove'])) { // remove // Add workstations from list
// Put all workstations in array
$temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]);
$workstations = explode (',', $temp);
@ -751,7 +749,7 @@ class sambaSamAccount extends baseModule {
}
$workstations = array_values($workstations);
// Remove unwanted workstations from array
$workstations = array_delete($post['sambaUserWorkstations'], $workstations);
$workstations = array_delete($_POST['sambaUserWorkstations'], $workstations);
// Recreate workstation string
$this->attributes['sambaUserWorkstations'][0] = $workstations[0];
for ($i=1; $i<count($workstations); $i++) {
@ -765,15 +763,14 @@ class sambaSamAccount extends baseModule {
* Processes user input of the logon hours 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_logonHours($post) {
if ($post['form_subpage_sambaSamAccount_attributes_abort']) return;
function process_logonHours() {
if ($_POST['form_subpage_sambaSamAccount_attributes_abort']) return;
// set new logon hours
$logonHours = '';
for ($i = 0; $i < 24*7; $i++) {
$logonHours .= isset($post['lh_' . $i]) ? '1' : '0';
$logonHours .= isset($_POST['lh_' . $i]) ? '1' : '0';
}
// reconstruct HEX string
$bitstring2hex = array_flip($this->hex2bitstring);
@ -792,7 +789,7 @@ class sambaSamAccount 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() {
// Get Domain SID from user SID
$sambaDomains = search_domains();
if (sizeof($sambaDomains) == 0) {
@ -968,7 +965,7 @@ class sambaSamAccount extends baseModule {
* to show a page with all attributes.
* It will output a complete html-table
*/
function display_html_sambaUserWorkstations($post) {
function display_html_sambaUserWorkstations() {
if ($_SESSION[$this->base]->type=='user') {
// Get list of all hosts.
$result = $_SESSION['cache']->get_cache('uid', 'sambaSamAccount', 'host');
@ -1000,10 +997,9 @@ class sambaSamAccount extends baseModule {
/**
* This function will create the HTML page to edit logon hours.
*
* @param array $post HTTP POST variables
* @return array meta HTML code
*/
function display_html_logonHours($post) {
function display_html_logonHours() {
$timeZone = 0;
if (isset($this->moduleSettings['sambaSamAccount_timeZone']) && is_array($this->moduleSettings['sambaSamAccount_timeZone'])) {
$timeZone = $this->moduleSettings['sambaSamAccount_timeZone'][0];

View File

@ -244,18 +244,17 @@ class shadowAccount 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['shadowMin'][0] = $post['shadowMin'];
$this->attributes['shadowMax'][0] = $post['shadowMax'];
$this->attributes['shadowWarning'][0] = $post['shadowWarning'];
$this->attributes['shadowInactive'][0] = $post['shadowInactive'];
$this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($post['shadowExpire_mon']), intval($post['shadowExpire_day']),
intval($post['shadowExpire_yea']))/3600/24);
$this->attributes['shadowMin'][0] = $_POST['shadowMin'];
$this->attributes['shadowMax'][0] = $_POST['shadowMax'];
$this->attributes['shadowWarning'][0] = $_POST['shadowWarning'];
$this->attributes['shadowInactive'][0] = $_POST['shadowInactive'];
$this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($_POST['shadowExpire_mon']), intval($_POST['shadowExpire_day']),
intval($_POST['shadowExpire_yea']))/3600/24);
if ( !get_preg($this->attributes['shadowMin'][0], 'digit')) $errors['shadowMin'][] = $this->messages['shadowMin'][0];
if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $errors['shadowMax'][] = $this->messages['shadowMax'][0];
if ( $this->attributes['shadowMin'][0] > $this->attributes['shadowMax'][0]) $errors['shadowMin'][] = $this->messages['shadow_cmp'][0];
@ -267,10 +266,9 @@ class shadowAccount extends baseModule {
/**
* This function will create the meta HTML code to show a page with all attributes.
*
* @param array $post HTTP POST data
* @return array meta HTML code
*/
function display_html_attributes(&$post) {
function display_html_attributes() {
// Use dd-mm-yyyy format of date because it's easier to read for humans
$shAccExpirationDate = 0;
if (isset($this->attributes['shadowExpire'][0])) $shAccExpirationDate = $this->attributes['shadowExpire'][0];