Exemple #1
0
 public function import()
 {
     $engine = $this->getEngine();
     $job = $engine->getJob();
     $job->addNotice("FruityCgiImporter beginning to import CGI Configuration.");
     // Cgi configuration
     $res = $this->dbConn->query("SELECT * FROM nagios_cgi");
     // Fruity has just one record in the resources, if we get it, import
     // it.
     $row = $res->fetch(PDO::FETCH_ASSOC);
     // Get our resources obj.
     $cgiConfig = NagiosCgiConfigurationPeer::doSelectOne(new Criteria());
     if (!$cgiConfig) {
         $cgiConfig = new NagiosCgiConfiguration();
         $cgiConfig->save();
     }
     foreach ($row as $key => $val) {
         unset($name);
         if ($key == "id" || $key == "show_context_help" || $key == "nagios_check_command") {
             continue;
         }
         // Iterate through and, if we have a valid key, we set it to
         // the NagiosResource obj.
         try {
             $name = NagiosCgiConfigurationPeer::translateFieldName($key, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME);
         } catch (Exception $e) {
             $job->addNotice("CGI Configuration Importer: Was unable to store unsupported value: " . $key);
         }
         if (!empty($name)) {
             $method = "set" . $name;
             $cgiConfig->{$method}($val);
         }
     }
     $cgiConfig->save();
     // Save resources configuration
     $job->addNotice("FruityCgiImporter finished importing CGI Configuration.");
 }
Exemple #2
0
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
/*
Lilac Index Page, Displays Menu, and Statistics
*/
include_once 'includes/config.inc';
$cgiConfig = NagiosCgiConfigurationPeer::doSelectOne(new Criteria());
if (!$cgiConfig) {
    $cgiConfig = new NagiosCgiConfiguration();
    $cgiConfig->save();
}
if (isset($_POST['request'])) {
    if ($_POST['request'] == 'update') {
        if (isset($_POST['cgi_config']['physical_html_path'])) {
            $cgiConfig->setPhysicalHtmlPath($_POST['cgi_config']['physical_html_path']);
        }
        if (isset($_POST['cgi_config']['url_html_path'])) {
            $cgiConfig->setUrlHtmlPath($_POST['cgi_config']['url_html_path']);
        }
        if (isset($_POST['cgi_config']['use_authentication'])) {
            $cgiConfig->setUseAuthentication($_POST['cgi_config']['use_authentication']);
        }
        if (isset($_POST['cgi_config']['default_user_name'])) {
            $cgiConfig->setDefaultUserName($_POST['cgi_config']['default_user_name']);
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      NagiosCgiConfiguration $value A NagiosCgiConfiguration object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(NagiosCgiConfiguration $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }