Browse Source

Fixed AJAX activation and deactivation of core features added with hooks

Signed-off-by: emanuele <[email protected]>
emanuele 12 years ago
parent
commit
1a749e3149
3 changed files with 22 additions and 9 deletions
  1. 8 8
      Sources/ManageSettings.php
  2. 2 1
      Sources/Packages.php
  3. 12 0
      Sources/Xml.php

+ 8 - 8
Sources/ManageSettings.php

@@ -389,15 +389,15 @@ function ModifyCoreFeatures($return_config = false)
 	{
 		checkSession();
 
-	if (isset($_GET['xml']))
-	{
-		$tokenValidation = validateToken('admin-core', 'post', false);
+		if (isset($_GET['xml']))
+		{
+			$tokenValidation = validateToken('admin-core', 'post', false);
 
-		if (empty($tokenValidation))
-			return 'token_verify_fail';
-	}
-	else
-		validateToken('admin-core');
+			if (empty($tokenValidation))
+				return 'token_verify_fail';
+		}
+		else
+			validateToken('admin-core');
 
 		$setting_changes = array('admin_features' => array());
 

+ 2 - 1
Sources/Packages.php

@@ -1570,7 +1570,8 @@ function list_getPackages($start, $items_per_page, $sort, $params, $installed)
 	}
 
 	if (empty($packages))
-		$packages = array('modification' => array(), 'avatar' => array(), 'language' => array(), 'unknown' => array());
+		foreach ($context['modification_types'] as $type)
+			$packages[$type] = arra();
 
 	if ($dir = @opendir($boarddir . '/Packages'))
 	{

+ 12 - 0
Sources/Xml.php

@@ -89,6 +89,18 @@ function EnableCoreFeatures()
 	// Just in case, maybe we don't need it
 	loadLanguage('Errors');
 
+	// We need (at least) this to ensure that mod files are included
+	if (!empty($modSettings['integrate_admin_include']))
+	{
+		$admin_includes = explode(',', $modSettings['integrate_admin_include']);
+		foreach ($admin_includes as $include)
+		{
+			$include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
+			if (file_exists($include))
+				require_once($include);
+		}
+	}
+
 	$errors = array();
 	$returns = array();
 	$tokens = array();