define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1361' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1145 );
+define ( 'DB_UPDATE_VERSION', 1146 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
`gender` char(32) NOT NULL,
`marital` char(255) NOT NULL,
`with` text NOT NULL,
+ `howlong` datetime NOT NULL default '0000-00-00 00:00:00',
`sexual` char(255) NOT NULL,
`politic` char(255) NOT NULL,
`religion` char(255) NOT NULL,
// Limited to range of timestamps
if(! function_exists('relative_date')) {
-function relative_date($posted_date) {
+function relative_date($posted_date,$format = null) {
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
if ($d >= 1) {
$r = round($d);
// translators - e.g. 22 hours ago, 1 minute ago
- return sprintf( t('%1$d %2$s ago'),$r, (($r == 1) ? $str[0] : $str[1]));
+ if(! $format)
+ $format = t('%1$d %2$s ago');
+ return sprintf( $format,$r, (($r == 1) ? $str[0] : $str[1]));
}
}
}}
if($a->profile['with']) $profile['marital']['with'] = $a->profile['with'];
+ if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
+ $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
+ }
if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
$pub_keywords = notags(trim($_POST['pub_keywords']));
$prv_keywords = notags(trim($_POST['prv_keywords']));
$marital = notags(trim($_POST['marital']));
+ $howlong = notags(trim($_POST['howlong']));
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
+ if(! strlen($howlong))
+ $howlong = '0000-00-00 00:00:00';
+ else
+ $howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
+
// linkify the relationship target if applicable
$withchanged = false;
`country-name` = '%s',
`marital` = '%s',
`with` = '%s',
+ `howlong` = '%s',
`sexual` = '%s',
`homepage` = '%s',
`politic` = '%s',
dbesc($country_name),
dbesc($marital),
dbesc($with),
+ dbesc($howlong),
dbesc($sexual),
dbesc($homepage),
dbesc($politic),
'$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'),
'$lbl_with' => t("Who: \x28if applicable\x29"),
'$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'),
+ '$lbl_howlong' => t('Since [date]:'),
'$lbl_sexual' => t('Sexual Preference:'),
'$lbl_homepage' => t('Homepage URL:'),
'$lbl_politic' => t('Political Views:'),
'$gender' => gender_selector($r[0]['gender']),
'$marital' => marital_selector($r[0]['marital']),
'$with' => strip_tags($r[0]['with']),
+ '$howlong' => ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])),
'$sexual' => sexpref_selector($r[0]['sexual']),
'$about' => $r[0]['about'],
'$homepage' => $r[0]['homepage'],
<?php
-define( 'UPDATE_VERSION' , 1145 );
+define( 'UPDATE_VERSION' , 1146 );
/**
*
return UPDATE_FAILED ;
return UPDATE_SUCCESS ;
}
+
+function update_1145() {
+ $r = q("alter table profile add howlong datetime not null default '0000-00-00 00:00:00' after `with`");
+ if(! $r)
+ return UPDATE_FAILED ;
+ return UPDATE_SUCCESS ;
+}
+
+
{{ if $profile.marital }}
<dl id="aprofile-marital" class="aprofile">
<dt><span class="heart">♥</span> $profile.marital.0</dt>
- <dd>$profile.marital.1 {{ if $profile.marital.with }}($profile.marital.with){{ endif }}</dd>
+ <dd>$profile.marital.1{{ if $profile.marital.with }} ($profile.marital.with){{ endif }}{{ if $profile.howlong }} $profile.howlong{{ endif }}</dd>
</dl>
{{ endif }}
</div>
<label id="profile-edit-with-label" for="profile-edit-with" > $lbl_with </label>
<input type="text" size="32" name="with" id="profile-edit-with" title="$lbl_ex1" value="$with" />
+<label id="profile-edit-howlong-label" for="profile-edit-howlong" > $lbl_howlong </label>
+<input type="text" size="32" name="howlong" id="profile-edit-howlong" title="$lbl_howlong" value="$howlong" />
+
<div id="profile-edit-marital-end"></div>
<div id="profile-edit-sexual-wrapper" >