aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorSimon L'nu <simon.lnu@gmail.com>2012-04-04 02:14:26 -0400
committerSimon L'nu <simon.lnu@gmail.com>2012-04-04 02:14:26 -0400
commit2871e28df702f32fc780a84642f101931907d458 (patch)
tree3d1e6ce8c5f044467d95844328ac15a4c6e79d0a /include/network.php
parent06942b36549668eb067650831f286d96aab14a40 (diff)
parent8e928d101b628c5f562cee840882892f05a1b838 (diff)
downloadvolse-hubzilla-2871e28df702f32fc780a84642f101931907d458.tar.gz
volse-hubzilla-2871e28df702f32fc780a84642f101931907d458.tar.bz2
volse-hubzilla-2871e28df702f32fc780a84642f101931907d458.zip
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: display settings hooks re-opened bug #363 this is better include contact_widgets for categories_widget when doing updates remove loozah themes which fell too far behind to recover smal fix german translation for right_aside make right_aside translatable and provide german translation... and some css-fixes suppress duplicates in search make contact ssl_policy change a function since it is used in a few places more ssl policy fixes and prevent delivery to soapbox when using local delivery don't change ssl settings on local photos for remote contact * master:
Diffstat (limited to 'include/network.php')
-rwxr-xr-xinclude/network.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php
index 9e1ed2091..38d0980d5 100755
--- a/include/network.php
+++ b/include/network.php
@@ -824,3 +824,48 @@ function scale_external_images($s,$include_link = true) {
}
return $s;
}
+
+
+function fix_contact_ssl_policy(&$contact,$new_policy) {
+
+ $ssl_changed = false;
+ if((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
+ $ssl_changed = true;
+ $contact['url'] = str_replace('https:','http:',$contact['url']);
+ $contact['request'] = str_replace('https:','http:',$contact['request']);
+ $contact['notify'] = str_replace('https:','http:',$contact['notify']);
+ $contact['poll'] = str_replace('https:','http:',$contact['poll']);
+ $contact['confirm'] = str_replace('https:','http:',$contact['confirm']);
+ $contact['poco'] = str_replace('https:','http:',$contact['poco']);
+ }
+
+ if((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
+ $ssl_changed = true;
+ $contact['url'] = str_replace('http:','https:',$contact['url']);
+ $contact['request'] = str_replace('http:','https:',$contact['request']);
+ $contact['notify'] = str_replace('http:','https:',$contact['notify']);
+ $contact['poll'] = str_replace('http:','https:',$contact['poll']);
+ $contact['confirm'] = str_replace('http:','https:',$contact['confirm']);
+ $contact['poco'] = str_replace('http:','https:',$contact['poco']);
+ }
+
+ if($ssl_changed) {
+ q("update contact set
+ url = '%s',
+ request = '%s',
+ notify = '%s',
+ poll = '%s',
+ confirm = '%s',
+ poco = '%s'
+ where id = %d limit 1",
+ dbesc($contact['url']),
+ dbesc($contact['request']),
+ dbesc($contact['notify']),
+ dbesc($contact['poll']),
+ dbesc($contact['confirm']),
+ dbesc($contact['poco']),
+ intval($contact['id'])
+ );
+ }
+}
+