Archived
1
0
Disbranĉigi 0

Way too much for a single commit...

This commit is contained in:
Jenga Phoenix 2019-02-18 23:24:07 -06:00
parent 4060b1c913
commit 6f37abd11c
24 changed files with 751 additions and 95 deletions

View File

@ -10,10 +10,11 @@
$depth = ""; $depth = "";
$title = "About"; $title = "About";
$mark = "about";
include "res/lib/load.php"; include "res/lib/load.php";
// ------------------------------------ // ------------------------------------
display_page("about.twig.html", $depth, $title); display_page($mark, $depth, $title);
?> ?>

View File

@ -10,10 +10,12 @@
$title = "Control Panel"; $title = "Control Panel";
$depth = "../"; $depth = "../";
$mark = "admin_index";
include "../res/lib/load.php"; include "../res/lib/load.php";
// -------------------------------------- // --------------------------------------
display_page("admin_index.twig.html", $depth, $title); display_page($mark, $depth, $title);
echo profanity_sharpie("fuck you bitch ass shit");
?> ?>

View File

@ -11,42 +11,34 @@
$depth = "../../"; $depth = "../../";
include "../../res/lib/load.php"; include "../../res/lib/load.php";
$auth_user = $_POST['auth_user']; $auth_user = scrub($_POST['auth_user']);
$auth_pass = $_POST['auth_pass']; $auth_pass = scrub($_POST['auth_pass']);
$auth_user_id = user_name_to_id($auth_user); $auth_id = user_name_to_id($auth_user);
$id = intval($_POST['id']); $name = scrub($_POST['name']);
$name = $_POST['name']; $full = scrub($_POST['full_name']);
$full_name = $_POST['full_name']; $bio = scrub($_POST['bio']);
$bio = $_POST['bio']; $email = scrub($_POST['email']);
$email = $_POST['email']; $url = scrub($_POST['url']);
$url = $_POST['url']; $pass = scrub($_POST['password']);
$password = $_POST['password']; $login = scrub($_POST['login']);
$login = $_POST['login'];
$password = password_hash($password, PASSWORD_BCRYPT, array('cost' => 11));
// ------------------------------------- // -------------------------------------
auth_enforce($auth_user_id, $auth_pass, auth_enforce($auth_id, $auth_pass,
array("wizard", "archmage"), "make accounts"); array("wizard", "archmage"), "make accounts");
$invalid = input_enforce(array($id, $name, $full_name, $bio, $email, $url, input_enforce(array($name, $full, $bio, $email, $url, $pass,
$password, $login), $login),
array("ID", "Username", "Full name", "Biography", "E-mail", array("Username", "Full name", "Biography", "E-mail",
"URL", "Password", "Login class"), "URL", "Password", "Login class"),
array("free_user_id", "free_user_name", "string", "string", array("free_user_name", "string", "string",
"email", "url", "ne_string", "email", "url", "ne_string",
array("spectator", "wizard", "archmage", array("spectator", "wizard", "archmage", "contributor")));
"contributor")));
if (!empty($invalid)) {
input_error("Some input is invalid: " . comma_sep($invalid));
}
// ------------------------------------- // -------------------------------------
user_create($id, $name, $password, $login, user_create($name, $pass, $login, $full, $email, $url, $bio);
$full_name, $email, $url, $bio);
root_redirect("user.php?name=" . $name); root_redirect("user.php?name=" . $name);

View File

@ -22,11 +22,7 @@ $id = intval($_POST['id']);
auth_enforce($auth_user_id, $auth_pass, auth_enforce($auth_user_id, $auth_pass,
array("wizard", "archmage"), "destroy users"); array("wizard", "archmage"), "destroy users");
$invalid = input_enforce(array($id), array("ID"), array("user_id")); input_enforce(array($id), array("ID"), array("user_id"));
if (!empty($invalid)) {
input_error("Some input is invalid: " . comma_sep($invalid));
}
// ------------------------------------- // -------------------------------------

View File

