<?PHP

$arr = array(

fieldbox => ".fieldbox {
height: 50px;
background-color: #eeeeee;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
border: 1px solid #dcdcdc;
display: inline-block;
padding:15px 15px;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

formbox => ".formbox {
margin-bottom: 0px;
box-sizing: border-box;
}",

body => "body {
margin-top: 5px;
font-family: arial,sans-serif;
font-size: 12px;
text-align: center;
background-color: EEEEEE;
background: #EEEEEE url(../images/background.jpg) center top no-repeat;
}",

footer => ".footer {
}",

listcontainer => ".listcontainer {
box-sizing: border-box;
}",

objectcontainer => ".objectcontainer {
box-sizing: border-box;
}",

focuscontainer => ".focuscontainer {
width: 100%;
box-sizing: border-box;
}",

navcontainer => ".navcontainer {
width: 100%;
box-sizing: border-box;
}",

body => "body {
margin-top: 5px;
font-family: arial,sans-serif;
font-size: 12px;
text-align: center;
background-color: EEEEEE;
background: #EEEEEE url(../images/background.jpg) center top no-repeat;
}",

verysmall => ".verysmall {
font-size: 10px;
color: 666666;
}",

small => ".small {
font-size: 12px;
color: 666666;
}",

medium => ".medium {
font-size: 14px;
color: 666666;
}",

large => ".large {
font-size: 18px;
color: 666666;
}",

verylarge => ".verylarge {
font-size: 24px;
color: 666666;
}",

linkverysmall => ".linkverysmall {
font-size: 10px;
}

.linkverysmall a:link {
color: 666666;
text-decoration: none;
}

.linkverysmall a:active {
color: 666666;
text-decoration: none;
}

.linkverysmall a:visited {
color: 666666;
text-decoration: none;
}

.linkverysmall a:hover {
color: 000000;
text-decoration: underline;
}",

linksmall => ".linksmall {
font-size: 12px;
}

.linksmall a:link {
color: 666666;
text-decoration: none;
}

.linksmall a:active {
color: 666666;
text-decoration: none;
}

.linksmall a:visited {
color: 666666;
text-decoration: none;
}

.linksmall a:hover {
color: 000000;
text-decoration: underline;
}",

linkmedium => ".linkmedium {
font-size: 14px;
}

.linkmedium a:link {
color: 666666;
text-decoration: none;
}

.linkmedium a:active {
color: 666666;
text-decoration: none;
}

.linkmedium a:visited {
color: 666666;
text-decoration: none;
}

.linkmedium a:hover {
color: 000000;
text-decoration: underline;
}",

linklarge => ".linklarge {
font-size: 18px;
}

.linklarge a:link {
color: 666666;
text-decoration: none;
}

.linklarge a:active  {
color: 666666;
text-decoration: none;
}

.linklarge a:visited {
color: 666666;
text-decoration: none;
}

.linklarge a:hover {
color: 000000;
text-decoration: underline;
}",

linkverylarge => ".linkverylarge {
font-size: 24px;
}

.linkverylarge a:link {
color: 666666;
text-decoration: none;
}

.linkverylarge a:active {
color: 666666;
text-decoration: none;
}

.linkverylarge a:visited {
color: 666666;
text-decoration: none;
}

.linkverylarge a:hover {
color: 000000;
text-decoration: underline;
}",

form => "form {
margin-bottom: 0px;
}",

hr => "hr {
color: fff;
border: 5px dotted #cccccc;
border-style: none none dotted;
}",

h1 => "h1 {
margin-top: 0px;
padding-top: 0px;
color: 666666;
font-size: 26px;
}",

h2 => "h2 {
margin-top: 0px;
padding-top: 0px;
color: 666666;
font-size: 22px;
}",

h3 => "h3 {
margin-top: 0px;
padding-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
font-size: 14px;
color: 666666;
font-size: 18px;
}",

h4 => "h4 {
margin-top: 0px;
padding-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
font-size: 14px;
}",

h5 => "h5 {
margin-top: 0px;
padding-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
font-size: 10px;
color: B0B0B0;
font-size: 12px;
}",

