<?PHP

//......................
/*
$SQL = "SELECT * from CSS WHERE STYLE = '$_GET[theme]'"; $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );

$show = @file_get_contents("http://webify.ws/themehq/uploads/$_GET[theme].txt");

$SQL = "SELECT * from CSS WHERE STYLE = '$_GET[theme]'"; $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );
if (empty($row[ID])) {

        $sql = "INSERT INTO CSS SET
        $show
        FILLER = ''";
        $query  = mysql_query($sql) or die("$sql_error" . mysql_error());

}

$SQL = "SELECT * from CSS WHERE STYLE = '$_GET[theme]'"; $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );

@mkdir ("$_SERVER[DOCUMENT_ROOT]/webifycore/themes/images/$row[STYLE]");
@mkdir ("$_SERVER[DOCUMENT_ROOT]/webifycore/themes/images/$row[STYLE]/files");

$pieces = explode("~", "$row[IMAGEARRAY]");
foreach ($pieces as $k => $content)
        @copy("http://webify.ws/themehq/uploads/$row[STYLE]/$content", "$_SERVER[DOCUMENT_ROOT]/webifycore/themes/images/$row[STYLE]/files/$content");
*/
//......................

$file = "http://www.webify.ws/themehq/give.php" . "?themeid=$_GET[themeid]";
$remote = file_get_contents($file);
//echo $remote;

$pieces = explode("[key]", "$remote");

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

if (!empty($content)) {

        $chip = explode("[style]", "$content");

        $table = "THEMES";
        $SQL = "SELECT * from $table WHERE THEMEID = '$_GET[themeid]' AND CLASSNAME = '$chip[0]'";
        $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );

        if (!$row) {
                $sql = "INSERT INTO $table SET
                CLASSNAME = '$chip[0]',
                CLASSCSS = '$chip[1]',
                THEMEID = '$_GET[themeid]'";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());

        } ELSE {

                $sql = "UPDATE $table SET
                CLASSCSS = '$chip[1]' WHERE THEMEID = '$_GET[themeid]' AND CLASSNAME = '$chip[0]'";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());

        }

}
}

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

$file = "http://www.webify.ws/themehq/givemore.php" . "?themeid=$_GET[themeid]";
$remote = file_get_contents($file);

        $table = "THEMEMASTER";
        $SQL = "SELECT * from $table WHERE THEMEID = '$_GET[themeid]'";
        $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );

        if (!$row) {
                $sql = "INSERT INTO $table SET
                $remote
                THEMEID = '$_GET[themeid]'";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());

        } ELSE {

                $sql = "UPDATE $table SET
                $remote
                WEBSITE = ''
                WHERE THEMEID = '$_GET[themeid]'";
                $query  = mysql_query($sql) or die("$sql_error" . mysql_error());

        }

$SQL = "SELECT * from THEMEMASTER WHERE THEMEID = '$_GET[themeid]'"; $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );

@mkdir ("$_SERVER[DOCUMENT_ROOT]/webifycore/themes/images/$_GET[themeid]");
@mkdir ("$_SERVER[DOCUMENT_ROOT]/webifycore/themes/images/$_GET[themeid]/files");

$pieces = explode("~", "$row[IMAGEARRAY]");
foreach ($pieces as $k => $content) {
        @copy("http://webify.ws/themehq/uploads/$_GET[themeid]/$content", "$_SERVER[DOCUMENT_ROOT]/webifycore/themes/images/$_GET[themeid]/files/$content");

}
        
//......................

?>

<div class="primebox" style="width: 100%; ">

<h1><?PHP /* (LANGUAGE) */ $t = "Theme Imported"; $f = "themeimported"; include "langinc.php"; /* (LANGUAGE) */ ?></h1>

<?PHP /* (LANGUAGE) */ $t = "Theme"; $f = "theme"; include "langinc.php"; /* (LANGUAGE) */ ?>: <b><?php echo $_GET[theme]; ?></b>

<br>

<br>

<?PHP /* (LANGUAGE) */ $t = "This theme has been imported to your library but it has not yet been activated. Activate this theme by visiting the Themes panel."; $f = "themeimportcaption"; include "langinc.php"; /* (LANGUAGE) */ ?>

</div>
