From 4611520c7fbb9269c6232e7f4047bb5f5dd1610c Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 15 Oct 2014 17:15:45 +0200 Subject: [PATCH 1/3] first steps of sidebar for personal and admin settings --- settings/templates/personal.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 871a0ec9e3..86f2c28319 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -7,6 +7,15 @@ /** @var $_ array */ ?> +
+ +
+ +
+ From 04323fbc19524926973550cc2aa0ab0331a4ca0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 16 Oct 2014 18:01:48 +0200 Subject: [PATCH 2/3] implement sidebar fro personal settings - bad kung-fu --- core/css/apps.css | 2 +- settings/personal.php | 35 ++++++++++++++++++++++++++++++--- settings/templates/personal.php | 21 +++++++++++++------- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/core/css/apps.css b/core/css/apps.css index 35487bee59..898259ed9d 100644 --- a/core/css/apps.css +++ b/core/css/apps.css @@ -479,7 +479,7 @@ button.loading { border-top: 1px solid #ddd; } /* no top border for first settings item */ -.section:first-child { +#app-content > .section:first-child { border-top: none; } .section h2 { diff --git a/settings/personal.php b/settings/personal.php index e6f53d6270..ecbec887da 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -101,9 +101,38 @@ $tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true)); $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser())); $tmpl->assign('certs', $certificateManager->listCertificates()); +// add hardcoded forms from the template +$l = OC_L10N::get('settings'); +$formsAndMore = array(); +$formsAndMore[]= array( 'anchor' => 'passwordform', 'section-name' => $l->t('Personal Info') ); + $forms=OC_App::getForms('personal'); -$tmpl->assign('forms', array()); -foreach($forms as $form) { - $tmpl->append('forms', $form); + +$formsMap = array_map(function($form){ + if (preg_match('%(]*>.*?)%i', $form, $regs)) { + $sectionName = str_replace('

', '', $regs[0]); + $sectionName = str_replace('

', '', $sectionName); + $anchor = strtolower($sectionName); + $anchor = str_replace(' ', '-', $anchor); + + return array( + 'anchor' => $anchor, + 'section-name' => $sectionName, + 'form' => $form + ); + } + return array( + 'form' => $form + ); +}, $forms); + +$formsAndMore = array_merge($formsAndMore, $formsMap); + +// add bottom hardcoded forms from the template +$formsAndMore[]= array( 'anchor' => 'ssl-root-certificates', 'section-name' => $l->t('SSL root certificates') ); +if($enableDecryptAll) { + $formsAndMore[]= array( 'anchor' => 'encryption', 'section-name' => $l->t('Encryption') ); } + +$tmpl->assign('forms', $formsAndMore); $tmpl->printPage(); diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 86f2c28319..b3a26acdb6 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -8,10 +8,15 @@ ?>
- +
@@ -159,10 +164,12 @@ if($_['passwordChangeSupported']) { + + -
+

t('SSL root certificates')); ?>

@@ -201,7 +208,7 @@ if($_['passwordChangeSupported']) { -
+

t( 'Encryption' ) ); ?> From 479424a4590ce99235fe5741828f90926bda4487 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 17 Oct 2014 10:35:24 +0200 Subject: [PATCH 3/3] Add some basic sanitization Better to be safe than sorry ;) --- settings/templates/personal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings/templates/personal.php b/settings/templates/personal.php index b3a26acdb6..cc04de5ec3 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -13,7 +13,7 @@ if (isset($form['anchor'])) { $anchor = '#' . $form['anchor']; $sectionName = $form['section-name']; - print_unescaped("
  • $sectionName
  • "); + print_unescaped(sprintf("
  • %s
  • ", OC_Util::sanitizeHTML($anchor), OC_Util::sanitizeHTML($sectionName))); } }?> @@ -165,7 +165,7 @@ if($_['passwordChangeSupported']) { - +