@ -10,10 +10,11 @@
$depth = ""; $depth = "";
$title = ""; $title = "";
$mark = "index";
include "res/lib/load.php"; include "res/lib/load.php";
// ------------------------------------- // -------------------------------------
display_page("index.twig.html", $depth, $title); display_page($mark, $depth, $title);
?> ?>

20
new/post/index.php Normal file
View File

@ -0,0 +1,20 @@
<?php
/* This file is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU Affero General Public
License as published by the Free Software Foundation.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. */
$title = "New Post";
$mark = "new_post_index";
$depth = "../../";
include "../../res/lib/load.php";
// --------------------------------------
display_page($mark, $depth, $title);
?>

View File

@ -0,0 +1,38 @@
<?php
/* This file is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU Affero General Public
License as published by the Free Software Foundation.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. */
$depth = "../../../";
include "../../../res/lib/load.php";
$auth_user = scrub($_POST['auth_user']);
$auth_pass = scrub($_POST['auth_pass']);
$auth_id = user_name_to_id($auth_user);
$title = scrub($_POST['title']);
$desc = scrub($_POST['desc']);
$text = scrub($_POST['text']);
// -------------------------------------
auth_enforce($auth_id, $auth_pass,
array("contributor", "wizard", "archmage"), "make posts");
input_enforce(array($title, $desc, $text),
array("Title", "Summary", "Text"),
array("title", "tweet", "ne_string"));
// -------------------------------------
echo $auth_user . $auth_user_id;
post_create($title, $auth_id, $desc, $text);
root_redirect("post.php?name=" . $title);
?>

View File

@ -10,20 +10,31 @@
$depth = ""; $depth = "";
$title = ""; $title = "";
$mark = "post";
include "res/lib/load.php"; include "res/lib/load.php";
// ------------------------------------- // -------------------------------------
$id = $_GET['id']; $id = $_GET['id'] ?? post_name_to_id($_GET['name']);
$text = post_text($id); $name = post_title($id);
$author = post_author($id);
$date = post_data($id);
$local_exports = array('id' => $id, 'text' => $text, 'author' => $author, // --------------------------------------
'data' => $data);
$text = markdown(post_text($id));
$date = post_date($id);
$data = post_data($id);
$user_id = post_author($id);
$username = user_name($user_id);
$full_name = user_full_name($user_id);
$local_exports = array('id' => $id, 'text' => $text, 'username' => $username,
'user_id' => $user_id, 'full_name' => $full_name,
'data' => $data, 'title' => $name,
'date' => $date);
// ------------------------------------- // -------------------------------------
display_page("post.twig.html", $depth, $title, $local_exports); display_page($mark, $depth, $title, $local_exports);
?> ?>

View File

