Initial Commit

This commit is contained in:
GiacomoHome
2021-09-17 12:41:45 +02:00
commit 9001e4656e
570 changed files with 31013 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
<?php
class App_Service_ConfigManager
{
protected $_config;
protected $_writer;
protected $_ipManager;
public function __construct()
{
$this->_config = Zend_Registry::get('config');
$this->_writer = new Zend_Config_Writer_Ini(array('config'=> $this->_config,'filename' => APPLICATION_PATH.'/configs/config.ini'));
$this->_ipManager = new App_Service_IpManager();
}
/**
* Aggiorna l'oggetto config ricaricando tutte le impostazioni memorizzate
* nel file config.ini
*/
public function update()
{
$this->_config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/config.ini', null, array('skipExtends'=> true,
'allowModifications' => true));
Zend_Registry::set('config',$this->_config);
}
/**
* Inserisci nel file di configurazione il parametro passato memorizzandolo
*
* @param string $param
* @param string $value
* @return void
*/
public function insert($param,$value)
{
if($param==null||$param==''){
return;
}
$this->_config->__set($param, $value);
$this->write();
}
public function set($key,$value){
$this->_config->__set($key, $value);
}
/**
* Restituisce il valore del parametro richiesto
*
* @param string $name
* @return string
*/
public function get($name){
return $this->_config->get($name);
}
/**
* Elimina il parametro richiesto se esistente
*
* @param string $param
* @return boolean
*/
public function delete($param){
if($this->_config->get($param)){
$this->_config->__unset($param);
$this->write();
return TRUE;
}else{
return FALSE;
}
}
public function write(){
$this->_writer->config=$this->_config;
$this->_writer->write();
$this->update();
}
public function getAllParam(){
$data=array();
foreach ($this->_config as $key => $value) {
$data[$key]=$value;
}
return $data;
}
}