Skip to content

Commit

Permalink
updated to include a hook_init
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Lea Lampton committed Jan 18, 2012
1 parent d8b989e commit df91f97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
5 changes: 2 additions & 3 deletions sopa.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name = Sopa Blackout
description = Black out your site on Jan 18, 2012 in protest of SOPA.

core = "7.x"
project = "sopa"
version 6.x-1.0
core = 6.x
30 changes: 19 additions & 11 deletions sopa.module
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<?php
/**
* @file sopa.module
* Black out your site on Jan 18, 2012 in protest of SOPA.
*/

/**
* Onerous hackin' time!
* Implements hook_init().
*/
$on_admin_page = strpos($_SERVER['REQUEST_URI'], 'admin') === 1;
$on_user_page = strpos($_SERVER['REQUEST_URI'], 'user') === 1;
function sopa_init() {
// Onerous hackin' time!
$on_admin_page = strpos($_SERVER['REQUEST_URI'], 'admin') === 1;
$on_user_page = strpos($_SERVER['REQUEST_URI'], 'user') === 1;

if (isset($_GET['sopa_test']) || !($on_admin_page || $on_user_page)) {
if (isset($_GET['sopa_test']) || date('Y-m-d') == '2012-01-18') {
// Preserve SE ranking. @see http://drupal.org/node/1405892#comment-5481540
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Retry-After: Thu, 19 Jan 2012 00:00:00 GMT');
print file_get_contents(dirname(__FILE__) .'/template/sopa.html');
exit();
if (isset($_GET['sopa_test']) || !($on_admin_page || $on_user_page)) {
if (isset($_GET['sopa_test']) || date('Y-m-d') == '2012-01-18') {
// Preserve SE ranking. @see http://drupal.org/node/1405892#comment-5481540
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Retry-After: Thu, 19 Jan 2012 00:00:00 GMT');
print file_get_contents(dirname(__FILE__) .'/template/sopa.html');
exit();
}
}

}

/**
* Implementation of hook_help().
* Implements hook_help().
*/
function sopa_help($section = '') {
$output= '';
Expand Down

0 comments on commit df91f97

Please sign in to comment.