Merge pull request #1715 from rabuzarus/theme_uid

use local theme settings for visitors
This commit is contained in:
fabrixxm 2015-06-30 08:41:07 +02:00
commit 5a23bd400c
8 changed files with 161 additions and 80 deletions

View file

@ -29,71 +29,72 @@ function photos_init(&$a) {
return;
$a->data['user'] = $r[0];
$a->profile_uid = $r[0]['uid'];
$profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg');
$profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg');
$tpl = get_markup_template("vcard-widget.tpl");
$tpl = get_markup_template("vcard-widget.tpl");
$vcard_widget .= replace_macros($tpl, array(
'$name' => $a->data['user']['username'],
'$photo' => $profilephoto
));
'$name' => $a->data['user']['username'],
'$photo' => $profilephoto
));
$sql_extra = permissions_sql($a->data['user']['uid']);
$albums = q("SELECT count(distinct `resource-id`) AS `total`, `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
$sql_extra group by album order by created desc",
$sql_extra group by album order by created desc",
intval($a->data['user']['uid']),
dbesc('Contact Photos'),
dbesc( t('Contact Photos'))
dbesc('Contact Photos'),
dbesc( t('Contact Photos'))
);
$albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
$albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
// add various encodings to the array so we can just loop through and pick them out in a template
$ret = array('success' => false);
// add various encodings to the array so we can just loop through and pick them out in a template
$ret = array('success' => false);
if($albums) {
$a->data['albums'] = $albums;
if ($albums_visible)
$ret['success'] = true;
if($albums) {
$a->data['albums'] = $albums;
if ($albums_visible)
$ret['success'] = true;
$ret['albums'] = array();
foreach($albums as $k => $album) {
$entry = array(
'text' => $album['album'],
'total' => $album['total'],
'url' => z_root() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']),
'urlencode' => urlencode($album['album']),
'bin2hex' => bin2hex($album['album'])
);
$ret['albums'][] = $entry;
}
}
$ret['albums'] = array();
foreach($albums as $k => $album) {
$entry = array(
'text' => $album['album'],
'total' => $album['total'],
'url' => z_root() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']),
'urlencode' => urlencode($album['album']),
'bin2hex' => bin2hex($album['album'])
);
$ret['albums'][] = $entry;
}
}
$albums = $ret;
$albums = $ret;
if(local_user() && $a->data['user']['uid'] == local_user())
$can_post = true;
if(local_user() && $a->data['user']['uid'] == local_user())
$can_post = true;
if($albums['success']) {
$photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'),array(
'$nick' => $a->data['user']['nickname'],
'$title' => t('Photo Albums'),
'recent' => t('Recent Photos'),
'$albums' => $albums['albums'],
'$baseurl' => z_root(),
'$upload' => array( t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload'),
'$can_post' => $can_post
));
}
if($albums['success']) {
$photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'),array(
'$nick' => $a->data['user']['nickname'],
'$title' => t('Photo Albums'),
'recent' => t('Recent Photos'),
'$albums' => $albums['albums'],
'$baseurl' => z_root(),
'$upload' => array( t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload'),
'$can_post' => $can_post
));
}
if(! x($a->page,'aside'))
$a->page['aside'] = '';
$a->page['aside'] .= $vcard_widget;
$a->page['aside'] .= $photo_albums_widget;
$a->page['aside'] .= $vcard_widget;
$a->page['aside'] .= $photo_albums_widget;
$tpl = get_markup_template("photos_head.tpl");

View file

@ -27,15 +27,16 @@ function videos_init(&$a) {
return;
$a->data['user'] = $r[0];
$a->profile_uid = $r[0]['uid'];
$profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg');
$profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg');
$tpl = get_markup_template("vcard-widget.tpl");
$tpl = get_markup_template("vcard-widget.tpl");
$vcard_widget = replace_macros($tpl, array(
'$name' => $a->data['user']['username'],
'$photo' => $profilephoto
));
'$name' => $a->data['user']['username'],
'$photo' => $profilephoto
));
/*$sql_extra = permissions_sql($a->data['user']['uid']);