Example #1
0
 /**
  * Collect Web 2 and module LESS files and add them to the LESS compiler
  */
 protected function collect()
 {
     foreach (self::$lessFiles as $lessFile) {
         $this->lessCompiler->addLessFile($this->pubPath . '/' . $lessFile);
     }
     $mm = $this->app->getModuleManager();
     foreach ($mm->getLoadedModules() as $moduleName => $module) {
         if ($module->hasCss()) {
             foreach ($module->getCssFiles() as $lessFilePath) {
                 $this->lessCompiler->addModuleLessFile($moduleName, $lessFilePath);
             }
         }
     }
     $themingConfig = $this->app->getConfig()->getSection('themes');
     $defaultTheme = $themingConfig->get('default');
     $theme = null;
     if ((bool) $themingConfig->get('disabled', false)) {
         if ($defaultTheme !== null && $defaultTheme !== self::DEFAULT_THEME) {
             $theme = $defaultTheme;
         }
     } else {
         $auth = Auth::getInstance();
         if ($auth->isAuthenticated()) {
             $userTheme = $auth->getUser()->getPreferences()->getValue('icingaweb', 'theme');
             if ($userTheme !== null) {
                 $theme = $userTheme;
             } elseif ($defaultTheme !== null && $defaultTheme !== self::DEFAULT_THEME) {
                 $theme = $defaultTheme;
             }
         }
     }
     if ($theme) {
         if (($pos = strpos($theme, '/')) !== false) {
             $moduleName = substr($theme, 0, $pos);
             $theme = substr($theme, $pos + 1);
             if ($mm->hasLoaded($moduleName)) {
                 $module = $mm->getModule($moduleName);
                 $this->lessCompiler->setTheme($module->getCssDir() . '/themes/' . $theme . '.less');
             }
         } else {
             $this->lessCompiler->setTheme($this->pubPath . '/css/themes/' . $theme . '.less');
         }
     }
 }
Example #2
0
 /**
  * Collect Web 2 and module LESS files and add them to the LESS compiler
  */
 protected function collect()
 {
     foreach (self::$lessFiles as $lessFile) {
         $this->lessCompiler->addLessFile($this->pubPath . '/' . $lessFile);
     }
     $mm = $this->app->getModuleManager();
     foreach ($mm->getLoadedModules() as $moduleName => $module) {
         if ($module->hasCss()) {
             foreach ($module->getCssFiles() as $lessFilePath) {
                 $this->lessCompiler->addModuleLessFile($moduleName, $lessFilePath);
             }
         }
     }
     $themingConfig = $this->app->getConfig()->getSection('themes');
     $defaultTheme = $themingConfig->get('default', self::DEFAULT_THEME);
     $theme = null;
     if ((bool) $themingConfig->get('disabled', false)) {
         if ($defaultTheme !== self::DEFAULT_THEME) {
             $theme = $defaultTheme;
         }
     } else {
         if (($userTheme = $this->app->getRequest()->getCookie('theme', $defaultTheme)) && $userTheme !== $defaultTheme) {
             $theme = $userTheme;
         }
     }
     if ($theme) {
         if (($pos = strpos($theme, '/')) !== false) {
             $moduleName = substr($theme, 0, $pos);
             $theme = substr($theme, $pos + 1);
             if ($mm->hasLoaded($moduleName)) {
                 $module = $mm->getModule($moduleName);
                 $this->lessCompiler->setTheme($module->getCssDir() . '/themes/' . $theme . '.less');
             }
         } else {
             $this->lessCompiler->setTheme($this->pubPath . '/css/themes/' . $theme . '.less');
         }
     }
 }
Example #3
0
            JavaScript::sendMinified();
            break;
        default:
            return false;
    }
} elseif ($path === 'svg/chart.php') {
    if (!array_key_exists('data', $_GET)) {
        return false;
    }
    include __DIR__ . '/EmbeddedWeb.php';
    EmbeddedWeb::start();
    header('Content-Type: image/svg+xml');
    $pie = new PieChart();
    $pie->initFromRequest();
    echo $pie->render();
} elseif ($path === 'png/chart.php') {
    if (!array_key_exists('data', $_GET)) {
        return false;
    }
    include __DIR__ . '/EmbeddedWeb.php';
    EmbeddedWeb::start();
    header('Content-Type: image/png');
    $pie = new PieChart();
    $pie->initFromRequest();
    $pie->toPng();
} elseif (file_exists($baseDir . '/' . $path) && is_file($baseDir . '/' . $path)) {
    return false;
} else {
    include __DIR__ . '/Web.php';
    Web::start()->dispatch();
}
Example #4
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 ******************************************************************************/
/*
Icinga Web 2 integration
*/
use Icinga\Application\EmbeddedWeb;
set_include_path('/usr/share/icingaweb2/library/vendor:/usr/share/icingaweb2/library:' . get_include_path());
require_once 'Icinga/Application/EmbeddedWeb.php';
require_once EmbeddedWeb::start(null, '/etc/icingaweb2')->getModuleManager()->getModule('nagvis')->getLibDir() . '/nagvis-includes/init.inc.php';
/*
* Url: Parse the url to know later what module and
*      action is called. The requested uri is splitted
*      into elements for later usage.
*/
$UHANDLER = new CoreUriHandler();
/*
* Session: Handle the user session
*/
$SHANDLER = new CoreSessionHandler();
/*
 * Authentication: Try to authenticate the user
 */
$AUTH = new CoreAuthHandler();
// Session: Logged in?