aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-06-30 00:38:02 -0700
committerfriendica <info@friendica.com>2013-06-30 00:38:02 -0700
commit72f6edd59507797ef4073aed01ca1a0d14fa8cfd (patch)
treeadd1a2879d2a2ca7c7b62ece73517bbf225f2cb9
parent29502438f807275ab8ea8259ca261117e561c962 (diff)
downloadvolse-hubzilla-72f6edd59507797ef4073aed01ca1a0d14fa8cfd.tar.gz
volse-hubzilla-72f6edd59507797ef4073aed01ca1a0d14fa8cfd.tar.bz2
volse-hubzilla-72f6edd59507797ef4073aed01ca1a0d14fa8cfd.zip
add age to directory profile - requires updating on each birthday and that part is still missing
-rwxr-xr-xboot.php2
-rwxr-xr-xinclude/items.php1
-rw-r--r--include/poller.php3
-rw-r--r--include/zot.php1
-rw-r--r--install/database.sql2
-rw-r--r--install/update.php11
-rw-r--r--mod/zfinger.php3
-rw-r--r--version.inc2
8 files changed, 22 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index 7106fd18f..db61a79ae 100755
--- a/boot.php
+++ b/boot.php
@@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1047 );
+define ( 'DB_UPDATE_VERSION', 1048 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/include/items.php b/include/items.php
index 0f260c8d2..2169dfe37 100755
--- a/include/items.php
+++ b/include/items.php
@@ -860,6 +860,7 @@ function get_profile_elements($x) {
$arr['desc'] = (($x['title']) ? htmlentities($x['title'],ENT_COMPAT,'UTF-8',false) : '');
$arr['dob'] = datetime_convert('UTC','UTC',$x['birthday'],'Y-m-d');
+ $arr['age'] = (($x['age']) ? intval($x['age']) : 0);
$arr['gender'] = (($x['gender']) ? htmlentities($x['gender'], ENT_COMPAT,'UTF-8',false) : '');
$arr['marital'] = (($x['marital']) ? htmlentities($x['marital'], ENT_COMPAT,'UTF-8',false) : '');
diff --git a/include/poller.php b/include/poller.php
index dff16d3d7..f50bd4e3e 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -63,6 +63,9 @@ function poller_run($argv, $argc){
// once daily run birthday_updates and then expire in background
+ // FIXME: add birthday updates, both locally and for xprof for use
+ // by directory servers
+
$d1 = get_config('system','last_expire_day');
$d2 = intval(datetime_convert('UTC','UTC','now','d'));
diff --git a/include/zot.php b/include/zot.php
index 14a29005d..be0760a05 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1225,6 +1225,7 @@ function import_directory_profile($hash,$profile) {
$arr['xprof_hash'] = $hash;
$arr['xprof_desc'] = (($profile['description']) ? htmlentities($profile['description'], ENT_COMPAT,'UTF-8',false) : '');
$arr['xprof_dob'] = datetime_convert('','',$profile['birthday'],'Y-m-d'); // !!!! check this for 0000 year
+ $arr['xprof_age'] = (($profile['age']) ? intval($profile['age']) : 0);
$arr['xprof_gender'] = (($profile['gender']) ? htmlentities($profile['gender'], ENT_COMPAT,'UTF-8',false) : '');
$arr['xprof_marital'] = (($profile['marital']) ? htmlentities($profile['marital'], ENT_COMPAT,'UTF-8',false) : '');
$arr['xprof_sexual'] = (($profile['sexual']) ? htmlentities($profile['sexual'], ENT_COMPAT,'UTF-8',false) : '');
diff --git a/install/database.sql b/install/database.sql
index 30b8edfd7..5cb0146f7 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -941,6 +941,7 @@ CREATE TABLE IF NOT EXISTS `xprof` (
`xprof_hash` char(255) NOT NULL,
`xprof_desc` char(255) NOT NULL DEFAULT '',
`xprof_dob` char(12) NOT NULL DEFAULT '',
+ `xprof_age` tinyint(3) NOT NULL DEFAULT '0',
`xprof_gender` char(255) NOT NULL DEFAULT '',
`xprof_marital` char(255) NOT NULL DEFAULT '',
`xprof_sexual` char(255) NOT NULL DEFAULT '',
@@ -952,6 +953,7 @@ CREATE TABLE IF NOT EXISTS `xprof` (
PRIMARY KEY (`xprof_hash`),
KEY `xprof_desc` (`xprof_desc`),
KEY `xprof_dob` (`xprof_dob`),
+ KEY `xprof_age` (`xprof_age`),
KEY `xprof_gender` (`xprof_gender`),
KEY `xprof_marital` (`xprof_marital`),
KEY `xprof_sexual` (`xprof_sexual`),
diff --git a/install/update.php b/install/update.php
index ee95b7e01..ef436c688 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1047 );
+define( 'UPDATE_VERSION' , 1048 );
/**
*
@@ -572,3 +572,12 @@ ADD INDEX ( `term_hash` ) ");
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1047() {
+ $r = q("ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` ,
+ADD INDEX ( `xprof_age` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 460f157b6..d438940a1 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -91,6 +91,9 @@ function zfinger_init(&$a) {
$profile['birthday'] = $p[0]['dob'];
if($profile['birthday'] != '0000-00-00')
$profile['next_birthday'] = z_birthday($p[0]['dob'],$e['channel_timezone']);
+
+ if($age = age($p[0]['dob'],$e['channel_timezone'],''))
+ $profile['age'] = $age;
$profile['gender'] = $p[0]['gender'];
$profile['marital'] = $p[0]['marital'];
$profile['sexual'] = $p[0]['sexual'];
diff --git a/version.inc b/version.inc
index 0b0501191..a91ac0c4c 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-06-29.359
+2013-06-30.360