function testUIInternals()
 {
     $ui = new WeatherMapEditorUI();
     $this->assertEquals("New Title", $ui->getTitleFromConfig("test-suite/tests/conf_title.conf"));
     $this->assertEquals("New <b>Title</b>", $ui->getTitleFromConfig("test-suite/tests/conf_title2.conf"));
     $this->assertEquals("", $ui->getTitleFromConfig("test-suite/tests/conf_no_title.conf"));
 }
Пример #2
0
<?php

// This file is from Network Weathermap v0.98
require_once dirname(__FILE__) . '/lib/all.php';
require_once dirname(__FILE__) . '/lib/SimpleTemplate.class.php';
require_once dirname(__FILE__) . '/lib/WeatherMapEditor.class.php';
require_once dirname(__FILE__) . '/lib/WeatherMapUIBase.class.php';
require_once dirname(__FILE__) . '/lib/WeatherMapEditorUI.class.php';
// so that you can't have the editor active, and not know about it.
$ENABLED = true;
// If we're embedded in the Cacti UI (included from weathermap-cacti-plugin-editor.php), then authentication has happened. Enable the editor.
if (isset($FROM_CACTI) && $FROM_CACTI == true) {
    $ENABLED = true;
} else {
    $FROM_CACTI = false;
}
if (!$ENABLED) {
    print "<p>The editor has not been enabled for standalone use yet.</p>";
    print "<h3>Cacti</h3><p>You <b>do not</b> need to do this to use the editor from within Cacti - just give users permission to edit maps in the <a href='../../user_admin.php'>User Management page</a>.</p>";
    print "<h3>Standalone Use</h3><p>For standalone use, you need to set ENABLED=true at the top of " . basename(__FILE__) . "</p>";
    print "<p>Before you do that, you should consider using FilesMatch (in Apache) or similar to limit who can access the editor. Not limiting access in some way can be a security risk. There is more information in the install guide section of the manual.</p>";
    exit;
}
$ui = new WeatherMapEditorUI();
$ui->moduleChecks();
chdir(dirname(__FILE__));
$ui->main($_REQUEST, $FROM_CACTI);