0)) { $this->Id = intval($v); } } function Init() { global $DEBUG; $this->IsInit = true; if ($this->Id == 0) return false; $this->ChangeDB(); $Nfo = $this->LoadInTbl(); $this->RestoreDB(); if (!$Nfo) { $DEBUG[] = 'Appel Init de '.get_class($this).' Erreur: Pas d\'objet pour l\'identifiant '.$this->Id.'
'; $this->Id = 0; return false; } $this->SetNom($Nfo['nom_script']); $this->SetUrl($Nfo['url_script']); $this->SetFrequence($Nfo['frequence_script']); $this->SetLast_Time($Nfo['last_time_script']); $this->SetNext_Time($Nfo['next_time_script']); $this->SetExecution($Nfo['execution_script'] == 'true'); } function Parse($Encoding = 'HTML', $Ext = '') { $a = array( 'ID_SCRIPT'.$Ext => Encode($this->GetId(), $Encoding), 'NOM_SCRIPT'.$Ext => Encode($this->GetNom(), $Encoding), 'URL_SCRIPT'.$Ext => Encode($this->GetUrl(), $Encoding), 'FREQUENCE_SCRIPT'.$Ext => Encode($this->GetFrequence(), $Encoding), 'LAST_TIME_SCRIPT'.$Ext => Encode($this->GetLast_Time(), $Encoding), 'NEXT_TIME_SCRIPT'.$Ext => Encode($this->GetNext_Time(), $Encoding), 'EXECUTION_SCRIPT'.$Ext => Encode($this->GetExecution(), $Encoding), ); return $a; } function SetId($v) { $this->Id = intval($v); } function GetId() { return $this->Id; } function SetNom($v) { $this->Nom = strval($v); } function GetNom() { if (!$this->IsInit) $this->Init(); return $this->Nom; } function SetUrl($v) { $this->Url = strval($v); } function GetUrl() { if (!$this->IsInit) $this->Init(); return $this->Url; } function SetFrequence($v) { $this->Frequence = intval($v); } function GetFrequence() { if (!$this->IsInit) $this->Init(); return $this->Frequence; } function SetLast_Time($v) { $this->Last_Time = strval($v); } function GetLast_Time() { if (!$this->IsInit) $this->Init(); return $this->Last_Time; } function SetNext_Time($v) { $this->Next_Time = strval($v); } function GetNext_Time() { if (!$this->IsInit) $this->Init(); return $this->Next_Time; } function SetExecution($v) { $this->Execution = $v; } function GetExecution() { if (!$this->IsInit) $this->Init(); return $this->Execution; } function Update() { $P = @func_get_arg(0)?func_get_arg(0):$_POST; if ($this->Id > 0) $this->Init(); if (isset($P['nom_script'])) $this->SetNom($P['nom_script']); if (isset($P['url_script'])) $this->SetUrl($P['url_script']); if (isset($P['frequence_script'])) $this->SetFrequence($P['frequence_script']); if (isset($P['last_time_script'])) $this->SetLast_Time($P['last_time_script']); if (isset($P['next_time_script'])) $this->SetNext_Time($P['next_time_script']); if (isset($P['execution_script'])) $this->SetExecution($P['execution_script'] == 'true'); } function Save() { $A = array( 'nom_script' => addslashes($this->GetNom()), 'url_script' => addslashes($this->GetUrl()), 'frequence_script' => $this->GetFrequence(), 'last_time_script' => $this->GetLast_Time(), 'next_time_script' => $this->GetNext_Time(), 'execution_script' => $this->GetExecution()?'true':'false', ); $this->ChangeDB(); if ($this->Id > 0) $this->UpdateInTbl($A); else $this->Id = $this->InsertInTbl($A); $this->RestoreDB(); } function ChangeDB() { global $CFG; if (db_name() != $this->DBName) { if (in_array($_SERVER['SERVER_ADDR'], array('192.168.10.12', '213.41.32.243'))) { //db_connect($CFG['SQL_COLT_URI'], $CFG['DB_USER'], $CFG['DB_PASSWORD'], $this->DBName); ## CHANGED 2009 06 03 db_connect($CFG['DB_HOST'], $CFG['DB_USER'], $CFG['DB_PASSWORD'], $this->DBName); } else { db_select($this->DBName); } } } function RemoveFromTbl($Tbl, $AND = array()) { $this->ChangeDB(); parent::RemoveFromTbl($Tbl, $AND); $this->RestoreDB(); } function RemoveFromDB() { $this->ChangeDB(); parent::RemoveFromDB(); $this->RestoreDB(); } function RestoreDB() { global $CFG; if (!empty($CFG['DB_NAME']) && $CFG['DB_NAME'] != $this->DBName) { if (in_array($_SERVER['SERVER_ADDR'], array('192.168.10.12', '213.41.32.243'))) { db_connect($CFG['DB_HOST'], $CFG['DB_USER'], $CFG['DB_PASSWORD'], $CFG['DB_NAME']); } else { db_select($CFG['DB_NAME']); } } } } ?>