Ejemplo n.º 1
0
 /**
  * function crea_inc (string $cal, string $tipo)
  * $cal: fichero original (no de datos adicionales)
  * $tipo: formato de datos ('dir','inc')
  *
  * crea o modifica un fichero de información adicional pero manteniendo
  * los valores de otros campos ya existentes en caso de existir
  * solo modificará los valores definidos por $this->conf->g('inc','comun')
  * y $this->conf->g('inc',$tipo)
  * los valores necesarios del formulario los obtiene por POST
  *
  * return string
  */
 function crea_inc($cal, $tipo)
 {
     $campos = array();
     $this->carga_datos($cal);
     foreach ((array) $this->datos as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $k2 => $v2) {
                 $campos[$k][$k2] = PFN_textoForm2interno($v2);
             }
         } else {
             $campos[$k] = PFN_textoForm2interno($v);
         }
     }
     if ($this->vars->post('')) {
         foreach (array('comun', $tipo) as $lista) {
             foreach ($this->conf->g('inc', $lista) as $v) {
                 if (is_callable(array($this, $v['tipo']))) {
                     if (strlen($this->multiple)) {
                         $este = $this->vars->post($v['nome']);
                         $campos[$v['nome']] = PFN_textoForm2interno($este[$this->multiple]);
                     } else {
                         $campos[$v['nome']] = PFN_textoForm2interno($this->vars->post($v['nome'] . $this->multiple));
                     }
                 }
             }
         }
     }
     foreach ((array) $this->mais_datos as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $k2 => $v2) {
                 $campos[$k][$k2] = PFN_textoForm2interno($v2);
             }
         } else {
             $campos[$k] = PFN_textoForm2interno($v);
         }
     }
     return $this->escribe_inc($cal, $campos);
 }
Ejemplo n.º 2
0
 $txt = '';
 $cambia['mal'] = array('<', '>', '"');
 $cambia['ben'] = array('<', '>', '"');
 foreach ($datos_orixe as $k => $v) {
     if (is_array($v)) {
         $txt .= "\n\t" . '\'' . $k . '\' => array(';
         foreach ($v as $k2 => $v2) {
             unset($v2);
             $cad = PFN_textoForm2interno($datos_destino[$k][$k2]);
             $cad = htmlentities($cad, ENT_NOQUOTES, $PFN_conf->g('charset'));
             $cad = str_replace($cambia['mal'], $cambia['ben'], $cad);
             $txt .= "\n\t\t" . '\'' . $k2 . '\' => \'' . $cad . '\',';
         }
         $txt .= "\n\t" . '),';
     } else {
         $cad = PFN_textoForm2interno($datos_destino[$k]);
         $cad = htmlentities($cad, ENT_NOQUOTES, $PFN_conf->g('charset'));
         $cad = str_replace($cambia['mal'], $cambia['ben'], $cad);
         $txt .= "\n\t" . '\'' . $k . '\' => \'' . $cad . '\',';
     }
 }
 $licencia['script'] = 'data/idiomas/' . $tr_destino . '/' . $tr_arquivo . '.inc.php';
 $licencia['descricion'] = 'Textos para el idioma ' . $PFN_conf->t('lista_idiomas', $tr_destino);
 $txt_licencia = (include $PFN_paths['include'] . 'licencia.php');
 $txt = '<?php' . "\n" . $txt_licencia . "\n\n" . 'defined(\'OK\') or die();' . "\n\n" . 'return array(' . $txt . "\n" . ');' . "\n" . '?>';
 $ok = $PFN_arquivos->abre_escribe($idioma_destino, $txt);
 if ($ok) {
     $datos_destino = (include $idioma_destino);
     foreach ($datos_orixe as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $k2 => $v2) {