Exemplo 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;
     }
 }
Exemplo 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");
 }
Exemplo n.º 3
0
 public function getLocalSettings()
 {
     $dbmysql5 = wfBoolToStr($this->getVar('wgDBmysql5', true));
     $prefix = LocalSettingsGenerator::escapePhpString($this->getVar('wgDBprefix'));
     $tblOpts = LocalSettingsGenerator::escapePhpString($this->getTableOptions());
     return "# MySQL specific settings\n\$wgDBprefix         = \"{$prefix}\";\n\n# MySQL table options to use during installation or update\n\$wgDBTableOptions   = \"{$tblOpts}\";\n\n# Experimental charset support for MySQL 5.0.\n\$wgDBmysql5 = {$dbmysql5};";
 }
Exemplo n.º 4
0
 public function getLocalSettings()
 {
     $schema = LocalSettingsGenerator::escapePhpString($this->getVar('wgDBmwschema'));
     $prefix = LocalSettingsGenerator::escapePhpString($this->getVar('wgDBprefix'));
     $windowsauth = $this->getVar('wgDBWindowsAuthentication') ? 'true' : 'false';
     return "# MSSQL specific settings\n\$wgDBWindowsAuthentication = {$windowsauth};\n\$wgDBmwschema = \"{$schema}\";\n\$wgDBprefix = \"{$prefix}\";";
 }
Exemplo n.º 5
0
 /**
  * @return string
  */
 public function getLocalSettings()
 {
     $dir = LocalSettingsGenerator::escapePhpString($this->getVar('wgSQLiteDataDir'));
     return "# SQLite-specific settings\n\$wgSQLiteDataDir = \"{$dir}\";";
 }
Exemplo n.º 6
0
 /**
  * @return string
  */
 public function getLocalSettings()
 {
     $dir = LocalSettingsGenerator::escapePhpString($this->getVar('wgSQLiteDataDir'));
     return "# SQLite-specific settings\n\$wgSQLiteDataDir = \"{$dir}\";\n\$wgObjectCaches[CACHE_DB] = array(\n\t'class' => 'SqlBagOStuff',\n\t'loggroup' => 'SQLBagOStuff',\n\t'server' => array(\n\t\t'type' => 'sqlite',\n\t\t'dbname' => 'wikicache',\n\t\t'tablePrefix' => '',\n\t\t'flags' => 0\n\t)\n);";
 }
