removed getDate()

This commit is contained in:
Roland Gruber 2016-07-18 20:58:47 +02:00
parent be211bedea
commit b2fc9fe4c6
3 changed files with 30 additions and 33 deletions

View File

@ -519,11 +519,11 @@ class freeRadius extends baseModule {
$attr = 'radiusExpiration'; $attr = 'radiusExpiration';
$text = _('Expiration date'); $text = _('Expiration date');
$help = "radiusExpiration"; $help = "radiusExpiration";
$date = getdate(time() + 3600*24*365); $date = new DateTime('@' . (time() + 3600*24*365), new DateTimeZone('UTC'));
$year = $date['year']; $year = $date->format('Y');
$month = str_pad($date['mon'], 2, '0', STR_PAD_LEFT); $month = $date->format('m');
$month = freeRadius::$monthList[$month]; $month = freeRadius::$monthList[$month];
$day = $date['mday']; $day = $date->format('d');
$hour = '00'; $hour = '00';
$minute = '00'; $minute = '00';
if (isset($this->attributes[$attr][0]) && ($this->attributes[$attr][0] != '')) { if (isset($this->attributes[$attr][0]) && ($this->attributes[$attr][0] != '')) {

View File

@ -1134,8 +1134,8 @@ class sambaSamAccount extends baseModule implements passwordService {
$dateValue = "     ∞      "; $dateValue = "     ∞      ";
} }
else { else {
$date = getdate($this->attributes['sambaKickoffTime'][0]); $date = new DateTime('@' . $this->attributes['sambaKickoffTime'][0], new DateTimeZone('UTC'));
$dateValue = $date['mday'] . "." . $date['mon'] . "." . $date['year']; $dateValue = $date->format('d.m.Y');
} }
} }
$return->addElement(new htmlOutputText(_('Account expiration date'))); $return->addElement(new htmlOutputText(_('Account expiration date')));
@ -1390,24 +1390,21 @@ class sambaSamAccount extends baseModule implements passwordService {
*/ */
function display_html_time() { function display_html_time() {
$return = new htmlTable(); $return = new htmlTable();
// determine attribute $attr = 'sambaKickoffTime';
if (isset($_POST['form_subpage_sambaSamAccount_time_sambaKickoffTime'])) { $text = _('Account expiration date');
$attr = 'sambaKickoffTime'; $help = "expireDate";
$text = _('Account expiration date'); $time = time() + 3600*24*365;
$help = "expireDate";
}
$time = 0;
if (isset($this->attributes[$attr][0])) { if (isset($this->attributes[$attr][0])) {
$time = $this->attributes[$attr][0]; $time = $this->attributes[$attr][0];
} }
$date = getdate($time); $date = new DateTime('@' . $time, new DateTimeZone('UTC'));
for ( $i=1; $i<=31; $i++ ) $mday[] = $i; for ( $i=1; $i<=31; $i++ ) $mday[] = $i;
for ( $i=1; $i<=12; $i++ ) $mon[] = $i; for ( $i=1; $i<=12; $i++ ) $mon[] = $i;
for ( $i=2003; $i<=2050; $i++ ) $year[] = $i; for ( $i=2003; $i<=2050; $i++ ) $year[] = $i;
$return->addElement(new htmlOutputText($text)); $return->addElement(new htmlOutputText($text));
$return->addElement(new htmlSelect('expire_day', $mday, array($date['mday']))); $return->addElement(new htmlSelect('expire_day', $mday, array($date->format('j'))));
$return->addElement(new htmlSelect('expire_mon', $mon, array($date['mon']))); $return->addElement(new htmlSelect('expire_mon', $mon, array($date->format('n'))));
$return->addElement(new htmlSelect('expire_yea', $year, array($date['year']))); $return->addElement(new htmlSelect('expire_yea', $year, array($date->format('Y'))));
$return->addElement(new htmlHelpLink($help), true); $return->addElement(new htmlHelpLink($help), true);
if ($this->getAccountContainer()->getAccountModule('shadowAccount') != null) { if ($this->getAccountContainer()->getAccountModule('shadowAccount') != null) {
$return->addElement(new htmlTableExtendedInputCheckbox('syncShadow', false, _('Set also for Shadow')), true); $return->addElement(new htmlTableExtendedInputCheckbox('syncShadow', false, _('Set also for Shadow')), true);

View File

@ -346,8 +346,8 @@ class shadowAccount extends baseModule implements passwordService {
$expirationDate = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; $expirationDate = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
if (isset($this->attributes['shadowExpire'][0])) { if (isset($this->attributes['shadowExpire'][0])) {
$shAccExpirationDate = $this->attributes['shadowExpire'][0]; $shAccExpirationDate = $this->attributes['shadowExpire'][0];
$date = getdate($shAccExpirationDate*3600*24); $date = new DateTime('@' . $shAccExpirationDate*3600*24, new DateTimeZone('UTC'));
$expirationDate = $date['mday'] . "." . $date['mon'] . "." . $date['year']; $expirationDate = $date->format('d.m.Y');
} }
$return->addElement(new htmlOutputText(_('Account expiration date'))); $return->addElement(new htmlOutputText(_('Account expiration date')));
$expireTable = new htmlTable(); $expireTable = new htmlTable();
@ -359,8 +359,8 @@ class shadowAccount extends baseModule implements passwordService {
$pwdChangeDate = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; $pwdChangeDate = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
if (isset($this->attributes['shadowLastChange'][0])) { if (isset($this->attributes['shadowLastChange'][0])) {
$shPwdChangeDate = $this->attributes['shadowLastChange'][0]; $shPwdChangeDate = $this->attributes['shadowLastChange'][0];
$date = getdate($shPwdChangeDate*3600*24); $date = new DateTime('@' . $shPwdChangeDate*3600*24, new DateTimeZone('UTC'));
$pwdChangeDate = $date['mday'] . "." . $date['mon'] . "." . $date['year']; $pwdChangeDate = $date->format('d.m.Y');
} }
$return->addElement(new htmlOutputText(_('Last password change'))); $return->addElement(new htmlOutputText(_('Last password change')));
$pwdChangeTable = new htmlTable(); $pwdChangeTable = new htmlTable();
@ -451,19 +451,19 @@ class shadowAccount extends baseModule implements passwordService {
*/ */
function display_html_expire() { function display_html_expire() {
$return = new htmlTable(); $return = new htmlTable();
$shAccExpirationDate = 0; $shAccExpirationDate = time()/(3600*24) + 365;
if (isset($this->attributes['shadowExpire'][0])) { if (isset($this->attributes['shadowExpire'][0])) {
$shAccExpirationDate = $this->attributes['shadowExpire'][0]; $shAccExpirationDate = $this->attributes['shadowExpire'][0];
} }
$date = getdate($shAccExpirationDate*3600*24); $date = new DateTime('@' . $shAccExpirationDate*3600*24, new DateTimeZone('UTC'));
for ( $i=1; $i<=31; $i++ ) $mday[] = $i; for ( $i=1; $i<=31; $i++ ) $mday[] = $i;
for ( $i=1; $i<=12; $i++ ) $mon[] = $i; for ( $i=1; $i<=12; $i++ ) $mon[] = $i;
for ( $i=2003; $i<=2050; $i++ ) $year[] = $i; for ( $i=2003; $i<=2050; $i++ ) $year[] = $i;
$return->addElement(new htmlOutputText(_('Account expiration date'))); $return->addElement(new htmlOutputText(_('Account expiration date')));
$expTable = new htmlTable(); $expTable = new htmlTable();
$expTable->addElement(new htmlSelect('shadowExpire_day', $mday, array($date['mday']))); $expTable->addElement(new htmlSelect('shadowExpire_day', $mday, array($date->format('j'))));
$expTable->addElement(new htmlSelect('shadowExpire_mon', $mon, array($date['mon']))); $expTable->addElement(new htmlSelect('shadowExpire_mon', $mon, array($date->format('n'))));
$expTable->addElement(new htmlSelect('shadowExpire_yea', $year, array($date['year']))); $expTable->addElement(new htmlSelect('shadowExpire_yea', $year, array($date->format('Y'))));
$return->addElement($expTable); $return->addElement($expTable);
$return->addElement(new htmlHelpLink('shadowExpire'), true); $return->addElement(new htmlHelpLink('shadowExpire'), true);
if ($this->getAccountContainer()->getAccountModule('sambaSamAccount') != null) { if ($this->getAccountContainer()->getAccountModule('sambaSamAccount') != null) {
@ -519,19 +519,19 @@ class shadowAccount extends baseModule implements passwordService {
*/ */
function display_html_pwdChange() { function display_html_pwdChange() {
$return = new htmlTable(); $return = new htmlTable();
$shLastChange = 0; $shLastChange = time()/(3600*24);
if (isset($this->attributes['shadowLastChange'][0])) { if (isset($this->attributes['shadowLastChange'][0])) {
$shLastChange = $this->attributes['shadowLastChange'][0]; $shLastChange = $this->attributes['shadowLastChange'][0];
} }
$date = getdate($shLastChange*3600*24); $date = new DateTime('@' . $shLastChange*3600*24, new DateTimeZone('UTC'));
for ( $i=1; $i<=31; $i++ ) $mday[] = $i; for ( $i=1; $i<=31; $i++ ) $mday[] = $i;
for ( $i=1; $i<=12; $i++ ) $mon[] = $i; for ( $i=1; $i<=12; $i++ ) $mon[] = $i;
for ( $i=2003; $i<=2050; $i++ ) $year[] = $i; for ( $i=2003; $i<=2050; $i++ ) $year[] = $i;
$return->addElement(new htmlOutputText(_('Last password change'))); $return->addElement(new htmlOutputText(_('Last password change')));
$table = new htmlTable(); $table = new htmlTable();
$table->addElement(new htmlSelect('shadowLastChange_day', $mday, array($date['mday']))); $table->addElement(new htmlSelect('shadowLastChange_day', $mday, array($date->format('j'))));
$table->addElement(new htmlSelect('shadowLastChange_mon', $mon, array($date['mon']))); $table->addElement(new htmlSelect('shadowLastChange_mon', $mon, array($date->format('n'))));
$table->addElement(new htmlSelect('shadowLastChange_yea', $year, array($date['year']))); $table->addElement(new htmlSelect('shadowLastChange_yea', $year, array($date->format('Y'))));
$return->addElement($table); $return->addElement($table);
$return->addElement(new htmlHelpLink('shadowLastChange'), true); $return->addElement(new htmlHelpLink('shadowLastChange'), true);
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addElement(new htmlSpacer(null, '10px'), true);
@ -753,8 +753,8 @@ class shadowAccount extends baseModule implements passwordService {
if (in_array('shadowLastChange', $fields)) { if (in_array('shadowLastChange', $fields)) {
$shadowLastChange = ''; $shadowLastChange = '';
if (isset($attributes['shadowLastChange'][0])) { if (isset($attributes['shadowLastChange'][0])) {
$date = getdate($attributes['shadowLastChange'][0] * 3600 * 24); $date = new DateTime('@' . $attributes['shadowLastChange'][0] * 3600 * 24, new DateTimeZone('UTC'));
$shadowLastChange = $date['mday'] . "." . $date['mon'] . "." . $date['year']; $shadowLastChange = $date->format('d.m.Y');
} }
$row = new htmlResponsiveRow(); $row = new htmlResponsiveRow();
$row->addLabel(new htmlOutputText($this->getSelfServiceLabel('shadowLastChange', _('Last password change')))); $row->addLabel(new htmlOutputText($this->getSelfServiceLabel('shadowLastChange', _('Last password change'))));