Переглянути джерело

! Fixed handling of hooks...testing is never enough! Especially when I code something :P

Signed-off-by: emanuele <[email protected]>
emanuele 12 роки тому
батько
коміт
995e6eafb3
2 змінених файлів з 7 додано та 9 видалено
  1. 5 4
      Sources/ManageSettings.php
  2. 2 5
      Themes/default/Admin.template.php

+ 5 - 4
Sources/ManageSettings.php

@@ -2165,7 +2165,7 @@ function list_integration_hooks()
 {
 	global $sourcedir, $scripturl, $context, $txt, $modSettings, $settings;
 
-	if (!empty($_POST['remove_hooks']) && !empty($_POST['remove']) && is_array($_POST['remove']))
+	if (!empty($_POST['remove']) && is_array($_POST['remove']))
 	{
 		checkSession();
 
@@ -2174,8 +2174,9 @@ function list_integration_hooks()
 			if (!is_array($functions))
 				continue;
 
-			foreach ($functions as $function)
-				remove_integration_function($hook, $function);
+			foreach ($functions as $function => $state)
+				if ($state == 'remove')
+					remove_integration_function($hook, $function);
 		}
 	}
 
@@ -2467,7 +2468,7 @@ function get_integration_hooks_data($start, $per_page, $sort)
 					'status' => $hook_exists ? ($enabled ? 'allow' : 'moderate') : 'deny',
 					'img_text' => $txt['hooks_' . ($hook_exists ? ($enabled ? 'active' : 'disabled') : 'missing')],
 					'enabled' => $enabled,
-					'can_be_disabled' => (isset($hook_status[$hook][$function]['enabled']) || $thisMod ? false : true),
+					'can_be_disabled' => !isset($hook_status[$hook][$function]['enabled']),
 				);
 			}
 	}

+ 2 - 5
Themes/default/Admin.template.php

@@ -1742,11 +1742,8 @@ function template_integrationHooks_below()
 
 		function integrationHooks_remove(id)
 		{
-			var elem = document.getElementById(\'input_remove_\'+id);
-			if (elem.value == \'enable\')
-				elem.value = \'disable\';
-			else if (elem.value == \'disable\')
-				elem.value = \'enable\';
+			var elem = document.getElementById(\'input_\'+id);
+			elem.value = \'remove\';
 
 			document.forms["' . $context['default_list'] . '"].submit();
 		}