container => ".container {
width: 950px;
display:inline-block;
}",

head => ".head {
width: 950px;
display:inline-block;
text-align: left;
margin-top: 10px;
margin-bottom: 10px;
}",

box => ".box {
width: 697px;
background-color: ffffff;
-moz-border-radius: 26px;
float: left;
-webkit-border-radius: 26px;
border-radius: 26px;
margin-bottom: 15px;
margin-right: 15px;
border: 5px solid #666666;
display: inline-block;
padding: 20px 20px;
text-align: left;
vertical-align:top;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

fullbox => ".fullbox {
width: 950px;
background-color: ffffff;
-moz-border-radius: 26px;
float: left;
-webkit-border-radius: 26px;
border-radius: 26px;
margin-bottom: 15px;
margin-right: 15px;
border: 5px solid #666666;
display: inline-block;
padding: 20px 20px;
text-align: left;
vertical-align:top;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

nav => ".nav {
width: 235px;
background-color: ffffff;
-moz-border-radius: 26px;
-webkit-border-radius: 26px;
border-radius: 26px;
margin-bottom: 15px;
border: 5px solid #666666;
display: inline-block;
padding: 20px 20px;
text-align: left;
vertical-align:top;
float: right;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

listbox => ".listbox {
width: 100%;
margin-bottom: 15px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
border: 0px solid #dcdcdc;
display: inline-block;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
margin-bottom: 30px;
}",

gallerycontainer => ".gallerycontainer {
box-sizing: border-box;
width: 205px;
margin-left: 5px;
margin-right: 5px;
float: left;
}",

gallerybox => ".gallerybox {
width: 100%;
margin-bottom: 15px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
border: 0px solid #dcdcdc;
display: inline-block;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

galleryfocusthumb => ".galleryfocusthumb {
width: 151px;
height: 151px;
background-color: 000000;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
border: 0px solid #666666;
display: inline-block;
float: left;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 10px;
}",

galleryobjectthumb => ".galleryobjectthumb {
width: 100%;
height: 170px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
border: 0px solid #666666;
display: inline-block;
float: left;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

/*
gallerybrowse => ".gallerybrowse {
background-color: eeeeee;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
border: 1px solid #666666;
display:inline-block;
padding: 15px 15px;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",
*/

focusthumb => ".focusthumb {
width: 90px;
height: 90px;
background-color: ffffff;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
border: 1px solid #dcdcdc;
display: inline-block;
padding: 5px 5px;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
margin-bottom: 10px;
}",

focusphoto => ".focusphoto {
width: 256px;
height: 256px;
background-color: ffffff;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
border: 1px solid #666666;
display: inline-block;
float: left;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
margin-right: 15px;
margin-bottom: 5px;
}",

objectthumb => ".objectthumb {
width: 128px;
height: 128px;
background-color: ffffff;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
border: 1px solid #666666;
display: inline-block;
float: left;
text-align: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
}",

poweredby => ".poweredby a:link {
color: B0B0B0;
font-size: 11px;
text-decoration: none;
}

.poweredby a:active {
color: B0B0B0;
font-size:11px;
text-decoration:none;
}


.poweredby a:visited
{ color: B0B0B0;
font-size: 11px;
text-decoration: none;
}

.poweredby a:hover {
color: B0B0B0;
font-size: 11px;
text-decoration: underline;
}

.poweredby {
font-size: 11px;
color: B0B0B0;
}",

pagination => ".pagination {
font-size: 64px;
font-weight: bold;
float: right;
}

.pagination a:link {
color: 666666;
text-decoration: none;
}

.pagination a:active  {
color: 666666;
text-decoration: none;
}

.pagination a:visited {
color: 666666;
text-decoration: none;
}

.pagination a:hover {
color: 000000;
text-decoration: underline;
}");


//......................

mysql_query ("CREATE TABLE IF NOT EXISTS `THEMES` (`ID` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY ( `id` ) )");
mysql_query ("ALTER TABLE `THEMES` ADD `CLASSNAME` text NOT NULL");
mysql_query ("ALTER TABLE `THEMES` ADD `CLASSCSS` text NOT NULL");
mysql_query ("ALTER TABLE `THEMES` ADD `THEMEID` text NOT NULL");