@ -33,9 +33,10 @@ function comma_sep($array, $seperator=", ") {
// STRING STRING [ARRAY] --> ARRAY // STRING STRING [ARRAY] --> ARRAY
// Return exports for Twig-- with the required global & local exports, // Return exports for Twig-- with the required global & local exports,
// along with any optional local ones. // along with any optional local ones.
function make_exports($depth, $title, $local = array()) { function make_exports($depth, $title, $mark, $local = array()) {
$exports = $GLOBALS['twig_exports']; $exports = $GLOBALS['twig_exports'];
$exports['mark'] = $mark;
$exports['depth'] = $depth; $exports['depth'] = $depth;
$exports['title'] = $title; $exports['title'] = $title;

View File

@ -12,12 +12,15 @@
// STRING STRING STRING [ARRAY] --> BOOLEAN // STRING STRING STRING [ARRAY] --> BOOLEAN
// Render and display a page, based on it's template-path, title, relative // Render and display a page, based on it's template-path, title, relative
// depth, and an optional array of more Twig variable exports. // depth, and an optional array of more Twig variable exports.
function display_page($template, $depth, $title, $local_exports=array()) { function display_page($mark, $depth, $title, $local_exports=array()) {
echo $GLOBALS['twig']->render("head.twig.html", echo $GLOBALS['twig']->render("head.twig.html",
make_exports($depth, $title, $local_exports)); make_exports($depth, $title, $mark,
echo $GLOBALS['twig']->render($template, $local_exports));
make_exports($depth, $title, $local_exports)); echo $GLOBALS['twig']->render($mark . ".twig.html",
make_exports($depth, $title, $mark,
$local_exports));
echo $GLOBALS['twig']->render("foot.twig.html", echo $GLOBALS['twig']->render("foot.twig.html",
make_exports($depth, $title, $local_exports)); make_exports($depth, $title, $mark,
$local_exports));
return true; return true;
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* This file is free software: you can redistribute it and/or modify /* This file is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU Affero General Public License as published by the Free Software Foundation. it under the terms of version 3 of the GNU Affero General Public
License as published by the Free Software Foundation.
This file is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -31,12 +31,20 @@ if (!db_table_existant("lusers")) {
array("id int primary key","username varchar(20)", array("id int primary key","username varchar(20)",
"biography longtext","email varchar(50)","website varchar(50)", "biography longtext","email varchar(50)","website varchar(50)",
"hash char(60)","full_name varchar(50)", "hash char(60)","full_name varchar(50)",
"class varchar(20)")); } "class varchar(20)"));
user_create("root", "password", "archmage", "Sorĉistino Root",
"jadedctrl@teknik.io",
"https://git.eunichx.us/blagoblag.git",
"Use my account (password is `password`) to create your
own archmage account-- then DELETE ME. I am a security
risk that should be destroyed ASAP.");
}
if (!db_table_existant("posts")) { if (!db_table_existant("posts")) {
db_create_table("posts", db_create_table("posts",
array("id int primary key","title varchar(200)","date datetime", array("id int primary key","title varchar(50)","date datetime",
"user int","text longtext")); } "description varchar(250)", "user int","text longtext")); }
if (!db_table_existant("comments")) { if (!db_table_existant("comments")) {
db_create_table("comments", db_create_table("comments",
@ -64,8 +72,26 @@ function db_cmd($query) {
// STRING STRING --> ARRAY // STRING STRING --> ARRAY
// Return all values of a specific column // Return all values of a specific column
function db_get_columns($table, $column) { function db_get_columns($table, $column,
$result = db_cmd("select " . $column . " from " . $table); $order = null, $ordered = null, $max = null) {
$command = "select " . $column . " from " . $table;
if (is_string($ordered)) {
$command = $command . " order by " . $ordered . " " . $order;
} else {
$command = $command . " order by " . $column . " " . $order;
}
if (is_int($max)) {
$command = $command . " limit 0," . $max;
}
$command = $command . ";";
// -----------------
$result = db_cmd($command);
$result_nest = function($array) { $result_nest = function($array) {
return $array[0]; return $array[0];
@ -76,7 +102,7 @@ function db_get_columns($table, $column) {
} else { } else {
return $result; return $result;
} }
} }
// STRING STRING VARYING --> ARRAY // STRING STRING VARYING --> ARRAY
// Return all rows that have an 'identifier' column set to given value // Return all rows that have an 'identifier' column set to given value
@ -92,6 +118,21 @@ function db_get_cell($table, $identifier, $value, $cell) {
return db_get_rows($table, $identifier, $value)[0][$cell]; return db_get_rows($table, $identifier, $value)[0][$cell];
} }
// !!!
// !!! ['id'] is used instead of $cell !!!
// STRING STRING VARYING STRING --> ARRAY
// Return the value of a specific column in a given row, identified by an
// 'identifier' column set to the given value
function db_get_cells($table, $identifier, $value, $cell) {
$id_pop = function ($row, $cell) {
return $row['id'];
};
$rows = db_get_rows($table, $identifier, $value);
return array_map($id_pop, $rows, $cell);
}
// -------------------------------------- // --------------------------------------
// STRING STRING VARYING STRING VARYING --> NIL // STRING STRING VARYING STRING VARYING --> NIL
@ -107,14 +148,42 @@ function db_set_cell($table, $identifier, $value, $cell, $new_value) {
// ------------------------------------- // -------------------------------------
// STRING STRING --> VARYING
// Return the 'biggest' value in a column, as dictated by 'desc' ordering
function db_get_biggest($table, $column) {
return db_get_columns($table, $column, "desc")[0];
}
// STRING STRING --> VARYING
// Return the 'smallest' value in a column, as dictated by 'asc' ordering
function db_get_smallest($table, $column) {
return db_get_columns($table, $column, "asc")[0];
}
// -------------------------------------
// STRING STRING --> INTEGER
// When passed a column of numbers, it'll increment the biggest number. Good
// for creating IDs. If there aren't any numbers in the column, it'll choose 1.
function db_new_id($table, $column) {
$biggest = db_get_biggest($table, $column);
if (is_nan($biggest)) {
return 1;
} else {
return $biggest + 1;
}
}
// -------------------------------------
// STRING ARRAY ARRAY --> BOOLEAN // STRING ARRAY ARRAY --> BOOLEAN
// Create a table with given values to given columns. // Create a table with given values to given columns.
// First array is a list of columns (as would be provided to SQL), and the // First array is a list of columns (as would be provided to SQL), and the
// second is the list of values (as would follow " values " in SQL) // second is the list of values (as would follow " values " in SQL)
function db_insert_row($table, $variables, $values) { function db_insert_row($table, $variables, $values) {
$variables = comma_sep($variables); $variables = comma_sep($variables, ", ");
$values = comma_sep(strings_wrap($values)); $values = comma_sep(strings_wrap($values), ", ");
return db_cmd("insert into " . $table return db_cmd("insert into " . $table
. " (". $variables .")" . " (". $variables .")"

View File

@ -28,11 +28,12 @@ include(root("res/lib/error.php"));
include(root("res/lib/sterilize.php")); include(root("res/lib/sterilize.php"));
include(root("res/lib/db.php")); include(root("res/lib/db.php"));
include(root("res/lib/url.php")); include(root("res/lib/url.php"));
include(root("res/lib/post.php"));
include(root("res/lib/blagoblag.php")); include(root("res/lib/blagoblag.php"));
$loader= new Twig_Loader_Filesystem(root("res/themes/default/html")); $loader= new Twig_Loader_Filesystem(root("res/themes/default/html"));
$twig = new Twig_Environment($loader, ['cache' => $twig = new Twig_Environment($loader, ['cache' =>
root('cache/')]); root('cache/'), 'autoescape' => false]);
@ -49,17 +50,17 @@ $push_user_data = function($user_id) {
array_map($push_user_data, $users); array_map($push_user_data, $users);
// global $posts; $posts = post_ids(); global $posts; $posts = post_ids_recent();
// global $post; $post = array(); global $post; $post = array();
// $post = array_map(post_data, $posts); $post = array_map("post_data", $posts);
// ----------------- // -----------------
global $twig_exports; global $twig_exports;
$twig_exports = array('theme' => $GLOBALS['theme'], $twig_exports = array('theme' => $GLOBALS['theme'],
'users' => $GLOBALS['users'], 'users' => $GLOBALS['users'],
'user' => $GLOBALS['user']); 'user' => $GLOBALS['user'],
//'posts' => $GLOBALS['posts'], 'posts' => $GLOBALS['posts'],
//'post' => $GLOBALS['post']); 'post' => $GLOBALS['post']);
?> ?>

122
res/lib/post.php Normal file
View File

@ -0,0 +1,122 @@
<?php
/* This file is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU Affero General Public
License as published by the Free Software Foundation.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. */
// -------------------------------------
// NUMBER STRING --> VARYING
// Return the value of a given user's row
function post_get($id, $variable) {
return db_get_cell("posts", "id", $id, $variable);
}
// NUMBER STRING VARYING --> NIL
// Set the value of a given user's cell
function post_set($id, $variable, $new_value) {
return db_set_cell("posts", "id", $id, $variable, $new_value);
}
// -------------------------------------
// NUMBER STRING STRING [STRING STRING STRING STRING STRING] --> BOOLEAN
// Create a user of the given specification.
function post_create($title, $author, $desc, $text) {
$id = db_new_id("posts", "id");
return db_insert_row("posts",
array("id", "user", "description", "date",
"text", "title"),
array($id, $author, $desc,
date("Y-m-d H:i:s"), $text, $title));
}
// NUMBER --> BOOLEAN
// Delete a user by their ID.
function post_delete($id) {
return db_cmd("delete from posts where id = " . $id);
}
// -------------------------------------
function post_name_to_id($name) {
return db_get_cell("posts", "title", string_wrap($name), "id");
}
// NUMBER --> STRING
// Return a post's title from ID
function post_title($id) {
return post_get($id, "title");
}
// NUMBER --> STRING
// Return a post's description from ID
function post_description($id) {
return post_get($id, "description");
}
// NUMBER --> STRING
// Return a post's date from ID
function post_date($id) {
return post_get($id, "date");
}
// NUMBER --> STRING
// Return the author's user ID from post ID
function post_author($id) {
return post_get($id, "user");
}
// NUMBER --> STRING
// Return the post's text from post ID
function post_text($id) {
return post_get($id, "text");
}
// -------------------------------------
// NUMBER --> ARRAY
// Fetch an array of a post's IDs
function post_ids() {
return db_get_columns("posts", "id", "desc", "date");
}
// -------------------------------------
// NUMBER --> ARRAY
// Fetch an array of a post's IDs
function post_ids_recent() {
return db_get_columns("posts", "id", "desc", "date", 25);
}
// -------------------------------------
// NUMBER --> ARRAY
// Return an array filled with all of a user's relevant data.
function post_data($id) {
return array('title' => post_title($id),
'date' => post_date($id),
'author' => post_author($id),
'text' => post_text($id),
'desc' => post_description($id));
}
?>

View File

@ -69,8 +69,11 @@ function input_enforce($values, $names, $types) {
$i++; $i++;
} }
if (!empty($stack)) {
input_error("Some input is invalid: " . comma_sep($stack));
}
return $stack; return true;
} }
@ -89,6 +92,22 @@ function is_url($string) {
return filter_var($string, FILTER_VALIDATE_URL); return filter_var($string, FILTER_VALIDATE_URL);
} }
// STRING --> BOOLEAN
// Return whether or not a string is a tweet (<250 chars)
function is_tweet($string) {
if (strlen($string) <= 250 && !empty($string)) {
return true;
} else {return false; }
}
// STRING --> BOOLEAN
// Return whether or not a string is a title (<50 chars)
function is_title($string) {
if (strlen($string) <= 50 && !empty($string)) {
return true;
} else {return false; }
}
// VARYING --> BOOLEAN // VARYING --> BOOLEAN
// Return whether or not a given value is a non-empty string // Return whether or not a given value is a non-empty string
function is_ne_string($value) { function is_ne_string($value) {
@ -138,7 +157,74 @@ function is_free_user_id($id) {
} }
function bleep_word($word, $replacement) {
$word = str_replace("a", $replacement, $word);
$word = str_replace("e", $replacement, $word);
$word = str_replace("i", $replacement, $word);
$word = str_replace("o", $replacement, $word);
$word = str_replace("u", $replacement, $word);
$word = str_replace("y", $replacement, $word);
return $word;
}
// STRING --> STRING
// you know how people'll write nasty stuff on bathroom stalls?
// this is like taking a sharpie and bleeping all that out
function profanity_sharpie($string) {
$string = str_ireplace(" ass ", bleep_word(" ass ", "&#9829;"),
$string);
$string = str_ireplace(" asses ", bleep_word(" asses ", "&#9829;"),
$string);
$string = str_ireplace("fuck", bleep_word("fuck", "&#9829;"), $string);
$string = str_ireplace("bitch", bleep_word("bitch", "&#9829;"),
$string);
$string = str_ireplace("dick", bleep_word("dick", "&#9829;"), $string);
$string = str_ireplace("cunt", bleep_word("cunt", "&#9829;"), $string);
$string = str_ireplace("shit", bleep_word("shit", "&#9734;"), $string);
$string = str_ireplace("bitch", bleep_word("bitch", "&#9734;"),
$string);
$string = \ConsoleTVs\Profanity\Builder::blocker($string)->filter();
return $string;
}
// ------------------------------------- // -------------------------------------
// STRING --> STRING
// Agressively sanitize a string -- alias for rub_a_dub_dub()
function scrub($string) {
return rub_a_dub_dub($string);
}
// STRING --> STRING
// don't forget your rubber duck <3
function rub_a_dub_dub($string) {
$string = htmlentities($string, ENT_QUOTES, "UTF-8", false);
$string = profanity_sharpie($string);
return $string;
}
// STRING --> STRING
// Agressively sanitize a string -- alias for rub_a_dub_dub()
function unscrub($string) {
return html_entity_decode($string, ENT_QUOTES);
}
// -------------------------------------
function markdown($string) {
$parsedown = new Parsedown();
return $parsedown->text($string);
}
function markdown_inline($string) {
$parsedown = new Parsedown();
return $parsedown->line($string);
}
?> ?>

View File

@ -28,9 +28,13 @@ function user_set($id, $variable, $new_value) {
// NUMBER STRING STRING [STRING STRING STRING STRING STRING] --> BOOLEAN // NUMBER STRING STRING [STRING STRING STRING STRING STRING] --> BOOLEAN
// Create a user of the given specification. // Create a user of the given specification.
function user_create($id, $name, $password, $class="Spectator", function user_create($name, $password, $class="spectator",
$full_name=NULL, $email=NULL, $url=NULL, $bio=NULL) { $full_name=NULL, $email=NULL, $url=NULL, $bio=NULL) {
$id = db_new_id("lusers", "id");
$password = password_hash($password, PASSWORD_BCRYPT,
array('cost' => 11));
return db_insert_row("lusers", return db_insert_row("lusers",
array("id", "username", "hash", "class", array("id", "username", "hash", "class",
"full_name", "email", "website", "biography"), "full_name", "email", "website", "biography"),
@ -116,7 +120,7 @@ function user_ids() {
// NUMBER --> ARRAY // NUMBER --> ARRAY
// Fetch an array of a user's posts (by ID) // Fetch an array of a user's posts (by ID)
function user_posts($id) { function user_posts($id) {
return db_get_cell("posts", "user", $id, "id"); return db_get_cells("posts", "user", $id, array('id'));
} }

View File

@ -0,0 +1,213 @@
/*PEN STYLES*/
* {
box-sizing: border-box;
}
.postbox {
height: 500px;
}
body {
background: #f1f1f1;
margin: 2rem;
}
$color_white: #fff;
$color_prime: #5ad67d;
$color_grey: #e2e2e2;
$color_grey_dark: #a2a2a2;
.blog-card {
display: flex;
flex-direction: column;
margin: 1rem auto;
box-shadow: 0 3px 7px -1px rgba(#000, .1);
margin-bottom: 1.6%;
background: $color_white;
line-height: 1.4;
font-family: sans-serif;
border-radius: 5px;
overflow: hidden;
z-index: 0;
a {
color: inherit;
&:hover {
color: $color_prime;
}
}
&:hover {
.photo {
transform: scale(1.3) rotate(3deg);
}
}
.meta {
position: relative;
z-index: 0;
height: 200px;
}
.photo {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-size: cover;
background-position: center;
transition: transform .2s;
}
.details,
.details ul {
margin: auto;
padding: 0;
list-style: none;
}
.details {
position: absolute;
top: 0;
bottom: 0;
left: -100%;
margin: auto;
transition: left .2s;
background: rgba(#000, .6);
color: $color_white;
padding: 10px;
width: 100%;
font-size: .9rem;
a {
text-decoration: dotted underline
}
ul li {
display: inline-block;
}
.author:before {
font-family: FontAwesome;
margin-right: 10px;
content: "\f007";
}
.date:before {
font-family: FontAwesome;
margin-right: 10px;
content: "\f133";
}
.tags {
ul:before {
font-family: FontAwesome;
content: "\f02b";
margin-right: 10px;
}
li {
margin-right: 2px;
&:first-child {
margin-left: -4px;
}
}
}
}
.description {
padding: 1rem;
background: $color_white;
position: relative;
z-index: 1;
h1,
h2 {
font-family: Poppins, sans-serif;
}
h1 {
line-height: 1;
margin: 0;
font-size: 1.7rem;
}
h2 {
font-size: 1rem;
font-weight: 300;
text-transform: uppercase;
color: $color_grey_dark;
margin-top: 5px;
}
.read-more {
text-align: right;
a {
color: $color_prime;
display: inline-block;
position: relative;
&:after {
content: "\f061";
font-family: FontAwesome;
margin-left: -10px;
opacity: 0;
vertical-align: middle;
transition: margin .3s, opacity .3s;
}
&:hover:after {
margin-left: 5px;
opacity: 1;
}
}
}
}
p {
position: relative;
margin: 1rem 0 0;
&:first-of-type {
margin-top: 1.25rem;
&:before {
content: "";
position: absolute;
height: 5px;
background: $color_prime;
width: 35px;
top: -0.75rem;
border-radius: 3px;
}
}
}
&:hover {
.details {
left: 0%;
}
}
@media (min-width: 640px) {
flex-direction: row;
max-width: 700px;
.meta {
flex-basis: 40%;
height: auto;
}
.description {
flex-basis: 60%;
&:before {
transform: skewX(-3deg);
content: "";
background: #fff;
width: 30px;
position: absolute;
left: -10px;
top: 0;
bottom: 0;
z-index: -1;
}
}
&.alt {
flex-direction: row-reverse;
.description {
&:before {
left: inherit;
right: -10px;
transform: skew(3deg)
}
}
.details {
padding-left: 25px;
}
}
}
}

View File

@ -6,13 +6,12 @@
<input name="auth_user" type="text" /> <input name="auth_user" type="text" />
</p> </p>
<p><label>Your Password</label> <p><label>Your Password</label>
<input name="auth_pass" type="text"> <input name="auth_pass" type="password">
</p> </p>
<hr /> <hr />
<section id="user_details"> <section id="user_details">
<p><label>User ID</label><input name="id" type="number" /></p>
<p><label>Full Name</label><input name="full_name" type="text"/> <p><label>Full Name</label><input name="full_name" type="text"/>
</p> </p>
<p><label>Biography</label><input name="bio" type="text" /> <p><label>Biography</label><input name="bio" type="text" />

View File

@ -1,11 +1,29 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" type="text/css" href="{{ depth }}res/{{ theme }}/css/global.css"> <meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="{{ depth }}res/{{ theme }}/css/{{ page }}.css"> <link rel="stylesheet" type="text/css"
href="{{ depth }}res/themes/{{ theme }}/css/global.css">
<link rel="stylesheet" type="text/css"
href="{{ depth }}res/themes/{{ theme }}/css/{{ mark }}.css">
<title>Index</title> <title>Index</title>
</head> </head>
<body> <body>
<!-- Powered by blagoblag, which is Free Software under the GNU AGPLv3. <!--
Git your sources here: <https://git.eunichx.us/blagoblag.git> -->
Powered by blagoblag, which is Free Software under the GNU AGPLv3.
Git your sources here: <https://git.eunichx.us/blagoblag.git>
_______________________________________
/ what do you call a cow with no legs? \
| ground beef! |
\_______________________________________/
\ ^__^
\ (oo)\_______
(__)\ )\/\
||____ |
|| w||
|| ||
-->

View File

@ -1 +1,12 @@
<p>{{ animal }}s are SUPER RAD.</p> {% for post_id in posts %}
{% set post_author = post[post_id]['author'] %}
{% set post_username = user[post_author]['name'] %}
{% set post_full_name = user[post_author]['full_name'] %}
{% set post_title = post[post_id]['title'] %}
{% set post_date = post[post_id]['date'] %}
{% set post_desc = post[post_id]['desc'] %}
{{ include('meta_post_card.html') }}
{% endfor %}

View File

@ -0,0 +1,10 @@
<div class="post_card">
<a href="{{ depth }}post.php?id={{ post_id }}">
<h1>{{ post_title }}</h1>
</a>
<a href="{{ depth }}user.php?name={{ post_username }}">
<h3>{{ post_full_name }}</h3>
</a>
<h3>{{ post_date }}</h3>
<p>{{ post_desc }}</p>
</div>

View File

@ -0,0 +1,28 @@
<section id="creation">
<form id="post_creation" action="private/post_create.php" method="post">
<section class="authentication">
<p><label>Username</label>
<input name="auth_user" type="text" />
</p>
<p><label>Password</label>
<input name="auth_pass" type="password">
</p>
</section>
<hr />
<section class="post_metadata">
<p><label>Title</label><input name="title" type="text" /></p>
<p><label>Desc</label><input name="desc" type="text" /></p>
</section>
<section class="post_data">
<p><label>Text</label><br />
<textarea name="text" rows="20" cols="80"></textarea>
</section>
<p><input type="submit" /></p>
</form>
</section>

View File

@ -1,10 +1,9 @@
<!DOCTYPE html> <h1>{{ title }}</h1>
<html lang="en"> <h2>By
<head> <a href="{{ depth }}user.php?name={{ username }}">
<link rel="stylesheet" type="text/css" href="res/default/css/global.css"> {{ full_name }}
<link rel="stylesheet" type="text/css" href="res/default/css/post.css"> </a>
<title>Index</title> </h2>
</head>
<body> <h3>{{ date }}</h3>
</body> <p>{{ text }}</p>
</html

View File

@ -1,7 +1,17 @@
<h1>{{ full_name }}</h1> <h1>{{ full_name }}</h1>
<h2>{{ username }}</h2> <h3>{{ website }} &lt;{{ email }}&gt;</h3>
<h3>{{ email }}</h3> <h3>({{ name }})</h3>
<h3>{{ url }}</h3>
<p>{{ bio }}</p> <p>{{ bio }}</p>
<ul>
</ul>
{% for post_id in user_posts %}
{% set post_id = post_id %}
{% set post_username = name %}
{% set post_user_id = id %}
{% set post_full_name = full_name %}
{% set post_title = user_post[post_id]['title'] %}
{% set post_date = user_post[post_id]['date'] %}
{% set post_desc = user_post[post_id]['desc'] %}
{{ include('meta_post_card.html') }}
{% endfor %}

View File

@ -10,6 +10,8 @@
$depth = ""; $depth = "";
$mark = "user";
$title = "Death";
include "res/lib/load.php"; include "res/lib/load.php";
// ------------------------------------- // -------------------------------------
@ -26,14 +28,33 @@ if (empty($name)) {
general_error("It looks like that isn't a real user..."); general_error("It looks like that isn't a real user...");
} }
// ------------------------------------ // -------------------------------------
$local_exports = array('full_name' => user_full_name($id), 'name' => $name, global $user_posts; $user_posts = user_posts($id);
'bio' => user_biography($id), 'email' => global $user_post; $user_post = array();
user_email($id), 'website' => user_website($id));
// this is used to make associative array for a user's posts, based on
// both post ID and post title
$push_post_data = function($post_id) {
$title = post_title($post_id);
$GLOBALS['user_post'][$post_id] = post_data($post_id);
$GLOBALS['user_post'][$title] = post_data($post_id);
};
array_map($push_post_data, $user_posts);
// -----------------
$local_exports = array('id' => $id, 'full_name' => unscrub(user_full_name($id)),
'name' => $name,
'bio' => unscrub(user_biography($id)),
'email' => user_email($id),
'website' => user_website($id),
'user_posts' => $user_posts,
'user_post' => $user_post);
// ------------------------------------- // -------------------------------------
display_page("user.twig.html", $depth, $title, $local_exports); display_page($mark, $depth, $title, $local_exports);
?> ?>