diff --git a/admin/adminchats.php b/admin/adminchats.php index fbcf9c7..d05bc7d 100644 --- a/admin/adminchats.php +++ b/admin/adminchats.php @@ -8,14 +8,17 @@ // admin chats display session_start(); $conf = json_decode(file_get_contents("../config.json"),true); // converts the chat.json file into an array +$bannedwords=explode(", ",file_get_contents("../core/flatchat_modules/noswearing/bannedwords.array"));// set banned words list for defilth module +require_once("../core/flatchat_modules/noswearing/defilth.php"); // init Defilth module. + if (password_verify($_SESSION["passwd"],$conf["password-hash"])) {//check passwd require_once("../core/php_libs/Parsedown/Parsedown.php"); // init parsedown. $Parsedown = new Parsedown(); // create a parsedown object to parse markdown. $count=1; $chats = json_decode(file_get_contents("../chats/chats.json"),true); // converts the chat.json file into an array foreach($chats as $i) { //loop through $chats and convert to html - echo("
". $Parsedown->line(htmlspecialchars($i["user"])).":"); // USERNAME - echo("
" . $Parsedown->text(str_replace("\r\n","\r\n
",htmlspecialchars($i["msg" ]))). "
id:$count
"); // Message + echo("
". admindefilth($Parsedown->line(htmlspecialchars($i["user"])),$bannedwords).":"); // USERNAME + echo("
" . admindefilth($Parsedown->text(str_replace("\r\n","\r\n
",htmlspecialchars($i["msg" ]))),$bannedwords). "
id:$count
"); // Message require("../core/admin/assets/delmsg.php"); echo"
"; // close the chats div diff --git a/admin/confedit.css b/admin/confedit.css index ac2ee05..7225a29 100644 --- a/admin/confedit.css +++ b/admin/confedit.css @@ -1,4 +1,5 @@ block { - display:inline-flex - + display:inline-flex; + padding:10px; + border-radius:10px; } \ No newline at end of file diff --git a/admin/confedit.php b/admin/confedit.php index ca9df6c..358bf5d 100644 --- a/admin/confedit.php +++ b/admin/confedit.php @@ -2,11 +2,81 @@ session_start(); ?> \r\n\r\n"; @@ -47,50 +123,68 @@ $available .= "\r\n"; }; $available .= "\r\n"; + + $available2 = "\r\n"; + $links= json_encode($conf["links"],JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES); echo <<

SEO

-

title:

+

Title:

-

description:

+

Description: a short summary of your site

+

Customization

-

theme:

+

Front page theme: e.g a very well stylized theme for your front page

{$available} -

links:

+

Alternate theme: e.g a more readable theme, for docs and whatever doesnt need to be punchy

+ {$available2} +

Secondary theme pages: a list of page ids in Json format

+ +

links: a list of links for the top toolbar, formatted in JSON

-

footer:

+

Footer: [NOTE: only supported by some themes] text for the footer at the bottom.

-

background image:

+

Background image: [NOTE: only some themes support this] the url for your chosen background image

- +

Admin Account

-

name:

+

Name:

-

hash:

+

Hash:


generate a hash:
- +
-

chat

-

block swear words:

+

Chat:

+

Block swear words:

Yes
No
+

Filter swear words on admin panel: Does the same as the option above, but on the admin panel


+ Yes, keep me safe :)
+ No

forum name:

admin join msgs:

Yes, annoy me!
No
+
+

submit changes:

+ click the "apply" button to save changes

diff --git a/admin/icon.png b/admin/icon.png new file mode 100644 index 0000000..3e98d6d Binary files /dev/null and b/admin/icon.png differ diff --git a/admin/index.php b/admin/index.php index 0ef1330..473d8d1 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,17 +1,54 @@ -
- - -

-log in via Session >> + + + + + +Flatchat login + + + + + + + + +
+
+computer icon +
+
+

Admin Login

+
+ + +
+
+ + +
+ + +Log in via session ➡ + +
+
+ + + + window.location.href=\"./manage.php\""; -}; - +if (isset($_POST["Username"])) { + if ($_POST["Username"] == $conf["adminuser"]) { + if (isset($_POST["Password"])) { + if(password_verify($_POST["Password"],$conf["password-hash"])){ + $_SESSION['passwd']=$_POST["Password"]; + echo ""; + }; + } + } }; diff --git a/admin/login.css b/admin/login.css new file mode 100644 index 0000000..a6ae82b --- /dev/null +++ b/admin/login.css @@ -0,0 +1,161 @@ +:root { + --body_gradient_left: #7200D0; + --body_gradient_right: #C800C1; + --form_bg: #ffffff; + --input_bg: #E5E5E5; + --input_hover: #eaeaea; + --submit_bg: #1FCC44; + --submit_hover: #40e263; + --icon_color: #6b6b6b; +} + +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +body { + /* make the body full height*/ + height: 100vh; + /* set our custom font */ + font-family: 'Roboto', + sans-serif; + /* create a linear gradient*/ + background-image: linear-gradient(to right, var(--body_gradient_left), var(--body_gradient_right)); + display: flex; +} + +#form_wrapper { + width: 1000px; + height: 700px; + /* this will help us center it*/ + margin: auto; + background-color: var(--form_bg); + border-radius: 50px; + /* make it a grid container*/ + display: grid; + /* with two columns of same width*/ + grid-template-columns: 1fr 1fr; + /* with a small gap in between them*/ + grid-gap: 5vw; + /* add some padding around */ + padding: 5vh 15px; +} + +#form_left { + /* center the image */ + display: flex; + justify-content: center; + align-items: center; +} + +#form_left img { + width: 350px; + height: 350px; +} + +#form_right { + display: grid; + /* single column layout */ + grid-template-columns: 1fr; + /* have some gap in between elements*/ + grid-gap: 20px; + padding: 10% 5%; +} + +h1, +span { + text-align: center; +} + +.input_container { + background-color: var(--input_bg); + /* vertically align icon and text inside the div*/ + display: flex; + align-items: center; + padding-left: 20px; +} + +.input_container:hover { + background-color: var(--input_hover); +} + +.input_container, +#input_submit { + height: 60px; + /* make the borders more round */ + border-radius: 30px; + width: 100%; +} + +.input_field { + /* customize the input tag with lighter font and some padding*/ + color: var(--icon_color); + background-color: inherit; + width: 90%; + border: none; + font-size: 1.3rem; + font-weight: 400; + padding-left: 30px; +} + +.input_field:hover, +.input_field:focus { + /* remove the outline */ + outline: none; +} + +#input_submit { + /* submit button has a different color and different padding */ + background-color: var(--submit_bg); + padding-left: 0; + font-weight: bold; + color: white; + text-transform: uppercase; +} + +#input_submit:hover { + background-color: var(--submit_hover); + /* simple color transition on hover */ + transition: background-color, + 1s; + cursor: pointer; +} + +/* shift it a bit lower */ +#create_account { + display: block; + position: relative; + top: 30px; +} + +a { + /* remove default underline */ + text-decoration: none; + color: var(--submit_bg); + font-weight: bold; +} + +a:hover { + color: var(--submit_hover); +} + +i { + color: var(--icon_color); +} + +/* make it responsive */ +@media screen and (max-width:768px) { + + /* make the layout a single column and add some margin to the wrapper */ + #form_wrapper { + grid-template-columns: 1fr; + margin-left: 10px; + margin-right: 10px; + } + /* on small screen we don't display the image */ + #form_left { + display: none; + } +} \ No newline at end of file diff --git a/admin/themeconf.php b/admin/themeconf.php new file mode 100644 index 0000000..e69de29 diff --git a/chats/addchat.php b/chats/addchat.php index d0d6510..51c997e 100644 --- a/chats/addchat.php +++ b/chats/addchat.php @@ -46,7 +46,8 @@ } } if (!$_POST["msg"] == '') { // check for empty msg - $newmsg=[["user" =>$_POST["user"],"msg" =>$_POST["msg"]],]; // format the user inputted data as an array. + $newmsg=[["user" =>$_POST["user"],"msg" =>$_POST["msg"]."\r\n\r\n *".date('d:m:Y h:i a + ').date_default_timezone_get()."*"],]; // format the user inputted data as an array. $newchat = array_merge($chat,$newmsg); // add the existing msgs to the new one. file_put_contents("chats.json",json_encode($newchat,JSON_PRETTY_PRINT)); // save to chats file }else{ @@ -68,7 +69,8 @@ } } if (!$_POST["msg"] == '') { // check for empty msg - $newmsg=[["user" =>$_POST["user"],"msg" =>$_POST["msg"]],]; // format the user inputted data as an array. + $newmsg=[["user" =>$_POST["user"],"msg" =>$_POST["msg"]."\r\n\r\n *".date('d:m:Y h:i a + ').date_default_timezone_get()."*"],]; // format the user inputted data as an array. $newchat = array_merge($chat,$newmsg); // add the existing msgs to the new one. file_put_contents("chats.json",json_encode($newchat,JSON_PRETTY_PRINT)); // save to chats file. }else{ diff --git a/chats/ajax.php b/chats/ajax.php index bc71dea..301aaa7 100644 --- a/chats/ajax.php +++ b/chats/ajax.php @@ -10,14 +10,8 @@