<?php
/**
*
* @ This file is created by http://DeZender.Net
* @ deZender (PHP7 Decoder for SourceGuardian Encoder)
*
* @ Version			:	5.0.1.0
* @ Author			:	DeZender
* @ Release on		:	22.04.2022
* @ Official site	:	http://DeZender.Net
*
*/


ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(E_ALL);
$jsondata = file_get_contents('./api/json/brbox_xcdata.json');
$data = json_decode($jsondata, true);
$json = $data['app'];
$widget_1 = ($json['widget'] == '1' ? 'selected' : '');
$widget_2 = ($json['widget'] == '2' ? 'selected' : '');
$widget_3 = ($json['widget'] == '3' ? 'selected' : '');
$widget_4 = ($json['widget'] == '4' ? 'selected' : '');
$widget_5 = ($json['widget'] == '5' ? 'selected' : '');
$widget_6 = ($json['widget'] == '6' ? 'selected' : '');
$active_1 = ($json['widget'] == '1' ? 'warning' : 'primary');
$active_2 = ($json['widget'] == '2' ? 'warning' : 'primary');
$active_3 = ($json['widget'] == '3' ? 'warning' : 'primary');
$active_4 = ($json['widget'] == '4' ? 'warning' : 'primary');
$active_5 = ($json['widget'] == '5' ? 'warning' : 'primary');
$active_6 = ($json['widget'] == '6' ? 'warning' : 'primary');
$message = '<div class="alert alert-primary" id="flash-msg"><h4><i class="icon fa fa-check"></i>Items Updated!</h4></div>';

if (isset($_REQUEST['submit'])) {
	$jsonData = file_get_contents('./api/json/brbox_xcdata.json');
	$arrayData = json_decode($jsonData, true);
	$replacementData = [
		'app' => ['widget' => $_REQUEST['widget']]
	];
	$newArrayData = array_replace_recursive($arrayData, $replacementData);
	$newJsonData = json_encode($newArrayData, JSON_UNESCAPED_UNICODE);
	file_put_contents('./api/json/brbox_xcdata.json', $newJsonData);
	header('Location: widgets.php?message=' . $message);
}

include 'includes/header.php';
echo ' <!-- Begin Page Content -->' . "\n";
echo '        <div class="container-fluid">' . "\n";
echo "\n";

if (isset($_GET['message'])) {
	echo $_GET['message'];
}

echo '          <!-- Content Row -->' . "\n";
echo '          <div class="row">' . "\n";
echo "\n";
echo '            <!-- First Column -->' . "\n";
echo '            <div class="col-lg-12">' . "\n";
echo "\n";
echo '              <!-- Custom codes -->' . "\n";
echo '                <div class="card text-text-primary">' . "\n";
echo '                <div class="card-header bg-primary py-3">' . "\n";
echo '                <center><h4 align="center" class="m-0 text-white"><i class="fas fa-object-group"' . "\r\n" . '                                    style="font-size:20px">&nbsp;&nbsp;</i>Choose Your App Widget Theme</h4>' . "\r\n" . '                        ' . "\r\n\t\t\t\t\t\t" . '</center>' . "\r\n\n";
echo '            </div>' . "\n";
echo '                <div class="card-body">' . "\n";
echo '                            <form method="post">' . "\n";
echo "\t\t\t\t\t\t\t" . '<div class="form-group ">' . "\n";
echo '                            <label class="text-primary control-label requiredField" for="aa" >' . "\n";
echo '                            <strong> Pick Your Widget Theme</strong>' . "\n";
echo '                            </label>' . "\n";
echo '                            <select class="select form-control text-primary" id="select" name="widget">' . "\n";
echo "\t\t\t\t\t\t\t\t" . '<option value="1"' . $widget_1 . '>Widget 1</option>' . "\n";
echo "\t\t\t\t\t\t\t\t" . '<option value="2"' . $widget_2 . '>Widget 2</option>' . "\n";
echo "\t\t\t\t\t\t\t\t" . '<option value="3"' . $widget_3 . '>Widget 3</option>' . "\n";
echo '                            </select>' . "\n";
echo "\t\t\t\t\t\t\t" . '</div>' . "\n";
echo '                            <div class="form-group">' . "\n";
echo '                        <button class="btn btn-success btn-icon-split" name="submit" type="submit">' . "\n";
echo '                        <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit</span>' . "\n";
echo '                        </button>' . "\n";
echo '                            </div>' . "\n";
echo '                            </form>' . "\n";
echo '                </div>' . "\n";
echo '              </div>' . "\n";
echo '                <div class="card-body">' . "\n";
echo '            </div>' . "\n";
echo '            </div>' . "\n";
echo '  <br>' . "\n";
echo "\n";
echo '            <!-- Theme -->' . "\n";
echo '            <div class="col-xl-4 col-md-6 mb-6">' . "\n";
echo '              <div class="card border-left-' . $active_1 . ' shadow py-2">' . "\n";
echo '                    <div class="col mr-2">' . "\n";
echo '                      <div class="text-xs font-weight-bold text-' . $active_1 . ' text-uppercase mb-1">Widget 1</div>' . "\n";
echo '                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="./img/widgets/widget1.jpg" alt="Card image" style="width:100%"></div>' . "\n";
echo '                </div>' . "\n";
echo '              </div>' . "\n";
echo '            </div>' . "\n";
echo '            ' . "\n";
echo '            <!-- Theme -->' . "\n";
echo '            <div class="col-xl-4 col-md-6 mb-6">' . "\n";
echo '              <div class="card border-left-' . $active_2 . ' shadow py-2">' . "\n";
echo '                    <div class="col mr-2">' . "\n";
echo '                      <div class="text-xs font-weight-bold text-' . $active_2 . ' text-uppercase mb-1">Widget 2</div>' . "\n";
echo '                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="./img/widgets/widget2.jpg" alt="Card image" style="width:100%"></div>' . "\n";
echo '                </div>' . "\n";
echo '              </div>' . "\n";
echo '            </div>' . "\n";
echo '            ' . "\n";
echo '            <!-- Theme -->' . "\n";
echo '            <div class="col-xl-4 col-md-6 mb-6">' . "\n";
echo '              <div class="card border-left-' . $active_3 . ' shadow py-2">' . "\n";
echo '                    <div class="col mr-2">' . "\n";
echo '                      <div class="text-xs font-weight-bold text-' . $active_3 . ' text-uppercase mb-1">Widget 3</div>' . "\n";
echo '                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="./img/widgets/widget3.jpg" alt="Card image" style="width:100%"></div>' . "\n";
echo '                </div>' . "\n";
echo '              </div>' . "\n";
echo '            </div>' . "\n";
echo '            ' . "\n";
echo '            </div>' . "\n";
echo '            </div>' . "\n";
echo "\n";
echo "\n";
include 'includes/footer.php';
require 'includes/brbox.php';
echo '</body>' . "\n";

?>