fixed logon hours (patch 1311915)
This commit is contained in:
parent
1e0c6be290
commit
4517a59f6d
|
@ -1,10 +1,11 @@
|
||||||
??? 0.5.1
|
19.10.2005 0.5.1
|
||||||
- Samba 3: added support for account expiration
|
- Samba 3: added support for account expiration
|
||||||
- fixed bugs:
|
- fixed bugs:
|
||||||
-> automatic UID/GID assignment did not fully work
|
-> automatic UID/GID assignment did not fully work
|
||||||
-> PDF: additional groups for Unix users
|
-> PDF: additional groups for Unix users
|
||||||
-> inetOrgPerson: fixed mobile number
|
-> inetOrgPerson: fixed mobile number
|
||||||
-> Samba 2/3: passwords fixed for file uploads (1311561)
|
-> Samba 2/3: passwords fixed for file uploads (1311561)
|
||||||
|
-> Samba 3: fixed logon hours (patch 1311915)
|
||||||
-> Quota: profile settings fixed
|
-> Quota: profile settings fixed
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -730,25 +730,17 @@ class sambaSamAccount extends baseModule {
|
||||||
if ($post['form_subpage_sambaSamAccount_attributes_abort']) return;
|
if ($post['form_subpage_sambaSamAccount_attributes_abort']) return;
|
||||||
// set new logon hours
|
// set new logon hours
|
||||||
$logonHours = '';
|
$logonHours = '';
|
||||||
for ($i = 0; $i < 7; $i++) {
|
for ($i = 0; $i < 24*7; $i++) {
|
||||||
for ($h = 0; $h < 24; $h++) {
|
$logonHours .= isset($post['lh_' . $i]) ? '1' : '0';
|
||||||
if ($post['lh_' . $i . '_' . $h] == 'on') {
|
|
||||||
$logonHours = $logonHours . '1';
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$logonHours = $logonHours . '0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// put sunday back at the beginning
|
|
||||||
$sunday = substr($logonHours, strlen($logonHours) - 24);
|
|
||||||
$logonHours = $sunday . substr($logonHours, 0, strlen($logonHours) - 24);
|
|
||||||
// reconstruct HEX string
|
// reconstruct HEX string
|
||||||
$bitstring2hex = array_flip($this->hex2bitstring);
|
$bitstring2hex = array_flip($this->hex2bitstring);
|
||||||
$logonHoursNew = '';
|
$logonHoursNew = '';
|
||||||
for ($i = 0; $i < 42; $i++) {
|
for ($i = 0; $i < 21; $i++) {
|
||||||
$part = substr($logonHours, $i * 4, 4);
|
$part = strrev(substr($logonHours, $i * 8, 8));
|
||||||
$hex = $bitstring2hex[$part];
|
$byte[hi] = substr($part,0,4);
|
||||||
|
$byte[low] = substr($part,4,4);
|
||||||
|
$hex = $bitstring2hex[$byte[hi]].$bitstring2hex[$byte[low]];
|
||||||
$logonHoursNew = $logonHoursNew . $hex;
|
$logonHoursNew = $logonHoursNew . $hex;
|
||||||
}
|
}
|
||||||
$this->attributes['sambaLogonHours'][0] = $logonHoursNew;
|
$this->attributes['sambaLogonHours'][0] = $logonHoursNew;
|
||||||
|
@ -958,8 +950,8 @@ class sambaSamAccount extends baseModule {
|
||||||
* @return array meta HTML code
|
* @return array meta HTML code
|
||||||
*/
|
*/
|
||||||
function display_html_logonHours(&$post) {
|
function display_html_logonHours(&$post) {
|
||||||
$days = array(0 => _('Monday'), 1 => _('Tuesday'), 2 => _('Wednesday'), 3 => _('Thursday'),
|
$days = array(1 => _('Monday'), 2 => _('Tuesday'), 3 => _('Wednesday'), 4 => _('Thursday'),
|
||||||
4 => _('Friday'), 5 => _('Saturday'), 6 => _('Sunday'));
|
5 => _('Friday'), 6 => _('Saturday'), 0 => _('Sunday'));
|
||||||
if (!$this->attributes['sambaLogonHours'][0]) {
|
if (!$this->attributes['sambaLogonHours'][0]) {
|
||||||
$this->attributes['sambaLogonHours'][0] = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
|
$this->attributes['sambaLogonHours'][0] = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
|
||||||
}
|
}
|
||||||
|
@ -969,13 +961,15 @@ class sambaSamAccount extends baseModule {
|
||||||
for ($i = 0; $i < strlen($logonHours); $i++) {
|
for ($i = 0; $i < strlen($logonHours); $i++) {
|
||||||
$temp[] = $this->hex2bitstring[$logonHours[$i]];
|
$temp[] = $this->hex2bitstring[$logonHours[$i]];
|
||||||
}
|
}
|
||||||
$logonHours = implode('', $temp);
|
$logonHoursRev = implode('', $temp);
|
||||||
// move sunday at the end
|
// reverse bits low to high (1 is 0:00 sunday, 2 is 1:00 sunday, etc)
|
||||||
$sunday = substr($logonHours, 0, 24);
|
$logonHours = "";
|
||||||
$logonHours = substr($logonHours, 24) . $sunday;
|
for ($i = 0; $i < 21; $i++) {
|
||||||
$week = array();
|
$logonHours .= strrev(substr($logonHoursRev, $i*8, 8));
|
||||||
for ($i = 0; $i < 7; $i++) {
|
}
|
||||||
$week[$i] = substr($logonHours, 24*$i, 24);
|
$hour = array();
|
||||||
|
for ($i = 0; $i < 24*7; $i++) {
|
||||||
|
$hour[$i] = substr($logonHours, $i, 1);
|
||||||
}
|
}
|
||||||
// get offset
|
// get offset
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
@ -988,22 +982,23 @@ class sambaSamAccount extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// display input
|
// display input
|
||||||
for ($i = 0; $i < 7; $i++) {
|
for ($i = 0; $i < 24*7; $i++) {
|
||||||
$return[0][1 + $i] = array('kind' => 'text', 'text' => '<b>' . $days[$i] . '</b>', 'td' => array('width' => "12.5%", 'align' => 'center'));
|
$hr = $i + $offset;
|
||||||
for ($h = 0; $h < 24; $h++) {
|
if ($hr < 0) {
|
||||||
$pos = $h;
|
$hr = $hr + 24*7;
|
||||||
$pos = $pos + $offset;
|
} elseif ($hr >= 24*7) {
|
||||||
if ($pos > 23) $pos = $pos - 24;
|
$hr = $hr - 24*7;
|
||||||
elseif ($pos < 0) $pos = 24 + $pos;
|
|
||||||
if ($week[$i][$h] == 1) {
|
|
||||||
$return[$pos + 1][1 + $i] = array('kind' => 'input', 'name' => 'lh_' . $i . '_' . $h,
|
|
||||||
'type' => 'checkbox', 'checked' => true, 'td' => array('align' => 'center'));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$return[$pos + 1][1 + $i] = array('kind' => 'input', 'name' => 'lh_' . $i . '_' . $h,
|
|
||||||
'type' => 'checkbox', 'checked' => false, 'td' => array('align' => 'center'));
|
|
||||||
}
|
}
|
||||||
|
if ($i % 7 == 0) {
|
||||||
|
$return[0][floor($i / 24)+1] = array('kind' => 'text',
|
||||||
|
'text' => '<b>' . $days[floor($i / 24)] . '</b>',
|
||||||
|
'td' => array('width' => "11%", 'align' => 'center'));
|
||||||
}
|
}
|
||||||
|
$return[$i % 24 + 1][floor($i/24) + 1] = array('kind' => 'input',
|
||||||
|
'name' => 'lh_' . $hr,
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'checked' => $hour[$hr] ? true : false,
|
||||||
|
'td' => array('align' => 'center'));
|
||||||
}
|
}
|
||||||
$return[0][0] = array('kind' => 'text', 'text' => '<b>' . _('Time') . '</b>', 'td' => array('width' => "12.5%"));
|
$return[0][0] = array('kind' => 'text', 'text' => '<b>' . _('Time') . '</b>', 'td' => array('width' => "12.5%"));
|
||||||
for ($h = 0; $h < 24; $h++) {
|
for ($h = 0; $h < 24; $h++) {
|
||||||
|
|
Loading…
Reference in New Issue