Permalink
Browse files

Allow any cobrand.

  • Loading branch information...
1 parent 75c05fd commit 373911ca139fa4dc65194e2c5475ff0b34caad98 @dracos dracos committed Mar 18, 2013
Showing with 14 additions and 67 deletions.
  1. +0 −16 bin/test-run
  2. +0 −3 conf/general-example
  3. +0 −12 perllib/FYR/Cobrand.pm
  4. +0 −12 phplib/cobrand.php
  5. +10 −19 phplib/fyr.php
  6. +4 −5 web-admin/index.php
View
@@ -441,22 +441,6 @@ sub do_send_cobrand_message {
confirm_message(2, $repinfo, $options);
check_delivered_to_rep(2, 'Anne Marie Canning', '32 Wheresome Wroad', $options);
$options->{cobrand} = undef;
-
- # Run tests in any TestHarness.pm files in for Cobrands
- my $allowed_cobrands = FYR::Cobrand::get_allowed_cobrands();
- foreach my $cobrand (@{$allowed_cobrands}){
- my $cobrand_class = ucfirst($cobrand);
- my $class = "Cobrands::" . $cobrand_class . "::TestHarness";
- print "Looking for tests for $cobrand_class\n" if $verbose > 0;
- eval "use $class";
- my $test_handle;
- eval{ $test_handle = $class->new($wth, $verbose, $multispawn); };
- next if $@;
- print "Running tests for $cobrand_class\n" if $verbose > 0;
- foreach my $test_function ($test_handle->test_functions()){
- $test_handle->$test_function();
- }
- }
}
#############################################################################
View
@@ -131,9 +131,6 @@ define('OPTION_TRACKING_SECRET', 'really-secret-value');
define('OPTION_SURVEY_SECRET', 'your-secret-value-here');
define('OPTION_SURVEY_URL', 'http://survey.mysociety.org');
-// Cobrands
-define('OPTION_ALLOWED_COBRANDS', 'animalaid|foiorder2009|freeourbills|cheltenham');
-
// Analytics
define('OPTION_GOOGLE_ANALYTICS_TRACKING_CODE', '');
View
@@ -62,18 +62,6 @@ sub get_cobrand_conf {
return $value;
}
-=item get_allowed_cobrands
-
-Return an array reference of allowed cobrand subdomains
-
-=cut
-sub get_allowed_cobrands {
- my $allowed_cobrand_string = mySociety::Config::get('ALLOWED_COBRANDS');
- my @allowed_cobrands = split(/\|/, $allowed_cobrand_string);
- return \@allowed_cobrands;
-}
-
-
=item base_url_for_emails COBRAND
Return the base url to use in links in emails for the cobranded
View
@@ -11,18 +11,6 @@
$handles = array();
-// List of subdomains of WriteToThem which are cobrands.
-function cobrand_allowed() {
- $allowed_cobrands_string = OPTION_ALLOWED_COBRANDS;
- $allowed_cobrands_list = explode('|', $allowed_cobrands_string);
- $allowed_cobrands = array();
- foreach ($allowed_cobrands_list as $i => $cobrand) {
- $allowed_cobrands[$cobrand] = 1;
- }
- return $allowed_cobrands;
-}
-
-
// To change look and feel, make new files in templates/. Look at cheltenham
// for examples. Also need to make file like web/cobrands/cheltenham/cheltenham.css. To change the
// behaviour of a cobranded site, add a function to phplib/cobrands/[cobrand name]/utils.php
View
@@ -37,33 +37,24 @@
template_set_style($dir . "/../templates/website");
# syndication type, read from domain name
+global $cobrand;
+$cobrand = null;
if (array_key_exists('HTTP_HOST', $_SERVER)) {
- $host_parts = explode('.', $_SERVER['HTTP_HOST']);
- $syn = $host_parts[0];
-} else {
- $syn = 'www';
+ $host_parts = explode('.', $_SERVER['HTTP_HOST'], 2);
+ if ($host_parts[1] == OPTION_WEB_DOMAIN) {
+ $cobrand = $host_parts[0];
+ }
}
-# or override for debugging
-if (array_key_exists('syn', $_GET)) {
- $syn = $_GET['syn'];
-}
-$cobrand_allowed = cobrand_allowed();
-global $cobrand;
-$cobrand = false;
-if (array_key_exists($syn, $cobrand_allowed)) {
- if (is_dir("../templates/$syn")) {
- template_set_style("../templates/$syn", true);
- }
- $cobrand = $syn;
+if (is_dir("../templates/$cobrand")) {
+ template_set_style("../templates/$cobrand", true);
}
global $cocode;
-$cocode = false;
$cocode = get_http_var('cocode');
if ($cobrand) {
- if (! cobrand_cocode_allowed($cobrand, $cocode)) {
- $cocode = false;
+ if (!cobrand_cocode_allowed($cobrand, $cocode)) {
+ $cocode = '';
}
}
View
@@ -61,11 +61,10 @@
if (OPTION_ADMIN_SERVICES_CGI)
$pages[] = new ADMIN_PAGE_EMBED('fyrmatch', 'Councillor Data', OPTION_ADMIN_SERVICES_CGI . 'match.cgi');
-if (OPTION_ALLOWED_COBRANDS != 'cities')
- array_push($pages,
- new ADMIN_PAGE_EMBED('fyrsignupgraph', 'Sent messages graph', OPTION_BASE_URL . '/fyr-live-signups.png'),
- new ADMIN_PAGE_EMBED('fyrfaxgraph', 'Faxes created graph', OPTION_BASE_URL . '/fyr-live-faxes.png')
- );
+array_push($pages,
+ new ADMIN_PAGE_EMBED('fyrsignupgraph', 'Sent messages graph', OPTION_BASE_URL . '/fyr-live-signups.png'),
+ new ADMIN_PAGE_EMBED('fyrfaxgraph', 'Faxes created graph', OPTION_BASE_URL . '/fyr-live-faxes.png')
+);
array_push($pages,
null, // space separator on menu

0 comments on commit 373911c

Please sign in to comment.