<?php
/*
 * @version $Id: HEADER 15930 2011-10-30 15:47:55Z tsmr $
 -------------------------------------------------------------------------
 Eventlog plugin for GLPI
 Copyright (C) 2003-2011 by the Eventlog Development Team.

 https://forge.indepnet.net/projects/eventlog
 -------------------------------------------------------------------------

 LICENSE
		
 This file is part of Eventlog.

 Eventlog 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.

 Eventlog 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 Eventlog. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 */

if (!defined('GLPI_ROOT')) {
	die("Sorry. You can't access directly to this file");
}

class DBeventLog extends DBmysql {

	///Store the id of the ocs server
	var $eventlogservers_id = -1;

	/**
	 * Constructor
	 * @param $ID ID of the ocs server ID
	**/
	function __construct($ID) {
		
		$this->eventlogservers_id = $ID;
		$server=new PluginEventlogEventlogServer();
		$data = $server->getEventlogConf($ID);
		$this->dbhost = $data["eventlog_db_host"];
		$this->dbuser = $data["eventlog_db_user"];
		$this->dbpassword = rawurldecode($data["eventlog_db_passwd"]);
		$this->dbdefault = $data["eventlog_db_name"];
		$this->dbenc="latin1";
		parent::__construct();
	}

	/**
	 * Get current ocs server ID
	 * @return ID of the ocs server ID
	**/
	function getServerID() {
		return $this->eventlogservers_id;
	}

}

?>