##########################################################################################
MISC-3: Adjust the cdnforjoomla plugin to optionally translate to a .onion
##########################################################################################
Issue Type: Sub-task
-----------------------------------------------------------------------------------------
Issue Information
====================
Priority: Major Status: Closed
Resolution: Done (2015-05-19 16:06:18)
Project: Miscellaneous (MISC)
Reported By: btasker
Assigned To: btasker
Child of: MISC-2 - Make bentasker.co.uk Available as Tor Hidden Service
Environment:NoNumber.nl CDN For Joomla Plugin v 3.4.0PRO
Affected Versions:
- Bentasker.co.uk via Tor
Targeted for fix in version:
- Bentasker.co.uk via Tor
Time Estimate: 0 minutes
Time Logged: 0 minutes
-----------------------------------------------------------------------------------------
Issue Description
==================
When a visitor visits the site via the .onion, need to be sure that the URLs use the
.onion domain instead of the www.
Will need to adjust the plugin so that it picks up on the indicator header and behaves
accordingly.
Essentially, all we want to do is to rewrite the scheme (from https to http), domain name
and the TLD
-----------------------------------------------------------------------------------------
Issue Relations
================
- CDN For Joomla product page (https://www.nonumber.nl/extensions/cdnforjoomla)
-----------------------------------------------------------------------------------------
Activity
==========
-----------------------------------------------------------------------------------------
2015-05-19 15:32:01
-----------------------------------------------------------------------------------------
btasker changed status from 'Open' to 'In Progress'
-----------------------------------------------------------------------------------------
2015-05-19 15:45:31 btasker
-----------------------------------------------------------------------------------------
Adding the additional config values is straightforward enough
I'm only using one static domain, so only need to make a change in one place.
-- BEGIN SNIPPET --
# diff -u cdnforjoomla.xml.org cdnforjoomla.xml
--- cdnforjoomla.xml.org 2015-05-19 15:37:08.957712726 +0100
+++ cdnforjoomla.xml 2015-05-19 15:36:37.692710748 +0100
@@ -34,6 +34,9 @@
+
+
+
-- END SNIPPET --
Just need to identify the best place to drop it into the helper now.
-----------------------------------------------------------------------------------------
2015-05-19 15:54:04 btasker
-----------------------------------------------------------------------------------------
Given that's where most of the process happens, this seemed like the logical place
-- BEGIN SNIPPET --
# diff -u helper.php.org helper.php
--- helper.php.org 2015-05-19 15:39:01.105718443 +0100
+++ helper.php 2015-05-19 15:51:52.960723647 +0100
@@ -132,7 +132,17 @@
}
$params->enable_versioning = $this->params->{'enable_versioning' .
$setid};
- $params->cdn = preg_replace('#/$#', '', $this->params->{'cdn' . $setid});
+
+
$onion_header=strtoupper(str_replace("-","_",$this->params->{'onion_header'}));
+
+ if (!empty($this->params->{'onion'}) &&
isset($_SERVER['HTTP_'.$onion_header]) && $_SERVER['HTTP_'.$onion_header] == ':true'){
+ $params->cdn = preg_replace('#/$#', '',
$this->params->{'onion'});
+ $params->protocol = 'http://';
+ }else{
+ $params->cdn = preg_replace('#/$#', '', $this->params->{'cdn' .
$setid});
+ }
+
+# $params->cdn = preg_replace('#/$#', '', $this->params->{'cdn' .
$setid});
$params->ignorefiles = explode(',', str_replace(array('\n', ' '),
array(',', ''), $this->params->{'ignorefiles' . $setid}));
$root = preg_replace(array('#^/#', '#/$#'), '', $this->params->{'root' .
$setid}) . '/';
-- END SNIPPET --
Tested with GET - the URL now rewrites correctly depending on whether or not that header
is present.
-----------------------------------------------------------------------------------------
2015-05-19 15:54:13
-----------------------------------------------------------------------------------------
btasker changed status from 'In Progress' to 'Resolved'
-----------------------------------------------------------------------------------------
2015-05-19 15:54:13
-----------------------------------------------------------------------------------------
btasker added 'Done' to resolution
-----------------------------------------------------------------------------------------
2015-05-19 15:54:18
-----------------------------------------------------------------------------------------
btasker changed status from 'Resolved' to 'Closed'
-----------------------------------------------------------------------------------------
2015-05-19 16:03:32
-----------------------------------------------------------------------------------------
btasker removed 'Done' from resolution
-----------------------------------------------------------------------------------------
2015-05-19 16:03:32
-----------------------------------------------------------------------------------------
btasker changed status from 'Closed' to 'Reopened'
-----------------------------------------------------------------------------------------
2015-05-19 16:06:18
-----------------------------------------------------------------------------------------
btasker changed status from 'Reopened' to 'Resolved'
-----------------------------------------------------------------------------------------
2015-05-19 16:06:18
-----------------------------------------------------------------------------------------
btasker added 'Done' to resolution
-----------------------------------------------------------------------------------------
2015-05-19 16:06:22
-----------------------------------------------------------------------------------------
btasker changed status from 'Resolved' to 'Closed'