My custom changes to Invision Community core files
This post is mostly a note to myself, to keep track of the changes I make to the core files of my Invision Community installation. I’m working on transforming these changes into one or more small, private plugins, to simplify the process of updating my community.
It’s not recommended to make changes to these files, as they will be overwritten on every update. You might also have to manually upload the new versions of the files you’ve changed, adding a delay to the update process.
/system/File/Amazon.php:
This change forces all assets stored on an Amazon S3 endpoint to be fetched using HTTPS, instead of using a relative protocol. I found this change necessary to make nginx-pagespeed work with HTTPS. For reasons I can’t explain or document at the moment, nginx-pagespeed seems to dislike assets served from relative protocols when configured to use HTTPS.
@@ -238,7 +238,7 @@ class _Amazon extends \IPS\File
*/
public function baseUrl()
{
- return preg_replace( '#^http(s)?://#', '//', rtrim( ( empty( $this->configuration['custom_url'] ) ) ? static::buildBaseUrl( $this->configuration ) : $this->configuration['custom_url'], '/' ) );
+ return preg_replace( '#^http(s)?://#', 'https://', rtrim( ( empty( $this->configuration['custom_url'] ) ) ? static::buildBaseUrl( $this->configuration ) : $this->configuration['custom_url'], '/' ) );
}
/**
/applications/calendar/sources/Date/Date.php:
Prevent a leading zero to be added to the date, when displaying the date in the calendar application. This change is unfortunately required in order to change the date format, as the leading zero is hard coded and changing the date format in the translations makes no difference.
@@ -836,7 +836,7 @@ class _Date extends \IPS\DateTime
return ( $data[ $key ] == 0 ) ? 6: ( $data[ $key ] - 1 );
}
- if( $key == 'mon' OR $key == 'mday' )
+ if( $key == 'mon' )
{
return str_pad( $data[ $key ], 2, '0', STR_PAD_LEFT );
}
/system/GeoLocation/Maps/Mapbox.php:
Change the Mapbox map style from Streets to Navigation Preview Day, and remove the Mapbox logo.
@@ -55,10 +55,11 @@ class _Mapbox
$location = str_replace( ',', '.', $this->geolocation->long ) . ',' . str_replace( ',', '.', $this->geolocation->lat );
- $imageUrl = \IPS\Http\Url::external( "https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/pin-l-marker+f00({$location})/{$location},14,0,60/{$width}x{$height}@2x" )->setQueryString( array(
+ $imageUrl = \IPS\Http\Url::external( "https://api.mapbox.com/styles/v1/mapbox/navigation-preview-day-v4/static/pin-l-marker+f00({$location})/{$location},14,0,60/{$width}x{$height}@2x" )->setQueryString( array(
'access_token' => \IPS\Settings::i()->mapbox_api_key,
+ 'logo' => 'false',
) );
return \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->staticMap( NULL, $imageUrl, $this->geolocation->lat, $this->geolocation->long );
/system/Http/Url.php:
As with the change in /system/File/Amazon.php
, the change here is made in
order to force HTTPS when constructing URLs with the relative protocol.
@@ -830,7 +830,7 @@ class _Url
break;
case static::PROTOCOL_RELATIVE:
- $url = '//' . mb_substr( $url, mb_strpos( $url, '://' ) + 3 );
+ $url = 'https://' . mb_substr( $url, mb_strpos( $url, '://' ) + 3 );
break;
}
}
This post will be updated when new changes are made, or when one of the existing changes are changed.