Finally merging 2.5.1 updates into beta

2.5.1 is ready to go, so it's time to merge into the beta branch and
  test it to make sure everything is ship shape
This commit is contained in:
Are0h 2022-06-16 13:59:57 -07:00
commit 69fc689d38
58 changed files with 11850 additions and 14872 deletions

5
.gitignore vendored
View file

@ -44,5 +44,6 @@ config/tags.json
config.codekit3 config.codekit3
/config/backups /config/backups
src/com/ src/com/*
src/styles/ src/styles/*

72
.php-cs-fixer.php Normal file
View file

@ -0,0 +1,72 @@
<?php
return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
'combine_consecutive_unsets' => true,
'method_chaining_indentation' => true,
'class_attributes_separation' => [
'elements' => [
'const' => 'none',
'method' => 'one',
'property' => 'none',
'trait_import' => 'none',
],
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'single_quote' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
],
],
'braces' => [
'allow_single_line_closure' => true,
],
'concat_space' => [
'spacing' => 'one',
],
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'single_line_comment_style' => [
'comment_types' => [
'hash',
],
],
'include' => true,
'lowercase_cast' => true,
'no_extra_blank_lines' => [
'tokens' => [
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'throw',
]
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_spaces_around_offset' => true,
'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'single_blank_line_before_namespace' => true,
'ternary_operator_spaces' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'single_line_after_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'none',
],
])
->setLineEnding("\n");

View file

@ -1,11 +1,27 @@
{ {
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
},
{
"files": "*.scss",
"options": {
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"printWidth": 90
}
},
{
"files": "*.js",
"options": {
"arrowParens": "avoid", "arrowParens": "avoid",
"bracketSpacing": true, "bracketSpacing": true,
"htmlWhitespaceSensitivity": "css", "htmlWhitespaceSensitivity": "css",
"insertPragma": false, "insertPragma": false,
"bracketSameLine": false, "bracketSameLine": false,
"jsxSingleQuote": true, "jsxSingleQuote": true,
"parser": "babel",
"proseWrap": "preserve", "proseWrap": "preserve",
"requirePragma": false, "requirePragma": false,
"semi": true, "semi": true,
@ -15,3 +31,6 @@
"tabWidth": 4, "tabWidth": 4,
"printWidth": 90 "printWidth": 90
} }
}
]
}

6
.stylelintrc Normal file
View file

@ -0,0 +1,6 @@
{
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-prettier-scss"
]
}

View file

@ -17,14 +17,14 @@ class AuthAPI
//internal check for admin action //internal check for admin action
if (Auth::status()) { if (Auth::status()) {
$result = [ $result = [
"message" => "Authorized", 'message' => 'Authorized',
"type" => "apiUseAuthorized", 'type' => 'apiUseAuthorized',
"token" => Session::get("token"), 'token' => Session::get('token'),
]; ];
} else { } else {
$result = [ $result = [
"message" => "Not Authorized", 'message' => 'Not Authorized',
"type" => "apiUseNotAuthorized", 'type' => 'apiUseNotAuthorized',
]; ];
} }
return $result; return $result;
@ -34,22 +34,22 @@ class AuthAPI
{ {
$result = []; $result = [];
switch (Auth::login($body)) { switch (Auth::login($body)) {
case "no_name": case 'no_name':
$result = [ $result = [
"message" => "Need to see some id, champ", 'message' => 'Need to see some id, champ',
"type" => "requestLame", 'type' => 'requestLame',
]; ];
break; break;
case "bad_pass": case 'bad_pass':
$result = [ $result = [
"message" => "Check your password, sport", 'message' => 'Check your password, sport',
"type" => "requestLame", 'type' => 'requestLame',
]; ];
break; break;
default: default:
$result = [ $result = [
"message" => "Welcome back", 'message' => 'Welcome back',
"type" => "requestGood", 'type' => 'requestGood',
]; ];
break; break;
} }
@ -61,16 +61,18 @@ class AuthAPI
{ {
Auth::logout($body); Auth::logout($body);
$result = [ $result = [
"message" => "Till next time, g.", 'message' => 'Till next time, g.',
"type" => "TASK_LOGOUT", 'type' => 'TASK_LOGOUT',
]; ];
return $result; return $result;
} }
public static function requestSecret($body) public static function requestSecret($body)
{ {
$result = Auth::findSecret($body); $result = Auth::findSecret($body);
return $result; return $result;
} }
public static function resetPassword($body) public static function resetPassword($body)
{ {
$result = Auth::makeNewPassword($body); $result = Auth::makeNewPassword($body);

View file

@ -15,64 +15,61 @@ class ImagesAPI
public static function uploadImage($request, $type = null) public static function uploadImage($request, $type = null)
{ {
$file = $request->getUploadedFiles(); $file = $request->getUploadedFiles();
$uploadPath = ""; $uploadPath = '';
$path = date("Y") . "/" . date("m"); $path = date('Y') . '/' . date('m');
$response = []; $response = [];
switch ($type) { switch ($type) {
case "avatar": case 'avatar':
$image = $file["avatar_upload"]; $image = $file['avatar_upload'];
$uploadPath = "../public/assets/images/user/" . $path; $uploadPath = '../public/assets/images/user/' . $path;
break; break;
case "background": case 'background':
$image = $file["background_upload"]; $image = $file['background_upload'];
$uploadPath = "../public/assets/images/user/" . $path; $uploadPath = '../public/assets/images/user/' . $path;
break; break;
default: default:
$image = $file["post_image"]; $image = $file['post_image'];
$path = date("Y") . "/" . date("m"); $path = date('Y') . '/' . date('m');
$uploadPath = "../public/assets/images/blog/" . $path; $uploadPath = '../public/assets/images/blog/' . $path;
break; break;
} }
$result = FileUploader::uploadFile($uploadPath, $image); $result = FileUploader::uploadFile($uploadPath, $image);
switch ($type) { switch ($type) {
case "avatar": case 'avatar':
$response = [ $response = [
"message" => "Avatar Added. You look great!", 'message' => 'Avatar Added. You look great!',
"type" => "avatarUploaded", 'type' => 'avatarUploaded',
"url" => 'url' => '/assets/images/user/' . $path . '/' . $image->getClientFileName(),
"/assets/images/user/" . $path . "/" . $image->getClientFileName(),
]; ];
//update member data //update member data
Member::updateData( Member::updateData(
"avi", 'avi',
"/assets/images/user/" . $path . "/" . $image->getClientFileName() '/assets/images/user/' . $path . '/' . $image->getClientFileName()
); );
break; break;
case "background": case 'background':
$response = [ $response = [
"message" => "Background plugged in. That's nice!", 'message' => "Background plugged in. That's nice!",
"type" => "siteBackgroundUploaded", 'type' => 'siteBackgroundUploaded',
"url" => 'url' => '/assets/images/user/' . $path . '/' . $image->getClientFileName(),
"/assets/images/user/" . $path . "/" . $image->getClientFileName(),
]; ];
//update settings file //update settings file
Settings::updateGlobalData( Settings::updateGlobalData(
"background", 'background',
"/assets/images/user/" . $path . "/" . $image->getClientFileName() '/assets/images/user/' . $path . '/' . $image->getClientFileName()
); );
break; break;
default: default:
$response = [ $response = [
"message" => "Image Added. Very slick", 'message' => 'Image Added. Very slick',
"type" => "postImageAdded", 'type' => 'postImageAdded',
"url" => 'url' => '/assets/images/blog/' . $path . '/' . $image->getClientFileName(),
"/assets/images/blog/" . $path . "/" . $image->getClientFileName(),
]; ];
break; break;
} }

View file

@ -17,13 +17,13 @@ class InitAPI
//through settings. //through settings.
if (Setup::status()) { if (Setup::status()) {
$result = ["type" => "blogInitFail", "message" => "Site already set up"]; $result = ['type' => 'blogInitFail', 'message' => 'Site already set up'];
} else { } else {
switch ($task) { switch ($task) {
case "init": case 'init':
$result = Setup::init($request); $result = Setup::init($request);
break; break;
case "restore": case 'restore':
$result = Setup::restore($request); $result = Setup::restore($request);
break; break;
} }

View file

@ -2,8 +2,6 @@
namespace brain\api\v1; namespace brain\api\v1;
use Mni\FrontYAML\Parser;
use brain\api\v1\ImagesAPI;
use brain\data\Book; use brain\data\Book;
use brain\data\Settings; use brain\data\Settings;
use brain\data\Session; use brain\data\Session;
@ -19,87 +17,87 @@ class PagesAPI
public static function getPageContent($request, $args) public static function getPageContent($request, $args)
{ {
$task = $args["fourth"]; $task = $args['fourth'];
$pages = (new Book("../content/pages"))->getContents(); $pages = (new Book('../content/pages'))->getContents();
$content = []; $content = [];
foreach ($pages as $page) { foreach ($pages as $page) {
$entry = [ $entry = [
"id" => $page["id"], 'id' => $page['id'],
"uuid" => $page["uuid"], 'uuid' => $page['uuid'],
"title" => $page["title"], 'title' => $page['title'],
"feature" => $page["feature"], 'feature' => $page['feature'],
"path" => $page["path"], 'path' => $page['path'],
"layout" => $page["layout"], 'layout' => $page['layout'],
"tags" => $page["tags"], 'tags' => $page['tags'],
"author" => $page["author"], 'author' => $page['author'],
"created" => $page["created"], 'created' => $page['created'],
"updated" => $page["updated"], 'updated' => $page['updated'],
"deleted" => $page["deleted"], 'deleted' => $page['deleted'],
"menu" => $page["menu"], 'menu' => $page['menu'],
"featured" => $page["featured"], 'featured' => $page['featured'],
"published" => $page["published"], 'published' => $page['published'],
"slug" => $page["slug"], 'slug' => $page['slug'],
"content" => StringTools::sanitizeContent($page["content"]), 'content' => StringTools::sanitizeContent($page['content']),
]; ];
array_push($content, $entry); array_push($content, $entry);
} }
switch ($task) { switch ($task) {
case "published": case 'published':
$published = filter($content, function ($item) { $published = filter($content, function ($item) {
return $item["published"] == true && $item["deleted"] == false; return $item['published'] == true && $item['deleted'] == false;
}); });
$result = ["pages" => $published, "totalItems" => count($published)]; $result = ['pages' => $published, 'totalItems' => count($published)];
break; break;
case "featured": case 'featured':
$featured = filter($content, function ($item) { $featured = filter($content, function ($item) {
return $item["featured"] == true && $item["deleted"] == false; return $item['featured'] == true && $item['deleted'] == false;
}); });
$result = [ $result = [
"pages" => $featured, 'pages' => $featured,
"totalItems" => count($featured), 'totalItems' => count($featured),
]; ];
break; break;
case "menu": case 'menu':
$menu = filter($content, function ($item) { $menu = filter($content, function ($item) {
return $item["menu"] == true && $item["deleted"] == false; return $item['menu'] == true && $item['deleted'] == false;
}); });
$result = ["pages" => $menu, "totalItems" => count($menu)]; $result = ['pages' => $menu, 'totalItems' => count($menu)];
break; break;
case "single": case 'single':
$uuid = $args["fifth"]; $uuid = $args['fifth'];
$page = (new Book("../content/pages"))->findPageById($uuid); $page = (new Book('../content/pages'))->findPageById($uuid);
$entry = [ $entry = [
"id" => $page["id"], 'id' => $page['id'],
"uuid" => $page["uuid"], 'uuid' => $page['uuid'],
"title" => $page["title"], 'title' => $page['title'],
"feature" => $page["feature"], 'feature' => $page['feature'],
"path" => $page["path"], 'path' => $page['path'],
"layout" => $page["layout"], 'layout' => $page['layout'],
"tags" => $page["tags"], 'tags' => $page['tags'],
"author" => $page["author"], 'author' => $page['author'],
"created" => $page["created"], 'created' => $page['created'],
"updated" => $page["updated"], 'updated' => $page['updated'],
"deleted" => $page["deleted"], 'deleted' => $page['deleted'],
"menu" => $page["menu"], 'menu' => $page['menu'],
"featured" => $page["featured"], 'featured' => $page['featured'],
"published" => $page["published"], 'published' => $page['published'],
"slug" => $page["slug"], 'slug' => $page['slug'],
"content" => StringTools::sanitizeContent($page["content"]), 'content' => StringTools::sanitizeContent($page['content']),
]; ];
$result = $entry; $result = $entry;
break; break;
case "tags": case 'tags':
$result = Settings::getTags(); $result = Settings::getTags();
break; break;
default: default:
$result = [ $result = [
"message" => "Hm, no task. That's unfortunate", 'message' => "Hm, no task. That's unfortunate",
"type" => "TASK_NONE", 'type' => 'TASK_NONE',
]; ];
break; break;
} }
@ -108,36 +106,36 @@ class PagesAPI
public static function handlePageTask($request, $args) public static function handlePageTask($request, $args)
{ {
$task = $args["fourth"]; $task = $args['fourth'];
switch ($task) { switch ($task) {
case "delete": case 'delete':
case "create": case 'create':
case "write": case 'write':
$body = $request->getParsedBody(); $body = $request->getParsedBody();
$passed = true; $passed = true;
if (!isset($body["form_token"])) { if (!isset($body['form_token'])) {
$result = [ $result = [
"message" => "No form token. Not good, sport.", 'message' => 'No form token. Not good, sport.',
"type" => "TASK_FORM_AUTH", 'type' => 'TASK_FORM_AUTH',
]; ];
} else { } else {
if ($body["form_token"] == Session::get("form_token")) { if ($body['form_token'] == Session::get('form_token')) {
//TODO: Verify form fields //TODO: Verify form fields
$keys = [ $keys = [
"id", 'id',
"uuid", 'uuid',
"layout", 'layout',
"current_title", 'current_title',
"content", 'content',
"title", 'title',
"created", 'created',
"slug", 'slug',
"tags", 'tags',
"menu", 'menu',
"featured", 'featured',
"published", 'published',
"form_token", 'form_token',
"feature_image", 'feature_image',
]; ];
foreach ($body as $key => $item) { foreach ($body as $key => $item) {
@ -150,27 +148,26 @@ class PagesAPI
$result = (new Book())->editPage($task, $request); $result = (new Book())->editPage($task, $request);
} else { } else {
$result = [ $result = [
"message" => 'message' => 'Unneccessary key found. Post not authorized, slick.',
"Unneccessary key found. Post not authorized, slick.", 'type' => 'TASK_FORM_AUTH',
"type" => "TASK_FORM_AUTH",
]; ];
} }
} else { } else {
$result = [ $result = [
"message" => "Form token, auth failed. Uh oh.", 'message' => 'Form token, auth failed. Uh oh.',
"type" => "TASK_FORM_AUTH", 'type' => 'TASK_FORM_AUTH',
]; ];
} }
} }
break; break;
case "add-entry-image": case 'add-entry-image':
$result = ImagesAPI::uploadImage($request); $result = ImagesAPI::uploadImage($request);
break; break;
default: default:
$result = [ $result = [
"message" => "Hm, no task. That's unfortunate", 'message' => "Hm, no task. That's unfortunate",
"type" => "TASK_NONE", 'type' => 'TASK_NONE',
]; ];
break; break;
} }

View file

@ -2,8 +2,6 @@
namespace brain\api\v1; namespace brain\api\v1;
use Slim\Views\Twig;
use brain\api\v1\ImagesApi;
use brain\data\Render; use brain\data\Render;
use brain\data\Settings; use brain\data\Settings;
use brain\data\Session; use brain\data\Session;
@ -17,42 +15,42 @@ class SettingsAPI
public static function handleSettingsTask($request, $args, $body = null) public static function handleSettingsTask($request, $args, $body = null)
{ {
$task = $args["fourth"]; $task = $args['fourth'];
switch ($task) { switch ($task) {
case "publish": case 'publish':
//check settings to see if site is a one pager //check settings to see if site is a one pager
$config = new Settings(); $config = new Settings();
$settings = $config->getSettings(); $settings = $config->getSettings();
$theme = $settings["global"]["theme"]; $theme = $settings['global']['theme'];
$themeConfig = json_decode( $themeConfig = json_decode(
file_get_contents("../content/themes/" . $theme . "/theme.json"), file_get_contents('../content/themes/' . $theme . '/theme.json'),
true true
); );
//check to see if dynamic rendering is active //check to see if dynamic rendering is active
if ( if (
isset($settings["global"]["dynamicRender"]) && isset($settings['global']['dynamicRender']) &&
$settings["global"]["dynamicRender"] === "true" $settings['global']['dynamicRender'] === 'true'
) { ) {
$result = [ $result = [
"message" => "Dynamic Render Active! You're good!", 'message' => "Dynamic Render Active! You're good!",
"type" => "RENDER_SUCCESS", 'type' => 'RENDER_SUCCESS',
]; ];
} else { } else {
$render = new Render(); $render = new Render();
if (isset($themeConfig["render"])) { if (isset($themeConfig['render'])) {
if (!$themeConfig["render"] || $themeConfig["render"] === "false") { if (!$themeConfig['render'] || $themeConfig['render'] === 'false') {
$render->renderIndex(); $render->renderIndex();
$result = [ $result = [
"message" => "Index Rendered. HAND CLAPS", 'message' => 'Index Rendered. HAND CLAPS',
"type" => "RENDER_SUCCESS", 'type' => 'RENDER_SUCCESS',
]; ];
} else { } else {
$render->renderTags(); $render->renderTags();
$render->renderArchive(); $render->renderArchive();
$render->renderPages(); $render->renderPages();
$result = [ $result = [
"message" => "Site Rendered. GOOD EFFORT", 'message' => 'Site Rendered. GOOD EFFORT',
"type" => "RENDER_SUCCESS", 'type' => 'RENDER_SUCCESS',
]; ];
} }
} else { } else {
@ -61,8 +59,8 @@ class SettingsAPI
$render->renderArchive(); $render->renderArchive();
$render->renderPages(); $render->renderPages();
$result = [ $result = [
"message" => "Site Rendered. GOOD EFFORT", 'message' => 'Site Rendered. GOOD EFFORT',
"type" => "RENDER_SUCCESS", 'type' => 'RENDER_SUCCESS',
]; ];
} }
} }
@ -71,30 +69,30 @@ class SettingsAPI
//otherwise, render all pages according to theme template files //otherwise, render all pages according to theme template files
break; break;
case "add-avatar": case 'add-avatar':
$result = ImagesAPI::uploadImage($request, "avatar"); $result = ImagesAPI::uploadImage($request, 'avatar');
break; break;
case "add-feature-background": case 'add-feature-background':
$result = ImagesAPI::uploadImage($request, "background"); $result = ImagesAPI::uploadImage($request, 'background');
break; break;
case "sync": case 'sync':
Settings::sync($body); Settings::sync($body);
$result = [ $result = [
"message" => "Settings Synced. You're doing great!", 'message' => "Settings Synced. You're doing great!",
"type" => "settingsUpdated", 'type' => 'settingsUpdated',
]; ];
break; break;
case "nav-sync": case 'nav-sync':
Settings::navSync($body); Settings::navSync($body);
$result = [ $result = [
"message" => "Navigation updated. Very slick!", 'message' => 'Navigation updated. Very slick!',
"type" => "menuUpdated", 'type' => 'menuUpdated',
]; ];
break; break;
default: default:
$result = [ $result = [
"message" => "Hm, no task. That's unfortunate", 'message' => "Hm, no task. That's unfortunate",
"type" => "TASK_NONE", 'type' => 'TASK_NONE',
]; ];
break; break;
} }
@ -104,42 +102,42 @@ class SettingsAPI
public static function getInfo($request, $args) public static function getInfo($request, $args)
{ {
$task = $args["fourth"]; $task = $args['fourth'];
switch ($task) { switch ($task) {
case "site": case 'site':
$config = new Settings(); $config = new Settings();
$settings = $config->getSettings(); $settings = $config->getSettings();
$data = [ $data = [
"title" => $settings["global"]["title"], 'title' => $settings['global']['title'],
"base_url" => $settings["global"]["base_url"], 'base_url' => $settings['global']['base_url'],
"description" => $settings["global"]["descriptions"], 'description' => $settings['global']['descriptions'],
]; ];
$result = [ $result = [
"message" => "Settings Found", 'message' => 'Settings Found',
"type" => "GET_SETTINGS", 'type' => 'GET_SETTINGS',
"data" => $data, 'data' => $data,
]; ];
break; break;
case "member": case 'member':
if (Session::active()) { if (Session::active()) {
$member = $member = Session::get("member"); $member = $member = Session::get('member');
$data = ["handle" => $member["handle"], "email" => $member["email"]]; $data = ['handle' => $member['handle'], 'email' => $member['email']];
$result = [ $result = [
"message" => "Member Info Found", 'message' => 'Member Info Found',
"type" => "GET_MEMBER_INFO", 'type' => 'GET_MEMBER_INFO',
"data" => $data, 'data' => $data,
]; ];
} else { } else {
$result = [ $result = [
"message" => "Not logged in. C'mon, bruh", 'message' => "Not logged in. C'mon, bruh",
"type" => "TASK_NONE", 'type' => 'TASK_NONE',
]; ];
} }
break; break;
default: default:
$result = [ $result = [
"message" => "No Settings found. Frowny Face", 'message' => 'No Settings found. Frowny Face',
"type" => "TASK_NONE", 'type' => 'TASK_NONE',
]; ];
break; break;
} }

View file

@ -5,7 +5,6 @@ namespace brain\controller;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use brain\api\v1\AuthAPI; use brain\api\v1\AuthAPI;
use brain\api\v1\ImagesAPI;
use brain\api\v1\PagesAPI; use brain\api\v1\PagesAPI;
use brain\api\v1\SettingsAPI; use brain\api\v1\SettingsAPI;
use brain\api\v1\InitAPI; use brain\api\v1\InitAPI;
@ -20,54 +19,54 @@ class APIControl
ResponseInterface $response, ResponseInterface $response,
array $args array $args
): ResponseInterface { ): ResponseInterface {
$filename = ""; $filename = '';
switch (isset($args["third"]) ? $args["third"] : "none") { switch (isset($args['third']) ? $args['third'] : 'none') {
case "status": case 'status':
$result = AuthAPI::status(); $result = AuthAPI::status();
break; break;
case "page": case 'page':
//echo //echo
if (Member::verifyKey($_GET["key"])) { if (Member::verifyKey($_GET['key'])) {
$result = PagesAPI::getPageContent($request, $args); $result = PagesAPI::getPageContent($request, $args);
} else { } else {
$result = [ $result = [
"message" => "API access denied, homie", 'message' => 'API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
break; break;
case "settings": case 'settings':
$token = $request->getHeader("fipamo-access-token"); $token = $request->getHeader('fipamo-access-token');
//Verify token to get site info //Verify token to get site info
if (isset($token[0])) { if (isset($token[0])) {
if (Session::verifyToken($token[0])) { if (Session::verifyToken($token[0])) {
$result = SettingsAPI::getInfo($request, $args); $result = SettingsAPI::getInfo($request, $args);
} else { } else {
$result = [ $result = [
"message" => "Invalid token, API access denied, homie", 'message' => 'Invalid token, API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
} else { } else {
$result = [ $result = [
"message" => "No token, API access denied, homie", 'message' => 'No token, API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
break; break;
case "files": case 'files':
if (Session::active()) { if (Session::active()) {
if ($args["third"] == "backup") { if ($args['third'] == 'backup') {
$filename = "../config/backups/latest_backup.zip"; $filename = '../config/backups/latest_backup.zip';
if (file_exists($filename)) { if (file_exists($filename)) {
header("Content-Type: application/zip"); header('Content-Type: application/zip');
header( header(
'Content-Disposition: attachment; filename="' . 'Content-Disposition: attachment; filename="' .
basename($filename) . basename($filename) .
'"' '"'
); );
header("Content-Length: " . filesize($filename)); header('Content-Length: ' . filesize($filename));
flush(); flush();
// return readfile($filename); // return readfile($filename);
@ -78,8 +77,8 @@ class APIControl
} }
} else { } else {
$result = [ $result = [
"message" => "API access denied, homie", 'message' => 'API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
// no break // no break
@ -89,46 +88,47 @@ class APIControl
$freshResponse = $response; $freshResponse = $response;
if ($args["third"] == "files") { if ($args['third'] == 'files') {
$freshResponse $freshResponse
->getBody() ->getBody()
->write(file_get_contents("../config/backups/latest_back.zip")); ->write(file_get_contents('../config/backups/latest_back.zip'));
$freshResponse->withHeader("Content-Type", "application/zip"); $freshResponse->withHeader('Content-Type', 'application/zip');
return $freshResponse->withAddedHeader( return $freshResponse->withAddedHeader(
"Content-Disposition", 'Content-Disposition',
"attachment; filename=latest_backup.zip" 'attachment; filename=latest_backup.zip'
); );
} else { } else {
$response->getBody()->write(json_encode($result)); $response->getBody()->write(json_encode($result));
return $response->withHeader("Content-Type", "application/json"); return $response->withHeader('Content-Type', 'application/json');
} }
} }
public static function post( public static function post(
ServerRequestInterface $request, ServerRequestInterface $request,
ResponseInterface $response, ResponseInterface $response,
array $args array $args
): ResponseInterface { ): ResponseInterface {
$contentType = $request->getHeader("Content-Type"); $contentType = $request->getHeader('Content-Type');
switch ($contentType[0]) { switch ($contentType[0]) {
case "application/json": case 'application/json':
$body = json_decode(file_get_contents("php://input"), true); $body = json_decode(file_get_contents('php://input'), true);
break; break;
default: default:
break; break;
} }
switch (isset($args["third"]) ? $args["third"] : "none") { switch (isset($args['third']) ? $args['third'] : 'none') {
case "restore": //move to 'api/auth' case 'restore': //move to 'api/auth'
case "init": //move to 'api/auth' case 'init': //move to 'api/auth'
$task = $args["third"]; $task = $args['third'];
$result = InitApi::handleInitTasks( $result = InitApi::handleInitTasks(
$task, $task,
$task == "init" ? $body : $request $task == 'init' ? $body : $request
); );
break; break;
case "backup": //move to 'api/auth' case 'backup': //move to 'api/auth'
$token = $request->getHeader("fipamo-access-token"); $token = $request->getHeader('fipamo-access-token');
//Verify token for admin tasks //Verify token for admin tasks
$result = SettingsAPI::createBackup(); $result = SettingsAPI::createBackup();
/* /*
@ -143,15 +143,15 @@ class APIControl
} }
*/ */
break; break;
case "login": //move to 'api/auth' case 'login': //move to 'api/auth'
//check if request is remote and if so, verify token //check if request is remote and if so, verify token
if ($body["remote"] || $body["remote"] == "true") { if ($body['remote'] || $body['remote'] == 'true') {
if (Member::verifyKey($body["key"])) { if (Member::verifyKey($body['key'])) {
$result = AuthAPI::login($body); $result = AuthAPI::login($body);
} else { } else {
$result = [ $result = [
"message" => "API access denied, homie", 'message' => 'API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
} else { } else {
@ -160,46 +160,46 @@ class APIControl
} }
break; break;
case "logout": //move to 'api/auth' case 'logout': //move to 'api/auth'
$result = AuthAPI::logout($body); $result = AuthAPI::logout($body);
break; break;
case "get-secret": //move to 'api/auth' case 'get-secret': //move to 'api/auth'
$result = AuthAPI::requestSecret($body); $result = AuthAPI::requestSecret($body);
break; break;
case "reset-password": //move to 'api/auth' case 'reset-password': //move to 'api/auth'
$result = AuthAPI::resetPassword($body); $result = AuthAPI::resetPassword($body);
break; break;
case "page": case 'page':
$token = $request->getHeader("fipamo-access-token"); $token = $request->getHeader('fipamo-access-token');
//Verify token for admin tasks //Verify token for admin tasks
if (isset($token[0])) { if (isset($token[0])) {
if (Session::verifyToken($token[0])) { if (Session::verifyToken($token[0])) {
$result = PagesAPI::handlePageTask($request, $args); $result = PagesAPI::handlePageTask($request, $args);
} else { } else {
$result = [ $result = [
"message" => "Invalid token, API access denied, homie", 'message' => 'Invalid token, API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
} else { } else {
$result = [ $result = [
"message" => "No token, API access denied, homie", 'message' => 'No token, API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
break; break;
case "settings": case 'settings':
if (isset($body)) { if (isset($body)) {
$postBody = $body; $postBody = $body;
} else { } else {
$postBody = null; $postBody = null;
} }
$task = $args["fourth"]; $task = $args['fourth'];
if ($task == "add-feature-background" || $task == "add-avatar") { if ($task == 'add-feature-background' || $task == 'add-avatar') {
$result = SettingsAPI::handleSettingsTask($request, $args, $postBody); $result = SettingsAPI::handleSettingsTask($request, $args, $postBody);
} else { } else {
$token = $request->getHeader("fipamo-access-token"); $token = $request->getHeader('fipamo-access-token');
if (Session::verifyToken($token[0])) { if (Session::verifyToken($token[0])) {
$result = SettingsAPI::handleSettingsTask( $result = SettingsAPI::handleSettingsTask(
$request, $request,
@ -208,25 +208,25 @@ class APIControl
); );
} else { } else {
$result = [ $result = [
"message" => "API access denied, homie", 'message' => 'API access denied, homie',
"type" => "API_ERROR", 'type' => 'API_ERROR',
]; ];
} }
} }
break; break;
case "mailer": case 'mailer':
$result = MailerAPI::handleMail($request, $body, $response); $result = MailerAPI::handleMail($request, $body, $response);
break; break;
default: default:
$result = [ $result = [
"message" => "Oh, nothing to do. That's unfortunate", 'message' => "Oh, nothing to do. That's unfortunate",
"type" => "TASK_NONE", 'type' => 'TASK_NONE',
]; ];
break; break;
} }
$response->getBody()->write(json_encode($result)); $response->getBody()->write(json_encode($result));
return $response->withHeader("Content-Type", "application/json"); return $response->withHeader('Content-Type', 'application/json');
} }
} }

View file

@ -157,8 +157,7 @@ class DashControl
$book = new Book(); $book = new Book();
$page = $book->findPageById($uuid); $page = $book->findPageById($uuid);
$pageOptions = Sorting::page($page); $pageOptions = Sorting::page($page);
$preview = $preview = $settings['global']['theme'] .
$settings['global']['theme'] .
'/' . '/' .
$page['layout'] . $page['layout'] .
'.twig'; '.twig';

View file

@ -22,49 +22,48 @@ class IndexControl
$settings = $config->getSettings(); $settings = $config->getSettings();
$view = Twig::fromRequest($request); $view = Twig::fromRequest($request);
//checks dynamic render flag for site render status //checks dynamic render flag for site render status
if ($settings["global"]["dynamicRender"]) { if ($settings['global']['dynamicRender']) {
if ($settings["global"]["dynamicRender"] == "true") { if ($settings['global']['dynamicRender'] == 'true') {
$loader = new \Twig\Loader\FilesystemLoader("../content/themes"); $loader = new \Twig\Loader\FilesystemLoader('../content/themes');
$display = new \Twig\Environment($loader, []); $display = new \Twig\Environment($loader, []);
$template = ""; $template = '';
$pageOptions = []; $pageOptions = [];
$pageInfo = [ $pageInfo = [
"keywords" => isset($settings["global"]["keywords"]) 'keywords' => isset($settings['global']['keywords'])
? $settings["global"]["keywords"] ? $settings['global']['keywords']
: "fipamo, blog, jamstack, php, markdown, js", : 'fipamo, blog, jamstack, php, markdown, js',
"description" => $settings["global"]["descriptions"], 'description' => $settings['global']['descriptions'],
"image" => 'image' => $settings['global']['base_url'] . $settings['global']['background'],
$settings["global"]["base_url"] . $settings["global"]["background"], 'baseURL' => $settings['global']['base_url'],
"baseURL" => $settings["global"]["base_url"],
]; ];
if (isset($args["first"])) { if (isset($args['first'])) {
switch ($args["first"]) { switch ($args['first']) {
case "tags": case 'tags':
$template = $settings["global"]["theme"] . "/tags.twig"; $template = $settings['global']['theme'] . '/tags.twig';
$tag = trim($args["second"]); $tag = trim($args['second']);
$taglist = Sorting::tags(); $taglist = Sorting::tags();
$item = find($taglist, ["tag_name" => $tag]); $item = find($taglist, ['tag_name' => $tag]);
$pageOptions = [ $pageOptions = [
"title" => "Pages Tagged as " . $item["tag_name"], 'title' => 'Pages Tagged as ' . $item['tag_name'],
"background" => $pageInfo["image"], 'background' => $pageInfo['image'],
"tag_list" => $item["pages"], 'tag_list' => $item['pages'],
"info" => $pageInfo, 'info' => $pageInfo,
"menu" => $settings["menu"], 'menu' => $settings['menu'],
"dynamicRender" => $settings["global"]["dynamicRender"], 'dynamicRender' => $settings['global']['dynamicRender'],
]; ];
break; break;
case "archives": case 'archives':
$archive = Sorting::archive(); $archive = Sorting::archive();
$template = $settings["global"]["theme"] . "/archive.twig"; $template = $settings['global']['theme'] . '/archive.twig';
$pageOptions = [ $pageOptions = [
"title" => "Archive", 'title' => 'Archive',
"background" => $pageInfo["image"], 'background' => $pageInfo['image'],
"archives" => $archive, 'archives' => $archive,
"info" => $pageInfo, 'info' => $pageInfo,
"menu" => $settings["menu"], 'menu' => $settings['menu'],
"dynamicRender" => $settings["global"]["dynamicRender"], 'dynamicRender' => $settings['global']['dynamicRender'],
]; ];
break; break;
@ -72,22 +71,20 @@ class IndexControl
//check if page is a menu item, if not render along path as usual //check if page is a menu item, if not render along path as usual
$page = []; $page = [];
$book = new Book(); $book = new Book();
if (is_numeric($args["first"])) { if (is_numeric($args['first'])) {
$page = $book->findPageBySlug($args["third"]); $page = $book->findPageBySlug($args['third']);
} else { } else {
$page = $book->findPageBySlug($args["first"]); $page = $book->findPageBySlug($args['first']);
} }
$template = $template = $settings['global']['theme'] . '/' . $page['layout'] . '.twig';
$settings["global"]["theme"] . "/" . $page["layout"] . ".twig";
$pageOptions = Sorting::page($page); $pageOptions = Sorting::page($page);
break; break;
} }
} else { } else {
//index //index
$template = $template = $settings['global']['theme'] . '/' . $page['layout'] . '.twig';
$settings["global"]["theme"] . "/" . $page["layout"] . ".twig"; $book = new Book('');
$book = new Book("");
$page = $book->findPageBySlug(); $page = $book->findPageBySlug();
$pageOptions = Sorting::page($page); $pageOptions = Sorting::page($page);
} }
@ -98,14 +95,14 @@ class IndexControl
} else { } else {
//if dynamic flag is false, load up html //if dynamic flag is false, load up html
$view = Twig::fromRequest($request); $view = Twig::fromRequest($request);
$html = file_get_contents("../public/index.html"); $html = file_get_contents('../public/index.html');
$response->getBody()->write($html); $response->getBody()->write($html);
return $response; return $response;
} }
} else { } else {
//if flag is not present, default to static html //if flag is not present, default to static html
$view = Twig::fromRequest($request); $view = Twig::fromRequest($request);
$html = file_get_contents("../public/index.html"); $html = file_get_contents('../public/index.html');
$response->getBody()->write($html); $response->getBody()->write($html);
return $response; return $response;
} }

View file

@ -4,9 +4,6 @@ namespace brain\controller;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use brain\controller\DashControl;
use brain\controller\APIControl;
use brain\controller\IndexControl;
class RouteControl class RouteControl
{ {
@ -15,11 +12,11 @@ class RouteControl
ResponseInterface $response, ResponseInterface $response,
array $args array $args
): ResponseInterface { ): ResponseInterface {
switch (isset($args["first"]) ? $args["first"] : "index") { switch (isset($args['first']) ? $args['first'] : 'index') {
case "dashboard": case 'dashboard':
return DashControl::start($request, $response, $args); return DashControl::start($request, $response, $args);
break; break;
case "api": case 'api':
return APIControl::get($request, $response, $args); return APIControl::get($request, $response, $args);
break; break;
default: default:
@ -33,8 +30,8 @@ class RouteControl
ResponseInterface $response, ResponseInterface $response,
array $args array $args
): ResponseInterface { ): ResponseInterface {
switch (isset($args["first"]) ? $args["first"] : "index") { switch (isset($args['first']) ? $args['first'] : 'index') {
case "api": case 'api':
//$result = APIControl::post($request, $response, $args); //$result = APIControl::post($request, $response, $args);
//var_dump($result); //var_dump($result);
return APIControl::post($request, $response, $args); return APIControl::post($request, $response, $args);

View file

@ -3,8 +3,6 @@
namespace brain\data; namespace brain\data;
use ReallySimpleJWT\Token; use ReallySimpleJWT\Token;
use brain\data\Settings;
use brain\data\Session;
use function _\find; use function _\find;
@ -16,7 +14,7 @@ class Auth
public static function sessionStatus() public static function sessionStatus()
{ {
if (isset($_SESSION["member"])) { if (isset($_SESSION['member'])) {
return true; return true;
} else { } else {
return false; return false;
@ -26,7 +24,7 @@ class Auth
public static function status() public static function status()
{ {
$result = ""; $result = '';
if (Session::active()) { if (Session::active()) {
$result = true; $result = true;
} else { } else {
@ -39,39 +37,39 @@ class Auth
{ {
//grab member list //grab member list
$folks = (new Settings())->getFolks(); $folks = (new Settings())->getFolks();
$found = find($folks, ["handle" => $who["handle"]]); $found = find($folks, ['handle' => $who['handle']]);
if ($found) { if ($found) {
//name is found, verify password //name is found, verify password
if (password_verify($who["password"], $found["password"])) { if (password_verify($who['password'], $found['password'])) {
$member = [ $member = [
"handle" => $found["handle"], 'handle' => $found['handle'],
"email" => $found["email"], 'email' => $found['email'],
"role" => $found["role"], 'role' => $found['role'],
"avatar" => $found["avi"], 'avatar' => $found['avi'],
"key" => $found["key"], 'key' => $found['key'],
]; ];
$token = Token::create( $token = Token::create(
$found["key"], $found['key'],
$found["secret"], $found['secret'],
time() + 3600, time() + 3600,
"localhost" 'localhost'
); //expires in an hour ); //expires in an hour
$form_token = md5(uniqid(microtime(), true)); $form_token = md5(uniqid(microtime(), true));
Session::start(); Session::start();
Session::set("member", $member); Session::set('member', $member);
Session::set("token", $token); Session::set('token', $token);
Session::set("form_token", $form_token); Session::set('form_token', $form_token);
$result = "good_login"; $result = 'good_login';
} else { } else {
$result = "bad_pass"; $result = 'bad_pass';
} }
} else { } else {
//if name is not found //if name is not found
$result = "no_name"; $result = 'no_name';
} }
return $result; return $result;
} }
@ -81,38 +79,35 @@ class Auth
$result = []; $result = [];
$folks = (new Settings())->getFolks(); $folks = (new Settings())->getFolks();
if ( if (!empty($data['email']) && filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
!empty($data["email"]) && $found = find($folks, ['email' => $data['email']]);
filter_var($data["email"], FILTER_VALIDATE_EMAIL)
) {
$found = find($folks, ["email" => $data["email"]]);
if ($found) { if ($found) {
//if email is cool, check mail relay status //if email is cool, check mail relay status
//if set up, send secret there, if not just return it //if set up, send secret there, if not just return it
$config = new Settings(); $config = new Settings();
$settings = $config->getSettings(); $settings = $config->getSettings();
$email = $settings["email"]["active"]; $email = $settings['email']['active'];
if ($email != "option-none") { if ($email != 'option-none') {
$data["mail_task"] = "SEND_SECRET"; $data['mail_task'] = 'SEND_SECRET';
$data["secret"] = $found["secret"]; $data['secret'] = $found['secret'];
$result = Mailer::sendmail($data); $result = Mailer::sendmail($data);
} else { } else {
$result = [ $result = [
"message" => "Valid email, but no email set up!", 'message' => 'Valid email, but no email set up!',
"type" => "secretFound", 'type' => 'secretFound',
"secret" => $found["secret"], 'secret' => $found['secret'],
]; ];
} }
} else { } else {
$result = [ $result = [
"message" => "No valid email, no goodies, pleighboi", 'message' => 'No valid email, no goodies, pleighboi',
"type" => "secretNotFound", 'type' => 'secretNotFound',
]; ];
} }
} else { } else {
$result = [ $result = [
"message" => "Aye, this address is not right, slick.", 'message' => 'Aye, this address is not right, slick.',
"type" => "secretNotFound", 'type' => 'secretNotFound',
]; ];
} }
@ -122,30 +117,30 @@ class Auth
public static function makeNewPassword($data) public static function makeNewPassword($data)
{ {
//check if passwordsmatch //check if passwordsmatch
if ($data["newPass"] == $data["newPassConfirm"]) { if ($data['newPass'] == $data['newPassConfirm']) {
//verify secret //verify secret
$folks = (new Settings())->getFolks(); $folks = (new Settings())->getFolks();
$found = find($folks, ["secret" => $data["secret"]]); $found = find($folks, ['secret' => $data['secret']]);
if ($found) { if ($found) {
//create new pass and secret key, then update file //create new pass and secret key, then update file
$hash = password_hash($data["newPass"], PASSWORD_DEFAULT); $hash = password_hash($data['newPass'], PASSWORD_DEFAULT);
$freshSecret = StringTools::randomString(12); $freshSecret = StringTools::randomString(12);
Member::updateData("password", $hash, $data["secret"]); Member::updateData('password', $hash, $data['secret']);
Member::updateData("secret", $freshSecret, $data["secret"]); Member::updateData('secret', $freshSecret, $data['secret']);
$result = [ $result = [
"message" => "Password Updated. Very nice!", 'message' => 'Password Updated. Very nice!',
"type" => "passCreated", 'type' => 'passCreated',
]; ];
} else { } else {
$result = [ $result = [
"message" => "Secret key is invalid. Try to retrieve it again", 'message' => 'Secret key is invalid. Try to retrieve it again',
"type" => "passNotCreated", 'type' => 'passNotCreated',
]; ];
} }
} else { } else {
$result = [ $result = [
"message" => "Passwords don't match. Try it again.", 'message' => "Passwords don't match. Try it again.",
"type" => "passNotCreated", 'type' => 'passNotCreated',
]; ];
} }

View file

@ -2,11 +2,12 @@
namespace brain\data; namespace brain\data;
use function _\filter;
use function _\find;
use brain\utility\DocTools; use brain\utility\DocTools;
use brain\utility\FileUploader;
use brain\utility\StringTools; use brain\utility\StringTools;
use brain\utility\FileUploader;
use function _\find;
use function _\filter;
class Book class Book
{ {
@ -51,8 +52,7 @@ class Book
$member = Session::get('member'); $member = Session::get('member');
if ($task != 'create') { if ($task != 'create') {
$path = $path = date('Y', date($page['rawCreated'])) .
date('Y', date($page['rawCreated'])).
'/' . '/' .
date('m', date($page['rawCreated'])); date('m', date($page['rawCreated']));
} else { } else {
@ -74,8 +74,7 @@ class Book
case 'image/gif': case 'image/gif':
case 'image/svg': case 'image/svg':
$imagesPath = '/assets/images/blog/' . $path . '/'; $imagesPath = '/assets/images/blog/' . $path . '/';
$imageList = $imageList = $imageList . $imagesPath . urlencode($file->getClientFileName()) . ', ';
$imageList.$imagesPath.urlencode($file->getClientFileName()).', ';
FileUploader::uploadFile( FileUploader::uploadFile(
'../public/assets/images/blog/' . $path . '/', '../public/assets/images/blog/' . $path . '/',
@ -84,8 +83,7 @@ class Book
break; break;
case 'video/mp4': case 'video/mp4':
$videosPath = '/assets/video/blog/' . $path . '/'; $videosPath = '/assets/video/blog/' . $path . '/';
$imageList = $imageList = $imageList . $videosPath . urlencode($file->getClientFileName()) . ', ';
$imageList.$videosPath.urlencode($file->getClientFileName()).', ';
FileUploader::uploadFile( FileUploader::uploadFile(
'../public/assets/video/blog/' . $path . '/', '../public/assets/video/blog/' . $path . '/',
@ -131,8 +129,7 @@ class Book
$deleted = isset($page['deleted']) ? $page['deleted'] : 'false'; $deleted = isset($page['deleted']) ? $page['deleted'] : 'false';
} }
$created = $created = $task != 'create'
$task != 'create'
? new \Moment\Moment($page['rawCreated']) ? new \Moment\Moment($page['rawCreated'])
: new \Moment\Moment(); : new \Moment\Moment();
$updated = new \Moment\Moment(); $updated = new \Moment\Moment();

View file

@ -2,18 +2,18 @@
namespace brain\data; namespace brain\data;
use HtmlSanitizer\SanitizerBuilder;
use League\CommonMark\MarkdownConverter;
use League\CommonMark\Environment\Environment; use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use HtmlSanitizer\Extension\Basic\BasicExtension;
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension; use HtmlSanitizer\Extension\Listing\ListExtension;
use HtmlSanitizer\Extension\Iframe\IframeExtension;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\Extension\Attributes\AttributesExtension; use League\CommonMark\Extension\Attributes\AttributesExtension;
use League\CommonMark\Extension\FrontMatter\FrontMatterExtension; use League\CommonMark\Extension\FrontMatter\FrontMatterExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
use League\CommonMark\Extension\FrontMatter\Output\RenderedContentWithFrontMatter; use League\CommonMark\Extension\FrontMatter\Output\RenderedContentWithFrontMatter;
use League\CommonMark\MarkdownConverter;
use League\CommonMark\CommonMarkConverter;
use HtmlSanitizer\Extension\Basic\BasicExtension;
use HtmlSanitizer\Extension\Iframe\IframeExtension;
use HtmlSanitizer\Extension\Listing\ListExtension;
use HtmlSanitizer\SanitizerBuilder;
use function _\orderBy; use function _\orderBy;
@ -21,10 +21,12 @@ class Contents
{ {
public $files = []; public $files = [];
public $config = []; public $config = [];
public function __construct($folder) public function __construct($folder)
{ {
$this->read($folder); $this->read($folder);
} }
public function read($folder) public function read($folder)
{ {
$folders = glob("$folder/*", GLOB_ONLYDIR); $folders = glob("$folder/*", GLOB_ONLYDIR);
@ -32,7 +34,7 @@ class Contents
//$this->files[] = $folder . "/"; //$this->files[] = $folder . "/";
$this->read($folder); $this->read($folder);
} }
$files = array_filter(glob("$folder/*md"), "is_file"); $files = array_filter(glob("$folder/*md"), 'is_file');
foreach ($files as $file) { foreach ($files as $file) {
$this->files[] = $file; $this->files[] = $file;
} }
@ -52,6 +54,9 @@ class Contents
//add attributes to elements in markdown //add attributes to elements in markdown
$environment->addExtension(new AttributesExtension()); $environment->addExtension(new AttributesExtension());
//add table rendering
$environment->addExtension(new TableExtension());
// Instantiate the converter engine and start converting some Markdown! // Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment); $converter = new MarkdownConverter($environment);
@ -76,6 +81,8 @@ class Contents
$builder->registerExtension(new BasicExtension()); $builder->registerExtension(new BasicExtension());
$builder->registerExtension(new IframeExtension()); $builder->registerExtension(new IframeExtension());
$builder->registerExtension(new ListExtension()); $builder->registerExtension(new ListExtension());
//just add it straight because classname is already in use
$builder->registerExtension(new \HtmlSanitizer\Extension\Table\TableExtension());
//relative-a and relative-image //relative-a and relative-image
$builder->registerExtension( $builder->registerExtension(
@ -86,16 +93,16 @@ class Contents
); );
$detergent = [ $detergent = [
"extensions" => ["basic", "list","relative-a", "relative-image", "iframe"], 'extensions' => ['basic', 'list', 'relative-a', 'relative-image', 'iframe', 'table'],
"tags" => [ 'tags' => [
"div" => [ 'div' => [
"allowed_attributes" => ["class", "title", "id", "style"], 'allowed_attributes' => ['class', 'title', 'id', 'style'],
], ],
"img" => [ 'img' => [
"allowed_attributes" => ["src", "alt", "title", "class"], 'allowed_attributes' => ['src', 'alt', 'title', 'class'],
], ],
"iframe" => [ 'iframe' => [
"allowed_attributes" => ["height", "width", "title", "src"], 'allowed_attributes' => ['height', 'width', 'title', 'src'],
], ],
], ],
]; ];
@ -103,11 +110,11 @@ class Contents
$sanitizer = $builder->build($detergent); $sanitizer = $builder->build($detergent);
$scrubbed = $sanitizer->sanitize($result->getContent()); $scrubbed = $sanitizer->sanitize($result->getContent());
$featureList = explode(",", $meta["feature"]); $featureList = explode(',', $meta['feature']);
$docs = ''; $docs = '';
if (isset($meta["files"])) { if (isset($meta['files'])) {
$fileList = explode(",", $meta["files"]); $fileList = explode(',', $meta['files']);
$docs = $meta["files"]; $docs = $meta['files'];
} else { } else {
$fileList = []; $fileList = [];
$docs = ''; $docs = '';
@ -118,52 +125,52 @@ class Contents
foreach ($featureList as $file) { foreach ($featureList as $file) {
$item = trim($file); $item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION); $ext = pathinfo($item, PATHINFO_EXTENSION);
if ($item != null || $item != "") { if ($item != null || $item != '') {
array_push($media, ["file" => $item, "type" => trim($ext)]); array_push($media, ['file' => $item, 'type' => trim($ext)]);
} }
} }
foreach ($fileList as $file) { foreach ($fileList as $file) {
$item = trim($file); $item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION); $ext = pathinfo($item, PATHINFO_EXTENSION);
if ($item != null || $item != "") { if ($item != null || $item != '') {
array_push($files, ["file" => $item, "type" => trim($ext)]); array_push($files, ['file' => $item, 'type' => trim($ext)]);
} }
} }
//sort attributes into page object //sort attributes into page object
$page = [ $page = [
"id" => $meta["id"], 'id' => $meta['id'],
"uuid" => $meta["uuid"], 'uuid' => $meta['uuid'],
"title" => $meta["title"], 'title' => $meta['title'],
"feature" => $meta["feature"], 'feature' => $meta['feature'],
"files" => $docs, 'files' => $docs,
"path" => $meta["path"], 'path' => $meta['path'],
"layout" => $meta["layout"], 'layout' => $meta['layout'],
"tags" => $meta["tags"], 'tags' => $meta['tags'],
"author" => $meta["author"], 'author' => $meta['author'],
"created" => date("Y M D d", $meta["created"]), 'created' => date('Y M D d', $meta['created']),
"updated" => date("Y M D d", $meta["updated"]), 'updated' => date('Y M D d', $meta['updated']),
"rawCreated" => $meta["created"], 'rawCreated' => $meta['created'],
"rawUpdated" => $meta["updated"], 'rawUpdated' => $meta['updated'],
"createdYear" => date("Y", $meta["created"]), 'createdYear' => date('Y', $meta['created']),
"createdMonth" => date("m", $meta["created"]), 'createdMonth' => date('m', $meta['created']),
"deleted" => $meta["deleted"], 'deleted' => $meta['deleted'],
"menu" => $meta["menu"], 'menu' => $meta['menu'],
"featured" => $meta["featured"], 'featured' => $meta['featured'],
"published" => $meta["published"], 'published' => $meta['published'],
"slug" => $meta["slug"], 'slug' => $meta['slug'],
"filePath" => $file, 'filePath' => $file,
"content" => $parsed->getContent(), 'content' => $parsed->getContent(),
"html" => $scrubbed, 'html' => $scrubbed,
"media" => $media, 'media' => $media,
"docs" => $files 'docs' => $files
]; ];
//checks for duplicates //checks for duplicates
$uuid = $meta["uuid"]; $uuid = $meta['uuid'];
$found = current( $found = current(
array_filter($contents, function ($item) use ($uuid) { array_filter($contents, function ($item) use ($uuid) {
return isset($item["uuid"]) && $uuid == $item["uuid"]; return isset($item['uuid']) && $uuid == $item['uuid'];
}) })
); );
@ -172,7 +179,7 @@ class Contents
array_push($contents, $page); array_push($contents, $page);
} }
} }
$contents = orderBy($contents, ["id"], ["desc"]); $contents = orderBy($contents, ['id'], ['desc']);
return $contents; return $contents;
} }
} }

View file

@ -2,8 +2,6 @@
namespace brain\data; namespace brain\data;
use brain\data\Settings;
use brain\data\Session;
use brain\utility\DocTools; use brain\utility\DocTools;
use function _\find; use function _\find;
@ -18,7 +16,7 @@ class Member
{ {
if (isset($key)) { if (isset($key)) {
$folks = (new Settings())->getFolks(); $folks = (new Settings())->getFolks();
$found = find($folks, ["key" => $key]); $found = find($folks, ['key' => $key]);
if ($found) { if ($found) {
return true; return true;
} else { } else {
@ -33,30 +31,30 @@ class Member
{ {
$folks = (new Settings())->getFolks(); $folks = (new Settings())->getFolks();
if (isset($secret)) { if (isset($secret)) {
$found = find($folks, ["secret" => $secret]); $found = find($folks, ['secret' => $secret]);
} else { } else {
$member = Session::get("member"); $member = Session::get('member');
$found = find($folks, ["handle" => $member["handle"]]); $found = find($folks, ['handle' => $member['handle']]);
} }
$found[$key] = $data; $found[$key] = $data;
//record time updated //record time updated
$updated = new \Moment\Moment(); $updated = new \Moment\Moment();
$found["updated"] = $updated->format("Y-m-d\TH:i:sP"); $found['updated'] = $updated->format("Y-m-d\TH:i:sP");
$newFolks = []; $newFolks = [];
array_push($newFolks, $found); array_push($newFolks, $found);
//save updated file //save updated file
DocTools::writeSettings("../config/folks.json", $newFolks); DocTools::writeSettings('../config/folks.json', $newFolks);
//update member data in session //update member data in session
if (!isset($secret)) { if (!isset($secret)) {
$member = [ $member = [
"handle" => $found["handle"], 'handle' => $found['handle'],
"email" => $found["email"], 'email' => $found['email'],
"role" => $found["role"], 'role' => $found['role'],
"avatar" => $found["avi"], 'avatar' => $found['avi'],
"key" => $found["key"], 'key' => $found['key'],
]; ];
Session::set("member", $member); Session::set('member', $member);
} }
} }
} }

View file

@ -2,9 +2,6 @@
namespace brain\data; namespace brain\data;
use Mni\FrontYAML\Parser;
use brain\data\Settings;
use brain\data\Book;
use brain\utility\Sorting; use brain\utility\Sorting;
use brain\utility\DocTools; use brain\utility\DocTools;
@ -17,38 +14,38 @@ class Render
public $pageInfo; public $pageInfo;
public $menu; public $menu;
public $background; public $background;
public function __construct() public function __construct()
{ {
$config = new Settings(); $config = new Settings();
//TODO: Add theme folder to loader //TODO: Add theme folder to loader
$settings = $config->getSettings(); $settings = $config->getSettings();
$this->menu = $settings["menu"]; $this->menu = $settings['menu'];
$this->theme = $settings["global"]["theme"]; $this->theme = $settings['global']['theme'];
$this->loader = new \Twig\Loader\FilesystemLoader("../content/themes/" . $this->theme); $this->loader = new \Twig\Loader\FilesystemLoader('../content/themes/' . $this->theme);
$this->twig = new \Twig\Environment($this->loader, []); $this->twig = new \Twig\Environment($this->loader, []);
$this->pageInfo = [ $this->pageInfo = [
"keywords" => isset($settings["global"]["keywords"]) 'keywords' => isset($settings['global']['keywords'])
? $settings["global"]["keywords"] ? $settings['global']['keywords']
: "fipamo, blog, jamstack, php, markdown, js", : 'fipamo, blog, jamstack, php, markdown, js',
"description" => $settings["global"]["descriptions"], 'description' => $settings['global']['descriptions'],
"image" => 'image' => $settings['global']['base_url'] . $settings['global']['background'],
$settings["global"]["base_url"] . $settings["global"]["background"], 'baseURL' => $settings['global']['base_url'],
"baseURL" => $settings["global"]["base_url"],
]; ];
//move global theme image assets to public folder //move global theme image assets to public folder
foreach ( foreach (
new \DirectoryIterator("../content/themes/" . $this->theme . "/assets/images/global/") as $file new \DirectoryIterator('../content/themes/' . $this->theme . '/assets/images/global/') as $file
) { ) {
if ($file->isDot()) { if ($file->isDot()) {
continue; continue;
} }
if (!is_file("../public/assets/images/global/" . $file->getFileName())) { if (!is_file('../public/assets/images/global/' . $file->getFileName())) {
copy( copy(
"../content/themes/" . '../content/themes/' .
$this->theme . $this->theme .
"/assets/images/global/" . '/assets/images/global/' .
$file->getFileName(), $file->getFileName(),
"../public/assets/images/global/" . $file->getFileName() '../public/assets/images/global/' . $file->getFileName()
); );
} else { } else {
//image is already there, so chill //image is already there, so chill
@ -72,24 +69,24 @@ class Render
$scripts = glob('../public/assets/scripts/*'); // get all file names $scripts = glob('../public/assets/scripts/*'); // get all file names
foreach ($scripts as $file) { // iterate files foreach ($scripts as $file) { // iterate files
if (is_file($file)) { if (is_file($file)) {
if (!$file == "../public/assets/scripts/Start.js") { if (!$file == '../public/assets/scripts/Start.js') {
unlink($file); // delete file unlink($file); // delete file
} }
} }
} }
//copy theme assets to public //copy theme assets to public
$newcss = glob("../content/themes/" . $this->theme . "/assets/css/*"); $newcss = glob('../content/themes/' . $this->theme . '/assets/css/*');
foreach ($newcss as $file) { // iterate files foreach ($newcss as $file) { // iterate files
if (is_file($file)) { if (is_file($file)) {
$path = explode("/", $file); $path = explode('/', $file);
copy($file, "../public/assets/css/" . $path[6]); copy($file, '../public/assets/css/' . $path[6]);
} }
} }
$newjs = glob("../content/themes/" . $this->theme . "/assets/scripts/*"); $newjs = glob('../content/themes/' . $this->theme . '/assets/scripts/*');
foreach ($newjs as $file) { // iterate files foreach ($newjs as $file) { // iterate files
if (is_file($file)) { if (is_file($file)) {
$path = explode("/", $file); $path = explode('/', $file);
copy($file, "../public/assets/scripts/" . $path[6]); copy($file, '../public/assets/scripts/' . $path[6]);
} }
} }
} }
@ -103,25 +100,24 @@ class Render
foreach ($pages as $page) { foreach ($pages as $page) {
$pageOptions = Sorting::page($page); $pageOptions = Sorting::page($page);
$layout = $page["layout"]; $layout = $page['layout'];
//new pages have no layout, so defautl for now //new pages have no layout, so defautl for now
if ($layout == "" || $layout == null) { if ($layout == '' || $layout == null) {
$layout = "page"; $layout = 'page';
} }
$template = $layout . ".twig"; $template = $layout . '.twig';
if (str_contains($page["layout"], "index")) { if (str_contains($page['layout'], 'index')) {
$location = "../public/index.html"; $location = '../public/index.html';
$dir = null; $dir = null;
} else { } else {
// if page is a menu item, render the page on public root // if page is a menu item, render the page on public root
if ($page["menu"] == "true") { if ($page['menu'] == 'true') {
$location = "../public/" . $page["slug"] . ".html"; $location = '../public/' . $page['slug'] . '.html';
$dir = "../public/"; $dir = '../public/';
} else { } else {
$location = $location = '../public/' . $page['path'] . '/' . $page['slug'] . '.html';
"../public/" . $page["path"] . "/" . $page["slug"] . ".html"; $dir = '../public/' . $page['path'];
$dir = "../public/" . $page["path"];
} }
} }
@ -133,17 +129,17 @@ class Render
public function renderArchive() public function renderArchive()
{ {
$archive = Sorting::archive(); $archive = Sorting::archive();
$template = "archive.twig"; $template = 'archive.twig';
$pageOptions = [ $pageOptions = [
"title" => "Archive", 'title' => 'Archive',
"background" => $this->pageInfo["image"], 'background' => $this->pageInfo['image'],
"archives" => $archive, 'archives' => $archive,
"info" => $this->pageInfo, 'info' => $this->pageInfo,
"menu" => $this->menu, 'menu' => $this->menu,
]; ];
$html = $this->twig->render($template, $pageOptions); $html = $this->twig->render($template, $pageOptions);
$location = "../public/archives.html"; $location = '../public/archives.html';
DocTools::writeHTML($location, $html); DocTools::writeHTML($location, $html);
} }
@ -151,29 +147,29 @@ class Render
{ {
$list = Sorting::tags(); $list = Sorting::tags();
foreach ($list as $item) { foreach ($list as $item) {
$template = "tags.twig"; $template = 'tags.twig';
$pageOptions = [ $pageOptions = [
"title" => "Pages Tagged as " . $item["tag_name"], 'title' => 'Pages Tagged as ' . $item['tag_name'],
"background" => $this->pageInfo["image"], 'background' => $this->pageInfo['image'],
"tag_list" => $item["pages"], 'tag_list' => $item['pages'],
"info" => $this->pageInfo, 'info' => $this->pageInfo,
"menu" => $this->menu, 'menu' => $this->menu,
]; ];
$html = $this->twig->render($template, $pageOptions); $html = $this->twig->render($template, $pageOptions);
$location = "../public/tags/" . $item["slug"] . ".html"; $location = '../public/tags/' . $item['slug'] . '.html';
//if tags folder doesn't exist, make it //if tags folder doesn't exist, make it
if (!is_dir("../public/tags")) { if (!is_dir('../public/tags')) {
mkdir("../public/tags", 0755, true); mkdir('../public/tags', 0755, true);
} else { } else {
} }
if (!is_file($location)) { if (!is_file($location)) {
file_put_contents($location, $html); file_put_contents($location, $html);
} else { } else {
($new = fopen($location, "w")) or die("Unable to open file!"); ($new = fopen($location, 'w')) or die('Unable to open file!');
fwrite($new, $html); fwrite($new, $html);
fclose($new); fclose($new);
} }
@ -184,20 +180,20 @@ class Render
{ {
//TODO: Need to fix this to account for new index templating system //TODO: Need to fix this to account for new index templating system
$pages = (new Book())->getContents(); $pages = (new Book())->getContents();
$index = find($pages, ["layout" => "index"]); $index = find($pages, ['layout' => 'index']);
$template = "index.twig"; $template = 'index.twig';
$location = "../public/index.html"; $location = '../public/index.html';
$dir = null; $dir = null;
$meta = [ $meta = [
"who" => $index["author"], 'who' => $index['author'],
"when" => $index["created"], 'when' => $index['created'],
]; ];
$pageOptions = [ $pageOptions = [
"title" => $index["title"], 'title' => $index['title'],
"background" => $index["feature"], 'background' => $index['feature'],
"meta" => $meta, 'meta' => $meta,
]; ];
$html = $this->twig->render($template, $pageOptions); $html = $this->twig->render($template, $pageOptions);

View file

@ -4,22 +4,21 @@ namespace brain\data;
use ReallySimpleJWT\Token; use ReallySimpleJWT\Token;
use function _\find;
class Session class Session
{ {
private static $file = "../content/.session"; private static $file = '../content/.session';
private static $data = [ private static $data = [
"member" => "", 'member' => '',
"token" => "", 'token' => '',
"form_token" => "", 'form_token' => '',
]; ];
public static function start() public static function start()
{ {
if (!is_file(self::$file)) { if (!is_file(self::$file)) {
file_put_contents(self::$file, json_encode(self::$data)); file_put_contents(self::$file, json_encode(self::$data));
} else { } else {
($new = fopen(self::$file, "w")) or die("Unable to open file!"); ($new = fopen(self::$file, 'w')) or die('Unable to open file!');
fwrite($new, json_encode(self::$data)); fwrite($new, json_encode(self::$data));
fclose($new); fclose($new);
} }
@ -31,14 +30,14 @@ class Session
return false; return false;
} else { } else {
$data = json_decode(file_get_contents(self::$file), true); $data = json_decode(file_get_contents(self::$file), true);
if ($data["member"] != null) { if ($data['member'] != null) {
$secret = (new Settings())->getFolks("secret"); $secret = (new Settings())->getFolks('secret');
if ($secret == null) { if ($secret == null) {
return false; return false;
} else { } else {
if ( if (
Token::validate($data["token"], $secret) && Token::validate($data['token'], $secret) &&
Token::validateExpiration($data["token"], $secret) Token::validateExpiration($data['token'], $secret)
) { ) {
return true; return true;
} else { } else {
@ -54,8 +53,8 @@ class Session
public static function verifyToken($token) public static function verifyToken($token)
{ {
$data = json_decode(file_get_contents(self::$file), true); $data = json_decode(file_get_contents(self::$file), true);
if ($data["member"] != null) { if ($data['member'] != null) {
$secret = (new Settings())->getFolks("secret"); $secret = (new Settings())->getFolks('secret');
if ( if (
Token::validate($token, $secret) && Token::validate($token, $secret) &&
Token::validateExpiration($token, $secret) Token::validateExpiration($token, $secret)
@ -73,7 +72,7 @@ class Session
{ {
$data = json_decode(file_get_contents(self::$file), true); $data = json_decode(file_get_contents(self::$file), true);
$data[$key] = $value; $data[$key] = $value;
($fresh = fopen(self::$file, "w")) or die("Unable to open file!"); ($fresh = fopen(self::$file, 'w')) or die('Unable to open file!');
fwrite($fresh, json_encode($data)); fwrite($fresh, json_encode($data));
fclose($fresh); fclose($fresh);
} }
@ -87,7 +86,7 @@ class Session
public static function kill() public static function kill()
{ {
($fresh = fopen(self::$file, "w")) or die("Unable to open file!"); ($fresh = fopen(self::$file, 'w')) or die('Unable to open file!');
fwrite($fresh, json_encode(self::$data)); fwrite($fresh, json_encode(self::$data));
fclose($fresh); fclose($fresh);
} }

View file

@ -2,7 +2,6 @@
namespace brain\data; namespace brain\data;
use brain\data\Member;
use brain\utility\DocTools; use brain\utility\DocTools;
use brain\utility\Sorting; use brain\utility\Sorting;
@ -19,10 +18,10 @@ class Settings
public function __construct() public function __construct()
{ {
//gets all settings files and converts to php objects //gets all settings files and converts to php objects
$this->folks = json_decode(file_get_contents("../config/folks.json"), true); $this->folks = json_decode(file_get_contents('../config/folks.json'), true);
self::$tags = json_decode(file_get_contents("../config/tags.json"), true); self::$tags = json_decode(file_get_contents('../config/tags.json'), true);
self::$settings = json_decode( self::$settings = json_decode(
file_get_contents("../config/settings.json"), file_get_contents('../config/settings.json'),
true true
); );
} }
@ -30,81 +29,80 @@ class Settings
public static function sync($data) public static function sync($data)
{ {
$settings = self::$settings; $settings = self::$settings;
$settings["global"]["base_url"] = $data["global"]["base_url"]; $settings['global']['base_url'] = $data['global']['base_url'];
$settings["global"]["title"] = $data["global"]["title"]; $settings['global']['title'] = $data['global']['title'];
$settings["global"]["descriptions"] = $data["global"]["descriptions"]; $settings['global']['descriptions'] = $data['global']['descriptions'];
$settings["global"]["base_url"] = $data["global"]["base_url"]; $settings['global']['base_url'] = $data['global']['base_url'];
$settings["global"]["private"] = $data["global"]["private"]; $settings['global']['private'] = $data['global']['private'];
$settings["global"]["renderOnSave"] = $data["global"]["renderOnSave"]; $settings['global']['renderOnSave'] = $data['global']['renderOnSave'];
$settings["global"]["theme"] = $data["global"]["theme"]; $settings['global']['theme'] = $data['global']['theme'];
$settings["global"]["externalAPI"] = $data["global"]["externalAPI"]; $settings['global']['externalAPI'] = $data['global']['externalAPI'];
$settings["global"]["dynamicRender"] = $data["global"]["dynamicRender"]; $settings['global']['dynamicRender'] = $data['global']['dynamicRender'];
Member::updateData("handle", $data["member"]["handle"]); Member::updateData('handle', $data['member']['handle']);
Member::updateData("email", $data["member"]["email"]); Member::updateData('email', $data['member']['email']);
$settings["email"]["active"] = $data["email"]["active"]; $settings['email']['active'] = $data['email']['active'];
$settings["email"]["smtp"] = $data["email"]["smtp"]; $settings['email']['smtp'] = $data['email']['smtp'];
$settings["email"]["mailgun"] = $data["email"]["mailgun"]; $settings['email']['mailgun'] = $data['email']['mailgun'];
DocTools::writeSettings("../config/settings.json", $settings); DocTools::writeSettings('../config/settings.json', $settings);
} }
public static function navSync($data) public static function navSync($data)
{ {
$settings = self::$settings; $settings = self::$settings;
$remove = $data["remove"]; $remove = $data['remove'];
//if remove contains id, find nav item page and set menu to false //if remove contains id, find nav item page and set menu to false
if ($remove != null || $remove != "") { if ($remove != null || $remove != '') {
$page = (new Book("../content/pages"))->findPageById($remove); $page = (new Book('../content/pages'))->findPageById($remove);
$page["menu"] = "false"; $page['menu'] = 'false';
$page["published"] $page['published']
? ($page["published"] = "true") ? ($page['published'] = 'true')
: ($page["published"] = "false"); : ($page['published'] = 'false');
$page["featured"] $page['featured']
? ($page["featured"] = "true") ? ($page['featured'] = 'true')
: ($page["featured"] = "false"); : ($page['featured'] = 'false');
$page["deleted"] $page['deleted']
? ($page["deleted"] = "true") ? ($page['deleted'] = 'true')
: ($page["deleted"] = "false"); : ($page['deleted'] = 'false');
$updated = new \Moment\Moment(); $updated = new \Moment\Moment();
$created = new \Moment\Moment($page["rawCreated"]); $created = new \Moment\Moment($page['rawCreated']);
$page["created"] = $created->format("Y-m-d\TH:i:sP"); $page['created'] = $created->format("Y-m-d\TH:i:sP");
$page["updated"] = $updated->format("Y-m-d\TH:i:sP"); $page['updated'] = $updated->format("Y-m-d\TH:i:sP");
$md = DocTools::objectToMD($page); $md = DocTools::objectToMD($page);
if ($page["layout"] == "index") { if ($page['layout'] == 'index') {
$writePath = "../content/pages/start/index.md"; $writePath = '../content/pages/start/index.md';
} else { } else {
$writePath = $writePath = '../content/pages/' . $page['path'] . '/' . $page['slug'] . '.md';
"../content/pages/" . $page["path"] . "/" . $page["slug"] . ".md";
} }
DocTools::writePages("write", $page["path"], $writePath, $md); DocTools::writePages('write', $page['path'], $writePath, $md);
} }
$settings["menu"] = []; $settings['menu'] = [];
$items = $data["menu"]; $items = $data['menu'];
foreach ($items as $item) { foreach ($items as $item) {
array_push($settings["menu"], [ array_push($settings['menu'], [
"title" => $item["title"], 'title' => $item['title'],
"id" => $item["id"], 'id' => $item['id'],
"uuid" => $item["uuid"], 'uuid' => $item['uuid'],
"slug" => $item["slug"], 'slug' => $item['slug'],
"path" => $item["path"], 'path' => $item['path'],
]); ]);
} }
DocTools::writeSettings("../config/settings.json", $settings); DocTools::writeSettings('../config/settings.json', $settings);
} }
public function getFolks($key = null) public function getFolks($key = null)
{ {
if (isset($key)) { if (isset($key)) {
$member = Session::get("member"); $member = Session::get('member');
$found = find($this->folks, ["handle" => $member["handle"]]); $found = find($this->folks, ['handle' => $member['handle']]);
if ($found) { if ($found) {
return $found[$key]; return $found[$key];
} }
@ -126,24 +124,23 @@ class Settings
public static function updateGlobalData($key, $data) public static function updateGlobalData($key, $data)
{ {
$settings = self::$settings; $settings = self::$settings;
$settings["global"][$key] = $data; $settings['global'][$key] = $data;
DocTools::writeSettings("../config/settings.json", $settings); DocTools::writeSettings('../config/settings.json', $settings);
} }
public static function getCurrentIndex() public static function getCurrentIndex()
{ {
$settings = self::$settings; $settings = self::$settings;
return $settings["library_stats"]["current_index"]; return $settings['library_stats']['current_index'];
} }
public static function updateIndex() public static function updateIndex()
{ {
$settings = self::$settings; $settings = self::$settings;
$settings["library_stats"]["current_index"] = $settings['library_stats']['current_index'] = $settings['library_stats']['current_index'] + 1;
$settings["library_stats"]["current_index"] + 1;
DocTools::writeSettings("../config/settings.json", $settings); DocTools::writeSettings('../config/settings.json', $settings);
} }
public static function updateMenu($body) public static function updateMenu($body)
@ -151,27 +148,27 @@ class Settings
$settings = self::$settings; $settings = self::$settings;
//$menu = $settings["menu"]; //$menu = $settings["menu"];
$item = [ $item = [
"title" => $body["title"], 'title' => $body['title'],
"id" => $body["id"], 'id' => $body['id'],
"uuid" => $body["uuid"], 'uuid' => $body['uuid'],
"slug" => $body["slug"], 'slug' => $body['slug'],
"path" => $body["path"], 'path' => $body['path'],
]; ];
if ($body["menu"] == "true") { if ($body['menu'] == 'true') {
if (!find($settings["menu"], ["uuid" => $item["uuid"]])) { if (!find($settings['menu'], ['uuid' => $item['uuid']])) {
array_push($settings["menu"], $item); array_push($settings['menu'], $item);
} }
} else { } else {
if (find($settings["menu"], ["uuid" => $item["uuid"]])) { if (find($settings['menu'], ['uuid' => $item['uuid']])) {
pull($settings["menu"], $item); pull($settings['menu'], $item);
} }
} }
DocTools::writeSettings("../config/settings.json", $settings); DocTools::writeSettings('../config/settings.json', $settings);
} }
public static function updateTags() public static function updateTags()
{ {
$tags = Sorting::tags(); $tags = Sorting::tags();
DocTools::writeSettings("../config/tags.json", $tags); DocTools::writeSettings('../config/tags.json', $tags);
} }
} }

View file

@ -2,19 +2,17 @@
namespace brain\data; namespace brain\data;
use brain\data\Settings;
class Themes class Themes
{ {
private $themes = []; private $themes = [];
public function __construct() public function __construct()
{ {
$_themes = glob("../content/themes/*", GLOB_ONLYDIR); $_themes = glob('../content/themes/*', GLOB_ONLYDIR);
foreach ($_themes as $theme) { foreach ($_themes as $theme) {
array_push( array_push(
$this->themes, $this->themes,
json_decode(file_get_contents($theme . "/theme.json"), true) json_decode(file_get_contents($theme . '/theme.json'), true)
); );
} }
} }
@ -27,16 +25,16 @@ class Themes
public function getCustomIndex() public function getCustomIndex()
{ {
$settings = (new Settings())->getSettings(); $settings = (new Settings())->getSettings();
$currentTheme = $settings["global"]["theme"]; $currentTheme = $settings['global']['theme'];
$folder = "../content/themes/" . $currentTheme; $folder = '../content/themes/' . $currentTheme;
$files = array_filter(glob("$folder/*twig"), "is_file"); $files = array_filter(glob("$folder/*twig"), 'is_file');
$views = []; $views = [];
foreach ($files as $file) { foreach ($files as $file) {
$path = explode("/", $file); $path = explode('/', $file);
$fileName = $path[4]; $fileName = $path[4];
if (str_contains($fileName, "index")) { if (str_contains($fileName, 'index')) {
$page = explode(".", $fileName); $page = explode('.', $fileName);
$views[] = $page[0]; $views[] = $page[0];
} }
} }
@ -46,16 +44,16 @@ class Themes
public function getCustomViews() public function getCustomViews()
{ {
$settings = (new Settings())->getSettings(); $settings = (new Settings())->getSettings();
$currentTheme = $settings["global"]["theme"]; $currentTheme = $settings['global']['theme'];
$folder = "../content/themes/" . $currentTheme; $folder = '../content/themes/' . $currentTheme;
$files = array_filter(glob("$folder/*twig"), "is_file"); $files = array_filter(glob("$folder/*twig"), 'is_file');
$views = []; $views = [];
foreach ($files as $file) { foreach ($files as $file) {
$path = explode("/", $file); $path = explode('/', $file);
$fileName = $path[4]; $fileName = $path[4];
if (str_contains($fileName, "page")) { if (str_contains($fileName, 'page')) {
$page = explode(".", $fileName); $page = explode('.', $fileName);
$views[] = $page[0]; $views[] = $page[0];
} }
} }

View file

@ -11,14 +11,14 @@ class DocTools
public static function writePages($task, $path, $fileLocation, $fileContents) public static function writePages($task, $path, $fileLocation, $fileContents)
{ {
try { try {
if ($task == "create") { if ($task == 'create') {
if (!is_dir("../content/pages/" . $path)) { if (!is_dir('../content/pages/' . $path)) {
//Directory does not exist, so lets create it. //Directory does not exist, so lets create it.
mkdir("../content/pages/" . $path, 0755, true); mkdir('../content/pages/' . $path, 0755, true);
} }
file_put_contents($fileLocation, $fileContents); file_put_contents($fileLocation, $fileContents);
} else { } else {
($new = fopen($fileLocation, "w")) or die("Unable to open file!"); ($new = fopen($fileLocation, 'w')) or die('Unable to open file!');
fwrite($new, $fileContents); fwrite($new, $fileContents);
fclose($new); fclose($new);
} }
@ -34,7 +34,7 @@ class DocTools
if (!is_file($fileLocation)) { if (!is_file($fileLocation)) {
file_put_contents($fileLocation, json_encode($fileContents)); file_put_contents($fileLocation, json_encode($fileContents));
} else { } else {
($new = fopen($fileLocation, "w")) or die("Unable to open file!"); ($new = fopen($fileLocation, 'w')) or die('Unable to open file!');
fwrite($new, json_encode($fileContents)); fwrite($new, json_encode($fileContents));
fclose($new); fclose($new);
} }
@ -51,7 +51,7 @@ class DocTools
if (!is_file($location)) { if (!is_file($location)) {
file_put_contents($location, $html); file_put_contents($location, $html);
} else { } else {
($new = fopen($location, "w")) or die("Unable to open file!"); ($new = fopen($location, 'w')) or die('Unable to open file!');
fwrite($new, $html); fwrite($new, $html);
fclose($new); fclose($new);
} }
@ -86,59 +86,58 @@ class DocTools
public static function objectToMD($object) public static function objectToMD($object)
{ {
$markdown = $markdown = "---\n" .
"---\n" . 'id: ' .
"id: " . $object['id'] .
$object["id"] .
"\n" . "\n" .
"uuid: " . 'uuid: ' .
$object["uuid"] . $object['uuid'] .
"\n" . "\n" .
"title: " . 'title: ' .
"'" . "'" .
$object["title"] . $object['title'] .
"'" . "'" .
"\n" . "\n" .
"feature: " . 'feature: ' .
$object["feature"] . $object['feature'] .
"\n" . "\n" .
"files: " . 'files: ' .
$object["files"] . $object['files'] .
"\n" . "\n" .
"path: " . 'path: ' .
$object["path"] . $object['path'] .
"\n" . "\n" .
"layout: " . 'layout: ' .
$object["layout"] . $object['layout'] .
"\n" . "\n" .
"tags: " . 'tags: ' .
$object["tags"] . $object['tags'] .
"\n" . "\n" .
"author: " . 'author: ' .
$object["author"] . $object['author'] .
"\n" . "\n" .
"created: " . 'created: ' .
$object["created"] . $object['created'] .
"\n" . "\n" .
"updated: " . 'updated: ' .
$object["updated"] . $object['updated'] .
"\n" . "\n" .
"deleted: " . 'deleted: ' .
$object["deleted"] . $object['deleted'] .
"\n" . "\n" .
"slug: " . 'slug: ' .
$object["slug"] . $object['slug'] .
"\n" . "\n" .
"menu: " . 'menu: ' .
$object["menu"] . $object['menu'] .
"\n" . "\n" .
"published: " . 'published: ' .
$object["published"] . $object['published'] .
"\n" . "\n" .
"featured: " . 'featured: ' .
$object["featured"] . $object['featured'] .
"\n---\n" . "\n---\n" .
$object["content"]; $object['content'];
return $markdown; return $markdown;
} }

View file

@ -9,37 +9,38 @@ class HandleCors
public function __construct() public function __construct()
{ {
//look to see if settings file exists. kinda important //look to see if settings file exists. kinda important
if (file_exists("../config/settings.json")) { if (file_exists('../config/settings.json')) {
//check settings to see if external api access is allowed //check settings to see if external api access is allowed
$config = new Settings(); $config = new Settings();
$settings = $config->getSettings(); $settings = $config->getSettings();
if ($settings["global"]["externalAPI"]) { if ($settings['global']['externalAPI']) {
//echo "API STATUS: " . $settings["global"]["externalAPI"]; //echo "API STATUS: " . $settings["global"]["externalAPI"];
if ($settings["global"]["externalAPI"] == "true") { if ($settings['global']['externalAPI'] == 'true') {
//echo "API ACCESS ACTIVE"; //echo "API ACCESS ACTIVE";
// checks to see if origin is set // checks to see if origin is set
if (isset($_SERVER["HTTP_ORIGIN"])) { if (isset($_SERVER['HTTP_ORIGIN'])) {
// You can decide if the origin in $_SERVER['HTTP_ORIGIN'] is something you want to allow, or as we do here, just allow all // You can decide if the origin in $_SERVER['HTTP_ORIGIN']
header("Access-Control-Allow-Origin: {$_SERVER["HTTP_ORIGIN"]}"); //is something you want to allow, or as we do here, just allow all
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
} else { } else {
//No HTTP_ORIGIN set, so we allow any. You can disallow if needed here //No HTTP_ORIGIN set, so we allow any. You can disallow if needed here
//never allow just any domain, so turn CORS off if no No HTTP_ORIGIN is set //never allow just any domain, so turn CORS off if no No HTTP_ORIGIN is set
//header("Access-Control-Allow-Origin: *"); //header("Access-Control-Allow-Origin: *");
} }
header("Access-Control-Allow-Credentials: true"); header('Access-Control-Allow-Credentials: true');
header("Access-Control-Max-Age: 600"); // cache for 10 minutes header('Access-Control-Max-Age: 600'); // cache for 10 minutes
if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") { if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER["HTTP_ACCESS_CONTROL_REQUEST_METHOD"])) { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
header( header(
"Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT" 'Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT'
); );
} //Make sure you remove those you do not want to support } //Make sure you remove those you do not want to support
if (isset($_SERVER["HTTP_ACCESS_CONTROL_REQUEST_HEADERS"])) { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
header( header(
"Access-Control-Allow-Headers: {$_SERVER["HTTP_ACCESS_CONTROL_REQUEST_HEADERS"]}" "Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"
); );
} }

View file

@ -2,7 +2,6 @@
namespace brain\utility; namespace brain\utility;
use Slim\Views\Twig;
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\Exception;
use brain\data\Settings; use brain\data\Settings;
@ -14,58 +13,56 @@ class Mailer
{ {
$config = new Settings(); $config = new Settings();
$settings = $config->getSettings(); $settings = $config->getSettings();
$mailConfig = $settings["email"]; $mailConfig = $settings['email'];
$mail = new PHPMailer(); $mail = new PHPMailer();
switch ($body["mail_task"]) { switch ($body['mail_task']) {
case "TESTING": case 'TESTING':
$html = $html = "<h1>Hi! It's Fipamo!</h1><br>" .
"<h1>Hi! It's Fipamo!</h1><br>" .
"<strong>It's just a test</strong><br>" . "<strong>It's just a test</strong><br>" .
$body["content"]; $body['content'];
$member = Session::get("member"); $member = Session::get('member');
$mail->addAddress($member["email"], ""); //pull email address from current user $mail->addAddress($member['email'], ''); //pull email address from current user
$mail->Subject = "A test email"; $mail->Subject = 'A test email';
break; break;
case "SEND_SECRET": case 'SEND_SECRET':
$html = $html = "<h1>Hi! It's Fipamo!</h1><br>" .
"<h1>Hi! It's Fipamo!</h1><br>" . '<strong>This is your secret key.</strong><br><br>' .
"<strong>This is your secret key.</strong><br><br>" . '<h3>' .
"<h3>" . $body['secret'] .
$body["secret"] . '</h3>' .
"</h3>" . '<br> Use this key to reset your password.';
"<br> Use this key to reset your password."; $mail->addAddress($body['email'], ''); //pull email address from current user
$mail->addAddress($body["email"], ""); //pull email address from current user
$mail->Subject = "Shhhh! It's a secret!"; $mail->Subject = "Shhhh! It's a secret!";
break; break;
default: default:
return $result = [ return $result = [
"type" => "noMailService", 'type' => 'noMailService',
"message" => "Mail task is undefined. What are you doing??", 'message' => 'Mail task is undefined. What are you doing??',
]; ];
break; break;
} }
//set values based on current active protocol //set values based on current active protocol
switch ($mailConfig["active"]) { switch ($mailConfig['active']) {
case "option-smtp": case 'option-smtp':
$mail->setFrom($mailConfig["smtp"]["email"], "System Email"); $mail->setFrom($mailConfig['smtp']['email'], 'System Email');
$mail->Host = "playvicio.us"; $mail->Host = 'playvicio.us';
$mail->Username = $mailConfig["smtp"]["email"]; $mail->Username = $mailConfig['smtp']['email'];
$mail->Password = $mailConfig["smtp"]["password"]; $mail->Password = $mailConfig['smtp']['password'];
break; break;
case "option-mg": case 'option-mg':
$mail->setFrom($mailConfig["mailgun"]["domain"], "No Reply"); $mail->setFrom($mailConfig['mailgun']['domain'], 'No Reply');
$mail->Host = "smtp.mailgun.org"; $mail->Host = 'smtp.mailgun.org';
$mail->Username = $mailConfig["mailgun"]["domain"]; $mail->Username = $mailConfig['mailgun']['domain'];
$mail->Password = $mailConfig["mailgun"]["key"]; $mail->Password = $mailConfig['mailgun']['key'];
break; break;
default: default:
//no mail service //no mail service
return $result = [ return $result = [
"type" => "noMailService", 'type' => 'noMailService',
"message" => "Mail is not configured. Handle that.", 'message' => 'Mail is not configured. Handle that.',
]; ];
break; break;
} }
@ -74,7 +71,7 @@ class Mailer
$mail->IsHTML(true); $mail->IsHTML(true);
$mail->isSMTP(); $mail->isSMTP();
$mail->SMTPAuth = true; $mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl"; $mail->SMTPSecure = 'ssl';
$mail->Port = 465; $mail->Port = 465;
// Uncomment for debug info // Uncomment for debug info
@ -83,13 +80,13 @@ class Mailer
/* Finally send the mail. */ /* Finally send the mail. */
try { try {
$mail->send(); $mail->send();
$result = ["type" => "mailSent", "message" => "Message Away!"]; $result = ['type' => 'mailSent', 'message' => 'Message Away!'];
} catch (Exception $e) { } catch (Exception $e) {
//echo $e->errorMessage(); //echo $e->errorMessage();
$result = [ $result = [
"type" => "mailNotSent", 'type' => 'mailNotSent',
"message" => "Message Not Away!", 'message' => 'Message Not Away!',
"error" => $e->errorMessage(), 'error' => $e->errorMessage(),
]; ];
} }

View file

@ -13,92 +13,90 @@ class Maintenance
public static function makeBackup() public static function makeBackup()
{ {
//make sure back directory is there //make sure back directory is there
if (!is_dir("../config/backups")) { if (!is_dir('../config/backups')) {
mkdir("../config/backups", 0755, true); mkdir('../config/backups', 0755, true);
} }
//creat backup zip //creat backup zip
$zip = new \ZipArchive(); $zip = new \ZipArchive();
$zip->open( $zip->open(
"../config/backups/latest_back.zip", '../config/backups/latest_back.zip',
\ZipArchive::CREATE | \ZipArchive::OVERWRITE \ZipArchive::CREATE | \ZipArchive::OVERWRITE
); );
//gather data and path info for md pages //gather data and path info for md pages
$pagePath = "../content/pages"; $pagePath = '../content/pages';
$yearPaths = glob($pagePath . "/*", GLOB_ONLYDIR); $yearPaths = glob($pagePath . '/*', GLOB_ONLYDIR);
foreach ($yearPaths as $years) { foreach ($yearPaths as $years) {
$year = explode("/", $years); $year = explode('/', $years);
//grap the index and save it //grap the index and save it
if (trim($year[3]) == "start") { if (trim($year[3]) == 'start') {
$options = [ $options = [
"add_path" => "content/pages/" . $year[3] . "/", 'add_path' => 'content/pages/' . $year[3] . '/',
"remove_all_path" => true, 'remove_all_path' => true,
]; ];
$zip->addGlob($years . "/*.md", GLOB_BRACE, $options); $zip->addGlob($years . '/*.md', GLOB_BRACE, $options);
} }
$monthsPath = glob($pagePath . "/" . $year[3] . "/*", GLOB_ONLYDIR); $monthsPath = glob($pagePath . '/' . $year[3] . '/*', GLOB_ONLYDIR);
foreach ($monthsPath as $months) { foreach ($monthsPath as $months) {
$month = explode("/", $months); $month = explode('/', $months);
//once info is collected, add md pages to zip //once info is collected, add md pages to zip
$options = [ $options = [
"add_path" => "content/pages/" . $year[3] . "/" . $month[4] . "/", 'add_path' => 'content/pages/' . $year[3] . '/' . $month[4] . '/',
"remove_all_path" => true, 'remove_all_path' => true,
]; ];
$zip->addGlob($months . "/*.md", GLOB_BRACE, $options); $zip->addGlob($months . '/*.md', GLOB_BRACE, $options);
} }
} }
//gather data and path info for blog images //gather data and path info for blog images
$blogImagesPath = "../public/assets/images/blog"; $blogImagesPath = '../public/assets/images/blog';
$yearPaths = glob($blogImagesPath . "/*", GLOB_ONLYDIR); $yearPaths = glob($blogImagesPath . '/*', GLOB_ONLYDIR);
foreach ($yearPaths as $years) { foreach ($yearPaths as $years) {
$year = explode("/", $years); $year = explode('/', $years);
$monthsPath = glob($blogImagesPath . "/" . $year[5] . "/*", GLOB_ONLYDIR); $monthsPath = glob($blogImagesPath . '/' . $year[5] . '/*', GLOB_ONLYDIR);
foreach ($monthsPath as $months) { foreach ($monthsPath as $months) {
$month = explode("/", $months); $month = explode('/', $months);
//once info is collected, add images pages to zip //once info is collected, add images pages to zip
$options = [ $options = [
"add_path" => 'add_path' => 'public/assets/images/blog/' . $year[5] . '/' . $month[6] . '/',
"public/assets/images/blog/" . $year[5] . "/" . $month[6] . "/", 'remove_all_path' => true,
"remove_all_path" => true,
]; ];
$zip->addGlob($months . "/*.*", GLOB_BRACE, $options); $zip->addGlob($months . '/*.*', GLOB_BRACE, $options);
} }
} }
//gather data and path info for user images //gather data and path info for user images
$userImagesPath = "../public/assets/images/user"; $userImagesPath = '../public/assets/images/user';
$yearPaths = glob($userImagesPath . "/*", GLOB_ONLYDIR); $yearPaths = glob($userImagesPath . '/*', GLOB_ONLYDIR);
foreach ($yearPaths as $years) { foreach ($yearPaths as $years) {
$year = explode("/", $years); $year = explode('/', $years);
$monthsPath = glob($userImagesPath . "/" . $year[5] . "/*", GLOB_ONLYDIR); $monthsPath = glob($userImagesPath . '/' . $year[5] . '/*', GLOB_ONLYDIR);
foreach ($monthsPath as $months) { foreach ($monthsPath as $months) {
$month = explode("/", $months); $month = explode('/', $months);
//once info is collected, add images pages to zip //once info is collected, add images pages to zip
$options = [ $options = [
"add_path" => 'add_path' => 'public/assets/images/user/' . $year[5] . '/' . $month[6] . '/',
"public/assets/images/user/" . $year[5] . "/" . $month[6] . "/", 'remove_all_path' => true,
"remove_all_path" => true,
]; ];
$zip->addGlob($months . "/*.*", GLOB_BRACE, $options); $zip->addGlob($months . '/*.*', GLOB_BRACE, $options);
} }
} }
//add directory for settings and save them //add directory for settings and save them
$zip->addEmptyDir("settings"); $zip->addEmptyDir('settings');
$zip->addFile("../config/settings.json", "settings/settings.json"); $zip->addFile('../config/settings.json', 'settings/settings.json');
$zip->addFile("../config/folks.json", "settings/folks.json"); $zip->addFile('../config/folks.json', 'settings/folks.json');
$zip->addFile("../config/tags.json", "settings/tags.json"); $zip->addFile('../config/tags.json', 'settings/tags.json');
//save zip file //save zip file
$zip->close(); $zip->close();
//update settings file with latest back up date //update settings file with latest back up date
$updated = new \Moment\Moment(); $updated = new \Moment\Moment();
Settings::updateGlobalData( Settings::updateGlobalData(
"last_backup", 'last_backup',
$updated->format("Y-m-d\TH:i:sP") $updated->format("Y-m-d\TH:i:sP")
); );
$result = ["message" => "Backup created. THIS IS A SAFE SPACE!"]; $result = ['message' => 'Backup created. THIS IS A SAFE SPACE!'];
return $result; return $result;
} }
} }

View file

@ -8,7 +8,7 @@ class SetUp
{ {
public static function status() public static function status()
{ {
if (file_exists("../config/settings.json")) { if (file_exists('../config/settings.json')) {
return true; return true;
} else { } else {
return false; return false;
@ -19,79 +19,78 @@ class SetUp
{ {
//grab template files //grab template files
$newFolks = json_decode( $newFolks = json_decode(
file_get_contents("../config/init/folks-template.json"), file_get_contents('../config/init/folks-template.json'),
true true
); );
$newSettings = json_decode( $newSettings = json_decode(
file_get_contents("../config/init/settings-template.json"), file_get_contents('../config/init/settings-template.json'),
true true
); );
//get form values //get form values
//$body = $request->getParsedBody(); //$body = $request->getParsedBody();
$handle = $body["new_member_handle"]; $handle = $body['new_member_handle'];
$email = $body["new_member_email"]; $email = $body['new_member_email'];
$pass = $body["new_member_pass"]; $pass = $body['new_member_pass'];
$title = $body["new_member_title"]; $title = $body['new_member_title'];
$now = new \Moment\Moment(); $now = new \Moment\Moment();
//setup folks config //setup folks config
$hash = password_hash($pass, PASSWORD_DEFAULT); $hash = password_hash($pass, PASSWORD_DEFAULT);
$newFolks[0]["id"] = 0; $newFolks[0]['id'] = 0;
$newFolks[0]["handle"] = $handle; $newFolks[0]['handle'] = $handle;
$newFolks[0]["email"] = $email; $newFolks[0]['email'] = $email;
$newFolks[0]["password"] = $hash; $newFolks[0]['password'] = $hash;
$newFolks[0]["key"] = password_hash($email, PASSWORD_DEFAULT); $newFolks[0]['key'] = password_hash($email, PASSWORD_DEFAULT);
$newFolks[0]["secret"] = StringTools::randomString(12); $newFolks[0]['secret'] = StringTools::randomString(12);
$newFolks[0]["role"] = "hnic"; $newFolks[0]['role'] = 'hnic';
$newFolks[0]["created"] = $now->format("Y-m-d\TH:i:sP"); $newFolks[0]['created'] = $now->format("Y-m-d\TH:i:sP");
$newFolks[0]["updated"] = $now->format("Y-m-d\TH:i:sP"); $newFolks[0]['updated'] = $now->format("Y-m-d\TH:i:sP");
//set up settings config //set up settings config
$newSettings["global"]["title"] = $title; $newSettings['global']['title'] = $title;
//create index file //create index file
//$rightNow = $now->format("Y-m-d\TH:i:sP"); //$rightNow = $now->format("Y-m-d\TH:i:sP");
//var_dump($now->format("Y-m-d\TH:i:sP")); //var_dump($now->format("Y-m-d\TH:i:sP"));
$index = [ $index = [
"id" => 1, 'id' => 1,
"uuid" => StringTools::createUUID(), 'uuid' => StringTools::createUUID(),
"title" => "FIRST!", 'title' => 'FIRST!',
"feature" => "/assets/images/global/default-bg.jpg", 'feature' => '/assets/images/global/default-bg.jpg',
"files" => "", 'files' => '',
"path" => "content/pages/start", 'path' => 'content/pages/start',
"layout" => "index", 'layout' => 'index',
"tags" => "start, welcome", 'tags' => 'start, welcome',
"author" => $handle, 'author' => $handle,
"created" => $now->format("Y-m-d\TH:i:sP"), 'created' => $now->format("Y-m-d\TH:i:sP"),
"updated" => $now->format("Y-m-d\TH:i:sP"), 'updated' => $now->format("Y-m-d\TH:i:sP"),
"deleted" => "false", 'deleted' => 'false',
"slug" => "first", 'slug' => 'first',
"menu" => "false", 'menu' => 'false',
"featured" => "false", 'featured' => 'false',
"published" => "true", 'published' => 'true',
"content" => 'content' => "# F**k Yes \n\nIf you're seeing this, you're up and running. NICE WORK!\n\nFrom here, feel free to start dropping pages to your heart's content.\n\nFor some tips about using Fipamo, check out the ![docs](https://code.playvicio.us/Are0h/Fipamo/wiki/02-Usage)\n\nAll good? Feel free to edit this page to whatever you want!\n\nYOU'RE THE CAPTAIN NOW.",
"# F**k Yes \n\nIf you're seeing this, you're up and running. NICE WORK!\n\nFrom here, feel free to start dropping pages to your heart's content.\n\nFor some tips about using Fipamo, check out the ![docs](https://code.playvicio.us/Are0h/Fipamo/wiki/02-Usage)\n\nAll good? Feel free to edit this page to whatever you want!\n\nYOU'RE THE CAPTAIN NOW.",
]; ];
$freshIndex = DocTools::objectToMD($index); $freshIndex = DocTools::objectToMD($index);
//once all files created, write down //once all files created, write down
DocTools::writeSettings("../config/settings.json", $newSettings); DocTools::writeSettings('../config/settings.json', $newSettings);
DocTools::writeSettings("../config/folks.json", $newFolks); DocTools::writeSettings('../config/folks.json', $newFolks);
DocTools::writeSettings("../config/tags.json", []); DocTools::writeSettings('../config/tags.json', []);
DocTools::writePages( DocTools::writePages(
"create", 'create',
"start", 'start',
"../content/pages/start/index.md", '../content/pages/start/index.md',
$freshIndex $freshIndex
); );
//if there is an older session file, get rid of it //if there is an older session file, get rid of it
if (is_file("../content/.session")) { if (is_file('../content/.session')) {
unlink("../content/.session"); unlink('../content/.session');
} }
$result = ["type" => "blogInitGood", "message" => "Site Created"]; $result = ['type' => 'blogInitGood', 'message' => 'Site Created'];
return $result; return $result;
} }
@ -99,39 +98,39 @@ class SetUp
public static function restore($request) public static function restore($request)
{ {
$result = [ $result = [
"type" => "requestLame", 'type' => 'requestLame',
"message" => "Still working on it.", 'message' => 'Still working on it.',
]; ];
$body = $request->getParsedBody(); $body = $request->getParsedBody();
$backup = $request->getUploadedFiles(); $backup = $request->getUploadedFiles();
$file = $backup["backup-upload"]; $file = $backup['backup-upload'];
//NOTE: If this fails check 'post_max_size' in php.ini //NOTE: If this fails check 'post_max_size' in php.ini
$size = $file->getSize(); $size = $file->getSize();
$name = $file->getClientFileName(); $name = $file->getClientFileName();
//park it so it can be read //park it so it can be read
$file->moveTo("../content" . "/" . $name); $file->moveTo('../content' . '/' . $name);
//open it and get files to verify user //open it and get files to verify user
$zip = new \ZipArchive(); $zip = new \ZipArchive();
if ($zip->open("../content" . "/" . $name) === true) { if ($zip->open('../content' . '/' . $name) === true) {
$folks = json_decode($zip->getFromName("settings/folks.json"), true); $folks = json_decode($zip->getFromName('settings/folks.json'), true);
$found = find($folks, ["handle" => $body["restore_member_handle"]]); $found = find($folks, ['handle' => $body['restore_member_handle']]);
//if member is found in back up, check pass //if member is found in back up, check pass
if ($found) { if ($found) {
if (password_verify($body["restore_member_pass"], $found["password"])) { if (password_verify($body['restore_member_pass'], $found['password'])) {
//backup verified, restore site //backup verified, restore site
//set new secret key for older folks configs //set new secret key for older folks configs
$newFolks = []; $newFolks = [];
if (!isset($found["secret"])) { if (!isset($found['secret'])) {
$found["secret"] = StringTools::randomString(12); $found['secret'] = StringTools::randomString(12);
} }
array_push($newFolks, $found); array_push($newFolks, $found);
//dump files in folder //dump files in folder
$zip->extractTo("../content"); $zip->extractTo('../content');
//move to appropriate spots //move to appropriate spots
/* /*
@ -143,49 +142,49 @@ class SetUp
//load up old config file //load up old config file
$newConfig = json_decode( $newConfig = json_decode(
file_get_contents("../content/settings/settings.json"), file_get_contents('../content/settings/settings.json'),
true true
); );
//check for key, add if not there //check for key, add if not there
if (!isset($newConfig["global"]["externalAPI"])) { if (!isset($newConfig['global']['externalAPI'])) {
$newConfig["global"]["externalAPI"] = "false"; $newConfig['global']['externalAPI'] = 'false';
} }
//write new config file //write new config file
DocTools::writeSettings("../config/settings.json", $newConfig); DocTools::writeSettings('../config/settings.json', $newConfig);
//rename("../content/settings/folks.json", "../config/folks.json"); //rename("../content/settings/folks.json", "../config/folks.json");
DocTools::writeSettings("../config/folks.json", $newFolks); DocTools::writeSettings('../config/folks.json', $newFolks);
rename("../content/settings/tags.json", "../config/tags.json"); rename('../content/settings/tags.json', '../config/tags.json');
//images path for blog and user //images path for blog and user
$blogImagePath = "../public/assets/images/blog"; $blogImagePath = '../public/assets/images/blog';
$userImagePath = "../public/assets/images/user"; $userImagePath = '../public/assets/images/user';
//check to see if image dirs are empty, if not chill //check to see if image dirs are empty, if not chill
if ($globs = glob($blogImagePath . "/*")) { if ($globs = glob($blogImagePath . '/*')) {
//directory not empty, relax //directory not empty, relax
} else { } else {
rename("../content/public/assets/images/blog", $blogImagePath); rename('../content/public/assets/images/blog', $blogImagePath);
} }
if ($globs = glob($userImagePath . "/*")) { if ($globs = glob($userImagePath . '/*')) {
//directory not empty, relax //directory not empty, relax
} else { } else {
rename("../content/public/assets/images/user", $userImagePath); rename('../content/public/assets/images/user', $userImagePath);
} }
rename("../content/content/pages/", "../content/pages"); rename('../content/content/pages/', '../content/pages');
//legacy check for old file structure //legacy check for old file structure
if (is_file("../content/pages/index.md")) { if (is_file('../content/pages/index.md')) {
if (!is_dir("../content/pages/start")) { if (!is_dir('../content/pages/start')) {
//Directory does not exist, so lets create it. //Directory does not exist, so lets create it.
mkdir("../content/pages/start", 0755, true); mkdir('../content/pages/start', 0755, true);
//move start page to appropriate spot //move start page to appropriate spot
rename( rename(
"../content/pages/index.md", '../content/pages/index.md',
"../content/pages/start/index.md" '../content/pages/start/index.md'
); );
} }
} else { } else {
@ -194,34 +193,34 @@ class SetUp
//clean up //clean up
DocTools::deleteFolder("../content/settings"); DocTools::deleteFolder('../content/settings');
DocTools::deleteFolder("../content/public"); DocTools::deleteFolder('../content/public');
DocTools::deleteFolder("../content/content"); DocTools::deleteFolder('../content/content');
$result = [ $result = [
"type" => "requestGood", 'type' => 'requestGood',
"message" => "Site Restored! Redirecting", 'message' => 'Site Restored! Redirecting',
]; ];
} else { } else {
$result = [ $result = [
"type" => "requestLame", 'type' => 'requestLame',
"message" => "Check that password, champ.", 'message' => 'Check that password, champ.',
]; ];
} }
} else { } else {
$result = [ $result = [
"type" => "requestLame", 'type' => 'requestLame',
"message" => "No member found by that name, hoss", 'message' => 'No member found by that name, hoss',
]; ];
} }
$zip->close(); $zip->close();
$zipPath = "../content/" . $name; $zipPath = '../content/' . $name;
//trash zip when done //trash zip when done
unlink($zipPath); unlink($zipPath);
} else { } else {
$result = [ $result = [
"type" => "requestLame", 'type' => 'requestLame',
"message" => "Could not open backup. RATS!", 'message' => 'Could not open backup. RATS!',
]; ];
} }
return $result; return $result;

View file

@ -10,13 +10,12 @@ use Mni\FrontYAML\Parser;
class Sorting class Sorting
{ {
private static $_tags = []; private static $p_tags = [];
private static $_archive = []; private static $p_archive = [];
public function __construct() public function __construct()
{ {
} }
public static function tags() public static function tags()
{ {
$pages = (new Book('../content/pages'))->getContents(); $pages = (new Book('../content/pages'))->getContents();
@ -25,8 +24,8 @@ class Sorting
$temp = explode(',', $page['tags']); $temp = explode(',', $page['tags']);
foreach ($temp as $tag) { foreach ($temp as $tag) {
$label = trim($tag); $label = trim($tag);
if (!find(self::$_tags, ['tag_name' => $label])) { if (!find(self::$p_tags, ['tag_name' => $label])) {
array_push(self::$_tags, [ array_push(self::$p_tags, [
'tag_name' => $label, 'tag_name' => $label,
'slug' => StringTools::safeString($label), 'slug' => StringTools::safeString($label),
'pages' => self::tagPages($label, $pages), 'pages' => self::tagPages($label, $pages),
@ -35,9 +34,8 @@ class Sorting
} }
} }
return self::$_tags; return self::$p_tags;
} }
private static function tagPages($tag, $pages) private static function tagPages($tag, $pages)
{ {
$tagged = []; $tagged = [];
@ -54,7 +52,6 @@ class Sorting
return $tagged; return $tagged;
} }
public static function archive() public static function archive()
{ {
$pages = (new Book('../content/pages'))->getContents(); $pages = (new Book('../content/pages'))->getContents();
@ -94,15 +91,14 @@ class Sorting
]); ]);
} }
} }
array_push(self::$_archive, [ array_push(self::$p_archive, [
'year' => $year['year'], 'year' => $year['year'],
'year_data' => $sorted, 'year_data' => $sorted,
]); ]);
} }
return self::$_archive; return self::$p_archive;
} }
public static function page($page) public static function page($page)
{ {
$config = new Settings(); $config = new Settings();
@ -196,8 +192,7 @@ class Sorting
$limit = 4; $limit = 4;
$pages = (new Book())->getContents(); $pages = (new Book())->getContents();
foreach ($pages as $item) { foreach ($pages as $item) {
if ( if (!$item['deleted'] &&
!$item['deleted'] &&
$item['published'] && $item['published'] &&
$item['menu'] != 'true' $item['menu'] != 'true'
) { ) {

View file

@ -10,12 +10,12 @@ class StringTools
{ {
public static function createUUID() public static function createUUID()
{ {
if (function_exists("com_create_guid") === true) { if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), "{}"); return trim(com_create_guid(), '{}');
} }
return sprintf( return sprintf(
"%04X%04X-%04X-%04X-%04X-%04X%04X%04X", '%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
mt_rand(0, 65535), mt_rand(0, 65535),
mt_rand(0, 65535), mt_rand(0, 65535),
mt_rand(0, 65535), mt_rand(0, 65535),
@ -32,11 +32,11 @@ class StringTools
$parser = new Parser(); $parser = new Parser();
$rendered = $parser->parse($entry); $rendered = $parser->parse($entry);
$sanitizer = HtmlSanitizer\Sanitizer::create([ $sanitizer = HtmlSanitizer\Sanitizer::create([
"extensions" => ["basic", "image", "list", "code"], 'extensions' => ['basic', 'image', 'list', 'code'],
"tags" => [ 'tags' => [
"img" => [ 'img' => [
"allowed_attributes" => ["src", "alt", "title", "class"], 'allowed_attributes' => ['src', 'alt', 'title', 'class'],
"allowed_hosts" => null, 'allowed_hosts' => null,
], ],
], ],
]); ]);
@ -44,21 +44,21 @@ class StringTools
$preclean = $sanitizer->sanitize($rendered->getContent()); $preclean = $sanitizer->sanitize($rendered->getContent());
$cleaned = strip_tags($rendered->getContent(), [ $cleaned = strip_tags($rendered->getContent(), [
"a", 'a',
"br", 'br',
"p", 'p',
"strong", 'strong',
"br", 'br',
"img", 'img',
"iframe", 'iframe',
"ul", 'ul',
"li", 'li',
"i", 'i',
"h1", 'h1',
"h2", 'h2',
"h3", 'h3',
"pre", 'pre',
"code", 'code',
]); ]);
return $cleaned; return $cleaned;
@ -69,32 +69,31 @@ class StringTools
return strtolower( return strtolower(
trim( trim(
preg_replace( preg_replace(
"~[^0-9a-z]+~i", '~[^0-9a-z]+~i',
"_", '_',
html_entity_decode( html_entity_decode(
preg_replace( preg_replace(
"~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i", '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i',
'$1', '$1',
htmlentities($string, ENT_QUOTES, "UTF-8") htmlentities($string, ENT_QUOTES, 'UTF-8')
), ),
ENT_QUOTES, ENT_QUOTES,
"UTF-8" 'UTF-8'
) )
), ),
"-" '-'
) )
); );
} }
public static function randomString(int $length) public static function randomString(int $length)
{ {
$alphanum = $alphanum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$special = '*&!@%^#$'; $special = '*&!@%^#$';
$alphabet = $alphanum . $special; $alphabet = $alphanum . $special;
$random = openssl_random_pseudo_bytes($length); $random = openssl_random_pseudo_bytes($length);
$alphabet_length = strlen($alphabet); $alphabet_length = strlen($alphabet);
$string = ""; $string = '';
for ($i = 0; $i < $length; ++$i) { for ($i = 0; $i < $length; ++$i) {
$string .= $alphabet[ord($random[$i]) % $alphabet_length]; $string .= $alphabet[ord($random[$i]) % $alphabet_length];
} }
@ -102,7 +101,7 @@ class StringTools
//secret needs to be a valid token //secret needs to be a valid token
if ($length == 12) { if ($length == 12) {
try { try {
$secret = Token::create(12, $string, time() + 3600, "localhost"); $secret = Token::create(12, $string, time() + 3600, 'localhost');
return $string; return $string;
} catch (BuildException $e) { } catch (BuildException $e) {
//bad secret, so try agiain //bad secret, so try agiain
@ -120,7 +119,7 @@ class StringTools
private static function checkSpecial($string) private static function checkSpecial($string)
{ {
$specials = ["*", "&", "!", "@", "%", "^", "#", "$"]; $specials = ['*', '&', '!', '@', '%', '^', '#', '$'];
$valid = false; $valid = false;
foreach ($specials as $item) { foreach ($specials as $item) {
if (strpos($string, $item)) { if (strpos($string, $item)) {

View file

@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<div id="notifications" class="notifications"> <div id="notifications" class="notifications">
<div id="notifyMessage" class="notifyMessage"> <div id="notify-message" class="notify-message">
<div id="notify-good" class="notify-icon"> <div id="notify-good" class="notify-icon">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-flirt"/></svg> <svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-flirt"/></svg>
</div> </div>

View file

@ -9,7 +9,7 @@
{% set slug = page['slug'] %} {% set slug = page['slug'] %}
{% set layout = page['layout'] %} {% set layout = page['layout'] %}
{% set feature = page['feature'] %} {% set feature = page['feature'] %}
{% set _title = page['title'] %} {% set title = page['title'] %}
{% set tags = page['tags'] %} {% set tags = page['tags'] %}
{% set content = page['content'] %} {% set content = page['content'] %}
{% set date = page['created'] %} {% set date = page['created'] %}
@ -36,7 +36,7 @@
{% endblock %} {% endblock %}
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=vbhj"> <link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfdf">
{% endblock %} {% endblock %}
{% block mainContent %} {% block mainContent %}
@ -66,18 +66,30 @@
<div id="page-images-list"> <div id="page-images-list">
{% if media|length > 1 %} {% if media|length > 1 %}
{% for item in media %} {% for item in media %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp4" %} {% if item.type == "mp4" %}
<div id="{{loop.index0}}" class="video-item" data-source="{{ item.file }}"></div>
<div id="{{ loop.index0 }}" class="video-item" data-source="{{ item.file }}" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %} {% else %}
<div id="{{loop.index0}}" class="img-item" style="background: url({{ item.file }}) no-repeat center center / cover"></div> <div id="{{ loop.index0 }}" class="img-item" style="background: url({{ item.file }}) no-repeat center center / cover" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% else %} {% else %}
{% if media[0] != '' %} {% if media[0] != '' %}
{% set fileName = media[0].file|split('/') %}
{% if media[0].type == "mp4" %} {% if media[0].type == "mp4" %}
<div id="0" class="video-item" data-source="{{ media[0].file }}"></div> <div id="0" class="video-item" data-source="{{ media[0].file }}" date-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %} {% else %}
<div id="0" class="img-item" style="background: url({{ media[0].file }}) no-repeat center center / cover"></div> <div id="0" class="img-item" style="background: url({{ media[0].file }}) no-repeat center center / cover" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% endif %} {% endif %}
{% else %} {% else %}
{% endif %} {% endif %}
@ -88,18 +100,28 @@
<div id="page-files-list"> <div id="page-files-list">
{% if files|length > 1 %} {% if files|length > 1 %}
{% for item in files %} {% for item in files %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp3" %} {% if item.type == "mp3" %}
<div id="{{loop.index0}}" class="audio-item" data-source="{{ item.file }}"></div> <div id="{{ loop.index0 }}" class="audio-item" data-source="{{ item.file }}" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %} {% else %}
<div id="{{loop.index0}}" class="file-item" data-source="{{ item.file }}"></div> <div id="{{ loop.index0 }}" class="file-item" data-source="{{ item.file }}" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% else %} {% else %}
{% if files[0] != '' %} {% if files[0] != '' %}
{% set fileName = files[0].file|split('/') %}
{% if files[0].type == "mp3" %} {% if files[0].type == "mp3" %}
<div id="0" class="audio-item" data-source="{{ files[0].file }}"></div> <div id="0" class="audio-item" data-source="{{ files[0].file }}" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %} {% else %}
<div id="0" class="file-item" data-source="{{ files[0].file }}"></div> <div id="0" class="file-item" data-source="{{ files[0].file }}" data-file-name="{{ fileName[6] }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% endif %} {% endif %}
{% else %} {% else %}
@ -116,11 +138,9 @@
</div> </div>
<div id="post-header"> <div id="post-header">
<div id="post-header-wrapper" class="columns"> <div id="post-header-wrapper" class="columns">
<div id="post-title" class="column"> <div id="post-edit-title" class="column">
<label>TITLE</label> <label>TITLE</label>
<textarea id="post_title" type="text" name="post_title" class="post-edit" placeholder="TITLE"> <textarea id="post-title-text" type="text" name="post-title-text" class="post-edit" placeholder="TITLE">{{ title }}</textarea>
{{- _title -}}
</textarea>
<div id="layouts"> <div id="layouts">
<label>LAYOUTS</label> <label>LAYOUTS</label>
@ -142,9 +162,7 @@
</div> </div>
<div id="post-meta" class="column"> <div id="post-meta" class="column">
<label>TAGS</label> <label>TAGS</label>
<textarea id="post_tags" type="text" name="post_tags" class="form-control" placeholder="tags [comma seperated]"> <textarea id="post-tags" type="text" name="post-tags" class="form-control" placeholder="tags [comma seperated]">{{ tags }}</textarea>
{{- tags -}}
</textarea>
<label>OPTIONS</label> <label>OPTIONS</label>
{% apply spaceless %} {% apply spaceless %}
{{ include("dash/partials/options.twig") }} {{ include("dash/partials/options.twig") }}
@ -155,8 +173,7 @@
</span> </span>
<input id="page-files-upload" type="file" name="page-files-upload" multiple/> <input id="page-files-upload" type="file" name="page-files-upload" multiple/>
<input id="post-image-upload" type="file" name="post-image-upload"/> <input id="post-image-upload" type="file" name="post-image-upload"/>
<input id="form_token" name="token" type="hidden" value="{{ token }}"> <input id="form_token" name="token" type="hidden" value="{{ token }}"></div>
</div>
</div> </div>
</div> </div>
<div id="edit-post"> <div id="edit-post">
@ -164,7 +181,7 @@
{{ include("dash/partials/editor.twig") }} {{ include("dash/partials/editor.twig") }}
{% endapply %} {% endapply %}
<div id="edit-post-wrapper"> <div id="edit-post-wrapper">
<textarea id="edit" spellcheck="false">{{- content -}}</textarea> <textarea id="edit" spellcheck="false">{{ content }}</textarea>
<pre id="highlight"> <pre id="highlight">
<code id="highlight-content" class="language-md"> <code id="highlight-content" class="language-md">
@ -177,5 +194,5 @@
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
<script src="/assets/scripts/Start.js?=dfdfvd" type="text/javascript"></script> <script src="/assets/scripts/Start.js?=wadfdfd" type="text/javascript"></script>
{% endblock %} {% endblock %}

View file

@ -16,7 +16,7 @@
</svg> </svg>
</button> </button>
{% if mode == "edit" %} {% if mode == "edit" %}
<button id="edit-update" class="post-sumbit-btn submit-start editor-button" data-action='blog-update' data-id=page.id type='submit' title="bold"> <button id="edit-update" class="post-sumbit-btn submit-start editor-button" data-action='blog-update' data-id="{{ page['uuid'] }} type='submit' title=" bold">
<svg id="submit-update" viewbox="0 0 20 20" class="icons"> <svg id="submit-update" viewbox="0 0 20 20" class="icons">
<use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-save" data-action='blog-update' data-id="{{ page['uuid'] }}"/> <use id="submit-update" xlink:href="/assets/images/global/sprite.svg#entypo-save" data-action='blog-update' data-id="{{ page['uuid'] }}"/>
</svg> </svg>

View file

@ -27,7 +27,7 @@
{% for page in data['pages'] %} {% for page in data['pages'] %}
{% if page.media[0].type == 'mp4' %} {% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-video-link"> <a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-video-link recent-link">
<video class="post-video" loop muted autoplay> <video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4"> <source src="{{ page.media[0].file }}" type="video/mp4">
@ -40,7 +40,7 @@
</a> </a>
{% else %} {% else %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-link" style="background: url({{ page.media[0].file }}) no-repeat center center / cover"> <a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-link recent-link" style="background: url({{ page.media[0].file }}) no-repeat center center / cover">
<label> <label>
{{ page.title }} {{ page.title }}
</label> </label>

View file

@ -5,7 +5,7 @@
{% endblock %} {% endblock %}
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=adfdff"> <link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=acvcnh">
{% endblock %} {% endblock %}
{% block mainContent %} {% block mainContent %}
@ -23,5 +23,5 @@
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
<script src="/assets/scripts/Start.js?=dfdfsdf" type="text/javascript"></script> <script src="/assets/scripts/Start.js?=dfadsf" type="text/javascript"></script>
{% endblock %} {% endblock %}

View file

@ -1,7 +1,7 @@
{ {
"name": "are0h/fipamo", "name": "are0h/fipamo",
"descriptions": "The most chill no database blog framework ever.", "descriptions": "The most chill no database blog framework ever.",
"version": "2.1.1-beta", "version": "2.5.1-beta",
"homepage": "https://fipamo.blog", "homepage": "https://fipamo.blog",
"authors": [ "authors": [
{ {

444
composer.lock generated
View file

@ -246,16 +246,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.1.0", "version": "2.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "819276bc54e83c160617d3ac0a436c239e479928" "reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/819276bc54e83c160617d3ac0a436c239e479928", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/cb36fee279f7fca01d5d9399ddd1b37e48e2eca1",
"reference": "819276bc54e83c160617d3ac0a436c239e479928", "reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -263,17 +263,20 @@
"league/config": "^1.1.1", "league/config": "^1.1.1",
"php": "^7.4 || ^8.0", "php": "^7.4 || ^8.0",
"psr/event-dispatcher": "^1.0", "psr/event-dispatcher": "^1.0",
"symfony/polyfill-php80": "^1.15" "symfony/deprecation-contracts": "^2.1 || ^3.0",
"symfony/polyfill-php80": "^1.16"
}, },
"require-dev": { "require-dev": {
"cebe/markdown": "^1.0", "cebe/markdown": "^1.0",
"commonmark/cmark": "0.30.0", "commonmark/cmark": "0.30.0",
"commonmark/commonmark.js": "0.30.0", "commonmark/commonmark.js": "0.30.0",
"composer/package-versions-deprecated": "^1.8", "composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4",
"erusev/parsedown": "^1.0", "erusev/parsedown": "^1.0",
"ext-json": "*", "ext-json": "*",
"github/gfm": "0.29.0", "github/gfm": "0.29.0",
"michelf/php-markdown": "^1.4", "michelf/php-markdown": "^1.4",
"nyholm/psr7": "^1.5",
"phpstan/phpstan": "^0.12.88 || ^1.0.0", "phpstan/phpstan": "^0.12.88 || ^1.0.0",
"phpunit/phpunit": "^9.5.5", "phpunit/phpunit": "^9.5.5",
"scrutinizer/ocular": "^1.8.1", "scrutinizer/ocular": "^1.8.1",
@ -288,7 +291,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "2.2-dev" "dev-main": "2.4-dev"
} }
}, },
"autoload": { "autoload": {
@ -345,7 +348,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-12-05T18:25:20+00:00" "time": "2022-05-14T15:37:39+00:00"
}, },
{ {
"name": "league/config", "name": "league/config",
@ -464,12 +467,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"League\\Uri\\": "src"
},
"files": [ "files": [
"src/functions_include.php" "src/functions_include.php"
] ],
"psr-4": {
"League\\Uri\\": "src"
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -725,16 +728,16 @@
}, },
{ {
"name": "nette/utils", "name": "nette/utils",
"version": "v3.2.6", "version": "v3.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/utils.git", "url": "https://github.com/nette/utils.git",
"reference": "2f261e55bd6a12057442045bf2c249806abc1d02" "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/2f261e55bd6a12057442045bf2c249806abc1d02", "url": "https://api.github.com/repos/nette/utils/zipball/0af4e3de4df9f1543534beab255ccf459e7a2c99",
"reference": "2f261e55bd6a12057442045bf2c249806abc1d02", "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -804,9 +807,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nette/utils/issues", "issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v3.2.6" "source": "https://github.com/nette/utils/tree/v3.2.7"
}, },
"time": "2021-11-24T15:47:23+00:00" "time": "2022-01-24T11:29:14+00:00"
}, },
{ {
"name": "nikic/fast-route", "name": "nikic/fast-route",
@ -830,12 +833,12 @@
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": {
"FastRoute\\": "src/"
},
"files": [ "files": [
"src/functions.php" "src/functions.php"
] ],
"psr-4": {
"FastRoute\\": "src/"
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -902,16 +905,16 @@
}, },
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
"version": "v6.5.1", "version": "v6.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git", "url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "dd803df5ad7492e1b40637f7ebd258fee5ca7355" "reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/dd803df5ad7492e1b40637f7ebd258fee5ca7355", "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e43bac82edc26ca04b36143a48bde1c051cfd5b1",
"reference": "dd803df5ad7492e1b40637f7ebd258fee5ca7355", "reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -924,10 +927,10 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2", "doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0", "php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.3.1",
"phpcompatibility/php-compatibility": "^9.3.5", "phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest", "roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6.0", "squizlabs/php_codesniffer": "^3.6.2",
"yoast/phpunit-polyfills": "^1.0.0" "yoast/phpunit-polyfills": "^1.0.0"
}, },
"suggest": { "suggest": {
@ -968,7 +971,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP", "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": { "support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues", "issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.1" "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.0"
}, },
"funding": [ "funding": [
{ {
@ -976,7 +979,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-08-18T09:14:16+00:00" "time": "2022-02-28T15:31:21+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@ -1305,30 +1308,30 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.1.4", "version": "3.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11" "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11", "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=8.0.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1.x-dev" "dev-master": "3.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Psr\\Log\\": "Psr/Log/" "Psr\\Log\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -1349,9 +1352,9 @@
"psr-3" "psr-3"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/log/tree/1.1.4" "source": "https://github.com/php-fig/log/tree/3.0.0"
}, },
"time": "2021-05-03T11:20:27+00:00" "time": "2021-07-14T16:46:02+00:00"
}, },
{ {
"name": "ralouphie/getallheaders", "name": "ralouphie/getallheaders",
@ -1819,22 +1822,22 @@
}, },
{ {
"name": "slim/slim", "name": "slim/slim",
"version": "4.9.0", "version": "4.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/slimphp/Slim.git", "url": "https://github.com/slimphp/Slim.git",
"reference": "44d3c9c0bfcc47e52e42b097b6062689d21b904b" "reference": "0dfc7d2fdf2553b361d864d51af3fe8a6ad168b0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/44d3c9c0bfcc47e52e42b097b6062689d21b904b", "url": "https://api.github.com/repos/slimphp/Slim/zipball/0dfc7d2fdf2553b361d864d51af3fe8a6ad168b0",
"reference": "44d3c9c0bfcc47e52e42b097b6062689d21b904b", "reference": "0dfc7d2fdf2553b361d864d51af3fe8a6ad168b0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"nikic/fast-route": "^1.3", "nikic/fast-route": "^1.3",
"php": "^7.3 || ^8.0", "php": "^7.4 || ^8.0",
"psr/container": "^1.0 || ^2.0", "psr/container": "^1.0 || ^2.0",
"psr/http-factory": "^1.0", "psr/http-factory": "^1.0",
"psr/http-message": "^1.0", "psr/http-message": "^1.0",
@ -1845,13 +1848,15 @@
"require-dev": { "require-dev": {
"adriansuter/php-autoload-override": "^1.2", "adriansuter/php-autoload-override": "^1.2",
"ext-simplexml": "*", "ext-simplexml": "*",
"guzzlehttp/psr7": "^2.0", "guzzlehttp/psr7": "^2.1",
"httpsoft/http-message": "^1.0",
"httpsoft/http-server-request": "^1.0",
"laminas/laminas-diactoros": "^2.8", "laminas/laminas-diactoros": "^2.8",
"nyholm/psr7": "^1.4", "nyholm/psr7": "^1.5",
"nyholm/psr7-server": "^1.0", "nyholm/psr7-server": "^1.0",
"phpspec/prophecy": "^1.14", "phpspec/prophecy": "^1.15",
"phpspec/prophecy-phpunit": "^2.0", "phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12.99", "phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"slim/http": "^1.2", "slim/http": "^1.2",
"slim/psr7": "^1.5", "slim/psr7": "^1.5",
@ -1928,34 +1933,35 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-10-05T03:00:00+00:00" "time": "2022-03-14T14:18:23+00:00"
}, },
{ {
"name": "slim/twig-view", "name": "slim/twig-view",
"version": "3.2.0", "version": "3.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/slimphp/Twig-View.git", "url": "https://github.com/slimphp/Twig-View.git",
"reference": "9ceaff0764ab8e70f9eeee825a9efd0b4e1dfc85" "reference": "df6dd6af6bbe28041be49c9fb8470c2e9b70cd98"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/slimphp/Twig-View/zipball/9ceaff0764ab8e70f9eeee825a9efd0b4e1dfc85", "url": "https://api.github.com/repos/slimphp/Twig-View/zipball/df6dd6af6bbe28041be49c9fb8470c2e9b70cd98",
"reference": "9ceaff0764ab8e70f9eeee825a9efd0b4e1dfc85", "reference": "df6dd6af6bbe28041be49c9fb8470c2e9b70cd98",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.4 || ^8.0",
"psr/http-message": "^1.0", "psr/http-message": "^1.0",
"slim/slim": "^4.7", "slim/slim": "^4.9",
"twig/twig": "^3.1" "symfony/polyfill-php81": "^1.23",
"twig/twig": "^3.3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^0.12.58", "phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^8.5.13 || ^9.3.8", "phpstan/phpstan": "^1.3.0",
"phpunit/phpunit": "^9.5",
"psr/http-factory": "^1.0", "psr/http-factory": "^1.0",
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.6"
"weirdan/prophecy-shim": "^1.0 || ^2.0.2"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -1990,31 +1996,31 @@
], ],
"support": { "support": {
"issues": "https://github.com/slimphp/Twig-View/issues", "issues": "https://github.com/slimphp/Twig-View/issues",
"source": "https://github.com/slimphp/Twig-View/tree/3.2.0" "source": "https://github.com/slimphp/Twig-View/tree/3.3.0"
}, },
"time": "2020-12-08T17:04:14+00:00" "time": "2022-01-02T05:14:45+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
"version": "v2.4.0", "version": "v3.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git", "url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c",
"reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=8.0.2"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "2.4-dev" "dev-main": "3.0-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/contracts", "name": "symfony/contracts",
@ -2043,7 +2049,7 @@
"description": "A generic function and convention to trigger deprecation notices", "description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1"
}, },
"funding": [ "funding": [
{ {
@ -2059,25 +2065,28 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-03-23T23:28:01+00:00" "time": "2022-01-02T09:55:41+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" "reference": "30885182c981ab175d4d034db0f6f469898070ab"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "reference": "30885182c981ab175d4d034db0f6f469898070ab",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.1"
}, },
"provide": {
"ext-ctype": "*"
},
"suggest": { "suggest": {
"ext-ctype": "For best performance" "ext-ctype": "For best performance"
}, },
@ -2092,12 +2101,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -2122,7 +2131,7 @@
"portable" "portable"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -2138,20 +2147,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-19T12:13:01+00:00" "time": "2021-10-20T20:35:02+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-grapheme", "name": "symfony/polyfill-intl-grapheme",
"version": "v1.23.1", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
"reference": "16880ba9c5ebe3642d1995ab866db29270b36535" "reference": "81b86b50cf841a64252b439e738e97f4a34e2783"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783",
"reference": "16880ba9c5ebe3642d1995ab866db29270b36535", "reference": "81b86b50cf841a64252b439e738e97f4a34e2783",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2171,12 +2180,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -2203,7 +2212,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -2219,11 +2228,11 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-27T12:26:48+00:00" "time": "2021-11-23T21:10:46+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-normalizer", "name": "symfony/polyfill-intl-normalizer",
"version": "v1.23.0", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -2252,12 +2261,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -2287,7 +2296,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -2307,21 +2316,24 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.23.1", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.1"
}, },
"provide": {
"ext-mbstring": "*"
},
"suggest": { "suggest": {
"ext-mbstring": "For best performance" "ext-mbstring": "For best performance"
}, },
@ -2336,12 +2348,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -2367,7 +2379,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -2383,20 +2395,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-27T12:26:48+00:00" "time": "2021-11-30T18:21:41+00:00"
}, },
{ {
"name": "symfony/polyfill-php80", "name": "symfony/polyfill-php80",
"version": "v1.23.1", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2413,12 +2425,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -2450,7 +2462,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
}, },
"funding": [ "funding": [
{ {
@ -2466,30 +2478,109 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-28T13:41:28+00:00" "time": "2022-03-04T08:16:47+00:00"
}, },
{ {
"name": "symfony/property-access", "name": "symfony/polyfill-php81",
"version": "v5.3.8", "version": "v1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/property-access.git", "url": "https://github.com/symfony/polyfill-php81.git",
"reference": "2fbab5f95ddb6b8e85f38a6a8a04a17c0acc4d66" "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/2fbab5f95ddb6b8e85f38a6a8a04a17c0acc4d66", "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f",
"reference": "2fbab5f95ddb6b8e85f38a6a8a04a17c0acc4d66", "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php81\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-09-13T13:58:11+00:00"
},
{
"name": "symfony/property-access",
"version": "v5.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "fe501d498d6ec7e9efe928c90fabedf629116495"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495",
"reference": "fe501d498d6ec7e9efe928c90fabedf629116495",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1", "symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16", "symfony/polyfill-php80": "^1.16",
"symfony/property-info": "^5.2" "symfony/property-info": "^5.2|^6.0"
}, },
"require-dev": { "require-dev": {
"symfony/cache": "^4.4|^5.0" "symfony/cache": "^4.4|^5.0|^6.0"
}, },
"suggest": { "suggest": {
"psr/cache-implementation": "To cache access methods." "psr/cache-implementation": "To cache access methods."
@ -2531,7 +2622,7 @@
"reflection" "reflection"
], ],
"support": { "support": {
"source": "https://github.com/symfony/property-access/tree/v5.3.8" "source": "https://github.com/symfony/property-access/tree/v5.4.8"
}, },
"funding": [ "funding": [
{ {
@ -2547,39 +2638,38 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-09-10T11:55:24+00:00" "time": "2022-04-12T15:48:08+00:00"
}, },
{ {
"name": "symfony/property-info", "name": "symfony/property-info",
"version": "v5.3.8", "version": "v6.0.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/property-info.git", "url": "https://github.com/symfony/property-info.git",
"reference": "39de5bed8c036f76ec0457ec52908e45d5497947" "reference": "0f26f0870f05d65d5c06681ecbf36e546204f4b5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/39de5bed8c036f76ec0457ec52908e45d5497947", "url": "https://api.github.com/repos/symfony/property-info/zipball/0f26f0870f05d65d5c06681ecbf36e546204f4b5",
"reference": "39de5bed8c036f76ec0457ec52908e45d5497947", "reference": "0f26f0870f05d65d5c06681ecbf36e546204f4b5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.1", "symfony/string": "^5.4|^6.0"
"symfony/polyfill-php80": "^1.16",
"symfony/string": "^5.1"
}, },
"conflict": { "conflict": {
"phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/reflection-docblock": "<5.2",
"phpdocumentor/type-resolver": "<1.4.0", "phpdocumentor/type-resolver": "<1.4.0",
"symfony/dependency-injection": "<4.4" "symfony/dependency-injection": "<5.4"
}, },
"require-dev": { "require-dev": {
"doctrine/annotations": "^1.10.4", "doctrine/annotations": "^1.10.4",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "phpdocumentor/reflection-docblock": "^5.2",
"symfony/cache": "^4.4|^5.0", "phpstan/phpdoc-parser": "^1.0",
"symfony/dependency-injection": "^4.4|^5.0", "symfony/cache": "^5.4|^6.0",
"symfony/serializer": "^4.4|^5.0" "symfony/dependency-injection": "^5.4|^6.0",
"symfony/serializer": "^5.4|^6.0"
}, },
"suggest": { "suggest": {
"phpdocumentor/reflection-docblock": "To use the PHPDoc", "phpdocumentor/reflection-docblock": "To use the PHPDoc",
@ -2621,7 +2711,7 @@
"validator" "validator"
], ],
"support": { "support": {
"source": "https://github.com/symfony/property-info/tree/v5.3.8" "source": "https://github.com/symfony/property-info/tree/v6.0.7"
}, },
"funding": [ "funding": [
{ {
@ -2637,44 +2727,46 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-09-07T07:41:40+00:00" "time": "2022-03-31T17:18:25+00:00"
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.3.10", "version": "v6.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c" "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d",
"reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=8.0.2",
"symfony/polyfill-ctype": "~1.8", "symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-grapheme": "~1.0",
"symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0",
"symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-mbstring": "~1.0"
"symfony/polyfill-php80": "~1.15" },
"conflict": {
"symfony/translation-contracts": "<2.0"
}, },
"require-dev": { "require-dev": {
"symfony/error-handler": "^4.4|^5.0", "symfony/error-handler": "^5.4|^6.0",
"symfony/http-client": "^4.4|^5.0", "symfony/http-client": "^5.4|^6.0",
"symfony/translation-contracts": "^1.1|^2", "symfony/translation-contracts": "^2.0|^3.0",
"symfony/var-exporter": "^4.4|^5.0" "symfony/var-exporter": "^5.4|^6.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Component\\String\\": ""
},
"files": [ "files": [
"Resources/functions.php" "Resources/functions.php"
], ],
"psr-4": {
"Symfony\\Component\\String\\": ""
},
"exclude-from-classmap": [ "exclude-from-classmap": [
"/Tests/" "/Tests/"
] ]
@ -2704,7 +2796,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.3.10" "source": "https://github.com/symfony/string/tree/v6.0.8"
}, },
"funding": [ "funding": [
{ {
@ -2720,20 +2812,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-10-27T18:21:46+00:00" "time": "2022-04-22T08:18:02+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v5.4.2", "version": "v5.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "b9eb163846a61bb32dfc147f7859e274fab38b58" "reference": "e80f87d2c9495966768310fc531b487ce64237a2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/b9eb163846a61bb32dfc147f7859e274fab38b58", "url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2",
"reference": "b9eb163846a61bb32dfc147f7859e274fab38b58", "reference": "e80f87d2c9495966768310fc531b487ce64237a2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2779,7 +2871,7 @@
"description": "Loads and dumps YAML files", "description": "Loads and dumps YAML files",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/yaml/tree/v5.4.2" "source": "https://github.com/symfony/yaml/tree/v5.4.3"
}, },
"funding": [ "funding": [
{ {
@ -2795,20 +2887,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-12-16T21:58:21+00:00" "time": "2022-01-26T16:32:32+00:00"
}, },
{ {
"name": "tgalopin/html-sanitizer", "name": "tgalopin/html-sanitizer",
"version": "1.4.0", "version": "1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/tgalopin/html-sanitizer.git", "url": "https://github.com/tgalopin/html-sanitizer.git",
"reference": "56cca6b48de4e50d16a4f549e3e677ae0d561e91" "reference": "5d02dcb6f2ea4f505731eac440798caa1b3b0913"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/tgalopin/html-sanitizer/zipball/56cca6b48de4e50d16a4f549e3e677ae0d561e91", "url": "https://api.github.com/repos/tgalopin/html-sanitizer/zipball/5d02dcb6f2ea4f505731eac440798caa1b3b0913",
"reference": "56cca6b48de4e50d16a4f549e3e677ae0d561e91", "reference": "5d02dcb6f2ea4f505731eac440798caa1b3b0913",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2816,7 +2908,7 @@
"league/uri-parser": "^1.4.1", "league/uri-parser": "^1.4.1",
"masterminds/html5": "^2.4", "masterminds/html5": "^2.4",
"php": ">=7.1", "php": ">=7.1",
"psr/log": "^1.0" "psr/log": "^1.0|^2.0|^3.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7.4", "phpunit/phpunit": "^7.4",
@ -2841,22 +2933,22 @@
"description": "Sanitize untrustworthy HTML user input", "description": "Sanitize untrustworthy HTML user input",
"support": { "support": {
"issues": "https://github.com/tgalopin/html-sanitizer/issues", "issues": "https://github.com/tgalopin/html-sanitizer/issues",
"source": "https://github.com/tgalopin/html-sanitizer/tree/master" "source": "https://github.com/tgalopin/html-sanitizer/tree/1.5.0"
}, },
"time": "2020-02-03T16:51:08+00:00" "time": "2021-09-14T08:27:50+00:00"
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.3.3", "version": "v3.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569" "reference": "e939eae92386b69b49cfa4599dd9bead6bf4a342"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/a27fa056df8a6384316288ca8b0fa3a35fdeb569", "url": "https://api.github.com/repos/twigphp/Twig/zipball/e939eae92386b69b49cfa4599dd9bead6bf4a342",
"reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569", "reference": "e939eae92386b69b49cfa4599dd9bead6bf4a342",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2871,7 +2963,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.3-dev" "dev-master": "3.4-dev"
} }
}, },
"autoload": { "autoload": {
@ -2907,7 +2999,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.3" "source": "https://github.com/twigphp/Twig/tree/v3.4.1"
}, },
"funding": [ "funding": [
{ {
@ -2919,7 +3011,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-09-17T08:44:23+00:00" "time": "2022-05-17T05:48:52+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],

18881
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "fipamo-dash", "name": "fipamo-dash",
"version": "2.5.0", "version": "2.5.1-beta",
"private": true, "private": true,
"apidoc": { "apidoc": {
"name": "Fipamo API", "name": "Fipamo API",
@ -13,7 +13,10 @@
"eslint": "^8.11.0", "eslint": "^8.11.0",
"eslint-plugin-babel": "^5.3.1", "eslint-plugin-babel": "^5.3.1",
"parcel": "^2.0.1", "parcel": "^2.0.1",
"prettier": "^2.6.0" "prettier": "^2.6.0",
"stylelint": "^14.8.2",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard-scss": "^3.0.0"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.16.5", "@babel/core": "^7.16.5",

156
phpcs.xml
View file

@ -1,156 +0,0 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>The coding standard for PHP_CodeSniffer itself.</description>
<file>autoload.php</file>
<file>bin</file>
<file>scripts</file>
<file>src</file>
<file>tests</file>
<exclude-pattern>*/src/Standards/*/Tests/*\.(inc|css|js)$</exclude-pattern>
<exclude-pattern>*/tests/Core/*/*\.(inc|css|js)$</exclude-pattern>
<arg name="basepath" value="."/>
<arg name="colors"/>
<arg name="parallel" value="75"/>
<arg value="np"/>
<!-- Don't hide tokenizer exceptions -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<!-- Include the whole PEAR standard -->
<rule ref="PEAR">
<exclude name="PEAR.NamingConventions.ValidFunctionName"/>
<exclude name="PEAR.NamingConventions.ValidVariableName"/>
<exclude name="PEAR.Commenting.ClassComment"/>
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
<exclude name="PEAR.Commenting.InlineComment"/>
</rule>
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<rule ref="Squiz.Arrays.ArrayDeclaration"/>
<rule ref="Squiz.Commenting.ClosingDeclarationComment"/>
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Squiz.ControlStructures.ElseIfDeclaration"/>
<rule ref="Squiz.Commenting.BlockComment"/>
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
<rule ref="Squiz.Commenting.InlineComment"/>
<rule ref="Squiz.Commenting.LongConditionClosingComment"/>
<rule ref="Squiz.Commenting.PostStatementComment"/>
<rule ref="Squiz.Commenting.VariableComment"/>
<rule ref="Squiz.Formatting.OperatorBracket"/>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
<rule ref="Squiz.Operators.ComparisonOperatorUsage"/>
<rule ref="Squiz.PHP.DisallowInlineIf"/>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/>
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<rule ref="PSR2.Methods.MethodDeclaration"/>
<rule ref="PSR2.Files.EndFileNewline"/>
<rule ref="PSR12.Files.OpenTag"/>
<rule ref="Zend.Files.ClosingTag"/>
<!-- PEAR uses warnings for inline control structures, so switch back to errors -->
<rule ref="Generic.ControlStructures.InlineControlStructure">
<properties>
<property name="error" value="true"/>
</properties>
</rule>
<!-- We use custom indent rules for arrays -->
<rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
<severity>0</severity>
</rule>
<!-- Check var names, but we don't want leading underscores for private vars -->
<rule ref="Squiz.NamingConventions.ValidVariableName"/>
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
<severity>0</severity>
</rule>
<!-- Only one argument per line in multi-line function calls -->
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false"/>
</properties>
</rule>
<!-- Have 12 chars padding maximum and always show as errors -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="12"/>
<property name="error" value="true"/>
</properties>
</rule>
<!-- Ban some functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="print" value="echo"/>
<element key="is_null" value="null"/>
<element key="create_function" value="null"/>
</property>
</properties>
</rule>
<!-- Private methods MUST not be prefixed with an underscore -->
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<type>error</type>
</rule>
<!-- Private properties MUST not be prefixed with an underscore -->
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<type>error</type>
</rule>
<!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<exclude-pattern>tests/bootstrap\.php</exclude-pattern>
</rule>
<!-- This test file specifically *needs* Windows line endings for testing purposes. -->
<rule ref="Generic.Files.LineEndings.InvalidEOLChar">
<exclude-pattern>tests/Core/Tokenizer/StableCommentWhitespaceWinTest\.php</exclude-pattern>
</rule>
</ruleset>

File diff suppressed because it is too large Load diff

View file

@ -1638,7 +1638,7 @@ class PostEditor {
//-------------------------- //--------------------------
constructor(){ constructor(){
this.processing = false; this.processing = false;
let self = 'this'; let self = "this";
this.admin = new _fipamoAdminAPIDefault.default(null, document.getElementById('notify-progress')); this.admin = new _fipamoAdminAPIDefault.default(null, document.getElementById('notify-progress'));
this.mm = new _maintenanceManagerDefault.default(null, null, document.getElementById('notify-progress')); this.mm = new _maintenanceManagerDefault.default(null, null, document.getElementById('notify-progress'));
this.urlPieces = document.URL.split('/'); this.urlPieces = document.URL.split('/');
@ -1663,7 +1663,7 @@ class PostEditor {
this.editor.addListener(_editorEvent.EDITOR_SAVE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_SAVE) this.editor.addListener(_editorEvent.EDITOR_SAVE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_SAVE)
, false); , false);
document.getElementById('post-image-upload').addEventListener('change', (e)=>{ document.getElementById('post-image-upload').addEventListener('change', (e)=>{
this.handleImageUpload(e.target.id, e.target.files); self.handleImageUpload(e.target.id, e.target.files);
}, false); }, false);
/* /*
TinyDatePicker(document.getElementById('post-date'), { TinyDatePicker(document.getElementById('post-date'), {
@ -1798,10 +1798,10 @@ class PostActions {
pageInfo.append('layout', document.getElementById('post-edit-index').getAttribute('data-layout')); pageInfo.append('layout', document.getElementById('post-edit-index').getAttribute('data-layout'));
pageInfo.append('current_title', document.getElementById('post-edit-index').getAttribute('data-slug')); pageInfo.append('current_title', document.getElementById('post-edit-index').getAttribute('data-slug'));
pageInfo.append('content', html); pageInfo.append('content', html);
pageInfo.append('title', document.getElementById('post_title').value); pageInfo.append('title', document.getElementById('post-title-text').value);
pageInfo.append('created', document.getElementById('post-date').getAttribute('data-raw')); pageInfo.append('created', document.getElementById('post-date').getAttribute('data-raw'));
pageInfo.append('slug', new _stringUtilsDefault.default().cleanString(document.getElementById('post_title').value)); pageInfo.append('slug', new _stringUtilsDefault.default().cleanString(document.getElementById('post-title-text').value));
pageInfo.append('tags', document.getElementById('post_tags').value); pageInfo.append('tags', document.getElementById('post-tags').value);
pageInfo.append('menu', document.getElementById('option-menu-pin').getAttribute('data-active')); pageInfo.append('menu', document.getElementById('option-menu-pin').getAttribute('data-active'));
pageInfo.append('featured', document.getElementById('option-feature').getAttribute('data-active')); pageInfo.append('featured', document.getElementById('option-feature').getAttribute('data-active'));
pageInfo.append('published', document.getElementById('option-published').getAttribute('data-active')); pageInfo.append('published', document.getElementById('option-published').getAttribute('data-active'));
@ -1810,7 +1810,7 @@ class PostActions {
if (files.length > 0 && files != null) for(var i = 0; i < files.length; i++){ if (files.length > 0 && files != null) for(var i = 0; i < files.length; i++){
var file = files[i]; var file = files[i];
if (file.type.match('image.*') || file.type.match('video.mp4') || file.type.match('audio.mpeg') || file.type.match('application.pdf') || file.type.match('text.plain') || file.type.match('text.rtf')) pageInfo.append('page_files[]', file, file.name); if (file.type.match('image.*') || file.type.match('video.mp4') || file.type.match('audio.mpeg') || file.type.match('application.pdf') || file.type.match('text.plain') || file.type.match('text.rtf')) pageInfo.append('page_files[]', file, file.name);
else reject('Not an image file'); else reject('Not an image file: ' + file.type);
} }
else //check to see if image exists else //check to see if image exists
if (document.getElementById('featured-image')) { if (document.getElementById('featured-image')) {
@ -4012,14 +4012,14 @@ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports); parcelHelpers.defineInteropFlag(exports);
var _animeEsJs = require("animejs/lib/anime.es.js"); var _animeEsJs = require("animejs/lib/anime.es.js");
var _animeEsJsDefault = parcelHelpers.interopDefault(_animeEsJs); var _animeEsJsDefault = parcelHelpers.interopDefault(_animeEsJs);
const notifcation = document.getElementById("notifications"); const notifcation = document.getElementById('notifications');
const notify = document.getElementById("notifyMessage"); const notify = document.getElementById('notify-message');
const messageText = document.getElementById("message-text"); const messageText = document.getElementById('message-text');
const notifyText = document.getElementById("notify-text"); const notifyText = document.getElementById('notify-text');
const notifyProgress = document.getElementById("notify-progress"); const notifyProgress = document.getElementById('notify-progress');
const iconGood = document.getElementById("notify-good"); const iconGood = document.getElementById('notify-good');
const iconLame = document.getElementById("notify-lame"); const iconLame = document.getElementById('notify-lame');
const iconWorking = document.getElementById("notify-working"); const iconWorking = document.getElementById('notify-working');
class Notfications { class Notfications {
//-------------------------- //--------------------------
// constructor // constructor
@ -4029,66 +4029,66 @@ class Notfications {
// methods // methods
//-------------------------- //--------------------------
alert(text, status) { alert(text, status) {
iconWorking.style.display = "none"; iconWorking.style.display = 'none';
iconGood.style.display = "none"; iconGood.style.display = 'none';
iconLame.style.display = "none"; iconLame.style.display = 'none';
var color = ""; var color = '';
if (status !== null) { if (status !== null) {
_animeEsJsDefault.default({ _animeEsJsDefault.default({
targets: notifyProgress, targets: notifyProgress,
opacity: 0, opacity: 0,
easing: "easeInOutQuint", easing: 'easeInOutQuint',
duration: 500 duration: 500
}); });
if (status) { if (status) {
color = "#32cd32"; color = '#32cd32';
iconWorking.style.display = "none"; iconWorking.style.display = 'none';
iconGood.style.display = "block"; iconGood.style.display = 'block';
} else { } else {
color = "#F64747"; color = '#F64747';
iconWorking.style.display = "none"; iconWorking.style.display = 'none';
iconLame.style.display = "block"; iconLame.style.display = 'block';
} }
} else { } else {
color = "#200317"; color = '#200317';
iconWorking.style.display = "block"; iconWorking.style.display = 'block';
_animeEsJsDefault.default({ _animeEsJsDefault.default({
targets: notifyProgress, targets: notifyProgress,
opacity: 1, opacity: 1,
easing: "easeInOutQuint", easing: 'easeInOutQuint',
duration: 500 duration: 500
}); });
} }
messageText.innerHTML = text; messageText.innerHTML = text;
_animeEsJsDefault.default({ _animeEsJsDefault.default({
targets: notifcation, targets: notifcation,
marginTop: "-10", marginTop: '-10',
easing: "easeInOutQuint", easing: 'easeInOutQuint',
duration: 10, duration: 10,
complete: ()=>{ complete: ()=>{
_animeEsJsDefault.default({ _animeEsJsDefault.default({
targets: notify, targets: notify,
rotateX: "0", rotateX: '0',
easing: "easeInOutQuint", easing: 'easeInOutQuint',
duration: 700 duration: 700
}); });
_animeEsJsDefault.default({ _animeEsJsDefault.default({
targets: notifyText, targets: notifyText,
backgroundColor: color, backgroundColor: color,
easing: "easeInOutQuint", easing: 'easeInOutQuint',
duration: 700, duration: 700,
complete: ()=>{ complete: ()=>{
setTimeout(()=>{ setTimeout(()=>{
if (status !== null) _animeEsJsDefault.default({ if (status !== null) _animeEsJsDefault.default({
targets: notify, targets: notify,
rotateX: "-120", rotateX: '-120',
easing: "easeInOutQuint", easing: 'easeInOutQuint',
duration: 700, duration: 700,
complete: ()=>{ complete: ()=>{
_animeEsJsDefault.default({ _animeEsJsDefault.default({
targets: notifcation, targets: notifcation,
marginTop: "-55", marginTop: '-55',
easing: "easeInOutQuint", easing: 'easeInOutQuint',
delay: 700, delay: 700,
duration: 50 duration: 50
}); //notifcation.style.display = 'none'; }); //notifcation.style.display = 'none';
@ -5424,6 +5424,20 @@ class FileManager {
this.files = []; this.files = [];
this.sortedFiles = []; this.sortedFiles = [];
this.storage = []; this.storage = [];
this.mediaSort = _sortablejsDefault.default.create(this.imageList, {
animation: 150,
onUpdate: ()=>{
notify.alert('REINDEXING MEDIA', null);
this.updateFiles();
}
});
this.fileSort = _sortablejsDefault.default.create(this.fileList, {
animation: 150,
onUpdate: ()=>{
notify.alert('REINDEXING FILES', null);
this.updateFiles();
}
});
this.start(); this.start();
} }
// methods // methods
@ -5435,38 +5449,9 @@ class FileManager {
, false); , false);
this.input.addEventListener('change', (e)=>this.handleFileActions(e) this.input.addEventListener('change', (e)=>this.handleFileActions(e)
, false); , false);
_sortablejsDefault.default.create(this.imageList, { var removeMedia = document.querySelectorAll('.media-remove');
onUpdate: (e)=>{ for(var i = 0, length = removeMedia.length; i < length; i++)removeMedia[i].addEventListener('click', (e)=>this.removeFile(e, 'media')
notify.alert('REINDEXING FILES', null); , false);
let currentFiles = []; //store current list
let items = e.target.children;
for(let index = 0; index < items.length; index++){
var item = items[index];
let url = '';
if (item.className == 'img-item') url = item.style.backgroundImage.slice(4, -1).replace(/"/g, '');
else url = item.getAttribute('data-source');
currentFiles.push({
earl: url
});
}
this.reindexFiles(currentFiles, 0);
}
});
_sortablejsDefault.default.create(this.fileList, {
onUpdate: (e)=>{
notify.alert('REINDEXING FILES', null);
let currentFiles = [];
let items = e.target.children;
for(let index = 0; index < items.length; index++){
var item = items[index];
let url = item.getAttribute('data-source');
currentFiles.push({
earl: url
});
}
this.reindexFiles(currentFiles, 0);
}
});
} }
getFiles() { getFiles() {
return this.files; return this.files;
@ -5475,28 +5460,34 @@ class FileManager {
let count = sortOrder.length; let count = sortOrder.length;
if (step == 0) this.files = []; if (step == 0) this.files = [];
var utils = new _dataUtilsDefault.default(); var utils = new _dataUtilsDefault.default();
var path = sortOrder[step].earl.split('/');
utils.imgLoad(sortOrder[step].earl).then((blob)=>{ utils.imgLoad(sortOrder[step].earl).then((blob)=>{
var fresh = new File([ var fresh = new File([
blob blob
], path[6], { ], sortOrder[step].fileName, {
type: blob.type type: blob.type
}); });
this.files.push(fresh); this.files.push(fresh);
if (this.files.length <= count - 1) this.reindexFiles(sortOrder, ++step); var limit = count - 1;
else notify.alert('FILES READY TO UPLOAD', true); if (this.files.length <= limit) {
step = step + 1;
this.reindexFiles(sortOrder, step);
} else notify.alert('FILES READY TO UPLOAD', true);
}); });
} }
sortFiles(files) { sortFiles(files) {
var self = this; var self = this;
this.files = []; //clear files array
this.imageList.innerHTML = '';
this.fileList.innerHTML = '';
for(var i = 0, file1; file1 = files[i]; i++){ for(var i = 0, file1; file1 = files[i]; i++){
var reader = new FileReader(); // Closure to capture the file information var reader = new FileReader(); // Closure to capture the file information
reader.onload = ((theFile)=>{ reader.onload = ((theFile)=>{
return function(f) { return function(f) {
// sort files //create remove button object
var remove = document.createElement('button');
remove.className = 'media-remove';
remove.innerHTML = 'X';
remove.addEventListener('click', (e)=>self.removeFile(e, 'media')
, false); //get counts for lists
var mediaCount = self.imageList.childNodes.length;
var fileCount = self.fileList.childNodes.length; // sort files
switch(theFile.type){ switch(theFile.type){
case 'image/jpg': case 'image/jpg':
case 'image/jpeg': case 'image/jpeg':
@ -5504,13 +5495,12 @@ class FileManager {
case 'image/svg': case 'image/svg':
case 'image/png': case 'image/png':
//create element and add to list //create element and add to list
var image = document.createElement('img'); //var image = document.createElement('img');
image.src = f.target.result; //image.src = f.target.result;
image.title = escape(theFile.name); //image.title = escape(theFile.name);
var span = document.createElement('div'); var span = document.createElement('div');
span.style.background = 'url(' + f.target.result + ') no-repeat center center / cover'; span.style.background = 'url(' + f.target.result + ') no-repeat center center / cover';
span.className = 'img-item'; span.className = 'img-item'; //image.setAttribute('id', i);
image.setAttribute('id', i);
self.storage.push([ self.storage.push([
{ {
id: 'page_image' + i, id: 'page_image' + i,
@ -5519,22 +5509,33 @@ class FileManager {
name: escape(theFile.name) name: escape(theFile.name)
} }
]); ]);
self.imageList.appendChild(span); //add to files list if (mediaCount < 0) mediaCount = 0;
self.files.push(theFile); span.setAttribute('id', mediaCount);
remove.setAttribute('id', mediaCount);
span.setAttribute('data-file-name', theFile.name);
span.appendChild(remove);
self.imageList.appendChild(span);
break; break;
case 'video/mp4': case 'video/mp4':
var video = document.createElement('div'); var video = document.createElement('div');
video.className = 'video-item'; video.className = 'video-item';
video.setAttribute('data-source', f.target.result); video.setAttribute('data-source', f.target.result);
if (mediaCount < 0) mediaCount = 0;
video.setAttribute('id', mediaCount);
remove.setAttribute('id', mediaCount);
video.setAttribute('data-file-name', theFile.name);
video.appendChild(remove);
self.imageList.appendChild(video); self.imageList.appendChild(video);
self.files.push(theFile);
break; break;
case 'audio/mpeg': case 'audio/mpeg':
var sound = document.createElement('div'); var sound = document.createElement('div');
sound.className = 'audio-item'; sound.className = 'audio-item';
sound.setAttribute('data-source', f.target.result); sound.setAttribute('data-source', f.target.result);
sound.setAttribute('id', fileCount);
remove.setAttribute('id', fileCount);
sound.setAttribute('data-file-name', theFile.name);
sound.appendChild(remove);
self.fileList.appendChild(sound); self.fileList.appendChild(sound);
self.files.push(theFile);
break; break;
case 'application/pdf': case 'application/pdf':
case 'text/plain': case 'text/plain':
@ -5542,31 +5543,75 @@ class FileManager {
var file = document.createElement('div'); var file = document.createElement('div');
file.className = 'file-item'; file.className = 'file-item';
file.setAttribute('data-source', f.target.result); file.setAttribute('data-source', f.target.result);
file.setAttribute('id', fileCount);
remove.setAttribute('id', fileCount);
file.setAttribute('data-file-name', theFile.name);
file.appendChild(remove);
self.fileList.appendChild(file); self.fileList.appendChild(file);
self.files.push(theFile);
break; break;
} }
}; };
})(file1); // Read in the image file as a data URL. })(file1); // Read in the image file as a data URL.
reader.readAsDataURL(file1); reader.readAsDataURL(file1);
} } //give the script a beat to add the child nodes, then update it all
setTimeout(()=>{
self.updateFiles();
}, 50);
} }
// event handlers // event handlers
//-------------------------- //--------------------------
handleFileActions(e) { updateFiles() {
e.stopPropagation(); let currentFiles = []; //store current list
e.preventDefault(); let items = []; //get files from media and files list
for(let index = 0; index < this.imageList.childNodes.length; index++)items.push(this.imageList.childNodes[index]);
for(let index1 = 0; index1 < this.fileList.childNodes.length; index1++)items.push(this.fileList.childNodes[index1]);
for(let index2 = 0; index2 < items.length; index2++){
var item = items[index2];
let url = '';
if (item.className == 'img-item') url = item.style.backgroundImage.slice(4, -1).replace(/"/g, '');
else url = item.getAttribute('data-source');
currentFiles.push({
earl: url,
fileName: item.getAttribute('data-file-name')
});
}
this.reindexFiles(currentFiles, 0);
}
removeFile(e) {
var list = [];
switch(e.target.parentNode.className){
case 'img-item':
case 'video-item':
list = this.imageList;
break;
case 'audio-item':
case 'file-item':
list = this.fileList;
break;
}
for(let index = 0; index < list.childNodes.length; index++){
let media = list.childNodes[index];
if (media.id == e.target.id) {
list.removeChild(media);
notify.alert('REINDEXING MEDIA', null);
this.updateFiles();
}
}
}
handleFileActions(e1) {
e1.stopPropagation();
e1.preventDefault();
let self = this; let self = this;
let rawList = []; let rawList = [];
let sortedList = []; let sortedList = [];
let notOnTheList = []; let notOnTheList = [];
switch(e.type){ switch(e1.type){
case 'dragover': case 'dragover':
e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. e1.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
break; break;
case 'change': case 'change':
case 'drop': case 'drop':
e.type == 'drop' ? rawList = e.dataTransfer.files : rawList = e.target.files; e1.type == 'drop' ? rawList = e1.dataTransfer.files : rawList = e1.target.files;
for(var i = 0, f; f = rawList[i]; i++)// check witch files are cool to upload for(var i = 0, f; f = rawList[i]; i++)// check witch files are cool to upload
if (this.accetableFiles.includes(f.type)) sortedList.push(f); if (this.accetableFiles.includes(f.type)) sortedList.push(f);
else notOnTheList.push(f); else notOnTheList.push(f);

43
src/styles/dash.scss Normal file
View file

@ -0,0 +1,43 @@
@use "sass:color";
//CSS
//Bulma
@import "../../node_modules/bulma/sass/utilities/_all";
@import "../../node_modules/bulma/sass/grid/columns";
//Colors
@import "main/_colors";
//Mixins
@import "main/_mixins";
//Normalize
@import "main/_normalize";
//Typography
@import "main/_typography";
//Main Structure
@import "main/_structure";
//Index
@import "main/_index";
//Settings
@import "main/_settings";
//Error
@import "main/_error";
//Navigation
@import "main/_navigation";
//Forms
@import "main/_forms";
//Posts
@import "main/_posts";
//Editor
@import "main/_calendar";
@import "main/_editor";
@import "main/_editor-highlight";

View file

@ -0,0 +1,327 @@
.dp-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 2000;
}
.dp {
position: relative;
background: $primary;
box-shadow: 2px 2px 16px rgba(#000, 0.25);
line-height: 1.4;
border-radius: 4px;
max-height: 400px;
z-index: 5000;
padding-top: 6px;
overflow: hidden;
-webkit-tap-highlight-color: transparent;
}
.dp::before {
content: ' ';
height: 6px;
position: absolute;
top: 0;
left: 0;
right: 0;
background: $highlight;
}
.dp-permanent .dp {
padding-top: 0;
border: 1px solid #eee;
box-shadow: none;
}
.dp-permanent .dp::before {
display: none;
}
.dp-cal {
min-height: 300px;
}
.dp-below {
position: absolute;
font-size: 0.8em;
width: 400px;
max-width: 90vw;
}
.dp-permanent {
position: relative;
font-size: 0.8em;
width: 400px;
max-width: 100vw;
}
.dp-permanent .dp {
z-index: 0;
}
.dp-modal .dp {
position: absolute;
top: 50%;
left: 50%;
max-width: 600px;
width: calc(100% - 4em);
transform: translate(-50%, -50%);
animation: slide-up 0.3s forwards;
}
.dp-months {
padding: 24px;
}
.dp-years {
box-sizing: border-box;
max-height: 400px;
padding: 8px 0;
/* HACK for Chrome on Android */
overflow: auto !important;
}
.dp-cal-month,
.dp-cal-year,
.dp-day,
.dp-month,
.dp-year {
box-sizing: border-box;
text-align: center;
text-decoration: none;
position: relative;
color: $white;
border-radius: 2px;
border: 0;
background: transparent;
}
.dp-cal-header {
position: relative;
text-align: center;
padding-bottom: 16px;
background: color.adjust($primary, $lightness: -10%);
}
.dp-next,
.dp-prev {
position: absolute;
width: 30px;
height: 30px;
overflow: hidden;
top: 14px;
color: color.adjust($primary, $lightness: -50%);
border-radius: 2px;
border: 0;
background: transparent;
}
.dp-prev {
left: 24px;
}
.dp-next {
right: 24px;
}
.dp-next:focus,
.dp-prev:focus,
.dp-next:hover,
.dp-prev:hover {
outline: none;
color: inherit;
}
.dp-prev::before,
.dp-next::before {
content: '';
border: 2px solid;
width: 10px;
height: 10px;
display: inline-block;
transform: rotate(-45deg);
transition: border-color 0.2s;
margin: 9px 0 40px 4px;
}
.dp-prev::before {
border-right: 0;
border-bottom: 0;
}
.dp-next::before {
border-left: 0;
border-top: 0;
margin-left: 0;
margin-right: 4px;
}
.dp-cal-month,
.dp-cal-year {
display: inline-block;
font-size: 1.4em;
padding: 16px 8px 8px;
outline: none;
}
.dp-cal-footer {
text-align: center;
background: color.adjust($primary, $lightness: -10%);
}
.dp-day-today::after {
content: '';
height: 0;
width: 0;
border: 7px solid $highlight;
border-bottom-color: transparent;
border-left-color: transparent;
position: absolute;
top: 0;
right: 0;
}
.dp-close,
.dp-clear,
.dp-today {
box-sizing: border-box;
display: inline-block;
width: 33%;
padding: 8px;
text-decoration: none;
color: color.adjust($primary, $lightness: -50%);
border: 0;
background: transparent;
}
.dp-permanent .dp-close,
.dp-permanent .dp-clear {
display: none;
}
.dp-close:active,
.dp-clear:active,
.dp-today:active,
.dp-next:active,
.dp-prev:active,
.dp-cal-month:active,
.dp-cal-year:active {
background: $highlight;
color: $white;
}
@media screen and (min-device-width: 1200px) {
.dp-close:hover,
.dp-close:focus,
.dp-clear:hover,
.dp-clear:focus,
.dp-today:hover,
.dp-today:focus,
.dp-next:hover,
.dp-next:focus,
.dp-prev:hover,
.dp-prev:focus,
.dp-cal-month:focus,
.dp-cal-month:hover,
.dp-cal-year:hover,
.dp-cal-year:focus {
background: $highlight;
color: $white;
}
}
.dp-col-header,
.dp-day {
width: 14.2857%;
display: inline-block;
padding: 8px;
text-align: center;
}
.dp-col-header {
color: #aaa;
text-transform: uppercase;
font-weight: 300;
font-size: 0.8em;
padding: 8px 0;
}
.dp-month {
width: 33%;
display: inline-block;
padding: 8px;
}
.dp-year {
display: block;
padding: 8px 40px;
width: 100%;
}
.dp-edge-day {
color: #aaa;
}
.dp-current,
.dp-day:hover,
.dp-month:hover,
.dp-year:hover,
.dp-current:focus,
.dp-day:focus,
.dp-month:focus,
.dp-year:focus {
outline: none;
background: color.adjust($primary, $lightness: -40%);
color: $white;
}
.dp-selected:hover,
.dp-selected:focus,
.dp-selected {
background: $highlight;
color: color.adjust($primary, $lightness: -60%);
}
.dp-day-disabled {
background: transparent;
color: #ddd;
}
.dp-day-disabled:focus,
.dp-day-disabled:hover {
background: #ddd;
}
.dp-focuser {
position: absolute;
z-index: 0;
top: 50%;
left: 50%;
}
// Responsive
@media (max-width: 480px), (max-height: 480px) {
.dp-modal .dp {
font-size: 0.9em;
width: auto;
width: 100%;
}
.dp-day-of-week,
.dp-day {
padding: 8px;
}
}
@keyframes slide-up {
0% {
transform: translate(-50%, 100%);
}
100% {
transform: translate(-50%, -50%);
}
} ;

View file

@ -0,0 +1,16 @@
$primary: #1d3040;
$secondary: #b2cce5;
$tertiary: #f5ab35;
$highlight: #fc6399;
$white: #efebe3;
$grey: #abb7b7;
$black: #32302f;
// editor colors
$event-cool: #32cd32;
$event-lame: #f64747;
$editor-primary: #fde3a7;
$editor-secondary: #e7903c;
$editor-tertiary: #6bb9f0;
$editor-string: #dcc6e0;
$editor-tag: #e73c4e;

View file

@ -0,0 +1,117 @@
code[class*='language-'],
pre[class*='language-'] {
color: $editor-primary;
background: none;
text-shadow: 0 1px rgba(#000, 0.3);
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
tab-size: 4;
hyphens: none;
}
pre[class*='language-'] {
// padding: 1em
margin: 0.1em 0;
overflow: auto;
border-radius: 0.3em;
}
:not(pre) > code[class*='language-'],
pre[class*='language-'] {
background: $primary;
}
:not(pre) {
& > code[class*='language-'] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #8292a2;
}
.token {
&.punctuation {
color: $editor-secondary;
}
&.namespace {
opacity: 0.6;
}
&.keyword {
color: #66d9ef;
}
&.italic {
font-style: italic;
}
&.entity {
cursor: help;
}
&.content {
color: $editor-tertiary;
}
}
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
color: $editor-tag;
}
.token.boolean,
.token.number {
color: #ae81ff;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #a6e22e;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: $editor-string;
}
.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
color: #e6db74;
}
.token.regex,
.token.important {
color: $editor-secondary;
}
.token.important,
.token.bold {
font-weight: bold;
}

View file

@ -0,0 +1,120 @@
#edit-control {
// margin 10px
top: 1px;
border-radius: 3px;
width: 100%;
max-width: 880px;
margin-top: 30px;
z-index: 2000;
button {
background: $secondary;
width: 10%;
height: 39px;
transition: all 0.3s linear;
margin: 0;
border-radius: 0;
display: inline-block;
vertical-align: top;
text-align: center;
svg.icons {
fill: $primary;
}
}
button:nth-child(1) {
border-radius: 3px 0 0 3px;
}
button:nth-child(10) {
border-radius: 0 3px 3px 0;
}
button:hover {
background: color.adjust($secondary, $lightness: -20%);
}
#option-update {
padding: 5px 5px 1px;
display: inline-block;
vertical-align: top;
text-align: center;
}
.icon-hide {
display: none;
visibility: hidden;
}
.submit-start {
background: $white;
svg {
fill: $event-cool !important;
}
}
.submit-cool {
background: $event-cool;
svg {
fill: $white;
}
}
.submit-delete {
background: $event-lame !important;
svg {
fill: $white !important;
}
}
#option-date {
height: 30px;
padding-top: 6px;
svg {
margin: -13px 5px 0 0;
display: inline-block;
vertical-align: top;
fill: $white;
}
}
.content-editor-btn-icon {
padding: 5px 5px 1px;
// border-radius 20px
color: $primary;
svg.edit-btn-icon {
fill: $primary;
}
}
.content-editor-btn-text {
padding: 5px;
// border-radius 20px
color: $primary;
}
#option-bold {
font-weight: bold;
text-decoration: none;
}
#option-italic {
font-weight: bold;
text-decoration: none;
font-style: italic;
}
#option-strikethrough {
font-weight: bold;
text-decoration: line-through;
font-style: italic;
}
}

View file

@ -0,0 +1,27 @@
#error-index {
width: 100%;
max-width: 900px;
margin: 0 auto;
padding: 10px;
height: 100%;
z-index: 10;
position: relative;
label#title {
font-size: 100px;
color: $highlight;
font-weight: 500;
}
label#message {
font-size: 50px;
color: $tertiary;
font-weight: 500;
}
label#error {
font-size: 25px;
color: $event-lame;
font-weight: 500;
}
}

View file

@ -0,0 +1,71 @@
form {
display: inline-block;
a {
color: $primary;
}
p {
background: $tertiary;
color: $primary;
padding: 5px;
display: block;
border-radius: 5px;
text-align: left;
}
}
input[type="email"],
input[type="password"],
input[type="text"] {
border: 0;
border-radius: 5px;
padding: 5px;
margin: 10px 5px 0 0;
font: 18px $basetype;
display: inline-block;
background: $primary;
color: $tertiary;
}
textarea {
border: 0;
border-radius: 3px;
color: $white;
font: 15px $basetype;
background: $primary;
}
button,
input[type="submit"] {
background: $highlight;
color: $primary;
font: 20px $basetype;
border-radius: 5px;
position: relative;
cursor: pointer;
border: 0;
padding: 10px 0 5px 0;
transition: all 0.3s linear;
}
select {
font: 14px $basetype;
border: 1px solid $secondary;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
color: $primary;
}
::-webkit-input-placeholder {
font: 25px $basetype;
color: $white;
}
:-moz-placeholder {
/* Firefox 18- */
font: 25px $basetype;
color: $white;
}
::-moz-placeholder {
/* Firefox 19+ */
font: 15px $basetype;
color: $white;
}
:-ms-input-placeholder {
font: 25px $basetype;
color: $white;
}

381
src/styles/main/_index.scss Normal file
View file

@ -0,0 +1,381 @@
#dash-index-content {
width: 100%;
height: 100%;
margin: 0 auto;
#dash-index {
width: 100%;
height: 100%;
z-index: 10;
position: relative;
#dash-index-wrapper {
width: 100%;
height: 100%;
margin: 0 auto;
.dash-init,
.dash-restore {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: $primary;
form {
background: $white;
padding: 15px;
width: 300px;
border-radius: 5px;
text-align: center;
#the-logo {
width: 40px;
margin: 20px;
}
input {
width: 290px;
margin: 0 0 10px;
height: 30px;
}
button {
width: 300px;
}
div {
background: $primary;
color: $white;
border-radius: 3px;
padding: 5px;
label {
display: block;
padding: 5px;
color: $tertiary;
}
}
}
}
.dash-restore {
display: none;
visibility: hidden;
}
#dash-login {
width: 100%;
height: 100%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
#dash-form,
#dash-reset {
width: 300px;
padding: 0.75em;
background: $white;
border-radius: 5px;
color: $white;
text-align: center;
#the-logo {
width: 40px;
margin: 20px;
}
input {
width: 290px;
margin: 0 0 10px;
height: 30px;
}
button {
width: 300px;
}
}
}
#dash-menu {
padding: 10px;
width: 90%;
max-width: 900px;
margin: 50px auto;
a {
display: inline-block;
vertical-align: top;
background: color.adjust($primary, $lightness: -60%);
width: 30%;
padding: 5px;
border-radius: 3px;
color: $white;
margin: 0 10px 10px 0;
&:hover {
background: color.adjust($primary, $lightness: -60%);
}
svg {
display: inline-block;
vertical-align: top;
fill: $white;
}
label {
display: inline-block;
margin-top: 5px;
width: 85%;
text-align: center;
cursor: pointer;
}
}
}
#dash-recent {
width: 100%;
max-width: 900px;
height: 100%;
padding: 5px 0 0;
margin: 0 auto;
#recent-list {
// padding: 5px
position: relative;
.recent-header {
height: 50px;
margin-top: 5px;
.index-header-left {
vertical-align: top;
display: inline-block;
width: 50%;
color: $white;
font-size: 3em;
}
.index-header-right {
width: 50%;
text-align: right;
vertical-align: top;
display: inline-block;
right: 10px;
color: $white;
a {
button {
border-radius: 3px;
margin-left: 10px;
svg {
transition: all 0.2s linear;
width: 40px;
height: 20px;
fill: $white;
}
}
}
}
}
a.post-link,
a.post-video-link {
font-size: 1.5em;
font-weight: 300;
display: inline-block;
border-radius: 3px;
vertical-align: top;
text-decoration: none;
position: relative;
overflow: hidden;
.post-video {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
}
label {
font-size: 1.4em;
font-weight: 700;
color: $white;
padding: 5px;
vertical-align: top;
display: inline-block;
word-wrap: break-word;
width: 100%;
text-align: center;
position: relative;
top: 35%;
text-shadow: 2px 2px 0 rgba($black, 1);
}
div#options {
width: 100%;
position: absolute;
bottom: 0;
border-radius: 0 0 3px 3px;
background: linear-gradient(
to bottom,
rgba(#000, 0) 0%,
rgba(#000, 0.65) 100%
);
#option-left {
display: inline-block;
vertical-align: top;
width: 50%;
position: relative;
background: none;
button {
border-radius: 3px;
background: $primary;
margin: 0 0 10px 10px;
svg {
// @include object-transitions(0.1s)
width: 40px;
height: 20px;
fill: $secondary;
}
}
.item-options {
border-radius: 3px;
margin: 5px;
display: inline-block;
}
button[data-active='false'] {
background: $primary;
svg {
fill: $secondary;
}
}
button[data-active='true'] {
background: $tertiary;
svg {
fill: $primary;
}
}
}
#option-right {
display: inline-block;
width: 50%;
text-align: right;
span {
font-weight: bold;
display: block;
background: $white;
color: $primary;
border-radius: 3px;
font-size: 0.6em;
text-align: center;
position: relative;
padding: 5px;
float: right;
margin: 0 10px 0 0;
bottom: -15px;
}
}
}
}
a.recent-link:nth-child(3) {
width: 100%;
margin-bottom: 20px;
height: 500px;
}
a.recent-link:nth-child(4),
a.recent-link:nth-child(6) {
width: 48.6%;
height: 350px;
margin: 0 10px 20px 0;
}
a.recent-link:nth-child(5),
a.recent-link:nth-child(7) {
width: 48.6%;
height: 350px;
margin: 0 0 20px 10px;
}
}
}
}
}
}
@media only screen and (max-width: 768px) {
#dash-index-content {
#dash-index {
#dash-index-wrapper {
#dash-recent {
#recent-list {
a:nth-child(4),
a:nth-child(6) {
width: 48.9%;
}
}
}
}
}
}
}
@media only screen and (max-width: 640px) {
#dash-index-content {
#dash-index {
#dash-index-wrapper {
#dash-recent {
#recent-list {
a:nth-child(4),
a:nth-child(6) {
width: 48.5%;
}
}
}
}
}
}
}
@media only screen and (max-width: 480px) {
#dash-index-content {
#dash-index {
#dash-index-wrapper {
#dash-recent {
#recent-list {
.recent-header {
h3 {
width: 40%;
}
.index-menu {
width: 60%;
}
}
a.dash-link:nth-child(3),
a.dash-link:nth-child(4),
a.dash-link:nth-child(5),
a.dash-link:nth-child(6),
a.dash-link:nth-child(7) {
width: 100%;
margin: 15px 0 0;
height: 400px;
}
}
}
}
}
}
} ;

View file

@ -0,0 +1,7 @@
@mixin background-opacity($rgb_value, $opacity) {
background: rgba($rgb_value, $opacity);
}
@mixin custom-header($weight, $size, $line_height, $color) {
font: $weight $size/$line_height $bodyTypeSans;
color: $color;
}

View file

@ -0,0 +1,93 @@
#nav-index {
width: 100%;
max-width: 900px;
margin: 0 auto;
#nav-index-wrapper {
#nav-pages {
.nav-item {
display: block;
width: 98%;
background: $white;
border-radius: 3px;
color: $highlight;
height: 30px;
padding: 10px;
margin: 0 0 10px;
font-size: 1.5em;
cursor: move;
#item-arrows {
fill: $primary;
width: 40px;
height: 30px;
}
}
label {
display: inline-block;
vertical-align: middle;
padding: 0;
margin: -15px 0 0 10px;
cursor: move;
}
#nav-btns {
float: right;
top: -5px;
position: relative;
button {
color: $white;
border-radius: 3px;
width: 40px;
margin: 0 10px;
svg {
fill: $white;
width: 25px;
height: 20px;
}
}
}
}
}
}
@media only screen and (max-width: 375px) {
#nav-index {
#nav-index-wrapper {
#nav-pages {
.nav-item {
width: 94.5%;
font-size: 1em;
label {
width: 40%;
vertical-align: top;
margin-top: 0;
line-height: 1em;
}
}
}
}
}
}
@media only screen and (max-width: 320px) {
#nav-index {
#nav-index-wrapper {
#nav-pages {
.nav-item {
width: 94.5%;
font-size: 1em;
label {
width: 37%;
vertical-align: top;
margin-top: 0;
line-height: 1em;
}
}
}
}
}
} ;

View file

@ -0,0 +1,351 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
// -webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input {
/* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select {
/* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type='button'],
[type='reset'],
[type='submit'] {
// -webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type='button']::-moz-focus-inner,
[type='reset']::-moz-focus-inner,
[type='submit']::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type='button']:-moz-focusring,
[type='reset']:-moz-focusring,
[type='submit']:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type='checkbox'],
[type='radio'] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type='number']::-webkit-inner-spin-button,
[type='number']::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type='search'] {
// -webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type='search']::-webkit-search-decoration {
// -webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
// -webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

701
src/styles/main/_posts.scss Normal file
View file

@ -0,0 +1,701 @@
#post-index {
width: 100%;
max-width: 900px;
margin: 0 auto;
#post-index-wrapper {
// padding: 0.75rem
overflow: hidden;
#post-index-header {
margin: 10px 0 0;
#post-index-header-left {
text-transform: capitalize;
display: inline-block;
width: 50%;
color: $white;
font-size: 3em;
}
#post-index-header-right {
text-align: right;
display: inline-block;
width: 50%;
a {
button {
color: $white;
border-radius: 3px;
margin-left: 10px;
width: 55px;
}
svg {
transition: all 0.1s linear;
width: 20px;
height: 17px;
fill: $white;
}
}
.current-filter {
color: $highlight;
text-decoration-color: $secondary;
}
}
}
#posts-list {
margin: 20px 0 0;
a.page-link {
background: $white;
display: inline-block;
vertical-align: top;
width: 100%;
text-decoration: none;
margin: 0 0 20px;
border-radius: 3px;
overflow: hidden;
color: color.adjust($primary, $lightness: -60%);
label {
font-size: 2em;
font-weight: 500;
padding: 10px;
display: inline-block;
vertical-align: top;
width: 100%;
}
div.page-bg,
div.page-video {
video {
width: 100%;
position: absolute;
}
width: 100%;
height: 350px;
background-color: $highlight;
position: relative;
label {
font-size: 2em;
font-weight: 700;
color: $white;
padding: 5px;
vertical-align: top;
display: inline-block;
word-wrap: break-word;
width: 100%;
text-align: center;
position: relative;
top: 35%;
text-shadow: 2px 2px 0 rgba($black, 1);
}
#meta {
width: 100%;
background: linear-gradient(
to bottom,
rgba(#000, 0%) 0%,
rgba(#000, 0.65%) 100%
);
border-radius: 3px;
margin: auto;
bottom: 0;
position: absolute;
padding: 0 0 20px;
#options {
width: 100%;
bottom: 0;
position: absolute;
#option-left {
display: inline-block;
vertical-align: top;
width: 50%;
position: relative;
background: none;
button {
border-radius: 3px;
background: $primary;
margin: 0 0 10px 10px;
}
svg {
transition: all 0.2s linear;
width: 40px;
height: 20px;
fill: $secondary;
}
.item-options {
border-radius: 3px;
margin: 5px;
display: inline-block;
}
button[data-active='false'] {
background: $primary;
svg {
fill: $secondary;
}
}
button[data-active='true'] {
background: $tertiary;
svg {
fill: $primary;
}
}
}
#option-right {
display: inline-block;
width: 50%;
text-align: right;
span {
font-weight: bold;
display: block;
background: $white;
color: $primary;
border-radius: 3px;
font-size: 0.6em;
text-align: center;
position: relative;
padding: 5px;
float: right;
margin: 0 10px 0 0;
bottom: -15px;
}
}
}
}
}
p {
padding: 5px 10px;
font-size: 1.2em;
font-weight: 400;
}
}
}
.paginate {
width: 260px;
display: block;
margin: 0 auto;
a.paginate-link {
display: inline-block;
vertical-align: top;
}
span.count {
text-align: center;
padding: 5px;
margin-top: -2px;
display: inline-block;
width: 190px;
font-size: 1.5em;
color: $tertiary;
}
}
}
}
#post-edit-index {
width: 100%;
overflow: hidden;
#post-edit-index-wrapper {
width: 100%;
#post-header {
// width 100%
background: $highlight;
#post-header-wrapper {
max-width: 900px;
margin: 0 auto;
padding: 0.75rem;
label {
color: $white;
font-size: 0.9em;
font-family: $basetype;
font-weight: 600;
}
span#post-span {
color: $primary;
font-size: 0.9em;
font-weight: 600;
text-transform: uppercase;
float: right;
}
#post-edit-title {
textarea#post-title-text {
background: $white;
font-family: $basetype;
width: 97.6%;
height: 80px;
font-size: 2em;
color: $primary;
padding: 5px;
margin: 0 0 5px;
}
#calendar-icon {
background: color.adjust($primary, $lightness: -15%);
border-radius: 3px 0 0 3px;
display: inline-block;
padding: 5.2px;
color: $secondary;
}
#layouts {
select {
background: $primary;
color: $secondary;
border-radius: 3px;
border-color: $primary;
margin: 0 0 10px;
width: 100%;
height: 45px;
padding: 5px;
font-size: 1.5em;
}
}
}
#post-meta {
#post-tags {
background: $white;
font-family: $basetype;
width: 97.6%;
height: 80px;
color: $primary;
padding: 5px;
margin: 0 0 5px;
}
#post-options {
display: inline-block;
vertical-align: top;
width: 100%;
padding: 0;
margin: 0 0 10px;
button.post-option-btn {
width: 25%;
height: 45px;
transition: all 0.3s linear;
margin: 0;
border-radius: 0;
display: inline-block;
vertical-align: top;
text-align: center;
}
button.post-option-btn:nth-child(1) {
border-radius: 3px 0 0 3px;
}
button.post-option-btn:nth-child(4) {
border-radius: 0 3px 3px 0;
}
a {
button.button-link {
border-radius: 0 3px 3px 0 !important;
}
}
button.post-option-btn[data-active='false'] {
background: $primary;
svg.svg-toggle {
fill: $secondary;
}
}
button.post-option-btn[data-active='true'] {
background: $tertiary;
svg.icons {
fill: $primary;
}
}
}
#page-files-upload,
#post-image-upload {
display: none;
}
}
}
}
#post-feature {
width: 100%;
#page-file-manager {
background: $tertiary;
width: 100%;
min-height: 300px;
#page-file-wrapper {
width: 100%;
max-width: 900px;
padding: 10px;
margin: 0 auto;
font-weight: bold;
color: $primary;
font-size: 1em;
#page-file-drop {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 100px;
background: $white;
color: $primary;
vertical-align: middle;
border-radius: 5px;
margin: 0 0 10px;
label {
cursor: pointer;
font-weight: 600px;
text-transform: capitalize;
}
img {
width: 100%;
margin: 0;
padding: 0;
}
}
#page-images-list,
#page-files-list {
padding: 10px 0 0;
button.media-remove {
height: 35px;
width: 30px;
background: $event-lame;
color: $white;
float: right;
margin: 5px 5px 0;
}
.img-item {
height: 150px;
width: 23.8%;
border-radius: 3px;
margin: 0 10px 10px 0;
display: inline-block;
cursor: pointer;
}
.audio-item {
height: 150px;
width: 23.8%;
border-radius: 3px;
margin: 0 10px 10px 0;
display: inline-block;
cursor: pointer;
background: $primary;
background: url('/assets/images/global/upload-audio.png')
no-repeat center center / cover;
}
.video-item {
height: 150px;
width: 23.8%;
border-radius: 3px;
margin: 0 10px 10px 0;
display: inline-block;
cursor: pointer;
background: $primary;
background: url('/assets/images/global/upload-video.png')
no-repeat center center / cover;
}
.file-item {
height: 150px;
width: 23.8%;
border-radius: 3px;
margin: 0 10px 10px 0;
display: inline-block;
cursor: pointer;
background: $primary;
background: url('/assets/images/global/upload-doc.png')
no-repeat center center / cover;
}
}
}
}
}
#edit-post {
width: 100%;
max-width: 880px;
margin: 0 auto;
#edit-post-wrapper {
width: 100%;
max-width: 900px;
border-radius: 5px;
position: relative;
textarea:focus {
outline: none;
border-color: $highlight;
}
#edit,
#highlight {
border: 0;
width: 100%;
min-height: 300px;
height: auto;
position: absolute;
top: 0;
left: 0;
overflow: auto;
word-wrap: normal;
white-space: pre-wrap;
line-break: normal;
}
#highlight-content {
word-wrap: normal;
white-space: pre-wrap;
line-break: normal;
}
#edit,
#highlight,
#hightlight * {
font-size: 1.2em;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
line-height: 22pt;
}
#edit {
z-index: 1;
color: transparent;
background: transparent;
caret-color: $highlight;
}
#highlight {
z-index: 0;
pre {
margin: 0;
code {
font-family: $monotype;
padding: 5px;
border-radius: 5px;
line-height: 1.6em;
font-size: 1.25em;
color: $editor-primary;
word-wrap: normal;
white-space: pre-wrap;
line-break: normal;
-webkit-line-break: normal;
-o-line-break: normal;
-moz-line-break: normal;
display: inline-block;
width: 100%;
max-width: 900px;
min-height: 200px;
caret-color: $highlight;
}
}
}
}
}
}
}
@media only screen and (max-width: 800px) {
#post-edit-index {
#post-edit-index-wrapper {
#post-header {
#post-title {
#post-date {
width: 37.6%;
}
}
}
}
}
}
@media only screen and (max-width: 768px) {
#post-edit-index {
#post-edit-index-wrapper {
#post-header {
#post-title {
#post-date {
width: 43.1%;
}
}
#post-meta {
#edit-control {
max-width: 100%;
button {
width: 9.91%;
}
}
}
}
}
}
}
@media only screen and (max-width: 640px) {
#post-edit-index {
#post-edit-index-wrapper {
#post-header {
#post-title {
#post-date {
width: 42%;
}
}
}
}
}
}
@media only screen and (max-width: 480px) {
#post-index {
#post-index-wrapper {
#post-index-header {
#post-index-header-left {
font-size: 1.35em;
width: 30%;
}
#post-index-header-right {
width: 70%;
vertical-align: top;
}
}
#post-index-menu {
a {
font-size: 0.95em;
label {
display: none;
visibility: hidden;
}
}
}
}
}
#post-edit-index {
#post-edit-index-wrapper {
#post-header {
#post-title {
#post-options {
margin: 5px 0 0;
width: 100%;
padding: 0;
}
#post-date {
width: 89.2%;
}
}
#post-meta {
#edit-control {
button {
width: 9.91%;
}
}
}
}
}
}
}
@media only screen and (max-width: 320px) {
#post-index {
#post-index-wrapper {
#post-index-menu {
a {
font-size: 0.95em;
label {
display: none;
visibility: hidden;
}
}
}
}
}
#post-edit-index {
#post-edit-index-wrapper {
#post-header {
#post-title {
#post-title-text {
width: 96.4%;
}
#post-options {
margin: 5px 0 0;
width: 100%;
padding: 0;
}
#post-date {
width: 83.1%;
}
}
#post-meta {
#post-tags {
width: 96.4%;
}
#edit-control {
.content-editor-btn-icon {
svg.icons {
width: 20px;
}
}
.post-sumbit-btn {
svg.icons {
width: 20px;
}
}
button {
width: 10%;
}
}
}
}
}
}
} ;

View file

@ -0,0 +1,383 @@
#settings-actions {
position: fixed;
width: 40%;
margin-top: -85px;
left: 50%;
margin-left: -20%;
#buttons {
width: 185px;
margin: 28px auto;
text-align: center;
background: $white;
padding: 2px;
border-radius: 3px;
button {
color: $white;
border-radius: 3px;
width: 40px;
margin: 0 10px;
svg {
width: 25px;
height: 20px;
fill: $white;
}
}
button[data-render='false'] {
background: $secondary;
svg {
fill: $primary;
}
}
button[data-render='true'] {
background: $highlight;
svg {
fill: $white;
}
}
}
}
#settings-index {
width: 94%;
max-width: 900px;
margin: 0 auto;
overflow: hidden;
#settings-index-wrapper {
padding: 0;
button {
margin-top: 5px;
width: 100%;
height: 33px;
}
#member-settings,
#feature-settings,
#option-settings,
#token-settings,
#backup-settings {
background: $white;
padding: 0;
border-radius: 5px 0;
width: 100%;
margin: 20px auto;
label {
font-family: $basetype;
color: $primary;
font-weight: bold;
}
span {
color: $secondary;
}
input {
width: 95%;
margin: 0 5px 10px 0;
height: 30px;
padding: 10px;
}
input#backup-upload {
visibility: hidden;
display: none;
}
.backup-meta {
background: $primary;
color: $white;
padding: 8px;
border-radius: 3px;
margin: 5px 0 0;
text-align: center;
}
#member-images {
padding: 10px 15px 0;
#member-avatar-drop {
display: inline-block;
margin: 0 0 10px;
img {
width: 100%;
border-radius: 5px;
overflow: hidden;
cursor: pointer;
display: block;
margin-bottom: 2px;
}
input {
visibility: hidden;
display: none;
}
#privacy-toggle {
width: 50%;
}
#render-toggle {
width: 50%;
}
}
#site-background {
margin: 0 0 10px;
img {
width: 92.1%;
height: 292px;
border-radius: 3px;
overflow: hidden;
cursor: pointer;
}
input {
visibility: hidden;
display: none;
}
}
}
#member-meta {
padding: 10px 15px 0;
position: relative;
top: -30px;
}
#features {
padding: 10px 15px 0;
}
}
#mail-settings {
min-height: 240px;
/*
input {
margin: 0 5px 5px 0;
vertical-align: top;
}
*/
a.mail-option {
float: right;
font-family: $monotype;
font-size: 0.9em;
border-radius: 3px;
text-decoration: none;
margin: 0 0 0 5px;
}
a.mail-option[data-enabled='true'] {
color: $highlight;
}
a.mail-option[data-enabled='false'] {
color: $primary;
}
div[data-enabled='false'] {
display: none;
visibility: hidden;
}
#settings-api {
background: $primary;
border-radius: 3px;
padding: 10px;
span {
color: $white !important;
margin: -13px 0 0 5px;
position: relative;
vertical-align: middle;
display: inline-block;
font-weight: bold;
}
button {
color: $white;
border-radius: 3px;
width: 40px;
margin: 0;
svg {
width: 25px;
height: 20px;
fill: $white;
}
}
button[data-enabled='false'] {
background: $secondary;
svg {
fill: $primary;
}
}
button[data-enabled='true'] {
background: $highlight;
svg {
fill: $white;
}
}
}
}
textarea {
background: $primary;
width: 70%;
height: 89.5px;
color: $tertiary;
padding: 10px;
display: inline-block;
margin-bottom: 10px;
}
span#key {
color: $white;
background: $primary;
font-size: 0.9em;
border-radius: 3px;
padding: 5px;
display: block;
width: 95%;
overflow: hidden;
}
#feature-settings {
#feature-api,
#dynamic-api {
background: $white;
border-radius: 3px;
padding: 5px;
button {
color: $white;
border-radius: 3px;
width: 200px;
margin: 0;
height: 200px;
font-size: 1em;
svg.icons {
width: 100px;
height: 90px;
fill: $white;
position: relative;
display: block;
margin: 12px auto;
}
span {
color: $white;
margin: 6px 0 0 5px;
position: relative;
vertical-align: middle;
display: inline-block;
font-weight: bold;
}
}
button[data-enabled='false'] {
background: $secondary;
svg {
fill: $primary;
}
span {
color: $primary;
}
}
button[data-enabled='true'] {
background: $highlight;
svg {
fill: $white;
}
}
}
}
#token-settings {
#keys-tokens {
padding: 10px 15px 0;
#member-api-key,
#form-token {
background: $primary;
border-radius: 3px;
padding: 5px;
color: $white;
}
}
}
#option-settings {
#theme-settings {
a {
width: 95%;
margin: 0 5px 5px 0;
height: 15px;
padding: 10px;
display: inline-block;
}
a[data-enabled='false'] {
background: $white;
color: $primary;
border-radius: 3px;
font-weight: bold;
border-top: 1px $highlight solid;
border-bottom: 1px $highlight solid;
}
a[data-enabled='true'] {
background: $highlight;
color: $primary;
border-radius: 3px;
font-weight: bold;
border-top: 1px $primary solid;
border-bottom: 1px $primary solid;
svg {
fill: $primary;
display: inline-block;
float: right;
}
}
}
}
}
}
// Responsive for Settings
@media only screen and (max-width: 480px) {
#settings-actions {
margin-left: -42%;
#buttons {
width: 150px;
background: none;
button {
margin: 0 5px;
}
}
}
} ;

View file

@ -0,0 +1,251 @@
html,
body {
background: $primary
linear-gradient(
0deg,
rgba($primary, 1) 0%,
rgba(color.adjust($primary, $lightness: 10%), 1) 100%
)
no-repeat;
font: 400 1em $basetype;
height: 100%;
}
a {
font: 300 1em $basetype;
color: $secondary;
text-decoration: underline;
transition: all 0.2s linear;
}
svg.icons {
width: 25px;
fill: $secondary;
}
#notifications {
perspective: 1000px;
position: fixed;
z-index: 2000;
height: 55px;
width: 100%;
display: block;
align-items: center;
justify-content: center;
padding: 0;
margin-top: -55px;
#notify-message {
margin: 0 auto;
// ks-easing( "out-back" );
transition: all 0.6s cubic-bezier(0.83, 0.05, 0.28, 1);
// padding-top -125px
height: 50px;
width: 500px;
display: flex;
align-items: center;
justify-content: center;
opacity: 1;
transform-style: preserve-3d;
transform: rotateX(120deg);
transform-origin: 50% 0;
overflow: hidden;
#notify-good,
#notify-lame,
#notify-working {
display: block;
}
#notify-working-icon {
animation: spin 2s linear infinite;
@keyframes spin {
transform: rotate(360deg);
}
}
.notify-icon {
background: $black;
padding: 8px 5px 5px;
border-radius: 5px 0 0 5px;
height: 30px;
width: 30px;
text-align: center;
border: 2px solid $white;
}
#notify-text {
color: $white;
background: $black;
width: 400px;
height: 28px;
padding: 15px 0 0;
border-radius: 0 5px 5px 0;
border: 2px solid $white;
text-align: center;
overflow: hidden;
position: relative;
#notify-progress {
width: 0;
background: $highlight;
height: 43px;
position: absolute;
top: 0;
}
p {
top: -15px;
display: block;
position: relative;
}
}
.icons {
fill: $white;
}
}
}
.notify-close {
transform-style: preserve-3d;
transform: rotateX(-120deg);
}
.notify-open {
transform-style: preserve-3d;
transform: rotateX(0deg);
}
.blog-container {
width: 100%;
}
.main-container {
margin: 0 auto;
z-index: 10;
position: relative;
height: 100%;
section {
header {
width: 100%;
max-width: 900px;
margin: 10px auto;
background: $white;
height: 50px;
border-radius: 5px;
#wrapper {
padding: 5px;
#left,
#right {
width: 49.7%;
display: inline-block;
vertical-align: top;
min-height: 60px;
#the-logo {
width: 29px;
}
}
#right {
text-align: right;
color: $white;
// word-break: break-all;
#dash-menu {
text-align: right;
a {
button {
border-radius: 50px;
svg {
transition: all 0.2s linear;
width: 40px;
height: 20px;
fill: $white;
}
}
&:hover {
button {
background: $primary;
}
svg {
fill: $secondary;
}
}
}
}
}
}
}
}
} /* Mozilla based browsers */
::selection {
background-color: $highlight;
color: $white;
}
/* Works in Opera */
::-o-selection {
background-color: $highlight;
color: $white;
}
::-ms-selection {
background-color: $highlight;
color: $white;
}
/* Works in Internet Explorer */
::-webkit-selection {
background-color: $highlight;
color: $white;
}
// Responsive
@media only screen and (max-width: 901px) {
.main-container {
padding: 10px;
}
}
@media only screen and (max-width: 800px) {
.main-container {
section {
header {
#wrapper {
#left,
#right {
display: inline-block;
}
}
}
}
}
}
@media only screen and (max-width: 480px) {
.main-container {
section {
header {
#wrapper {
#left {
width: 30%;
}
#right {
width: 70%;
}
}
}
}
}
} ;

View file

@ -0,0 +1,23 @@
$basetype: helvetica, arial, sans-serif;
$monotype: 'Lucida Console', monaco, monospace;
h1,
h2,
h3 {
color: $white;
}
h1 {
font-size: 2em;
font-weight: 400;
}
h2 {
font-size: 1.75em;
font-weight: 400;
}
h3 {
font-size: 1.5em;
font-weight: 300;
}