Display warning to admin user if test script is enabled.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 2 Jun 2010 16:57:41 +0000 (10:57 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 2 Jun 2010 19:54:04 +0000 (13:54 -0600)
horde/lib/LoginTasks/Task/TestScriptActive.php [new file with mode: 0644]

diff --git a/horde/lib/LoginTasks/Task/TestScriptActive.php b/horde/lib/LoginTasks/Task/TestScriptActive.php
new file mode 100644 (file)
index 0000000..b7716fd
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Login task to check if the test script is active.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author   Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @package  Horde
+ */
+class Horde_LoginTasks_Task_TestScriptActive extends Horde_LoginTasks_Task
+{
+    /**
+     * The interval at which to run the task.
+     *
+     * @var integer
+     */
+    public $interval = Horde_LoginTasks::EVERY;
+
+    /**
+     * Display type.
+     *
+     * @var integer
+     */
+    public $display = Horde_LoginTasks::DISPLAY_NONE;
+
+    /**
+     * Perform all functions for this task.
+     */
+    public function execute()
+    {
+        if ($GLOBALS['registry']->isAdmin() &&
+            empty($GLOBALS['conf']['testdisable'])) {
+            $GLOBALS['notification']->push(_("The test script is currently enabled. For security reasons, disable test scripts when you are done testing (see horde/docs/INSTALL)."), 'horde.warning');
+        }
+    }
+
+}