aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/api.php121
-rw-r--r--include/event.php123
-rw-r--r--include/group.php2
-rwxr-xr-xinclude/items.php2
-rw-r--r--include/photo/photo_driver.php3
-rw-r--r--include/photos.php12
-rw-r--r--include/text.php2
-rw-r--r--include/widgets.php21
-rw-r--r--include/zot.php15
9 files changed, 206 insertions, 95 deletions
diff --git a/include/api.php b/include/api.php
index e72344ff7..369992332 100644
--- a/include/api.php
+++ b/include/api.php
@@ -631,6 +631,27 @@ require_once('include/items.php');
}
api_register_func('api/red/photos','api_photos', true);
+ function api_photo_detail(&$a,$type) {
+ if (api_user()===false) return false;
+ if(! $_REQUEST['photo_id']) return false;
+ $scale = ((array_key_exists('scale',$_REQUEST)) ? intval($_REQUEST['scale']) : 0);
+ $r = q("select * from photo where uid = %d and resource_id = '%s' and scale = %d limit 1",
+ intval(local_channel()),
+ dbesc($_REQUEST['photo_id']),
+ intval($scale)
+ );
+ if($r) {
+ $data = dbunescbin($r[0]['data']);
+ if(array_key_exists('os_storage',$r[0]) && intval($r[0]['os_storage']))
+ $data = file_get_contents($data);
+ $r[0]['data'] = base64_encode($data);
+ json_return_and_die($r[0]);
+ }
+ killme();
+ }
+
+ api_register_func('api/red/photo', 'api_photo_detail', true);
+
function api_group_members(&$a,$type) {
if(api_user() === false)
@@ -686,7 +707,7 @@ require_once('include/items.php');
api_register_func('api/red/xchan','api_red_xchan',true);
- function api_statuses_mediap(&$a, $type) {
+ function api_statuses_mediap(&$a, $type) {
if (api_user() === false) {
logger('api_statuses_update: no user');
return false;
@@ -696,7 +717,7 @@ require_once('include/items.php');
$_REQUEST['type'] = 'wall';
$_REQUEST['profile_uid'] = api_user();
$_REQUEST['api_source'] = true;
-
+
$txt = requestdata('status');
require_once('library/HTMLPurifier.auto.php');
@@ -711,13 +732,13 @@ require_once('include/items.php');
}
$txt = html2bbcode($txt);
- $a->argv[1] = $user_info['screen_name'];
+ $a->argv[1] = $user_info['screen_name'];
$_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
$_FILES['userfile'] = $_FILES['media'];
require_once('mod/wall_attach.php');
$posted = wall_attach_post($a);
-
+
//now that we have the img url in bbcode we can add it to the status and insert the wall item.
$_REQUEST['body']=$txt."\n\n".$posted;
require_once('mod/item.php');
@@ -1178,7 +1199,7 @@ require_once('include/items.php');
and uid = " . $sys['channel_id'] . "
$sql_extra
AND id > %d group by mid
- order by received desc LIMIT %d OFFSET %d ",
+ order by received desc LIMIT %d OFFSET %d ",
intval($since_id),
intval($count),
intval($start)
@@ -1392,17 +1413,17 @@ require_once('include/items.php');
$diasp_url = str_replace('/channel/','/u/',$myurl);
if (get_config('system','use_fulltext_engine'))
- $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where (MATCH(`author-link`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(`tag`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode))) ",
- dbesc(protect_sprintf($myurl)),
- dbesc(protect_sprintf($myurl)),
- dbesc(protect_sprintf($diasp_url))
- );
- else
- $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ",
- dbesc(protect_sprintf('%' . $myurl)),
- dbesc(protect_sprintf('%' . $myurl . ']%')),
- dbesc(protect_sprintf('%' . $diasp_url . ']%'))
- );
+ $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where (MATCH(`author-link`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(`tag`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode))) ",
+ dbesc(protect_sprintf($myurl)),
+ dbesc(protect_sprintf($myurl)),
+ dbesc(protect_sprintf($diasp_url))
+ );
+ else
+ $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ",
+ dbesc(protect_sprintf('%' . $myurl)),
+ dbesc(protect_sprintf('%' . $myurl . ']%')),
+ dbesc(protect_sprintf('%' . $diasp_url . ']%'))
+ );
if ($max_id > 0)
$sql_extra .= ' AND `item`.`id` <= '.intval($max_id);
@@ -1496,10 +1517,10 @@ require_once('include/items.php');
// );
$arr = array(
- 'uid' => api_user(),
- 'since_id' => $since_id,
- 'start' => $start,
- 'records' => $count);
+ 'uid' => api_user(),
+ 'since_id' => $since_id,
+ 'start' => $start,
+ 'records' => $count);
if ($user_info['self']==1)
$arr['wall'] = 1;
@@ -1508,7 +1529,7 @@ require_once('include/items.php');
$r = items_fetch($arr,get_app()->get_channel(),get_observer_hash());
-
+
$ret = api_format_items($r,$user_info);
@@ -1526,32 +1547,32 @@ require_once('include/items.php');
- /**
- * Star/unstar an item
- * param: id : id of the item
- *
- * api v1 : https://web.archive.org/web/20131019055350/https://dev.twitter.com/docs/api/1/post/favorites/create/%3Aid
- */
- function api_favorites_create_destroy(&$a, $type){
+ /**
+ * Star/unstar an item
+ * param: id : id of the item
+ *
+ * api v1 : https://web.archive.org/web/20131019055350/https://dev.twitter.com/docs/api/1/post/favorites/create/%3Aid
+ */
+ function api_favorites_create_destroy(&$a, $type){
logger('favorites_create_destroy');
- if (api_user()===false)
+ if (api_user()===false)
return false;
- $action = str_replace(".".$type,"",argv(2));
- if (argc() > 3) {
- $itemid = intval(argv(3));
- } else {
- $itemid = intval($_REQUEST['id']);
- }
+ $action = str_replace(".".$type,"",argv(2));
+ if (argc() > 3) {
+ $itemid = intval(argv(3));
+ } else {
+ $itemid = intval($_REQUEST['id']);
+ }
$item = q("SELECT * FROM item WHERE id = %d AND uid = %d",
intval($itemid),
intval(api_user())
);
- if (! $item)
+ if (! $item)
return false;
switch($action){
@@ -1581,22 +1602,22 @@ require_once('include/items.php');
xchan_query($item,true);
- $user_info = api_get_user($a);
- $rets = api_format_items($item,$user_info);
- $ret = $rets[0];
+ $user_info = api_get_user($a);
+ $rets = api_format_items($item,$user_info);
+ $ret = $rets[0];
- $data = array('$status' => $ret);
- switch($type){
- case "atom":
- case "rss":
- $data = api_rss_extra($a, $data, $user_info);
- }
+ $data = array('$status' => $ret);
+ switch($type){
+ case "atom":
+ case "rss":
+ $data = api_rss_extra($a, $data, $user_info);
+ }
- return api_apply_template("status", $type, $data);
- }
+ return api_apply_template("status", $type, $data);
+ }
- api_register_func('api/favorites/create', 'api_favorites_create_destroy', true);
- api_register_func('api/favorites/destroy', 'api_favorites_create_destroy', true);
+ api_register_func('api/favorites/create', 'api_favorites_create_destroy', true);
+ api_register_func('api/favorites/destroy', 'api_favorites_create_destroy', true);
@@ -1607,7 +1628,7 @@ require_once('include/items.php');
$user_info = api_get_user($a);
// params
- $count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
+ $count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if($page < 0)
$page = 0;
diff --git a/include/event.php b/include/event.php
index 1ae0d06ef..c468420c0 100644
--- a/include/event.php
+++ b/include/event.php
@@ -63,9 +63,9 @@ function ical_wrapper($ev) {
return '';
$o .= "BEGIN:VCALENDAR";
- $o .= "\nVERSION:2.0";
- $o .= "\nMETHOD:PUBLISH";
- $o .= "\nPRODID:-//" . get_config('system','sitename') . "//" . PLATFORM_NAME . "//" . strtoupper(get_app()->language). "\n";
+ $o .= "\r\nVERSION:2.0";
+ $o .= "\r\nMETHOD:PUBLISH";
+ $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . PLATFORM_NAME . "//" . strtoupper(get_app()->language). "\r\n";
if(array_key_exists('start', $ev))
$o .= format_event_ical($ev);
else {
@@ -73,7 +73,7 @@ function ical_wrapper($ev) {
$o .= format_event_ical($e);
}
}
- $o .= "\nEND:VCALENDAR\n";
+ $o .= "\r\nEND:VCALENDAR\r\n";
return $o;
}
@@ -85,24 +85,26 @@ function format_event_ical($ev) {
$o = '';
- $o .= "\nBEGIN:VEVENT";
+ $o .= "\r\nBEGIN:VEVENT";
- $o .= "\nCREATED:" . datetime_convert('UTC','UTC', $ev['created'],'Ymd\\THis\\Z');
- $o .= "\nLAST-MODIFIED:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
- $o .= "\nDTSTAMP:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
+ $o .= "\r\nCREATED:" . datetime_convert('UTC','UTC', $ev['created'],'Ymd\\THis\\Z');
+ $o .= "\r\nLAST-MODIFIED:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
+ $o .= "\r\nDTSTAMP:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
if($ev['start'])
- $o .= "\nDTSTART:" . datetime_convert('UTC','UTC', $ev['start'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ $o .= "\r\nDTSTART:" . datetime_convert('UTC','UTC', $ev['start'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
if($ev['finish'] && ! $ev['nofinish'])
- $o .= "\nDTEND:" . datetime_convert('UTC','UTC', $ev['finish'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ $o .= "\r\nDTEND:" . datetime_convert('UTC','UTC', $ev['finish'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
if($ev['summary'])
- $o .= "\nSUMMARY:" . format_ical_text($ev['summary']);
+ $o .= "\r\nSUMMARY:" . format_ical_text($ev['summary']);
if($ev['location'])
- $o .= "\nLOCATION:" . format_ical_text($ev['location']);
+ $o .= "\r\nLOCATION:" . format_ical_text($ev['location']);
if($ev['description'])
- $o .= "\nDESCRIPTION:" . format_ical_text($ev['description']);
- $o .= "\nUID:" . $ev['event_hash'] ;
- $o .= "\nEND:VEVENT\n";
-
+ $o .= "\r\nDESCRIPTION:" . format_ical_text($ev['description']);
+ if($ev['event_priority'])
+ $o .= "\r\nPRIORITY:" . intval($ev['event_priority']);
+ $o .= "\r\nUID:" . $ev['event_hash'] ;
+ $o .= "\r\nEND:VEVENT\r\n";
+
return $o;
}
@@ -111,31 +113,33 @@ function format_todo_ical($ev) {
$o = '';
- $o .= "\nBEGIN:VTODO";
- $o .= "\nCREATED:" . datetime_convert('UTC','UTC', $ev['created'],'Ymd\\THis\\Z');
- $o .= "\nLAST-MODIFIED:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
- $o .= "\nDTSTAMP:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
+ $o .= "\r\nBEGIN:VTODO";
+ $o .= "\r\nCREATED:" . datetime_convert('UTC','UTC', $ev['created'],'Ymd\\THis\\Z');
+ $o .= "\r\nLAST-MODIFIED:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
+ $o .= "\r\nDTSTAMP:" . datetime_convert('UTC','UTC', $ev['edited'],'Ymd\\THis\\Z');
if($ev['start'])
- $o .= "\nDTSTART:" . datetime_convert('UTC','UTC', $ev['start'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ $o .= "\r\nDTSTART:" . datetime_convert('UTC','UTC', $ev['start'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
if($ev['finish'] && ! $ev['nofinish'])
- $o .= "\nDUE:" . datetime_convert('UTC','UTC', $ev['finish'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ $o .= "\r\nDUE:" . datetime_convert('UTC','UTC', $ev['finish'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
if($ev['summary'])
- $o .= "\nSUMMARY:" . format_ical_text($ev['summary']);
+ $o .= "\r\nSUMMARY:" . format_ical_text($ev['summary']);
if($ev['event_status']) {
- $o .= "\nSTATUS:" . $ev['event_status'];
+ $o .= "\r\nSTATUS:" . $ev['event_status'];
if($ev['event_status'] === 'COMPLETED')
- $o .= "\nCOMPLETED:" . datetime_convert('UTC','UTC', $ev['event_status_date'],'Ymd\\THis\\Z');
+ $o .= "\r\nCOMPLETED:" . datetime_convert('UTC','UTC', $ev['event_status_date'],'Ymd\\THis\\Z');
}
if(intval($ev['event_percent']))
- $o .= "\nPERCENT-COMPLETE:" . $ev['event_percent'];
+ $o .= "\r\nPERCENT-COMPLETE:" . $ev['event_percent'];
if(intval($ev['event_sequence']))
- $o .= "\nSEQUENCE:" . $ev['event_sequence'];
+ $o .= "\r\nSEQUENCE:" . $ev['event_sequence'];
if($ev['location'])
- $o .= "\nLOCATION:" . format_ical_text($ev['location']);
+ $o .= "\r\nLOCATION:" . format_ical_text($ev['location']);
if($ev['description'])
- $o .= "\nDESCRIPTION:" . format_ical_text($ev['description']);
- $o .= "\nUID:" . $ev['event_hash'] ;
- $o .= "\nEND:VTODO\n";
+ $o .= "\r\nDESCRIPTION:" . format_ical_text($ev['description']);
+ $o .= "\r\nUID:" . $ev['event_hash'] ;
+ if($ev['event_priority'])
+ $o .= "\r\nPRIORITY:" . intval($ev['event_priority']);
+ $o .= "\r\nEND:VTODO\r\n";
return $o;
}
@@ -146,7 +150,7 @@ function format_ical_text($s) {
require_once('include/bbcode.php');
require_once('include/html2plain.php');
- return(wordwrap(str_replace(',','\\,',html2plain(bbcode($s))),72,"\n ",true));
+ return(wordwrap(str_replace(array(',',';','\\'),array('\\,','\\;','\\\\'),html2plain(bbcode($s))),72,"\r\n ",true));
}
@@ -260,10 +264,11 @@ function ev_compare($a, $b) {
function event_store_event($arr) {
- $arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
- $arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
- $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
- $arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
+ $arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
+ $arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
+ $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
+ $arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
+ $arr['event_priority'] = (($arr['event_priority']) ? $arr['event_priority'] : 0);
if(array_key_exists('event_status_date',$arr))
@@ -317,6 +322,7 @@ function event_store_event($arr) {
`event_percent` = %d,
`event_repeat` = '%s',
`event_sequence` = %d,
+ `event_priority` = %d,
`allow_cid` = '%s',
`allow_gid` = '%s',
`deny_cid` = '%s',
@@ -337,6 +343,7 @@ function event_store_event($arr) {
intval($arr['event_percent']),
dbesc($arr['event_repeat']),
intval($arr['event_sequence']),
+ intval($arr['event_priority']),
dbesc($arr['allow_cid']),
dbesc($arr['allow_gid']),
dbesc($arr['deny_cid']),
@@ -355,8 +362,8 @@ function event_store_event($arr) {
$hash = random_string() . '@' . get_app()->get_hostname();
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
- adjust,nofinish, event_status, event_status_date, event_percent, event_repeat, event_sequence, allow_cid,allow_gid,deny_cid,deny_gid)
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, '%s', '%s', '%s', '%s' ) ",
+ adjust,nofinish, event_status, event_status_date, event_percent, event_repeat, event_sequence, event_priority, allow_cid,allow_gid,deny_cid,deny_gid)
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
intval($arr['uid']),
intval($arr['account']),
dbesc($arr['event_xchan']),
@@ -376,6 +383,7 @@ function event_store_event($arr) {
intval($arr['event_percent']),
dbesc($arr['event_repeat']),
intval($arr['event_sequence']),
+ intval($arr['event_priority']),
dbesc($arr['allow_cid']),
dbesc($arr['allow_gid']),
dbesc($arr['deny_cid']),
@@ -543,6 +551,8 @@ function event_import_ical($ical, $uid) {
$ev['description'] = (string) $ical->DESCRIPTION;
if(isset($ical->SUMMARY))
$ev['summary'] = (string) $ical->SUMMARY;
+ if(isset($ical->PRIORITY))
+ $ev['event_priority'] = intval((string) $ical->PRIORITY);
if(isset($ical->UID)) {
$evuid = (string) $ical->UID;
@@ -641,6 +651,8 @@ function event_import_ical_task($ical, $uid) {
$ev['description'] = (string) $ical->DESCRIPTION;
if(isset($ical->SUMMARY))
$ev['summary'] = (string) $ical->SUMMARY;
+ if(isset($ical->PRIORITY))
+ $ev['event_priority'] = intval((string) $ical->PRIORITY);
$stored_event = null;
@@ -850,6 +862,17 @@ function event_store_item($arr, $event) {
$item_arr['item_origin'] = $item_origin;
$item_arr['item_thread_top'] = $item_thread_top;;
+ $attach = array(array(
+ 'href' => z_root() . '/events/ical/' . urlencode($event['event_hash']),
+ 'length' => 0,
+ 'type' => 'text/calendar',
+ 'title' => t('event') . '-' . $event['event_hash'],
+ 'revision' => ''
+ ));
+
+ $item_arr['attach'] = $attach;
+
+
if(array_key_exists('term', $arr))
$item_arr['term'] = $arr['term'];
@@ -907,3 +930,27 @@ function todo_stat() {
'CANCELLED' => t('Cancelled')
);
}
+
+
+function tasks_fetch($arr) {
+
+ if(! local_channel())
+ return;
+
+ $ret = array();
+ $sql_extra = " and event_status != 'COMPLETED' ";
+ if($arr && $arr['all'] == 1)
+ $sql_extra = '';
+
+ $r = q("select * from event where type = 'task' and uid = %d $sql_extra order by created desc",
+ intval(local_channel())
+ );
+
+ $ret['success'] = (($r) ? true : false);
+ if($r) {
+ $ret['tasks'] = $r;
+ }
+
+ return $ret;
+
+} \ No newline at end of file
diff --git a/include/group.php b/include/group.php
index 81e9b98f2..0875b10f9 100644
--- a/include/group.php
+++ b/include/group.php
@@ -229,7 +229,7 @@ function mini_group_select($uid,$group = '') {
logger('mini_group_select: ' . print_r($grps,true), LOGGER_DATA);
$o = replace_macros(get_markup_template('group_selection.tpl'), array(
- '$label' => t('Default privacy group for new contacts'),
+ '$label' => t('Add new connections to this collection (privacy group)'),
'$groups' => $grps
));
return $o;
diff --git a/include/items.php b/include/items.php
index d8c551cea..0079e0e55 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3492,7 +3492,7 @@ function mail_store($arr) {
$arr['to_xchan'] = ((x($arr,'to_xchan')) ? notags(trim($arr['to_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
$arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : NULL_DATE);
- $arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
+ $arr['title'] = ((x($arr,'title')) ? trim($arr['title']) : '');
$arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : '');
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 426eb6aac..553e77ed1 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -238,10 +238,12 @@ abstract class photo_driver {
if(! $this->is_valid())
return FALSE;
+
if((! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg'))
return;
$exif = @exif_read_data($filename,null,true);
+
if($exif) {
$ort = $exif['IFD0']['Orientation'];
@@ -281,7 +283,6 @@ abstract class photo_driver {
break;
}
- // logger('exif: ' . print_r($exif,true));
return $exif;
}
diff --git a/include/photos.php b/include/photos.php
index 7437d6aa9..cb7fabc98 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -166,7 +166,7 @@ function photo_upload($channel, $observer, $args) {
return $ret;
}
- $exif = $ph->orient($src);
+ $exif = $ph->orient(($args['os_path']) ? $args['os_path'] : $src);
@unlink($src);
@@ -579,6 +579,16 @@ function getGps($exifCoord, $hemi) {
return floatval($flip * ($degrees + ($minutes / 60) + ($seconds / 3600)));
}
+function getGpstimestamp($exifCoord) {
+
+ $hours = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
+ $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0;
+ $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0;
+
+ return sprintf('%02d:%02d:%02d',$hours,$minutes,$seconds);
+}
+
+
function gps2Num($coordPart) {
$parts = explode('/', $coordPart);
diff --git a/include/text.php b/include/text.php
index cc084f6f1..f27a9ce68 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1305,7 +1305,7 @@ function theme_attachments(&$item) {
$title = htmlspecialchars($r['title'], ENT_COMPAT,'UTF-8');
if(! $title)
$title = t('unknown.???');
- $title .= ' ' . $r['length'] . ' ' . t('bytes');
+ $title .= ' ' . (($r['length']) ? $r['length'] . ' ' . t('bytes') : '');
require_once('include/identity.php');
if(is_foreigner($item['author_xchan']))
diff --git a/include/widgets.php b/include/widgets.php
index e735f5b2f..5e70730a3 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1042,3 +1042,24 @@ function widget_forums($arr) {
}
+
+function widget_tasklist($arr) {
+
+
+ require_once('include/event.php');
+ $o .= '<script>var tasksShowAll = 0; $(document).ready(function() { tasksFetch(); $("#tasklist-new-form").submit(function(event) { event.preventDefault(); $.post( "tasks/new", $("#tasklist-new-form").serialize(), function(data) { tasksFetch(); $("#tasklist-new-summary").val(""); } ); return false; } )});</script>';
+ $o .= '<script>function taskComplete(id) { $.post("tasks/complete/"+id, function(data) { tasksFetch();}); }
+ function tasksFetch() {
+ $.get("tasks/fetch" + ((tasksShowAll) ? "/all" : ""), function(data) {
+ $(".tasklist-tasks").html(data.html);
+ });
+ }
+ </script>';
+
+ $o .= '<div class="widget">' . '<h3>' . t('Tasks') . '</h3><div class="tasklist-tasks">';
+ $o .= '</div><form id="tasklist-new-form" action="" ><input id="tasklist-new-summary" type="text" name="summary" value="" /></form>';
+ $o .= '</div>';
+ return $o;
+
+}
+
diff --git a/include/zot.php b/include/zot.php
index bae20b4f0..17330838b 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1688,7 +1688,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
}
else {
- update_imported_item($sender,$arr,$channel['channel_id']);
+ update_imported_item($sender,$arr,$r[0],$channel['channel_id']);
$result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
if(! $relay)
add_source_route($item_id,$sender['hash']);
@@ -1825,9 +1825,20 @@ function remove_community_tag($sender, $arr, $uid) {
* @param array $item
* @param int $uid (unused)
*/
-function update_imported_item($sender, $item, $uid) {
+function update_imported_item($sender, $item, $orig, $uid) {
+
$x = item_store_update($item);
+
+ // If we're updating an event that we've saved locally, we store the item info first
+ // because event_addtocal will parse the body to get the 'new' event details
+
+ if($orig['resource_type'] === 'event') {
+ $res = event_addtocal($orig['id'],$uid);
+ if(! $res)
+ logger('update event: failed');
+ }
+
if(! $x['item_id'])
logger('update_imported_item: failed: ' . $x['message']);
else