Skip to content
Newer
Older
100644 36 lines (32 sloc) 956 Bytes
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
1 <?php
df91f97 updated to include a hook_init
Jennifer Lea Lampton authored Jan 17, 2012
2 /**
3 * @file sopa.module
4 * Black out your site on Jan 18, 2012 in protest of SOPA.
5 */
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
6
7 /**
df91f97 updated to include a hook_init
Jennifer Lea Lampton authored Jan 18, 2012
8 * Implements hook_init().
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
9 */
df91f97 updated to include a hook_init
Jennifer Lea Lampton authored Jan 18, 2012
10 function sopa_init() {
11 // Onerous hackin' time!
12 $on_admin_page = strpos($_SERVER['REQUEST_URI'], 'admin') === 1;
13 $on_user_page = strpos($_SERVER['REQUEST_URI'], 'user') === 1;
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
14
df91f97 updated to include a hook_init
Jennifer Lea Lampton authored Jan 18, 2012
15 if (isset($_GET['sopa_test']) || !($on_admin_page || $on_user_page)) {
16 if (isset($_GET['sopa_test']) || date('Y-m-d') == '2012-01-18') {
17 // Preserve SE ranking. @see http://drupal.org/node/1405892#comment-5481540
18 header('HTTP/1.1 503 Service Temporarily Unavailable');
19 header('Retry-After: Thu, 19 Jan 2012 00:00:00 GMT');
20 print file_get_contents(dirname(__FILE__) .'/template/sopa.html');
21 exit();
22 }
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
23 }
24 }
25
26 /**
df91f97 updated to include a hook_init
Jennifer Lea Lampton authored Jan 18, 2012
27 * Implements hook_help().
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
28 */
7e168d7 cleanup of help hook too, on the correct branch this time
Jennifer Lea Lampton authored Jan 17, 2012
29 function sopa_help($path, $arg) {
30 switch ($path) {
31 case "admin/help#sopa":
32 return t("Block out your site on January 18, 2012.");
fb8e327 @mcantelon First commit eh.
authored Jan 15, 2012
33 break;
34 }
35 }
Something went wrong with that request. Please try again.