From 7e33c1072a4a948941e2522afe0123899b0abddd Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 19 Mar 2011 01:19:11 -0700 Subject: stuff to make connecting to diaspora profiles easier --- mod/follow.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/follow.php b/mod/follow.php index 689ae8232..4ce3ccb82 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -11,7 +11,7 @@ function follow_post(&$a) { } $url = $orig_url = notags(trim($_POST['url'])); - + $diaspora = false; $email_conversant = false; if($url) { @@ -28,6 +28,9 @@ function follow_post(&$a) { $hcard = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') $profile = unamp($link['@attributes']['href']); + if($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location') + $diaspora = true; + } @@ -90,9 +93,12 @@ function follow_post(&$a) { } } - if(! $profile) - $profile = $url; - + if(! $profile) { + if($diaspora) + $profile = $hcard; + else + $profile = $url; + } if(! x($vcard,'fn')) if(x($vcard,'nick')) -- cgit v1.2.3 From c1144912e2d2dab07c1e23aec5377e12bcf3e631 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 20 Mar 2011 08:38:42 +0100 Subject: small fix --- mod/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index 8298d0d3f..061542c75 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1074,7 +1074,7 @@ function photos_content(&$a) { $tpl = load_view_file('view/photo_item.tpl'); $return_url = $a->cmd; - $like_tpl = load_view_file('view/lik_noshare.tpl'); + $like_tpl = load_view_file('view/like_noshare.tpl'); $likebuttons = ''; -- cgit v1.2.3 From b7292bc673bc7983b1fd933070bc9d6a0a155dbb Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 20 Mar 2011 17:54:50 -0700 Subject: user pref -> block remote wall posting --- mod/settings.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index 85029b3d7..6a2733d7c 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -70,6 +70,7 @@ function settings_post(&$a) { $net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0); $old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0); $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); + $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! $notify = 0; @@ -140,7 +141,7 @@ function settings_post(&$a) { $openidserver = ''; } - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s' WHERE `uid` = %d LIMIT 1", + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($openid), @@ -157,6 +158,7 @@ function settings_post(&$a) { intval($maxreq), intval($expire), dbesc($openidserver), + intval($blockwall), intval(local_user()) ); if($r) @@ -241,6 +243,7 @@ function settings_content(&$a) { $openid = $a->user['openid']; $maxreq = $a->user['maxreq']; $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); + $blockwall = $a->user['blockwall']; if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); @@ -362,6 +365,7 @@ function settings_content(&$a) { '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''), '$maxreq' => $maxreq, '$expire' => $expire, + '$blockw_checked' => (($blockwall) ? '' : ' checked="checked" ' ), '$theme' => $theme_selector, '$pagetype' => $pagetype )); -- cgit v1.2.3 From 5f9f03daf781b95b5685a19d450800aad879c0de Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 20 Mar 2011 19:29:01 -0700 Subject: simplify insecure network warning --- mod/contacts.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/contacts.php b/mod/contacts.php index 029330b7a..c1455ec54 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -244,6 +244,9 @@ function contacts_content(&$a) { $sparkle = ''; } + $insecure = '

' . t('Privacy Unavailable') . ' ' + . t('Private communications are not available for this contact.') . '

