]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Robustness: safer RainTPL directory handling
authorVirtualTam <virtualtam@flibidi.net>
Tue, 19 Sep 2017 18:21:28 +0000 (20:21 +0200)
committerVirtualTam <virtualtam@flibidi.net>
Thu, 28 Sep 2017 19:57:20 +0000 (21:57 +0200)
Relates to https://github.com/shaarli/Shaarli/issues/845
Relates to https://github.com/shaarli/Shaarli/issues/846
Relates to https://github.com/shaarli/Shaarli/pull/909

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
application/ApplicationUtils.php
application/ThemeUtils.php

index 85dcbeebdb164858680ff68b9fbc1048340d05f1..123cc0b3e567ef531e4123dff6d31149d5f69ff5 100644 (file)
@@ -168,14 +168,15 @@ class ApplicationUtils
     public static function checkResourcePermissions($conf)
     {
         $errors = array();
+        $rainTplDir = rtrim($conf->get('resource.raintpl_tpl'), '/');
 
         // Check script and template directories are readable
         foreach (array(
             'application',
             'inc',
             'plugins',
-            $conf->get('resource.raintpl_tpl'),
-            $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme'),
+            $rainTplDir,
+            $rainTplDir.'/'.$conf->get('resource.theme'),
         ) as $path) {
             if (! is_readable(realpath($path))) {
                 $errors[] = '"'.$path.'" directory is not readable';
index 2718ed138cf7215609eb61d39351150fe84c8515..16f2f6a2742c701f79d671bcf4d89359584fc4d9 100644 (file)
@@ -22,6 +22,7 @@ class ThemeUtils
      */
     public static function getThemes($tplDir)
     {
+        $tplDir = rtrim($tplDir, '/');
         $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR);
         $themes = [];
         foreach ($allTheme as $value) {