Exemplo n.º 1
0
 public function onBootstrap(MvcEvent $e)
 {
     $app = $e->getParam("application");
     //Este fragmento de código se usa cuando hay instalador
     $reader = new Ini();
     $data = $reader->fromFile(__DIR__ . '/config/config.ini');
     $appInstalada = false;
     if ($data['production']['configuracion']['instalado'] == "0") {
         $app->getEventManager()->attach('dispatch', array($this, 'initInstalacion'), 20000);
         $config = new Config(array(), true);
         $config->production = array();
         $config->production->configuracion = array();
         $config->production->configuracion->instalado = "-1";
         $config->production->configuracion->confirmado = "0";
         $writer = new Ini2();
         $writer->toFile(__DIR__ . '/config/config.ini', $config);
     } elseif ($data['production']['configuracion']['instalado'] == "-1") {
         return;
     } else {
         $appInstalada = true;
     }
     if ($appInstalada) {
         $app->getEventManager()->attach('dispatch', array($this, 'initAuth'), 200);
     }
     $moduleRouteListener = new ModuleRouteListener();
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener->attach($eventManager);
 }
Exemplo n.º 2
0
 /**
  * Write data to label file
  *
  * @param    String        $network
  * @param    String        $locale
  * @param    Array[]        $data
  * @return    String        Path to file
  */
 public function write($network, $locale, array $data)
 {
     $data = $this->convertData($data);
     $config = new Config($data, false);
     $writer = new IniWriter();
     $pathFile = $this->buildPath($network, $locale);
     $writer->toFile($pathFile, $config);
     return $pathFile;
 }
Exemplo n.º 3
0
 /**
  * Save configuration file
  *
  * @param    Array    $data
  * @param    String    $filename
  * @return    String
  * @throws    \Exception
  */
 public function saveConfigFile(array $data, $filename)
 {
     $pathFile = $this->basePath . '/' . $filename . '.ini';
     $pathDir = dirname($pathFile);
     $dirStatus = is_dir($pathDir) || mkdir($pathDir, 0777, true);
     if (!$dirStatus) {
         throw new \Exception('Cannot create config folder ' . $filename);
     }
     $data = $this->cleanData($data);
     $config = new Config($data, false);
     $writer = new IniWriter();
     $writer->toFile($pathFile, $config);
     return $pathFile;
 }
Exemplo n.º 4
0
 /**
  * Save a setting into translation.ini
  * @param $section
  * @param $subsection
  * @param $value
  */
 public function setConfig($section, $subsection, $value)
 {
     $cfg = $this->getConfig();
     if (!isset($cfg->{$section})) {
         $cfg->{$section} = [];
     }
     if ($subsection) {
         $cfg->{$section}->{$subsection} = $value;
     } else {
         $cfg->{$section} = $value;
     }
     $config = $this->getServiceLocator()->get('config');
     $config = $config['circlical']['translation_editor'];
     $cache_dir = $config['cache_dir'];
     $translator_config = $cache_dir . '/translator.ini';
     if (!file_exists($translator_config)) {
         @mkdir(dirname($translator_config), 0755, true);
         @touch($translator_config);
     }
     $writer = new ConfigWriter();
     $writer->toFile($translator_config, $cfg, false);
 }
Exemplo n.º 5
0
 /**
  * Saves all target data
  * @param array $data associative array with all targets.
  *               - key - name of the the target
  *               - value - target properties
  *
  * @throws ConfigException
  */
 public function save(array $data)
 {
     $config = new ConfigWriter();
     return $config->toFile($this->configFile, $data);
 }
Exemplo n.º 6
0
 public function instalaAction()
 {
     // [TODO] probar este bloque if de redireccion
     if (!$this->request->isPost()) {
         return $this->redirect()->toRoute('login');
     }
     $form = new CreaEsquemaForm();
     $data = $this->request->getPost();
     $form->setData($data);
     if (!$form->isValid()) {
         echo 'fail';
         exit;
     }
     $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $instalacionBO = new InstalacionBO($adapter);
     $resultado = $instalacionBO->guardar($form->getData());
     // echo"<pre>";var_dump($resultado);exit();
     if ($resultado == 1) {
         $config = new Config(array(), true);
         $config->production = array();
         $config->production->configuracion = array();
         $config->production->configuracion->instalado = "1";
         $config->production->configuracion->confirmado = "1";
         $writer = new Ini2();
         $dir = str_replace("Instalacion\\src\\Instalacion\\Controller", "", __DIR__);
         $dir = str_replace("Instalacion/src/Instalacion/Controller", "", $dir);
         $writer->toFile($dir . 'Application/config/config.ini', $config);
         return $this->redirect()->toRoute('home');
     } else {
         echo 'laca';
         exit;
     }
 }