Commit 17f219c8 authored by redmatrix's avatar redmatrix

DB schema changes

parent 2b0f327a
......@@ -1972,7 +1972,7 @@ function diaspora_like($importer,$xml,$msg) {
$arr['item_private'] = $parent_item['item_private'];
$arr['verb'] = $activity;
$arr['obj_type'] = $objtype;
$arr['object'] = $object;
$arr['obj'] = $object;
if(! $parent_author_signature) {
$key = get_config('system','pubkey');
......
......@@ -41,10 +41,10 @@ $cookies = 'store/[data]/frphoto_cookie_' . $channel_address;
// logger('frphotohelper: ' . print_r($j,true));
$args = array();
$args['data'] = base64_decode($j['data']);
$args['content'] = base64_decode(($j['content']) ? $j['content'] : $j['data']);
$args['filename'] = $j['filename'];
$args['resource_id'] = $j['resource-id'];
$args['scale'] = $j['scale'];
$args['imgscale'] = ((array_key_exists('imgscale',$j)) ? $j['imgscale'] : $j['scale']);
$args['album'] = $j['album'];
$args['visible'] = 0;
$args['created'] = $j['created'];
......
......@@ -218,28 +218,46 @@ function openclipatar_content(&$a) {
// create a unique resource_id
$hash = photo_new_resource();
$width = $ph->getWidth();
$height = $ph->getHeight();
// save an original or "scale 0" image
$p = array('aid' => get_account_id(), 'uid' => local_channel(), 'resource_id' => $hash, 'filename' => $id.'.png', 'album' => t('Profile Photos'), 'scale' => 0);
$p = array('aid' => get_account_id(), 'uid' => local_channel(), 'resource_id' => $hash, 'filename' => $id.'.png', 'album' => t('Profile Photos'), 'imgscale' => 0);
$r = $ph->save($p);
if($r) {
// scale 0 success, continue 4, 5, 6
// we'll skip scales 1,2 (640, 320 rectangular formats as these images are all less than this)
if(($width > 1024 || $height > 1024) && (! $errors))
$ph->scaleImage(1024);
$p['imgscale'] = 1;
$r1 = $ph->save($p);
if(($width > 640 || $height > 640) && (! $errors))
$ph->scaleImage(640);
$p['imgscale'] = 2;
$r2 = $ph->save($p);
if(($width > 320 || $height > 320) && (! $errors))
$ph->scaleImage(320);
$p['imgscale'] = 3;
$r3 = $ph->save($p);
// ensure squareness at first, subsequent scales keep ratio
$ph->scaleImageSquare(175);
$p['scale'] = 4;
$p['imgscale'] = 4;
$r = $ph->save($p);
if($r === false)
$photo_failure = true;
$ph->scaleImage(80);
$p['scale'] = 5;
$p['imgscale'] = 5;
$r = $ph->save($p);
if($r === false)
$photo_failure = true;
$ph->scaleImage(48);
$p['scale'] = 6;
$p['imgscale'] = 6;
$r = $ph->save($p);
if($r === false)
$photo_failure = true;
......
......@@ -22,7 +22,7 @@ function randpost_unload() {
function randpost_enotify_store(&$a,&$b) {
if(! ($b['type'] == NOTIFY_COMMENT || $b['type'] == NOTIFY_TAGSELF))
if(! ($b['ntype'] == NOTIFY_COMMENT || $b['ntype'] == NOTIFY_TAGSELF))
return;
if(! get_pconfig($b['uid'],'randpost','enable'))
......@@ -55,7 +55,7 @@ function randpost_enotify_store(&$a,&$b) {
return;
if($b['type'] == NOTIFY_TAGSELF)
if($b['ntype'] == NOTIFY_TAGSELF)
$my_conversation = true;
elseif($p[0]['author_xchan'] === $c[0]['channel_hash'])
$my_conversation = true;
......
......@@ -49,9 +49,14 @@ $attach_tmp = 'store/[data]/redfile_data_' . $channel_address;
killme();
}
if(array_key_exists('content',$j['attach']) && $j['attach']['content']) {
file_put_contents($attach_tmp,base64_decode($j['attach']['content']));
unset($j['attach']['content']);
}
else {
file_put_contents($attach_tmp,(($j['attach']['data']) ? base64_decode($j['attach']['data']) : ''));
unset($j['attach']['data']);
}
$args = array();
......@@ -74,8 +79,6 @@ $attach_tmp = 'store/[data]/redfile_data_' . $channel_address;
$args['revision'] = $j['attach']['revision'];
$args['is_dir'] = $j['attach']['is_dir'];
unset($j['attach']['data']);
logger('redfilehelper: ' . print_r($j,true));
$r = q("select id from attach where hash = '%s' and uid = %d limit 1",
......
......@@ -47,7 +47,14 @@ $photo_tmp = 'store/[data]/redphoto_data_' . $channel_address;
killme();
}
if(array_key_exists('content',$j['photo'])) {
file_put_contents($photo_tmp,base64_decode($j['photo']['content']));
unset($j['photo']['content']);
}
else {
file_put_contents($photo_tmp,base64_decode($j['photo']['data']));
unset($j['photo']['data']);
}
$args = array();
......@@ -58,7 +65,7 @@ $photo_tmp = 'store/[data]/redphoto_data_' . $channel_address;
if(! $args['filename'])
$args['filename'] = t('photo');
$args['hash'] = $j['photo']['hash'];
$args['scale'] = $j['photo']['scale'];
$args['imgscale'] = ((array_key_exists('imgscale',$j['photo'])) ? $j['photo']['imgscale'] : $j['photo']['scale']);
$args['album'] = $j['photo']['album'];
$args['visible'] = 0;
$args['created'] = $j['photo']['created'];
......@@ -84,7 +91,6 @@ $photo_tmp = 'store/[data]/redphoto_data_' . $channel_address;
$args['item'] = (($j['item']) ? $j['item'] : false);
unset($j['photo']['data']);
// logger('redphotohelper: ' . print_r($j,true));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment