Merge pull request #27 from andydixon/development

Development Sync
This commit was merged in pull request #27.
This commit is contained in:
Andy Dixon
2024-10-09 20:56:19 +01:00
committed by GitHub
6 changed files with 35 additions and 37 deletions
+14 -16
View File
@@ -15,8 +15,8 @@ body {
height: 70px; height: 70px;
background-color: #666666; background-color: #666666;
border-bottom: 1px solid #1a1a1a; border-bottom: 1px solid #1a1a1a;
-webkit-box-shadow: 0px 10px 13px -7px #000000, -1px -1px 15px 5px rgba(0, 0, 0, 0); -webkit-box-shadow: 0 10px 13px -7px #000000, -1px -1px 15px 5px rgba(0, 0, 0, 0);
box-shadow: 0px 10px 13px -7px #000000, -1px -1px 15px 5px rgba(0, 0, 0, 0); box-shadow: 0 10px 13px -7px #000000, -1px -1px 15px 5px rgba(0, 0, 0, 0);
} }
.pageContainer .frame { .pageContainer .frame {
@@ -55,45 +55,43 @@ body {
} }
.blueButton { .blueButton {
box-shadow: inset 0px 0px 15px 3px #23395e; box-shadow: inset 0 0 15px 3px #23395e;
background: linear-gradient(to bottom, #2e466e 5%, #415989 100%); background: #2e466e linear-gradient(to bottom, #2e466e 5%, #415989 100%);
background-color: #2e466e;
border-radius: 17px; border-radius: 17px;
border: 1px solid #1f2f47; border: 1px solid #1f2f47;
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
color: #ffffff; color: #ffffff;
font-family: Arial; font-family: Arial, Helvetica, sans-serif;
font-size: 15px; font-size: 15px;
padding: 6px 13px; padding: 6px 13px;
text-decoration: none; text-decoration: none;
text-shadow: 0px 1px 0px #263666; text-shadow: 0 1px 0 #263666;
} }
.blueButton:hover { .blueButton:hover {
background: linear-gradient(to bottom, #415989 5%, #2e466e 100%); background: #415989 linear-gradient(to bottom, #415989 5%, #2e466e 100%);
background-color: #415989; color: #ffffff;
} }
.greenButton { .greenButton {
box-shadow: inset 0px 0px 15px 3px #3e7327; box-shadow: inset 0 0 15px 3px #3e7327;
background: linear-gradient(to bottom, #77b55a 5%, #72b352 100%); background: #77b55a linear-gradient(to bottom, #77b55a 5%, #72b352 100%);
background-color: #77b55a;
border-radius: 17px; border-radius: 17px;
border: 1px solid #4b8f29; border: 1px solid #4b8f29;
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
color: #ffffff; color: #ffffff;
font-family: Arial; font-family: Arial, Helvetica, sans-serif;
font-size: 15px; font-size: 15px;
padding: 6px 13px; padding: 6px 13px;
text-decoration: none; text-decoration: none;
text-shadow: 0px 1px 0px #5b8a3c; text-shadow: 0 1px 0 #5b8a3c;
} }
.greenButton:hover { .greenButton:hover {
background: linear-gradient(to bottom, #72b352 5%, #77b55a 100%); background: #72b352 linear-gradient(to bottom, #72b352 5%, #77b55a 100%);
background-color: #72b352; color: #ffffff;
} }
.greenButton:active { .greenButton:active {
+2 -2
View File
@@ -26,7 +26,7 @@ if (!$_SESSION["core"]->isLoggedIn() && stripos($_SERVER['REQUEST_URI'], "/login
// str_starts_with compatibility for php 7 // str_starts_with compatibility for php 7
if (!function_exists('str_starts_with')) { if (!function_exists('str_starts_with')) {
function str_starts_with($haystack, $needle) function str_starts_with($haystack, $needle): bool
{ {
//str_starts_with(string $haystack, string $needle): bool //str_starts_with(string $haystack, string $needle): bool
@@ -40,7 +40,7 @@ if (!function_exists('str_starts_with')) {
//str_ends_with compatibility for php 7 //str_ends_with compatibility for php 7
if (!function_exists('str_ends_with')) { if (!function_exists('str_ends_with')) {
function str_ends_with($haystack, $needle) function str_ends_with($haystack, $needle): bool
{ {
//str_starts_with(string $haystack, string $needle): bool //str_starts_with(string $haystack, string $needle): bool
+9 -9
View File
@@ -1,12 +1,12 @@
$(document).ready(function () { $(document).ready(function () {
var currentDiv; let currentDiv;
var iframeDoc; let iframeDoc;
$('#frameContainer').on('load', function () { $('#frameContainer').on('load', function () {
// Get the iframe document // Get the iframe document
var iframe = document.getElementById('frameContainer'); const iframe = document.getElementById('frameContainer');
iframeDoc = iframe.contentDocument || iframe.contentWindow.document; iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
// Set up click handler on divs with class 'editable' in the iframe // Set up click handler on divs with class 'editable' in the iframe
@@ -16,7 +16,7 @@ $(document).ready(function () {
currentDiv = $(this); currentDiv = $(this);
// Get the content of the div // Get the content of the div
var content = currentDiv.html(); const content = currentDiv.html();
// Set the content in TinyMCE // Set the content in TinyMCE
$('#editor').val(content); $('#editor').val(content);
@@ -47,7 +47,7 @@ $(document).ready(function () {
// Save changes made to a div, but not save to the file on the server // Save changes made to a div, but not save to the file on the server
$('#saveBtn').click(function () { $('#saveBtn').click(function () {
// Get the data from TinyMCE // Get the data from TinyMCE
var data = tinymce.get('editor').getContent(); const data = tinymce.get('editor').getContent();
// Set the data back to the div in the iframe // Set the data back to the div in the iframe
$(currentDiv).html(data); $(currentDiv).html(data);
@@ -119,7 +119,7 @@ $(document).ready(function () {
} else { } else {
showMessage("New page Created", "success"); showMessage("New page Created", "success");
$('#frameContainer').contents().get(0).location.href = response.url; $('#frameContainer').contents().get(0).location.href = response.url;
$("#newPageForm").dialog("close"); // Close the modal on success $('.ui-dialog-content').dialog('close');
} }
}, },
error: function () { error: function () {
@@ -169,7 +169,7 @@ $(document).ready(function () {
// Add click event to list items to redirect // Add click event to list items to redirect
$("#fileList li").click(function () { $("#fileList li").click(function () {
$('#frameContainer').contents().get(0).location.href = $(this).data("url"); // Redirect to the clicked file's URL $('#frameContainer').contents().get(0).location.href = $(this).data("url"); // Redirect to the clicked file's URL
$("#fileListDialog").dialog("close"); // Close the modal $('.ui-dialog-content').dialog('close');
}); });
}, },
error: function () { error: function () {
@@ -186,7 +186,7 @@ $(document).ready(function () {
width: 500, width: 500,
buttons: { buttons: {
Close: function () { Close: function () {
$(this).dialog("close"); $('.ui-dialog-content').dialog('close');
} }
} }
}); });
@@ -200,7 +200,7 @@ $(document).ready(function () {
* @param type - string "success" or "error" * @param type - string "success" or "error"
*/ */
function showMessage(message, type) { function showMessage(message, type) {
var messageBar = $('#message-bar'); const messageBar = $('#message-bar');
// Set the text message // Set the text message
messageBar.text(message); messageBar.text(message);
+1 -1
View File
@@ -15,7 +15,7 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Login</title> <title>Login</title>
<style> <style>
+8 -8
View File
@@ -3,11 +3,11 @@
class neoCMSCore class neoCMSCore
{ {
public $auditEnabled = true; public bool $auditEnabled = true;
public $users = []; public array $users = [];
public $loggedIn = false; public bool $loggedIn = false;
public $version = '2.0'; public string $version = '2.0';
private $loggedInUser = ''; private string $loggedInUser = '';
public function __construct() public function __construct()
{ {
@@ -27,7 +27,7 @@ class neoCMSCore
* @param $value * @param $value
* @return void * @return void
*/ */
public function writeAudit($value) public function writeAudit($value): void
{ {
if ($this->auditEnabled) if ($this->auditEnabled)
file_put_contents(__DIR__ . "/logs/" . date('y-m-d-') . "audit.txt", date('Y-m-d H:i:s') . "\t" . $this->loggedInUser . "\t" . trim($value) . "\n", FILE_APPEND); file_put_contents(__DIR__ . "/logs/" . date('y-m-d-') . "audit.txt", date('Y-m-d H:i:s') . "\t" . $this->loggedInUser . "\t" . trim($value) . "\n", FILE_APPEND);
@@ -38,12 +38,12 @@ class neoCMSCore
return $this->loggedIn; return $this->loggedIn;
} }
public function getLoggedinUser() public function getLoggedinUser(): string
{ {
return $this->loggedInUser; return $this->loggedInUser;
} }
public function saveContent($uri, $content) public function saveContent($uri, $content): void
{ {
$this->writeAudit("Content for " . $uri . " was saved."); $this->writeAudit("Content for " . $uri . " was saved.");
$uri = str_replace("../", "./", $uri); $uri = str_replace("../", "./", $uri);
+1 -1
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Iframe Content</title> <title>Iframe Content</title>
</head> </head>