Config-Module added to frontend
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@36 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
cf5a6eed70
commit
019f35aa87
|
|
@ -1 +1,25 @@
|
|||
<?
|
||||
/* Datenbankverbindung */
|
||||
$pg_host = "141.30.228.39";
|
||||
$pg_database = "wetter";
|
||||
$pg_user = "losinshi";
|
||||
$pg_pass = "";
|
||||
|
||||
/* Default-Werte */
|
||||
$default_set = "test";
|
||||
|
||||
/* Config-Klasse, Bitte nicht ändern! */
|
||||
class Config{
|
||||
|
||||
function getPgConnString(){
|
||||
global $pg_host,$pg_database,$pg_user,$pg_pass;
|
||||
return "host=".$pg_host." dbname=".$pg_database." user=".$pg_user." password=".$pg_pass;
|
||||
}
|
||||
|
||||
function getDefaultSet(){
|
||||
global $default_set;
|
||||
return $default_set;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?
|
||||
include_once("php_inc/config.inc.php");
|
||||
|
||||
/* Connection-Klasse..ist für die Datenbankverbindung zuständig */
|
||||
class Connection{
|
||||
|
||||
|
|
@ -12,7 +14,7 @@ class Connection{
|
|||
/* Verbindung herstellen (wenn noch net besteht)*/
|
||||
function _createConn(){
|
||||
if($this->conn == NULL){
|
||||
$this->conn = pg_connect("host=141.30.228.39 dbname=wetter user=losinshi")
|
||||
$this->conn = pg_connect(Config::getPgConnString())
|
||||
or die('Verbindungsaufbau fehlgeschlagen: ' . pg_last_error());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
include_once("php_inc/module.inc.php");
|
||||
include_once("php_inc/parser.inc.php");
|
||||
include_once("php_inc/connection.inc.php");
|
||||
include_once("php_inc/config.inc.php");
|
||||
|
||||
|
||||
/* Klasse, die die ModuleSets Verwaltet */
|
||||
|
|
@ -23,6 +24,8 @@ class ModuleSet{
|
|||
|
||||
/* Dateinamen eines Setz aus dessen Namen zusammenbauen */
|
||||
function _getSetFilename($setName){
|
||||
if($setName == "")
|
||||
$setName = Config::getDefaultSet();
|
||||
return "content/module_sets/set_".$setName.".html";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue