From 125543adedfe00b3d5cea8548d1a66096a173a6b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 02:16:14 -0800 Subject: more comanche migration --- include/text.php | 23 +++++++++++------------ include/widgets.php | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index f808fb0a0..b3154d23e 100755 --- a/include/text.php +++ b/include/text.php @@ -1889,18 +1889,17 @@ function json_decode_plus($s) { function design_tools() { -$channel = get_app()->get_channel(); -$who = $channel['channel_address']; - -return replace_macros(get_markup_template('design_tools.tpl'), array( - '$title' => t('Design'), - '$who' => $who, - '$blocks' => t('Blocks'), - '$menus' => t('Menus'), - '$layout' => t('Layouts'), - '$pages' => t('Pages') - )); - + $channel = get_app()->get_channel(); + $who = $channel['channel_address']; + + return replace_macros(get_markup_template('design_tools.tpl'), array( + '$title' => t('Design'), + '$who' => $who, + '$blocks' => t('Blocks'), + '$menus' => t('Menus'), + '$layout' => t('Layouts'), + '$pages' => t('Pages') + )); } /* case insensitive in_array() */ diff --git a/include/widgets.php b/include/widgets.php index 9d6617aa2..ed155be9b 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -494,4 +494,20 @@ function widget_mailmenu($arr) { )); +} + +function widget_design_tools($arr) { + $a = get_app(); + + // mod menu doesn't load a profile. For any modules which load a profile, check it. + // otherwise local_user() is sufficient for permissions. + + if($a->profile['profile_uid']) + if($a->profile['profile_uid'] != local_user()) + return ''; + + if(! local_user()) + return ''; + + return design_tools(); } \ No newline at end of file -- cgit v1.2.3 From b28a37c38e3fc68b1d0a59e4f5e6054ce13cb680 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 02:25:44 -0800 Subject: more comanche --- include/widgets.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/widgets.php b/include/widgets.php index ed155be9b..5418d6d8e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -510,4 +510,8 @@ function widget_design_tools($arr) { return ''; return design_tools(); +} + +function widget_findpeople($arr) { + return findpeople_widget(); } \ No newline at end of file -- cgit v1.2.3 From 825492407e3e064b6cd806b3ed7d484d2cc9f50e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 02:35:45 -0800 Subject: more comanche --- include/Contact.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/Contact.php b/include/Contact.php index 20dd04d17..59605e463 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -78,12 +78,16 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { $a = get_app(); if(! $xchan) { - if($a->profile['channel_hash']) + if($a->poi) { + $xchan = $a->poi; + } + elseif($a->profile['channel_hash']) { $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($a->profile['channel_hash']) ); if($r) $xchan = $r[0]; + } } if(! $xchan) -- cgit v1.2.3 From e6dc916915af631effc790f1cadf740666168049 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 13:52:23 -0800 Subject: if somebody tagged you in a private post, the tag email notification contained the obscured message. Clear it. --- include/enotify.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index 011a1cde2..1ab6e7dfb 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -183,9 +183,6 @@ function notification($params) { $recip['channel_name'], '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', $params['link']); - - // FIXME - check the item privacy - $private = false; $sitelink = t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf( $sitelink, $siteurl ); @@ -455,6 +452,8 @@ function notification($params) { if(! $datarray['email_secure']) { switch($params['type']) { case NOTIFY_WALL: + case NOTIFY_TAGSELF: + case NOTIFY_POKE: case NOTIFY_COMMENT: if(! $private) break; -- cgit v1.2.3 From f8042cc4677227aca8999c875c4f6d4c7acef96c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 15:23:36 -0800 Subject: add 'src' parameter to api photo list --- include/photos.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index 9828140b8..3ccb536a8 100644 --- a/include/photos.php +++ b/include/photos.php @@ -324,8 +324,11 @@ function photos_list_photos($channel,$observer,$album = '') { intval(PHOTO_NORMAL), intval(PHOTO_PROFILE) ); - + if($r) { + for($x = 0; $x < count($r); $x ++) { + $r[$x]['src'] = z_root() . '/photo/' . $r[$x]['resource_id'] . '-' . $r[$x]['scale']; + } $ret['success'] = true; $ret['photos'] = $r; } -- cgit v1.2.3 From 7c81889b3397f09dfba4f17bba99f6d1dad9d0b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 16:33:36 -0800 Subject: make default profile photo configurable - should be functional but needs admin ui --- include/identity.php | 21 +++++++++++++++++++++ include/network.php | 2 +- include/photo/photo_driver.php | 6 +++--- 3 files changed, 25 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 6bbf193c1..4d38b2828 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1109,3 +1109,24 @@ function get_theme_uid() { } return $uid; } + +/** + * @function get_default_profile_photo($size = 175) + * Retrieves the path of the default_profile_photo for this system + * with the specified size. + * @param int $size + * one of (175, 80, 48) + * @returns string + * + */ + +function get_default_profile_photo($size = 175) { + $scheme = get_config('system','default_profile_photo'); + if(! $scheme) + $scheme = 'rainbow_man'; + return 'images/default_profile_photos/' . $scheme . '/' . $size . 'jpg'; +} + + + + \ No newline at end of file diff --git a/include/network.php b/include/network.php index 7446c2384..3fe7f5400 100644 --- a/include/network.php +++ b/include/network.php @@ -548,7 +548,7 @@ function avatar_img($email) { call_hooks('avatar_lookup', $avatar); if(! $avatar['success']) - $avatar['url'] = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/175.jpg'; + $avatar['url'] = $a->get_baseurl() . '/' . get_default_profile_photo(); logger('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG); return $avatar['url']; diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 8730b4298..3d8ee2196 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -576,9 +576,9 @@ function import_profile_photo($photo,$xchan) { $photo_failure = true; } if($photo_failure) { - $photo = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/175.jpg'; - $thumb = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/80.jpg'; - $micro = $a->get_baseurl() . '/images/default_profile_photos/rainbow_man/48.jpg'; + $photo = $a->get_baseurl() . '/' . get_default_profile_photo(); + $thumb = $a->get_baseurl() . '/' . get_default_profile_photo(80); + $micro = $a->get_baseurl() . '/' . get_default_profile_photo(48); $type = 'image/jpeg'; } -- cgit v1.2.3 From 564f431551672d706136559a4fed3a3c4f98c0ec Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 17:36:31 -0800 Subject: comanchificate mod_photos --- include/widgets.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/widgets.php b/include/widgets.php index 5418d6d8e..5bb937c2e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1,18 +1,5 @@ t('Displays a full channel profile'), - 'tagcloud' => t('Tag cloud of webpage categories'), - 'collections' => t('List and filter by collection'), - 'suggestions' => t('Show a couple of channel suggestion'), - 'follow' => t('Provide a channel follow form') - ); - $arr = array('widgets' => $widgets); - call_hooks('list_widgets',$arr); - return $arr['widgets']; -} - function widget_profile($args) { $a = get_app(); @@ -514,4 +501,22 @@ function widget_design_tools($arr) { function widget_findpeople($arr) { return findpeople_widget(); -} \ No newline at end of file +} + + +function widget_photo_albums($arr) { + $a = get_app(); + if(! $a->profile['profile_uid']) + return ''; + $channelx = channelx_by_n($a->profile['profile_uid']); + if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_photos'))) + return ''; + return photos_album_widget($channelx[0],$a->get_observer()); + +} + + +function widget_vcard($arr) { + return vcard_from_xchan('',get_app()->get_observer()); +} + -- cgit v1.2.3 From bccc20f38c3919d453b0dee1ed354aa4eb13b398 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 19:16:46 -0800 Subject: default photo issue, and connections page showing deleted accounts. Also show last updated on connedit page --- include/identity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 4d38b2828..80f02a9c5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1124,7 +1124,7 @@ function get_default_profile_photo($size = 175) { $scheme = get_config('system','default_profile_photo'); if(! $scheme) $scheme = 'rainbow_man'; - return 'images/default_profile_photos/' . $scheme . '/' . $size . 'jpg'; + return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg'; } -- cgit v1.2.3 From cd78f9d13df721ea218cc8ba023470899b64a151 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 20:23:19 -0800 Subject: sourced items which are then edited at the source weren't setting up the second delivery chain. --- include/items.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index b328ca2d1..26fdc3c5c 100755 --- a/include/items.php +++ b/include/items.php @@ -2148,6 +2148,13 @@ function tag_deliver($uid,$item_id) { $item = $i[0]; + if(($item['source_xchan']) && ($item['item_flags'] & ITEM_UPLINK) && ($item['item_flags'] & ITEM_THREAD_TOP) && ($item['edited'] != $item['created'])) { + // this is an update to a post which was already processed by us and has a second delivery chain + // Just start the second delivery chain to deliver the updated post + proc_run('php','include/notifier.php','tgroup',$item['id']); + return; + } + if($item['obj_type'] === ACTIVITY_OBJ_TAGTERM) { @@ -2444,7 +2451,7 @@ function check_item_source($uid,$item) { $r = q("select * from source where src_channel_id = %d and src_xchan = '%s' limit 1", intval($uid), - dbesc($item['owner_xchan']) + dbesc(($item['source_xchan']) ? $item['source_xchan'] : $item['owner_xchan']) ); if(! $r) -- cgit v1.2.3 From 2c0fbc508e44ebc96b00e4e8a5e166324fbcf9b3 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 23:56:37 -0800 Subject: comanchify connedit, group --- include/group.php | 2 +- include/widgets.php | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/group.php b/include/group.php index 8f690785d..c19c83c80 100644 --- a/include/group.php +++ b/include/group.php @@ -229,7 +229,7 @@ function mini_group_select($uid,$group = '') { -function group_side($every="contacts",$each="group",$edit = false, $group_id = 0, $cid = '',$mode = 1) { +function group_side($every="connections",$each="group",$edit = false, $group_id = 0, $cid = '',$mode = 1) { $o = ''; diff --git a/include/widgets.php b/include/widgets.php index 5bb937c2e..2591a9d09 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -34,10 +34,39 @@ function widget_tagcloud($args) { function widget_collections($args) { require_once('include/group.php'); - $page = argv(0); - $gid = $_REQUEST['gid']; - return group_side($page,$page,true,$_REQUEST['gid'],'',0); + $mode = ((array_key_exists('mode',$args)) ? $args['mode'] : 'conversation'); + switch($mode) { + case 'conversation': + $every = argv(0); + $each = argv(0); + $edit = true; + $current = $_REQUEST['gid']; + $abook_id = 0; + $wmode = 0; + break; + case 'groups': + $every = 'connections'; + $each = argv(0); + $edit = false; + $current = intval(argv(1)); + $abook_id = 0; + $wmode = 1; + break; + case 'abook': + $every = 'connections'; + $each = 'group'; + $edit = false; + $current = 0; + $abook_id = get_app()->poi['abook_xchan']; + $wmode = 1; + break; + default: + return ''; + break; + } + + return group_side($every, $each, $edit, $current, $abook_id, $wmode); } -- cgit v1.2.3 From aa312f72bf48f3ffeb62606541b39e5243ce819e Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 20 Dec 2013 12:43:04 -0800 Subject: comanchify mod_directory. Two modules remaining. Actually three because message needs to be split. --- include/taxonomy.php | 19 +++++++++++-------- include/widgets.php | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/taxonomy.php b/include/taxonomy.php index 65d082bb0..7887f7687 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -217,16 +217,19 @@ function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$ } function dir_tagblock($link,$r) { - $o = ''; - $tab = 0; + $o = ''; + $tab = 0; - if($r) { - $o = '

' . t('Keywords') . '

'; - foreach($r as $rr) { - $o .= ''.$rr['term'].' ' . "\r\n"; + if(! $r) + $r = get_app()->data['directory_keywords']; + + if($r) { + $o = '

' . t('Keywords') . '

'; + foreach($r as $rr) { + $o .= ''.$rr['term'].' ' . "\r\n"; + } + $o .= '
'; } - $o .= '
'; - } return $o; } diff --git a/include/widgets.php b/include/widgets.php index 2591a9d09..5e2285de7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1,5 +1,8 @@ get_observer()); } + +/** + * The following directory widgets are only useful on the directory page + */ + +function widget_dirsafemode($arr) { + return dir_safe_mode(); +} + +function widget_dirsort($arr) { + return dir_sort_links(); +} + +function widget_dirtags($arr) { + return dir_tagblock(z_root() . '/directory',null); +} \ No newline at end of file -- cgit v1.2.3 From d32bbaf599c77aa415ee403a896b77f091f0e9fc Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 21 Dec 2013 23:47:44 -0800 Subject: split private messages into two modules - "message" is just for message lists, "mail" is for reading and writing conversations. This is so we can Comanchify it cleanly. --- include/conversation.php | 2 +- include/dir_fns.php | 4 ++-- include/enotify.php | 4 ++-- include/nav.php | 2 +- include/widgets.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 2ba3948bf..0bb13a17e 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -908,7 +908,7 @@ function item_photo_menu($item){ } $profile_link = z_root() . "/chanview/?f=&hash=" . $item['author_xchan']; - $pm_url = $a->get_baseurl($ssl_state) . '/message/new/?f=&hash=' . $item['author_xchan']; + $pm_url = $a->get_baseurl($ssl_state) . '/mail/new/?f=&hash=' . $item['author_xchan']; if($a->contacts && array_key_exists($item['author_xchan'],$a->contacts)) $contact = $a->contacts[$item['author_xchan']]; diff --git a/include/dir_fns.php b/include/dir_fns.php index 02e8186b7..823763e63 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -22,8 +22,8 @@ function dir_sort_links() { function dir_safe_mode() { $observer = get_observer_hash(); -if (! $observer) - return; + if (! $observer) + return; if ($observer) $safe_mode = get_xconfig($observer,'directory','safe_mode'); if($safe_mode === '0') diff --git a/include/enotify.php b/include/enotify.php index 1ab6e7dfb..49d690511 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -86,8 +86,8 @@ function notification($params) { $preamble = sprintf( t('%1$s, %2$s sent you a new private message at %3$s.'),$recip['channel_name'], $sender['xchan_name'],$sitename); $epreamble = sprintf( t('%1$s sent you %2$s.'),'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', '[zrl=$itemlink]' . t('a private message') . '[/zrl]'); $sitelink = t('Please visit %s to view and/or reply to your private messages.'); - $tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] ); - $hsitelink = sprintf( $sitelink, '' . $sitename . ''); + $tsitelink = sprintf( $sitelink, $siteurl . '/mail/' . $params['item']['id'] ); + $hsitelink = sprintf( $sitelink, '' . $sitename . ''); $itemlink = $siteurl . '/message/' . $params['item']['id']; } diff --git a/include/nav.php b/include/nav.php index 7e99c782e..008899c47 100644 --- a/include/nav.php +++ b/include/nav.php @@ -165,7 +165,7 @@ EOT; $nav['messages']['mark'] = array('', t('Mark all private messages seen'), '',''); $nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox')); $nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox')); - $nav['messages']['new'] = array('message/new', t('New Message'), "", t('New Message')); + $nav['messages']['new'] = array('mail/new', t('New Message'), "", t('New Message')); $nav['all_events'] = array('events', t('Events'), "", t('Event Calendar')); diff --git a/include/widgets.php b/include/widgets.php index 5e2285de7..d6ef9ec07 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -507,7 +507,7 @@ function widget_mailmenu($arr) { ), '$new'=>array( 'label' => t('New Message'), - 'url' => $a->get_baseurl(true) . '/message/new', + 'url' => $a->get_baseurl(true) . '/mail/new', 'sel'=> (argv(1) == 'new'), ) -- cgit v1.2.3 From 0366991b45a9b54da66850bce44b4b9dc1d939a7 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Dec 2013 02:04:55 -0800 Subject: appears that I missed a few files for Comanchification. so here's mitem. --- include/widgets.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/widgets.php b/include/widgets.php index d6ef9ec07..a1ff756ff 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -567,4 +567,11 @@ function widget_dirsort($arr) { function widget_dirtags($arr) { return dir_tagblock(z_root() . '/directory',null); -} \ No newline at end of file +} + +function widget_menu_preview($arr) { + if(! get_app()->data['menu_item']) + return; + require_once('include/menu.php'); + return menu_render(get_app()->data['menu_item']); +} -- cgit v1.2.3