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

$jsondata_admin1 = file_get_contents('./includes/eggzie.json');
$data_admin1 = json_decode($jsondata_admin1, true);
$json_admin1 = $data_admin1['info'];
$col_admin1 = $json_admin1['oo'];

if ($col_admin1 == '0') {
	header('Location: users.php');
}

$file = './api/note.json';
$jsondata = file_get_contents($file);
$json = json_decode($jsondata, true);
$message = '<div class="alert alert-primary" id="flash-msg"><h4><i class="icon fa fa-check"></i>Items Updated!</h4></div>';

if (isset($_POST['text'])) {
	$file = './api/note.json';
	$jsondata = file_get_contents($file);
	$json = json_decode($jsondata, true);
	$replacementData = ['title' => $_POST['title'], 'content' => $_POST['content']];
	$newArrayData = array_replace_recursive($json, $replacementData);
	$newJsonData = json_encode($newArrayData, JSON_UNESCAPED_UNICODE);
	file_put_contents($file, $newJsonData);
	header('Location: note.php?success');
}

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

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

echo '          <!-- Page Heading -->' . "\n";
echo '          <h1 class="h3 mb-1" style="color:' . $colour_head_16 . ';">Notifications</h1>' . "\n";
echo '         ' . "\n";
echo '          <!-- Content Row -->' . "\n";
echo '          <div class="row">' . "\n";
echo "\n";
echo '            <!-- First Column -->' . "\n";
echo '            <div class="col-lg-6">' . "\n";
echo "\n";
echo '              <!-- Custom codes -->' . "\n";
echo '                <div class="card border-left-primary shadow h-100 card shadow mb-4">' . "\n";
echo '                <div class="card-header py-3">' . "\n";
echo '                <h6 class="m-0 font-weight-bold" style="color:' . $colour_head_11 . ';"><i class="fa fa-bull-horn"></i> Edit Notification Details</h6>' . "\n";
echo '                </div>' . "\n";
echo '                <div class="card-body">' . "\n";
echo '                            <form method="post">' . "\n";
echo '                            <div class="form-group ">' . "\n";
echo '                            <label class="control-label " style="color:' . $colour_head_18 . ';" for="title">' . "\n";
echo '                                <strong>Title</strong>' . "\n";
echo '                            </label>' . "\n";
echo '                            <div class="input-group">' . "\n";
echo '                            <input type="text" class="form-control " style="background-color:' . $colour_head_17 . ';color:' . $colour_head_10 . ';"  name="title" id="title" value="' . $title . '">' . "\n";
echo '                            </div>' . "\n";
echo '                            </div>' . "\n";
echo '                            <div class="form-group ">' . "\n";
echo '                            <label class="control-label " style="color:' . $colour_head_18 . ';" for="content">' . "\n";
echo '                                <strong>Message</strong>' . "\n";
echo '                            </label>' . "\n";
echo '                            <div class="input-group">' . "\n";
echo '                            <input type="text" class="form-control"  style="background-color:' . $colour_head_17 . ';color:' . $colour_head_10 . ';" name="content" id="content" value="' . $content . '">' . "\n";
echo '                            </div>' . "\n";
echo '                            </div>' . "\n";
echo '                            <div class="form-group">' . "\n";
echo '                            <div>' . "\n";
echo '                        <button class="btn btn-success btn-icon-split" style="background-color:' . $colour_head_btn . ';border-color:' . $colour_head_btn . ';color:' . $colour_head_10 . ';" name="text" type="submit">' . "\n";
echo '                        <span class="icon text-white-50"><i class="fas fa-check" style="color:' . $colour_head_10 . ';"></i></span><span class="text">Submit</span>' . "\n";
echo '                        </button>' . "\n";
echo '                            </div>' . "\n";
echo '                            </div>' . "\n";
echo '                            </form>' . "\n";
echo '                </div>' . "\n";
echo '              </div>' . "\n";
echo '            </div>' . "\n";
echo '            </div>' . "\n";
echo '            </div>' . "\n";
echo "\n";
echo '    <br><br><br>';
include 'includes/footer.php';
require 'includes/egz.php';
echo '</body>' . "\n";

?>