From 9391fc965d68fea5fc18e93a1583e90d8f11bd02 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 2 Apr 2012 17:43:11 -0700 Subject: bug #363 and a couple of other reported ssl link issues --- mod/admin.php | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 53b5ee354..8caa76370 100755 --- a/mod/admin.php +++ b/mod/admin.php @@ -208,6 +208,38 @@ function admin_page_site_post(&$a){ $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False); $ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0); + if($ssl_policy != intval(get_config('system','ssl_policy'))) { + if($ssl_policy == SSL_POLICY_FULL) { + q("update `contact` set + `url` = replace(`url` , 'http:' , 'https:'), + `photo` = replace(`photo` , 'http:' , 'https:'), + `thumb` = replace(`thumb` , 'http:' , 'https:'), + `micro` = replace(`micro` , 'http:' , 'https:'), + `request` = replace(`request`, 'http:' , 'https:'), + `notify` = replace(`notify` , 'http:' , 'https:'), + `poll` = replace(`poll` , 'http:' , 'https:'), + `confirm` = replace(`confirm`, 'http:' , 'https:'), + `poco` = replace(`poco` , 'http:' , 'https:') + where `self` = 1" + ); + } + elseif($ssl_policy == SSL_POLICY_SELFSIGN) { + q("update `contact` set + `url` = replace(`url` , 'https:' , 'http:'), + `photo` = replace(`photo` , 'https:' , 'http:'), + `thumb` = replace(`thumb` , 'https:' , 'http:'), + `micro` = replace(`micro` , 'https:' , 'http:'), + `request` = replace(`request`, 'https:' , 'http:'), + `notify` = replace(`notify` , 'https:' , 'http:'), + `poll` = replace(`poll` , 'https:' , 'http:'), + `confirm` = replace(`confirm`, 'https:' , 'http:'), + `poco` = replace(`poco` , 'https:' , 'http:') + where `self` = 1" + ); + } + } + set_config('system','ssl_policy',$ssl_policy); + set_config('config','sitename',$sitename); if ($banner==""){ // don't know why, but del_config doesn't work... @@ -218,7 +250,6 @@ function admin_page_site_post(&$a){ } else { set_config('system','banner', $banner); } - set_config('system','ssl_policy',$ssl_policy); set_config('system','language', $language); set_config('system','theme', $theme); set_config('system','maximagesize', $maximagesize); -- cgit v1.2.3 From e1de2e3de0142c350fd74ea2161117ed61654dd6 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 2 Apr 2012 19:38:13 -0700 Subject: don't change ssl settings on local photos for remote contact --- mod/dfrn_notify.php | 9 --------- 1 file changed, 9 deletions(-) (limited to 'mod') diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 8e4ce0671..4ce324652 100755 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -107,9 +107,6 @@ function dfrn_notify_post(&$a) { $ssl_changed = true; $importer['url'] = str_replace('https:','http:',$importer['url']); $importer['nurl'] = normalise_link($importer['url']); - $importer['photo'] = str_replace('https:','http:',$importer['photo']); - $importer['thumb'] = str_replace('https:','http:',$importer['thumb']); - $importer['micro'] = str_replace('https:','http:',$importer['micro']); $importer['request'] = str_replace('https:','http:',$importer['request']); $importer['notify'] = str_replace('https:','http:',$importer['notify']); $importer['poll'] = str_replace('https:','http:',$importer['poll']); @@ -121,9 +118,6 @@ function dfrn_notify_post(&$a) { $ssl_changed = true; $importer['url'] = str_replace('http:','https:',$importer['url']); $importer['nurl'] = normalise_link($importer['url']); - $importer['photo'] = str_replace('http:','https:',$importer['photo']); - $importer['thumb'] = str_replace('http:','https:',$importer['thumb']); - $importer['micro'] = str_replace('http:','https:',$importer['micro']); $importer['request'] = str_replace('http:','https:',$importer['request']); $importer['notify'] = str_replace('http:','https:',$importer['notify']); $importer['poll'] = str_replace('http:','https:',$importer['poll']); @@ -146,9 +140,6 @@ function dfrn_notify_post(&$a) { where id = %d limit 1", dbesc($importer['url']), dbesc($importer['nurl']), - dbesc($importer['photo']), - dbesc($importer['thumb']), - dbesc($importer['micro']), dbesc($importer['request']), dbesc($importer['notify']), dbesc($importer['poll']), -- cgit v1.2.3 From f4721955dbfb23992c4acdadd05108cb1b92e2af Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 2 Apr 2012 21:01:19 -0700 Subject: more ssl policy fixes and prevent delivery to soapbox when using local delivery --- mod/dfrn_notify.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'mod') diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 4ce324652..5d44e8144 100755 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -106,7 +106,6 @@ function dfrn_notify_post(&$a) { if($ssl_policy == 'self' && strstr($importer['url'],'https:')) { $ssl_changed = true; $importer['url'] = str_replace('https:','http:',$importer['url']); - $importer['nurl'] = normalise_link($importer['url']); $importer['request'] = str_replace('https:','http:',$importer['request']); $importer['notify'] = str_replace('https:','http:',$importer['notify']); $importer['poll'] = str_replace('https:','http:',$importer['poll']); @@ -117,7 +116,6 @@ function dfrn_notify_post(&$a) { if($ssl_policy == 'full' && strstr($importer['url'],'http:')) { $ssl_changed = true; $importer['url'] = str_replace('http:','https:',$importer['url']); - $importer['nurl'] = normalise_link($importer['url']); $importer['request'] = str_replace('http:','https:',$importer['request']); $importer['notify'] = str_replace('http:','https:',$importer['notify']); $importer['poll'] = str_replace('http:','https:',$importer['poll']); @@ -129,9 +127,6 @@ function dfrn_notify_post(&$a) { q("update contact set url = '%s', nurl = '%s', - photo = '%s', - thumb = '%s', - micro = '%s', request = '%s', notify = '%s', poll = '%s', -- cgit v1.2.3 From 5d0d9f877294258cb90e1c496b4db750ee99f3ca Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 2 Apr 2012 23:07:26 -0700 Subject: make contact ssl_policy change a function since it is used in a few places --- mod/dfrn_notify.php | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'mod') diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 5d44e8144..65d39d5fe 100755 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -99,51 +99,10 @@ function dfrn_notify_post(&$a) { $importer['forum'] = $page; } - // if contact's ssl policy changed, update our links - - $ssl_changed = false; - if($ssl_policy == 'self' && strstr($importer['url'],'https:')) { - $ssl_changed = true; - $importer['url'] = str_replace('https:','http:',$importer['url']); - $importer['request'] = str_replace('https:','http:',$importer['request']); - $importer['notify'] = str_replace('https:','http:',$importer['notify']); - $importer['poll'] = str_replace('https:','http:',$importer['poll']); - $importer['confirm'] = str_replace('https:','http:',$importer['confirm']); - $importer['poco'] = str_replace('https:','http:',$importer['poco']); - } - - if($ssl_policy == 'full' && strstr($importer['url'],'http:')) { - $ssl_changed = true; - $importer['url'] = str_replace('http:','https:',$importer['url']); - $importer['request'] = str_replace('http:','https:',$importer['request']); - $importer['notify'] = str_replace('http:','https:',$importer['notify']); - $importer['poll'] = str_replace('http:','https:',$importer['poll']); - $importer['confirm'] = str_replace('http:','https:',$importer['confirm']); - $importer['poco'] = str_replace('http:','https:',$importer['poco']); - } + // if contact's ssl policy changed, update our links - if($ssl_changed) { - q("update contact set - url = '%s', - nurl = '%s', - request = '%s', - notify = '%s', - poll = '%s', - confirm = '%s', - poco = '%s' - where id = %d limit 1", - dbesc($importer['url']), - dbesc($importer['nurl']), - dbesc($importer['request']), - dbesc($importer['notify']), - dbesc($importer['poll']), - dbesc($importer['confirm']), - dbesc($importer['poco']), - intval($importer['id']) - ); - } - + fix_contact_ssl_policy($importer,$ssl_policy); logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: data: ' . $data, LOGGER_DATA); -- cgit v1.2.3 From 4b762ff923626addc10e3b90c6fef183320c84ea Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Apr 2012 02:44:29 -0700 Subject: suppress duplicates in search --- mod/search.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'mod') diff --git a/mod/search.php b/mod/search.php index 6495fc8e5..4ca7db9bb 100755 --- a/mod/search.php +++ b/mod/search.php @@ -97,27 +97,26 @@ function search_content(&$a) { // OR your own posts if you are a logged in member // No items will be shown if the member has a blocked profile wall. - $r = q("SELECT COUNT(*) AS `total` + $r = q("SELECT distinct(`item`.`uri`) as `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", + AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) group by `item`.`uri` ", intval(local_user()), dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\[') ); if(count($r)) - $a->set_pager_total($r[0]['total']); - - if(! $r[0]['total']) { + $a->set_pager_total(count($r)); + if(! count($r)) { info( t('No results.') . EOL); return $o; } - $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, + $r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`, @@ -128,7 +127,8 @@ function search_content(&$a) { AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 ) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) + AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) + group by `item`.`uri` ORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), dbesc(preg_quote($search)), -- cgit v1.2.3 From dbe16afcd41376ce3cc93fe7ec98a83a71644878 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Apr 2012 19:16:02 -0700 Subject: include contact_widgets for categories_widget when doing updates --- mod/profile.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') diff --git a/mod/profile.php b/mod/profile.php index 26b33d5f1..66386160f 100755 --- a/mod/profile.php +++ b/mod/profile.php @@ -124,6 +124,8 @@ function profile_content(&$a, $update = 0) { return; } + require_once('include/contact_widgets.php'); + $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : '')); if(! $update) { -- cgit v1.2.3 From 96abee53e49c70679919dc0f0ac8a44439e36aa3 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Apr 2012 19:20:39 -0700 Subject: this is better --- mod/profile.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/profile.php b/mod/profile.php index 66386160f..68d73fba3 100755 --- a/mod/profile.php +++ b/mod/profile.php @@ -124,11 +124,9 @@ function profile_content(&$a, $update = 0) { return; } - require_once('include/contact_widgets.php'); + if(! $update) { - $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : '')); - if(! $update) { if(x($_GET,'tab')) $tab = notags(trim($_GET['tab'])); @@ -150,6 +148,7 @@ function profile_content(&$a, $update = 0) { $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : '')); if(can_write_wall($a,$a->profile['profile_uid'])) { -- cgit v1.2.3 From 466188ebd77a4ef07fce459d9a591f4b45b08d44 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Apr 2012 20:14:37 -0700 Subject: re-opened bug #363 --- mod/admin.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 8caa76370..a395027c1 100755 --- a/mod/admin.php +++ b/mod/admin.php @@ -222,6 +222,11 @@ function admin_page_site_post(&$a){ `poco` = replace(`poco` , 'http:' , 'https:') where `self` = 1" ); + q("update `profile` set + `photo` = replace(`photo` , 'http:' , 'https:'), + `thumb` = replace(`thumb` , 'http:' , 'https:') + where 1 " + ); } elseif($ssl_policy == SSL_POLICY_SELFSIGN) { q("update `contact` set @@ -236,6 +241,11 @@ function admin_page_site_post(&$a){ `poco` = replace(`poco` , 'https:' , 'http:') where `self` = 1" ); + q("update `profile` set + `photo` = replace(`photo` , 'https:' , 'http:'), + `thumb` = replace(`thumb` , 'https:' , 'http:') + where 1 " + ); } } set_config('system','ssl_policy',$ssl_policy); -- cgit v1.2.3 From 8e928d101b628c5f562cee840882892f05a1b838 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Apr 2012 22:01:52 -0700 Subject: display settings hooks --- mod/settings.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index 926d1faa5..6879da285 100755 --- a/mod/settings.php +++ b/mod/settings.php @@ -229,7 +229,7 @@ function settings_post(&$a) { if ($theme == $a->user['theme']){ - // call theme_post only if theme has not benn changed + // call theme_post only if theme has not been changed if( ($themeconfigfile = get_theme_config_file($theme)) != null){ require_once($themeconfigfile); theme_post($a); @@ -242,6 +242,7 @@ function settings_post(&$a) { intval(local_user()) ); + call_hooks('display_settings_post', $_POST); goaway($a->get_baseurl(true) . '/settings/display' ); return; // NOTREACHED } @@ -679,6 +680,8 @@ function settings_content(&$a) { '$settings_connectors' => $settings_connectors )); + + call_hooks('display_settings', $o); return $o; } -- cgit v1.2.3 From 60c57704c6fef12784e37ac9e9060c51420f6db3 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Apr 2012 02:02:23 -0700 Subject: better handling of reshares containing embeds --- mod/share.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/share.php b/mod/share.php index 47bb851a4..6c6098c83 100755 --- a/mod/share.php +++ b/mod/share.php @@ -16,18 +16,18 @@ function share_init(&$a) { $o = ''; - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) { +// if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) { $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n"; if($r[0]['title']) $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n"; $o .= $r[0]['body'] . "\n"; - } - else { - $o .= '♲ ' . $r[0]['author-name'] . '
'; - if($r[0]['title']) - $o .= '' . $r[0]['title'] . '
'; - $o .= bbcode($r[0]['body'], true) . '
'; - } +// } +// else { +// $o .= '♲ ' . $r[0]['author-name'] . '
'; +// if($r[0]['title']) +// $o .= '' . $r[0]['title'] . '
'; +// $o .= $r[0]['body'] . "\n"; +// } echo $o; killme(); } -- cgit v1.2.3 From f63636ed14ccd0e88f6e01153029ff6b79c91027 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Apr 2012 17:19:46 -0700 Subject: well that was a stupid mistake... --- mod/dfrn_poll.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 6030587ce..5c2788983 100755 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -33,7 +33,7 @@ function dfrn_poll_init(&$a) { $user = ''; if($a->argc > 1) { - $r = q("SELECT `hidewall` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1", + $r = q("SELECT `hidewall`,`nickname` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1", dbesc($a->argv[1]) ); if((! count($r)) || (count($r) && $r[0]['hidewall'])) -- cgit v1.2.3 From da0eb2d4c9bfad5eb329e9da7d0443f3f6327095 Mon Sep 17 00:00:00 2001 From: Michael Johnston Date: Wed, 4 Apr 2012 23:08:16 -0400 Subject: correct some filer dialog weirdness caused by introduction of categories --- mod/filer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/filer.php b/mod/filer.php index 3cd1bfe22..c0cca9e6d 100755 --- a/mod/filer.php +++ b/mod/filer.php @@ -22,7 +22,8 @@ function filer_content(&$a) { } else { // return filer dialog $filetags = get_pconfig(local_user(),'system','filetags'); - $filetags = explode("][", trim($filetags,"[]")); + $filetags = file_tag_file_to_list($filetags,'file'); + $filetags = explode(",", $filetags); $tpl = get_markup_template("filer_dialog.tpl"); $o = replace_macros($tpl, array( '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), -- cgit v1.2.3 From b45327b856a3ce116931c6b554e23fc1bef20b7c Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Apr 2012 20:45:48 -0700 Subject: let's catch d* disabled at a higher level and not waste any resources on it. --- mod/receive.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mod') diff --git a/mod/receive.php b/mod/receive.php index 950bf0bd3..2bd3cc65b 100755 --- a/mod/receive.php +++ b/mod/receive.php @@ -12,6 +12,13 @@ require_once('include/diaspora.php'); function receive_post(&$a) { + + $enabled = intval(get_config('system','diaspora_enabled')); + if(! $enabled) { + logger('mod-diaspora: disabled'); + http_status_exit(500); + } + $public = false; if(($a->argc == 2) && ($a->argv[1] === 'public')) { -- cgit v1.2.3 From 9b6e91086b29554fd04362f6c87ea148718e8b1c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 5 Apr 2012 02:15:03 -0700 Subject: make 'PHP "register_argc_argv"' easier to translate, may require fix for po2php --- mod/install.php | 2 +- mod/poco.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/install.php b/mod/install.php index 003d81c6a..d1142248a 100755 --- a/mod/install.php +++ b/mod/install.php @@ -340,7 +340,7 @@ function check_php(&$phpath, &$checks) { $help .= t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL; $help .= t('This is required for message delivery to work.'); } - check_add($checks, t('PHP "register_argc_argv"'), $passed, true, $help); + check_add($checks, t('PHP register_argc_argv'), $passed, true, $help); } diff --git a/mod/poco.php b/mod/poco.php index 79cf820bc..acfa3ffaa 100755 --- a/mod/poco.php +++ b/mod/poco.php @@ -45,6 +45,8 @@ function poco_init(&$a) { if($justme) $sql_extra = " and `contact`.`self` = 1 "; + else + $sql_extra = " and `contact`.`self` = 0 "; if($cid) $sql_extra = sprintf(" and `contact`.`id` = %d ",intval($cid)); -- cgit v1.2.3