Browse Source

Create the new dir and remove the custom_avatar_enabled setting

Signed-off-by: Suki <[email protected]>
Suki 10 years ago
parent
commit
d7a60c3dcd
4 changed files with 28 additions and 4 deletions
  1. 3 4
      Sources/ManageAttachments.php
  2. 7 0
      custom_avatar/.htaccess
  3. BIN
      custom_avatar/blank.png
  4. 18 0
      custom_avatar/index.php

+ 3 - 4
Sources/ManageAttachments.php

@@ -312,7 +312,6 @@ function ManageAvatarSettings($return_config = false)
 			array('warning', 'avatar_paranoid_warning'),
 			array('check', 'avatar_paranoid'),
 		'',
-			array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'fUpdateStatus();'),
 			array('text', 'custom_avatar_dir', 40, 'subtext' => $txt['custom_avatar_dir_desc'], 'invalid' => !$context['valid_custom_avatar_dir']),
 			array('text', 'custom_avatar_url', 40),
 	);
@@ -330,8 +329,8 @@ function ManageAvatarSettings($return_config = false)
 	{
 		checkSession();
 
-		// Just incase the admin forgot to set both custom avatar values, we disable it to prevent errors.
-		if (isset($_POST['custom_avatar_enabled']) && $_POST['custom_avatar_enabled'] == 1 && (empty($_POST['custom_avatar_dir']) || empty($_POST['custom_avatar_url'])))
+		// Just in case the admin forgot to set both custom avatar values, we disable it to prevent errors.
+		if (empty($_POST['custom_avatar_dir']) || empty($_POST['custom_avatar_url']))
 			$_POST['custom_avatar_enabled'] = 0;
 
 		call_integration_hook('integrate_save_avatar_settings');
@@ -342,7 +341,7 @@ function ManageAvatarSettings($return_config = false)
 	}
 
 	// Attempt to figure out if the admin is trying to break things.
-	$context['settings_save_onclick'] = 'return document.getElementById(\'custom_avatar_enabled\').value == 1 && (document.getElementById(\'custom_avatar_dir\').value == \'\' || document.getElementById(\'custom_avatar_url\').value == \'\') ? confirm(\'' . $txt['custom_avatar_check_empty'] . '\') : true;';
+	$context['settings_save_onclick'] = 'return (document.getElementById(\'custom_avatar_dir\').value == \'\' || document.getElementById(\'custom_avatar_url\').value == \'\') ? confirm(\'' . $txt['custom_avatar_check_empty'] . '\') : true;';
 
 	// We need this for the in-line permissions
 	createToken('admin-mp');

+ 7 - 0
custom_avatar/.htaccess

@@ -0,0 +1,7 @@
+<Files *>
+	Order Deny,Allow
+	Deny from all
+	Allow from localhost
+</Files>
+
+RemoveHandler .php .php3 .phtml .cgi .fcgi .pl .fpl .shtml

BIN
custom_avatar/blank.png


+ 18 - 0
custom_avatar/index.php

@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * This file is here solely to protect your avatars directory.
+ */
+
+// Look for Settings.php....
+if (file_exists(dirname(dirname(__FILE__)) . '/Settings.php'))
+{
+	// Found it!
+	require(dirname(dirname(__FILE__)) . '/Settings.php');
+	header('Location: ' . $boardurl);
+}
+// Can't find it... just forget it.
+else
+	exit;
+
+?>