purify user-supplied filenames in some cases. Probably not needed but it's the right thing to do.
This commit is contained in:
parent
23812e5b48
commit
623dfa1384
@ -457,6 +457,9 @@ class Comanche {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! purify_filename($name))
|
||||||
|
return ''
|
||||||
|
|
||||||
$clsname = ucfirst($name);
|
$clsname = ucfirst($name);
|
||||||
$nsname = "\\Zotlabs\\Widget\\" . $clsname;
|
$nsname = "\\Zotlabs\\Widget\\" . $clsname;
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ EOT;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$c = theme_include('navbar_' . $template . '.css');
|
$c = theme_include('navbar_' . purify_filename($template) . '.css');
|
||||||
$tpl = get_markup_template('navbar_' . $template . '.tpl');
|
$tpl = get_markup_template('navbar_' . purify_filename($template) . '.tpl');
|
||||||
|
|
||||||
if($c && $tpl) {
|
if($c && $tpl) {
|
||||||
head_add_css('navbar_' . $template . '.css');
|
head_add_css('navbar_' . $template . '.css');
|
||||||
|
@ -3156,3 +3156,9 @@ function ellipsify($s,$maxlen) {
|
|||||||
|
|
||||||
return mb_substr($s,0,$maxlen / 2) . '...' . mb_substr($s,mb_strlen($s) - ($maxlen / 2));
|
return mb_substr($s,0,$maxlen / 2) . '...' . mb_substr($s,mb_strlen($s) - ($maxlen / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function purify_filename($s) {
|
||||||
|
if(($s[0] === '.') || strpos($s,'/') !== false)
|
||||||
|
return '';
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user