spaghetti 8 years ago
parent
commit
268f9f3627

+ 2
- 0
.gitignore View File

1
+classes/config.php
2
+.DS_Store

+ 5
- 1
classes/config.template View File

76
 define('DONOR_INVITES',     2);
76
 define('DONOR_INVITES',     2);
77
 
77
 
78
 // Features
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
 // User class IDs needed for automatic promotions. Found in the 'permissions' table
85
 // User class IDs needed for automatic promotions. Found in the 'permissions' table
82
 // Name of class  Class ID (NOT level)
86
 // Name of class  Class ID (NOT level)

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

17
     $Headers .= 'X-Mailer: Project Gazelle'."\r\n";
17
     $Headers .= 'X-Mailer: Project Gazelle'."\r\n";
18
     $Headers .= 'Message-Id: <'.Users::make_secret().'@'.SITE_DOMAIN.">\r\n";
18
     $Headers .= 'Message-Id: <'.Users::make_secret().'@'.SITE_DOMAIN.">\r\n";
19
     $Headers .= 'X-Priority: 3'."\r\n";
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
  * @param string $Raw An IRC protocol snippet to send.
133
  * @param string $Raw An IRC protocol snippet to send.
134
  */
134
  */
135
 function send_irc($Raw) {
135
 function send_irc($Raw) {
136
+  // check if IRC is enabled
137
+  if (!FEATURE_IRC) {
138
+    return;
139
+  }
140
+
136
   $IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
141
   $IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
137
   $Raw = str_replace(array("\n", "\r"), '', $Raw);
142
   $Raw = str_replace(array("\n", "\r"), '', $Raw);
138
   fwrite($IRCSocket, $Raw);
143
   fwrite($IRCSocket, $Raw);

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

274
                   $DB->query("SELECT ASN FROM geoip_asn WHERE StartIP<=INET6_ATON('$_SERVER[REMOTE_ADDR]') AND EndIP>=INET6_ATON('$_SERVER[REMOTE_ADDR]')");
274
                   $DB->query("SELECT ASN FROM geoip_asn WHERE StartIP<=INET6_ATON('$_SERVER[REMOTE_ADDR]') AND EndIP>=INET6_ATON('$_SERVER[REMOTE_ADDR]')");
275
                   list($CurrentASN) = $DB->next_record();
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
                     // Never logged in from this location before
279
                     // Never logged in from this location before
279
                     if ($Cache->get_value('new_location_'.$UserID.'_'.$CurrentASN) !== true) {
280
                     if ($Cache->get_value('new_location_'.$UserID.'_'.$CurrentASN) !== true) {
280
                       $DB->query("
281
                       $DB->query("

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

10
   $_REQUEST['action'] = $argv[1];
10
   $_REQUEST['action'] = $argv[1];
11
 } else {
11
 } else {
12
   if (empty($_REQUEST['action']) || ($_REQUEST['action'] != 'public_sandbox' && $_REQUEST['action'] != 'ocelot')) {
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
 <?
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
 if (isset($_POST['dbkey'])) {
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
   apc_store('DBKEY', hash('sha512', $_POST['dbkey']));
14
   apc_store('DBKEY', hash('sha512', $_POST['dbkey']));
9
 }
15
 }
10
 
16
 

Loading…
Cancel
Save