Browse Source

Migrate to SITE_DOMAIN constant from (NON)SSL_SITE_URL

spaghetti 9 years ago
parent
commit
b577cb290e

+ 1
- 1
README.md View File

@@ -35,7 +35,7 @@ We use new PHP password hashing features that automatically rehash your password
35 35
 
36 36
 * When a torrent is trumped, the new torrent is made freeleech to users who snatched the old torrent for a few days
37 37
 * An attempt has been made to support magnet links. This has shown partial success.
38
-* This codebase is expected to run over https only. No effort has been made to explicitely break non-ssl functionality, but no effort has been made to continue supporting it either.
38
+* This codebase is expected to run over https only.
39 39
 
40 40
 ## Bug Fixes
41 41
 

+ 1
- 1
classes/autoenable.class.php View File

@@ -122,7 +122,7 @@ class AutoEnable {
122 122
             $TPL = NEW TEMPLATE;
123 123
             if ($Status == self::APPROVED) {
124 124
                 $TPL->open(SERVER_ROOT . '/templates/enable_request_accepted.tpl');
125
-                $TPL->set('SITE_URL', NONSSL_SITE_URL);
125
+                $TPL->set('SITE_DOMAIN', SITE_DOMAIN);
126 126
             } else {
127 127
                 $TPL->open(SERVER_ROOT . '/templates/enable_request_denied.tpl');
128 128
             }

+ 2
- 12
classes/config.template View File

@@ -6,8 +6,7 @@ if (PHP_VERSION_ID < 70000) {
6 6
 
7 7
 // Main settings
8 8
 define('SITE_NAME', 'Oppaitime'); //The name of your site
9
-define('NONSSL_SITE_URL', 'oppaiti.me'); //The FQDN of your site
10
-define('SSL_SITE_URL', 'oppaiti.me'); //The FQDN of your site, make this different if you are using a subdomain for ssl
9
+define('SITE_DOMAIN', 'oppaiti.me'); //The FQDN of your site
11 10
 define('SITE_IP', '8.8.8.8'); //The IP address by which your site can be publicly accessed
12 11
 define('SERVER_ROOT', '/var/www'); //The root of the server, used for includes, purpose is to shorten the path string
13 12
 
@@ -21,8 +20,7 @@ define('ANNOUNCE_URLS', [['https://tracker.'.SSL_SITE_URL.':34001',
21 20
 define('API_KEYS', ['ANIDB' => 'AAAAAAAAAAAAAAAA']);
22 21
 
23 22
 // Allows you to run static content off another server. Default is usually what you want.
24
-define('NONSSL_STATIC_SERVER', 'static/');
25
-define('SSL_STATIC_SERVER', 'static/');
23
+define('STATIC_SERVER', 'static/');
26 24
 
27 25
 // Keys
28 26
 define('ENCKEY', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); //Random key. The key for encryption
@@ -57,14 +55,6 @@ define('TRACKER_PORT', 34000);
57 55
 define('TRACKER_SECRET', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); // Must be 32 characters and match site_password in Ocelot's config.cpp
58 56
 define('TRACKER_REPORTKEY', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); // Must be 32 characters and match report_password in Ocelot's config.cpp
59 57
 
60
-if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 80) {
61
-	define('SITE_URL', NONSSL_SITE_URL);
62
-	define('STATIC_SERVER', NONSSL_STATIC_SERVER);
63
-} else {
64
-	define('SITE_URL', SSL_SITE_URL);
65
-	define('STATIC_SERVER', SSL_STATIC_SERVER);
66
-}
67
-
68 58
 // Site settings
69 59
 define('DEBUG_MODE', false); //Set to false if you dont want everyone to see debug information, can be overriden with 'site_debug'
70 60
 define('DEBUG_WARNINGS', true); //Set to true if you want to see PHP warnings in the footer

+ 1
- 1
classes/cookie.class.php View File

@@ -32,7 +32,7 @@ class COOKIE /*implements COOKIE_INTERFACE*/ {
32 32
 
33 33
 	//Pass the 4th optional param as false to allow JS access to the cookie
34 34
 	public function set($Key, $Value, $Seconds = 86400, $LimitAccess = SELF::LIMIT_ACCESS) {
35
-		setcookie(SELF::PREFIX.$Key, $Value, time() + $Seconds, '/', SITE_URL, $_SERVER['SERVER_PORT'] === '443', $LimitAccess, false);
35
+		setcookie(SELF::PREFIX.$Key, $Value, time() + $Seconds, '/', SITE_DOMAIN, $_SERVER['SERVER_PORT'] === '443', $LimitAccess, false);
36 36
 	}
37 37
 
38 38
 	public function del($Key) {

+ 2
- 4
classes/feed.class.php View File

@@ -1,7 +1,5 @@
1 1
 <?
2 2
 class FEED {
3
-	var $UseSSL = true; // If we're using SSL for blog and news links
4
-
5 3
 	function open_feed() {
6 4
 		header("Content-type: application/xml; charset=UTF-8");
7 5
 		echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n","<rss xmlns:dc=\"http://purl.org/dc/elements/1.1/\" version=\"2.0\">\n\t<channel>\n";
@@ -12,7 +10,7 @@ class FEED {
12 10
 	}
13 11
 
14 12
 	function channel($Title, $Description, $Section = '') {
15
-		$Site = $this->UseSSL ? site_url() : site_url(false);
13
+		$Site = site_url();
16 14
 		echo "\t\t<title>$Title :: ". SITE_NAME. "</title>\n";
17 15
 		echo "\t\t<link>$Site$Section</link>\n";
18 16
 		echo "\t\t<description>$Description</description>\n";
@@ -28,7 +26,7 @@ class FEED {
28 26
 		} else {
29 27
 			$Date = date('r', strtotime($Date));
30 28
 		}
31
-		$Site = $this->UseSSL ? site_url() : site_url(false);
29
+		$Site = site_url();
32 30
 		$Item = "\t\t<item>\n";
33 31
 		$Item .= "\t\t\t<title><![CDATA[$Title]]></title>\n";
34 32
 		$Item .= "\t\t\t<description><![CDATA[$Description]]></description>\n";

+ 2
- 4
classes/imagetools.class.php View File

@@ -169,8 +169,6 @@ class ImageTools {
169 169
 	 * @return image proxy URL
170 170
 	 */
171 171
 	public static function proxy_url($Url, $CheckSize, $UserID, &$ExtraInfo) {
172
-		global $SSL;
173
-
174 172
 		if ($UserID) {
175 173
 			$ExtraInfo = "&amp;userid=$UserID";
176 174
 			if ($CheckSize === 'avatar' && !isset(self::$CheckedAvatars[$UserID])) {
@@ -185,10 +183,10 @@ class ImageTools {
185 183
 			}
186 184
 		}
187 185
 
188
-    if (preg_match('/^https:\/\/'.SITE_URL.'\//', $Url)) {
186
+    if (preg_match('/^https:\/\/'.SITE_DOMAIN.'\//', $Url)) {
189 187
       return $Url;
190 188
     } else {
191
-      return ($SSL ? 'https' : 'http') . '://' . SITE_URL . "/image.php?c=1&amp;i=" . urlencode($Url);
189
+      return 'https://' . SITE_DOMAIN . "/image.php?c=1&amp;i=" . urlencode($Url);
192 190
     }
193 191
 	}
194 192
 

+ 5
- 5
classes/misc.class.php View File

@@ -6,18 +6,18 @@ class Misc {
6 6
 	 * @param string $To the email address to send it to.
7 7
 	 * @param string $Subject
8 8
 	 * @param string $Body
9
-	 * @param string $From The user part of the user@NONSSL_SITE_URL email address.
9
+	 * @param string $From The user part of the user@SITE_DOMAIN email address.
10 10
 	 * @param string $ContentType text/plain or text/html
11 11
 	 */
12 12
 	public static function send_email($To, $Subject, $Body, $From = 'noreply', $ContentType = 'text/plain') {
13 13
 		$Headers = 'MIME-Version: 1.0'."\r\n";
14 14
 		$Headers .= 'Content-type: '.$ContentType.'; charset=iso-8859-1'."\r\n";
15
-		$Headers .= 'From: '.SITE_NAME.' <'.$From.'@'.NONSSL_SITE_URL.'>'."\r\n";
16
-		$Headers .= 'Reply-To: '.$From.'@'.NONSSL_SITE_URL."\r\n";
15
+		$Headers .= 'From: '.SITE_NAME.' <'.$From.'@'.SITE_DOMAIN.'>'."\r\n";
16
+		$Headers .= 'Reply-To: '.$From.'@'.SITE_DOMAIN."\r\n";
17 17
 		$Headers .= 'X-Mailer: Project Gazelle'."\r\n";
18
-		$Headers .= 'Message-Id: <'.Users::make_secret().'@'.NONSSL_SITE_URL.">\r\n";
18
+		$Headers .= 'Message-Id: <'.Users::make_secret().'@'.SITE_DOMAIN.">\r\n";
19 19
 		$Headers .= 'X-Priority: 3'."\r\n";
20
-		mail($To, $Subject, $Body, $Headers, "-f $From@".NONSSL_SITE_URL);
20
+		mail($To, $Subject, $Body, $Headers, "-f $From@".SITE_DOMAIN);
21 21
 	}
22 22
 
23 23
 

+ 1
- 1
classes/regex.php View File

@@ -10,7 +10,7 @@ define('EMAIL_REGEX','[_a-z0-9-]+([.+][_a-z0-9-]+)*@'.DOMAIN_REGEX);
10 10
 define('IMAGE_REGEX', URL_REGEX.'\/\S+\.(jpg|jpeg|tif|tiff|png|gif|bmp)(\?\S*)?');
11 11
 define('VIDEO_REGEX', URL_REGEX.'\/\S+\.(webm)(\?\S*)?');
12 12
 define('CSS_REGEX', URL_REGEX.'\/\S+\.css(\?\S*)?');
13
-define('SITELINK_REGEX', RESOURCE_REGEX.'(ssl.)?'.preg_quote(NONSSL_SITE_URL, '/'));
13
+define('SITELINK_REGEX', RESOURCE_REGEX.'(www)?'.preg_quote(SITE_DOMAIN, '/'));
14 14
 define('TORRENT_REGEX', SITELINK_REGEX.'\/torrents\.php\?(.*&)?torrentid=(\d+)'); // torrentid = group 4
15 15
 define('TORRENT_GROUP_REGEX', SITELINK_REGEX.'\/torrents\.php\?(.*&)?id=(\d+)'); // id = group 4
16 16
 define('ARTIST_REGEX', SITELINK_REGEX.'\/artist\.php\?(.*&)?id=(\d+)'); // id = group 4

+ 4
- 18
classes/script_start.php View File

@@ -30,25 +30,11 @@ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])
30 30
 	$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
31 31
 }
32 32
 
33
-$SSL = true; #(isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);
34 33
 if (!isset($argv) && !empty($_SERVER['HTTP_HOST'])) {
35
-//Skip this block if running from cli or if the browser is old and shitty
36
-	if (!$SSL && $_SERVER['HTTP_HOST'] == 'www.'.NONSSL_SITE_URL) {
37
-		header('Location: http://'.NONSSL_SITE_URL.$_SERVER['REQUEST_URI']); die();
38
-	}
39
-	if ($SSL && $_SERVER['HTTP_HOST'] == 'www.'.NONSSL_SITE_URL) {
40
-		header('Location: https://'.SSL_SITE_URL.$_SERVER['REQUEST_URI']); die();
41
-	}
42
-	if (SSL_SITE_URL != NONSSL_SITE_URL) {
43
-		if (!$SSL && $_SERVER['HTTP_HOST'] == SSL_SITE_URL) {
44
-			header('Location: https://'.SSL_SITE_URL.$_SERVER['REQUEST_URI']); die();
45
-		}
46
-		if ($SSL && $_SERVER['HTTP_HOST'] == NONSSL_SITE_URL) {
47
-			header('Location: https://'.SSL_SITE_URL.$_SERVER['REQUEST_URI']); die();
48
-		}
49
-	}
50
-	if ($_SERVER['HTTP_HOST'] == 'www.m.'.NONSSL_SITE_URL) {
51
-		header('Location: http://m.'.NONSSL_SITE_URL.$_SERVER['REQUEST_URI']); die();
34
+  // Skip this block if running from cli or if the browser is old and shitty
35
+  // This should really be done in nginx config TODO: Remove
36
+	if ($_SERVER['HTTP_HOST'] == 'www.'.SITE_DOMAIN) {
37
+		header('Location: https://'.SITE_DOMAIN.$_SERVER['REQUEST_URI']); die();
52 38
 	}
53 39
 }
54 40
 

+ 4
- 5
classes/text.class.php View File

@@ -281,9 +281,9 @@ class Text {
281 281
 			return false;
282 282
 		}
283 283
 		$Host = $URLInfo['host'];
284
-		// If for some reason your site does not require subdomains or contains a directory in the SITE_URL, revert to the line below.
285
-		//if ($Host == NONSSL_SITE_URL || $Host == SSL_SITE_URL || $Host == 'www.'.NONSSL_SITE_URL) {
286
-		if (empty($URLInfo['port']) && preg_match('/(\S+\.)*'.NONSSL_SITE_URL.'/', $Host)) {
284
+		// If for some reason your site does not require subdomains or contains a directory in the SITE_DOMAIN, revert to the line below.
285
+		//if ($Host == SITE_DOMAIN || $Host == 'www.'.SITE_DOMAIN) {
286
+		if (empty($URLInfo['port']) && preg_match('/(\S+\.)*'.SITE_DOMAIN.'/', $Host)) {
287 287
 			$URL = '';
288 288
 			if (!empty($URLInfo['path'])) {
289 289
 				$URL .= ltrim($URLInfo['path'], '/'); // Things break if the path starts with '//'
@@ -665,7 +665,6 @@ class Text {
665 665
 	}
666 666
 
667 667
 	private static function to_html ($Array) {
668
-		global $SSL;
669 668
 		self::$Levels++;
670 669
 		/*
671 670
 		 * Hax prevention
@@ -720,7 +719,7 @@ class Text {
720 719
 					$Str .= '<a href="rules.php?p=upload#'.urlencode(Format::undisplay_str($Rule)).'">'.preg_replace('/[aA-zZ]/', '', $Block['Val']).'</a>';
721 720
 					break;
722 721
 				case 'torrent':
723
-					$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php.*[\?&]id=)?(\d+)($|&|\#).*/i';
722
+					$Pattern = '/('.SITE_DOMAIN.'\/torrents\.php.*[\?&]id=)?(\d+)($|&|\#).*/i';
724 723
 					$Matches = array();
725 724
 					if (preg_match($Pattern, $Block['Val'], $Matches)) {
726 725
 						if (isset($Matches[2])) {

+ 2
- 2
classes/users.class.php View File

@@ -47,7 +47,7 @@ class Users {
47 47
 	 *	int EffectiveClass - the highest level of their main and secondary classes
48 48
 	 */
49 49
 	public static function user_info($UserID) {
50
-		global $Classes, $SSL;
50
+		global $Classes;
51 51
 		$UserInfo = G::$Cache->get_value("user_info_$UserID");
52 52
 		// the !isset($UserInfo['Paranoia']) can be removed after a transition period
53 53
 		if (empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia']) || empty($UserInfo['Class'])) {
@@ -728,7 +728,7 @@ class Users {
728 728
     $TPL->set('ResetKey', $ResetKey);
729 729
     $TPL->set('IP', $_SERVER['REMOTE_ADDR']);
730 730
     $TPL->set('SITE_NAME', SITE_NAME);
731
-    $TPL->set('SITE_URL', NONSSL_SITE_URL);
731
+    $TPL->set('SITE_DOMAIN', SITE_DOMAIN); // TODO: Remove
732 732
 
733 733
     Misc::send_email($Email, 'Password reset information for ' . SITE_NAME, $TPL->get(), 'noreply');
734 734
   }

+ 2
- 4
classes/util.php View File

@@ -192,10 +192,8 @@ function json_print($Status, $Message) {
192 192
 
193 193
 /**
194 194
  * Print the site's URL including the appropriate URI scheme, including the trailing slash
195
- *
196
- * @param bool $SSL - whether the URL should be crafted for HTTPS or regular HTTP
197 195
  */
198
-function site_url($SSL = true) {
199
-	return $SSL ? 'https://' . SSL_SITE_URL . '/' : 'http://' . NONSSL_SITE_URL . '/';
196
+function site_url() {
197
+	return 'https://' . SITE_DOMAIN . '/';
200 198
 }
201 199
 ?>

+ 2
- 2
design/privateheader.php View File

@@ -1,7 +1,7 @@
1 1
 <?
2 2
 
3 3
 define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php');
4
-$HTTPS = ($_SERVER['SERVER_PORT'] == 443) ? 'ssl_' : '';
4
+$HTTPS = true;
5 5
 $UseTooltipster = !isset(G::$LoggedUser['Tooltipster']) || G::$LoggedUser['Tooltipster'];
6 6
 
7 7
 ?>
@@ -75,7 +75,7 @@ if ($Mobile) { ?>
75 75
 		$StyleURLInfo = parse_url(G::$LoggedUser['StyleURL']);
76 76
 		if (substr(G::$LoggedUser['StyleURL'], -4) == '.css'
77 77
 				&& empty($StyleURLInfo['query']) && empty($StyleURLInfo['fragment'])
78
-				&& in_array($StyleURLInfo['host'], array(NONSSL_SITE_URL, SSL_SITE_URL))
78
+				&& ($StyleURLInfo['host'] == SITE_DOMAIN)
79 79
 				&& file_exists(SERVER_ROOT.$StyleURLInfo['path'])) {
80 80
 			$StyleURL = G::$LoggedUser['StyleURL'].'?v='.filemtime(SERVER_ROOT.$StyleURLInfo['path']);
81 81
 		} else {

+ 1
- 1
design/publicheader.php View File

@@ -1,5 +1,5 @@
1 1
 <?
2
-global $LoggedUser, $SSL;
2
+global $LoggedUser;
3 3
 define('FOOTER_FILE',SERVER_ROOT.'/design/publicfooter.php');
4 4
 ?>
5 5
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

+ 2
- 5
feeds.php View File

@@ -102,11 +102,9 @@ function display_array($Array, $Escape = array()) {
102 102
 
103 103
 /**
104 104
  * Print the site's URL including the appropriate URI scheme, including the trailing slash
105
- *
106
- * @param bool $SSL - whether the URL should be crafted for HTTPS or regular HTTP
107 105
  */
108
-function site_url($SSL = true) {
109
-	return $SSL ? 'https://' . SSL_SITE_URL . '/' : 'http://' . NONSSL_SITE_URL . '/';
106
+function site_url() {
107
+	return 'https://' . SITE_DOMAIN . '/';
110 108
 }
111 109
 
112 110
 header('Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0');
@@ -114,5 +112,4 @@ header('Pragma:');
114 112
 header('Expires: '.date('D, d M Y H:i:s', time() + (2 * 60 * 60)).' GMT');
115 113
 header('Last-Modified: '.date('D, d M Y H:i:s').' GMT');
116 114
 
117
-$Feed->UseSSL = (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);
118 115
 require(SERVER_ROOT.'/sections/feeds/index.php');

+ 2
- 2
sections/artist/artist.php View File

@@ -273,7 +273,7 @@ foreach ($TorrentList as $Group) {
273 273
 
274 274
 			$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
275 275
 			$TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
276
-			$TorrentMG = "magnet:?xt=urn:btih:".$Torrent['info_hash']."&as=https://".SSL_SITE_URL."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Torrent['Size'];
276
+			$TorrentMG = "magnet:?xt=urn:btih:".$Torrent['info_hash']."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Torrent['Size'];
277 277
 ?>
278 278
 		<tr class="torrent_row groupid_<?=$GroupID?> group_torrent discog<?=$SnatchedTorrentClass . $SnatchedGroupClass . $HideTorrents?>">
279 279
 			<td colspan="2">
@@ -340,7 +340,7 @@ foreach ($TorrentList as $Group) {
340 340
 		$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
341 341
 
342 342
     $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
343
-    $TorrentMG = "magnet:?xt=urn:btih:".$Torrent['info_hash']."&as=https://".SSL_SITE_URL."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Torrent['Size'];
343
+    $TorrentMG = "magnet:?xt=urn:btih:".$Torrent['info_hash']."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Torrent['Size'];
344 344
 
345 345
 ?>
346 346
 		<tr class="torrent<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">

+ 1
- 1
sections/chat/index.php View File

@@ -56,7 +56,7 @@ if (false && empty($IRCKey)) {
56 56
 		<div style="padding: 0px 10px 10px 20px;">
57 57
 			<p>If you have an IRC client, refer to <a href="wiki.php?action=article&amp;name=IRC">this wiki article</a> for information on how to connect.</p>
58 58
 		</div>
59
-    <iframe src="<?echo 'https://chat.'.SSL_SITE_URL?>" width="100%" height="600" style="border:0;">
59
+    <iframe src="<?echo 'https://chat.'.SITE_DOMAIN?>" width="100%" height="600" style="border:0;">
60 60
 		</iframe>
61 61
 	</div>
62 62
 </div>

+ 1
- 1
sections/donate/donate_gpal.php View File

@@ -38,7 +38,7 @@ View::show_header('Donate');
38 38
 			<input type="hidden" name="business" value="<?=PAYPAL_ADDRESS?>" />
39 39
 			<input type="hidden" name="txn_id" value="0" />
40 40
 			<input type="hidden" name="payment_type" value="instant" />
41
-			<input type="text" name="payer_email" value="<?=$LoggedUser['Username']?>@<?=NONSSL_SITE_URL?>" />
41
+			<input type="text" name="payer_email" value="<?=$LoggedUser['Username']?>@<?=SITE_DOMAIN?>" />
42 42
 			<input type="hidden" name="mc_currency" value="<?=PAYPAL_CURRENCY?>" />
43 43
 			<input name="test" type="submit" value="Donate" />
44 44
 		</form>

+ 1
- 1
sections/error/index.php View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 function notify ($Channel, $Message) {
4 4
 	global $LoggedUser;
5
-	send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? site_url()."user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".Tools::geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SSL_SITE_URL."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
5
+	send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? site_url()."user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".Tools::geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SITE_DOMAIN."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
6 6
 }
7 7
 
8 8
 $Errors = array('403','404','413','504');

+ 4
- 4
sections/log/index.php View File

@@ -51,10 +51,10 @@ while (list($ID, $Message, $LogTime) = $DB->next_record()) {
51 51
 	$Message = '';
52 52
 	$Color = $Colon = false;
53 53
 	for ($i = 0, $PartCount = sizeof($MessageParts); $i < $PartCount; $i++) {
54
-		if ((strpos($MessageParts[$i], 'https://'.SSL_SITE_URL) === 0
55
-				&& $Offset = strlen('https://'.SSL_SITE_URL.'/'))
56
-			|| (strpos($MessageParts[$i], 'http://'.NONSSL_SITE_URL) === 0
57
-				&& $Offset = strlen('http://'.NONSSL_SITE_URL.'/'))
54
+		if ((strpos($MessageParts[$i], 'https://'.SITE_DOMAIN) === 0
55
+				&& $Offset = strlen('https://'.SITE_DOMAIN.'/'))
56
+			|| (strpos($MessageParts[$i], 'http://'.SITE_DOMAIN) === 0
57
+				&& $Offset = strlen('http://'.SITE_DOMAIN.'/'))
58 58
 			) {
59 59
 				$MessageParts[$i] = '<a href="'.substr($MessageParts[$i], $Offset).'">'.substr($MessageParts[$i], $Offset).'</a>';
60 60
 		}

+ 1
- 1
sections/login/disabled.php View File

@@ -54,7 +54,7 @@ If you do not have access to an IRC client, you can use the WebIRC interface pro
54 54
 Please use your <?=SITE_NAME?> username.
55 55
 </p>
56 56
 <br />
57
-<form class="confirm_form" name="chat" action="<?echo 'https://chat.'.SSL_SITE_URL.BOT_DISABLED_CHAN?>" target="_blank" method="pre">
57
+<form class="confirm_form" name="chat" action="<?echo 'https://chat.'.SITE_DOMAIN.BOT_DISABLED_CHAN?>" target="_blank" method="pre">
58 58
 	<input type="text" name="nick" width="20" />
59 59
 	<input type="submit" value="Join WebIRC" />
60 60
 </form>

+ 2
- 2
sections/login/index.php View File

@@ -297,10 +297,10 @@ else {
297 297
 
298 298
 						if (isset($_POST['keeplogged']) && $_POST['keeplogged']) {
299 299
 							$KeepLogged = 1;
300
-							setcookie('session', $Cookie, time() + 60 * 60 * 24 * 365, '/', '', $SSL, true);
300
+							setcookie('session', $Cookie, time() + 60 * 60 * 24 * 365, '/', '', true, true);
301 301
 						} else {
302 302
 							$KeepLogged = 0;
303
-							setcookie('session', $Cookie, 0, '/', '', $SSL, true);
303
+							setcookie('session', $Cookie, 0, '/', '', true, true);
304 304
 						}
305 305
 
306 306
 						//TODO: another tracker might enable this for donors, I think it's too stupid to bother adding that

+ 1
- 1
sections/register/index.php View File

@@ -251,7 +251,7 @@ if (!empty($_REQUEST['confirm'])) {
251 251
 			$TPL->set('Username', $_REQUEST['username']);
252 252
 			$TPL->set('TorrentKey', $torrent_pass);
253 253
 			$TPL->set('SITE_NAME', SITE_NAME);
254
-			$TPL->set('SITE_URL', SITE_URL);
254
+			$TPL->set('SITE_DOMAIN', SITE_DOMAIN);
255 255
 
256 256
 			Misc::send_email($_REQUEST['email'], 'New account confirmation at '.SITE_NAME, $TPL->get(), 'noreply');
257 257
 			Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));

+ 1
- 1
sections/staffblog/index.php View File

@@ -73,7 +73,7 @@ if (check_perms('admin_manage_blog')) {
73 73
 				$Cache->delete_value('staff_blog');
74 74
 				$Cache->delete_value('staff_blog_latest_time');
75 75
 
76
-        send_irc("PRIVMSG ".ADMIN_CHAN." :!mod New staff blog: " . $_POST['title'] . " - https://".SSL_SITE_URL."/staffblog.php#blog" . $DB->inserted_id());
76
+        send_irc("PRIVMSG ".ADMIN_CHAN." :!mod New staff blog: " . $_POST['title'] . " - https://".SITE_DOMAIN."/staffblog.php#blog" . $DB->inserted_id());
77 77
 
78 78
 				header('Location: staffblog.php');
79 79
 				break;

+ 2
- 2
sections/torrents/browse.php View File

@@ -581,7 +581,7 @@ $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGr
581 581
 
582 582
 			$SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : '';
583 583
       $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
584
-      $TorrentMG = "magnet:?xt=urn:btih:".$Data['info_hash']."&as=https://".SSL_SITE_URL."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Data['Size'];
584
+      $TorrentMG = "magnet:?xt=urn:btih:".$Data['info_hash']."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Data['Size'];
585 585
 
586 586
 ?>
587 587
 	<tr class="group_torrent groupid_<?=$GroupID?> <?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
@@ -647,7 +647,7 @@ $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGr
647 647
 		}
648 648
 		$SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : '';
649 649
     $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
650
-    $TorrentMG = "magnet:?xt=urn:btih:".$Data['info_hash']."&as=https://".SSL_SITE_URL."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Data['Size'];
650
+    $TorrentMG = "magnet:?xt=urn:btih:".$Data['info_hash']."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Data['Size'];
651 651
 ?>
652 652
 	<tr class="torrent<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">
653 653
 <?		if ($GroupResults) { ?>

+ 1
- 1
sections/torrents/details.php View File

@@ -517,7 +517,7 @@ foreach ($TorrentList as $Torrent) {
517 517
 	if (!empty($BadFiles)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad File Names'); $AddExtra=' / '; }
518 518
 
519 519
   $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
520
-  $TorrentMG = "magnet:?xt=urn:btih:".$InfoHash."&as=https://".SSL_SITE_URL."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Size;
520
+  $TorrentMG = "magnet:?xt=urn:btih:".$InfoHash."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Size;
521 521
 ?>
522 522
 
523 523
 			<tr class="torrent_row groupid_<?=$GroupID?> group_torrent<?=($IsSnatched ? ' snatched_torrent' : '')?>" style="font-weight: normal;" id="torrent<?=$TorrentID?>">

+ 2
- 5
sections/upload/insert_extra_torrents.php View File

@@ -53,15 +53,12 @@ foreach ($ExtraTorrentsInsert as $ExtraTorrent) {
53 53
 		$Announce .= ' / Freeleech!';
54 54
 	}
55 55
 
56
-	$AnnounceSSL = $Announce . ' - ' . site_url() . "torrents.php?id=$GroupID / " . site_url() . "torrents.php?action=download&id=$ExtraTorrentID";
57
-	$Announce .= ' - ' . site_url() . "torrents.php?id=$GroupID / " . site_url() . "torrents.php?action=download&id=$ExtraTorrentID";
56
+	$Announce .= ' - https://' . SITE_DOMAIN . "/torrents.php?id=$GroupID / https://" . SITE_DOMAIN . "/torrents.php?action=download&id=$ExtraTorrentID";
58 57
 
59
-	$AnnounceSSL .= ' - ' . trim($Properties['TagList']);
60 58
 	$Announce .= ' - ' . trim($Properties['TagList']);
61 59
 
62 60
 	// ENT_QUOTES is needed to decode single quotes/apostrophes
63
-	send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce :' . html_entity_decode($Announce, ENT_QUOTES));
64
-	send_irc('PRIVMSG #' . SSL_SITE_URL . '-announce-ssl :' . html_entity_decode($AnnounceSSL, ENT_QUOTES));
61
+	send_irc('PRIVMSG ' . BOT_ANNOUNCE_CHAN . ' :' . html_entity_decode($Announce, ENT_QUOTES));
65 62
 
66 63
 }
67 64
 ?>

+ 3
- 3
sections/user/takemoderate.php View File

@@ -266,17 +266,17 @@ if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
266 266
 			INSERT INTO users_history_emails
267 267
 				(UserID, Email, Time, IP)
268 268
 			VALUES
269
-				('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_URL)."', '0000-00-00 00:00:00', '".DBCrypt::encrypt('127.0.0.1')."')");
269
+				('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', '0000-00-00 00:00:00', '".DBCrypt::encrypt('127.0.0.1')."')");
270 270
 	} else {
271 271
 		$DB->query("
272 272
 			INSERT INTO users_history_emails
273 273
 				(UserID, Email, Time, IP)
274 274
 			VALUES
275
-				('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_URL)."', '0000-00-00 00:00:00', '".$Cur['IP']."')");
275
+				('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', '0000-00-00 00:00:00', '".$Cur['IP']."')");
276 276
 	}
277 277
 	$DB->query("
278 278
 		UPDATE users_main
279
-		SET Email = '".DBCrypt::encrypt($Username.'@'.SITE_URL)."'
279
+		SET Email = '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."'
280 280
 		WHERE ID = '$UserID'");
281 281
 	$EditSummary[] = 'Email history cleared';
282 282
 }

+ 1
- 1
templates/enable_request_accepted.tpl View File

@@ -1,6 +1,6 @@
1 1
 Your request to re-enable your account has been accepted. Please use the following link to activate your account. This link is valid for 48 hours, and can be clicked only once.
2 2
 
3
-https://{{SITE_URL}}/enable.php?token={{TOKEN}}
3
+https://{{SITE_DOMAIN}}/enable.php?token={{TOKEN}}
4 4
 
5 5
 Thank you,
6 6
 {{SITE_NAME}} Staff

+ 1
- 1
templates/invite.tpl View File

@@ -6,7 +6,7 @@ If you had previously had an account at {{SITE_NAME}}, do not use this invite. I
6 6
 
7 7
 To confirm your invite, click on the following link:
8 8
 
9
-https://{{SITE_URL}}/register.php?invite={{InviteKey}}
9
+https://{{SITE_DOMAIN}}/register.php?invite={{InviteKey}}
10 10
 
11 11
 After you register, you will be able to use your account. Please take note that if you do not use this invite in the next 3 days, it will expire. We urge you to read the RULES and the wiki immediately after you join.
12 12
 

+ 1
- 1
templates/new_registration.tpl View File

@@ -2,7 +2,7 @@ This email is to confirm the account you just created at {{SITE_NAME}}
2 2
 
3 3
 You have 24 hours to click the link below and finish the registration process for the account created with the username: {{Username}}
4 4
 
5
-https://{{SITE_URL}}/register.php?confirm={{TorrentKey}}
5
+https://{{SITE_DOMAIN}}/register.php?confirm={{TorrentKey}}
6 6
 
7 7
 Thank you,
8 8
 {{SITE_NAME}} Staff

+ 1
- 1
templates/password_reset.tpl View File

@@ -2,7 +2,7 @@ A password reset process has been started for the username: {{Username}}
2 2
 
3 3
 To finish this process please click the link below (you have 1 hour)
4 4
 
5
-https://{{SITE_URL}}/login.php?act=recover&key={{ResetKey}}
5
+https://{{SITE_DOMAIN}}/login.php?act=recover&key={{ResetKey}}
6 6
 
7 7
 If you did not initiate this password reset then please disregard this email.
8 8
 The user who requested the password reset had the IP address {{IP}}.

Loading…
Cancel
Save