diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-08-09 23:30:07 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-08-09 23:30:07 +0200 |
commit | 518545fc2fc93f31d1885f143a0386c5449679f4 (patch) | |
tree | 0a4664dd771ef4a2e9a62c656440124a34c09eca /settings/Controller/AdminSettingsController.php | |
parent | 97df444d92fff2756572bf1901cd2ca112ea571e (diff) | |
download | nextcloud-server-518545fc2fc93f31d1885f143a0386c5449679f4.tar.gz nextcloud-server-518545fc2fc93f31d1885f143a0386c5449679f4.zip |
Fallback for legacy settings. They are placed into Additional Settings
Diffstat (limited to 'settings/Controller/AdminSettingsController.php')
-rw-r--r-- | settings/Controller/AdminSettingsController.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/settings/Controller/AdminSettingsController.php b/settings/Controller/AdminSettingsController.php index 68707addfe4..b6a6e74705f 100644 --- a/settings/Controller/AdminSettingsController.php +++ b/settings/Controller/AdminSettingsController.php @@ -83,6 +83,10 @@ class AdminSettingsController extends Controller { } private function getSettings($section) { + if($section === 'additional') { + return $this->getLegacyForms(); + } + $settings = $this->settingsManager->getAdminSettings($section); $html = ''; foreach ($settings as $prioritizedSettings) { @@ -95,6 +99,33 @@ class AdminSettingsController extends Controller { return ['content' => $html]; } + private function getLegacyForms() { + $forms = \OC_App::getForms('admin'); + + $forms = array_map(function ($form) { + if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { + $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); + $sectionName = str_replace('</h2>', '', $sectionName); + $anchor = strtolower($sectionName); + $anchor = str_replace(' ', '-', $anchor); + + return array( + 'anchor' => $anchor, + 'section-name' => $sectionName, + 'form' => $form + ); + } + return array( + 'form' => $form + ); + }, $forms); + + $out = new \OCP\Template('settings', 'admin/additional'); + $out->assign('forms', $forms); + + return ['content' => $out->fetchPage()]; + } + private function getNavigationParameters() { $a = 'anchor'; $name = 'section-name'; |