<?PHP
/*
* phpMyAuth
* Jason Gerfen [hide@address.com]
*
* class.skins.php - Class to help with resource permissions
*/
class PageSkinner
{
private $data;
private $skin_err;
function GenSkinMenu( $skin, $path )
{
global $handles;
if( empty( $id ) ) { $id = "default"; }
if( ( $handles['val']->ValidateString( $skin ) !== -1 ) || ( $handles['val']->ValidateString( $path ) !== -1 ) ) {
if( is_dir( $path ) ) {
if( $dh = opendir( $path ) ) {
$this->data = "<form method=\"get\" action=\"" . $_SERVER['PHP_SELF'] . "?skin=$skin\"><select name=\"skin\" onChange=\"jumpMenu('parent',this,0)\"><option value=\"NULL\">Pick your poison...</option>";
while( ( $file = readdir( $dh ) ) !== false ) {
if( ( $file !== "." ) && ( $file !== ".." ) && ( $file !== "index.html" ) && ( $file !== "images" ) && ( !eregi( ".tpl", $file ) ) ) {
$this->data .= "<OPTION NAME=\"skin\" VALUE=\"" . $_SERVER['PHP_SELF'] . "?skin=$file\">$file</OPTION>";
}
}
$this->data .= "</select></form>";
closedir( $dh );
}
}
}
return $this->data;
}
function SelectSkin( $path, $skin, $cookie )
{
global $handles;
if( ( $handles['val']->ValidateString( $path ) !== -1 ) || ( $handles['val']->ValidateString( $skin ) !== -1 ) || ( $handles['val']->ValidateString( $cookie ) !== -1 ) ) {
if( ( !empty( $cookie ) ) && ( !empty( $skin ) ) ) { $this->data = $path . "/" . $skin; }
if( ( !empty( $cookie ) ) && ( empty( $skin ) ) ) { $this->data = $path . "/" . $cookie; }
if( ( empty( $cookie ) ) && ( !empty( $skin ) ) ) { $this->data = $path . "/" . $skin; }
if( ( empty( $cookie ) ) && ( empty( $skin ) ) ) { $this->data = $path . "/green"; }
} else {
$this->data = $path . "/green";
}
return $this->data;
}
}
?>