Ejemplo n.º 1
0
 public function execute()
 {
     global $gvEditableConfs, $gvDirectory;
     $modifiedConfs = array();
     foreach ($gvEditableConfs as $conf) {
         if (!isset($_POST[$conf->getName()])) {
             // Checkboxes not checked are not sent via Post
             if ($conf->getType() == 'boolean') {
                 $_POST[$conf->getName()] = 0;
             } else {
                 // Something went wrong, abort execution
                 $this->message = "Errore nel processare la richiesta. Riprovare in seguito.";
                 return true;
             }
         }
         $newValue = $_POST[$conf->getName()];
         // Empty value means default
         if ($newValue === '') {
             $newValue = $conf->getDefault();
         }
         $conf->setNewValue($newValue);
         $modifiedConfs[] = $conf;
     }
     $generator = new LocalSettingsGenerator($modifiedConfs);
     if ($generator->writeFile("{$gvDirectory}/LocalSettings.php")) {
         global $gvPath;
         // Use new settings asap
         foreach ($modifiedConfs as $conf) {
             $conf->exportNewValue();
         }
         $this->message = "Configurazione salvata correttamente.<br />\n";
         $this->message .= "È possibile tornare al <a href=\"{$gvPath}/application/adminPage\">menù principale</a>.";
         return true;
     } else {
         $this->message = "Errore nel salvataggio del file. Controllare i permessi di scrittura.";
         return true;
     }
 }
Ejemplo n.º 2
0
 /**
  * Write LocalSettings.php to a given path
  *
  * @param $path String Full path to write LocalSettings.php to
  */
 public function writeConfigurationFile($path)
 {
     $ls = new LocalSettingsGenerator($this);
     $ls->writeFile("{$path}/LocalSettings.php");
 }