1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

fix edit profile

This commit is contained in:
Mzhelskiy Maxim 2017-01-27 15:24:34 +07:00
parent cbf1ebe391
commit 23f143822d
4 changed files with 14 additions and 10 deletions

View file

@ -547,11 +547,11 @@ class ActionSettings extends Action
$aGeo = getRequest('geo');
if (isset($aGeo['city']) && $aGeo['city']) {
$oGeoObject = $this->Geo_GetGeoObject('city', (int) $aGeo['city']);
$oGeoObject = $this->Geo_GetGeoObject('city', (int)$aGeo['city']);
} elseif (isset($aGeo['region']) && $aGeo['region']) {
$oGeoObject = $this->Geo_GetGeoObject('region', (int) $aGeo['region']);
$oGeoObject = $this->Geo_GetGeoObject('region', (int)$aGeo['region']);
} elseif (isset($aGeo['country']) && $aGeo['country']) {
$oGeoObject = $this->Geo_GetGeoObject('country', (int) $aGeo['country']);
$oGeoObject = $this->Geo_GetGeoObject('country', (int)$aGeo['country']);
} else {
$oGeoObject = null;
}
@ -574,10 +574,14 @@ class ActionSettings extends Action
/**
* Проверяем дату рождения
*/
if (preg_match('#^(\d{1,2})\.(\d{1,2})\.(\d{4})$#', getRequestStr('profile_birthday'), $aMatch)) {
$this->oUserCurrent->setProfileBirthday(date("Y-m-d H:i:s", mktime(0, 0, 0, $aMatch[2], $aMatch[1], $aMatch[3])));
} else {
$this->oUserCurrent->setProfileBirthday(null);
$this->oUserCurrent->setProfileBirthday(null);
if ($this->Validate_Validate('date', getRequestStr('profile_birthday'),
array('format' => 'dd.MM.yyyy', 'allowEmpty' => false))
) {
$iBirthdayTime = strtotime(getRequestStr('profile_birthday'));
if ($iBirthdayTime < time() and $iBirthdayTime > strtotime('-100 year')) {
$this->oUserCurrent->setProfileBirthday(date("Y-m-d H:i:s", $iBirthdayTime));
}
}
/**
* Проверяем информацию о себе

View file

@ -61,7 +61,7 @@
{component 'field' template='date'
name = 'profile_birthday'
inputClasses = 'js-field-date-default'
value = {date_format date=$user->getProfileBirthday() format='j.n.Y'}
value = ($user->getProfileBirthday()) ? {date_format date=$user->getProfileBirthday() format='d.m.Y'} : ''
label = {lang name='user.settings.profile.fields.birthday.label'}}

View file

@ -61,7 +61,7 @@
mods = 'horizontal'
name = 'profile_birthday'
inputClasses = 'js-field-date-default'
value = {date_format date=$user->getProfileBirthday() format='j.n.Y'}
value = ($user->getProfileBirthday()) ? {date_format date=$user->getProfileBirthday() format='d.m.Y'} : ''
label = {lang name='user.settings.profile.fields.birthday.label'}}

@ -1 +1 @@
Subproject commit 8c532cc61735381de711690fb685a2aa882b3989
Subproject commit 99805d40418c582e741a6f573c66a509c53eba25