aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2013-07-03 16:10:58 +0100
committerThomas Willingham <founder@kakste.com>2013-07-03 16:10:58 +0100
commitd065135d909bf876f4c305d303de7642657f7e3e (patch)
treec569ec28535fe5e91ab29dffe67c9a74f11fece2 /mod
parentd1cae2da2abc3a602f682114bc02cce08a7e7578 (diff)
parent429ebabfd98240fe7d69ba81879ee35769af305f (diff)
downloadvolse-hubzilla-d065135d909bf876f4c305d303de7642657f7e3e.tar.gz
volse-hubzilla-d065135d909bf876f4c305d303de7642657f7e3e.tar.bz2
volse-hubzilla-d065135d909bf876f4c305d303de7642657f7e3e.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php3
-rw-r--r--mod/connections.php15
-rw-r--r--mod/photos.php134
-rw-r--r--mod/profile.php26
-rw-r--r--mod/profiles.php3
5 files changed, 88 insertions, 93 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 1442070a9..5d4c7ce1b 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -47,6 +47,9 @@ function channel_aside(&$a) {
$a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$a->profile['profile_uid'],true));
$a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat));
}
+ if(feature_enabled($a->profile['profile_uid'],'tagadelic'))
+ $a->set_widget('tagcloud',tagblock('search',$a->profile['profile_uid'],50,ITEM_WALL|ITEM_THREAD_TOP));
+
}
diff --git a/mod/connections.php b/mod/connections.php
index a53107dcf..89c0bcbc0 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -63,10 +63,10 @@ function connections_post(&$a) {
call_hooks('contact_edit_post', $_POST);
- $profile_id = intval($_POST['profile-assign']);
+ $profile_id = $_POST['profile-assign'];
if($profile_id) {
- $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($profile_id),
+ $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($profile_id),
intval(local_user())
);
if(! count($r)) {
@@ -99,9 +99,9 @@ function connections_post(&$a) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
}
- $r = q("UPDATE abook SET abook_profile = %d, abook_my_perms = %d , abook_closeness = %d, abook_flags = %d
+ $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d
where abook_id = %d AND abook_channel = %d LIMIT 1",
- intval($profile_id),
+ dbesc($profile_id),
intval($abook_my_perms),
intval($closeness),
intval($abook_flags),
@@ -405,7 +405,7 @@ function connections_content(&$a) {
'$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your <a href="settings">privacy settings</a>, though you may wish to review the "Advanced Permissions"') : ''),
'$submit' => t('Submit'),
'$lbl_vis1' => t('Profile Visibility'),
- '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['name']),
+ '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']),
'$lbl_info1' => t('Contact Information / Notes'),
'$infedit' => t('Edit contact notes'),
'$close' => $contact['abook_closeness'],
@@ -438,7 +438,8 @@ function connections_content(&$a) {
'$updpub' => t('Update public posts'),
'$last_update' => $last_update,
'$udnow' => t('Update now'),
-// '$profile_select' => contact_profile_assign($contact['profile_id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)),
+ '$profile_select' => contact_profile_assign($contact['abook_profile']),
+ '$multiprofs' => feature_enabled(local_user(),'multi_profiles'),
'$contact_id' => $contact['abook_id'],
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
diff --git a/mod/photos.php b/mod/photos.php
index 65bf866f1..f0b2b882e 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -633,6 +633,9 @@ function photos_content(&$a) {
// dispatch request
//
+ /**
+ * Display upload form
+ */
if($datatype === 'upload') {
if(! ($can_post)) {
@@ -640,12 +643,8 @@ function photos_content(&$a) {
return;
}
-
$selname = (($datum) ? hex2bin($datum) : '');
-
-
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
-
$albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
if(count($a->data['albums'])) {
@@ -673,6 +672,7 @@ function photos_content(&$a) {
$default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
<input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
+ /* Show space usage */
$r = q("select sum(size) as total from photo where uid = %d and scale = 0 ",
intval($a->data['channel']['channel_id'])
@@ -687,15 +687,8 @@ function photos_content(&$a) {
$usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 );
}
-
- if($a->get_template_engine() === 'internal') {
- $albumselect_e = template_escape($albumselect);
- $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb)));
- }
- else {
- $albumselect_e = $albumselect;
- $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
- }
+ $albumselect_e = $albumselect;
+ $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
$tpl = get_markup_template('photos_upload.tpl');
$o .= replace_macros($tpl,array(
@@ -718,6 +711,10 @@ function photos_content(&$a) {
return $o;
}
+ /*
+ * Display a single photo album
+ */
+
if($datatype === 'album') {
$album = hex2bin($datum);
@@ -793,6 +790,7 @@ function photos_content(&$a) {
if(count($r))
$twist = 'rotright';
foreach($r as $rr) {
+
if($twist == 'rotright')
$twist = 'rotleft';
else
@@ -839,12 +837,12 @@ function photos_content(&$a) {
}
+ /**
+ * Display one photo
+ */
if($datatype === 'image') {
-
-
- //$o = '';
// fetch image, item containing image, then comments
$ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
@@ -853,13 +851,16 @@ function photos_content(&$a) {
dbesc($datum)
);
- if(! count($ph)) {
+ if(! $ph) {
+
+ /* Check again - this time without specifying permissions */
+
$ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
LIMIT 1",
intval($owner_uid),
dbesc($datum)
);
- if(count($ph))
+ if($ph)
notice( t('Permission denied. Access to this item may be restricted.'));
else
notice( t('Photo not available') . EOL );
@@ -893,9 +894,9 @@ function photos_content(&$a) {
break;
}
}
- $edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
- $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
- $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
+
+ $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
+ $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
}
@@ -918,7 +919,6 @@ function photos_content(&$a) {
if($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = array(
- 'edit' => array($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))),
'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')),
);
@@ -931,7 +931,7 @@ function photos_content(&$a) {
}
- if(! $cmd !== 'edit') {
+ if(! $can_post) {
$a->page['htmlhead'] .= '<script>
$(document).keydown(function(event) {' . "\n";
@@ -990,39 +990,33 @@ function photos_content(&$a) {
}
- $edit = Null;
- if(($cmd === 'edit') && ($can_post)) {
- if($a->get_template_engine() === 'internal') {
- $album_e = template_escape($ph[0]['album']);
- $caption_e = template_escape($ph[0]['desc']);
- $aclselect_e = template_escape(populate_acl($ph[0]));
- }
- else {
- $album_e = $ph[0]['album'];
- $caption_e = $ph[0]['desc'];
- $aclselect_e = populate_acl($ph[0]);
- }
+ $edit = null;
+ if($can_post) {
- $edit_tpl = get_markup_template('photo_edit.tpl');
- $edit = replace_macros($edit_tpl, array(
- '$id' => $ph[0]['id'],
- '$rotatecw' => t('Rotate CW (right)'),
- '$rotateccw' => t('Rotate CCW (left)'),
- '$album' => $album_e,
- '$newalbum' => t('New album name'),
- '$nickname' => $a->data['channel']['channel_address'],
- '$resource_id' => $ph[0]['resource_id'],
- '$capt_label' => t('Caption'),
- '$caption' => $caption_e,
- '$tag_label' => t('Add a Tag'),
- '$tags' => $link_item['tag'],
- '$permissions' => t('Permissions'),
- '$aclselect' => $aclselect_e,
- '$help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
- '$item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
- '$submit' => t('Submit'),
- '$delete' => t('Delete Photo')
- ));
+ $album_e = $ph[0]['album'];
+ $caption_e = $ph[0]['desc'];
+ $aclselect_e = populate_acl($ph[0]);
+
+ $edit = array(
+ 'edit' => t('Edit photo'),
+ 'id' => $ph[0]['id'],
+ 'rotatecw' => t('Rotate CW (right)'),
+ 'rotateccw' => t('Rotate CCW (left)'),
+ 'album' => $album_e,
+ 'newalbum' => t('New album name'),
+ 'nickname' => $a->data['channel']['channel_address'],
+ 'resource_id' => $ph[0]['resource_id'],
+ 'capt_label' => t('Caption'),
+ 'caption' => $caption_e,
+ 'tag_label' => t('Add a Tag'),
+ 'tags' => $link_item['tag'],
+ 'permissions' => t('Permissions'),
+ 'aclselect' => $aclselect_e,
+ 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
+ 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
+ 'submit' => t('Submit'),
+ 'delete' => t('Delete Photo')
+ );
}
if(count($linked_items)) {
@@ -1154,16 +1148,10 @@ function photos_content(&$a) {
$drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
- if($a->get_template_engine() === 'internal') {
- $name_e = template_escape($profile_name);
- $title_e = template_escape($item['title']);
- $body_e = template_escape(bbcode($item['body']));
- }
- else {
- $name_e = $profile_name;
- $title_e = $item['title'];
- $body_e = bbcode($item['body']);
- }
+ $name_e = $profile_name;
+ $title_e = $item['title'];
+ $body_e = bbcode($item['body']);
+
$comments .= replace_macros($template,array(
'$id' => $item['item_id'],
@@ -1184,18 +1172,10 @@ function photos_content(&$a) {
$paginate = paginate($a);
}
- if($a->get_template_engine() === 'internal') {
- $album_e = array($album_link,template_escape($ph[0]['album']));
- $tags_e = template_escape($tags);
- $like_e = template_escape($like);
- $dislike_e = template_escape($dislike);
- }
- else {
- $album_e = array($album_link,$ph[0]['album']);
- $tags_e = $tags;
- $like_e = $like;
- $dislike_e = $dislike;
- }
+ $album_e = array($album_link,$ph[0]['album']);
+ $tags_e = $tags;
+ $like_e = $like;
+ $dislike_e = $dislike;
$photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array(
diff --git a/mod/profile.php b/mod/profile.php
index 2f869a533..d59602ba0 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -10,25 +10,35 @@ function profile_init(&$a) {
return;
}
- $profile = 0;
+ $profile = '';
$channel = $a->get_channel();
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
+ $r = q("select profile_guid from profile where id = %d and uid = %d limit 1",
+ intval($profile),
+ intval(local_user())
+ );
+ if(! $r)
+ $profile = '';
+ $profile = $r[0]['profile_guid'];
}
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
- $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
- dbesc(argv(1))
- );
- if($x) {
- $a->profile = $x[0];
+ if(! $profile) {
+ $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
+ dbesc(argv(1))
+ );
+ if($x) {
+ $a->profile = $x[0];
+ }
+ }
// $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format');
// if(! $channel_display)
- profile_load($a,$which,$profile);
- }
+ profile_load($a,$which,$profile);
+
}
diff --git a/mod/profiles.php b/mod/profiles.php
index ff6bc8ff6..28d8dd973 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -47,7 +47,7 @@ function profiles_init(&$a) {
if((argc() > 1) && (argv(1) === 'new')) {
- check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
+// check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user()));
@@ -519,6 +519,7 @@ function profiles_content(&$a) {
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t='
. get_form_security_token("profile_drop"),
+ '$guid' => $r[0]['profile_guid'],
'$banner' => t('Edit Profile Details'),
'$submit' => t('Submit'),
'$viewprof' => t('View this profile'),