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."); }
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']); }