Exemplo n.º 7
0
 /**
  * Main entry point.
  *
  * @param $session Array: initial session array
  *
  * @return Array: new session array
  */
 public function execute(array $session)
 {
     $this->session = $session;
     if (isset($session['settings'])) {
         $this->settings = $session['settings'] + $this->settings;
     }
     $this->exportVars();
     $this->setupLanguage();
     if (($this->getVar('_InstallDone') || $this->getVar('_UpgradeDone')) && $this->request->getVal('localsettings')) {
         $this->request->response()->header('Content-type: application/x-httpd-php');
         $this->request->response()->header('Content-Disposition: attachment; filename="LocalSettings.php"');
         $ls = new LocalSettingsGenerator($this);
         $rightsProfile = $this->rightsProfiles[$this->getVar('_RightsProfile')];
         foreach ($rightsProfile as $group => $rightsArr) {
             $ls->setGroupRights($group, $rightsArr);
         }
         echo $ls->getText();
         return $this->session;
     }
     $cssDir = $this->request->getVal('css');
     if ($cssDir) {
         $cssDir = $cssDir == 'rtl' ? 'rtl' : 'ltr';
         $this->request->response()->header('Content-type: text/css');
         echo $this->output->getCSS($cssDir);
         return $this->session;
     }
     if (isset($session['happyPages'])) {
         $this->happyPages = $session['happyPages'];
     } else {
         $this->happyPages = array();
     }
     if (isset($session['skippedPages'])) {
         $this->skippedPages = $session['skippedPages'];
     } else {
         $this->skippedPages = array();
     }
     $lowestUnhappy = $this->getLowestUnhappy();
     # Special case for Creative Commons partner chooser box.
     if ($this->request->getVal('SubmitCC')) {
         $page = $this->getPageByName('Options');
         $this->output->useShortHeader();
         $this->output->allowFrames();
         $page->submitCC();
         return $this->finish();
     }
     if ($this->request->getVal('ShowCC')) {
         $page = $this->getPageByName('Options');
         $this->output->useShortHeader();
         $this->output->allowFrames();
         $this->output->addHTML($page->getCCDoneBox());
         return $this->finish();
     }
     # Get the page name.
     $pageName = $this->request->getVal('page');
     if (in_array($pageName, $this->otherPages)) {
         # Out of sequence
         $pageId = false;
         $page = $this->getPageByName($pageName);
     } else {
         # Main sequence
         if (!$pageName || !in_array($pageName, $this->pageSequence)) {
             $pageId = $lowestUnhappy;
         } else {
             $pageId = array_search($pageName, $this->pageSequence);
         }
         # If necessary, move back to the lowest-numbered unhappy page
         if ($pageId > $lowestUnhappy) {
             $pageId = $lowestUnhappy;
             if ($lowestUnhappy == 0) {
                 # Knocked back to start, possible loss of session data.
                 $this->showSessionWarning = true;
             }
         }
         $pageName = $this->pageSequence[$pageId];
         $page = $this->getPageByName($pageName);
     }
     # If a back button was submitted, go back without submitting the form data.
     if ($this->request->wasPosted() && $this->request->getBool('submit-back')) {
         if ($this->request->getVal('lastPage')) {
             $nextPage = $this->request->getVal('lastPage');
         } elseif ($pageId !== false) {
             # Main sequence page
             # Skip the skipped pages
             $nextPageId = $pageId;
             do {
                 $nextPageId--;
                 $nextPage = $this->pageSequence[$nextPageId];
             } while (isset($this->skippedPages[$nextPage]));
         } else {
             $nextPage = $this->pageSequence[$lowestUnhappy];
         }
         $this->output->redirect($this->getUrl(array('page' => $nextPage)));
         return $this->finish();
     }
     # Execute the page.
     $this->currentPageName = $page->getName();
     $this->startPageWrapper($pageName);
     if ($page->isSlow()) {
         $this->disableTimeLimit();
     }
     $result = $page->execute();
     $this->endPageWrapper();
     if ($result == 'skip') {
         # Page skipped without explicit submission.
         # Skip it when we click "back" so that we don't just go forward again.
         $this->skippedPages[$pageName] = true;
         $result = 'continue';
     } else {
         unset($this->skippedPages[$pageName]);
     }
     # If it was posted, the page can request a continue to the next page.
     if ($result === 'continue' && !$this->output->headerDone()) {
         if ($pageId !== false) {
             $this->happyPages[$pageId] = true;
         }
         $lowestUnhappy = $this->getLowestUnhappy();
         if ($this->request->getVal('lastPage')) {
             $nextPage = $this->request->getVal('lastPage');
         } elseif ($pageId !== false) {
             $nextPage = $this->pageSequence[$pageId + 1];
         } else {
             $nextPage = $this->pageSequence[$lowestUnhappy];
         }
         if (array_search($nextPage, $this->pageSequence) > $lowestUnhappy) {
             $nextPage = $this->pageSequence[$lowestUnhappy];
         }
         $this->output->redirect($this->getUrl(array('page' => $nextPage)));
     }
     return $this->finish();
 }
Exemplo n.º 8
0
 /**
  * Generate the code to store the DB2-specific settings defined by the configuration form
  * @return string
  */
 public function getLocalSettings()
 {
     $schema = LocalSettingsGenerator::escapePhpString($this->getVar('wgDBmwschema'));
     $port = LocalSettingsGenerator::escapePhpString($this->getVar('wgDBport'));
     return "# IBM_DB2 specific settings\n\$wgDBmwschema         = \"{$schema}\";\n\$wgDBport             = \"{$port}\";";
 }