]> git.mxchange.org Git - friendica.git/commitdiff
"howlong" added to marital status.
authorfriendica <info@friendica.com>
Sat, 2 Jun 2012 09:30:26 +0000 (02:30 -0700)
committerfriendica <info@friendica.com>
Sat, 2 Jun 2012 09:30:26 +0000 (02:30 -0700)
boot.php
database.sql
include/datetime.php
include/profile_advanced.php
mod/profiles.php
update.php
view/profile_advanced.tpl
view/profile_edit.tpl

index 2e83d371f6dfd50ba25ec78097ae4a3dad4548ab..219e3c466adae567558b65e5b28cf4d8068fef4f 100644 (file)
--- 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' );
index 48900839c938a83335d2ca55b3d86df0c0ae9820..e32bca5ac65cfb84b94c6b20aacb129a8b382f92 100644 (file)
@@ -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,
index f4dcfce62e9fb90952a65c1158781ca7ed8a339a..3b1491e4d839429d5fb95390df171be39bc5ad54 100644 (file)
@@ -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]));
         }
     }
 }}
index 8c2acd8e7639441573689a1efc3076af36ed274f..2326ae7167c344e4609aa64c9b962153dfebb1ca 100644 (file)
@@ -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'] );
 
index ca3890eb9466e39aa7be7354e450fd0e38662b76..e32fdb33db59919b6190746374b4a157bc0743f3 100644 (file)
@@ -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'],
index f94b89fd31d08a3e6b55c38d2d1d5ec22eafd2a0..3ac9d17211afd9f59db02303b2def51c421a7aac 100644 (file)
@@ -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 ;
+}
+
+
index 470404fc339081347887ee5ff52d2d5bd1814f2e..30d41fe41a79a7cb2807ab52c083b66638813167 100644 (file)
@@ -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 }}
 
index 2139fcf13cb140321df62e457282dfad859e91f9..077fb0aaa73f7f3be61c53e3570b696c2dcde24d 100644 (file)
@@ -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" >