Browse Source

Merge branch 'master' of ngxez/Gazelle into master

spaghetti 8 years ago
parent
commit
590c6da86e

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+classes/config.php
2
+.DS_Store

+ 5
- 1
classes/config.template View File

@@ -76,7 +76,11 @@ define('BLOCK_OPERA_MINI',  false); //Set to true to block Opera Mini proxy
76 76
 define('DONOR_INVITES',     2);
77 77
 
78 78
 // Features
79
-define('FEATURE_EMAIL_REENABLE', true);
79
+define('FEATURE_EMAIL_REENABLE',     true);
80
+define('FEATURE_SEND_EMAIL',         true);  //Attempt to send email from the site
81
+define('FEATURE_IRC',                true);  //Attempt to send messages to IRC
82
+define('FEATURE_ENFORCE_LOCATIONS',  true);  //Require users to verify login from unknown devices
83
+define('FEATURE_SET_ENC_KEY_PUBLIC', false); //Allow the site encryption key to be set without an account
80 84
 
81 85
 // User class IDs needed for automatic promotions. Found in the 'permissions' table
82 86
 // Name of class  Class ID (NOT level)

+ 4
- 1
classes/misc.class.php View File

@@ -17,7 +17,10 @@ class Misc {
17 17
     $Headers .= 'X-Mailer: Project Gazelle'."\r\n";
18 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@".SITE_DOMAIN);
20
+    // check if email is enabled
21
+    if (FEATURE_SEND_EMAIL) {
22
+      mail($To, $Subject, $Body, $Headers, "-f $From@".SITE_DOMAIN);
23
+    }
21 24
   }
22 25
 
23 26
 

+ 5
- 0
classes/util.php View File

@@ -133,6 +133,11 @@ function display_str($Str) {
133 133
  * @param string $Raw An IRC protocol snippet to send.
134 134
  */
135 135
 function send_irc($Raw) {
136
+  // check if IRC is enabled
137
+  if (!FEATURE_IRC) {
138
+    return;
139
+  }
140
+
136 141
   $IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
137 142
   $Raw = str_replace(array("\n", "\r"), '', $Raw);
138 143
   fwrite($IRCSocket, $Raw);

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

@@ -274,7 +274,8 @@ else {
274 274
                   $DB->query("SELECT ASN FROM geoip_asn WHERE StartIP<=INET6_ATON('$_SERVER[REMOTE_ADDR]') AND EndIP>=INET6_ATON('$_SERVER[REMOTE_ADDR]')");
275 275
                   list($CurrentASN) = $DB->next_record();
276 276
 
277
-                  if (!in_array($CurrentASN, $PastASNs)) {
277
+                  // if FEATURE_ENFORCE_LOCATIONS is enabled, require users to confirm new logins
278
+                  if (!in_array($CurrentASN, $PastASNs) && FEATURE_ENFORCE_LOCATIONS) {
278 279
                     // Never logged in from this location before
279 280
                     if ($Cache->get_value('new_location_'.$UserID.'_'.$CurrentASN) !== true) {
280 281
                       $DB->query("

+ 4
- 1
sections/tools/index.php View File

@@ -10,7 +10,10 @@ if (isset($argv[1])) {
10 10
   $_REQUEST['action'] = $argv[1];
11 11
 } else {
12 12
   if (empty($_REQUEST['action']) || ($_REQUEST['action'] != 'public_sandbox' && $_REQUEST['action'] != 'ocelot')) {
13
-    enforce_login();
13
+    // if set, do not enforce login so we can set the encryption key w/o an account
14
+    if (!FEATURE_SET_ENC_KEY_PUBLIC) {
15
+      enforce_login();
16
+    }
14 17
   }
15 18
 }
16 19
 

+ 9
- 3
sections/tools/misc/database_key.php View File

@@ -1,10 +1,16 @@
1 1
 <?
2
-if (!check_perms('site_debug')) {
3
-    error(403);
2
+// if set, do not enforce login so we can set the encryption key w/o an account
3
+if (!FEATURE_SET_ENC_KEY_PUBLIC) {
4
+  if (!check_perms('site_debug')) {
5
+      error(403);
6
+  }
4 7
 }
5 8
 
6 9
 if (isset($_POST['dbkey'])) {
7
-  authorize();
10
+  // if set, do not enforce login so we can set the encryption key w/o an account
11
+  if (!FEATURE_SET_ENC_KEY_PUBLIC) {
12
+    authorize();
13
+  }
8 14
   apc_store('DBKEY', hash('sha512', $_POST['dbkey']));
9 15
 }
10 16
 

Loading…
Cancel
Save