'; + $last_update = (($r[0]['last-update'] == '0000-00-00 00:00:00') ? t('Never') : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')); @@ -266,7 +269,7 @@ function contacts_content(&$a) { '$contact_id' => $r[0]['id'], '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ), '$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ), - '$insecure' => (($r[0]['network'] === 'stat') ? load_view_file('view/insecure_net.tpl') : ''), + '$insecure' => (($r[0]['network'] !== 'dfrn') ? $insecure : ''), '$info' => $r[0]['info'], '$blocked' => (($r[0]['blocked']) ? '
' . t('Currently blocked') . '
' : ''), '$ignored' => (($r[0]['readonly']) ? '
' . t('Currently ignored') . '
' : ''), -- cgit v1.2.3 From 798c83b6aa3887622299ec4071c0d817953f3db9 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 00:21:35 -0700 Subject: localise some more templates --- mod/message.php | 3 ++- mod/network.php | 7 ++++++- mod/profile.php | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/message.php b/mod/message.php index 4821a45d2..9d30abd66 100644 --- a/mod/message.php +++ b/mod/message.php @@ -168,7 +168,8 @@ function message_content(&$a) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), - '$nickname' => $a->user['nickname'] + '$nickname' => $a->user['nickname'], + '$linkurl' => t('Please enter a link URL:') )); $select = contact_select('messageto','message-to-select', false, 4, true); diff --git a/mod/network.php b/mod/network.php index 81c85f0ff..97bc0713d 100644 --- a/mod/network.php +++ b/mod/network.php @@ -65,7 +65,12 @@ function network_content(&$a, $update = 0) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$geotag' => $geotag, - '$nickname' => $a->user['nickname'] + '$nickname' => $a->user['nickname'], + '$linkurl' => t('Please enter a link URL:'), + '$utubeurl' => t('Please enter a YouTube link:'), + '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), + '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$whereareu' => t('Where are you right now?') )); diff --git a/mod/profile.php b/mod/profile.php index 1053e4a1e..82a84c39e 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -130,7 +130,12 @@ function profile_content(&$a, $update = 0) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$geotag' => $geotag, - '$nickname' => $a->profile['nickname'] + '$nickname' => $a->profile['nickname'], + '$linkurl' => t('Please enter a link URL:'), + '$utubeurl' => t('Please enter a YouTube link:'), + '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), + '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$whereareu' => t('Where are you right now?') )); require_once('include/acl_selectors.php'); -- cgit v1.2.3 From 94cbf3bb80371d5b4160db8bef1d70f28f8a0d97 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 04:10:08 -0700 Subject: another template down --- mod/profile.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/profile.php b/mod/profile.php index 82a84c39e..fad8bc79b 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -98,7 +98,10 @@ function profile_content(&$a, $update = 0) { $o .= replace_macros($tpl,array( '$url' => $a->get_baseurl() . '/' . $a->cmd, - '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'] + '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'], + '$status' => t('Status') + '$profile' => t('Profile'), + '$photos' => t('Photos') )); -- cgit v1.2.3 From d71db3e0645a71cf65b095f9cf0dcfdd2b2b8980 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 15:12:40 -0700 Subject: typo --- mod/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/profile.php b/mod/profile.php index fad8bc79b..4b5f92a1f 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -99,7 +99,7 @@ function profile_content(&$a, $update = 0) { $o .= replace_macros($tpl,array( '$url' => $a->get_baseurl() . '/' . $a->cmd, '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'], - '$status' => t('Status') + '$status' => t('Status'), '$profile' => t('Profile'), '$photos' => t('Photos') )); -- cgit v1.2.3 From f73e40c188a5baae6cad3e0884843be02df72a6c Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 17:34:29 -0700 Subject: several install issues sorted out --- mod/install.php | 62 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 24 deletions(-) (limited to 'mod') diff --git a/mod/install.php b/mod/install.php index dc91f848e..173df6d4b 100644 --- a/mod/install.php +++ b/mod/install.php @@ -14,17 +14,20 @@ function install_post(&$a) { $phpath = notags(trim($_POST['phpath'])); require_once("dba.php"); - + unset ($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); if(mysqli_connect_errno()) { + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, '', true); if(! mysqli_connect_errno()) { $r = q("CREATE DATABASE '%s'", dbesc($dbdata) ); - if($r) + if($r) { + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); + } } if(mysqli_connect_errno()) { notice( t('Could not create/connect to database.') . EOL); @@ -50,36 +53,47 @@ function install_post(&$a) { } $errors = load_database($db); - if(! $errors) { - // Our sessions normally are stored in the database. But as we have only managed - // to get it bootstrapped milliseconds ago, we have to apply a bit of trickery so - // that you'll see the following important notice (which is stored in the session). - - session_write_close(); - - require_once('session.php'); - session_start(); - session_regenerate_id(); - $_SESSION['sysmsg'] = ''; + if($errors) + $a->data['db_failed'] = true; + else + $a->data['db_installed'] = true; - notice( t('Database import succeeded.') . EOL - . t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL - . t('Please see the file "INSTALL.txt".') . EOL ); - goaway($a->get_baseurl() . '/register' ); - } - else { - $db = null; // start fresh - notice( t('Database import failed.') . EOL - . t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL - . t('Please see the file "INSTALL.txt".') . EOL ); - } + return; } function install_content(&$a) { + global $db; $o = ''; + + if(x($a->data,'db_installed')) { + $o .= '

' . t('Proceed with Installation') . '

'; + $o .= '

'; + $o .= t('Your Friendika site database has been installed.') . EOL; + $o .= t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL ; + $o .= t('Please see the file "INSTALL.txt".') . EOL ; + $o .= '
'; + $o .= '' . t('Proceed to registration') . '' ; + $o .= '

'; + return $o; + } + + if(x($a->data,'db_failed')) { + $o .= t('Database import failed.') . EOL; + $o .= t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL; + $o .= t('Please see the file "INSTALL.txt".') . EOL ; + return $o; + } + + if($db && $db->connected) { + $r = q("SELECT COUNT(*) as `total` FROM `user`"); + if($r && count($r) && $r[0]['total']) { + notice( t('Permission denied.') . EOL); + return ''; + } + } notice( t('Welcome to Friendika.') . EOL); -- cgit v1.2.3 From e16bca4f76fde5cea40b5a855ed9210718a7ed76 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 19:33:06 -0700 Subject: first prototype of profile match against global directory (hint: set some keywords) --- mod/install.php | 2 +- mod/match.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 mod/match.php (limited to 'mod') diff --git a/mod/install.php b/mod/install.php index 173df6d4b..5c508e4f2 100644 --- a/mod/install.php +++ b/mod/install.php @@ -14,7 +14,7 @@ function install_post(&$a) { $phpath = notags(trim($_POST['phpath'])); require_once("dba.php"); - unset ($db); + unset($db); $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true); if(mysqli_connect_errno()) { diff --git a/mod/match.php b/mod/match.php new file mode 100644 index 000000000..ce2ece428 --- /dev/null +++ b/mod/match.php @@ -0,0 +1,42 @@ +' . '' . $jj[1] . '' . $jj[0] . ''; + } + } + else { + notice( t('No matches') . EOL); + } + + } + return $o; +} \ No newline at end of file -- cgit v1.2.3 From ee1dff998047834319464ff10c16679aefcfdfab Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 19:44:00 -0700 Subject: converted json to symbolic references --- mod/match.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/match.php b/mod/match.php index ce2ece428..58c81a0cd 100644 --- a/mod/match.php +++ b/mod/match.php @@ -24,13 +24,13 @@ function match_content(&$a) { $x = post_url('http://dir.friendika.com/msearch', $params); + $j = json_decode($x); if(count($j)) { - - foreach($j as $jj) { - $o .= '' . '' . $jj[1] . '' . $jj[0] . ''; + + $o .= '' . '' . $jj->name . '' . $jj->name . ''; } } else { -- cgit v1.2.3 From c74367e4c2dbcb9ef20bc07a3ea815902c61600a Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 21:26:11 -0700 Subject: pagination in keyword match --- mod/match.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/match.php b/mod/match.php index 58c81a0cd..f3c78bc7d 100644 --- a/mod/match.php +++ b/mod/match.php @@ -3,9 +3,12 @@ function match_content(&$a) { + $o = ''; if(! local_user()) return; + $o .= '

' . t('Profile Keyword Match') . '

'; + $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) ); @@ -21,16 +24,25 @@ function match_content(&$a) { $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']); if($tags) { $params['s'] = $tags; - + if($a->pager['page'] != 1) + $params['p'] = $a->pager['page']; $x = post_url('http://dir.friendika.com/msearch', $params); $j = json_decode($x); - if(count($j)) { - foreach($j as $jj) { + if($j->total) { + $a->set_pager_total($j->total); + $a->set_pager_itemspage($j->items_page); + } - $o .= '' . '' . $jj->name . '' . $jj->name . ''; + if(count($j->results)) { + foreach($j->results as $jj) { + $o .= '
'; + $o .= '' . '' . $jj->name . '
'; + $o .= '
'; + $o .= ''; + $o .= '
'; } } else { @@ -38,5 +50,7 @@ function match_content(&$a) { } } + + $o .= paginate($a); return $o; } \ No newline at end of file -- cgit v1.2.3 From ee11a74d0b7cff5061a4d498f8ecd15e55b91b07 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 21 Mar 2011 21:43:22 -0700 Subject: profile match --- mod/contacts.php | 7 ++++++- mod/match.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/contacts.php b/mod/contacts.php index c1455ec54..aee6548fe 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -9,7 +9,10 @@ function contacts_init(&$a) { $a->page['aside'] .= group_side(); if($a->config['register_policy'] != REGISTER_CLOSED) - $a->page['aside'] .= ''; + $a->page['aside'] .= ''; + + if(strlen(get_config('system','directory_submit_url'))) + $a->page['aside'] .= ''; $tpl = load_view_file('view/follow.tpl'); $a->page['aside'] .= replace_macros($tpl,array( @@ -18,6 +21,8 @@ function contacts_init(&$a) { '$follow' => t('Follow') )); + + } function contacts_post(&$a) { diff --git a/mod/match.php b/mod/match.php index f3c78bc7d..7228529d7 100644 --- a/mod/match.php +++ b/mod/match.php @@ -7,7 +7,7 @@ function match_content(&$a) { if(! local_user()) return; - $o .= '

' . t('Profile Keyword Match') . '

'; + $o .= '

' . t('Profile Match') . '

'; $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) -- cgit v1.2.3