Check to make sure that skin and css are valid.

This commit is contained in:
Isaac Connor 2015-02-19 14:17:33 -05:00
parent c3f96ad8ca
commit 8eb8cacd56
1 changed files with 13 additions and 1 deletions

View File

@ -68,15 +68,27 @@ elseif ( ZM_SKIN_DEFAULT )
else
$skin = "classic";
$skins = array_map( 'basename', glob('skins/*',GLOB_ONLYDIR) );
if ( ! in_array( $skin, $skins ) ) {
Fatal( "Invalid skin '$skin'" );
$skin = 'classic';
}
if ( isset($_GET['css']) )
$css = $_GET['css'];
elseif ( isset($_COOKIE['zmCSS']) )
$css = $_COOKIE['zmCSS'];
elseif (ZM_CSS_DEFAULT)
elseif (defined(ZM_CSS_DEFAULT))
$css = ZM_CSS_DEFAULT;
else
$css = "classic";
$css_skins = array_map( 'basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR) );
if ( ! in_array( $css, $css_skins ) ) {
Fatal( "Invalid skin css '$css'" );
$css = 'classic';
}
define( "ZM_BASE_PATH", dirname( $_SERVER['REQUEST_URI'] ) );
define( "ZM_SKIN_PATH", "skins/$skin" );