more heavy lifting
This commit is contained in:
parent
8e8482355b
commit
968b9ce1af
@ -902,7 +902,10 @@ CREATE TABLE IF NOT EXISTS `xchan` (
|
||||
`xchan_guid` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_guid_sig` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_pubkey` text NOT NULL,
|
||||
`xchan_photo` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_photo_mimetype` char(32) NOT NULL DEFAULT 'image/jpeg',
|
||||
`xchan_photo_l` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_photo_m` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_photo_s` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_addr` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_profile` char(255) NOT NULL DEFAULT '',
|
||||
`xchan_name` char(255) NOT NULL DEFAULT '',
|
||||
|
@ -141,7 +141,7 @@ class Item extends BaseObject {
|
||||
else
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($this->get_data_value('thumb')));
|
||||
|
||||
$profile_avatar = $item['author']['xchan_photo'];
|
||||
$profile_avatar = $item['author']['xchan_photo_m'];
|
||||
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
@ -56,7 +56,7 @@ function profile_activity($changed, $value) {
|
||||
|
||||
$links = array();
|
||||
$links[] = array('rel' => 'alternate', 'type' => 'text/html', 'href' => $self[0]['profile'] . '?tab=profile');
|
||||
$links[] = array('rel' => 'photo', 'type' => /*FIXME*/ 'image/jpeg', 'href' => $self[0]['xchan_photo']);
|
||||
$links[] = array('rel' => 'photo', 'type' => $self[0]['xchan_photo_mimetype'], 'href' => $self[0]['xchan_photo_l']);
|
||||
|
||||
$arr['object'] = json_encode(array(
|
||||
'type' => ACTIVITY_OBJ_PROFILE,
|
||||
|
@ -441,7 +441,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||
else
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
|
||||
|
||||
$profile_avatar = $item['author']['xchan_photo'];
|
||||
$profile_avatar = $item['author']['xchan_photo_m'];
|
||||
$profile_link = zrl($item['author']['xchan_profile']);
|
||||
$profile_name = $item['author']['xchan_name'];
|
||||
|
||||
@ -1204,7 +1204,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
|
||||
|
||||
|
||||
$profile_avatar = $item['author']['xchan_photo'];
|
||||
$profile_avatar = $item['author']['xchan_photo_m'];
|
||||
$profile_link = zrl($item['author']['xchan_profile']);
|
||||
$profile_name = $item['author']['xchan_name'];
|
||||
|
||||
|
@ -110,12 +110,14 @@ function create_identity($arr) {
|
||||
|
||||
$newuid = $ret['channel']['channel_id'];
|
||||
|
||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo, xchan_addr, xchan_profile, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_profile, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
dbesc($hash),
|
||||
dbesc($ret['channel']['channel_guid']),
|
||||
dbesc($sig),
|
||||
dbesc($key['pubkey']),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/s/{$newuid}"),
|
||||
dbesc($ret['channel']['channel_address'] . '@' . $a->get_hostname()),
|
||||
dbesc(z_root() . '/profile/' . $ret['channel']['channel_address']),
|
||||
dbesc($ret['channel']['channel_name']),
|
||||
|
@ -56,11 +56,8 @@ function nav(&$a) {
|
||||
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'));
|
||||
$nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
|
||||
|
||||
// user info
|
||||
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($channel['channel_id']));
|
||||
|
||||
$userinfo = array(
|
||||
'icon' => $xchan[0]['xchan_photo'],
|
||||
$userinfo = array(
|
||||
'icon' => $xchan[0]['xchan_photo_s'],
|
||||
'name' => $channel['channel_name'],
|
||||
);
|
||||
|
||||
|
@ -10,12 +10,8 @@ function photo_init(&$a) {
|
||||
switch(argc()) {
|
||||
case 4:
|
||||
$person = argv(3);
|
||||
$customres = intval(argv(2));
|
||||
$type = argv(1);
|
||||
break;
|
||||
case 3:
|
||||
$person = argv(2);
|
||||
$type = argv(1);
|
||||
$res = argv(2);
|
||||
$type = argv(1);
|
||||
break;
|
||||
case 2:
|
||||
$photo = argv(1);
|
||||
@ -35,26 +31,27 @@ function photo_init(&$a) {
|
||||
* Profile photos
|
||||
*/
|
||||
|
||||
switch($type) {
|
||||
if($type === 'profile') {
|
||||
switch($res) {
|
||||
|
||||
case 'profile':
|
||||
case 'custom':
|
||||
$resolution = 4;
|
||||
break;
|
||||
case 'micro':
|
||||
$resolution = 6;
|
||||
$default = 'images/person-48.jpg';
|
||||
break;
|
||||
case 'avatar':
|
||||
default:
|
||||
$resolution = 5;
|
||||
$default = 'images/person-80.jpg';
|
||||
break;
|
||||
case 'm':
|
||||
$resolution = 5;
|
||||
$default = 'images/person-80.jpg';
|
||||
break;
|
||||
case 's':
|
||||
$resolution = 6;
|
||||
$default = 'images/person-48.jpg';
|
||||
break;
|
||||
case 'l':
|
||||
default:
|
||||
$resolution = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$uid = $person;
|
||||
|
||||
$r = q("SELECT * FROM `photo` WHERE `scale` = %d AND `uid` = %d AND `profile` = 1 LIMIT 1",
|
||||
$r = q("SELECT * FROM photo WHERE scale = %d AND uid = %d AND profile = 1 LIMIT 1",
|
||||
intval($resolution),
|
||||
intval($uid)
|
||||
);
|
||||
@ -74,16 +71,16 @@ function photo_init(&$a) {
|
||||
*/
|
||||
|
||||
$resolution = 0;
|
||||
foreach( Photo::supportedTypes() as $m=>$e){
|
||||
$photo = str_replace(".$e",'',$photo);
|
||||
}
|
||||
|
||||
if(strpos($photo,'.') !== false)
|
||||
$photo = substr($photo,0,strpos($photo,'.'));
|
||||
|
||||
if(substr($photo,-2,1) == '-') {
|
||||
$resolution = intval(substr($photo,-1,1));
|
||||
$photo = substr($photo,0,-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 scale = %d LIMIT 1",
|
||||
dbesc($photo),
|
||||
intval($resolution)
|
||||
);
|
||||
@ -93,7 +90,7 @@ function photo_init(&$a) {
|
||||
|
||||
// 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 scale = %d $sql_extra LIMIT 1",
|
||||
dbesc($photo),
|
||||
intval($resolution)
|
||||
);
|
||||
@ -149,10 +146,10 @@ function photo_init(&$a) {
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($customres) && $customres > 0 && $customres < 500) {
|
||||
if(isset($res) && intval($res) && $res < 500) {
|
||||
$ph = new Photo($data, $mimetype);
|
||||
if($ph->is_valid()) {
|
||||
$ph->scaleImageSquare($customres);
|
||||
$ph->scaleImageSquare($res);
|
||||
$data = $ph->imageString();
|
||||
$mimetype = $ph->getType();
|
||||
}
|
||||
@ -167,7 +164,7 @@ function photo_init(&$a) {
|
||||
header_remove('pragma');
|
||||
}
|
||||
|
||||
header("Content-type: ".$mimetype);
|
||||
header("Content-type: " . $mimetype);
|
||||
|
||||
if($prvcachecontrol) {
|
||||
|
||||
|
@ -14,28 +14,28 @@ function photos_init(&$a) {
|
||||
}
|
||||
$o = '';
|
||||
|
||||
if($a->argc > 1) {
|
||||
$nick = $a->argv[1];
|
||||
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
|
||||
if(argc() > 1) {
|
||||
$nick = argv(1);
|
||||
$r = q("SELECT * FROM channel WHERE channel_address = '%s' LIMIT 1",
|
||||
dbesc($nick)
|
||||
);
|
||||
|
||||
if(! count($r))
|
||||
if(! ($r && count($r)))
|
||||
return;
|
||||
|
||||
$a->data['user'] = $r[0];
|
||||
$a->data['channel'] = $r[0];
|
||||
|
||||
$sql_extra = permissions_sql($a->data['user']['uid']);
|
||||
$sql_extra = permissions_sql($a->data['channel']['channel_id']);
|
||||
|
||||
$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d $sql_extra order by created desc",
|
||||
intval($a->data['user']['uid'])
|
||||
intval($a->data['channel']['channel_id'])
|
||||
);
|
||||
|
||||
if(count($albums)) {
|
||||
$a->data['albums'] = $albums;
|
||||
|
||||
// FIXME
|
||||
$o .= '<div class="vcard">';
|
||||
$o .= '<div class="fn">' . $a->data['user']['username'] . '</div>';
|
||||
$o .= '<div class="fn">' . $a->data['channel']['channel_name'] . '</div>';
|
||||
$o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid']) . '" alt="' . $a->data['user']['username'] . '" /></div>';
|
||||
$o .= '</div>';
|
||||
|
||||
|
Reference in New Issue
Block a user