Skip to content

Commit

Permalink
Robustness: safer RainTPL directory handling
Browse files Browse the repository at this point in the history
Relates to shaarli#845
Relates to shaarli#846
Relates to shaarli#909

Signed-off-by: VirtualTam <[email protected]>
  • Loading branch information
virtualtam committed Sep 28, 2017
1 parent 0cba184 commit e4325b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/ApplicationUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,15 @@ public static function checkPHPVersion($minVersion, $curVersion)
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';
Expand Down
1 change: 1 addition & 0 deletions application/ThemeUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ThemeUtils
*/
public static function getThemes($tplDir)
{
$tplDir = rtrim($tplDir, '/');
$allTheme = glob($tplDir.'/*', GLOB_ONLYDIR);
$themes = [];
foreach ($allTheme as $value) {
Expand Down

0 comments on commit e4325b1

Please sign in to comment.