$SQLlu = "SELECT * from THEMEMASTER"; $resultlu = @mySQL_query( $SQLlu ); while( $rowlu = @mySQL_fetch_array( $resultlu ) ) {

        foreach ($arr as $k => $content) {

                $SQL = "SELECT * from THEMES WHERE THEMEID = '$rowlu[THEMEID]' AND CLASSNAME = '$k'";
                $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );
                
                if (!$row) {
                        $sql = "INSERT INTO THEMES SET
                        CLASSNAME = '$k',
                        CLASSCSS = '$content',
                        THEMEID = '$rowlu[THEMEID]'";
                        $query  = mysql_query($sql) or die("$sql_error" . mysql_error());
                }
        }

}

if ($_GET[themereset] == 1) {
        foreach ($arr as $k => $content) {
        
                $sql = "DELETE FROM THEMES WHERE THEMEID = '1'";
                mysql_query("$sql");
                
                $sql = "UPDATE THEMES SET
                CLASSCSS = '$content' WHERE CLASSNAME = '$k' AND THEMEID = '1'";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());
        }
}

mysql_query ("CREATE TABLE IF NOT EXISTS `THEMEMASTER` (`ID` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY ( `id` ) )");
mysql_query ("ALTER TABLE `THEMEMASTER` ADD `THEME` text NOT NULL");
mysql_query ("ALTER TABLE `THEMEMASTER` ADD `AUTHOR` text NOT NULL");
mysql_query ("ALTER TABLE `THEMEMASTER` ADD `WEBSITE` text NOT NULL");
mysql_query ("ALTER TABLE `THEMEMASTER` ADD `DESCRIPTION` text NOT NULL");
mysql_query ("ALTER TABLE `THEMEMASTER` ADD `THEMEID` text NOT NULL");
mysql_query ("ALTER TABLE `THEMEMASTER` ADD `IMAGEARRAY` text NOT NULL");

$SQL = "SELECT * from `THEMEMASTER` WHERE THEMEID = '1'"; $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );
if (!$row) {
        $sql = "INSERT INTO `THEMEMASTER` SET
        THEME = 'default',
        THEMEID = '1',
        AUTHOR = 'Webify',
        WEBSITE = 'webify.ws',
        DESCRIPTION = 'This is the default Webify theme.'";
        $query  = mysql_query($sql) or die("$sql_error" . mysql_error());
}

/*
mysql_query ("CREATE TABLE IF NOT EXISTS `CSS` (`ID` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY ( `id` ) )");
mysql_query ("ALTER TABLE `CSS` ADD `STYLE` text NOT NULL");
mysql_query ("ALTER TABLE `CSS` ADD `AUTHOR` text NOT NULL");
mysql_query ("ALTER TABLE `CSS` ADD `DESCRIPTION` text NOT NULL");
mysql_query ("ALTER TABLE `CSS` ADD `FILLER` text NOT NULL");
mysql_query ("ALTER TABLE `CSS` ADD `IMAGEARRAY` text NOT NULL");
mysql_query ("ALTER TABLE `CSS` ADD `WEBSITE` text NOT NULL");
mysql_query ("ALTER TABLE `CSS` ADD `STATUS` text NOT NULL");

foreach ($arr as $k => $content) {
        mysql_query ("ALTER TABLE `CSS` ADD `$k` text NOT NULL");
        $insert = "$k = '$content', $insert";
}
//......................

$SQL = "SELECT * from CSS WHERE STYLE = 'default'";
$result = @mySQL_query( $SQL );
$row = @mySQL_fetch_array( $result );

        IF (empty($row[ID])) {

                $sql = "INSERT INTO CSS SET
                $insert
                STYLE = 'default',
                AUTHOR = 'Webify',
                DESCRIPTION = 'This is the default template.'
                ";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());
        }

        IF ($_GET[themereset] == 1) {

                $sql = "UPDATE CSS SET
                $insert
                AUTHOR = 'Webify',
                DESCRIPTION = 'This is the default template.'
                WHERE STYLE = 'default'";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());
        }

//......................
*/
?>
