aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Cron_daily.php2
-rw-r--r--Zotlabs/Lib/Enotify.php16
-rw-r--r--Zotlabs/Module/Attach.php4
-rw-r--r--Zotlabs/Module/Cal.php20
-rw-r--r--Zotlabs/Module/Connedit.php2
-rw-r--r--Zotlabs/Module/Cover_photo.php44
-rw-r--r--Zotlabs/Module/Events.php42
-rw-r--r--Zotlabs/Module/Fbrowser.php4
-rw-r--r--Zotlabs/Module/Like.php2
-rw-r--r--Zotlabs/Module/Notifications.php6
-rw-r--r--Zotlabs/Module/Notify.php4
-rw-r--r--Zotlabs/Module/Oep.php16
-rw-r--r--Zotlabs/Module/Photo.php18
-rw-r--r--Zotlabs/Module/Photos.php73
-rw-r--r--Zotlabs/Module/Ping.php38
-rw-r--r--Zotlabs/Module/Poke.php2
-rw-r--r--Zotlabs/Module/Profile_photo.php44
-rw-r--r--Zotlabs/Module/Share.php2
-rw-r--r--Zotlabs/Module/Sharedwithme.php4
-rw-r--r--Zotlabs/Module/Subthread.php2
-rw-r--r--Zotlabs/Module/Tagger.php2
-rw-r--r--Zotlabs/Module/Tasks.php20
-rw-r--r--Zotlabs/Module/Thing.php2
-rw-r--r--Zotlabs/Storage/Directory.php2
-rw-r--r--Zotlabs/Storage/File.php14
-rwxr-xr-xboot.php4
-rw-r--r--include/api.php24
-rw-r--r--include/attach.php26
-rw-r--r--include/channel.php174
-rw-r--r--include/conversation.php16
-rw-r--r--include/event.php169
-rw-r--r--include/feedutils.php12
-rw-r--r--include/import.php26
-rwxr-xr-xinclude/items.php34
-rw-r--r--include/photo/photo_driver.php50
-rw-r--r--include/photos.php28
-rw-r--r--include/sharedwithme.php4
-rw-r--r--include/text.php33
-rw-r--r--include/widgets.php12
-rw-r--r--install/schema_mysql.sql44
-rw-r--r--install/schema_postgres.sql46
-rw-r--r--install/update.php70
42 files changed, 541 insertions, 616 deletions
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php
index fbc255d2f..a16d49853 100644
--- a/Zotlabs/Daemon/Cron_daily.php
+++ b/Zotlabs/Daemon/Cron_daily.php
@@ -34,7 +34,7 @@ class Cron_daily {
// expire any read notifications over a month old
- q("delete from notify where seen = 1 and date < %s - INTERVAL %s",
+ q("delete from notify where seen = 1 and created < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('30 DAY')
);
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index ccb538ef5..56c717468 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -348,7 +348,7 @@ class Enotify {
$hash = random_string();
$r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash));
- if (count($r))
+ if ($r)
$dups = true;
} while ($dups === true);
@@ -356,16 +356,16 @@ class Enotify {
$datarray = array();
$datarray['hash'] = $hash;
$datarray['sender_hash'] = $sender['xchan_hash'];
- $datarray['name'] = $sender['xchan_name'];
+ $datarray['xname'] = $sender['xchan_name'];
$datarray['url'] = $sender['xchan_url'];
$datarray['photo'] = $sender['xchan_photo_s'];
- $datarray['date'] = datetime_convert();
+ $datarray['created'] = datetime_convert();
$datarray['aid'] = $recip['channel_account_id'];
$datarray['uid'] = $recip['channel_id'];
$datarray['link'] = $itemlink;
$datarray['parent'] = $parent_mid;
$datarray['parent_item'] = $parent_item;
- $datarray['type'] = $params['type'];
+ $datarray['ntype'] = $params['type'];
$datarray['verb'] = $params['verb'];
$datarray['otype'] = $params['otype'];
$datarray['abort'] = false;
@@ -394,19 +394,19 @@ class Enotify {
}
}
- $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,seen,type,verb,otype)
+ $r = q("insert into notify (hash,xname,url,photo,created,aid,uid,link,parent,seen,ntype,verb,otype)
values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')",
dbesc($datarray['hash']),
- dbesc($datarray['name']),
+ dbesc($datarray['xname']),
dbesc($datarray['url']),
dbesc($datarray['photo']),
- dbesc($datarray['date']),
+ dbesc($datarray['created']),
intval($datarray['aid']),
intval($datarray['uid']),
dbesc($datarray['link']),
dbesc($datarray['parent']),
intval($seen),
- intval($datarray['type']),
+ intval($datarray['ntype']),
dbesc($datarray['verb']),
dbesc($datarray['otype'])
);
diff --git a/Zotlabs/Module/Attach.php b/Zotlabs/Module/Attach.php
index 8948b66d7..de941d52c 100644
--- a/Zotlabs/Module/Attach.php
+++ b/Zotlabs/Module/Attach.php
@@ -40,7 +40,7 @@ class Attach extends \Zotlabs\Web\Controller {
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
if(intval($r['data']['os_storage'])) {
- $fname = dbunescbin($r['data']['data']);
+ $fname = dbunescbin($r['data']['content']);
if(strpos($fname,'store') !== false)
$istream = fopen($fname,'rb');
else
@@ -53,7 +53,7 @@ class Attach extends \Zotlabs\Web\Controller {
}
}
else
- echo dbunescbin($r['data']['data']);
+ echo dbunescbin($r['data']['content']);
killme();
}
diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php
index a1adb30e5..1da42684d 100644
--- a/Zotlabs/Module/Cal.php
+++ b/Zotlabs/Module/Cal.php
@@ -91,7 +91,7 @@ class Cal extends \Zotlabs\Web\Controller {
$mode = 'view';
$y = 0;
$m = 0;
- $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
+ $ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : '');
// logger('args: ' . print_r(\App::$argv,true));
@@ -146,7 +146,7 @@ class Cal extends \Zotlabs\Web\Controller {
$ftext = datetime_convert('UTC',$tz,$fdt);
$ftext = substr($ftext,0,14) . "00:00";
- $type = ((x($orig_event)) ? $orig_event['type'] : 'event');
+ $type = ((x($orig_event)) ? $orig_event['etype'] : 'event');
$f = get_config('system','event_input_format');
if(! $f)
@@ -157,7 +157,7 @@ class Cal extends \Zotlabs\Web\Controller {
$show_bd = perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_contacts');
if(! $show_bd) {
- $sql_extra .= " and event.type != 'birthday' ";
+ $sql_extra .= " and event.etype != 'birthday' ";
}
@@ -225,8 +225,8 @@ class Cal extends \Zotlabs\Web\Controller {
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
from event left join item on event_hash = resource_id
where resource_type = 'event' and event.uid = %d $ignored
- AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )
- OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) $sql_extra ",
+ AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )
+ OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) $sql_extra ",
intval($channel['channel_id']),
dbesc($start),
dbesc($finish),
@@ -247,7 +247,7 @@ class Cal extends \Zotlabs\Web\Controller {
if($r) {
foreach($r as $rr) {
- $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
+ $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
if(! x($links,$j))
$links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j;
}
@@ -262,15 +262,15 @@ class Cal extends \Zotlabs\Web\Controller {
foreach($r as $rr) {
- $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
- $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt));
+ $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
+ $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt));
$d = day_translate($d);
- $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c'));
+ $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c'));
if ($rr['nofinish']){
$end = null;
} else {
- $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c'));
+ $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c'));
}
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index c5c38b96a..33deac4c8 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -270,7 +270,7 @@ class Connedit extends \Zotlabs\Web\Controller {
array('rel' => 'photo', 'type' => \App::$poi['xchan_photo_mimetype'], 'href' => \App::$poi['xchan_photo_l'])
),
);
- $xarr['object'] = json_encode($obj);
+ $xarr['obj'] = json_encode($obj);
$xarr['obj_type'] = ACTIVITY_OBJ_PERSON;
$xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . \App::$poi['xchan_url'] . ']' . \App::$poi['xchan_name'] . '[/zrl]';
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index 371713c8d..a72c3389f 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -80,7 +80,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$profile = $r[0];
}
- $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND scale = 0 LIMIT 1",
+ $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = 0 LIMIT 1",
dbesc($image_id),
intval(local_channel())
);
@@ -88,9 +88,9 @@ class Cover_photo extends \Zotlabs\Web\Controller {
if($r) {
$base_image = $r[0];
- $base_image['data'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['data']) : dbunescbin($base_image['data']));
+ $base_image['content'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['content']) : dbunescbin($base_image['content']));
- $im = photo_factory($base_image['data'], $base_image['type']);
+ $im = photo_factory($base_image['content'], $base_image['mimetype']);
if($im->is_valid()) {
// We are scaling and cropping the relative pixel locations to the original photo instead of the
@@ -99,7 +99,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
// First load the scaled photo to check its size. (Should probably pass this in the post form and save
// a query.)
- $g = q("select width, height from photo where resource_id = '%s' and uid = %d and scale = 3",
+ $g = q("select width, height from photo where resource_id = '%s' and uid = %d and imgscale = 3",
dbesc($image_id),
intval(local_channel())
);
@@ -133,26 +133,26 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'],
'filename' => $base_image['filename'], 'album' => t('Cover Photos'));
- $p['scale'] = 7;
+ $p['imgscale'] = 7;
$p['photo_usage'] = PHOTO_COVER;
$r1 = $im->save($p);
$im->doScaleImage(850,310);
- $p['scale'] = 8;
+ $p['imgscale'] = 8;
$r2 = $im->save($p);
$im->doScaleImage(425,160);
- $p['scale'] = 9;
+ $p['imgscale'] = 9;
$r3 = $im->save($p);
if($r1 === false || $r2 === false || $r3 === false) {
// if one failed, delete them all so we can start over.
notice( t('Image resize failed.') . EOL );
- $x = q("delete from photo where resource_id = '%s' and uid = %d and scale >= 7 ",
+ $x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale >= 7 ",
dbesc($base_image['resource_id']),
local_channel()
);
@@ -183,7 +183,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
logger('attach_store: ' . print_r($res,true));
if($res && intval($res['data']['is_photo'])) {
- $i = q("select * from photo where resource_id = '%s' and uid = %d and scale = 0",
+ $i = q("select * from photo where resource_id = '%s' and uid = %d and imgscale = 0",
dbesc($hash),
intval(local_channel())
);
@@ -195,10 +195,10 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$os_storage = false;
foreach($i as $ii) {
- $smallest = intval($ii['scale']);
+ $smallest = intval($ii['imgscale']);
$os_storage = intval($ii['os_storage']);
- $imagedata = $ii['data'];
- $filetype = $ii['type'];
+ $imagedata = $ii['content'];
+ $filetype = $ii['mimetype'];
}
}
@@ -224,10 +224,10 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$arr['obj_type'] = ACTIVITY_OBJ_PHOTO;
$arr['verb'] = ACTIVITY_UPDATE;
- $arr['object'] = json_encode(array(
+ $arr['obj'] = json_encode(array(
'type' => $arr['obj_type'],
'id' => z_root() . '/photo/' . $photo['resource_id'] . '-7',
- 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7')
+ 'link' => array('rel' => 'photo', 'type' => $photo['mimetype'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7')
));
if($profile && stripos($profile['gender'],t('female')) !== false)
@@ -295,7 +295,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$resource_id = argv(2);
- $r = q("SELECT id, album, scale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY scale ASC",
+ $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
intval(local_channel()),
dbesc($resource_id)
);
@@ -305,11 +305,11 @@ class Cover_photo extends \Zotlabs\Web\Controller {
}
$havescale = false;
foreach($r as $rr) {
- if($rr['scale'] == 7)
+ if($rr['imgscale'] == 7)
$havescale = true;
}
- $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
+ $r = q("SELECT `content`, `mimetype`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
intval($r[0]['id']),
intval(local_channel())
@@ -320,15 +320,15 @@ class Cover_photo extends \Zotlabs\Web\Controller {
}
if(intval($r[0]['os_storage']))
- $data = @file_get_contents($r[0]['data']);
+ $data = @file_get_contents($r[0]['content']);
else
- $data = dbunescbin($r[0]['data']);
+ $data = dbunescbin($r[0]['content']);
- $ph = photo_factory($data, $r[0]['type']);
+ $ph = photo_factory($data, $r[0]['mimetype']);
$smallest = 0;
if($ph->is_valid()) {
// go ahead as if we have just uploaded a new photo to crop
- $i = q("select resource_id, scale from photo where resource_id = '%s' and uid = %d and scale = 0",
+ $i = q("select resource_id, imgscale from photo where resource_id = '%s' and uid = %d and imgscale = 0",
dbesc($r[0]['resource_id']),
intval(local_channel())
);
@@ -336,7 +336,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
if($i) {
$hash = $i[0]['resource_id'];
foreach($i as $ii) {
- $smallest = intval($ii['scale']);
+ $smallest = intval($ii['imgscale']);
}
}
}
diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php
index 3996473b7..3f3f9fb4c 100644
--- a/Zotlabs/Module/Events.php
+++ b/Zotlabs/Module/Events.php
@@ -180,12 +180,12 @@ class Events extends \Zotlabs\Web\Controller {
}
$datarray = array();
- $datarray['start'] = $start;
- $datarray['finish'] = $finish;
+ $datarray['dtstart'] = $start;
+ $datarray['dtend'] = $finish;
$datarray['summary'] = $summary;
$datarray['description'] = $desc;
$datarray['location'] = $location;
- $datarray['type'] = $type;
+ $datarray['etype'] = $type;
$datarray['adjust'] = $adjust;
$datarray['nofinish'] = $nofinish;
$datarray['uid'] = local_channel();
@@ -269,14 +269,14 @@ class Events extends \Zotlabs\Web\Controller {
nav_set_selected('all_events');
if((argc() > 2) && (argv(1) === 'ignore') && intval(argv(2))) {
- $r = q("update event set ignore = 1 where id = %d and uid = %d",
+ $r = q("update event set dismissed = 1 where id = %d and uid = %d",
intval(argv(2)),
intval(local_channel())
);
}
if((argc() > 2) && (argv(1) === 'unignore') && intval(argv(2))) {
- $r = q("update event set ignore = 0 where id = %d and uid = %d",
+ $r = q("update event set dismissed = 0 where id = %d and uid = %d",
intval(argv(2)),
intval(local_channel())
);
@@ -301,7 +301,7 @@ class Events extends \Zotlabs\Web\Controller {
$mode = 'view';
$y = 0;
$m = 0;
- $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
+ $ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : '');
// logger('args: ' . print_r(\App::$argv,true));
@@ -358,9 +358,9 @@ class Events extends \Zotlabs\Web\Controller {
if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
- if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
- if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
- if(x($_REQUEST,'type')) $orig_event['type'] = $_REQUEST['type'];
+ if(x($_REQUEST,'start')) $orig_event['dtstart'] = $_REQUEST['start'];
+ if(x($_REQUEST,'finish')) $orig_event['dtend'] = $_REQUEST['finish'];
+ if(x($_REQUEST,'type')) $orig_event['etype'] = $_REQUEST['type'];
*/
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
@@ -380,9 +380,9 @@ class Events extends \Zotlabs\Web\Controller {
if($orig_event['event_xchan'])
$sh_checked .= ' disabled="disabled" ';
- $sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
+ $sdt = ((x($orig_event)) ? $orig_event['dtstart'] : 'now');
- $fdt = ((x($orig_event)) ? $orig_event['finish'] : '+1 hour');
+ $fdt = ((x($orig_event)) ? $orig_event['dtend'] : '+1 hour');
$tz = date_default_timezone_get();
if(x($orig_event))
@@ -406,7 +406,7 @@ class Events extends \Zotlabs\Web\Controller {
$ftext = datetime_convert('UTC',$tz,$fdt);
$ftext = substr($ftext,0,14) . "00:00";
- $type = ((x($orig_event)) ? $orig_event['type'] : 'event');
+ $type = ((x($orig_event)) ? $orig_event['etype'] : 'event');
$f = get_config('system','event_input_format');
if(! $f)
@@ -536,8 +536,8 @@ class Events extends \Zotlabs\Web\Controller {
);
} elseif($export) {
$r = q("SELECT * from event where uid = %d
- AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )
- OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ",
+ AND (( `adjust` = 0 AND ( `dtend` >= '%s' or nofinish = 1 ) AND `dtstart` <= '%s' )
+ OR ( `adjust` = 1 AND ( `dtend` >= '%s' or nofinish = 1 ) AND `dtstart` <= '%s' )) ",
intval(local_channel()),
dbesc($start),
dbesc($finish),
@@ -554,8 +554,8 @@ class Events extends \Zotlabs\Web\Controller {
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
from event left join item on event_hash = resource_id
where resource_type = 'event' and event.uid = %d $ignored
- AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )
- OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) ",
+ AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )
+ OR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) ",
intval(local_channel()),
dbesc($start),
dbesc($finish),
@@ -576,7 +576,7 @@ class Events extends \Zotlabs\Web\Controller {
if($r) {
foreach($r as $rr) {
- $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
+ $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
if(! x($links,$j))
$links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j;
}
@@ -591,15 +591,15 @@ class Events extends \Zotlabs\Web\Controller {
foreach($r as $rr) {
- $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
- $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt));
+ $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
+ $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt));
$d = day_translate($d);
- $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c'));
+ $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c'));
if ($rr['nofinish']){
$end = null;
} else {
- $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c'));
+ $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtend'], 'c') : datetime_convert('UTC','UTC',$rr['dtend'],'c'));
}
diff --git a/Zotlabs/Module/Fbrowser.php b/Zotlabs/Module/Fbrowser.php
index eef3cb67d..c534e8f72 100644
--- a/Zotlabs/Module/Fbrowser.php
+++ b/Zotlabs/Module/Fbrowser.php
@@ -45,10 +45,10 @@ class Fbrowser extends \Zotlabs\Web\Controller {
$album = hex2bin(\App::$argv[2]);
$sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
$sql_extra2 = "";
- $path[]=array(z_root()."/fbrowser/image/".\App::$argv[2]."/", $album);
+ $path[]=array(z_root() . "/fbrowser/image/" . \App::$argv[2] . "/", $album);
}
- $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description`
+ $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`imgscale`) AS `hiq`,max(`imgscale`) AS `loq`, `description`
FROM `photo` WHERE `uid` = %d $sql_extra
GROUP BY `resource_id` $sql_extra2",
intval(local_channel())
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 3ef67ddcc..1ca37d646 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -483,7 +483,7 @@ class Like extends \Zotlabs\Web\Controller {
$arr['verb'] = $activity;
$arr['obj_type'] = $objtype;
- $arr['object'] = $object;
+ $arr['obj'] = $object;
if($target) {
$arr['tgt_type'] = $tgttype;
diff --git a/Zotlabs/Module/Notifications.php b/Zotlabs/Module/Notifications.php
index d51d2861c..9da28a360 100644
--- a/Zotlabs/Module/Notifications.php
+++ b/Zotlabs/Module/Notifications.php
@@ -80,18 +80,18 @@ class Notifications extends \Zotlabs\Web\Controller {
$not_tpl = get_markup_template('notify.tpl');
require_once('include/bbcode.php');
- $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
+ $r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc",
intval(local_channel())
);
- if (count($r) > 0) {
+ if ($r > 0) {
$notifications_available =1;
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
'$item_link' => z_root().'/notify/view/'. $it['id'],
'$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])),
- '$item_when' => relative_date($it['date'])
+ '$item_when' => relative_date($it['created'])
));
}
} else {
diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php
index 227491145..f592f6f37 100644
--- a/Zotlabs/Module/Notify.php
+++ b/Zotlabs/Module/Notify.php
@@ -39,7 +39,7 @@ class Notify extends \Zotlabs\Web\Controller {
$not_tpl = get_markup_template('notify.tpl');
require_once('include/bbcode.php');
- $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
+ $r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc",
intval(local_channel())
);
@@ -49,7 +49,7 @@ class Notify extends \Zotlabs\Web\Controller {
'$item_link' => z_root().'/notify/view/'. $it['id'],
'$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])),
- '$item_when' => relative_date($it['date'])
+ '$item_when' => relative_date($it['created'])
));
}
}
diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php
index 89824fc7e..dc0547a42 100644
--- a/Zotlabs/Module/Oep.php
+++ b/Zotlabs/Module/Oep.php
@@ -249,7 +249,7 @@ class Oep extends \Zotlabs\Web\Controller {
$sql_extra = permissions_sql($c[0]['channel_id']);
- $p = q("select resource_id from photo where album = '%s' and uid = %d and scale = 0 $sql_extra order by created desc limit 1",
+ $p = q("select resource_id from photo where album = '%s' and uid = %d and imgscale = 0 $sql_extra order by created desc limit 1",
dbesc($res),
intval($c[0]['channel_id'])
);
@@ -258,7 +258,7 @@ class Oep extends \Zotlabs\Web\Controller {
$res = $p[0]['resource_id'];
- $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc",
+ $r = q("select height, width, imgscale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by imgscale asc",
intval($c[0]['channel_id']),
dbesc($res)
);
@@ -276,7 +276,7 @@ class Oep extends \Zotlabs\Web\Controller {
if($foundres) {
$ret['type'] = 'link';
- $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale'];
+ $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['imgscale'];
$ret['thumbnail_width'] = $rr['width'];
$ret['thumbnail_height'] = $rr['height'];
}
@@ -310,7 +310,7 @@ class Oep extends \Zotlabs\Web\Controller {
$sql_extra = permissions_sql($c[0]['channel_id']);
- $p = q("select resource_id from photo where uid = %d and scale = 0 $sql_extra order by created desc limit 1",
+ $p = q("select resource_id from photo where uid = %d and imgscale = 0 $sql_extra order by created desc limit 1",
intval($c[0]['channel_id'])
);
if(! $p)
@@ -318,7 +318,7 @@ class Oep extends \Zotlabs\Web\Controller {
$res = $p[0]['resource_id'];
- $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc",
+ $r = q("select height, width, imgscale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by imgscale asc",
intval($c[0]['channel_id']),
dbesc($res)
);
@@ -336,7 +336,7 @@ class Oep extends \Zotlabs\Web\Controller {
if($foundres) {
$ret['type'] = 'link';
- $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale'];
+ $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['imgscale'];
$ret['thumbnail_width'] = $rr['width'];
$ret['thumbnail_height'] = $rr['height'];
}
@@ -372,7 +372,7 @@ class Oep extends \Zotlabs\Web\Controller {
$sql_extra = permissions_sql($c[0]['channel_id']);
- $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc",
+ $r = q("select height, width, imgscale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by imgscale asc",
intval($c[0]['channel_id']),
dbesc($res)
);
@@ -390,7 +390,7 @@ class Oep extends \Zotlabs\Web\Controller {
if($foundres) {
$ret['type'] = 'link';
- $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale'];
+ $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['imgscale'];
$ret['thumbnail_width'] = $rr['width'];
$ret['thumbnail_height'] = $rr['height'];
}
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 408688886..92c9ac3c0 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -57,14 +57,14 @@ class Photo extends \Zotlabs\Web\Controller {
$uid = $person;
- $r = q("SELECT * FROM photo WHERE scale = %d AND uid = %d AND photo_usage = %d LIMIT 1",
+ $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1",
intval($resolution),
intval($uid),
intval(PHOTO_PROFILE)
);
if(count($r)) {
- $data = dbunescbin($r[0]['data']);
- $mimetype = $r[0]['type'];
+ $data = dbunescbin($r[0]['content']);
+ $mimetype = $r[0]['mimetype'];
}
if(intval($r[0]['os_storage']))
$data = file_get_contents($data);
@@ -113,7 +113,7 @@ class Photo extends \Zotlabs\Web\Controller {
// If using resolution 1, make sure it exists before proceeding:
if ($resolution == 1)
{
- $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1",
+ $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
@@ -121,7 +121,7 @@ class Photo extends \Zotlabs\Web\Controller {
$resolution = 2;
}
- $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1",
+ $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
@@ -133,14 +133,14 @@ class Photo extends \Zotlabs\Web\Controller {
// Now we'll see if we can access the photo
- $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND scale = %d $sql_extra LIMIT 1",
+ $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d $sql_extra LIMIT 1",
dbesc($photo),
intval($resolution)
);
if($r && $allowed) {
- $data = dbunescbin($r[0]['data']);
- $mimetype = $r[0]['type'];
+ $data = dbunescbin($r[0]['content']);
+ $mimetype = $r[0]['mimetype'];
if(intval($r[0]['os_storage']))
$data = file_get_contents($data);
}
@@ -154,7 +154,7 @@ class Photo extends \Zotlabs\Web\Controller {
// they won't have the photo link, so there's a reasonable chance that the person
// might be able to obtain permission to view it.
- $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d LIMIT 1",
+ $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `imgscale` = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index ecf966032..ada7b4ef1 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -255,13 +255,13 @@ class Photos extends \Zotlabs\Web\Controller {
( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) {
logger('rotate');
- $r = q("select * from photo where `resource_id` = '%s' and uid = %d and scale = 0 limit 1",
+ $r = q("select * from photo where `resource_id` = '%s' and uid = %d and imgscale = 0 limit 1",
dbesc($resource_id),
intval($page_owner_uid)
);
if(count($r)) {
- $d = (($r[0]['os_storage']) ? @file_get_contents($r[0]['data']) : dbunescbin($r[0]['data']));
- $ph = photo_factory($d, $r[0]['type']);
+ $d = (($r[0]['os_storage']) ? @file_get_contents($r[0]['content']) : dbunescbin($r[0]['content']));
+ $ph = photo_factory($d, $r[0]['mimetype']);
if($ph->is_valid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
$ph->rotate($rotate_deg);
@@ -270,9 +270,9 @@ class Photos extends \Zotlabs\Web\Controller {
$height = $ph->getHeight();
if(intval($r[0]['os_storage'])) {
- @file_put_contents($r[0]['data'],$ph->imageString());
- $data = $r[0]['data'];
- $fsize = @filesize($r[0]['data']);
+ @file_put_contents($r[0]['content'],$ph->imageString());
+ $data = $r[0]['content'];
+ $fsize = @filesize($r[0]['content']);
q("update attach set filesize = %d where hash = '%s' and uid = %d limit 1",
intval($fsize),
dbesc($resource_id),
@@ -284,7 +284,7 @@ class Photos extends \Zotlabs\Web\Controller {
$fsize = strlen($data);
}
- $x = q("update photo set data = '%s', `size` = %d, height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 0",
+ $x = q("update photo set content = '%s', filesize = %d, height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 0",
dbescbin($data),
intval($fsize),
intval($height),
@@ -299,7 +299,7 @@ class Photos extends \Zotlabs\Web\Controller {
$width = $ph->getWidth();
$height = $ph->getHeight();
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 1",
+ $x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 1",
dbescbin($ph->imageString()),
intval($height),
intval($width),
@@ -314,7 +314,7 @@ class Photos extends \Zotlabs\Web\Controller {
$width = $ph->getWidth();
$height = $ph->getHeight();
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 2",
+ $x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 2",
dbescbin($ph->imageString()),
intval($height),
intval($width),
@@ -329,7 +329,7 @@ class Photos extends \Zotlabs\Web\Controller {
$width = $ph->getWidth();
$height = $ph->getHeight();
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 3",
+ $x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 3",
dbescbin($ph->imageString()),
intval($height),
intval($width),
@@ -340,12 +340,12 @@ class Photos extends \Zotlabs\Web\Controller {
}
}
- $p = q("SELECT type, is_nsfw, description, resource_id, scale, allow_cid, allow_gid, deny_cid, deny_gid FROM photo WHERE resource_id = '%s' AND uid = %d ORDER BY scale DESC",
+ $p = q("SELECT mimetype, is_nsfw, description, resource_id, imgscale, allow_cid, allow_gid, deny_cid, deny_gid FROM photo WHERE resource_id = '%s' AND uid = %d ORDER BY imgscale DESC",
dbesc($resource_id),
intval($page_owner_uid)
);
if($p) {
- $ext = $phototypes[$p[0]['type']];
+ $ext = $phototypes[$p[0]['mimetype']];
$r = q("UPDATE `photo` SET `description` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d",
dbesc($desc),
@@ -611,7 +611,7 @@ class Photos extends \Zotlabs\Web\Controller {
/* Show space usage */
- $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ",
+ $r = q("select sum(filesize) as total from photo where aid = %d and imgscale = 0 ",
intval(\App::$data['channel']['channel_account_id'])
);
@@ -704,8 +704,8 @@ class Photos extends \Zotlabs\Web\Controller {
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$cmd) . '" title="oembed" />' . "\r\n";
- $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
- AND `scale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`",
+ $r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
+ AND `imgscale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`",
intval($owner_uid),
dbesc($album),
intval(PHOTO_NORMAL),
@@ -725,9 +725,9 @@ class Photos extends \Zotlabs\Web\Controller {
$order = 'DESC';
- $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.scale, p.description, p.created FROM photo p INNER JOIN
- (SELECT resource_id, max(scale) scale FROM photo WHERE uid = %d AND album = '%s' AND scale <= 4 AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id) ph
- ON (p.resource_id = ph.resource_id AND p.scale = ph.scale)
+ $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.imgscale, p.description, p.created FROM photo p INNER JOIN
+ (SELECT resource_id, max(imgscale) imgscale FROM photo WHERE uid = %d AND album = '%s' AND imgscale <= 4 AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id) ph
+ ON (p.resource_id = ph.resource_id AND p.imgscale = ph.imgscale)
ORDER BY created $order LIMIT %d OFFSET %d",
intval($owner_uid),
dbesc($album),
@@ -777,7 +777,7 @@ class Photos extends \Zotlabs\Web\Controller {
else
$twist = 'rotright';
- $ext = $phototypes[$rr['type']];
+ $ext = $phototypes[$rr['mimetype']];
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
@@ -790,7 +790,7 @@ class Photos extends \Zotlabs\Web\Controller {
'twist' => ' ' . $twist . rand(2,4),
'link' => $imagelink,
'title' => t('View Photo'),
- 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
+ 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['imgscale'] . '.' .$ext,
'alt' => $imgalt_e,
'desc'=> $desc_e,
'ext' => $ext,
@@ -852,8 +852,8 @@ class Photos extends \Zotlabs\Web\Controller {
// fetch image, item containing image, then comments
- $ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
- $sql_extra ORDER BY `scale` ASC ",
+ $ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,mimetype,height,width,filesize,imgscale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
+ $sql_extra ORDER BY `imgscale` ASC ",
intval($owner_uid),
dbesc($datum)
);
@@ -884,7 +884,7 @@ class Photos extends \Zotlabs\Web\Controller {
$order = 'DESC';
- $prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
+ $prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `imgscale` = 0
$sql_extra ORDER BY `created` $order ",
dbesc($ph[0]['album']),
intval($owner_uid)
@@ -911,7 +911,7 @@ class Photos extends \Zotlabs\Web\Controller {
if(count($ph) == 1)
$hires = $lores = $ph[0];
if(count($ph) > 1) {
- if($ph[1]['scale'] == 2) {
+ if($ph[1]['imgscale'] == 2) {
// original is 640 or less, we can display it directly
$hires = $lores = $ph[0];
}
@@ -949,9 +949,9 @@ class Photos extends \Zotlabs\Web\Controller {
$prevlink = array($prevlink, t('Previous'));
$photo = array(
- 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
+ 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['imgscale'] . '.' . $phototypes[$hires['mimetype']],
'title'=> t('View Full Size'),
- 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
+ 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['imgscale'] . '.' . $phototypes[$lores['mimetype']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
);
if($nextlink)
@@ -1277,7 +1277,7 @@ class Photos extends \Zotlabs\Web\Controller {
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$cmd) . '" title="oembed" />' . "\r\n";
- $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
+ $r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`",
intval(\App::$data['channel']['channel_id']),
dbesc('Contact Photos'),
@@ -1286,16 +1286,17 @@ class Photos extends \Zotlabs\Web\Controller {
intval(PHOTO_PROFILE),
intval($unsafe)
);
- if(count($r)) {
+ if($r) {
\App::set_pager_total(count($r));
\App::set_pager_itemspage(60);
}
- $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN
- (SELECT resource_id, max(scale) scale FROM photo
- WHERE uid=%d AND album != '%s' AND album != '%s'
- AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra group by resource_id) ph
- ON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d",
+ $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.album, p.imgscale, p.created FROM photo as p
+ INNER JOIN ( SELECT resource_id, max(imgscale) as imgscale FROM photo
+ WHERE uid = %d AND photo_usage IN ( %d, %d )
+ AND is_nsfw = %d $sql_extra group by resource_id ) as ph
+ ON (p.resource_id = ph.resource_id and p.imgscale = ph.imgscale)
+ ORDER by p.created DESC LIMIT %d OFFSET %d",
intval(\App::$data['channel']['channel_id']),
dbesc('Contact Photos'),
dbesc( t('Contact Photos')),
@@ -1309,14 +1310,14 @@ class Photos extends \Zotlabs\Web\Controller {
$photos = array();
- if(count($r)) {
+ if($r) {
$twist = 'rotright';
foreach($r as $rr) {
if($twist == 'rotright')
$twist = 'rotleft';
else
$twist = 'rotright';
- $ext = $phototypes[$rr['type']];
+ $ext = $phototypes[$rr['mimetype']];
if(\App::get_template_engine() === 'internal') {
$alt_e = template_escape($rr['filename']);
@@ -1332,7 +1333,7 @@ class Photos extends \Zotlabs\Web\Controller {
'twist' => ' ' . $twist . rand(2,4),
'link' => z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id'],
'title' => t('View Photo'),
- 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
+ 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['imgscale']) == 6) ? 4 : $rr['imgscale']) . '.' . $ext,
'alt' => $alt_e,
'album' => array(
'link' => z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']),
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index 32427b06f..5cbf45daa 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -173,7 +173,7 @@ class Ping extends \Zotlabs\Web\Controller {
);
break;
case 'all_events':
- $r = q("update event set `ignore` = 1 where `ignore` = 0 and uid = %d AND start < '%s' AND start > '%s' ",
+ $r = q("update event set `dimissed` = 1 where `dismissed` = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
@@ -209,17 +209,17 @@ class Ping extends \Zotlabs\Web\Controller {
);
if($t && intval($t[0]['total']) > 49) {
$z = q("select * from notify where uid = %d
- and seen = 0 order by date desc limit 50",
+ and seen = 0 order by created desc limit 50",
intval(local_channel())
);
}
else {
$z1 = q("select * from notify where uid = %d
- and seen = 0 order by date desc limit 50",
+ and seen = 0 order by created desc limit 50",
intval(local_channel())
);
$z2 = q("select * from notify where uid = %d
- and seen = 1 order by date desc limit %d",
+ and seen = 1 order by created desc limit %d",
intval(local_channel()),
intval(50 - intval($t[0]['total']))
);
@@ -230,10 +230,10 @@ class Ping extends \Zotlabs\Web\Controller {
foreach($z as $zz) {
$notifs[] = array(
'notify_link' => z_root() . '/notify/view/' . $zz['id'],
- 'name' => $zz['name'],
+ 'name' => $zz['xname'],
'url' => $zz['url'],
'photo' => $zz['photo'],
- 'when' => relative_date($zz['date']),
+ 'when' => relative_date($zz['created']),
'hclass' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
'message' => strip_tags(bbcode($zz['msg']))
);
@@ -325,9 +325,9 @@ class Ping extends \Zotlabs\Web\Controller {
$result = array();
$r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash
- WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0
- and type in ( 'event', 'birthday' )
- ORDER BY `start` DESC LIMIT 1000",
+ WHERE `event`.`uid` = %d AND dtstart < '%s' AND dtstart > '%s' and `dismissed` = 0
+ and etype in ( 'event', 'birthday' )
+ ORDER BY `dtstart` DESC LIMIT 1000",
intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
@@ -336,14 +336,14 @@ class Ping extends \Zotlabs\Web\Controller {
if($r) {
foreach($r as $rr) {
if($rr['adjust'])
- $md = datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'Y/m');
+ $md = datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'Y/m');
else
- $md = datetime_convert('UTC', 'UTC', $rr['start'], 'Y/m');
+ $md = datetime_convert('UTC', 'UTC', $rr['dtstart'], 'Y/m');
- $strt = datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['start']);
+ $strt = datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['dtstart']);
$today = ((substr($strt, 0, 10) === datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d')) ? true : false);
- $when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
+ $when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['dtstart'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
$result[] = array(
'notify_link' => z_root() . '/events', // FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'],
@@ -443,10 +443,10 @@ class Ping extends \Zotlabs\Web\Controller {
$t5 = dba_timer();
if($vnotify & (VNOTIFY_EVENT|VNOTIFY_EVENTTODAY|VNOTIFY_BIRTHDAY)) {
- $events = q("SELECT type, start, adjust FROM `event`
- WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0
- and type in ( 'event', 'birthday' )
- ORDER BY `start` ASC ",
+ $events = q("SELECT etype, dtstart, adjust FROM `event`
+ WHERE `event`.`uid` = %d AND dtstart < '%s' AND dtstart > '%s' and `dismissed` = 0
+ and etype in ( 'event', 'birthday' )
+ ORDER BY `dtstart` ASC ",
intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
@@ -459,14 +459,14 @@ class Ping extends \Zotlabs\Web\Controller {
$str_now = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d');
foreach($events as $x) {
$bd = false;
- if($x['type'] === 'birthday') {
+ if($x['etype'] === 'birthday') {
$result['birthdays'] ++;
$bd = true;
}
else {
$result['events'] ++;
}
- if(datetime_convert('UTC', ((intval($x['adjust'])) ? date_default_timezone_get() : 'UTC'), $x['start'], 'Y-m-d') === $str_now) {
+ if(datetime_convert('UTC', ((intval($x['adjust'])) ? date_default_timezone_get() : 'UTC'), $x['dtstart'], 'Y-m-d') === $str_now) {
$result['all_events_today'] ++;
if($bd)
$result['birthdays_today'] ++;
diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php
index 123ecbc7b..cf8d83023 100644
--- a/Zotlabs/Module/Poke.php
+++ b/Zotlabs/Module/Poke.php
@@ -115,7 +115,7 @@ class Poke extends \Zotlabs\Web\Controller {
),
);
- $arr['object'] = json_encode($obj);
+ $arr['obj'] = json_encode($obj);
$arr['item_origin'] = 1;
$arr['item_wall'] = 1;
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index a8cf3cbee..6129a7492 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -93,7 +93,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$srcW = $_POST['xfinal'] - $srcX;
$srcH = $_POST['yfinal'] - $srcY;
- $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND scale = %d LIMIT 1",
+ $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1",
dbesc($image_id),
dbesc(local_channel()),
intval($scale));
@@ -101,9 +101,9 @@ class Profile_photo extends \Zotlabs\Web\Controller {
if($r) {
$base_image = $r[0];
- $base_image['data'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['data']) : dbunescbin($base_image['data']));
+ $base_image['content'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['content']) : dbunescbin($base_image['content']));
- $im = photo_factory($base_image['data'], $base_image['type']);
+ $im = photo_factory($base_image['content'], $base_image['mimetype']);
if($im->is_valid()) {
$im->cropImage(300,$srcX,$srcY,$srcW,$srcH);
@@ -113,25 +113,25 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'],
'filename' => $base_image['filename'], 'album' => t('Profile Photos'));
- $p['scale'] = 4;
+ $p['imgscale'] = 4;
$p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL);
$r1 = $im->save($p);
$im->scaleImage(80);
- $p['scale'] = 5;
+ $p['imgscale'] = 5;
$r2 = $im->save($p);
$im->scaleImage(48);
- $p['scale'] = 6;
+ $p['imgscale'] = 6;
$r3 = $im->save($p);
if($r1 === false || $r2 === false || $r3 === false) {
// if one failed, delete them all so we can start over.
notice( t('Image resize failed.') . EOL );
- $x = q("delete from photo where resource_id = '%s' and uid = %d and scale >= 4 ",
+ $x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale >= 4 ",
dbesc($base_image['resource_id']),
local_channel()
);
@@ -208,7 +208,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
logger('attach_store: ' . print_r($res,true));
if($res && intval($res['data']['is_photo'])) {
- $i = q("select * from photo where resource_id = '%s' and uid = %d order by scale",
+ $i = q("select * from photo where resource_id = '%s' and uid = %d order by imgscale",
dbesc($hash),
intval(local_channel())
);
@@ -220,11 +220,11 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$os_storage = false;
foreach($i as $ii) {
- if(intval($ii['scale']) < 2) {
- $smallest = intval($ii['scale']);
+ if(intval($ii['imgscale']) < 2) {
+ $smallest = intval($ii['imgscale']);
$os_storage = intval($ii['os_storage']);
- $imagedata = $ii['data'];
- $filetype = $ii['type'];
+ $imagedata = $ii['content'];
+ $filetype = $ii['mimetype'];
}
}
}
@@ -250,7 +250,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
*/
- function get() {
+ function get() {
if(! local_channel()) {
notice( t('Permission denied.') . EOL );
@@ -275,7 +275,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$resource_id = argv(2);
- $r = q("SELECT id, album, scale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY scale ASC",
+ $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC",
intval(local_channel()),
dbesc($resource_id)
);
@@ -285,7 +285,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
$havescale = false;
foreach($r as $rr) {
- if($rr['scale'] == 5)
+ if($rr['imgscale'] == 5)
$havescale = true;
}
@@ -315,7 +315,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
goaway(z_root() . '/profiles');
}
- $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
+ $r = q("SELECT content, mimetype, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
intval($r[0]['id']),
intval(local_channel())
@@ -326,15 +326,15 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
if(intval($r[0]['os_storage']))
- $data = @file_get_contents($r[0]['data']);
+ $data = @file_get_contents($r[0]['content']);
else
- $data = dbunescbin($r[0]['data']);
+ $data = dbunescbin($r[0]['content']);
- $ph = photo_factory($data, $r[0]['type']);
+ $ph = photo_factory($data, $r[0]['mimetype']);
$smallest = 0;
if($ph->is_valid()) {
// go ahead as if we have just uploaded a new photo to crop
- $i = q("select resource_id, scale from photo where resource_id = '%s' and uid = %d order by scale",
+ $i = q("select resource_id, imgscale from photo where resource_id = '%s' and uid = %d order by imgscale",
dbesc($r[0]['resource_id']),
intval(local_channel())
);
@@ -342,8 +342,8 @@ class Profile_photo extends \Zotlabs\Web\Controller {
if($i) {
$hash = $i[0]['resource_id'];
foreach($i as $ii) {
- if(intval($ii['scale']) < 2) {
- $smallest = intval($ii['scale']);
+ if(intval($ii['imgscale']) < 2) {
+ $smallest = intval($ii['imgscale']);
}
}
}
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index 73db01657..fcc2486ba 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -48,7 +48,7 @@ class Share extends \Zotlabs\Web\Controller {
$is_photo = (($r[0]['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
if($is_photo) {
- $object = json_decode($r[0]['object'],true);
+ $object = json_decode($r[0]['obj'],true);
$photo_bb = $object['body'];
}
diff --git a/Zotlabs/Module/Sharedwithme.php b/Zotlabs/Module/Sharedwithme.php
index 8eaa47dba..25bc7dba3 100644
--- a/Zotlabs/Module/Sharedwithme.php
+++ b/Zotlabs/Module/Sharedwithme.php
@@ -46,7 +46,7 @@ class Sharedwithme extends \Zotlabs\Web\Controller {
}
//list files
- $r = q("SELECT id, uid, object, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'",
+ $r = q("SELECT id, uid, obj, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'",
dbesc(ACTIVITY_POST),
dbesc(ACTIVITY_OBJ_FILE),
intval(local_channel()),
@@ -59,7 +59,7 @@ class Sharedwithme extends \Zotlabs\Web\Controller {
if($r) {
foreach($r as $rr) {
- $object = json_decode($rr['object'],true);
+ $object = json_decode($rr['obj'],true);
$item = array();
$item['id'] = $rr['id'];
diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php
index 16a011a40..0226664d7 100644
--- a/Zotlabs/Module/Subthread.php
+++ b/Zotlabs/Module/Subthread.php
@@ -144,7 +144,7 @@ class Subthread extends \Zotlabs\Web\Controller {
$arr['verb'] = $activity;
$arr['obj_type'] = $objtype;
- $arr['object'] = $obj;
+ $arr['obj'] = $obj;
$arr['allow_cid'] = $item['allow_cid'];
$arr['allow_gid'] = $item['allow_gid'];
diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php
index 26d1c58ea..0a46cf56d 100644
--- a/Zotlabs/Module/Tagger.php
+++ b/Zotlabs/Module/Tagger.php
@@ -124,7 +124,7 @@ class Tagger extends \Zotlabs\Web\Controller {
$arr['tgt_type'] = $targettype;
$arr['target'] = $target;
$arr['obj_type'] = $objtype;
- $arr['object'] = $obj;
+ $arr['obj'] = $obj;
$arr['parent_mid'] = $item['mid'];
store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_COMMUNITYTAG,$term,$tagid);
diff --git a/Zotlabs/Module/Tasks.php b/Zotlabs/Module/Tasks.php
index ab05f8be9..6d0a92d91 100644
--- a/Zotlabs/Module/Tasks.php
+++ b/Zotlabs/Module/Tasks.php
@@ -45,7 +45,7 @@ class Tasks extends \Zotlabs\Web\Controller {
if((argc() > 2) && (argv(1) === 'complete') && intval(argv(2))) {
$ret = array('success' => false);
- $r = q("select * from event where `type` = 'task' and uid = %d and id = %d limit 1",
+ $r = q("select * from event where `etype` = 'task' and uid = %d and id = %d limit 1",
intval(local_channel()),
intval(argv(2))
);
@@ -80,9 +80,9 @@ class Tasks extends \Zotlabs\Web\Controller {
$event['account'] = $channel['channel_account_id'];
$event['uid'] = $channel['channel_id'];
$event['event_xchan'] = $channel['channel_hash'];
- $event['type'] = 'task';
+ $event['etype'] = 'task';
$event['nofinish'] = true;
- $event['created'] = $event['edited'] = $event['start'] = datetime_convert();
+ $event['created'] = $event['edited'] = $event['dtstart'] = datetime_convert();
$event['adjust'] = 1;
$event['allow_cid'] = '<' . $channel['channel_hash'] . '>';
$event['summary'] = escape_tags($_REQUEST['summary']);
@@ -92,21 +92,13 @@ class Tasks extends \Zotlabs\Web\Controller {
else
$x = array('success' => false);
json_return_and_die($x);
- }
-
-
+ }
}
-
-
-
-
- function get() {
-
+ function get() {
if(! local_channel())
return;
-
-
+
return '';
}
}
diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php
index 6fc5219d8..e23cce565 100644
--- a/Zotlabs/Module/Thing.php
+++ b/Zotlabs/Module/Thing.php
@@ -212,7 +212,7 @@ class Thing extends \Zotlabs\Web\Controller {
$arr['verb'] = $verb;
$arr['obj_type'] = $objtype;
- $arr['object'] = $obj;
+ $arr['obj'] = $obj;
if(! $profile['is_default']) {
$arr['item_private'] = true;
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index 84368d07e..06ae90a5f 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -246,7 +246,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
$deny_gid = $c[0]['channel_deny_gid'];
}
- $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, folder, os_storage, filetype, filesize, revision, is_photo, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
+ $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, folder, os_storage, filetype, filesize, revision, is_photo, content, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($c[0]['channel_account_id']),
intval($c[0]['channel_id']),
diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php
index d40fee0ea..ecd15cc55 100644
--- a/Zotlabs/Storage/File.php
+++ b/Zotlabs/Storage/File.php
@@ -124,7 +124,7 @@ class File extends DAV\Node implements DAV\IFile {
);
if ($r) {
if (intval($r[0]['os_storage'])) {
- $d = q("select folder, data from attach where hash = '%s' and uid = %d limit 1",
+ $d = q("select folder, content from attach where hash = '%s' and uid = %d limit 1",
dbesc($this->data['hash']),
intval($c[0]['channel_id'])
);
@@ -139,7 +139,7 @@ class File extends DAV\Node implements DAV\IFile {
$direct = $f1[0];
}
}
- $fname = dbunescbin($d[0]['data']);
+ $fname = dbunescbin($d[0]['content']);
if(strpos($fname,'store') === false)
$f = 'store/' . $this->auth->owner_nick . '/' . $fname ;
else
@@ -158,12 +158,12 @@ class File extends DAV\Node implements DAV\IFile {
}
else {
// this shouldn't happen any more
- $r = q("UPDATE attach SET data = '%s' WHERE hash = '%s' AND uid = %d",
+ $r = q("UPDATE attach SET content = '%s' WHERE hash = '%s' AND uid = %d",
dbescbin(stream_get_contents($data)),
dbesc($this->data['hash']),
intval($this->data['uid'])
);
- $r = q("SELECT length(data) AS fsize FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1",
+ $r = q("SELECT length(content) AS fsize FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1",
dbesc($this->data['hash']),
intval($this->data['uid'])
);
@@ -236,7 +236,7 @@ class File extends DAV\Node implements DAV\IFile {
logger('get file ' . basename($this->name), LOGGER_DEBUG);
logger('os_path: ' . $this->os_path, LOGGER_DATA);
- $r = q("SELECT data, flags, os_storage, filename, filetype FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1",
+ $r = q("SELECT content, flags, os_storage, filename, filetype FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1",
dbesc($this->data['hash']),
intval($this->data['uid'])
);
@@ -250,14 +250,14 @@ class File extends DAV\Node implements DAV\IFile {
}
if (intval($r[0]['os_storage'])) {
- $x = dbunescbin($r[0]['data']);
+ $x = dbunescbin($r[0]['content']);
if(strpos($x,'store') === false)
$f = 'store/' . $this->auth->owner_nick . '/' . (($this->os_path) ? $this->os_path . '/' : '') . $x;
else
$f = $x;
return fopen($f, 'rb');
}
- return dbunescbin($r[0]['data']);
+ return dbunescbin($r[0]['content']);
}
}
diff --git a/boot.php b/boot.php
index e105560e4..5b3a614f1 100755
--- a/boot.php
+++ b/boot.php
@@ -45,10 +45,10 @@ require_once('include/account.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '1.7.2' );
+define ( 'STD_VERSION', '1.7.3' );
define ( 'ZOT_REVISION', 1.1 );
-define ( 'DB_UPDATE_VERSION', 1173 );
+define ( 'DB_UPDATE_VERSION', 1176 );
/**
diff --git a/include/api.php b/include/api.php
index 0833ae7b9..f0d886d9b 100644
--- a/include/api.php
+++ b/include/api.php
@@ -554,7 +554,7 @@ require_once('include/api_auth.php');
dbesc($_REQUEST['file_id'])
);
if($r) {
- unset($r[0]['data']);
+ unset($r[0]['content']);
$ret = array('attach' => $r[0]);
json_return_and_die($ret);
}
@@ -580,21 +580,21 @@ require_once('include/api_auth.php');
$length = intval($ptr['filesize']);
if($ptr['is_dir'])
- $ptr['data'] = '';
+ $ptr['content'] = '';
elseif(! intval($r[0]['os_storage'])) {
$ptr['start'] = $start;
- $x = substr(dbunescbin($ptr['data'],$start,$length));
+ $x = substr(dbunescbin($ptr['content'],$start,$length));
$ptr['length'] = strlen($x);
- $ptr['data'] = base64_encode($x);
+ $ptr['content'] = base64_encode($x);
}
else {
- $fp = fopen(dbunescbin($ptr['data']),'r');
+ $fp = fopen(dbunescbin($ptr['content']),'r');
if($fp) {
$seek = fseek($fp,$start,SEEK_SET);
$x = fread($fp,$length);
$ptr['start'] = $start;
$ptr['length'] = strlen($x);
- $ptr['data'] = base64_encode($x);
+ $ptr['content'] = base64_encode($x);
}
}
@@ -617,11 +617,11 @@ require_once('include/api_auth.php');
);
if($r) {
if($r[0]['is_dir'])
- $r[0]['data'] = '';
+ $r[0]['content'] = '';
elseif(intval($r[0]['os_storage']))
- $r[0]['data'] = base64_encode(file_get_contents(dbunescbin($r[0]['data'])));
+ $r[0]['content'] = base64_encode(file_get_contents(dbunescbin($r[0]['content'])));
else
- $r[0]['data'] = base64_encode(dbunescbin($r[0]['data']));
+ $r[0]['content'] = base64_encode(dbunescbin($r[0]['content']));
$ret = array('attach' => $r[0]);
json_return_and_die($ret);
@@ -647,16 +647,16 @@ require_once('include/api_auth.php');
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",
+ $r = q("select * from photo where uid = %d and resource_id = '%s' and imgscale = %d limit 1",
intval(local_channel()),
dbesc($_REQUEST['photo_id']),
intval($scale)
);
if($r) {
- $data = dbunescbin($r[0]['data']);
+ $data = dbunescbin($r[0]['content']);
if(array_key_exists('os_storage',$r[0]) && intval($r[0]['os_storage']))
$data = file_get_contents($data);
- $r[0]['data'] = base64_encode($data);
+ $r[0]['content'] = base64_encode($data);
$ret = array('photo' => $r[0]);
$i = q("select id from item where uid = %d and resource_type = 'photo' and resource_id = '%s' limit 1",
intval(local_channel()),
diff --git a/include/attach.php b/include/attach.php
index d9cd30f6d..78efde51f 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -720,7 +720,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$edited = $created;
if($options === 'replace') {
- $r = q("update attach set filename = '%s', filetype = '%s', folder = '%s', filesize = %d, os_storage = %d, is_photo = %d, data = '%s', edited = '%s' where id = %d and uid = %d",
+ $r = q("update attach set filename = '%s', filetype = '%s', folder = '%s', filesize = %d, os_storage = %d, is_photo = %d, content = '%s', edited = '%s' where id = %d and uid = %d",
dbesc($filename),
dbesc($mimetype),
dbesc($folder_hash),
@@ -734,7 +734,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
);
}
elseif($options === 'revise') {
- $r = q("insert into attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
+ $r = q("insert into attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, content, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($x[0]['aid']),
intval($channel_id),
@@ -775,7 +775,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
}
else {
- $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, data, created, edited, allow_cid, allow_gid,deny_cid, deny_gid )
+ $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, content, created, edited, allow_cid, allow_gid,deny_cid, deny_gid )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($channel['channel_account_id']),
intval($channel_id),
@@ -1032,7 +1032,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
$created = datetime_convert();
- $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, filesize, revision, folder, os_storage, is_dir, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
+ $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, filesize, revision, folder, os_storage, is_dir, content, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($channel['channel_account_id']),
intval($channel_id),
@@ -1275,16 +1275,16 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
// delete a file from filesystem
if(intval($r[0]['os_storage'])) {
- $y = q("SELECT data FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1",
+ $y = q("SELECT content FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1",
dbesc($resource),
intval($channel_id)
);
if($y) {
- if(strpos($y[0]['data'],'store') === false)
- $f = 'store/' . $channel_address . '/' . $y[0]['data'];
+ if(strpos($y[0]['content'],'store') === false)
+ $f = 'store/' . $channel_address . '/' . $y[0]['content'];
else
- $f = $y[0]['data'];
+ $f = $y[0]['content'];
if(is_dir($f))
@rmdir($f);
@@ -1585,7 +1585,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr['deny_gid'] = perms2str($u_arr_deny_gid);
$arr['item_private'] = $private;
$arr['verb'] = ACTIVITY_UPDATE;
- $arr['object'] = $u_jsonobject;
+ $arr['obj'] = $u_jsonobject;
$arr['body'] = '';
$post = item_store($arr);
@@ -1620,7 +1620,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr['deny_gid'] = perms2str($arr_deny_gid);
$arr['item_private'] = $private;
$arr['verb'] = (($update) ? ACTIVITY_UPDATE : ACTIVITY_POST);
- $arr['object'] = (($update) ? $u_jsonobject : $jsonobject);
+ $arr['obj'] = (($update) ? $u_jsonobject : $jsonobject);
$arr['body'] = '';
$post = item_store($arr);
@@ -1854,21 +1854,19 @@ function attach_export_data($channel, $resource_id, $deleted = false) {
} while($hash_ptr);
-
-
$paths = array_reverse($paths);
$ret['attach'] = $paths;
if($attach_ptr['is_photo']) {
- $r = q("select * from photo where resource_id = '%s' and uid = %d order by scale asc",
+ $r = q("select * from photo where resource_id = '%s' and uid = %d order by imgscale asc",
dbesc($resource_id),
intval($channel['channel_id'])
);
if($r) {
for($x = 0; $x < count($r); $x ++) {
- $r[$x]['data'] = base64_encode($r[$x]['data']);
+ $r[$x]['content'] = base64_encode($r[$x]['content']);
}
$ret['photo'] = $r;
}
diff --git a/include/channel.php b/include/channel.php
index 0e5490c86..087bd4162 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -550,13 +550,13 @@ function identity_basic_export($channel_id, $items = false) {
if($r)
$ret['config'] = $r;
- $r = q("select type, data, os_storage from photo where scale = 4 and photo_usage = %d and uid = %d limit 1",
+ $r = q("select mimetype, content, os_storage from photo where imgscale = 4 and photo_usage = %d and uid = %d limit 1",
intval(PHOTO_PROFILE),
intval($channel_id)
);
if($r) {
- $ret['photo'] = array('type' => $r[0]['type'], 'data' => (($r[0]['os_storage']) ? base64url_encode(file_get_contents($r[0]['data'])) : base64url_encode($r[0]['data'])));
+ $ret['photo'] = array('type' => $r[0]['mimetype'], 'data' => (($r[0]['os_storage']) ? base64url_encode(file_get_contents($r[0]['content'])) : base64url_encode($r[0]['content'])));
}
// All other term types will be included in items, if requested.
@@ -1108,150 +1108,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
}
-/**
- * @FIXME or remove
- */
- function get_birthdays() {
-
- $o = '';
-
- if(! local_channel())
- return $o;
-
- $bd_format = t('g A l F d') ; // 8 AM Friday January 18
- $bd_short = t('F d');
-
- $r = q("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event`
- LEFT JOIN `contact` ON `contact`.`id` = `event`.`cid`
- WHERE `event`.`uid` = %d AND `type` = 'birthday' AND `start` < '%s' AND `finish` > '%s'
- ORDER BY `start` ASC ",
- intval(local_channel()),
- dbesc(datetime_convert('UTC','UTC','now + 6 days')),
- dbesc(datetime_convert('UTC','UTC','now'))
- );
-
- if($r && count($r)) {
- $total = 0;
- $now = strtotime('now');
- $cids = array();
-
- $istoday = false;
- foreach($r as $rr) {
- if(strlen($rr['name']))
- $total ++;
- if((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now))
- $istoday = true;
- }
- $classtoday = $istoday ? ' birthday-today ' : '';
- if($total) {
- foreach($r as &$rr) {
- if(! strlen($rr['name']))
- continue;
-
- // avoid duplicates
-
- if(in_array($rr['cid'],$cids))
- continue;
- $cids[] = $rr['cid'];
-
- $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false);
- $sparkle = '';
- $url = $rr['url'];
- if($rr['network'] === NETWORK_DFRN) {
- $sparkle = " sparkle";
- $url = z_root() . '/redir/' . $rr['cid'];
- }
-
- $rr['link'] = $url;
- $rr['title'] = $rr['name'];
- $rr['date'] = day_translate(datetime_convert('UTC', App::$timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
- $rr['startime'] = Null;
- $rr['today'] = $today;
- }
- }
- }
- $tpl = get_markup_template("birthdays_reminder.tpl");
- return replace_macros($tpl, array(
- '$baseurl' => z_root(),
- '$classtoday' => $classtoday,
- '$count' => $total,
- '$event_reminders' => t('Birthday Reminders'),
- '$event_title' => t('Birthdays this week:'),
- '$events' => $r,
- '$lbr' => '{', // raw brackets mess up if/endif macro processing
- '$rbr' => '}'
- ));
- }
-
-
-/**
- * @FIXME
- */
- function get_events() {
-
- require_once('include/bbcode.php');
-
- if(! local_channel())
- return $o;
-
- $bd_format = t('g A l F d') ; // 8 AM Friday January 18
- $bd_short = t('F d');
-
- $r = q("SELECT `event`.* FROM `event`
- WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` > '%s'
- ORDER BY `start` ASC ",
- intval(local_channel()),
- dbesc(datetime_convert('UTC','UTC','now + 6 days')),
- dbesc(datetime_convert('UTC','UTC','now - 1 days'))
- );
-
- if($r && count($r)) {
- $now = strtotime('now');
- $istoday = false;
- foreach($r as $rr) {
- if(strlen($rr['name']))
- $total ++;
-
- $strt = datetime_convert('UTC',$rr['convert'] ? App::$timezone : 'UTC',$rr['start'],'Y-m-d');
- if($strt === datetime_convert('UTC',App::$timezone,'now','Y-m-d'))
- $istoday = true;
- }
- $classtoday = (($istoday) ? 'event-today' : '');
-
- foreach($r as &$rr) {
- if($rr['adjust'])
- $md = datetime_convert('UTC',App::$timezone,$rr['start'],'Y/m');
- else
- $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m');
- $md .= "/#link-".$rr['id'];
-
- $title = substr(strip_tags(bbcode($rr['desc'])),0,32) . '... ';
- if(! $title)
- $title = t('[No description]');
-
- $strt = datetime_convert('UTC',$rr['convert'] ? App::$timezone : 'UTC',$rr['start']);
- $today = ((substr($strt,0,10) === datetime_convert('UTC',App::$timezone,'now','Y-m-d')) ? true : false);
-
- $rr['link'] = $md;
- $rr['title'] = $title;
- $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? App::$timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
- $rr['startime'] = $strt;
- $rr['today'] = $today;
- }
- }
-
- $tpl = get_markup_template("events_reminder.tpl");
- return replace_macros($tpl, array(
- '$baseurl' => z_root(),
- '$classtoday' => $classtoday,
- '$count' => count($r),
- '$event_reminders' => t('Event Reminders'),
- '$event_title' => t('Events this week:'),
- '$events' => $r,
- ));
- }
-
-
function advanced_profile(&$a) {
require_once('include/text.php');
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile'))
@@ -1785,7 +1641,7 @@ function auto_channel_create($account_id) {
function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_1200) {
- $r = q("select height, width, resource_id, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ $r = q("select height, width, resource_id, mimetype from photo where uid = %d and imgscale = %d and photo_usage = %d",
intval($channel_id),
intval($res),
intval(PHOTO_COVER)
@@ -1808,8 +1664,8 @@ function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_
default:
$output = array(
'width' => $r[0]['width'],
- 'height' => $r[0]['type'],
- 'type' => $r[0]['type'],
+ 'height' => $r[0]['height'],
+ 'type' => $r[0]['mimetype'],
'url' => $url
);
break;
@@ -1834,19 +1690,19 @@ function get_zcard($channel,$observer_hash = '',$args = array()) {
$width = 425;
$size = 'hz_small';
$cover_size = PHOTO_RES_COVER_425;
- $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']);
}
elseif($maxwidth <= 900) {
$width = 900;
$size = 'hz_medium';
$cover_size = PHOTO_RES_COVER_850;
- $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']);
}
elseif($maxwidth <= 1200) {
$width = 1200;
$size = 'hz_large';
$cover_size = PHOTO_RES_COVER_1200;
- $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
}
// $scale = (float) $maxwidth / $width;
@@ -1856,7 +1712,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) {
$channel['channel_addr'] = $channel['channel_address'] . '@' . App::get_hostname();
$zcard = array('chan' => $channel);
- $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ $r = q("select height, width, resource_id, imgscale, mimetype from photo where uid = %d and imgscale = %d and photo_usage = %d",
intval($channel['channel_id']),
intval($cover_size),
intval(PHOTO_COVER)
@@ -1864,7 +1720,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) {
if($r) {
$cover = $r[0];
- $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale'];
+ $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
else {
$cover = $pphoto;
@@ -1900,25 +1756,25 @@ function get_zcard_embed($channel,$observer_hash = '',$args = array()) {
$width = 425;
$size = 'hz_small';
$cover_size = PHOTO_RES_COVER_425;
- $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']);
}
elseif($maxwidth <= 900) {
$width = 900;
$size = 'hz_medium';
$cover_size = PHOTO_RES_COVER_850;
- $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']);
}
elseif($maxwidth <= 1200) {
$width = 1200;
$size = 'hz_large';
$cover_size = PHOTO_RES_COVER_1200;
- $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
+ $pphoto = array('mimetype' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
}
$channel['channel_addr'] = $channel['channel_address'] . '@' . App::get_hostname();
$zcard = array('chan' => $channel);
- $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ $r = q("select height, width, resource_id, imgscale, mimetype from photo where uid = %d and imgscale = %d and photo_usage = %d",
intval($channel['channel_id']),
intval($cover_size),
intval(PHOTO_COVER)
@@ -1926,7 +1782,7 @@ function get_zcard_embed($channel,$observer_hash = '',$args = array()) {
if($r) {
$cover = $r[0];
- $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale'];
+ $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
else {
$cover = $pphoto;
diff --git a/include/conversation.php b/include/conversation.php
index dabe2ca93..518193b08 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -93,15 +93,15 @@ function localize_item(&$item){
if (activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)){
- if(! $item['object'])
+ if(! $item['obj'])
return;
if(intval($item['item_thread_top']))
return;
- $obj = json_decode_plus($item['object']);
- if((! $obj) && ($item['object'])) {
- logger('localize_item: failed to decode object: ' . print_r($item['object'],true));
+ $obj = json_decode_plus($item['obj']);
+ if((! $obj) && ($item['obj'])) {
+ logger('localize_item: failed to decode object: ' . print_r($item['obj'],true));
}
if($obj['author'] && $obj['author']['link'])
@@ -186,7 +186,7 @@ function localize_item(&$item){
$Alink = $item['author']['xchan_url'];
- $obj= json_decode_plus($item['object']);
+ $obj= json_decode_plus($item['obj']);
$Blink = $Bphoto = '';
@@ -219,7 +219,7 @@ function localize_item(&$item){
$Aname = $item['author']['xchan_name'];
$Alink = $item['author']['xchan_url'];
- $obj= json_decode_plus($item['object']);
+ $obj= json_decode_plus($item['obj']);
$Blink = $Bphoto = '';
@@ -299,7 +299,7 @@ function localize_item(&$item){
}
$plink = '[zrl=' . $obj['plink'] . ']' . $post_type . '[/zrl]';
- $parsedobj = parse_xml_string($xmlhead.$item['object']);
+ $parsedobj = parse_xml_string($xmlhead.$item['obj']);
$tag = sprintf('#[zrl=%s]%s[/zrl]', $parsedobj->id, $parsedobj->content);
$item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
@@ -316,7 +316,7 @@ function localize_item(&$item){
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
- $obj = parse_xml_string($xmlhead.$item['object']);
+ $obj = parse_xml_string($xmlhead.$item['obj']);
if(strlen($obj->id)) {
$r = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($obj->id),
diff --git a/include/event.php b/include/event.php
index 81e403d37..a4118ec78 100644
--- a/include/event.php
+++ b/include/event.php
@@ -28,22 +28,22 @@ function format_event_html($ev) {
$o .= '<div class="event-title"><h3><i class="fa fa-calendar"></i>&nbsp;' . bbcode($ev['summary']) . '</h3></div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
- . datetime_convert('UTC', 'UTC', $ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
+ . datetime_convert('UTC', 'UTC', $ev['dtstart'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
- $ev['start'] , $bd_format ))
+ $ev['dtstart'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
- $ev['start'] , $bd_format)))
+ $ev['dtstart'] , $bd_format)))
. '</span></div>' . "\r\n";
if(! $ev['nofinish'])
$o .= '<div class="event-end" ><span class="event-label">' . t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
- . datetime_convert('UTC','UTC',$ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
+ . datetime_convert('UTC','UTC',$ev['dtend'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
. (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
- $ev['finish'] , $bd_format ))
+ $ev['dtend'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
- $ev['finish'] , $bd_format )))
+ $ev['dtend'] , $bd_format )))
. '</span></div>' . "\r\n";
$o .= '<div class="event-description">' . bbcode($ev['description']) . '</div>' . "\r\n";
@@ -58,6 +58,37 @@ function format_event_html($ev) {
return $o;
}
+function format_event_obj($jobject) {
+ $event = array();
+
+ $object = json_decode($jobject,true);
+
+ //ensure compatibility with older items - this check can be removed at a later point
+ if(array_key_exists('description', $object)) {
+
+ $bd_format = t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM
+
+ $event['header'] = replace_macros(get_markup_template('event_item_header.tpl'),array(
+ '$title' => bbcode($object['title']),
+ '$dtstart_label' => t('Starts:'),
+ '$dtstart_title' => datetime_convert('UTC', 'UTC', $object['dtstart'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
+ '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtstart'] , $bd_format))),
+ '$finish' => (($object['nofinish']) ? false : true),
+ '$dtend_label' => t('Finishes:'),
+ '$dtend_title' => datetime_convert('UTC','UTC',$object['dtend'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
+ '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtend'] , $bd_format )))
+ ));
+
+ $event['content'] = replace_macros(get_markup_template('event_item_content.tpl'),array(
+ '$description' => bbcode($object['description']),
+ '$location_label' => t('Location:'),
+ '$location' => bbcode($object['location'])
+ ));
+
+ }
+
+ return $event;
+}
function ical_wrapper($ev) {
@@ -68,7 +99,7 @@ function ical_wrapper($ev) {
$o .= "\r\nVERSION:2.0";
$o .= "\r\nMETHOD:PUBLISH";
$o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Lib\System::get_platform_name() . "//" . strtoupper(App::$language). "\r\n";
- if(array_key_exists('start', $ev))
+ if(array_key_exists('dtstart', $ev))
$o .= format_event_ical($ev);
else {
foreach($ev as $e) {
@@ -82,7 +113,7 @@ function ical_wrapper($ev) {
function format_event_ical($ev) {
- if($ev['type'] === 'task')
+ if($ev['etype'] === 'task')
return format_todo_ical($ev);
$o = '';
@@ -92,10 +123,10 @@ function format_event_ical($ev) {
$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 .= "\r\nDTSTART:" . datetime_convert('UTC','UTC', $ev['start'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
- if($ev['finish'] && ! $ev['nofinish'])
- $o .= "\r\nDTEND:" . datetime_convert('UTC','UTC', $ev['finish'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ if($ev['dtstart'])
+ $o .= "\r\nDTSTART:" . datetime_convert('UTC','UTC', $ev['dtstart'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ if($ev['dtend'] && ! $ev['nofinish'])
+ $o .= "\r\nDTEND:" . datetime_convert('UTC','UTC', $ev['dtend'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
if($ev['summary'])
$o .= "\r\nSUMMARY:" . format_ical_text($ev['summary']);
if($ev['location'])
@@ -119,10 +150,10 @@ function format_todo_ical($ev) {
$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 .= "\r\nDTSTART:" . datetime_convert('UTC','UTC', $ev['start'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
- if($ev['finish'] && ! $ev['nofinish'])
- $o .= "\r\nDUE:" . datetime_convert('UTC','UTC', $ev['finish'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ if($ev['dtstart'])
+ $o .= "\r\nDTSTART:" . datetime_convert('UTC','UTC', $ev['dtstart'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
+ if($ev['dtend'] && ! $ev['nofinish'])
+ $o .= "\r\nDUE:" . datetime_convert('UTC','UTC', $ev['dtend'],'Ymd\\THis' . (($ev['adjust']) ? '\\Z' : ''));
if($ev['summary'])
$o .= "\r\nSUMMARY:" . format_ical_text($ev['summary']);
if($ev['event_status']) {
@@ -166,11 +197,11 @@ function format_event_bbcode($ev) {
if($ev['description'])
$o .= '[event-description]' . $ev['description'] . '[/event-description]';
- if($ev['start'])
- $o .= '[event-start]' . $ev['start'] . '[/event-start]';
+ if($ev['dtstart'])
+ $o .= '[event-start]' . $ev['dtstart'] . '[/event-start]';
- if(($ev['finish']) && (! $ev['nofinish']))
- $o .= '[event-finish]' . $ev['finish'] . '[/event-finish]';
+ if(($ev['dtend']) && (! $ev['nofinish']))
+ $o .= '[event-finish]' . $ev['dtend'] . '[/event-finish]';
if($ev['location'])
$o .= '[event-location]' . $ev['location'] . '[/event-location]';
@@ -207,10 +238,10 @@ function bbtoevent($s) {
$ev['description'] = $match[1];
$match = '';
if(preg_match("/\[event\-start\](.*?)\[\/event\-start\]/is",$s,$match))
- $ev['start'] = $match[1];
+ $ev['dtstart'] = $match[1];
$match = '';
if(preg_match("/\[event\-finish\](.*?)\[\/event\-finish\]/is",$s,$match))
- $ev['finish'] = $match[1];
+ $ev['dtend'] = $match[1];
$match = '';
if(preg_match("/\[event\-location\](.*?)\[\/event\-location\]/is",$s,$match))
$ev['location'] = $match[1];
@@ -220,11 +251,11 @@ function bbtoevent($s) {
$match = '';
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
$ev['adjust'] = $match[1];
- if(array_key_exists('start',$ev)) {
- if(array_key_exists('finish',$ev)) {
- if($ev['finish'] === $ev['start'])
+ if(array_key_exists('dtstart',$ev)) {
+ if(array_key_exists('dtend',$ev)) {
+ if($ev['dtend'] === $ev['dtstart'])
$ev['nofinish'] = 1;
- elseif($ev['finish'])
+ elseif($ev['dtend'])
$ev['nofinish'] = 0;
else
$ev['nofinish'] = 1;
@@ -260,8 +291,8 @@ function sort_by_date($arr) {
*/
function ev_compare($a, $b) {
- $date_a = (($a['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$a['start']) : $a['start']);
- $date_b = (($b['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$b['start']) : $b['start']);
+ $date_a = (($a['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$a['dtstart']) : $a['dtstart']);
+ $date_b = (($b['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$b['dtstart']) : $b['dtstart']);
if ($date_a === $date_b)
return strcasecmp($a['description'], $b['description']);
@@ -274,7 +305,7 @@ 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['etype'] = (($arr['etype']) ? $arr['etype'] : 'event' );
$arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
$arr['event_priority'] = (($arr['event_priority']) ? $arr['event_priority'] : 0);
@@ -324,12 +355,12 @@ function event_store_event($arr) {
$r = q("UPDATE `event` SET
`edited` = '%s',
- `start` = '%s',
- `finish` = '%s',
+ `dtstart` = '%s',
+ `dtend` = '%s',
`summary` = '%s',
`description` = '%s',
`location` = '%s',
- `type` = '%s',
+ `etype` = '%s',
`adjust` = %d,
`nofinish` = %d,
`event_status` = '%s',
@@ -345,12 +376,12 @@ function event_store_event($arr) {
WHERE `id` = %d AND `uid` = %d",
dbesc($arr['edited']),
- dbesc($arr['start']),
- dbesc($arr['finish']),
+ dbesc($arr['dtstart']),
+ dbesc($arr['dtend']),
dbesc($arr['summary']),
dbesc($arr['description']),
dbesc($arr['location']),
- dbesc($arr['type']),
+ dbesc($arr['etype']),
intval($arr['adjust']),
intval($arr['nofinish']),
dbesc($arr['event_status']),
@@ -378,7 +409,7 @@ function event_store_event($arr) {
else
$hash = random_string() . '@' . App::get_hostname();
- $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
+ $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,dtstart,dtend,summary,description,location,etype,
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']),
@@ -387,12 +418,12 @@ function event_store_event($arr) {
dbesc($hash),
dbesc($arr['created']),
dbesc($arr['edited']),
- dbesc($arr['start']),
- dbesc($arr['finish']),
+ dbesc($arr['dtstart']),
+ dbesc($arr['dtend']),
dbesc($arr['summary']),
dbesc($arr['description']),
dbesc($arr['location']),
- dbesc($arr['type']),
+ dbesc($arr['etype']),
intval($arr['adjust']),
intval($arr['nofinish']),
dbesc($arr['event_status']),
@@ -441,7 +472,7 @@ function event_addtocal($item_id, $uid) {
$ev = bbtoevent($r[0]['body']);
- if(x($ev,'summary') && x($ev,'start')) {
+ if(x($ev,'summary') && x($ev,'dtstart')) {
$ev['event_xchan'] = $item['author_xchan'];
$ev['uid'] = $channel['channel_id'];
$ev['account'] = $channel['channel_account_id'];
@@ -554,20 +585,20 @@ function event_import_ical($ical, $uid) {
// logger('dtstart: ' . var_export($dtstart,true));
- $ev['start'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
+ $ev['dtstart'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
$dtstart->format(\DateTime::W3C));
if(isset($ical->DTEND)) {
$dtend = $ical->DTEND->getDateTime();
- $ev['finish'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
+ $ev['dtend'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
$dtend->format(\DateTime::W3C));
}
else
$ev['nofinish'] = 1;
- if($ev['start'] === $ev['finish'])
+ if($ev['dtstart'] === $ev['dtend'])
$ev['nofinish'] = 1;
if(isset($ical->CREATED)) {
@@ -601,7 +632,7 @@ function event_import_ical($ical, $uid) {
$ev['external_id'] = $evuid;
}
- if($ev['summary'] && $ev['start']) {
+ if($ev['summary'] && $ev['dtstart']) {
$ev['event_xchan'] = $channel['channel_hash'];
$ev['uid'] = $channel['channel_id'];
$ev['account'] = $channel['channel_account_id'];
@@ -640,29 +671,24 @@ function event_import_ical_task($ical, $uid) {
$dtstart = $ical->DTSTART->getDateTime();
+ $ev['adjust'] = (($ical->DTSTART->isFloating()) ? 1 : 0);
+
// logger('dtstart: ' . var_export($dtstart,true));
- if(($dtstart->timezone_type == 2) || (($dtstart->timezone_type == 3) && ($dtstart->timezone === 'UTC'))) {
- $ev['adjust'] = 1;
- }
- else {
- $ev['adjust'] = 0;
- }
-
- $ev['start'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
+ $ev['dtstart'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
$dtstart->format(\DateTime::W3C));
if(isset($ical->DUE)) {
$dtend = $ical->DUE->getDateTime();
- $ev['finish'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
+ $ev['dtend'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
$dtend->format(\DateTime::W3C));
}
else
$ev['nofinish'] = 1;
- if($ev['start'] === $ev['finish'])
+ if($ev['dtstart'] === $ev['dtend'])
$ev['nofinish'] = 1;
if(isset($ical->CREATED)) {
@@ -727,9 +753,9 @@ function event_import_ical_task($ical, $uid) {
$ev['event_percent'] = (string) $ical->{'PERCENT-COMPLETE'} ;
}
- $ev['type'] = 'task';
+ $ev['etype'] = 'task';
- if($ev['summary'] && $ev['start']) {
+ if($ev['summary'] && $ev['dtstart']) {
$ev['event_xchan'] = $channel['channel_hash'];
$ev['uid'] = $channel['channel_id'];
$ev['account'] = $channel['channel_account_id'];
@@ -781,7 +807,7 @@ function event_store_item($arr, $event) {
if(($event) && array_key_exists('event_hash',$event) && (! array_key_exists('event_hash',$arr)))
$arr['event_hash'] = $event['event_hash'];
- if($event['type'] === 'birthday') {
+ if($event['etype'] === 'birthday') {
if(! is_sys_channel($arr['uid']))
$prefix = t('This event has been added to your calendar.');
// $birthday = true;
@@ -805,21 +831,22 @@ function event_store_item($arr, $event) {
'type' => ACTIVITY_OBJ_EVENT,
'id' => z_root() . '/event/' . $r[0]['resource_id'],
'title' => $arr['summary'],
- 'start' => $arr['start'],
- 'finish' => $arr['finish'],
+ 'dtstart' => $arr['dtstart'],
+ 'dtend' => $arr['dtend'],
'nofinish' => $arr['nofinish'],
'description' => $arr['description'],
'location' => $arr['location'],
'adjust' => $arr['adjust'],
'content' => format_event_bbcode($arr),
'author' => array(
- 'name' => $r[0]['xchan_name'],
- 'address' => $r[0]['xchan_addr'],
- 'guid' => $r[0]['xchan_guid'],
- 'guid_sig' => $r[0]['xchan_guid_sig'],
- 'link' => array(
- array('rel' => 'alternate', 'type' => 'text/html', 'href' => $r[0]['xchan_url']),
- array('rel' => 'photo', 'type' => $r[0]['xchan_photo_mimetype'], 'href' => $r[0]['xchan_photo_m'])),
+ 'name' => $r[0]['xchan_name'],
+ 'address' => $r[0]['xchan_addr'],
+ 'guid' => $r[0]['xchan_guid'],
+ 'guid_sig' => $r[0]['xchan_guid_sig'],
+ 'link' => array(
+ array('rel' => 'alternate', 'type' => 'text/html', 'href' => $r[0]['xchan_url']),
+ array('rel' => 'photo', 'type' => $r[0]['xchan_photo_mimetype'], 'href' => $r[0]['xchan_photo_m'])
+ ),
),
));
@@ -830,7 +857,7 @@ function event_store_item($arr, $event) {
$sig = '';
- q("UPDATE item SET title = '%s', body = '%s', object = '%s', allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', edited = '%s', sig = '%s', item_flags = %d, item_private = %d, obj_type = '%s' WHERE id = %d AND uid = %d",
+ q("UPDATE item SET title = '%s', body = '%s', obj = '%s', allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', edited = '%s', sig = '%s', item_flags = %d, item_private = %d, obj_type = '%s' WHERE id = %d AND uid = %d",
dbesc($arr['summary']),
dbesc($prefix . format_event_bbcode($arr)),
dbesc($object),
@@ -946,12 +973,12 @@ function event_store_item($arr, $event) {
dbesc($arr['event_xchan'])
);
if($x) {
- $item_arr['object'] = json_encode(array(
+ $item_arr['obj'] = json_encode(array(
'type' => ACTIVITY_OBJ_EVENT,
'id' => z_root() . '/event/' . $event['event_hash'],
'title' => $arr['summary'],
- 'start' => $arr['start'],
- 'finish' => $arr['finish'],
+ 'dtstart' => $arr['dtstart'],
+ 'dtend' => $arr['dtend'],
'nofinish' => $arr['nofinish'],
'description' => $arr['description'],
'location' => $arr['location'],
@@ -1001,7 +1028,7 @@ function tasks_fetch($arr) {
if($arr && $arr['all'] == 1)
$sql_extra = '';
- $r = q("select * from event where type = 'task' and uid = %d $sql_extra order by created desc",
+ $r = q("select * from event where etype = 'task' and uid = %d $sql_extra order by created desc",
intval(local_channel())
);
diff --git a/include/feedutils.php b/include/feedutils.php
index fb938cfdd..685b2f982 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -144,9 +144,9 @@ function construct_verb($item) {
function construct_activity_object($item) {
- if($item['object']) {
+ if($item['obj']) {
$o = '<as:object>' . "\r\n";
- $r = json_decode($item['object'],false);
+ $r = json_decode($item['obj'],false);
if(! $r)
return '';
@@ -582,7 +582,7 @@ function get_atom_elements($feed, $item, &$author) {
$obj['content'] = $body;
}
- $res['object'] = $obj;
+ $res['obj'] = $obj;
}
$rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'target');
@@ -1163,12 +1163,12 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
}
if(activity_match($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_match($item['verb'],ACTIVITY_POST)) {
- $obj = ((is_array($item['obj'])) ? $item['object'] : json_decode($item['object'],true));
+ $obj = ((is_array($item['obj'])) ? $item['obj'] : json_decode($item['obj'],true));
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
$o .= '<summary xmlns="urn:ietf:params:xml:ns:xcal">' . xmlify(bbcode($obj['title'])) . '</summary>' . "\r\n";
- $o .= '<dtstart xmlns="urn:ietf:params:xml:ns:xcal">' . datetime_convert('UTC','UTC', $obj['start'],'Ymd\\THis' . (($obj['adjust']) ? '\\Z' : '')) . '</dtstart>' . "\r\n";
- $o .= '<dtend xmlns="urn:ietf:params:xml:ns:xcal">' . datetime_convert('UTC','UTC', $obj['finish'],'Ymd\\THis' . (($obj['adjust']) ? '\\Z' : '')) . '</dtend>' . "\r\n";
+ $o .= '<dtstart xmlns="urn:ietf:params:xml:ns:xcal">' . datetime_convert('UTC','UTC', $obj['dtstart'],'Ymd\\THis' . (($obj['adjust']) ? '\\Z' : '')) . '</dtstart>' . "\r\n";
+ $o .= '<dtend xmlns="urn:ietf:params:xml:ns:xcal">' . datetime_convert('UTC','UTC', $obj['dtend'],'Ymd\\THis' . (($obj['adjust']) ? '\\Z' : '')) . '</dtend>' . "\r\n";
$o .= '<location xmlns="urn:ietf:params:xml:ns:xcal">' . xmlify(bbcode($obj['location'])) . '</location>' . "\r\n";
$o .= '<content type="' . $type . '" >' . xmlify(bbcode($obj['description'])) . '</content>' . "\r\n";
}
diff --git a/include/import.php b/include/import.php
index d094fb582..6fcb08416 100644
--- a/include/import.php
+++ b/include/import.php
@@ -974,6 +974,11 @@ function sync_files($channel,$files) {
$attachment_stored = false;
foreach($f['attach'] as $att) {
+ if(array_key_exists('data',$att)) {
+ $att['content'] = $att['data'];
+ unset($att['data']);
+ }
+
if($att['deleted']) {
attach_delete($channel,$att['hash']);
continue;
@@ -1043,7 +1048,7 @@ function sync_files($channel,$files) {
// @fixme - update attachment structures if they are modified rather than created
- $att['data'] = $newfname;
+ $att['content'] = $newfname;
// Note: we use $att['hash'] below after it has been escaped to
// fetch the file contents.
@@ -1125,6 +1130,15 @@ function sync_files($channel,$files) {
$p['aid'] = $channel['channel_account_id'];
$p['uid'] = $channel['channel_id'];
+ if(array_key_exists('data',$p)) {
+ $p['content'] = $p['data'];
+ unset($p['data']);
+ }
+ if(array_key_exists('scale',$p)) {
+ $p['imgscale'] = $p['scale'];
+ unset($p['scale']);
+ }
+
// if this is a profile photo, undo the profile photo bit
// for any other photo which previously held it.
@@ -1150,15 +1164,15 @@ function sync_files($channel,$files) {
);
}
- if($p['scale'] === 0 && $p['os_storage'])
- $p['data'] = $store_path;
+ if($p['imgscale'] === 0 && $p['os_storage'])
+ $p['content'] = $store_path;
else
- $p['data'] = base64_decode($p['data']);
+ $p['content'] = base64_decode($p['content']);
- $exists = q("select * from photo where resource_id = '%s' and scale = %d and uid = %d limit 1",
+ $exists = q("select * from photo where resource_id = '%s' and imgscale = %d and uid = %d limit 1",
dbesc($p['resource_id']),
- intval($p['scale']),
+ intval($p['imgscale']),
intval($channel['channel_id'])
);
diff --git a/include/items.php b/include/items.php
index b283ed3ab..f473b2bac 100755
--- a/include/items.php
+++ b/include/items.php
@@ -666,7 +666,7 @@ function get_item_elements($x,$allow_code = false) {
$arr['diaspora_meta'] = (($x['diaspora_signature']) ? $x['diaspora_signature'] : '');
- $arr['object'] = activity_sanitise($x['object']);
+ $arr['obj'] = activity_sanitise($x['object']);
$arr['target'] = activity_sanitise($x['target']);
$arr['attach'] = activity_sanitise($x['attach']);
@@ -1055,8 +1055,8 @@ function encode_item($item,$mirror = false) {
$x['owner'] = encode_item_xchan($item['owner']);
$x['author'] = encode_item_xchan($item['author']);
- if($item['object'])
- $x['object'] = json_decode_plus($item['object']);
+ if($item['obj'])
+ $x['object'] = json_decode_plus($item['obj']);
if($item['target'])
$x['target'] = json_decode_plus($item['target']);
if($item['attach'])
@@ -1595,9 +1595,9 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
}
}
- if((x($arr,'object')) && is_array($arr['object'])) {
- activity_sanitise($arr['object']);
- $arr['object'] = json_encode($arr['object']);
+ if((x($arr,'obj')) && is_array($arr['obj'])) {
+ activity_sanitise($arr['obj']);
+ $arr['obj'] = json_encode($arr['obj']);
}
if((x($arr,'target')) && is_array($arr['target'])) {
@@ -1628,7 +1628,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
$arr['thr_parent'] = ((x($arr,'thr_parent')) ? notags(trim($arr['thr_parent'])) : $arr['parent_mid']);
$arr['verb'] = ((x($arr,'verb')) ? notags(trim($arr['verb'])) : ACTIVITY_POST);
$arr['obj_type'] = ((x($arr,'obj_type')) ? notags(trim($arr['obj_type'])) : ACTIVITY_OBJ_NOTE);
- $arr['object'] = ((x($arr,'object')) ? trim($arr['object']) : '');
+ $arr['obj'] = ((x($arr,'obj')) ? trim($arr['obj']) : '');
$arr['tgt_type'] = ((x($arr,'tgt_type')) ? notags(trim($arr['tgt_type'])) : '');
$arr['target'] = ((x($arr,'target')) ? trim($arr['target']) : '');
$arr['plink'] = ((x($arr,'plink')) ? notags(trim($arr['plink'])) : '');
@@ -1697,7 +1697,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
return $ret;
}
- if(($arr['obj_type'] == ACTIVITY_OBJ_NOTE) && (! $arr['object']))
+ if(($arr['obj_type'] == ACTIVITY_OBJ_NOTE) && (! $arr['obj']))
$arr['obj_type'] = ACTIVITY_OBJ_COMMENT;
// is the new message multi-level threaded?
@@ -1991,9 +1991,9 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
}
}
- if((x($arr,'object')) && is_array($arr['object'])) {
- activity_sanitise($arr['object']);
- $arr['object'] = json_encode($arr['object']);
+ if((x($arr,'obj')) && is_array($arr['obj'])) {
+ activity_sanitise($arr['obj']);
+ $arr['obj'] = json_encode($arr['obj']);
}
if((x($arr,'target')) && is_array($arr['target'])) {
@@ -2035,7 +2035,7 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
$arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : $orig[0]['coord']);
$arr['verb'] = ((x($arr,'verb')) ? notags(trim($arr['verb'])) : $orig[0]['verb']);
$arr['obj_type'] = ((x($arr,'obj_type')) ? notags(trim($arr['obj_type'])) : $orig[0]['obj_type']);
- $arr['object'] = ((x($arr,'object')) ? trim($arr['object']) : $orig[0]['object']);
+ $arr['obj'] = ((x($arr,'obj')) ? trim($arr['obj']) : $orig[0]['obj']);
$arr['tgt_type'] = ((x($arr,'tgt_type')) ? notags(trim($arr['tgt_type'])) : $orig[0]['tgt_type']);
$arr['target'] = ((x($arr,'target')) ? trim($arr['target']) : $orig[0]['target']);
$arr['plink'] = ((x($arr,'plink')) ? notags(trim($arr['plink'])) : $orig[0]['plink']);
@@ -2369,10 +2369,10 @@ function tag_deliver($uid, $item_id) {
if (stristr($item['verb'],ACTIVITY_POKE)) {
$poke_notify = true;
- if(($item['obj_type'] == "") || ($item['obj_type'] !== ACTIVITY_OBJ_PERSON) || (! $item['object']))
+ if(($item['obj_type'] == "") || ($item['obj_type'] !== ACTIVITY_OBJ_PERSON) || (! $item['obj']))
$poke_notify = false;
- $obj = json_decode_plus($item['object']);
+ $obj = json_decode_plus($item['obj']);
if($obj) {
if($obj['id'] !== $u[0]['channel_hash'])
$poke_notify = false;
@@ -2416,7 +2416,7 @@ function tag_deliver($uid, $item_id) {
intval($u[0]['channel_id'])
);
if($p) {
- $j_obj = json_decode_plus($item['object']);
+ $j_obj = json_decode_plus($item['obj']);
logger('tag_deliver: tag object: ' . print_r($j_obj,true), LOGGER_DATA);
if($j_obj && $j_obj['id'] && $j_obj['title']) {
if(is_array($j_obj['link']))
@@ -3093,7 +3093,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
if($x) {
$res = substr($i,$x+1);
$i = substr($i,0,$x);
- $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d AND `uid` = %d",
+ $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `imgscale` = %d AND `uid` = %d",
dbesc($i),
intval($res),
intval($uid)
@@ -4263,7 +4263,7 @@ function send_profile_photo_activity($channel,$photo,$profile) {
$arr['obj_type'] = ACTIVITY_OBJ_PHOTO;
$arr['verb'] = ACTIVITY_UPDATE;
- $arr['object'] = json_encode(array(
+ $arr['obj'] = json_encode(array(
'type' => $arr['obj_type'],
'id' => z_root() . '/photo/profile/l/' . $channel['channel_id'],
'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id'])
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index e57a9165a..6de75d497 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -316,7 +316,7 @@ abstract class photo_driver {
$p['resource_id'] = (($arr['resource_id']) ? $arr['resource_id'] : '');
$p['filename'] = (($arr['filename']) ? $arr['filename'] : '');
$p['album'] = (($arr['album']) ? $arr['album'] : '');
- $p['scale'] = ((intval($arr['scale'])) ? intval($arr['scale']) : 0);
+ $p['imgscale'] = ((intval($arr['imgscale'])) ? intval($arr['imgscale']) : 0);
$p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : '');
$p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : '');
$p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : '');
@@ -329,14 +329,14 @@ abstract class photo_driver {
$p['os_storage'] = intval($arr['os_storage']);
$p['os_path'] = $arr['os_path'];
- if(! intval($p['scale']))
- logger('save: ' . print_r($arr,true));
+ if(! intval($p['imgscale']))
+ logger('save: ' . print_r($arr,true), LOGGER_DATA);
- $x = q("select id from photo where resource_id = '%s' and uid = %d and xchan = '%s' and `scale` = %d limit 1",
+ $x = q("select id from photo where resource_id = '%s' and uid = %d and xchan = '%s' and imgscale = %d limit 1",
dbesc($p['resource_id']),
intval($p['uid']),
dbesc($p['xchan']),
- intval($p['scale'])
+ intval($p['imgscale'])
);
if($x) {
$r = q("UPDATE `photo` set
@@ -347,14 +347,14 @@ abstract class photo_driver {
`created` = '%s',
`edited` = '%s',
`filename` = '%s',
- `type` = '%s',
+ `mimetype` = '%s',
`album` = '%s',
`height` = %d,
`width` = %d,
- `data` = '%s',
+ `content` = '%s',
`os_storage` = %d,
- `size` = %d,
- `scale` = %d,
+ `filesize` = %d,
+ `imgscale` = %d,
`photo_usage` = %d,
`title` = '%s',
`description` = '%s',
@@ -378,7 +378,7 @@ abstract class photo_driver {
(intval($p['os_storage']) ? dbesc($p['os_path']) : dbescbin($this->imageString())),
intval($p['os_storage']),
intval(strlen($this->imageString())),
- intval($p['scale']),
+ intval($p['imgscale']),
intval($p['photo_usage']),
dbesc($p['title']),
dbesc($p['description']),
@@ -391,7 +391,7 @@ abstract class photo_driver {
}
else {
$r = q("INSERT INTO `photo`
- ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `os_storage`, `size`, `scale`, `photo_usage`, `title`, `description`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
+ ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, mimetype, `album`, `height`, `width`, `content`, `os_storage`, `filesize`, `imgscale`, `photo_usage`, `title`, `description`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($p['aid']),
intval($p['uid']),
@@ -407,7 +407,7 @@ abstract class photo_driver {
(intval($p['os_storage']) ? dbesc($p['os_path']) : dbescbin($this->imageString())),
intval($p['os_storage']),
intval(strlen($this->imageString())),
- intval($p['scale']),
+ intval($p['imgscale']),
intval($p['photo_usage']),
dbesc($p['title']),
dbesc($p['description']),
@@ -422,7 +422,7 @@ abstract class photo_driver {
public function store($aid, $uid, $xchan, $rid, $filename, $album, $scale, $usage = PHOTO_NORMAL, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') {
- $x = q("select id from photo where `resource_id` = '%s' and uid = %d and `xchan` = '%s' and `scale` = %d limit 1",
+ $x = q("select id from photo where `resource_id` = '%s' and uid = %d and `xchan` = '%s' and `imgscale` = %d limit 1",
dbesc($rid),
intval($uid),
dbesc($xchan),
@@ -437,13 +437,13 @@ abstract class photo_driver {
`created` = '%s',
`edited` = '%s',
`filename` = '%s',
- `type` = '%s',
+ `mimetype` = '%s',
`album` = '%s',
`height` = %d,
`width` = %d,
- `data` = '%s',
- `size` = %d,
- `scale` = %d,
+ `content` = '%s',
+ `filesize` = %d,
+ `imgscale` = %d,
`photo_usage` = %d,
`allow_cid` = '%s',
`allow_gid` = '%s',
@@ -475,7 +475,7 @@ abstract class photo_driver {
}
else {
$r = q("INSERT INTO `photo`
- ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `size`, `scale`, `photo_usage`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
+ ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, mimetype, `album`, `height`, `width`, `content`, `filesize`, `imgscale`, `photo_usage`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s' )",
intval($aid),
intval($uid),
@@ -588,7 +588,7 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
if($thing)
$hash = photo_new_resource();
else {
- $r = q("select resource_id from photo where xchan = '%s' and photo_usage = %d and scale = 4 limit 1",
+ $r = q("select resource_id from photo where xchan = '%s' and photo_usage = %d and imgscale = 4 limit 1",
dbesc($xchan),
intval(PHOTO_XCHAN)
);
@@ -654,7 +654,7 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
else
$photo_failure = true;
- $p = array('xchan' => $xchan,'resource_id' => $hash, 'filename' => basename($photo), 'album' => $album, 'photo_usage' => $flags, 'scale' => 4);
+ $p = array('xchan' => $xchan,'resource_id' => $hash, 'filename' => basename($photo), 'album' => $album, 'photo_usage' => $flags, 'imgscale' => 4);
$r = $img->save($p);
@@ -662,7 +662,7 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
$photo_failure = true;
$img->scaleImage(80);
- $p['scale'] = 5;
+ $p['imgscale'] = 5;
$r = $img->save($p);
@@ -670,7 +670,7 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
$photo_failure = true;
$img->scaleImage(48);
- $p['scale'] = 6;
+ $p['imgscale'] = 6;
$r = $img->save($p);
@@ -715,7 +715,7 @@ function import_channel_photo($photo,$type,$aid,$uid) {
$img->scaleImageSquare(300);
- $p = array('aid' => $aid, 'uid' => $uid, 'resource_id' => $hash, 'filename' => $filename, 'album' => t('Profile Photos'), 'photo_usage' => PHOTO_PROFILE, 'scale' => 4);
+ $p = array('aid' => $aid, 'uid' => $uid, 'resource_id' => $hash, 'filename' => $filename, 'album' => t('Profile Photos'), 'photo_usage' => PHOTO_PROFILE, 'imgscale' => 4);
$r = $img->save($p);
@@ -723,7 +723,7 @@ function import_channel_photo($photo,$type,$aid,$uid) {
$photo_failure = true;
$img->scaleImage(80);
- $p['scale'] = 5;
+ $p['imgscale'] = 5;
$r = $img->save($p);
@@ -731,7 +731,7 @@ function import_channel_photo($photo,$type,$aid,$uid) {
$photo_failure = true;
$img->scaleImage(48);
- $p['scale'] = 6;
+ $p['imgscale'] = 6;
$r = $img->save($p);
diff --git a/include/photos.php b/include/photos.php
index c333a4d04..1cc64f6fa 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -71,17 +71,17 @@ function photo_upload($channel, $observer, $args) {
$type = $args['getimagesize']['mime'];
$os_storage = 1;
}
- elseif ($args['data']) {
+ elseif ($args['data'] || $args['content']) {
// allow an import from a binary string representing the image.
// This bypasses the upload step and max size limit checking
- $imagedata = $args['data'];
+ $imagedata = (($args['content']) ? $args['content'] : $args['data']);
$filename = $args['filename'];
$filesize = strlen($imagedata);
// this is going to be deleted if it exists
$src = '/tmp/deletemenow';
- $type = $args['type'];
+ $type = (($args['mimetype']) ? $args['mimetype'] : $args['type']);
} else {
$f = array('src' => '', 'filename' => '', 'filesize' => 0, 'type' => '');
@@ -125,7 +125,7 @@ function photo_upload($channel, $observer, $args) {
$imagedata = @file_get_contents($src);
}
- $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ",
+ $r = q("select sum(filesize) as total from photo where aid = %d and imgscale = 0 ",
intval($account_id)
);
@@ -172,7 +172,7 @@ function photo_upload($channel, $observer, $args) {
$errors = false;
$p = array('aid' => $account_id, 'uid' => $channel_id, 'xchan' => $visitor, 'resource_id' => $photo_hash,
- 'filename' => $filename, 'album' => $album, 'scale' => 0, 'photo_usage' => PHOTO_NORMAL,
+ 'filename' => $filename, 'album' => $album, 'imgscale' => 0, 'photo_usage' => PHOTO_NORMAL,
'allow_cid' => $ac['allow_cid'], 'allow_gid' => $ac['allow_gid'],
'deny_cid' => $ac['deny_cid'], 'deny_gid' => $ac['deny_gid'],
'os_storage' => $os_storage, 'os_path' => $args['os_path']
@@ -205,7 +205,7 @@ function photo_upload($channel, $observer, $args) {
if(($width > 1024 || $height > 1024) && (! $errors))
$ph->scaleImage(1024);
- $p['scale'] = 1;
+ $p['imgscale'] = 1;
$r1 = $ph->save($p);
$link[1] = array(
'rel' => 'alternate',
@@ -220,7 +220,7 @@ function photo_upload($channel, $observer, $args) {
if(($width > 640 || $height > 640) && (! $errors))
$ph->scaleImage(640);
- $p['scale'] = 2;
+ $p['imgscale'] = 2;
$r2 = $ph->save($p);
$link[2] = array(
'rel' => 'alternate',
@@ -235,7 +235,7 @@ function photo_upload($channel, $observer, $args) {
if(($width > 320 || $height > 320) && (! $errors))
$ph->scaleImage(320);
- $p['scale'] = 3;
+ $p['imgscale'] = 3;
$r3 = $ph->save($p);
$link[3] = array(
'rel' => 'alternate',
@@ -332,7 +332,7 @@ function photo_upload($channel, $observer, $args) {
$item['body'] = $args['body'];
$item['obj_type'] = ACTIVITY_OBJ_PHOTO;
- $item['object'] = json_encode($object);
+ $item['obj'] = json_encode($object);
$item['tgt_type'] = ACTIVITY_OBJ_ALBUM;
$item['target'] = json_encode($target);
@@ -389,8 +389,8 @@ function photo_upload($channel, $observer, $args) {
$arr['deny_cid'] = $ac['deny_cid'];
$arr['deny_gid'] = $ac['deny_gid'];
$arr['verb'] = ACTIVITY_POST;
- $arr['obj_type'] = ACTIVITY_OBJ_PHOTO;
- $arr['object'] = json_encode($object);
+ $arr['obj_type'] = ACTIVITY_OBJ_PHOTO;
+ $arr['obj'] = json_encode($object);
$arr['tgt_type'] = ACTIVITY_OBJ_ALBUM;
$arr['target'] = json_encode($target);
$arr['item_wall'] = 1;
@@ -535,7 +535,7 @@ function photos_list_photos($channel, $observer, $album = '') {
$ret = array('success' => false);
- $r = q("select resource_id, created, edited, title, description, album, filename, type, height, width, size, scale, photo_usage, allow_cid, allow_gid, deny_cid, deny_gid from photo where uid = %d and photo_usage in ( %d, %d ) $sql_extra ",
+ $r = q("select resource_id, created, edited, title, description, album, filename, mimetype, height, width, filesize, imgscale, photo_usage, allow_cid, allow_gid, deny_cid, deny_gid from photo where uid = %d and photo_usage in ( %d, %d ) $sql_extra ",
intval($channel_id),
intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE)
@@ -543,7 +543,7 @@ function photos_list_photos($channel, $observer, $album = '') {
if($r) {
for($x = 0; $x < count($r); $x ++) {
- $r[$x]['src'] = z_root() . '/photo/' . $r[$x]['resource_id'] . '-' . $r[$x]['scale'];
+ $r[$x]['src'] = z_root() . '/photo/' . $r[$x]['resource_id'] . '-' . $r[$x]['imgscale'];
}
$ret['success'] = true;
$ret['photos'] = $r;
@@ -661,7 +661,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
$arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']'
- . '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/zmg]'
+ . '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['imgscale'] . '[/zmg]'
. '[/zrl]';
$result = item_store($arr);
diff --git a/include/sharedwithme.php b/include/sharedwithme.php
index b01764ad3..b342f51d5 100644
--- a/include/sharedwithme.php
+++ b/include/sharedwithme.php
@@ -3,7 +3,7 @@
function apply_updates() {
//check for updated items and remove them
- $x = q("SELECT mid, max(object) AS object FROM item WHERE verb = '%s' AND obj_type = '%s' GROUP BY mid",
+ $x = q("SELECT mid, max(obj) AS obj FROM item WHERE verb = '%s' AND obj_type = '%s' GROUP BY mid",
dbesc(ACTIVITY_UPDATE),
dbesc(ACTIVITY_OBJ_FILE)
);
@@ -12,7 +12,7 @@ function apply_updates() {
foreach($x as $xx) {
- $object = json_decode($xx['object'],true);
+ $object = json_decode($xx['obj'],true);
$d_mid = $object['d_mid'];
$u_mid = $xx['mid'];
diff --git a/include/text.php b/include/text.php
index c57f5fce4..551cb72bc 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1458,37 +1458,6 @@ function generate_named_map($location) {
return (($arr['html']) ? $arr['html'] : $location);
}
-function format_event($jobject) {
- $event = array();
-
- $object = json_decode($jobject,true);
-
- //ensure compatibility with older items - this check can be removed at a later point
- if(array_key_exists('description', $object)) {
-
- $bd_format = t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM
-
- $event['header'] = replace_macros(get_markup_template('event_item_header.tpl'),array(
- '$title' => bbcode($object['title']),
- '$dtstart_label' => t('Starts:'),
- '$dtstart_title' => datetime_convert('UTC', 'UTC', $object['start'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
- '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['start'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['start'] , $bd_format))),
- '$finish' => (($object['nofinish']) ? false : true),
- '$dtend_label' => t('Finishes:'),
- '$dtend_title' => datetime_convert('UTC','UTC',$object['finish'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
- '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['finish'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['finish'] , $bd_format )))
- ));
-
- $event['content'] = replace_macros(get_markup_template('event_item_content.tpl'),array(
- '$description' => bbcode($object['description']),
- '$location_label' => t('Location:'),
- '$location' => bbcode($object['location'])
- ));
-
- }
-
- return $event;
-}
function prepare_body(&$item,$attach = false) {
@@ -1516,7 +1485,7 @@ function prepare_body(&$item,$attach = false) {
$s .= prepare_text($item['body'],$item['mimetype'], false);
- $event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event($item['object']) : false);
+ $event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : false);
$prep_arr = array(
'item' => $item,
diff --git a/include/widgets.php b/include/widgets.php
index 17a76c0f4..3448aeb5e 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1126,7 +1126,7 @@ function widget_photo_rand($arr) {
$filtered = array();
if($ret['success'] && $ret['photos'])
foreach($ret['photos'] as $p)
- if($p['scale'] == $scale)
+ if($p['imgscale'] == $scale)
$filtered[] = $p['src'];
if($filtered) {
@@ -1459,9 +1459,9 @@ function widget_album($args) {
$order = 'DESC';
- $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.scale, p.description, p.created FROM photo p INNER JOIN
- (SELECT resource_id, max(scale) scale FROM photo WHERE uid = %d AND album = '%s' AND scale <= 4 AND photo_usage IN ( %d, %d ) $sql_extra GROUP BY resource_id) ph
- ON (p.resource_id = ph.resource_id AND p.scale = ph.scale)
+ $r = q("SELECT p.resource_id, p.id, p.filename, p.mimetype, p.imgscale, p.description, p.created FROM photo p INNER JOIN
+ (SELECT resource_id, max(imgscale) imgscale FROM photo WHERE uid = %d AND album = '%s' AND imgscale <= 4 AND photo_usage IN ( %d, %d ) $sql_extra GROUP BY resource_id) ph
+ ON (p.resource_id = ph.resource_id AND p.imgscale = ph.imgscale)
ORDER BY created $order ",
intval($owner_uid),
dbesc($album),
@@ -1482,7 +1482,7 @@ function widget_album($args) {
else
$twist = 'rotright';
- $ext = $phototypes[$rr['type']];
+ $ext = $phototypes[$rr['mimetype']];
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
@@ -1495,7 +1495,7 @@ function widget_album($args) {
'twist' => ' ' . $twist . rand(2,4),
'link' => $imagelink,
'title' => t('View Photo'),
- 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
+ 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['imgscale'] . '.' .$ext,
'alt' => $imgalt_e,
'desc'=> $desc_e,
'ext' => $ext,
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index e5bb7b889..a536c3f9a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -158,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `attach` (
`os_storage` tinyint(1) NOT NULL DEFAULT '0',
`os_path` mediumtext NOT NULL,
`display_path` mediumtext NOT NULL,
- `data` longblob NOT NULL,
+ `content` longblob NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`allow_cid` mediumtext NOT NULL,
@@ -398,15 +398,15 @@ CREATE TABLE IF NOT EXISTS `event` (
`event_hash` char(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `finish` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `dtstart` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `dtend` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`summary` text NOT NULL,
`description` text NOT NULL,
`location` text NOT NULL,
- `type` char(255) NOT NULL DEFAULT '',
+ `etype` char(255) NOT NULL DEFAULT '',
`nofinish` tinyint(1) NOT NULL DEFAULT '0',
`adjust` tinyint(1) NOT NULL DEFAULT '1',
- `ignore` tinyint(1) NOT NULL DEFAULT '0',
+ `dismissed` tinyint(1) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@@ -420,12 +420,12 @@ CREATE TABLE IF NOT EXISTS `event` (
`event_vdata` text NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
- KEY `type` (`type`),
- KEY `start` (`start`),
- KEY `finish` (`finish`),
+ KEY `etype` (`etype`),
+ KEY `dtstart` (`dtstart`),
+ KEY `dtend` (`dtend`),
KEY `adjust` (`adjust`),
KEY `nofinish` (`nofinish`),
- KEY `ignore` (`ignore`),
+ KEY `dismissed` (`dismissed`),
KEY `aid` (`aid`),
KEY `event_hash` (`event_hash`),
KEY `event_xchan` (`event_xchan`),
@@ -569,7 +569,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`revision` int(10) unsigned NOT NULL DEFAULT '0',
`verb` char(255) NOT NULL DEFAULT '',
`obj_type` char(255) NOT NULL DEFAULT '',
- `object` text NOT NULL,
+ `obj` text NOT NULL,
`tgt_type` char(255) NOT NULL DEFAULT '',
`target` text NOT NULL,
`layout_mid` char(255) NOT NULL DEFAULT '',
@@ -791,24 +791,24 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
CREATE TABLE IF NOT EXISTS `notify` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hash` char(64) NOT NULL DEFAULT '',
- `name` char(255) NOT NULL DEFAULT '',
+ `xname` char(255) NOT NULL DEFAULT '',
`url` char(255) NOT NULL DEFAULT '',
`photo` char(255) NOT NULL DEFAULT '',
- `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`msg` mediumtext NOT NULL,
`aid` int(11) NOT NULL DEFAULT '0',
`uid` int(11) NOT NULL DEFAULT '0',
`link` char(255) NOT NULL DEFAULT '',
`parent` char(255) NOT NULL DEFAULT '',
`seen` tinyint(1) NOT NULL DEFAULT '0',
- `type` int(11) NOT NULL DEFAULT '0',
+ `ntype` int(11) NOT NULL DEFAULT '0',
`verb` char(255) NOT NULL DEFAULT '',
`otype` char(16) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
- KEY `type` (`type`),
+ KEY `ntype` (`ntype`),
KEY `seen` (`seen`),
KEY `uid` (`uid`),
- KEY `date` (`date`),
+ KEY `created` (`created`),
KEY `hash` (`hash`),
KEY `parent` (`parent`),
KEY `link` (`link`),
@@ -893,12 +893,12 @@ CREATE TABLE IF NOT EXISTS `photo` (
`description` text NOT NULL,
`album` char(255) NOT NULL DEFAULT '',
`filename` char(255) NOT NULL DEFAULT '',
- `type` char(128) NOT NULL DEFAULT 'image/jpeg',
+ `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg',
`height` smallint(6) NOT NULL DEFAULT '0',
`width` smallint(6) NOT NULL DEFAULT '0',
- `size` int(10) unsigned NOT NULL DEFAULT '0',
- `data` mediumblob NOT NULL,
- `scale` tinyint(3) NOT NULL DEFAULT '0',
+ `filesize` int(10) unsigned NOT NULL DEFAULT '0',
+ `content` mediumblob NOT NULL,
+ `imgscale` tinyint(3) NOT NULL DEFAULT '0',
`photo_usage` smallint(6) NOT NULL DEFAULT '0',
`profile` tinyint(1) NOT NULL DEFAULT '0',
`is_nsfw` tinyint(1) NOT NULL DEFAULT '0',
@@ -913,13 +913,13 @@ CREATE TABLE IF NOT EXISTS `photo` (
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `album` (`album`),
- KEY `scale` (`scale`),
+ KEY `imgscale` (`imgscale`),
KEY `profile` (`profile`),
KEY `photo_flags` (`photo_flags`),
- KEY `type` (`type`),
+ KEY `mimetype` (`mimetype`),
KEY `aid` (`aid`),
KEY `xchan` (`xchan`),
- KEY `size` (`size`),
+ KEY `filesize` (`filesize`),
KEY `resource_id` (`resource_id`),
KEY `is_nsfw` (`is_nsfw`),
KEY `os_storage` (`os_storage`),
diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql
index bda1b8970..b637fea43 100644
--- a/install/schema_postgres.sql
+++ b/install/schema_postgres.sql
@@ -154,7 +154,7 @@ CREATE TABLE "attach" (
"os_storage" smallint NOT NULL DEFAULT '0',
"os_path" text NOT NULL,
"display_path" text NOT NULL,
- "data" bytea NOT NULL,
+ "content" bytea NOT NULL,
"created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"allow_cid" text NOT NULL,
@@ -390,17 +390,17 @@ CREATE TABLE "event" (
"uid" bigint NOT NULL,
"event_xchan" text NOT NULL DEFAULT '',
"event_hash" text NOT NULL DEFAULT '',
- "created" timestamp NOT NULL,
- "edited" timestamp NOT NULL,
- "start" timestamp NOT NULL,
- "finish" timestamp NOT NULL,
+ "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "dtstart" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
+ "dtend" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"summary" text NOT NULL,
"description" text NOT NULL,
"location" text NOT NULL,
- "type" text NOT NULL,
+ "etype" text NOT NULL,
"nofinish" numeric(1) NOT NULL DEFAULT '0',
"adjust" numeric(1) NOT NULL DEFAULT '1',
- "ignore" numeric(1) NOT NULL DEFAULT '0',
+ "dismissed" numeric(1) NOT NULL DEFAULT '0',
"allow_cid" text NOT NULL,
"allow_gid" text NOT NULL,
"deny_cid" text NOT NULL,
@@ -415,12 +415,12 @@ CREATE TABLE "event" (
PRIMARY KEY ("id")
);
create index "event_uid_idx" on event ("uid");
-create index "event_type_idx" on event ("type");
-create index "event_start_idx" on event ("start");
-create index "event_finish_idx" on event ("finish");
+create index "event_etype_idx" on event ("etype");
+create index "event_dtstart_idx" on event ("dtstart");
+create index "event_dtend_idx" on event ("dtend");
create index "event_adjust_idx" on event ("adjust");
create index "event_nofinish_idx" on event ("nofinish");
-create index "event_ignore_idx" on event ("ignore");
+create index "event_dismissed_idx" on event ("dismissed");
create index "event_aid_idx" on event ("aid");
create index "event_hash_idx" on event ("event_hash");
create index "event_xchan_idx" on event ("event_xchan");
@@ -560,7 +560,7 @@ CREATE TABLE "item" (
"revision" bigint NOT NULL DEFAULT '0',
"verb" text NOT NULL DEFAULT '',
"obj_type" text NOT NULL DEFAULT '',
- "object" text NOT NULL,
+ "obj" text NOT NULL,
"tgt_type" text NOT NULL DEFAULT '',
"target" text NOT NULL,
"layout_mid" text NOT NULL DEFAULT '',
@@ -781,25 +781,25 @@ create index "mitem_flags" on menu_item ("mitem_flags");
CREATE TABLE "notify" (
"id" serial NOT NULL,
"hash" char(64) NOT NULL,
- "name" text NOT NULL,
+ "xname" text NOT NULL,
"url" text NOT NULL,
"photo" text NOT NULL,
- "date" timestamp NOT NULL,
+ "created" timestamp NOT NULL,
"msg" text NOT NULL DEFAULT '',
"aid" bigint NOT NULL,
"uid" bigint NOT NULL,
"link" text NOT NULL,
"parent" text NOT NULL DEFAULT '',
"seen" numeric(1) NOT NULL DEFAULT '0',
- "type" bigint NOT NULL,
+ "ntype" bigint NOT NULL,
"verb" text NOT NULL,
"otype" varchar(16) NOT NULL,
PRIMARY KEY ("id")
);
-create index "notify_type" on notify ("type");
+create index "notify_ntype" on notify ("ntype");
create index "notify_seen" on notify ("seen");
create index "notify_uid" on notify ("uid");
-create index "notify_date" on notify ("date");
+create index "notify_created" on notify ("created");
create index "notify_hash" on notify ("hash");
create index "notify_parent" on notify ("parent");
create index "notify_link" on notify ("link");
@@ -882,12 +882,12 @@ CREATE TABLE "photo" (
"description" text NOT NULL,
"album" text NOT NULL,
"filename" text NOT NULL,
- "type" varchar(128) NOT NULL DEFAULT 'image/jpeg',
+ "mimetype" varchar(128) NOT NULL DEFAULT 'image/jpeg',
"height" numeric(6) NOT NULL,
"width" numeric(6) NOT NULL,
- "size" bigint NOT NULL DEFAULT '0',
- "data" bytea NOT NULL,
- "scale" numeric(3) NOT NULL,
+ "filesize" bigint NOT NULL DEFAULT '0',
+ "content" bytea NOT NULL,
+ "imgscale" numeric(3) NOT NULL DEFAULT '0',
"profile" numeric(1) NOT NULL DEFAULT '0',
"photo_usage" smallint NOT NULL DEFAULT '0',
"is_nsfw" smallint NOT NULL DEFAULT '0',
@@ -903,13 +903,13 @@ CREATE TABLE "photo" (
);
create index "photo_uid" on photo ("uid");
create index "photo_album" on photo ("album");
-create index "photo_scale" on photo ("scale");
+create index "photo_imgscale" on photo ("imgscale");
create index "photo_profile" on photo ("profile");
create index "photo_flags" on photo ("photo_flags");
create index "photo_type" on photo ("type");
create index "photo_aid" on photo ("aid");
create index "photo_xchan" on photo ("xchan");
-create index "photo_size" on photo ("size");
+create index "photo_filesize" on photo ("filesize");
create index "photo_resource_id" on photo ("resource_id");
create index "photo_usage" on photo ("photo_usage");
create index "photo_is_nsfw" on photo ("is_nsfw");
diff --git a/install/update.php b/install/update.php
index dd0131ee8..3e18c9840 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1173 );
+define( 'UPDATE_VERSION' , 1176 );
/**
*
@@ -2186,3 +2186,71 @@ function update_r1172() {
return UPDATE_FAILED;
}
+
+function update_r1173() {
+
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE notify CHANGE `name` `xname` TEXT NOT NULL ");
+ $r2 = q("ALTER TABLE notify CHANGE `date` `created` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` numeric(3) NOT NULL DEFAULT '0' ");
+ }
+ else {
+ $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
+ $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' ");
+ }
+
+ if($r1 && $r2 && $r3)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+function update_r1174() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE event CHANGE `type` `etype` varchar(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
+ $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` numeric(1) NOT NULL DEFAULT '0' ");
+ $r5 = q("ALTER TABLE attach CHANGE `data` `content` bytea NOT NULL ");
+ $r6 = q("ALTER TABLE photo CHANGE `data` `content` bytea NOT NULL ");
+ }
+ else {
+ $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' ");
+ $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
+ $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
+ $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' ");
+ $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL ");
+ $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL ");
+ }
+
+ if($r1 && $r2 && $r3 && $r4 && $r5 && $r6)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}
+
+function update_r1175() {
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
+ $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` bigint NOT NULL DEFAULT '0' ");
+ $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` numeric(3) NOT NULL DEFAULT '0' ");
+ $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` varchar(128) NOT NULL DEFAULT 'image/jpeg' ");
+
+ }
+ else {
+ $r1 = q("ALTER TABLE item CHANGE `object` `obj` text NOT NULL");
+ $r2 = q("ALTER TABLE photo CHANGE `size` `filesize` int(10) unsigned NOT NULL DEFAULT '0' ");
+ $r3 = q("ALTER TABLE photo CHANGE `scale` `imgscale` tinyint(3) unsigned NOT NULL DEFAULT '0' ");
+ $r4 = q("ALTER TABLE photo CHANGE `type` `mimetype` char(128) NOT NULL DEFAULT 'image/jpeg' ");
+
+ }
+
+ if($r1)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
+}