! install-testdata plugin should verify it is enabled before being used, as well as enforcing the user is an admin.
gruffen

gruffen commited on 2011-04-25 08:20:59
Showing 1 changed files, with 6 additions and 2 deletions.

... ...
@@ -33,13 +33,17 @@
33 33
  *	Before attempting to execute, this file attempts to load SSI.php to enable access to the database functions.
34 34
 */
35 35
 
36
-$context = array();
37 36
 if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
38 37
 	require_once(dirname(__FILE__) . '/SSI.php');
39 38
 elseif (!defined('SMF')) // If we are outside SMF and can't find SSI.php, then throw an error
40 39
 	die('<b>Error:</b> Cannot install - please verify you put this file in the same place as SMF\'s SSI.php.');
41
-elseif (!defined('TICKET_STATUS_NEW')) // SD isn't loaded and active
40
+
41
+if (!defined('TICKET_STATUS_NEW')) // SD isn't loaded and active
42 42
 	die('<b>SimpleDesk needs to be installed and active before running this script.</b>');
43
+elseif (!in_array('install_testdata', $context['shd_plugins']))
44
+	die('<b>This plugin needs to be activated in the admin panel.</b>');
45
+else
46
+	isAllowedTo('admin_forum');
43 47
 
44 48
 $db_show_debug = false;
45 49
 shd_load_language('SDPluginInstallTestdata');
46 50