Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
This commit is contained in:
commit
750d6f4be9
@ -80,7 +80,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||||||
intval(PHOTO_PROFILE)
|
intval(PHOTO_PROFILE)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$modified = strtotime($r[0]['edited']);
|
$modified = strtotime($r[0]['edited'] . "Z");
|
||||||
$data = dbunescbin($r[0]['content']);
|
$data = dbunescbin($r[0]['content']);
|
||||||
$mimetype = $r[0]['mimetype'];
|
$mimetype = $r[0]['mimetype'];
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||||||
$data = dbunescbin($e[0]['content']);
|
$data = dbunescbin($e[0]['content']);
|
||||||
$filesize = $e[0]['filesize'];
|
$filesize = $e[0]['filesize'];
|
||||||
$mimetype = $e[0]['mimetype'];
|
$mimetype = $e[0]['mimetype'];
|
||||||
$modified = strtotime($e[0]['edited']);
|
$modified = strtotime($e[0]['edited'] . 'Z');
|
||||||
if(intval($e[0]['os_storage']))
|
if(intval($e[0]['os_storage']))
|
||||||
$streaming = $data;
|
$streaming = $data;
|
||||||
if($e[0]['allow_cid'] != '' || $e[0]['allow_gid'] != '' || $e[0]['deny_gid'] != '' || $e[0]['deny_gid'] != '')
|
if($e[0]['allow_cid'] != '' || $e[0]['allow_gid'] != '' || $e[0]['deny_gid'] != '' || $e[0]['deny_gid'] != '')
|
||||||
@ -193,7 +193,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||||||
header_remove('Expires');
|
header_remove('Expires');
|
||||||
header_remove('Cache-Control');
|
header_remove('Cache-Control');
|
||||||
header_remove('Set-Cookie');
|
header_remove('Set-Cookie');
|
||||||
http_status_exit(304,'not modified');
|
http_status_exit(304,'not modified');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! isset($data)) {
|
if(! isset($data)) {
|
||||||
|
@ -1963,7 +1963,6 @@ function scrape_vcard($url) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret['photo'] = (filter_var($ret['photo'], FILTER_VALIDATE_URL) ? $ret['photo'] : substr($ret['url'], 0, -1) . $ret['photo']);
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,8 +350,7 @@ abstract class photo_driver {
|
|||||||
$p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : '');
|
$p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : '');
|
||||||
$p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : '');
|
$p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : '');
|
||||||
$p['deny_gid'] = (($arr['deny_gid']) ? $arr['deny_gid'] : '');
|
$p['deny_gid'] = (($arr['deny_gid']) ? $arr['deny_gid'] : '');
|
||||||
$p['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
|
$p['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
||||||
$p['edited'] = (($arr['edited']) ? $arr['edited'] : $p['created']);
|
|
||||||
$p['title'] = (($arr['title']) ? $arr['title'] : '');
|
$p['title'] = (($arr['title']) ? $arr['title'] : '');
|
||||||
$p['description'] = (($arr['description']) ? $arr['description'] : '');
|
$p['description'] = (($arr['description']) ? $arr['description'] : '');
|
||||||
$p['photo_usage'] = intval($arr['photo_usage']);
|
$p['photo_usage'] = intval($arr['photo_usage']);
|
||||||
@ -365,13 +364,15 @@ abstract class photo_driver {
|
|||||||
if(! intval($p['imgscale']))
|
if(! intval($p['imgscale']))
|
||||||
logger('save: ' . print_r($arr,true), LOGGER_DATA);
|
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 imgscale = %d limit 1",
|
$x = q("select id, created from photo where resource_id = '%s' and uid = %d and xchan = '%s' and imgscale = %d limit 1",
|
||||||
dbesc($p['resource_id']),
|
dbesc($p['resource_id']),
|
||||||
intval($p['uid']),
|
intval($p['uid']),
|
||||||
dbesc($p['xchan']),
|
dbesc($p['xchan']),
|
||||||
intval($p['imgscale'])
|
intval($p['imgscale'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if($x) {
|
if($x) {
|
||||||
|
$p['created'] = (($x['created']) ? $x['created'] : $p['edited']);
|
||||||
$r = q("UPDATE photo set
|
$r = q("UPDATE photo set
|
||||||
aid = %d,
|
aid = %d,
|
||||||
uid = %d,
|
uid = %d,
|
||||||
@ -427,6 +428,7 @@ abstract class photo_driver {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$p['created'] = (($arr['created']) ? $arr['created'] : $p['edited']);
|
||||||
$r = q("INSERT INTO photo
|
$r = q("INSERT INTO photo
|
||||||
( aid, uid, xchan, resource_id, created, edited, filename, mimetype, album, height, width, content, os_storage, filesize, imgscale, photo_usage, title, description, os_path, display_path, 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, os_path, display_path, 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', '%s', '%s' )",
|
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
|
||||||
@ -464,11 +466,6 @@ abstract class photo_driver {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guess image mimetype from filename or from Content-Type header
|
* Guess image mimetype from filename or from Content-Type header
|
||||||
*
|
*
|
||||||
@ -640,7 +637,7 @@ function import_xchan_photo($photo,$xchan,$thing = false,$force = false) {
|
|||||||
if(is_null($type))
|
if(is_null($type))
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
}
|
}
|
||||||
elseif($result['return_code'] = 304) {
|
elseif($result['return_code'] === 304) {
|
||||||
$photo = z_root() . '/photo/' . $hash . '-4';
|
$photo = z_root() . '/photo/' . $hash . '-4';
|
||||||
$thumb = z_root() . '/photo/' . $hash . '-5';
|
$thumb = z_root() . '/photo/' . $hash . '-5';
|
||||||
$micro = z_root() . '/photo/' . $hash . '-6';
|
$micro = z_root() . '/photo/' . $hash . '-6';
|
||||||
@ -650,9 +647,8 @@ function import_xchan_photo($photo,$xchan,$thing = false,$force = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
}
|
|
||||||
|
|
||||||
if(! $photo_failure && $result['return_code'] != 304) {
|
if(! $photo_failure && $result['return_code'] != 304) {
|
||||||
$img = photo_factory($img_str, $type);
|
$img = photo_factory($img_str, $type);
|
||||||
@ -680,7 +676,15 @@ function import_xchan_photo($photo,$xchan,$thing = false,$force = false) {
|
|||||||
else
|
else
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
|
||||||
$p = array('xchan' => $xchan,'resource_id' => $hash, 'filename' => basename($photo), 'album' => $album, 'photo_usage' => $flags, 'imgscale' => 4);
|
$p = array(
|
||||||
|
'xchan' => $xchan,
|
||||||
|
'resource_id' => $hash,
|
||||||
|
'filename' => basename($photo),
|
||||||
|
'album' => $album,
|
||||||
|
'photo_usage' => $flags,
|
||||||
|
'imgscale' => 4,
|
||||||
|
'edited' => $modified
|
||||||
|
);
|
||||||
|
|
||||||
$r = $img->save($p);
|
$r = $img->save($p);
|
||||||
|
|
||||||
@ -721,6 +725,7 @@ function import_xchan_photo($photo,$xchan,$thing = false,$force = false) {
|
|||||||
$modified = gmdate('Y-m-d H:i:s', filemtime($default));
|
$modified = gmdate('Y-m-d H:i:s', filemtime($default));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger('HTTP code: ' . $result['return_code'] . '; modified: ' . $modified . '; failure: ' . ($photo_failure ? 'yes' : 'no') . '; URL: ' . $photo, LOGGER_DEBUG);
|
||||||
return(array($photo,$thumb,$micro,$type,$photo_failure,$modified));
|
return(array($photo,$thumb,$micro,$type,$photo_failure,$modified));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user