aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-06-02 02:30:26 -0700
committerfriendica <info@friendica.com>2012-06-02 02:30:26 -0700
commit608d424b0b94eacd99ceeeca3e2caf112abd5b48 (patch)
treea2bb50fd0f913ce039f8b7ad2f1be8974d053472
parent29bdf432f012af9b1959d5b4a33b3c45d220fd64 (diff)
downloadvolse-hubzilla-608d424b0b94eacd99ceeeca3e2caf112abd5b48.tar.gz
volse-hubzilla-608d424b0b94eacd99ceeeca3e2caf112abd5b48.tar.bz2
volse-hubzilla-608d424b0b94eacd99ceeeca3e2caf112abd5b48.zip
"howlong" added to marital status.
-rw-r--r--boot.php2
-rw-r--r--database.sql1
-rw-r--r--include/datetime.php6
-rw-r--r--include/profile_advanced.php3
-rw-r--r--mod/profiles.php10
-rw-r--r--update.php11
-rw-r--r--view/profile_advanced.tpl2
-rw-r--r--view/profile_edit.tpl3
8 files changed, 33 insertions, 5 deletions
diff --git a/boot.php b/boot.php
index 2e83d371f..219e3c466 100644
--- a/boot.php
+++ b/boot.php
@@ -11,7 +11,7 @@ require_once('include/cache.php');
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' );
diff --git a/database.sql b/database.sql
index 48900839c..e32bca5ac 100644
--- a/database.sql
+++ b/database.sql
@@ -823,6 +823,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`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,
diff --git a/include/datetime.php b/include/datetime.php
index f4dcfce62..3b1491e4d 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -244,7 +244,7 @@ function timesel($pre,$h,$m) {
// 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);
@@ -274,7 +274,9 @@ function relative_date($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]));
}
}
}}
diff --git a/include/profile_advanced.php b/include/profile_advanced.php
index 8c2acd8e7..2326ae716 100644
--- a/include/profile_advanced.php
+++ b/include/profile_advanced.php
@@ -39,6 +39,9 @@ function advanced_profile(&$a) {
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'] );
diff --git a/mod/profiles.php b/mod/profiles.php
index ca3890eb9..e32fdb33d 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -62,9 +62,15 @@ function profiles_post(&$a) {
$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;
@@ -207,6 +213,7 @@ function profiles_post(&$a) {
`country-name` = '%s',
`marital` = '%s',
`with` = '%s',
+ `howlong` = '%s',
`sexual` = '%s',
`homepage` = '%s',
`politic` = '%s',
@@ -237,6 +244,7 @@ function profiles_post(&$a) {
dbesc($country_name),
dbesc($marital),
dbesc($with),
+ dbesc($howlong),
dbesc($sexual),
dbesc($homepage),
dbesc($politic),
@@ -558,6 +566,7 @@ function profiles_content(&$a) {
'$lbl_marital' => t('<span class="heart">&hearts;</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:'),
@@ -595,6 +604,7 @@ function profiles_content(&$a) {
'$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'],
diff --git a/update.php b/update.php
index f94b89fd3..3ac9d1721 100644
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1145 );
+define( 'UPDATE_VERSION' , 1146 );
/**
*
@@ -1259,3 +1259,12 @@ function update_1144() {
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 ;
+}
+
+
diff --git a/view/profile_advanced.tpl b/view/profile_advanced.tpl
index 470404fc3..30d41fe41 100644
--- a/view/profile_advanced.tpl
+++ b/view/profile_advanced.tpl
@@ -29,7 +29,7 @@
{{ if $profile.marital }}
<dl id="aprofile-marital" class="aprofile">
<dt><span class="heart">&hearts;</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 }}
diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl
index 2139fcf13..077fb0aaa 100644
--- a/view/profile_edit.tpl
+++ b/view/profile_edit.tpl
@@ -108,6 +108,9 @@ $marital
</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" >