From 075b7fa9c82d5b0663528d2cf5e6f28dd1c5f4ab Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 22 Feb 2014 13:33:18 -0800 Subject: This should resolve the dav authentication loop (correctly) --- mod/ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/ping.php b/mod/ping.php index 390613d7a..b9d9a9c77 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -28,7 +28,7 @@ function ping_init(&$a) { header("content-type: application/json"); - $result['invalid'] = ((local_user()) && (intval($_GET['uid'])) && (intval($_GET['uid']) != local_user()) ? 1 : 0); + $result['invalid'] = ((intval($_GET['uid'])) && (intval($_GET['uid']) != local_user()) ? 1 : 0); if(x($_SESSION,'sysmsg')){ foreach ($_SESSION['sysmsg'] as $m){ -- cgit v1.2.3 From 5b4e3f46bca2def72fd2df2651eacdd853892a23 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 22 Feb 2014 14:58:12 -0800 Subject: minor stuff, some doco, auth cleanup, and make "unknown" more translateable by context. --- mod/openid.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/openid.php b/mod/openid.php index 1ab8749ee..b0d4008d4 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -42,6 +42,7 @@ function openid_content(&$a) { if(($record['account_flags'] == ACCOUNT_OK) || ($record['account_flags'] == ACCOUNT_UNVERIFIED)) { logger('mod_openid: openid success for ' . $x[0]['channel_name']); $_SESSION['uid'] = $r[0]['channel_id']; + $_SESSION['account_id'] = $r[0]['channel_account_id']; $_SESSION['authenticated'] = true; authenticate_success($record,true,true,true,true); goaway(z_root()); -- cgit v1.2.3 From 8284901f9eda97457da1d4d5a74a0e24ee9249b3 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Mon, 24 Feb 2014 05:11:56 +0000 Subject: Make bbcode the default doco ready for the next commit --- mod/help.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/help.php b/mod/help.php index a4ccd1cfe..bbfeb9a6c 100644 --- a/mod/help.php +++ b/mod/help.php @@ -60,7 +60,8 @@ function help_content(&$a) { $a->page['title'] = t('Help'); } if(! $text) { - $text = load_doc_file('doc/Home.md'); + $doctype = 'bbcode'; + $text = load_doc_file('doc/main.bb'); $a->page['title'] = t('Help'); } -- cgit v1.2.3 From 2becbae4022f6c418aa455e7477c00560bcd8b41 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Feb 2014 20:46:52 -0800 Subject: remote "add bookmark" - like rpost but saves a bookmark from a remote hub into one of your own bookmark folders (or a new one if desired). --- mod/rbmark.php | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mod/rpost.php | 2 +- 2 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 mod/rbmark.php (limited to 'mod') diff --git a/mod/rbmark.php b/mod/rbmark.php new file mode 100644 index 000000000..1c962152c --- /dev/null +++ b/mod/rbmark.php @@ -0,0 +1,112 @@ +get_channel(); + + $t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title'])); + bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), + array('menu_id' => ((x($_REQUEST,'menu_id')) ? intval($_REQUEST['menu_id']) : 0), + 'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : '') + )); + + goaway(z_root() . '/bookmarks'); + +} + + +function rbmark_content(&$a) { + + $o = ''; + + if(! local_user()) { + + // The login procedure is going to bugger our $_REQUEST variables + // so save them in the session. + + if(array_key_exists('url',$_REQUEST)) { + $_SESSION['bookmark'] = $_REQUEST; + } + return login(); + } + + // If we have saved rbmark session variables, but nothing in the current $_REQUEST, recover the saved variables + + if((! array_key_exists('url',$_REQUEST)) && (array_key_exists('bookmark',$_SESSION))) { + $_REQUEST = $_SESSION['bookmark']; + unset($_SESSION['bookmark']); + } + + if($_REQUEST['remote_return']) { + $_SESSION['remote_return'] = $_REQUEST['remote_return']; + } + if(argc() > 1 && argv(1) === 'return') { + if($_SESSION['remote_return']) + goaway($_SESSION['remote_return']); + goaway(z_root() . '/bookmarks'); + } + + $channel = $a->get_channel(); + + $m = menu_list($channel,'',MENU_BOOKMARK); + $menus = array(); + if($m) { + $menus = array(0 => ''); + foreach($m as $n) { + $menus[$n['menu_id']] = $n['menu_name']; + } + } + $menu_select = array('menu_id',t('Select a bookmark folder'),false,'',$menus); + + + $o .= replace_macros(get_markup_template('rbmark.tpl'), array( + + '$header' => t('Save Bookmark'), + '$url' => array('url',t('URL of bookmark'),escape_tags($_REQUEST['url'])), + '$title' => array('title',t('Description'),escape_tags($_REQUEST['title'])), + '$ischat' => (($ischat) ? 1 : 0), + '$private' => (($private) ? 1 : 0), + '$submit' => t('Save'), + '$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''), + '$menus' => $menu_select + + )); + + + + + + + return $o; + +} + + diff --git a/mod/rpost.php b/mod/rpost.php index 852a57d78..18d4c86cd 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -33,7 +33,7 @@ function rpost_content(&$a) { if(remote_user()) { // redirect to your own site. // We can only do this with a GET request so you'll need to keep the text short or risk getting truncated - // by the wretched beast called 'shusoin'. All the browsers now allow long GET requests, but suhosin + // by the wretched beast called 'suhosin'. All the browsers now allow long GET requests, but suhosin // blocks them. $url = get_rpost_path($a->get_observer()); -- cgit v1.2.3 From b1021df485fb6129acda5bba616bac10aea75a45 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Feb 2014 21:34:49 -0800 Subject: provide ability to bookmark chatrooms using rbmark --- mod/chat.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index a960f4f37..0f2b94b9d 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -1,6 +1,7 @@ get_channel(); + $ob = $a->get_observer(); $observer = get_observer_hash(); if(! $observer) { notice( t('Permission denied.') . EOL); @@ -144,6 +146,8 @@ function chat_content(&$a) { if(argc() > 2 && intval(argv(2))) { $room_id = intval(argv(2)); + $bookmark_link = get_bookmark_link($ob); + $x = chatroom_enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']); if(! $x) return; @@ -152,8 +156,16 @@ function chat_content(&$a) { intval($a->profile['profile_uid']) ); if($x) { + $private = ((($x[0]['allow_cid']) || ($x[0]['allow_gid']) || ($x[0]['deny_cid']) || ($x[0]['deny_gid'])) ? true : false); $room_name = $x[0]['cr_name']; + if($bookmark_link) + $bookmark_link .= '&url=' . z_root() . '/chat/' . argv(1) . '/' . argv(2) . '&title=' . urlencode($x[0]['cr_name']) . (($private) ? '&private=1' : '') . '&ischat=1'; + } + else { + notice( t('Room not found') . EOL); + return; } + $o = replace_macros(get_markup_template('chat.tpl'),array( '$room_name' => $room_name, '$room_id' => $room_id, @@ -162,7 +174,9 @@ function chat_content(&$a) { '$submit' => t('Submit'), '$leave' => t('Leave Room'), '$away' => t('I am away right now'), - '$online' => t('I am online') + '$online' => t('I am online'), + '$bookmark_link' => $bookmark_link, + '$bookmark' => t('Bookmark this room') )); return $o; -- cgit v1.2.3 From 08313bac6c7ce9f87b6b6ddf23cc5c4d50747aa1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Feb 2014 14:12:51 -0800 Subject: allow personalised page layouts for modules. --- mod/settings.php | 1 - 1 file changed, 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index b88380ff0..13cb3cae9 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -439,7 +439,6 @@ function settings_post(&$a) { dbesc($str_group_deny), intval(local_user()) ); - if($r) info( t('Settings updated.') . EOL); -- cgit v1.2.3 From 2c72e49d1f63404b464f284d86ce2dce7f2eb493 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Feb 2014 17:55:30 -0800 Subject: more chatroom discovery --- mod/rbmark.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/rbmark.php b/mod/rbmark.php index 1c962152c..e35c2494a 100644 --- a/mod/rbmark.php +++ b/mod/rbmark.php @@ -35,7 +35,8 @@ function rbmark_post(&$a) { $t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title'])); bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), array('menu_id' => ((x($_REQUEST,'menu_id')) ? intval($_REQUEST['menu_id']) : 0), - 'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : '') + 'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : ''), + 'ischat' => ((x($_REQUEST['ischat'])) ? intval($_REQUEST['ischat']) : 0) )); goaway(z_root() . '/bookmarks'); @@ -92,8 +93,8 @@ function rbmark_content(&$a) { '$header' => t('Save Bookmark'), '$url' => array('url',t('URL of bookmark'),escape_tags($_REQUEST['url'])), '$title' => array('title',t('Description'),escape_tags($_REQUEST['title'])), - '$ischat' => (($ischat) ? 1 : 0), - '$private' => (($private) ? 1 : 0), + '$ischat' => ((x($_REQUEST,'ischat')) ? intval($_REQUEST['ischat']) : 0), + '$private' => ((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), '$submit' => t('Save'), '$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''), '$menus' => $menu_select -- cgit v1.2.3 From 04e6cb515b524b35ae9f8d20c4b131aa0429a784 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Wed, 26 Feb 2014 01:57:29 +0000 Subject: Fix the weirdness of messages appearing in the middle of the screen and working their way downwards one comment at a time as the ping runs when joining an active chat room. --- mod/chatsvc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/chatsvc.php b/mod/chatsvc.php index e6590f57a..9cc8778f5 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -113,7 +113,7 @@ function chatsvc_content(&$a) { $chats = array(); - $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d", + $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created", intval($a->data['chat']['room_id']), intval($lastseen) ); @@ -147,4 +147,4 @@ function chatsvc_content(&$a) { json_return_and_die($ret); } - \ No newline at end of file + -- cgit v1.2.3 From e7e97e578b3069b8d24ea2a18ce4d3648b402ca3 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Feb 2014 19:48:13 -0800 Subject: put bookmarked chatrooms into poco --- mod/poco.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mod') diff --git a/mod/poco.php b/mod/poco.php index a5808b7db..9295f13de 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -76,6 +76,9 @@ function poco_init(&$a) { $sql_extra ", intval($channel_id) ); + $c = q("select * from menu_item where ( mitem_flags & " . intval(MENU_ITEM_CHATROOM) . " ) and allow_cid = '' and allow_gid = '' and deny_cid = '' and deny_gid = '' and mitem_channel_id = %d", + intval($channel_id) + ); } if($r) $totalResults = intval($r[0]['total']); @@ -115,6 +118,14 @@ function poco_init(&$a) { $ret['startIndex'] = (string) $startIndex; $ret['itemsPerPage'] = (string) $itemsPerPage; $ret['totalResults'] = (string) $totalResults; + + if($c) { + $ret['chatrooms'] = array(); + foreach($c as $d) { + $ret['chatrooms'][] = array('url' => $d['mitem_link'], 'desc' => $d['mitem_desc']); + } + } + $ret['entry'] = array(); -- cgit v1.2.3 From 364fc9f1638e67dad2c289b4d365753a5d06ac05 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Feb 2014 20:58:20 -0800 Subject: comanche: provide an option to add a menu class for different theming choices on some menus (e.g. horizontal, tabbed, etc.) --- mod/bookmarks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/bookmarks.php b/mod/bookmarks.php index c5be68b8e..141ae2e0b 100644 --- a/mod/bookmarks.php +++ b/mod/bookmarks.php @@ -57,7 +57,7 @@ function bookmarks_content(&$a) { if($x) { foreach($x as $xx) { $y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash()); - $o .= menu_render($y,true); + $o .= menu_render($y,'',true); } } @@ -69,7 +69,7 @@ function bookmarks_content(&$a) { if($x) { foreach($x as $xx) { $y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash()); - $o .= menu_render($y,true); + $o .= menu_render($y,'',true); } } -- cgit v1.2.3 From 5cf0e74501f4e72b29f8f486e8d6aac769d0ed24 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Thu, 27 Feb 2014 17:50:36 +0000 Subject: Capitalise $a->page['title'] in doco pages. --- mod/help.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/help.php b/mod/help.php index bbfeb9a6c..aa0ee8ae6 100644 --- a/mod/help.php +++ b/mod/help.php @@ -40,19 +40,19 @@ function help_content(&$a) { if(argc() > 1) { $text = load_doc_file('doc/' . $a->argv[1] . '.md'); - $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags(argv(1))); + $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1)))); } if(! $text) { $text = load_doc_file('doc/' . $a->argv[1] . '.bb'); if($text) $doctype = 'bbcode'; - $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags(argv(1))); + $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags(argv(1)))); } if(! $text) { $text = load_doc_file('doc/' . $a->argv[1] . '.html'); if($text) $doctype = 'html'; - $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags(argv(1))); + $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags(argv(1)))); } if(! $text) { -- cgit v1.2.3 From 102521844b3d6f31d0d801b0d0c89241c2c621af Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Feb 2014 20:48:10 -0800 Subject: put schemas in Comanche (this requires theme support (!)) --- mod/layouts.php | 101 +++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 53 deletions(-) (limited to 'mod') diff --git a/mod/layouts.php b/mod/layouts.php index 9ed349850..cbbef4fea 100644 --- a/mod/layouts.php +++ b/mod/layouts.php @@ -28,76 +28,71 @@ function layouts_content(&$a) { return; } + // Get the observer, check their permissions + $observer = $a->get_observer(); + $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + $perms = get_all_perms($owner,$ob_hash); -// Get the observer, check their permissions - - $observer = $a->get_observer(); - $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + if(! $perms['write_pages']) { + notice( t('Permission denied.') . EOL); + return; + } - $perms = get_all_perms($owner,$ob_hash); + $tabs = array( + array( + 'label' => t('Layout Help'), + 'url' => 'help/Comanche', + 'sel' => '', + 'title' => t('Help with this feature'), + 'id' => 'layout-help-tab', + )); - if(! $perms['write_pages']) { - notice( t('Permission denied.') . EOL); - return; - } -// if(local_user() && local_user() == $owner) { - // $a->set_widget('design',design_tools()); - // } + $o .= replace_macros(get_markup_template('common_tabs.tpl'),array('$tabs' => $tabs)); - $tabs = array( - array( - 'label' => t('Layout Help'), - 'url' => 'help/Comanche', - 'sel' => '', - 'title' => t('Help with this feature'), - 'id' => 'layout-help-tab', - )); + // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages + // Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels. - $o .= replace_macros(get_markup_template('common_tabs.tpl'),array('$tabs' => $tabs)); + require_once ('include/conversation.php'); + $x = array( + 'webpage' => ITEM_PDL, + 'is_owner' => true, + 'nickname' => $a->profile['channel_address'], + 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'bang' => (($group || $cid) ? '!' : ''), + 'visitor' => 'none', + 'nopreview' => 1, + 'ptlabel' => t('Layout Name'), + 'profile_uid' => intval($owner), + ); -// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages -// Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels. -require_once ('include/conversation.php'); - $x = array( - 'webpage' => ITEM_PDL, - 'is_owner' => true, - 'nickname' => $a->profile['channel_address'], - 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'bang' => (($group || $cid) ? '!' : ''), - 'visitor' => 'none', - 'nopreview' => 1, - 'ptlabel' => t('Layout Name'), - 'profile_uid' => intval($owner), - ); + $o .= status_editor($a,$x); - $o .= status_editor($a,$x); + // Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link. + // TODO - this should be replaced with pagelist_widget - //Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link. -//TODO - this should be replaced with pagelist_widget + $r = q("select * from item_id where uid = %d and service = 'PDL' order by sid asc", + intval($owner) + ); -$r = q("select * from item_id where uid = %d and service = 'PDL' order by sid asc", - intval($owner) -); + $pages = null; - $pages = null; + if($r) { + $pages = array(); + foreach($r as $rr) { + $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']); + } + } - if($r) { - $pages = array(); - foreach($r as $rr) { - $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']); - } - } + //Build the base URL for edit links + $url = z_root() . "/editlayout/" . $which; -//Build the base URL for edit links - $url = z_root() . "/editlayout/" . $which; -// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM). - return $o . replace_macros(get_markup_template("webpagelist.tpl"), array( + return $o . replace_macros(get_markup_template("webpagelist.tpl"), array( '$baseurl' => $url, '$edit' => t('Edit'), '$pages' => $pages, @@ -105,7 +100,7 @@ $r = q("select * from item_id where uid = %d and service = 'PDL' order by sid as '$view' => t('View'), '$preview' => '1', - )); + )); } -- cgit v1.2.3 From 429022e11666f886d19d8ea2742ebcf516bb8efa Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 28 Feb 2014 16:00:29 -0800 Subject: allow one to ignore pending connections --- mod/connections.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index e36cb5fc7..679b6d79d 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -223,7 +223,8 @@ function connections_content(&$a) { } $sql_extra = (($search_flags) ? " and ( abook_flags & " . $search_flags . " ) " : ""); - + if(argv(1) === 'pending') + $sql_extra .= " and not ( abook_flags & " . ABOOK_FLAG_IGNORED . " ) "; } else { -- cgit v1.2.3 From 7baeb451836752a612ca976db04aeffcafeb621d Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 2 Mar 2014 19:40:59 -0800 Subject: some anomolies found when viewing connections in various cases. --- mod/zfinger.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/zfinger.php b/mod/zfinger.php index 94671271b..75abfefe4 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -176,10 +176,22 @@ function zfinger_init(&$a) { $ret['follow_url'] = z_root() . '/follow?f=&url=%s'; - $permissions = get_all_perms($e['channel_id'],(($ztarget && $zsig) + $ztarget_hash = (($ztarget && $zsig) ? base64url_encode(hash('whirlpool',$ztarget . $zsig,true)) - : '' ),false); + : '' ); + $permissions = get_all_perms($e['channel_id'],$ztarget_hash,false); + + $permissions['connected'] = false; + + if($ztarget_hash) { + $b = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", + dbesc($ztarget_hash), + intval($e['channel_id']) + ); + if($b) + $permissions['connected'] = true; + } $ret['permissions'] = (($ztarget && $zkey) ? aes_encapsulate(json_encode($permissions),$zkey) : $permissions); -- cgit v1.2.3 From cdd2e9cd953394adfd6331c946466f3165606e29 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 3 Mar 2014 20:05:23 -0800 Subject: layout export to file --- mod/layouts.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/layouts.php b/mod/layouts.php index cbbef4fea..0dcaba361 100644 --- a/mod/layouts.php +++ b/mod/layouts.php @@ -40,6 +40,20 @@ function layouts_content(&$a) { return; } + if((argc() > 3) && (argv(2) === 'share') && (argv(3))) { + $r = q("select sid, service, mimetype, title, body from item_id left join item on item.id = item_id.iid where item_id.uid = %d and item.mid = '%s' and service = 'PDL' order by sid asc", + intval($owner), + dbesc(argv(3)) + ); + if($r) { + header('Content-type: application/x-redmatrix-layout'); + header('Content-disposition: attachment; filename="' . $r[0]['sid'] . '.pdl"'); + echo json_encode($r); + killme(); + + } + } + $tabs = array( array( 'label' => t('Layout Help'), @@ -75,7 +89,7 @@ function layouts_content(&$a) { // Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link. // TODO - this should be replaced with pagelist_widget - $r = q("select * from item_id where uid = %d and service = 'PDL' order by sid asc", + $r = q("select iid, sid, mid from item_id left join item on item.id = item_id.iid where item_id.uid = %d and service = 'PDL' order by sid asc", intval($owner) ); @@ -84,7 +98,7 @@ function layouts_content(&$a) { if($r) { $pages = array(); foreach($r as $rr) { - $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']); + $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid'], 'mid' => $rr['mid']); } } @@ -92,9 +106,10 @@ function layouts_content(&$a) { //Build the base URL for edit links $url = z_root() . "/editlayout/" . $which; - return $o . replace_macros(get_markup_template("webpagelist.tpl"), array( + return $o . replace_macros(get_markup_template("layoutlist.tpl"), array( '$baseurl' => $url, '$edit' => t('Edit'), + '$share' => t('Share'), '$pages' => $pages, '$channel' => $which, '$view' => t('View'), -- cgit v1.2.3 From 3d49bf0320cd6a35e34da9694d3eb957053845a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 3 Mar 2014 21:00:42 -0800 Subject: directory sync issues --- mod/dirsearch.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 59a1d448d..7b83b8a46 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -159,7 +159,12 @@ function dirsearch_content(&$a) { ); if($r) { foreach($r as $rr) { - $flags = (($rr['ud_flags'] & UPDATE_FLAGS_DELETED) ? array('deleted') : array()); + $flags = array(); + if($rr['ud_flags'] & UPDATE_FLAGS_DELETED) + $flags[] = 'deleted'; + if($rr['ud_flags'] & UPDATE_FLAGS_FORCED) + $flags[] = 'forced'; + $spkt['transactions'][] = array( 'hash' => $rr['ud_hash'], 'address' => $rr['ud_addr'], -- cgit v1.2.3 From 66f754c4c730bbea46faac2c61bb5195246d7233 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 01:43:39 -0800 Subject: !@#$% pay~!@#$pal --- mod/siteinfo.php | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'mod') diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 7fdb892d2..bdf9b1af6 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -90,24 +90,6 @@ function siteinfo_content(&$a) { $admininfo = bbcode(get_config('system','admininfo')); - $project_donate = t('Project Donations'); - $donate_text = t('

The Red Matrix is provided for you by volunteers working in their spare time. Your support will help us to build a better, freer, and privacy respecting web. Select the following option for a one-time donation of your choosing

'); - $alternatively = t('

or

'); - $recurring = t('Recurring Donation Options'); - - $donate = <<< EOT -

{$project_donate}

-$donate_text -

-$alternatively -

- - -
$recurring
-

-

-EOT; - if(file_exists('doc/site_donate.html')) $donate .= file_get_contents('doc/site_donate.html'); -- cgit v1.2.3 From 86d60f572f6accb086f7cd4271ababde2c5d3669 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 14:35:42 -0800 Subject: change flags for one-way connections from hidden to unconnected so we can still use hidden for - well hiding connections --- mod/connections.php | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 679b6d79d..dbdcbdc93 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -35,7 +35,7 @@ function connections_post(&$a) { if(! $orig_record) { notice( t('Could not access contact record.') . EOL); - goaway($a->get_baseurl(true) . '/connections'); + goaway(z_root() . '/connections'); return; // NOTREACHED } @@ -170,14 +170,14 @@ function connections_content(&$a) { return login(); } - $blocked = false; - $hidden = false; - $ignored = false; - $archived = false; - $unblocked = false; - $pending = false; - - $all = false; + $blocked = false; + $hidden = false; + $ignored = false; + $archived = false; + $unblocked = false; + $pending = false; + $unconnected = false; + $all = false; $_SESSION['return_url'] = $a->query_string; @@ -212,6 +212,11 @@ function connections_content(&$a) { $pending = true; nav_set_selected('intros'); break; + case 'unconnected': + $search_flags = ABOOK_FLAG_UNCONNECTED; + $head = t('Unconnected'); + $unconnected = true; + break; case 'all': $head = t('All'); @@ -237,57 +242,65 @@ function connections_content(&$a) { $tabs = array( array( 'label' => t('Suggestions'), - 'url' => $a->get_baseurl(true) . '/suggest', + 'url' => z_root() . '/suggest', 'sel' => '', 'title' => t('Suggest new connections'), ), array( 'label' => t('New Connections'), - 'url' => $a->get_baseurl(true) . '/connections/pending', + 'url' => z_root() . '/connections/pending', 'sel' => ($pending) ? 'active' : '', 'title' => t('Show pending (new) connections'), ), array( 'label' => t('All Connections'), - 'url' => $a->get_baseurl(true) . '/connections/all', + 'url' => z_root() . '/connections/all', 'sel' => ($all) ? 'active' : '', 'title' => t('Show all connections'), ), array( 'label' => t('Unblocked'), - 'url' => $a->get_baseurl(true) . '/connections', + 'url' => z_root() . '/connections', 'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '', 'title' => t('Only show unblocked connections'), ), array( 'label' => t('Blocked'), - 'url' => $a->get_baseurl(true) . '/connections/blocked', + 'url' => z_root() . '/connections/blocked', 'sel' => ($blocked) ? 'active' : '', 'title' => t('Only show blocked connections'), ), array( 'label' => t('Ignored'), - 'url' => $a->get_baseurl(true) . '/connections/ignored', + 'url' => z_root() . '/connections/ignored', 'sel' => ($ignored) ? 'active' : '', 'title' => t('Only show ignored connections'), ), array( 'label' => t('Archived'), - 'url' => $a->get_baseurl(true) . '/connections/archived', + 'url' => z_root() . '/connections/archived', 'sel' => ($archived) ? 'active' : '', 'title' => t('Only show archived connections'), ), array( 'label' => t('Hidden'), - 'url' => $a->get_baseurl(true) . '/connections/hidden', + 'url' => z_root() . '/connections/hidden', 'sel' => ($hidden) ? 'active' : '', 'title' => t('Only show hidden connections'), ), + array( + 'label' => t('Unconnected'), + 'url' => z_root() . '/connections/unconnected', + 'sel' => ($unconnected) ? 'active' : '', + 'title' => t('Only show one-way connections'), + ), + + ); $tab_tpl = get_markup_template('common_tabs.tpl'); -- cgit v1.2.3 From 39f18d0f1618ce27804d6fcf2eee15e813b17140 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 15:25:04 -0800 Subject: fix third-party zid's --- mod/openid.php | 2 ++ mod/post.php | 1 + 2 files changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/openid.php b/mod/openid.php index b0d4008d4..2112e0af4 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -62,6 +62,7 @@ function openid_content(&$a) { if($r) { $_SESSION['authenticated'] = 1; $_SESSION['visitor_id'] = $r[0]['xchan_hash']; + $_SESSION['my_url'] = $r[0]['xchan_url']; $_SESSION['my_address'] = $r[0]['xchan_addr']; $arr = array('xchan' => $r[0], 'session' => $_SESSION); call_hooks('magic_auth_openid_success',$arr); @@ -169,6 +170,7 @@ function openid_content(&$a) { set_xconfig($url,'system','openid',$authid); $_SESSION['authenticated'] = 1; $_SESSION['visitor_id'] = $r[0]['xchan_hash']; + $_SESSION['my_url'] = $r[0]['xchan_url']; $_SESSION['my_address'] = $r[0]['xchan_addr']; $arr = array('xchan' => $r[0], 'session' => $_SESSION); call_hooks('magic_auth_openid_success',$arr); diff --git a/mod/post.php b/mod/post.php index 6c57bfa0d..54d0d8db9 100644 --- a/mod/post.php +++ b/mod/post.php @@ -243,6 +243,7 @@ function post_init(&$a) { $_SESSION['authenticated'] = 1; $_SESSION['visitor_id'] = $x[0]['xchan_hash']; + $_SESSION['my_url'] = $x[0]['xchan_url']; $_SESSION['my_address'] = $address; $_SESSION['remote_service_class'] = $remote_service_class; $_SESSION['remote_level'] = $remote_level; -- cgit v1.2.3 From aa9d25f51764c7bbd2922d6e91f609e89659b2f6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 18:12:27 -0800 Subject: add system PDL editor (lets you change/personalise the layout for any module which has a system PDL file.) --- mod/pdledit.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 mod/pdledit.php (limited to 'mod') diff --git a/mod/pdledit.php b/mod/pdledit.php new file mode 100644 index 000000000..e3ff2292d --- /dev/null +++ b/mod/pdledit.php @@ -0,0 +1,61 @@ + 1) + $module = 'mod_' . argv(1) . '.pdl'; + else { + $o .= '

' . t('Edit System Page Description') . '

'; + $files = glob('mod/*'); + if($files) { + foreach($files as $f) { + $name = basename($f,'.php'); + $x = theme_include('mod_' . $name . '.pdl'); + if($x) { + $o .= '' . $name . '
'; + } + } + } + + // list module pdl files + return $o; + } + + $t = get_pconfig(local_user(),'system',$module); + if(! $t) + $t = file_get_contents(theme_include($module)); + if(! $t) { + notice( t('Layout not found.') . EOL); + return ''; + } + + $o = replace_macros(get_markup_template('pdledit.tpl'),array( + '$header' => t('Edit System Page Description'), + '$mname' => t('Module Name:'), + '$module' => argv(1), + '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'), + '$submit' => t('Submit') + )); + + return $o; +} -- cgit v1.2.3 From 4da73d7d841d9ed33ce83539d7faac5809cac6dc Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 19:34:04 -0800 Subject: stopgap solution until somebody implements endless scroll on the directory --- mod/dirsearch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 7b83b8a46..d06ccb619 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -99,7 +99,7 @@ function dirsearch_content(&$a) { - $perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 80); + $perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 300); $page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0); $startrec = (($page+1) * $perpage) - $perpage; $limit = (($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 0); -- cgit v1.2.3 From 267283748f676a278d180752c3af56486754e83e Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 19:57:54 -0800 Subject: Red API: /api/red/item/new ; which is like /api/statuses/update except it uses Red semantics and returns success/failure indication. --- mod/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 2feb64a37..6ea434542 100644 --- a/mod/item.php +++ b/mod/item.php @@ -862,7 +862,7 @@ function item_post(&$a) { // figure out how to return, depending on from whence we came if($api_source) - return; + return $post; if($return_path) { goaway($a->get_baseurl() . "/" . $return_path); -- cgit v1.2.3 From efc828bed52eb32e1e99d757139d1133e3ec9b8a Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 20:58:12 -0800 Subject: add pdl editor to settings/display --- mod/settings.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index 13cb3cae9..1d2a5ecf9 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -758,6 +758,7 @@ function settings_content(&$a) { '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), '$chanview_full' => array('chanview_full', t('Do not view remote profiles in frames'), $chanview, t('By default open in a sub-window of your own site')), + '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, )); -- cgit v1.2.3 From cdcbc5816e21d53172c5396083b38fce4ab0ba38 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 21:03:56 -0800 Subject: add Comanche help link to pdledit --- mod/pdledit.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/pdledit.php b/mod/pdledit.php index e3ff2292d..36b9a0c14 100644 --- a/mod/pdledit.php +++ b/mod/pdledit.php @@ -52,6 +52,7 @@ function pdledit_content(&$a) { $o = replace_macros(get_markup_template('pdledit.tpl'),array( '$header' => t('Edit System Page Description'), '$mname' => t('Module Name:'), + '$help' => t('Layout Help'), '$module' => argv(1), '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'), '$submit' => t('Submit') -- cgit v1.2.3 From 61f47cd5ed6eee337d9ab30b65844b5118080b76 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 5 Mar 2014 03:19:20 -0800 Subject: move language selector to a module --- mod/lang.php | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 mod/lang.php (limited to 'mod') diff --git a/mod/lang.php b/mod/lang.php new file mode 100644 index 000000000..fba5f9c73 --- /dev/null +++ b/mod/lang.php @@ -0,0 +1,6 @@ + Date: Wed, 5 Mar 2014 14:17:01 -0800 Subject: lots of little fixes to blocks --- mod/blocks.php | 2 +- mod/editblock.php | 91 +++++++++++++++++++++++++------------------------------ 2 files changed, 42 insertions(+), 51 deletions(-) (limited to 'mod') diff --git a/mod/blocks.php b/mod/blocks.php index 9a4e0b1ca..81337448c 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -88,7 +88,7 @@ $r = q("select * from item_id where uid = %d and service = 'BUILDBLOCK' order by //Build the base URL for edit links $url = z_root() . "/editblock/" . $which; // This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM). - return $o . replace_macros(get_markup_template("webpagelist.tpl"), array( + return $o . replace_macros(get_markup_template("blocklist.tpl"), array( '$baseurl' => $url, '$edit' => t('Edit'), '$pages' => $pages, diff --git a/mod/editblock.php b/mod/editblock.php index dcb4b42a7..8ccccc24b 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -1,74 +1,68 @@ get_channel() and stuff don't work here, so we've got to find the owner for ourselves. - $r = q("select channel_id from channel where channel_address = '%s'", - dbesc($which) - ); - if($r) { - $owner = intval($r[0]['channel_id']); - //logger('owner: ' . print_r($owner,true)); - } + if(argc() < 2) { + notice( t('Item not found') . EOL); + return; + } + $channel = get_channel_by_nick(argv(1)); - - - if((local_user()) && (argc() > 2) && (argv(2) === 'view')) { - $which = $channel['channel_address']; - } + if($c) { + $owner = intval($channel['channel_id']); + } $o = ''; -// Figure out which post we're editing + // Figure out which post we're editing $post_id = ((argc() > 2) ? intval(argv(2)) : 0); - if(! $post_id) { + if(! ($post_id && $channel)) { notice( t('Item not found') . EOL); return; } -// Now we've got a post and an owner, let's find out if we're allowed to edit it - - $observer = $a->get_observer(); - $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + // Now we've got a post and an owner, let's find out if we're allowed to edit it - $perms = get_all_perms($owner,$ob_hash); - - if(! $perms['write_pages']) { - notice( t('Permission denied.') . EOL); - return; - } + if(! perm_is_allowed($channel['channel_id'],get_observer_hash(),'write_pages')) { + notice( t('Permission denied.') . EOL); + return; + } -// We've already figured out which item we want and whose copy we need, so we don't need anything fancy here - $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", - intval($post_id), - intval($owner) - ); - $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1", - $itm[0]['id'] + // We've already figured out which item we want and whose copy we need, so we don't need anything fancy here + $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", + intval($post_id), + intval($channel['channel_id']) ); - if($item_id) - $block_title = $item_id[0]['sid']; + if($itm) { + $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1", + $itm[0]['id'] + ); + if($item_id) + $block_title = $item_id[0]['sid']; + } + else { + notice( t('Item not found') . EOL); + return; + } $plaintext = true; -// You may or may not be a local user. This won't work, - if(feature_enabled(local_user(),'richtext')) + + // You may or may not be a local user. + if(local_user() && feature_enabled(local_user(),'richtext')) $plaintext = false; $mimeselect = ''; + $mimetype = $itm[0]['mimetype']; if($mimetype != 'text/bbcode') $plaintext = true; @@ -79,9 +73,6 @@ function editblock_content(&$a) { $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); - - - $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit Block') )); @@ -91,8 +82,8 @@ function editblock_content(&$a) { '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$ispublic' => ' ', // t('Visible to everybody'), - '$geotag' => $geotag, - '$nickname' => $a->user['nickname'], + '$geotag' => '', + '$nickname' => $channel['channel_address'], '$confirmdelete' => t('Delete block?') )); @@ -105,13 +96,13 @@ function editblock_content(&$a) { call_hooks('jot_tool', $jotplugins); call_hooks('jot_networks', $jotnets); - $channel = $a->get_channel(); //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); -//FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page. So, send folk to the webpage list. + // FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page. + //So, send folk to the webpage list. - $rp = '/blocks/' . $which; + $rp = 'blocks/' . $channel['channel_address']; $o .= replace_macros($tpl,array( '$return_path' => $rp, @@ -147,10 +138,10 @@ function editblock_content(&$a) { '$lockstate' => $lockstate, '$acl' => '', '$bang' => '', - '$profile_uid' => (intval($owner)), + '$profile_uid' => (intval($channel['channel_id'])), '$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''), '$jotplugins' => $jotplugins, - '$sourceapp' => t($a->sourcename), + '$sourceapp' => $itm[0]['app'], '$defexpire' => '', '$feature_expire' => 'none', '$expires' => t('Set expiration date'), -- cgit v1.2.3 From 1b1cfb366d5ce6627f86d696cf96f740c70c9afe Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 5 Mar 2014 17:06:46 -0800 Subject: missing mod/block --- mod/block.php | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 mod/block.php (limited to 'mod') diff --git a/mod/block.php b/mod/block.php new file mode 100644 index 000000000..043b0e9e8 --- /dev/null +++ b/mod/block.php @@ -0,0 +1,86 @@ +profile['profile_uid']) + head_set_icon($a->profile['thumb']); + +} + + +function block_content(&$a) { + + if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_pages')) { + notice( t('Permission denied.') . EOL); + return; + } + + if(argc() < 3) { + notice( t('Invalid item.') . EOL); + return; + } + + $channel_address = argv(1); + $page_id = argv(2); + + $u = q("select channel_id from channel where channel_address = '%s' limit 1", + dbesc($channel_address) + ); + + if(! $u) { + notice( t('Channel not found.') . EOL); + return; + } + + if($_REQUEST['rev']) + $revision = " and revision = " . intval($_REQUEST['rev']) . " "; + else + $revision = " order by revision desc "; + + require_once('include/security.php'); + $sql_options = item_permissions_sql($u[0]['channel_id']); + + $r = q("select item.* from item left join item_id on item.id = item_id.iid + where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and + item_restrict = %d $sql_options $revision limit 1", + intval($u[0]['channel_id']), + dbesc($page_id), + intval(ITEM_BUILDBLOCK) + ); + + if(! $r) { + + // Check again with no permissions clause to see if it is a permissions issue + + $x = q("select item.* from item left join item_id on item.id = item_id.iid + where item.uid = %d and sid = '%s' and service = 'BUILDBLOCK' and + item_restrict = %d $revision limit 1", + intval($u[0]['channel_id']), + dbesc($page_id), + intval(ITEM_BUILDBLOCK) + ); + if($x) { + // Yes, it's there. You just aren't allowed to see it. + notice( t('Permission denied.') . EOL); + } + else { + notice( t('Page not found.') . EOL); + } + return; + } + + xchan_query($r); + $r = fetch_post_tags($r,true); + + $o .= prepare_page($r[0]); + return $o; + +} -- cgit v1.2.3 From 8c7e076dae46a81e38620048d1fe3894c1a6d70e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 6 Mar 2014 01:29:42 -0800 Subject: bring friends back --- mod/zfinger.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/zfinger.php b/mod/zfinger.php index 75abfefe4..4f59c1973 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -182,9 +182,8 @@ function zfinger_init(&$a) { $permissions = get_all_perms($e['channel_id'],$ztarget_hash,false); - $permissions['connected'] = false; - if($ztarget_hash) { + $permissions['connected'] = false; $b = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($ztarget_hash), intval($e['channel_id']) -- cgit v1.2.3 From 93000ebad6520018712128833bd8f4fbab4a1f68 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 7 Mar 2014 17:29:36 +0000 Subject: Actually create syschan during install --- mod/setup.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/setup.php b/mod/setup.php index 14572699e..d12627e84 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -602,6 +602,9 @@ function what_next() { $a = get_app(); // install the standard theme set_config('system','allowed_themes','redbasic'); + // Create a system channel + require_once ('include/identity.php'); + create_sys_channel(); $baseurl = $a->get_baseurl(); return t('

What next

') -- cgit v1.2.3 From ab0eab49e866e29b1c1b5ef58897c6a446d24864 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 7 Mar 2014 20:28:04 -0800 Subject: start new connections out with even more sane defaults than before by pre-filling the connedit form page. This still lets them change things before any damage has been done or before any privacy has leaked, but should reduce the number of new connections that can't comment. --- mod/connedit.php | 6 ++++++ mod/follow.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/connedit.php b/mod/connedit.php index c6f64ccfc..b9b7fcce3 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -177,7 +177,13 @@ function connedit_content(&$a) { $sort_type = 0; $o = ''; + // this triggers some javascript to set Full Sharing by default after + // completing a "follow" - which can be changed to something else before + // form submission, but this gives us something useable + if($_GET['follow'] == 1) { + $o .= ''; + } if(! local_user()) { notice( t('Permission denied.') . EOL); return login(); diff --git a/mod/follow.php b/mod/follow.php index 962bb71a7..4fcb5bda3 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -30,7 +30,7 @@ function follow_init(&$a) { proc_run('php','include/onepoll.php',$result['abook']['abook_id']); - goaway(z_root() . '/connedit/' . $result['abook']['abook_id']); + goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1); } -- cgit v1.2.3 From aa8a93f1710f463f9467610cbcdc1cb754551c78 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 7 Mar 2014 23:00:27 -0800 Subject: missing quote --- mod/follow.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/follow.php b/mod/follow.php index 4fcb5bda3..663fb7536 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -30,7 +30,7 @@ function follow_init(&$a) { proc_run('php','include/onepoll.php',$result['abook']['abook_id']); - goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1); + goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1'); } -- cgit v1.2.3 From af22aeb55748bd0aa76db99a1e8a3fb84a1b85e1 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 8 Mar 2014 12:40:06 -0800 Subject: incorrect webfinger link per fabrixxm --- mod/wfinger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/wfinger.php b/mod/wfinger.php index 33d2fe478..fb75da193 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -80,7 +80,7 @@ function wfinger_init(&$a) { array( 'rel' => 'http://purl.org/zot/protocol', - 'href' => z_root() . '/.well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'], + 'href' => z_root() . '/.well-known/zot-info' . '?address=' . $r[0]['xchan_addr'], ) ); -- cgit v1.2.3 From 20ef3aee722c1079f844e32405dcc39ff5e1215e Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 8 Mar 2014 15:53:55 -0800 Subject: back-end for advanced directory search --- mod/dirsearch.php | 113 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 98 insertions(+), 15 deletions(-) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index d06ccb619..759e27c5b 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -27,6 +27,27 @@ function dirsearch_content(&$a) { json_return_and_die($ret); } + $sql_extra = ''; + + $tables = array('name','address','locale','region','postcode','country','gender','marital','sexual','keywords'); + + + if($_REQUEST['query']) { + $advanced = dir_parse_query($_REQUEST['query']); + if($advanced) { + foreach($advanced as $adv) { + if(in_array($adv['field'],$tables)) { + if($adv['field'] === 'name') + $sql_extra .= dir_query_build($adv['logic'],'xchan_name',$adv['value']); + elseif($adv['field'] === 'address') + $sql_extra .= dir_query_build($adv['logic'],'xchan_addr',$adv['value']); + else + $sql_extra .= dir_query_build($adv['logic'],'xprof_' . $adv['field'],$adv['value']); + } + } + } + } + $hash = ((x($_REQUEST['hash'])) ? $_REQUEST['hash'] : ''); $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''); @@ -38,6 +59,7 @@ function dirsearch_content(&$a) { $country = ((x($_REQUEST,'country')) ? $_REQUEST['country'] : ''); $gender = ((x($_REQUEST,'gender')) ? $_REQUEST['gender'] : ''); $marital = ((x($_REQUEST,'marital')) ? $_REQUEST['marital'] : ''); + $sexual = ((x($_REQUEST,'sexual')) ? $_REQUEST['sexual'] : ''); $keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : ''); $agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 ); $agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 ); @@ -59,36 +81,38 @@ function dirsearch_content(&$a) { $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : ''); -// TODO - a meta search which joins all of these things to one search string - - $sql_extra = ''; + $joiner = ' OR '; + if($_REQUEST['and']) + $joiner = ' AND '; if($name) - $sql_extra .= " OR xchan_name like '" . protect_sprintf( '%' . dbesc($name) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xchan_name',$name); if($hub) - $sql_extra .= " OR xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') "; + $sql_extra .= " $joiner xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') "; if($address) - $sql_extra .= " OR xchan_addr like '" . protect_sprintf( '%' . dbesc($address) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xchan_addr',$address); if($city) - $sql_extra .= " OR xprof_locale like '" . protect_sprintf( '%' . dbesc($city) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_locale',$city); if($region) - $sql_extra .= " OR xprof_region like '" . protect_sprintf( '%' . dbesc($region) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_region',$region); if($post) - $sql_extra .= " OR xprof_postcode like '" . protect_sprintf( '%' . dbesc($post) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_postcode',$post); if($country) - $sql_extra .= " OR xprof_country like '" . protect_sprintf( '%' . dbesc($country) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_country',$country); if($gender) - $sql_extra .= " OR xprof_gender like '" . protect_sprintf( '%' . dbesc($gender) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_gender',$gender); if($marital) - $sql_extra .= " OR xprof_marital like '" . protect_sprintf( '%' . dbesc($marital) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_marital',$marital); + if($sexual) + $sql_extra .= dir_query_build($joiner,'xprof_sexual',$sexual); if($keywords) - $sql_extra .= " OR xprof_keywords like '" . protect_sprintf( '%' . dbesc($keywords) . '%' ) . "' "; + $sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords); // we only support an age range currently. You must set both agege // (greater than or equal) and agele (less than or equal) if($agele && $agege) { - $sql_extra .= " OR ( xprof_age <= " . intval($agele) . " "; + $sql_extra .= " $joiner ( xprof_age <= " . intval($agele) . " "; $sql_extra .= " AND xprof_age >= " . intval($agege) . ") "; } @@ -98,7 +122,6 @@ function dirsearch_content(&$a) { } - $perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 300); $page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0); $startrec = (($page+1) * $perpage) - $perpage; @@ -236,6 +259,66 @@ function dirsearch_content(&$a) { } +function dir_query_build($joiner,$field,$s) { + $ret = ''; + if(trim($s)) + $ret .= dbesc($joiner) . " " . dbesc($field) . " like '" . protect_sprintf( '%' . dbesc($s) . '%' ) . "' "; + return $ret; +} + +function dir_parse_query($s) { + + $ret = array(); + $curr = array(); + $all = explode(' ',$s); + $quoted_string = false; + + if($all) { + foreach($all as $q) { + if($q === 'and') { + $curr['logic'] = 'and'; + continue; + } + if($q === 'or') { + $curr['logic'] = 'or'; + continue; + } + if(strpos($q,'=')) { + if(! isset($curr['logic'])) + $curr['logic'] = 'or'; + $curr['field'] = trim(substr($q,0,strpos($q,'='))); + $curr['value'] = trim(substr($q,strpos($q,'=')+1)); + if(strpos($curr['value'],'"') !== false) { + $quoted_string = true; + $curr['value'] = substr($curr['value'],strpos($curr['value'],'"')+1); + } + else { + $ret[] = $curr; + $curr = array(); + $continue; + } + } + elseif($quoted_string) { + if(strpos($q,'"') !== false) { + $curr['value'] .= ' ' . str_replace('"','',trim($q)); + $ret[] = $curr; + $curr = array(); + $quoted_string = false; + } + else + $curr['value'] .= ' ' . trim(q); + } + } + } + logger('dir_parse_query:' . print_r($ret,true),LOGGER_DATA); + return $ret; +} + + + + + + function list_public_sites() { $r = q("select * from site where site_access != 0 and site_register !=0 order by rand()"); -- cgit v1.2.3 From bef416a2d122609cb43b046cfc4211421f4149fd Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 8 Mar 2014 17:39:20 -0800 Subject: advanced search front-end --- mod/directory.php | 8 ++++++-- mod/dirsearch.php | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/directory.php b/mod/directory.php index 8fc62e95b..6e0e2e7dc 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -42,12 +42,13 @@ function directory_content(&$a) { else $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); + $advanced = ((x($_REQUEST,'query')) ? notags(trim($_REQUEST['query'])) : ''); + $keywords = (($_GET['keywords']) ? $_GET['keywords'] : ''); $tpl = get_markup_template('directory_header.tpl'); - $dirmode = intval(get_config('system','directory_mode')); if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) { @@ -81,6 +82,7 @@ function directory_content(&$a) { if($url) { // We might want to make the tagadelic count (&kw=) configurable or turn it off completely. + $numtags = get_config('system','directorytags'); $kw = ((intval($numtags)) ? $numtags : 24); @@ -92,7 +94,9 @@ function directory_content(&$a) { $query .= '&address=' . urlencode($search); if($keywords) $query .= '&keywords=' . urlencode($keywords); - + if($advanced) + $query .= '&query=' . urlencode($advanced); + $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : ''); if($sort_order) $query .= '&order=' . urlencode($sort_order); diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 759e27c5b..1f2ec1108 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -283,6 +283,10 @@ function dir_parse_query($s) { $curr['logic'] = 'or'; continue; } + if($q === 'not') { + $curr['logic'] .= ' not'; + continue; + } if(strpos($q,'=')) { if(! isset($curr['logic'])) $curr['logic'] = 'or'; -- cgit v1.2.3