--- /dev/null
+Listen 1008
+
+<VirtualHost *:1008>
+
+# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
+# Last Modified: 11-26-2005
+#
+# This file contains examples of entries that need
+# to be incorporated into your Apache web server
+# configuration file. Customize the paths, etc. as
+# needed to fit your system.
+
+ScriptAlias /nagios/cgi-bin "/usr/share/nagios/cgi-bin"
+
+<Directory "/usr/share/nagios/cgi-bin">
+# SSLRequireSSL
+ Options ExecCGI
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+# Order deny,allow
+# Deny from all
+# Allow from 127.0.0.1
+ AuthName "Nagios Access"
+ AuthType Basic
+ AuthUserFile /etc/nagios/htpasswd.users
+ Require valid-user
+</Directory>
+
+Alias /nagios "/usr/share/nagios"
+
+<Directory "/usr/share/nagios">
+# SSLRequireSSL
+ Options None
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+# Order deny,allow
+# Deny from all
+# Allow from 127.0.0.1
+ AuthName "Nagios Access"
+ AuthType Basic
+ AuthUserFile /etc/nagios/htpasswd.users
+ Require valid-user
+</Directory>
+
+Alias /nagiosql "/usr/share/nagiosql"
+
+<Directory "/usr/share/nagiosql">
+ include /etc/httpd/conf/conf.d/php*.conf
+ Options None
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+</Directory>
+
+</VirtualHost>
--- /dev/null
+<?php
+/**
+ * Integrated Template - IT
+ *
+ * PHP version 4
+ *
+ * Copyright (c) 1997-2007 Ulf Wendel, Pierre-Alain Joye,
+ * David Soria Parra
+ *
+ * This source file is subject to the New BSD license, That is bundled
+ * with this package in the file LICENSE, and is available through
+ * the world-wide-web at
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the new BSDlicense and are unable
+ * to obtain it through the world-wide-web, please send a note to
+ * pajoye@php.net so we can mail you a copy immediately.
+ *
+ * Author: Ulf Wendel <ulf.wendel@phpdoc.de>
+ * Pierre-Alain Joye <pajoye@php.net>
+ * David Soria Parra <dsp@php.net>
+ *
+ * @category HTML
+ * @package HTML_Template_IT
+ * @author Ulf Wendel <uw@netuse.de>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version CVS: $Id: IT.php,v 1.27 2008/11/14 23:57:17 kguest Exp $
+ * @link http://pear.php.net/packages/HTML_Template_IT
+ * @access public
+ */
+
+require_once 'PEAR.php';
+
+define('IT_OK', 1);
+define('IT_ERROR', -1);
+define('IT_TPL_NOT_FOUND', -2);
+define('IT_BLOCK_NOT_FOUND', -3);
+define('IT_BLOCK_DUPLICATE', -4);
+define('IT_UNKNOWN_OPTION', -6);
+/**
+ * Integrated Template - IT
+ *
+ * Well there's not much to say about it. I needed a template class that
+ * supports a single template file with multiple (nested) blocks inside and
+ * a simple block API.
+ *
+ * The Isotemplate API is somewhat tricky for a beginner although it is the best
+ * one you can build. template::parse() [phplib template = Isotemplate] requests
+ * you to name a source and a target where the current block gets parsed into.
+ * Source and target can be block names or even handler names. This API gives you
+ * a maximum of fexibility but you always have to know what you do which is
+ * quite unusual for php skripter like me.
+ *
+ * I noticed that I do not any control on which block gets parsed into which one.
+ * If all blocks are within one file, the script knows how they are nested and in
+ * which way you have to parse them. IT knows that inner1 is a child of block2,
+ * there's no need to tell him about this.
+ *
+ * <table border>
+ * <tr>
+ * <td colspan=2>
+ * __global__
+ * <p>
+ * (hidden and automatically added)
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>block1</td>
+ * <td>
+ * <table border>
+ * <tr>
+ * <td colspan=2>block2</td>
+ * </tr>
+ * <tr>
+ * <td>inner1</td>
+ * <td>inner2</td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * To add content to block1 you simply type:
+ * <code>$tpl->setCurrentBlock("block1");</code>
+ * and repeat this as often as needed:
+ * <code>
+ * $tpl->setVariable(...);
+ * $tpl->parseCurrentBlock();
+ * </code>
+ *
+ * To add content to block2 you would type something like:
+ * <code>
+ * $tpl->setCurrentBlock("inner1");
+ * $tpl->setVariable(...);
+ * $tpl->parseCurrentBlock();
+ *
+ * $tpl->setVariable(...);
+ * $tpl->parseCurrentBlock();
+ *
+ * $tpl->parse("block1");
+ * </code>
+ *
+ * This will result in one repition of block1 which contains two repitions
+ * of inner1. inner2 will be removed if $removeEmptyBlock is set to true
+ * which is the default.
+ *
+ * Usage:
+ * <code>
+ * $tpl = new HTML_Template_IT( [string filerootdir] );
+ *
+ * // load a template or set it with setTemplate()
+ * $tpl->loadTemplatefile( string filename [, boolean removeUnknownVariables, boolean removeEmptyBlocks] )
+ *
+ * // set "global" Variables meaning variables not beeing within a (inner) block
+ * $tpl->setVariable( string variablename, mixed value );
+ *
+ * // like with the Isotemplates there's a second way to use setVariable()
+ * $tpl->setVariable( array ( string varname => mixed value ) );
+ *
+ * // Let's use any block, even a deeply nested one
+ * $tpl->setCurrentBlock( string blockname );
+ *
+ * // repeat this as often as you need it.
+ * $tpl->setVariable( array ( string varname => mixed value ) );
+ * $tpl->parseCurrentBlock();
+ *
+ * // get the parsed template or print it: $tpl->show()
+ * $tpl->get();
+ * </code>
+ *
+ * @category HTML
+ * @package HTML_Template_IT
+ * @author Ulf Wendel <uw@netuse.de>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/packages/HTML_Template_IT
+ * @access public
+ */
+class HTML_Template_IT
+{
+ /**
+ * Contains the error objects
+ * @var array
+ * @access public
+ * @see halt(), $printError, $haltOnError
+ */
+ var $err = array();
+
+ /**
+ * Clear cache on get()?
+
+ * @var boolean
+ * @acces public
+ */
+ var $clearCache = false;
+
+ /**
+ * First character of a variable placeholder ( _{_VARIABLE} ).
+ * @var string
+ * @access public
+ * @see $closingDelimiter, $blocknameRegExp, $variablenameRegExp
+ */
+ var $openingDelimiter = '{';
+
+ /**
+ * Last character of a variable placeholder ( {VARIABLE_}_ ).
+ * @var string
+ * @access public
+ * @see $openingDelimiter, $blocknameRegExp, $variablenameRegExp
+ */
+ var $closingDelimiter = '}';
+
+ /**
+ * RegExp matching a block in the template.
+ * Per default "sm" is used as the regexp modifier, "i" is missing.
+ * That means a case sensitive search is done.
+ * @var string
+ * @access public
+ * @see $variablenameRegExp, $openingDelimiter, $closingDelimiter
+ */
+ var $blocknameRegExp = '[\.0-9A-Za-z_-]+';
+
+ /**
+ * RegExp matching a variable placeholder in the template.
+ * Per default "sm" is used as the regexp modifier, "i" is missing.
+ * That means a case sensitive search is done.
+ * @var string
+ * @access public
+ * @see $blocknameRegExp, $openingDelimiter, $closingDelimiter
+ */
+ var $variablenameRegExp = '[\.0-9A-Za-z_-]+';
+
+ /**
+ * RegExp used to find variable placeholder, filled by the constructor.
+ * @var string Looks somewhat like @(delimiter varname delimiter)@
+ * @access private
+ * @see IntegratedTemplate()
+ */
+ var $variablesRegExp = '';
+
+ /**
+ * RegExp used to strip unused variable placeholder.
+ * @access private
+ * @brother $variablesRegExp
+ */
+ var $removeVariablesRegExp = '';
+
+ /**
+ * Controls the handling of unknown variables, default is remove.
+ * @var boolean
+ * @access public
+ */
+ var $removeUnknownVariables = true;
+
+ /**
+ * Controls the handling of empty blocks, default is remove.
+ * @var boolean
+ * @access public
+ */
+ var $removeEmptyBlocks = true;
+
+ /**
+ * RegExp used to find blocks an their content, filled by the constructor.
+ * @var string
+ * @see IntegratedTemplate()
+ * @access private
+ */
+ var $blockRegExp = '';
+
+ /**
+ * Name of the current block.
+ * @var string
+ * @access private
+ */
+ var $currentBlock = '__global__';
+
+ /**
+ * Content of the template.
+ * @var string
+ * @access private
+ */
+ var $template = '';
+
+ /**
+ * Array of all blocks and their content.
+ *
+ * @var array
+ * @see findBlocks()
+ * @access private
+ */
+ var $blocklist = array();
+
+ /**
+ * Array with the parsed content of a block.
+ *
+ * @var array
+ * @access private
+ */
+ var $blockdata = array();
+
+ /**
+ * Array of variables in a block.
+ * @var array
+ * @access private
+ */
+ var $blockvariables = array();
+
+ /**
+ * Array of inner blocks of a block.
+ * @var array
+ * @access private
+ */
+ var $blockinner = array();
+
+ /**
+ * List of blocks to preverse even if they are "empty".
+ *
+ * This is something special. Sometimes you have blocks that
+ * should be preserved although they are empty (no placeholder replaced).
+ * Think of a shopping basket. If it's empty you have to drop a message to
+ * the user. If it's filled you have to show the contents of
+ * the shopping baseket. Now where do you place the message that the basket
+ * is empty? It's no good idea to place it in you applications as customers
+ * tend to like unecessary minor text changes. Having another template file
+ * for an empty basket means that it's very likely that one fine day
+ * the filled and empty basket templates have different layout. I decided
+ * to introduce blocks that to not contain any placeholder but only
+ * text such as the message "Your shopping basked is empty".
+ *
+ * Now if there is no replacement done in such a block the block will
+ * be recognized as "empty" and by default ($removeEmptyBlocks = true) be
+ * stripped off. To avoid thisyou can now call touchBlock() to avoid this.
+ *
+ * The array $touchedBlocks stores a list of touched block which must not
+ * be removed even if they are empty.
+ *
+ * @var array $touchedBlocks
+ * @see touchBlock(), $removeEmptyBlocks
+ * @access private
+ */
+ var $touchedBlocks = array();
+
+ /**
+ * List of blocks which should not be shown even if not "empty"
+ * @var array $_hiddenBlocks
+ * @see hideBlock(), $removeEmptyBlocks
+ * @access private
+ */
+ var $_hiddenBlocks = array();
+
+ /**
+ * Variable cache.
+ *
+ * Variables get cached before any replacement is done.
+ * Advantage: empty blocks can be removed automatically.
+ * Disadvantage: might take some more memory
+ *
+ * @var array
+ * @see setVariable(), $clearCacheOnParse
+ * @access private
+ */
+ var $variableCache = array();
+
+ /**
+ * Clear the variable cache on parse?
+ *
+ * If you're not an expert just leave the default false.
+ * True reduces memory consumption somewhat if you tend to
+ * add lots of values for unknown placeholder.
+ *
+ * @var boolean
+ * @access public
+ */
+ var $clearCacheOnParse = false;
+
+ /**
+ * Root directory for all file operations.
+ * The string gets prefixed to all filenames given.
+ * @var string
+ * @see HTML_Template_IT(), setRoot()
+ * @access private
+ */
+ var $fileRoot = '';
+
+ /**
+ * Internal flag indicating that a blockname was used multiple times.
+ * @var boolean
+ * @access private
+ */
+ var $flagBlocktrouble = false;
+
+ /**
+ * Flag indicating that the global block was parsed.
+ * @var boolean
+ * @access private
+ */
+ var $flagGlobalParsed = false;
+
+ /**
+ * EXPERIMENTAL! FIXME!
+ * Flag indication that a template gets cached.
+ *
+ * Complex templates require some times to be preparsed
+ * before the replacement can take place. Often I use
+ * one template file over and over again but I don't know
+ * before that I will use the same template file again.
+ * Now IT could notice this and skip the preparse.
+ *
+ * @var boolean
+ * @access private
+ */
+ var $flagCacheTemplatefile = true;
+
+ /**
+ * EXPERIMENTAL! FIXME!
+ * @access private
+ */
+ var $lastTemplatefile = '';
+
+ /**
+ * $_options['preserve_data'] Whether to substitute variables and remove
+ * empty placeholders in data passed through setVariable
+ * (see also bugs #20199, #21951).
+ * $_options['use_preg'] Whether to use preg_replace instead of
+ * str_replace in parse()
+ * (this is a backwards compatibility feature, see also bugs #21951, #20392)
+ *
+ * @var array
+ * @access private
+ */
+ var $_options = array(
+ 'preserve_data' => false,
+ 'use_preg' => true,
+ 'preserve_input'=> true
+ );
+
+ /**
+ * Builds some complex regular expressions and optinally sets the
+ * file root directory.
+ *
+ * Make sure that you call this constructor if you derive your template
+ * class from this one.
+ *
+ * @param string $root File root directory, prefix for all filenames
+ * given to the object.
+ * @param mixed $options Unknown
+ *
+ * @see setRoot()
+ * @access public
+ */
+ function HTML_Template_IT($root = '', $options = null)
+ {
+ if (!is_null($options)) {
+ $this->setOptions($options);
+ }
+
+ $this->variablesRegExp = '@' . $this->openingDelimiter .
+ '(' . $this->variablenameRegExp . ')' .
+ $this->closingDelimiter . '@sm';
+
+ $this->removeVariablesRegExp = '@' . $this->openingDelimiter .
+ "\s*(" . $this->variablenameRegExp .
+ ")\s*" . $this->closingDelimiter .'@sm';
+
+ $this->blockRegExp = '@<!--\s+BEGIN\s+(' . $this->blocknameRegExp .
+ ')\s+-->(.*)<!--\s+END\s+\1\s+-->@sm';
+
+ $this->setRoot($root);
+ } // end constructor
+
+
+ /**
+ * Sets the option for the template class
+ *
+ * @param string $option option name
+ * @param mixed $value option value
+ *
+ * @access public
+ * @return mixed IT_OK on success, error object on failure
+ */
+ function setOption($option, $value)
+ {
+ if (array_key_exists($option, $this->_options)) {
+ $this->_options[$option] = $value;
+ return IT_OK;
+ }
+
+ return PEAR::raiseError(
+ $this->errorMessage(IT_UNKNOWN_OPTION) . ": '{$option}'",
+ IT_UNKNOWN_OPTION);
+ }
+
+ /**
+ * Sets the options for the template class
+ *
+ * @param string[] $options options array of options
+ * default value:
+ * 'preserve_data' => false,
+ * 'use_preg' => true
+ *
+ * @access public
+ * @return mixed IT_OK on success, error object on failure
+ * @see $options
+ */
+ function setOptions($options)
+ {
+ if (is_array($options)) {
+ foreach ($options as $option => $value) {
+ $error = $this->setOption($option, $value);
+ if (PEAR::isError($error)) {
+ return $error;
+ }
+ }
+ }
+
+ return IT_OK;
+ }
+
+ /**
+ * Print a certain block with all replacements done.
+ *
+ * @param string $block block
+ *
+ * @brother get()
+ * @access public
+ * @return null
+ */
+ function show($block = '__global__')
+ {
+ print $this->get($block);
+ } // end func show
+
+ /**
+ * Returns a block with all replacements done.
+ *
+ * @param string $block name of the block
+ *
+ * @return string
+ * @throws PEAR_Error
+ * @access public
+ * @see show()
+ */
+ function get($block = '__global__')
+ {
+ if ($block == '__global__' && !$this->flagGlobalParsed) {
+ $this->parse('__global__');
+ }
+
+ if (!isset($this->blocklist[$block])) {
+ $this->err[] = PEAR::raiseError($this->errorMessage(IT_BLOCK_NOT_FOUND) .
+ '"' . $block . "'",
+ IT_BLOCK_NOT_FOUND);
+ return '';
+ }
+
+ if (isset($this->blockdata[$block])) {
+ $ret = $this->blockdata[$block];
+
+ if ($this->clearCache) {
+ unset($this->blockdata[$block]);
+ if ($block == '__global__') {
+ $this->flagGlobalParsed = false;
+ }
+ }
+
+ if ($this->_options['preserve_data']) {
+ $ret = str_replace($this->openingDelimiter .
+ '%preserved%' . $this->closingDelimiter,
+ $this->openingDelimiter,
+ $ret);
+ }
+ return $ret;
+ }
+
+ return '';
+ } // end func get()
+
+ /**
+ * Parses the given block.
+ *
+ * @param string $block name of the block to be parsed
+ * @param bool $flag_recursion unknown
+ *
+ * @access public
+ * @see parseCurrentBlock()
+ * @throws PEAR_Error
+ * @return null
+ */
+ function parse($block = '__global__', $flag_recursion = false)
+ {
+ static $regs, $values;
+
+ if (!isset($this->blocklist[$block])) {
+ return PEAR::raiseError($this->errorMessage(IT_BLOCK_NOT_FOUND)
+ . '"' . $block . "'", IT_BLOCK_NOT_FOUND);
+ }
+
+ if ($block == '__global__') {
+ $this->flagGlobalParsed = true;
+ }
+
+ if (!$flag_recursion) {
+ $regs = array();
+ $values = array();
+ }
+ $outer = $this->blocklist[$block];
+ $empty = true;
+
+ $variablelist = array();
+ if ($this->clearCacheOnParse) {
+ foreach ($this->variableCache as $name => $value) {
+ $regs[] = $this->openingDelimiter .
+ $name . $this->closingDelimiter;
+
+ $values[] = $value;
+
+ $empty = false;
+
+ $variablelist[] = $name;
+ }
+ $this->variableCache = array();
+ } else {
+ foreach ($this->blockvariables[$block] as $allowedvar => $v) {
+
+ if (isset($this->variableCache[$allowedvar])) {
+ $regs[] = $this->openingDelimiter .
+ $allowedvar . $this->closingDelimiter;
+ $values[] = $this->variableCache[$allowedvar];
+
+ unset($this->variableCache[$allowedvar]);
+
+ $empty = false;
+
+ $variablelist[] = $allowedvar;
+ }
+ }
+ }
+
+ if (isset($this->blockinner[$block])) {
+ foreach ($this->blockinner[$block] as $k => $innerblock) {
+
+ $this->parse($innerblock, true);
+ if ($this->blockdata[$innerblock] != '') {
+ $empty = false;
+ }
+
+ $placeholder = $this->openingDelimiter . "__" .
+ $innerblock . "__" . $this->closingDelimiter;
+
+ $outer = str_replace($placeholder,
+ $this->blockdata[$innerblock], $outer);
+
+ $this->blockdata[$innerblock] = "";
+ }
+
+ }
+
+ if (!$flag_recursion && 0 != count($values)) {
+ if ($this->_options['use_preg']) {
+ $regs = array_map(array(&$this, '_addPregDelimiters'), $regs);
+ $values = array_map(array(&$this, '_escapeBackreferences'), $values);
+
+ $funcReplace = 'preg_replace';
+ } else {
+ $funcReplace = 'str_replace';
+ }
+
+ if ($this->_options['preserve_data']) {
+ $values = array_map(array(&$this, '_preserveOpeningDelimiter'),
+ $values);
+ }
+
+ $outer = $funcReplace($regs, $values, $outer);
+ }
+
+ if ($this->removeUnknownVariables) {
+ $outer = $this->removeUnknownVariablesFromBlock($block,
+ $outer,
+ $variablelist);
+ }
+
+ if ($empty) {
+ if (!$this->removeEmptyBlocks) {
+ $this->blockdata[$block ] .= $outer;
+ } else {
+ if (isset($this->touchedBlocks[$block])) {
+ $this->blockdata[$block] .= $outer;
+ unset($this->touchedBlocks[$block]);
+ }
+ }
+ } else {
+ if (empty($this->blockdata[$block])) {
+ $this->blockdata[$block] = $outer;
+ } else {
+ $this->blockdata[$block] .= $outer;
+ }
+ }
+
+ return $empty;
+ } // end func parse
+
+ /**
+ * Removes unknown variables from block. If preserve_input is set to true
+ * only unknown variables that were present during setTemplate or
+ * loadTemplatefile are removed. Thus you can set a variable to
+ * "{SOMEINPUTDATA}" which is preserved.
+ *
+ * @param string $blockname block
+ * @param string $blockinner unknown
+ * @param string $variableList unknown
+ *
+ * @see parse()
+ * @access private
+ * @return null
+ */
+ function removeUnknownVariablesFromBlock ($blockname, $blockinner, $variableList)
+ {
+ if ($this->_options['preserve_input']) {
+ foreach ($this->blockvariables[$blockname] as $var => $setted) {
+ if (!in_array($var, $variableList)) {
+ $blockinner = str_replace($this->openingDelimiter .
+ $var . $this->closingDelimiter, '', $blockinner);
+ }
+ }
+ } else {
+ $blockinner = preg_replace($this->removeVariablesRegExp,
+ '',
+ $blockinner);
+ }
+
+ return $blockinner;
+ }
+
+ /**
+ * Parses the current block
+ *
+ * @see parse(), setCurrentBlock(), $currentBlock
+ * @access public
+ * @return null
+ */
+ function parseCurrentBlock()
+ {
+ return $this->parse($this->currentBlock);
+ } // end func parseCurrentBlock
+
+ /**
+ * Sets a variable value.
+ *
+ * The function can be used eighter like setVariable( "varname", "value")
+ * or with one array $variables["varname"] = "value"
+ * given setVariable($variables) quite like phplib templates set_var().
+ *
+ * @param mixed $variable string with the variable name or an array
+ * %variables["varname"] = "value"
+ * @param string $value value of the variable or empty if $variable
+ * is an array.
+ *
+ * @access public
+ * @return null
+ */
+ function setVariable($variable, $value = '')
+ {
+ if (is_array($variable)) {
+ $this->variableCache = array_merge($this->variableCache, $variable);
+ } else {
+ $this->variableCache[$variable] = $value;
+ }
+ } // end func setVariable
+
+ /**
+ * Sets the name of the current block that is the block where variables
+ * are added.
+ *
+ * @param string $block name of the block
+ *
+ * @return boolean false on failure, otherwise true
+ * @throws PEAR_Error
+ * @access public
+ */
+ function setCurrentBlock($block = '__global__')
+ {
+
+ if (!isset($this->blocklist[$block])) {
+ return PEAR::raiseError($this->errorMessage(IT_BLOCK_NOT_FOUND)
+ . '"' . $block . "'",
+ IT_BLOCK_NOT_FOUND);
+ }
+
+ $this->currentBlock = $block;
+
+ return true;
+ } // end func setCurrentBlock
+
+ /**
+ * Preserves an empty block even if removeEmptyBlocks is true.
+ *
+ * @param string $block name of the block
+ *
+ * @return boolean false on false, otherwise true
+ * @throws PEAR_Error
+ * @access public
+ * @see $removeEmptyBlocks
+ */
+ function touchBlock($block)
+ {
+ if (!isset($this->blocklist[$block])) {
+ return PEAR::raiseError($this->errorMessage(IT_BLOCK_NOT_FOUND) .
+ '"' . $block . "'", IT_BLOCK_NOT_FOUND);
+ }
+
+ $this->touchedBlocks[$block] = true;
+
+ return true;
+ } // end func touchBlock
+
+ /**
+ * Clears all datafields of the object and rebuild the internal blocklist
+ *
+ * LoadTemplatefile() and setTemplate() automatically call this function
+ * when a new template is given. Don't use this function
+ * unless you know what you're doing.
+ *
+ * @access private
+ * @see free()
+ * @return null
+ */
+ function init()
+ {
+ $this->free();
+ $this->findBlocks($this->template);
+ // we don't need it any more
+ $this->template = '';
+ $this->buildBlockvariablelist();
+ } // end func init
+
+ /**
+ * Clears all datafields of the object.
+ *
+ * Don't use this function unless you know what you're doing.
+ *
+ * @access private
+ * @see init()
+ * @return null
+ */
+ function free()
+ {
+ $this->err = array();
+
+ $this->currentBlock = '__global__';
+
+ $this->variableCache = array();
+ $this->blocklist = array();
+ $this->touchedBlocks = array();
+
+ $this->flagBlocktrouble = false;
+ $this->flagGlobalParsed = false;
+ } // end func free
+
+ /**
+ * Sets the template.
+ *
+ * You can eighter load a template file from disk with
+ * LoadTemplatefile() or set the template manually using this function.
+ *
+ * @param string $template template content
+ * @param bool $removeUnknownVariables how to handle unknown variables.
+ * @param bool $removeEmptyBlocks how to handle empty blocks.
+ *
+ * @see LoadTemplatefile(), $template
+ * @access public
+ * @return boolean
+ */
+ function setTemplate( $template, $removeUnknownVariables = true,
+ $removeEmptyBlocks = true)
+ {
+ $this->removeUnknownVariables = $removeUnknownVariables;
+
+ $this->removeEmptyBlocks = $removeEmptyBlocks;
+
+ if ($template == '' && $this->flagCacheTemplatefile) {
+ $this->variableCache = array();
+ $this->blockdata = array();
+ $this->touchedBlocks = array();
+ $this->currentBlock = '__global__';
+ } else {
+ $this->template = '<!-- BEGIN __global__ -->' . $template .
+ '<!-- END __global__ -->';
+ $this->init();
+ }
+
+ if ($this->flagBlocktrouble) {
+ return false;
+ }
+
+ return true;
+ } // end func setTemplate
+
+ /**
+ * Reads a template file from the disk.
+ *
+ * @param string $filename name of the template file
+ * @param bool $removeUnknownVariables how to handle unknown variables.
+ * @param bool $removeEmptyBlocks how to handle empty blocks.
+ *
+ * @access public
+ * @return boolean false on failure, otherwise true
+ * @see $template, setTemplate(), $removeUnknownVariables,
+ * $removeEmptyBlocks
+ */
+ function loadTemplatefile( $filename,
+ $removeUnknownVariables = true,
+ $removeEmptyBlocks = true )
+ {
+ $template = '';
+ if (!$this->flagCacheTemplatefile ||
+ $this->lastTemplatefile != $filename
+ ) {
+ $template = $this->getFile($filename);
+ }
+ $this->lastTemplatefile = $filename;
+
+ return $template != '' ?
+ $this->setTemplate($template,
+ $removeUnknownVariables,
+ $removeEmptyBlocks) : false;
+ } // end func LoadTemplatefile
+
+ /**
+ * Sets the file root. The file root gets prefixed to all filenames passed
+ * to the object.
+ *
+ * Make sure that you override this function when using the class
+ * on windows.
+ *
+ * @param string $root File root
+ *
+ * @see HTML_Template_IT()
+ * @access public
+ * @return null
+ */
+ function setRoot($root)
+ {
+ if ($root != '' && substr($root, -1) != '/') {
+ $root .= '/';
+ }
+
+ $this->fileRoot = $root;
+ } // end func setRoot
+
+ /**
+ * Build a list of all variables within of a block
+ *
+ * @access private
+ * @return null
+ */
+ function buildBlockvariablelist()
+ {
+ foreach ($this->blocklist as $name => $content) {
+ preg_match_all($this->variablesRegExp, $content, $regs);
+
+ if (count($regs[1]) != 0) {
+ foreach ($regs[1] as $k => $var) {
+ $this->blockvariables[$name][$var] = true;
+ }
+ } else {
+ $this->blockvariables[$name] = array();
+ }
+ }
+ } // end func buildBlockvariablelist
+
+ /**
+ * Returns a list of all global variables
+ *
+ * @access public
+ * @return array
+ */
+ function getGlobalvariables()
+ {
+ $regs = array();
+ $values = array();
+
+ foreach ($this->blockvariables['__global__'] as $allowedvar => $v) {
+ if (isset($this->variableCache[$allowedvar])) {
+ $regs[] = '@' . $this->openingDelimiter .
+ $allowedvar . $this->closingDelimiter . '@';
+ $values[] = $this->variableCache[$allowedvar];
+ unset($this->variableCache[$allowedvar]);
+ }
+ }
+
+ return array($regs, $values);
+ } // end func getGlobalvariables
+
+ /**
+ * Recusively builds a list of all blocks within the template.
+ *
+ * @param string $string string that gets scanned
+ *
+ * @access private
+ * @see $blocklist
+ * @return array
+ */
+ function findBlocks($string)
+ {
+ $blocklist = array();
+
+ if (preg_match_all($this->blockRegExp, $string, $regs, PREG_SET_ORDER)) {
+ foreach ($regs as $k => $match) {
+ $blockname = $match[1];
+ $blockcontent = $match[2];
+
+ if (isset($this->blocklist[$blockname])) {
+ $msg = $this->errorMessage(IT_BLOCK_DUPLICATE, $blockname);
+
+ $this->err[] = PEAR::raiseError($msg, IT_BLOCK_DUPLICATE);
+
+ $this->flagBlocktrouble = true;
+ }
+
+ $this->blocklist[$blockname] = $blockcontent;
+ $this->blockdata[$blockname] = "";
+
+ $blocklist[] = $blockname;
+
+ $inner = $this->findBlocks($blockcontent);
+ $regex = '@<!--\s+BEGIN\s+%s\s+-->(.*)<!--\s+END\s+%s\s+-->@sm';
+ foreach ($inner as $k => $name) {
+ $pattern = sprintf($regex, preg_quote($name), preg_quote($name));
+
+ $this->blocklist[$blockname] = preg_replace($pattern,
+ $this->openingDelimiter .
+ '__' . $name . '__' .
+ $this->closingDelimiter,
+ $this->blocklist[$blockname]);
+
+ $this->blockinner[$blockname][] = $name;
+
+ $this->blockparents[$name] = $blockname;
+ }
+ }
+ }
+
+ return $blocklist;
+ } // end func findBlocks
+
+ /**
+ * Reads a file from disk and returns its content.
+ *
+ * @param string $filename Filename
+ *
+ * @return string Filecontent
+ * @access private
+ */
+ function getFile($filename)
+ {
+ if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') {
+ $filename = substr($filename, 1);
+ }
+
+ $filename = $this->fileRoot . $filename;
+
+ if (!($fh = @fopen($filename, 'r'))) {
+ $this->err[] = PEAR::raiseError($this->errorMessage(IT_TPL_NOT_FOUND) .
+ ': "' .$filename .'"',
+ IT_TPL_NOT_FOUND);
+ return "";
+ }
+
+ $fsize = filesize($filename);
+ if ($fsize < 1) {
+ fclose($fh);
+ return '';
+ }
+
+ $content = fread($fh, $fsize);
+ fclose($fh);
+
+ return preg_replace("#<!-- INCLUDE (.*) -->#ime",
+ "\$this->getFile('\\1')",
+ $content);
+ } // end func getFile
+
+ /**
+ * Adds delimiters to a string, so it can be used as a pattern
+ * in preg_* functions
+ *
+ * @param string $str input
+ *
+ * @return string
+ * @access private
+ */
+ function _addPregDelimiters($str)
+ {
+ return '@' . preg_quote($str) . '@';
+ }
+
+ /**
+ * Escapes $ and \ as preg_replace will treat
+ * them as a backreference and not literal.
+ * See bug #9501
+ *
+ * @param string $str String to escape
+ *
+ * @since 1.2.2
+ * @return string
+ * @access private
+ */
+ function _escapeBackreferences($str)
+ {
+ $str = str_replace('\\', '\\\\', $str);
+ $str = preg_replace('@\$([0-9]{1,2})@', '\\\$${1}', $str);
+ return $str;
+ }
+
+ /**
+ * Replaces an opening delimiter by a special string
+ *
+ * @param string $str special string
+ *
+ * @return string
+ * @access private
+ */
+ function _preserveOpeningDelimiter($str)
+ {
+ return (false === strpos($str, $this->openingDelimiter))?
+ $str:
+ str_replace($this->openingDelimiter,
+ $this->openingDelimiter .
+ '%preserved%' . $this->closingDelimiter,
+ $str);
+ }
+
+ /**
+ * Return a textual error message for a IT error code
+ *
+ * @param integer $value error code
+ * @param string $blockname unknown
+ *
+ * @access private
+ * @return string error message, or false if the error code was
+ * not recognized
+ */
+ function errorMessage($value, $blockname = '')
+ {
+ static $errorMessages;
+ if (!isset($errorMessages)) {
+ $errorMessages = array(
+ IT_OK => '',
+ IT_ERROR => 'unknown error',
+ IT_TPL_NOT_FOUND => 'Cannot read the template file',
+ IT_BLOCK_NOT_FOUND => 'Cannot find this block',
+ IT_BLOCK_DUPLICATE => 'The name of a block must be'.
+ ' uniquewithin a template.'.
+ ' Found "' . $blockname . '" twice.'.
+ 'Unpredictable results '.
+ 'may appear.',
+ IT_UNKNOWN_OPTION => 'Unknown option'
+ );
+ }
+
+ if (PEAR::isError($value)) {
+ $value = $value->getCode();
+ }
+
+ return isset($errorMessages[$value]) ?
+ $errorMessages[$value] : $errorMessages[IT_ERROR];
+ }
+} // end class IntegratedTemplate
+?>
--- /dev/null
+<?php
+/**
+ * Integrated Template - IT
+ *
+ * PHP version 4
+ *
+ * Copyright (c) 1997-2007 Ulf Wendel, Pierre-Alain Joye,
+ * David Soria Parra
+ *
+ * This source file is subject to the New BSD license, That is bundled
+ * with this package in the file LICENSE, and is available through
+ * the world-wide-web at
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the new BSDlicense and are unable
+ * to obtain it through the world-wide-web, please send a note to
+ * pajoye@php.net so we can mail you a copy immediately.
+ *
+ * Author: Ulf Wendel <ulf.wendel@phpdoc.de>
+ * Pierre-Alain Joye <pajoye@php.net>
+ * David Soria Parra <dsp@php.net>
+ *
+ * @category HTML
+ * @package HTML_Template_IT
+ * @author Ulf Wendel <uw@netuse.de>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version CVS: $Id: ITX.php,v 1.19 2008/11/14 23:57:17 kguest Exp $
+ * @link http://pear.php.net/packages/HTML_Template_IT
+ * @access public
+ */
+
+require_once 'HTML/Template/IT.php';
+require_once 'HTML/Template/IT_Error.php';
+
+/**
+* Integrated Template Extension - ITX
+*
+* With this class you get the full power of the phplib template class.
+* You may have one file with blocks in it but you have as well one main file
+* and multiple files one for each block. This is quite usefull when you have
+* user configurable websites. Using blocks not in the main template allows
+* you to modify some parts of your layout easily.
+*
+* Note that you can replace an existing block and add new blocks at runtime.
+* Adding new blocks means changing a variable placeholder to a block.
+*
+ * @category HTML
+ * @package HTML_Template_IT
+ * @author Ulf Wendel <uw@netuse.de>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/packages/HTML_Template_IT
+ * @access public
+*/
+class HTML_Template_ITX extends HTML_Template_IT
+{
+ /**
+ * Array with all warnings.
+ * @var array
+ * @access public
+ * @see $printWarning, $haltOnWarning, warning()
+ */
+ var $warn = array();
+
+ /**
+ * Print warnings?
+ * @var array
+ * @access public
+ * @see $haltOnWarning, $warn, warning()
+ */
+ var $printWarning = false;
+
+ /**
+ * Call die() on warning?
+ * @var boolean
+ * @access public
+ * @see $warn, $printWarning, warning()
+ */
+ var $haltOnWarning = false;
+
+ /**
+ * RegExp used to test for a valid blockname.
+ * @var string
+ * @access private
+ */
+ var $checkblocknameRegExp = '';
+
+ /**
+ * Functionnameprefix used when searching function calls in the template.
+ * @var string
+ * @access public
+ */
+ var $functionPrefix = 'func_';
+
+ /**
+ * Functionname RegExp.
+ * @var string
+ * @access public
+ */
+ var $functionnameRegExp = '[_a-zA-Z]+[A-Za-z_0-9]*';
+
+ /**
+ * RegExp used to grep function calls in the template.
+ *
+ * The variable gets set by the constructor.
+ *
+ * @access private
+ * @var string
+ * @see HTML_Template_IT()
+ */
+ var $functionRegExp = '';
+
+ /**
+ * List of functions found in the template.
+ *
+ * @access private
+ * @var array
+ */
+ var $functions = array();
+
+ /**
+ * List of callback functions specified by the user.
+ *
+ * @access private
+ * @var array
+ */
+ var $callback = array();
+
+ /**
+ * Builds some complex regexps and calls the constructor
+ * of the parent class.
+ *
+ * Make sure that you call this constructor if you derive your own
+ * template class from this one.
+ *
+ * @param string $root Root node?
+ *
+ * @access public
+ * @see HTML_Template_IT()
+ */
+ function HTML_Template_ITX($root = '')
+ {
+
+ $this->checkblocknameRegExp = '@' . $this->blocknameRegExp . '@';
+
+ $this->functionRegExp = '@' . $this->functionPrefix . '(' .
+ $this->functionnameRegExp . ')\s*\(@sm';
+
+ $this->HTML_Template_IT($root);
+ } // end func constructor
+
+ /**
+ * Clears all datafields of the object and rebuild the internal blocklist
+ *
+ * LoadTemplatefile() and setTemplate() automatically call this function
+ * when a new template is given. Don't use this function
+ * unless you know what you're doing.
+ *
+ * @access private
+ * @return null
+ */
+ function init()
+ {
+ $this->free();
+ $this->buildFunctionlist();
+ $this->findBlocks($this->template);
+
+ // we don't need it any more
+ $this->template = '';
+ $this->buildBlockvariablelist();
+
+ } // end func init
+
+ /**
+ * Replaces an existing block with new content.
+ *
+ * This function will replace a block of the template and all blocks
+ * contained in the replaced block and add a new block insted, means
+ * you can dynamically change your template.
+ *
+ * Note that changing the template structure violates one of the IT[X]
+ * development goals. I've tried to write a simple to use template engine
+ * supporting blocks. In contrast to other systems IT[X] analyses the way
+ * you've nested blocks and knows which block belongs into another block.
+ * The nesting information helps to make the API short and simple. Replacing
+ * blocks does not only mean that IT[X] has to update the nesting
+ * information (relatively time consumpting task) but you have to make sure
+ * that you do not get confused due to the template change itself.
+ *
+ * @param string $block Blockname
+ * @param string $template Blockcontent
+ * @param boolean $keep_content true if the new block inherits the content
+ * of the old block
+ *
+ * @return boolean
+ * @throws IT_Error
+ * @see replaceBlockfile(), addBlock(), addBlockfile()
+ * @access public
+ */
+ function replaceBlock($block, $template, $keep_content = false)
+ {
+ if (!isset($this->blocklist[$block])) {
+ return new IT_Error("The block "."'$block'".
+ " does not exist in the template and thus it can't be replaced.",
+ __FILE__, __LINE__);
+ }
+
+ if ($template == '') {
+ return new IT_Error('No block content given.', __FILE__, __LINE__);
+ }
+
+ if ($keep_content) {
+ $blockdata = $this->blockdata[$block];
+ }
+
+ // remove all kinds of links to the block / data of the block
+ $this->removeBlockData($block);
+
+ $template = "<!-- BEGIN $block -->" . $template . "<!-- END $block -->";
+ $parents = $this->blockparents[$block];
+
+ $this->findBlocks($template);
+ $this->blockparents[$block] = $parents;
+
+ // KLUDGE: rebuild the list for all block - could be done faster
+ $this->buildBlockvariablelist();
+
+ if ($keep_content) {
+ $this->blockdata[$block] = $blockdata;
+ }
+
+ // old TODO - I'm not sure if we need this
+ // update caches
+
+ return true;
+ } // end func replaceBlock
+
+ /**
+ * Replaces an existing block with new content from a file.
+ *
+ * @param string $block Blockname
+ * @param string $filename Name of the file that contains the blockcontent
+ * @param boolean $keep_content true if the new block inherits the content of
+ * the old block
+ *
+ * @brother replaceBlock()
+ * @access public
+ * @return null
+ */
+ function replaceBlockfile($block, $filename, $keep_content = false)
+ {
+ return $this->replaceBlock($block, $this->getFile($filename), $keep_content);
+ } // end func replaceBlockfile
+
+ /**
+ * Adds a block to the template changing a variable placeholder
+ * to a block placeholder.
+ *
+ * Add means "replace a variable placeholder by a new block".
+ * This is different to PHPLibs templates. The function loads a
+ * block, creates a handle for it and assigns it to a certain
+ * variable placeholder. To to the same with PHPLibs templates you would
+ * call set_file() to create the handle and parse() to assign the
+ * parsed block to a variable. By this PHPLibs templates assume
+ * that you tend to assign a block to more than one one placeholder.
+ * To assign a parsed block to more than only the placeholder you specify
+ * in this function you have to use a combination of getBlock()
+ * and setVariable().
+ *
+ * As no updates to cached data is necessary addBlock() and addBlockfile()
+ * are rather "cheap" meaning quick operations.
+ *
+ * The block content must not start with <!-- BEGIN blockname -->
+ * and end with <!-- END blockname --> this would cause overhead and
+ * produce an error.
+ *
+ * @param string $placeholder Name of the variable placeholder, the name
+ * must be unique within the template.
+ * @param string $blockname Name of the block to be added
+ * @param string $template Content of the block
+ *
+ * @return boolean
+ * @throws IT_Error
+ * @see addBlockfile()
+ * @access public
+ */
+ function addBlock($placeholder, $blockname, $template)
+ {
+ // Don't trust any user even if it's a programmer or yourself...
+ if ($placeholder == '') {
+ return new IT_Error('No variable placeholder given.',
+ __FILE__, __LINE__);
+ } elseif ($blockname == '' ||
+ !preg_match($this->checkblocknameRegExp, $blockname)
+ ) {
+ return new IT_Error("No or invalid blockname '$blockname' given.",
+ __FILE__, __LINE__);
+ } elseif ($template == '') {
+ return new IT_Error('No block content given.', __FILE__, __LINE__);
+ } elseif (isset($this->blocklist[$blockname])) {
+ return new IT_Error('The block already exists.',
+ __FILE__, __LINE__);
+ }
+
+ // find out where to insert the new block
+ $parents = $this->findPlaceholderBlocks($placeholder);
+ if (count($parents) == 0) {
+
+ return new IT_Error("The variable placeholder".
+ " '$placeholder' was not found in the template.",
+ __FILE__, __LINE__);
+
+ } elseif (count($parents) > 1) {
+
+ reset($parents);
+ while (list($k, $parent) = each($parents)) {
+ $msg .= "$parent, ";
+ }
+ $msg = substr($parent, -2);
+
+ return new IT_Error("The variable placeholder "."'$placeholder'".
+ " must be unique, found in multiple blocks '$msg'.",
+ __FILE__, __LINE__);
+ }
+
+ $template = "<!-- BEGIN $blockname -->"
+ . $template
+ . "<!-- END $blockname -->";
+ $this->findBlocks($template);
+ if ($this->flagBlocktrouble) {
+ return false; // findBlocks() already throws an exception
+ }
+
+ $this->blockinner[$parents[0]][] = $blockname;
+
+ $escblockname = '__' . $blockname . '__';
+
+ $this->blocklist[$parents[0]] = preg_replace(
+ '@' . $this->openingDelimiter . $placeholder .
+ $this->closingDelimiter . '@',
+ $this->openingDelimiter . $escblockname . $this->closingDelimiter,
+ $this->blocklist[$parents[0]]);
+
+ $this->deleteFromBlockvariablelist($parents[0], $placeholder);
+ $this->updateBlockvariablelist($blockname);
+
+ return true;
+ } // end func addBlock
+
+ /**
+ * Adds a block taken from a file to the template changing a variable
+ * placeholder to a block placeholder.
+ *
+ * @param string $placeholder Name of the variable placeholder to be converted
+ * @param string $blockname Name of the block to be added
+ * @param string $filename File that contains the block
+ *
+ * @brother addBlock()
+ * @access public
+ * @return null
+ */
+ function addBlockfile($placeholder, $blockname, $filename)
+ {
+ return $this->addBlock($placeholder, $blockname, $this->getFile($filename));
+ } // end func addBlockfile
+
+ /**
+ * Returns the name of the (first) block that contains
+ * the specified placeholder.
+ *
+ * @param string $placeholder Name of the placeholder you're searching
+ * @param string $block Name of the block to scan. If left out (default)
+ * all blocks are scanned.
+ *
+ * @return string Name of the (first) block that contains
+ * the specified placeholder.
+ * If the placeholder was not found or an error occured
+ * an empty string is returned.
+ * @throws IT_Error
+ * @access public
+ */
+ function placeholderExists($placeholder, $block = '')
+ {
+ if ($placeholder == '') {
+ new IT_Error('No placeholder name given.', __FILE__, __LINE__);
+ return '';
+ }
+
+ if ($block != '' && !isset($this->blocklist[$block])) {
+ new IT_Error("Unknown block '$block'.", __FILE__, __LINE__);
+ return '';
+ }
+
+ // name of the block where the given placeholder was found
+ $found = '';
+
+ if ($block != '') {
+ if (is_array($variables = $this->blockvariables[$block])) {
+ // search the value in the list of blockvariables
+ reset($variables);
+ while (list($k, $variable) = each($variables)) {
+ if ($k == $placeholder) {
+ $found = $block;
+ break;
+ }
+ }
+ }
+ } else {
+
+ // search all blocks and return the name of the first block that
+ // contains the placeholder
+ reset($this->blockvariables);
+ while (list($blockname, $variables) = each($this->blockvariables)) {
+ if (is_array($variables) && isset($variables[$placeholder])) {
+ $found = $blockname;
+ break;
+ }
+ }
+ }
+
+ return $found;
+ } // end func placeholderExists
+
+ /**
+ * Checks the list of function calls in the template and
+ * calls their callback function.
+ *
+ * @access public
+ * @return null
+ */
+ function performCallback()
+ {
+ reset($this->functions);
+ while (list($func_id, $function) = each($this->functions)) {
+ if (isset($this->callback[$function['name']])) {
+ if ($this->callback[$function['name']]['expandParameters']) {
+ $callFunction = 'call_user_func_array';
+ } else {
+ $callFunction = 'call_user_func';
+ }
+
+ if ($this->callback[$function['name']]['object'] != '') {
+ $call = $callFunction(
+ array(
+ &$GLOBALS[$this->callback[$function['name']]['object']],
+ $this->callback[$function['name']]['function']),
+ $function['args']);
+
+ } else {
+ $call = $callFunction(
+ $this->callback[$function['name']]['function'],
+ $function['args']);
+ }
+ $this->variableCache['__function' . $func_id . '__'] = $call;
+ }
+ }
+
+ } // end func performCallback
+
+ /**
+ * Returns a list of all function calls in the current template.
+ *
+ * @return array
+ * @access public
+ */
+ function getFunctioncalls()
+ {
+ return $this->functions;
+ } // end func getFunctioncalls
+
+ /**
+ * Replaces a function call with the given replacement.
+ *
+ * @param int $functionID Function ID
+ * @param string $replacement Replacement
+ *
+ * @access public
+ * @deprecated
+ * @return null
+ */
+ function setFunctioncontent($functionID, $replacement)
+ {
+ $this->variableCache['__function' . $functionID . '__'] = $replacement;
+ } // end func setFunctioncontent
+
+ /**
+ * Sets a callback function.
+ *
+ * IT[X] templates (note the X) can contain simple function calls.
+ * "function call" means that the editor of the template can add
+ * special placeholder to the template like 'func_h1("embedded in h1")'.
+ * IT[X] will grab this function calls and allow you to define a callback
+ * function for them.
+ *
+ * This is an absolutely evil feature. If your application makes heavy
+ * use of such callbacks and you're even implementing if-then etc. on
+ * the level of a template engine you're reiventing the wheel... - that's
+ * actually how PHP came into life. Anyway, sometimes it's handy.
+ *
+ * Consider also using XML/XSLT or native PHP. And please do not push
+ * IT[X] any further into this direction of adding logics to the template
+ * engine.
+ *
+ * For those of you ready for the X in IT[X]:
+ *
+ * <?php
+ * ...
+ * function h_one($args) {
+ * return sprintf('<h1>%s</h1>', $args[0]);
+ * }
+ *
+ * ...
+ * $itx = new HTML_Template_ITX(...);
+ * ...
+ * $itx->setCallbackFunction('h1', 'h_one');
+ * $itx->performCallback();
+ * ?>
+ *
+ * template:
+ * func_h1('H1 Headline');
+ *
+ * @param string $tplfunction Function name in the template
+ * @param string $callbackfunction Name of the callback function
+ * @param string $callbackobject Name of the callback object
+ * @param boolean $expandCallbackParameters If the callback is called with
+ * a list of parameters or with an
+ * array holding the parameters
+ *
+ * @return boolean False on failure.
+ * @throws IT_Error
+ * @access public
+ * @deprecated The $callbackobject parameter is depricated since
+ * version 1.2 and might be dropped in further versions.
+ */
+ function setCallbackFunction($tplfunction, $callbackfunction,
+ $callbackobject = '',
+ $expandCallbackParameters = false)
+ {
+ if ($tplfunction == '' || $callbackfunction == '') {
+ return new IT_Error("No template function "."('$tplfunction')".
+ " and/or no callback function ('$callback') given.",
+ __FILE__, __LINE__);
+ }
+ $this->callback[$tplfunction] = array(
+ 'function' => $callbackfunction,
+ 'object' => $callbackobject,
+ 'expandParameters' => (boolean)
+ $expandCallbackParameters);
+
+ return true;
+ } // end func setCallbackFunction
+
+ /**
+ * Sets the Callback function lookup table
+ *
+ * @param array $functions function table
+ * array[templatefunction] =
+ * array(
+ * "function" => userfunction,
+ * "object" => userobject
+ * )
+ *
+ * @access public
+ * @return null
+ */
+ function setCallbackFuntiontable($functions)
+ {
+ $this->callback = $functions;
+ } // end func setCallbackFunctiontable
+
+ /**
+ * Recursively removes all data assiciated with a block, including
+ * all inner blocks
+ *
+ * @param string $block block to be removed
+ *
+ * @return null
+ * @access private
+ */
+ function removeBlockData($block)
+ {
+ if (isset($this->blockinner[$block])) {
+ foreach ($this->blockinner[$block] as $k => $inner) {
+ $this->removeBlockData($inner);
+ }
+
+ unset($this->blockinner[$block]);
+ }
+
+ unset($this->blocklist[$block]);
+ unset($this->blockdata[$block]);
+ unset($this->blockvariables[$block]);
+ unset($this->touchedBlocks[$block]);
+
+ } // end func removeBlockinner
+
+ /**
+ * Returns a list of blocknames in the template.
+ *
+ * @return array [blockname => blockname]
+ * @access public
+ * @see blockExists()
+ */
+ function getBlocklist()
+ {
+ $blocklist = array();
+ foreach ($this->blocklist as $block => $content) {
+ $blocklist[$block] = $block;
+ }
+
+ return $blocklist;
+ } // end func getBlocklist
+
+ /**
+ * Checks wheter a block exists.
+ *
+ * @param string $blockname Blockname
+ *
+ * @return boolean
+ * @access public
+ * @see getBlocklist()
+ */
+ function blockExists($blockname)
+ {
+ return isset($this->blocklist[$blockname]);
+ } // end func blockExists
+
+ /**
+ * Returns a list of variables of a block.
+ *
+ * @param string $block Blockname
+ *
+ * @return array [varname => varname]
+ * @access public
+ * @see BlockvariableExists()
+ */
+ function getBlockvariables($block)
+ {
+ if (!isset($this->blockvariables[$block])) {
+ return array();
+ }
+
+ $variables = array();
+ foreach ($this->blockvariables[$block] as $variable => $v) {
+ $variables[$variable] = $variable;
+ }
+
+ return $variables;
+ } // end func getBlockvariables
+
+ /**
+ * Checks wheter a block variable exists.
+ *
+ * @param string $block Blockname
+ * @param string $variable Variablename
+ *
+ * @return boolean
+ * @access public
+ * @see getBlockvariables()
+ */
+ function BlockvariableExists($block, $variable)
+ {
+ return isset($this->blockvariables[$block][$variable]);
+ } // end func BlockvariableExists
+
+ /**
+ * Builds a functionlist from the template.
+ *
+ * @access private
+ * @return null
+ */
+ function buildFunctionlist()
+ {
+ $this->functions = array();
+
+ $template = $this->template;
+
+ $num = 0;
+
+ while (preg_match($this->functionRegExp, $template, $regs)) {
+
+ $pos = strpos($template, $regs[0]);
+
+ $template = substr($template, $pos + strlen($regs[0]));
+
+ $head = $this->getValue($template, ')');
+ $args = array();
+
+ $search = $regs[0] . $head . ')';
+
+ $replace = $this->openingDelimiter .
+ '__function' . $num . '__' .
+ $this->closingDelimiter;
+
+ $this->template = str_replace($search, $replace, $this->template);
+ $template = str_replace($search, $replace, $template);
+
+ while ($head != '' && $args2 = $this->getValue($head, ',')) {
+ $arg2 = trim($args2);
+
+ $args[] = ('"' == $arg2{0} || "'" == $arg2{0}) ?
+ substr($arg2, 1, -1) : $arg2;
+
+ if ($arg2 == $head) {
+ break;
+ }
+ $head = substr($head, strlen($arg2) + 1);
+ }
+
+ $this->functions[$num++] = array('name' => $regs[1],
+ 'args' => $args);
+ }
+
+ } // end func buildFunctionlist
+
+ /**
+ * Truncates the given code from the first occurence of
+ * $delimiter but ignores $delimiter enclosed by " or '.
+ *
+ * @param string $code The code which should be parsed
+ * @param string $delimiter The delimiter char
+ *
+ * @access private
+ * @return string
+ * @see buildFunctionList()
+ */
+ function getValue($code, $delimiter)
+ {
+ if ($code == '') {
+ return '';
+ }
+
+ if (!is_array($delimiter)) {
+ $delimiter = array($delimiter => true);
+ }
+
+ $len = strlen($code);
+ $enclosed = false;
+ $enclosed_by = '';
+
+ if (isset($delimiter[$code[0]])) {
+ $i = 1;
+ } else {
+ for ($i = 0; $i < $len; ++$i) {
+ $char = $code[$i];
+
+ if (($char == '"' || $char == "'") &&
+ ($char == $enclosed_by || '' == $enclosed_by) &&
+ (0 == $i || ($i > 0 && '\\' != $code[$i - 1]))) {
+
+ if (!$enclosed) {
+ $enclosed_by = $char;
+ } else {
+ $enclosed_by = "";
+ }
+ $enclosed = !$enclosed;
+
+ }
+
+ if (!$enclosed && isset($delimiter[$char])) {
+ break;
+ }
+ }
+ }
+
+ return substr($code, 0, $i);
+ } // end func getValue
+
+ /**
+ * Deletes one or many variables from the block variable list.
+ *
+ * @param string $block Blockname
+ * @param mixed $variables Name of one variable or array of variables
+ * (array (name => true ) ) to be stripped.
+ *
+ * @access private
+ * @return null
+ */
+ function deleteFromBlockvariablelist($block, $variables)
+ {
+ if (!is_array($variables)) {
+ $variables = array($variables => true);
+ }
+
+ reset($this->blockvariables[$block]);
+ while (list($varname, $val) = each($this->blockvariables[$block])) {
+ if (isset($variables[$varname])) {
+ unset($this->blockvariables[$block][$varname]);
+ }
+ }
+ } // end deleteFromBlockvariablelist
+
+ /**
+ * Updates the variable list of a block.
+ *
+ * @param string $block Blockname
+ *
+ * @access private
+ * @return null
+ */
+ function updateBlockvariablelist($block)
+ {
+ preg_match_all($this->variablesRegExp,
+ $this->blocklist[$block], $regs);
+
+ if (count($regs[1]) != 0) {
+ foreach ($regs[1] as $k => $var) {
+ $this->blockvariables[$block][$var] = true;
+ }
+ } else {
+ $this->blockvariables[$block] = array();
+ }
+
+ // check if any inner blocks were found
+ if (isset($this->blockinner[$block]) &&
+ is_array($this->blockinner[$block]) &&
+ count($this->blockinner[$block]) > 0) {
+ /*
+ * loop through inner blocks, registering the variable
+ * placeholders in each
+ */
+ foreach ($this->blockinner[$block] as $childBlock) {
+ $this->updateBlockvariablelist($childBlock);
+ }
+ }
+ } // end func updateBlockvariablelist
+
+ /**
+ * Returns an array of blocknames where the given variable
+ * placeholder is used.
+ *
+ * @param string $variable Variable placeholder
+ *
+ * @return array $parents parents[0..n] = blockname
+ * @access public
+ */
+ function findPlaceholderBlocks($variable)
+ {
+ $parents = array();
+ reset($this->blocklist);
+ while (list($blockname, $content) = each($this->blocklist)) {
+ reset($this->blockvariables[$blockname]);
+
+ while (list($varname, $val) = each($this->blockvariables[$blockname])) {
+ if ($variable == $varname) {
+ $parents[] = $blockname;
+ }
+ }
+ }
+
+ return $parents;
+ } // end func findPlaceholderBlocks
+
+ /**
+ * Handles warnings, saves them to $warn and prints them or
+ * calls die() depending on the flags
+ *
+ * @param string $message Warning
+ * @param string $file File where the warning occured
+ * @param int $line Linenumber where the warning occured
+ *
+ * @see $warn, $printWarning, $haltOnWarning
+ * @access private
+ * @return null
+ */
+ function warning($message, $file = '', $line = 0)
+ {
+ $message = sprintf('HTML_Template_ITX Warning: %s [File: %s, Line: %d]',
+ $message,
+ $file,
+ $line);
+
+ $this->warn[] = $message;
+
+ if ($this->printWarning) {
+ print $message;
+ }
+
+ if ($this->haltOnWarning) {
+ die($message);
+ }
+ } // end func warning
+
+} // end class HTML_Template_ITX
+?>
--- /dev/null
+<?php
+/**
+ * Integrated Template - IT
+ *
+ * PHP version 4
+ *
+ * Copyright (c) 1997-2007 Ulf Wendel, Pierre-Alain Joye,
+ * David Soria Parra
+ *
+ * This source file is subject to the New BSD license, That is bundled
+ * with this package in the file LICENSE, and is available through
+ * the world-wide-web at
+ * http://www.opensource.org/licenses/bsd-license.php
+ * If you did not receive a copy of the new BSDlicense and are unable
+ * to obtain it through the world-wide-web, please send a note to
+ * pajoye@php.net so we can mail you a copy immediately.
+ *
+ * Author: Ulf Wendel <ulf.wendel@phpdoc.de>
+ * Pierre-Alain Joye <pajoye@php.net>
+ * David Soria Parra <dsp@php.net>
+ *
+ * @category HTML
+ * @package HTML_Template_IT
+ * @author Ulf Wendel <uw@netuse.de>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version CVS: $Id: IT_Error.php,v 1.4 2008/11/09 12:30:27 clockwerx Exp $
+ * @link http://pear.php.net/packages/HTML_Template_IT
+ * @access public
+ */
+
+require_once "PEAR.php";
+
+/**
+* IT[X] Error class
+*
+ * @category HTML
+ * @package HTML_Template_IT
+ * @author Ulf Wendel <uw@netuse.de>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/packages/HTML_Template_IT
+ * @access public
+*/
+class IT_Error extends PEAR_Error
+{
+ /**
+ * Prefix of all error messages.
+ *
+ * @var string
+ */
+ var $error_message_prefix = "IntegratedTemplate Error: ";
+
+ /**
+ * Creates an cache error object.
+ *
+ * @param string $msg error message
+ * @param string $file file where the error occured
+ * @param string $line linenumber where the error occured
+ */
+ function IT_Error($msg, $file = __FILE__, $line = __LINE__)
+ {
+ $this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line));
+ } // end func IT_Error
+
+} // end class IT_Error
+?>
--- /dev/null
+etc/httpd/conf/vhosts.d/nagios.conf
+etc/nagiosql
+etc/nagiosql/backup
+etc/nagiosql/backup/hosts
+etc/nagiosql/backup/services
+etc/nagiosql/hosts
+etc/nagiosql/services
+usr/share/nagiosql
+usr/share/nagiosql/admin
+usr/share/nagiosql/admin.php
+usr/share/nagiosql/admin/administration.php
+usr/share/nagiosql/admin/alarming.php
+usr/share/nagiosql/admin/cgicfg.php
+usr/share/nagiosql/admin/checkcommands.php
+usr/share/nagiosql/admin/commandline.php
+usr/share/nagiosql/admin/commands.php
+usr/share/nagiosql/admin/contactgroups.php
+usr/share/nagiosql/admin/contacts.php
+usr/share/nagiosql/admin/contacttemplates.php
+usr/share/nagiosql/admin/delbackup.php
+usr/share/nagiosql/admin/domain.php
+usr/share/nagiosql/admin/download.php
+usr/share/nagiosql/admin/errorsite.php
+usr/share/nagiosql/admin/helpedit.php
+usr/share/nagiosql/admin/hostdependencies.php
+usr/share/nagiosql/admin/hostescalations.php
+usr/share/nagiosql/admin/hostextinfo.php
+usr/share/nagiosql/admin/hostgroups.php
+usr/share/nagiosql/admin/hosts.php
+usr/share/nagiosql/admin/hosttemplates.php
+usr/share/nagiosql/admin/import.php
+usr/share/nagiosql/admin/index.html
+usr/share/nagiosql/admin/info.php
+usr/share/nagiosql/admin/logbook.php
+usr/share/nagiosql/admin/menuaccess.php
+usr/share/nagiosql/admin/monitoring.php
+usr/share/nagiosql/admin/mutdialog.php
+usr/share/nagiosql/admin/nagioscfg.php
+usr/share/nagiosql/admin/password.php
+usr/share/nagiosql/admin/searchhosts.php
+usr/share/nagiosql/admin/servicedependencies.php
+usr/share/nagiosql/admin/serviceescalations.php
+usr/share/nagiosql/admin/serviceextinfo.php
+usr/share/nagiosql/admin/servicegroups.php
+usr/share/nagiosql/admin/services.php
+usr/share/nagiosql/admin/servicetemplates.php
+usr/share/nagiosql/admin/settings.php
+usr/share/nagiosql/admin/specials.php
+usr/share/nagiosql/admin/templatedefinitions.php
+usr/share/nagiosql/admin/timedefinitions.php
+usr/share/nagiosql/admin/timeperiods.php
+usr/share/nagiosql/admin/tools.php
+usr/share/nagiosql/admin/user.php
+usr/share/nagiosql/admin/variabledefinitions.php
+usr/share/nagiosql/admin/verify.php
+usr/share/nagiosql/config
+usr/share/nagiosql/config/fieldvars.php
+usr/share/nagiosql/config/locale
+usr/share/nagiosql/config/locale/de_DE
+usr/share/nagiosql/config/locale/de_DE/LC_MESSAGES
+usr/share/nagiosql/config/locale/de_DE/LC_MESSAGES/de_DE.mo
+usr/share/nagiosql/config/locale/de_DE/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/de_DE/index.html
+usr/share/nagiosql/config/locale/en_GB
+usr/share/nagiosql/config/locale/en_GB/LC_MESSAGES
+usr/share/nagiosql/config/locale/en_GB/LC_MESSAGES/en_GB.mo
+usr/share/nagiosql/config/locale/en_GB/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/en_GB/index.html
+usr/share/nagiosql/config/locale/es_ES
+usr/share/nagiosql/config/locale/es_ES/LC_MESSAGES
+usr/share/nagiosql/config/locale/es_ES/LC_MESSAGES/es_ES.mo
+usr/share/nagiosql/config/locale/es_ES/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/es_ES/index.html
+usr/share/nagiosql/config/locale/fr_FR
+usr/share/nagiosql/config/locale/fr_FR/LC_MESSAGES
+usr/share/nagiosql/config/locale/fr_FR/LC_MESSAGES/fr_FR.mo
+usr/share/nagiosql/config/locale/fr_FR/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/fr_FR/index.html
+usr/share/nagiosql/config/locale/it_IT
+usr/share/nagiosql/config/locale/it_IT/LC_MESSAGES
+usr/share/nagiosql/config/locale/it_IT/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/it_IT/LC_MESSAGES/it_IT.mo
+usr/share/nagiosql/config/locale/it_IT/index.html
+usr/share/nagiosql/config/locale/pl_PL
+usr/share/nagiosql/config/locale/pl_PL/LC_MESSAGES
+usr/share/nagiosql/config/locale/pl_PL/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/pl_PL/LC_MESSAGES/pl_PL.mo
+usr/share/nagiosql/config/locale/pl_PL/index.html
+usr/share/nagiosql/config/locale/ru_RU
+usr/share/nagiosql/config/locale/ru_RU/LC_MESSAGES
+usr/share/nagiosql/config/locale/ru_RU/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/ru_RU/LC_MESSAGES/ru_RU.mo
+usr/share/nagiosql/config/locale/ru_RU/index.html
+usr/share/nagiosql/config/locale/zh_CN
+usr/share/nagiosql/config/locale/zh_CN/LC_MESSAGES
+usr/share/nagiosql/config/locale/zh_CN/LC_MESSAGES/index.html
+usr/share/nagiosql/config/locale/zh_CN/LC_MESSAGES/zh_CN.mo
+usr/share/nagiosql/config/locale/zh_CN/index.html
+usr/share/nagiosql/config/main.css
+usr/share/nagiosql/favicon.ico
+usr/share/nagiosql/functions
+usr/share/nagiosql/functions/common.js
+usr/share/nagiosql/functions/config_class.php
+usr/share/nagiosql/functions/data_class.php
+usr/share/nagiosql/functions/import_class.php
+usr/share/nagiosql/functions/mysql_class.php
+usr/share/nagiosql/functions/nag_class.php
+usr/share/nagiosql/functions/prepend_adm.php
+usr/share/nagiosql/functions/supportive.php
+usr/share/nagiosql/functions/tinyMCE
+usr/share/nagiosql/functions/tinyMCE/jscripts
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/langs
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/langs/en.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/license.txt
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/contextmenu
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/safari
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/safari/blank.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/safari/editor_plugin.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/css/searchreplace.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/js/searchreplace.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/langs
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/searchreplace/searchreplace.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/cell.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/css/cell.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/css/row.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/css/table.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/editor_plugin.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/js/cell.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/js/merge_cells.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/js/row.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/js/table.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/langs
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/langs/en_dlg.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/merge_cells.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/row.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/plugins/table/table.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/about.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/anchor.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/charmap.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/color_picker.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/editor_template.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/image.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/img
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/img/colorpicker.jpg
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/img/icons.gif
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/about.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/anchor.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/charmap.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/color_picker.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/image.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/link.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/js/source_editor.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/langs
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/langs/en.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/link.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/content.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img/buttons.png
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img/items.gif
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img/progress.gif
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/default/ui.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/img
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/themes/advanced/source_editor.htm
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/tiny_mce.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/tiny_mce_popup.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/utils
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/utils/editable_selects.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/utils/form_utils.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/utils/mctabs.js
+usr/share/nagiosql/functions/tinyMCE/jscripts/tiny_mce/utils/validate.js
+usr/share/nagiosql/functions/translator.php
+usr/share/nagiosql/functions/yui
+usr/share/nagiosql/functions/yui/build
+usr/share/nagiosql/functions/yui/build/assets
+usr/share/nagiosql/functions/yui/build/assets/skins
+usr/share/nagiosql/functions/yui/build/assets/skins/sam
+usr/share/nagiosql/functions/yui/build/assets/skins/sam/sprite.png
+usr/share/nagiosql/functions/yui/build/button
+usr/share/nagiosql/functions/yui/build/button/assets
+usr/share/nagiosql/functions/yui/build/button/assets/skins
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/button.css
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/menu-button-arrow-disabled.png
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/menu-button-arrow.png
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/split-button-arrow-active.png
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/split-button-arrow-disabled.png
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/split-button-arrow-focus.png
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/split-button-arrow-hover.png
+usr/share/nagiosql/functions/yui/build/button/assets/skins/sam/split-button-arrow.png
+usr/share/nagiosql/functions/yui/build/button/button-min.js
+usr/share/nagiosql/functions/yui/build/calendar
+usr/share/nagiosql/functions/yui/build/calendar/assets
+usr/share/nagiosql/functions/yui/build/calendar/assets/skins
+usr/share/nagiosql/functions/yui/build/calendar/assets/skins/sam
+usr/share/nagiosql/functions/yui/build/calendar/assets/skins/sam/calendar.css
+usr/share/nagiosql/functions/yui/build/calendar/calendar-min.js
+usr/share/nagiosql/functions/yui/build/connection
+usr/share/nagiosql/functions/yui/build/connection/connection-min.js
+usr/share/nagiosql/functions/yui/build/container
+usr/share/nagiosql/functions/yui/build/container/assets
+usr/share/nagiosql/functions/yui/build/container/assets/skins
+usr/share/nagiosql/functions/yui/build/container/assets/skins/sam
+usr/share/nagiosql/functions/yui/build/container/assets/skins/sam/container.css
+usr/share/nagiosql/functions/yui/build/container/container-min.js
+usr/share/nagiosql/functions/yui/build/element
+usr/share/nagiosql/functions/yui/build/element/element-beta-min.js
+usr/share/nagiosql/functions/yui/build/fonts
+usr/share/nagiosql/functions/yui/build/fonts/fonts-min.css
+usr/share/nagiosql/functions/yui/build/tabview
+usr/share/nagiosql/functions/yui/build/tabview/assets
+usr/share/nagiosql/functions/yui/build/tabview/assets/skins
+usr/share/nagiosql/functions/yui/build/tabview/assets/skins/sam
+usr/share/nagiosql/functions/yui/build/tabview/assets/skins/sam/tabview.css
+usr/share/nagiosql/functions/yui/build/tabview/tabview-min.js
+usr/share/nagiosql/functions/yui/build/utilities
+usr/share/nagiosql/functions/yui/build/utilities/utilities.js
+usr/share/nagiosql/functions/yui/build/yahoo-dom-event
+usr/share/nagiosql/functions/yui/build/yahoo-dom-event/yahoo-dom-event.js
+usr/share/nagiosql/images
+usr/share/nagiosql/images/admin.png
+usr/share/nagiosql/images/bg_menu_aktiv.png
+usr/share/nagiosql/images/bg_menu_inaktiv.png
+usr/share/nagiosql/images/bg_submenu.png
+usr/share/nagiosql/images/bg_top.png
+usr/share/nagiosql/images/calbtn.gif
+usr/share/nagiosql/images/copy.gif
+usr/share/nagiosql/images/del.png
+usr/share/nagiosql/images/delete.gif
+usr/share/nagiosql/images/down.gif
+usr/share/nagiosql/images/download.gif
+usr/share/nagiosql/images/edit.gif
+usr/share/nagiosql/images/info.gif
+usr/share/nagiosql/images/input.png
+usr/share/nagiosql/images/inputlock.png
+usr/share/nagiosql/images/inputmust.png
+usr/share/nagiosql/images/left.gif
+usr/share/nagiosql/images/login-form.png
+usr/share/nagiosql/images/logo_top.png
+usr/share/nagiosql/images/lupe.gif
+usr/share/nagiosql/images/menu.gif
+usr/share/nagiosql/images/menu_bg.png
+usr/share/nagiosql/images/menu_bg2.png
+usr/share/nagiosql/images/menusub_bg.png
+usr/share/nagiosql/images/mut.gif
+usr/share/nagiosql/images/nagiosql_logo.png
+usr/share/nagiosql/images/pfeil_l.gif
+usr/share/nagiosql/images/pfeil_r.gif
+usr/share/nagiosql/images/pixel.gif
+usr/share/nagiosql/images/right.gif
+usr/share/nagiosql/images/tip.gif
+usr/share/nagiosql/images/tip.png
+usr/share/nagiosql/images/titel_v2.png
+usr/share/nagiosql/images/up.gif
+usr/share/nagiosql/images/upArrow.png
+usr/share/nagiosql/images/write.gif
+usr/share/nagiosql/index.php
+usr/share/nagiosql/install
+usr/share/nagiosql/install/css
+usr/share/nagiosql/install/css/index.html
+usr/share/nagiosql/install/css/install.css
+usr/share/nagiosql/install/doc
+usr/share/nagiosql/install/doc/INSTALLATION_deDE.txt
+usr/share/nagiosql/install/doc/INSTALLATION_enGB.txt
+usr/share/nagiosql/install/functions
+usr/share/nagiosql/install/functions/func_installer.php
+usr/share/nagiosql/install/images
+usr/share/nagiosql/install/images/background.png
+usr/share/nagiosql/install/images/body_background.png
+usr/share/nagiosql/install/images/favicon.ico
+usr/share/nagiosql/install/images/index-install.png
+usr/share/nagiosql/install/images/index-update.png
+usr/share/nagiosql/install/images/index.html
+usr/share/nagiosql/install/images/install.png
+usr/share/nagiosql/install/images/invalid.png
+usr/share/nagiosql/install/images/minus.png
+usr/share/nagiosql/install/images/nagiosql.png
+usr/share/nagiosql/install/images/next.png
+usr/share/nagiosql/install/images/pixel.gif
+usr/share/nagiosql/install/images/plus.png
+usr/share/nagiosql/install/images/previous.png
+usr/share/nagiosql/install/images/reload.png
+usr/share/nagiosql/install/images/skip.png
+usr/share/nagiosql/install/images/step1_active.png
+usr/share/nagiosql/install/images/step1_deactive.png
+usr/share/nagiosql/install/images/step2_active.png
+usr/share/nagiosql/install/images/step2_deactive.png
+usr/share/nagiosql/install/images/step3_active.png
+usr/share/nagiosql/install/images/step3_deactive.png
+usr/share/nagiosql/install/images/update.png
+usr/share/nagiosql/install/images/valid.png
+usr/share/nagiosql/install/images/warning.png
+usr/share/nagiosql/install/index.php
+usr/share/nagiosql/install/install.php
+usr/share/nagiosql/install/js
+usr/share/nagiosql/install/js/functions.js
+usr/share/nagiosql/install/js/index.html
+usr/share/nagiosql/install/js/prototype.js
+usr/share/nagiosql/install/js/validation.js
+usr/share/nagiosql/install/sql
+usr/share/nagiosql/install/sql/import_nagios_sample.sql
+usr/share/nagiosql/install/sql/index.html
+usr/share/nagiosql/install/sql/nagiosQL_v3_db_mysql.sql
+usr/share/nagiosql/install/sql/update_200_202.sql
+usr/share/nagiosql/install/sql/update_202_303.sql
+usr/share/nagiosql/install/sql/update_300_301.sql
+usr/share/nagiosql/install/sql/update_300b1_300b2.sql
+usr/share/nagiosql/install/sql/update_300b2_300rc1.sql
+usr/share/nagiosql/install/sql/update_300rc1_300.sql
+usr/share/nagiosql/install/sql/update_301_302.sql
+usr/share/nagiosql/install/sql/update_302_303.sql
+usr/share/nagiosql/install/status.php
+usr/share/nagiosql/install/step1.php
+usr/share/nagiosql/install/step2.php
+usr/share/nagiosql/install/step3.php
+usr/share/nagiosql/templates
+usr/share/nagiosql/templates/admin
+usr/share/nagiosql/templates/admin/admin_master.tpl.htm
+usr/share/nagiosql/templates/admin/checkcommands.tpl.htm
+usr/share/nagiosql/templates/admin/contactgroups.tpl.htm
+usr/share/nagiosql/templates/admin/contacts.tpl.htm
+usr/share/nagiosql/templates/admin/contacttemplates.tpl.htm
+usr/share/nagiosql/templates/admin/delbackup.tpl.htm
+usr/share/nagiosql/templates/admin/domain.tpl.htm
+usr/share/nagiosql/templates/admin/helpedit.tpl.htm
+usr/share/nagiosql/templates/admin/hostdependencies.tpl.htm
+usr/share/nagiosql/templates/admin/hostescalations.tpl.htm
+usr/share/nagiosql/templates/admin/hostextinfo.tpl.htm
+usr/share/nagiosql/templates/admin/hostgroups.tpl.htm
+usr/share/nagiosql/templates/admin/hosts.tpl.htm
+usr/share/nagiosql/templates/admin/hosttemplates.tpl.htm
+usr/share/nagiosql/templates/admin/import.tpl.htm
+usr/share/nagiosql/templates/admin/mainpages.tpl.htm
+usr/share/nagiosql/templates/admin/mutdialog.tpl.htm
+usr/share/nagiosql/templates/admin/nagioscfg.tpl.htm
+usr/share/nagiosql/templates/admin/servicedependencies.tpl.htm
+usr/share/nagiosql/templates/admin/serviceescalations.tpl.htm
+usr/share/nagiosql/templates/admin/serviceextinfo.tpl.htm
+usr/share/nagiosql/templates/admin/servicegroups.tpl.htm
+usr/share/nagiosql/templates/admin/services.tpl.htm
+usr/share/nagiosql/templates/admin/servicetemplates.tpl.htm
+usr/share/nagiosql/templates/admin/settings.tpl.htm
+usr/share/nagiosql/templates/admin/timeperiods.tpl.htm
+usr/share/nagiosql/templates/admin/user.tpl.htm
+usr/share/nagiosql/templates/admin/verify.tpl.htm
+usr/share/nagiosql/templates/files
+usr/share/nagiosql/templates/files/commands.tpl.dat
+usr/share/nagiosql/templates/files/contactgroups.tpl.dat
+usr/share/nagiosql/templates/files/contacts.tpl.dat
+usr/share/nagiosql/templates/files/contacttemplates.tpl.dat
+usr/share/nagiosql/templates/files/hostdependencies.tpl.dat
+usr/share/nagiosql/templates/files/hostescalations.tpl.dat
+usr/share/nagiosql/templates/files/hostextinfo.tpl.dat
+usr/share/nagiosql/templates/files/hostgroups.tpl.dat
+usr/share/nagiosql/templates/files/hosts.tpl.dat
+usr/share/nagiosql/templates/files/hosttemplates.tpl.dat
+usr/share/nagiosql/templates/files/servicedependencies.tpl.dat
+usr/share/nagiosql/templates/files/serviceescalations.tpl.dat
+usr/share/nagiosql/templates/files/serviceextinfo.tpl.dat
+usr/share/nagiosql/templates/files/servicegroups.tpl.dat
+usr/share/nagiosql/templates/files/services.tpl.dat
+usr/share/nagiosql/templates/files/servicetemplates.tpl.dat
+usr/share/nagiosql/templates/files/timeperiods.tpl.dat
+usr/share/nagiosql/templates/index.tpl.htm
+usr/share/nagiosql/templates/main.tpl.htm
+usr/lib/php/HTML/Template/IT.php
+usr/lib/php/HTML/Template/ITX.php
+usr/lib/php/HTML/Template/IT_Error.php
--- /dev/null
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2009 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# 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, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER = 303
+
+THISAPP = nagiosql$(VER)
+DL_FILE = $(THISAPP).tar.gz
+DL_FROM = $(URL_IPFIRE)
+DIR_APP = $(DIR_SRC)/nagiosql3
+TARGET = $(DIR_INFO)/$(THISAPP)
+PROG = nagiosql
+PAK_VER = 1
+
+DEPS = "nagios"
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 3b15650942cf0fea3b6bbec1700ace38
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+
+dist:
+ @$(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+ @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+ @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+ @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+ @$(PREBUILD)
+ @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+ @rm -rf /usr/share/nagiosql
+ mkdir /usr/share/nagiosql
+ cd $(DIR_APP) && mv -vf * /usr/share/nagiosql
+ cp -vf $(DIR_SRC)/config/nagiosql/nagios.conf /etc/httpd/conf/vhosts.d/
+ cp -vrf $(DIR_SRC)/config/nagiosql/pear/HTML /usr/lib/php
+ cp -vrf $(DIR_SRC)/config/nagiosql/etc /
+ chown -R nobody /etc/nagiosql
+ chown nobody /usr/share/nagiosql/config
+ @rm -rf $(DIR_APP)
+ @$(POSTBUILD)
--- /dev/null
+#!/bin/bash
+############################################################################
+# #
+# This file is part of the IPFire Firewall. #
+# #
+# IPFire is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation; either version 2 of the License, or #
+# (at your option) any later version. #
+# #
+# IPFire is distributed in the hope that it will be useful, #
+# 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 IPFire; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+# #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
+# #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+extract_files
+restore_backup ${NAME}
+touch /usr/share/nagiosql/install/ENABLE_INSTALLER
+/etc/init.d/apache restart
+
--- /dev/null
+#!/bin/bash
+############################################################################
+# #
+# This file is part of the IPFire Firewall. #
+# #
+# IPFire is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation; either version 2 of the License, or #
+# (at your option) any later version. #
+# #
+# IPFire is distributed in the hope that it will be useful, #
+# 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 IPFire; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+# #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
+# #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+stop_service ${NAME}
+make_backup ${NAME}
+remove_files
--- /dev/null
+#!/bin/bash
+############################################################################
+# #
+# This file is part of the IPFire Firewall. #
+# #
+# IPFire is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation; either version 2 of the License, or #
+# (at your option) any later version. #
+# #
+# IPFire is distributed in the hope that it will be useful, #
+# 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 IPFire; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+# #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
+# #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+./uninstall.sh
+./install.sh