Compare commits

..

351 Commits

Author SHA1 Message Date
Ro 49c1f2d3f2
Taiga Intergration Test 2
First one used the wrong hook type.

TG-3 #testing
1 year ago
Ro 2ce0a4eb82
Taiga Integration Test
Just seeing if this thing actually work

TG-3 #testing
1 year ago
Ro 599fca18f1
Removed invalid role attributes from Settings page
Cleaned up the settings page by removing the improper usage of the role
tag and replaced it with class to maintain current design integrity.
Also updated the script files that was referencing the old role tags
1 year ago
Ro bea40049fc
Removed invalid role attributes from dash index
Converted role tags to class to remove the invalid role attributes
used.
1 year ago
Ro df8e301a0b
Confirming Verify Commit Error
I tried submitting an updated through and IDE and it does not properly
verify signed commits.

Using git from the command line works fine.
1 year ago
Ro 16de29c399
testing verified commits 1 year ago
Ro ac08c77813
Removed role from header, notification and login
Began the process of removing all invalid role attributes starting with the header, login, and notifications components. Updated the corresponding scripts as well. 

Made a few structural changes to the header to simply it and then tested it to ensure notification still worked.
1 year ago
Ro 2f0b83b492
Added License
Decided to go with GNU General Public License v3.0 because all
improvements to the codebase should be shared with the public
2 years ago
Ro f824b53f2a
Update versioning to 2.6.1
All the issues in milestone 2.6.1 have been completed, so now it's time for an update
2 years ago
Ro 8461d88dd6
Settings CSS Cleanup
The Settings UI needed some responsive polish, so that's been given a
bit more love.
2 years ago
Ro a9c88f1430
Edits for #86 and #92
Fixed the issue where the text edit controller would scroll right off
the screen. Now it stick when it's the bottom of the header.

Also changed the background color of page links on the Start and Book
pages to indicate there is no image. It's just cleaner
2 years ago
Ro fa4b252d9c
Fix for #94
Header images were missing from the archive and tags pages, so this is a
patch to make sure those are working again.
2 years ago
Ro 181225329a
CSS and icon fixes
Fixes for issues #93, #88, #87
2 years ago
Ro 4876c1336e
Updated Composer packages; empty field fix
Composer dependencies were pretty old, so they needed to be upgraded to
the latest.

There was also a minor bug that was triggered when a new page was saved
with empty tags and no images or documents, so that's been patched as
well.
2 years ago
Ro f1850ce7f7
Site Creation Hot Fix
There was an error in the request to set up a fresh site on the front
end and handling the respective object on the backend that was causing
the process to error out.

Also added the source map for the dash script because it's eventually
going to be fully transparent anyway.
2 years ago
Ro e7cd52bd12
Fixed script after removing dependency
Removed 'carot-ps' from dependencies so it had to be removed from
scripts calling that package.

Also renamed dash script to 'dash.js' just so it's clear it is for the
dashboard
2 years ago
Ro f9190c2a41
removed carot-pos from dependecies 2 years ago
Ro 8885ae4c63
updated version nunmber 2 years ago
Ro 405be1a6ed
Emplty Layout Hotfix
When creating new pages, there is no layout, so the system was pushing a
null error when trying to use string_contains and a null string, so
cleaned that up so it defaults to 'page' when that string is empty
2 years ago
Ro 3f9506ac6b
Responsive P 4 - Dash, Index, Editor, Nav, Menu
Cleaned up resonsive for the rest of the remaining pages: the dash
index, page index, page editor, navigation editor and plugged in a
mobile nav that activates when the viewport gets skinny.

Whew.
2 years ago
Ro e7fd91c152
Responsive Pt 3 - Pass Reset, Site Create/Restore
Rebuilt forms for resetting the password, creating a fresh site and
restoring a site from a backup, as well as adjusting the accompanying
scripts that handle those processes.
2 years ago
Ro 5adf196783
Responsive Part 2 - Login
Updated Login CSS and cleaned up login notifications to alert when
something is amiss.
2 years ago
Ro 2ce86fad2e
Settings CSS Remix
Wasn't feeling the previous CSS responsive structure, so edited it to be
a bit more streamline.

Also fixed small issue with the backup API request.

Made a small change to notifications so the alert stays live while the
system is processing a request rather than going back to an unalert
state.
2 years ago
Ro bfb0873f5f
Reponsive: Part 1 - Settings
Started cleaning up responsive styles for the site starting with the
Settings section. Still needs some tweaking but the structure for that
section is in so it's just a matter of police.

Some changes need to be made to the main nav as reduced viewport throws
off the alignment.
2 years ago
Ro 97278e3a90
Notifications Rework #81
Integrated the Notifications UI component into the header to streamline
user alerts into the overall experience.

Also added titles to use the space created by moving the notifications
compoenent to it's own space.
2 years ago
Ro 78bfe4596b
Styled Nav Editor
Created new CSS styles for dash nav editor and updated the appropriate
controller scripts.

Also updated the icons for the main nav.
2 years ago
Ro 1b89d1d072
Restyled Settings UI
Rebuilt the css for the Settings UI, which also led to some changed in
the FilesAPI so it knows what to do with specific targets. There's still
some additional styling needed to polish it, but the core structure is
in place so now it can just be tweaked. The controller for this page was
adjusted as needed.

Also moved the settings sub nav convtrols to the header menu since it's
sticky now.
2 years ago
Ro fcca7357bc
Fixes for removing media items and page deletion
The upload process changed, so some tweaks needed to me made to the page
deletion process, which just marks the page as deleted but keeps the
file. Also updated the file manager to properly delete items from the
display list.

The css for page listings also had to updated [forgot to put that on the
list] so the styles for that were updated and the template pages
adjusted accordingnly.

Also forgot to mention changes to the notification display in the last
commit. It's basic as of right now but it will be enhanced as needed.
2 years ago
Ro 07b422a9c3
CSS Overhaul Part 1
This one is a doozy, so let's breakt it down into what areas where
touched.

-   updated package json to remove unneeded dependencies.
-   rebuilt file uploading to simply a very convuluted process
-   began proces to replace icons with https://tabler-icons.io
-   began process of removing the need for css preprocessor and using
    pure css
        - login completed
        - dashboard index completed
        - page edit ui completed
- page edit ui text editor tweaked so syntax highlighting is cleaner and
  more accurate

The settings and navigation UIs still remain and then polishing the
responsive for the new css structure
2 years ago
Ro ec1dc49ba1
Login Hotfix
The script that handles logggin in and the form for getting that
information were both posting the info which would result in an
intemittent uncaught error.

An attribute was added to the form so it does not submit at the same
time the JS sends a request.

A minor bug but it was annoying.
2 years ago
Ro 61ae73a9e5
Issue #83 Round 1
First pass for CSS refactor for the dashboard, including the login and
index templates. Still rough but the basic structure is in place for
both as well as the re-worked css that will be added to the repo later
once all the pages have been updated.

Lots to do still but a good start.
2 years ago
Ro 859b75e9f3
Removed links to old repo from ReadMe
I'll probably miss some as the migration completes but let's start with
scrubbing the old repo from the new one.
2 years ago
Ro a14d4a0a08
Move Repo test
Just a quick update to see if I got all the setting right as I'm
migrating the show to a fresh repo
2 years ago
Ro 7890715ea6
PHP Linting Tweaks
PHP syntax checking was being weird so I spent some time to make some
corrections. The problem was I was just using the wrong protocal, PEAR
when I've been coding to the PSR12 standard. Easy fix.
2 years ago
Ro 77eb8dd1a8
HTTP Method notes for RouteControl
Currently only two http methods are being utilized for route traffic so
classes are getting jumped trying to stuff every action in on or the
other. More methods need to be implemented to better organize route
pathing and subsequent requests
2 years ago
Ro e431f1afa4
Sign commit test
Testing out commit signing for a bit of extra security.
2 years ago
Ro 254a7f1c38 Scrubbed Moment from codebase
Moment was still being used in some classes so found and replaced all
those instances with Carbon and uninstalled the packaged from composer.
2 years ago
Ro b092645733 Removed Fipamo classes from composer autoloading
I didn't like the extra step that had to be taken to register new
classes from the command line using composer's auto dump, so a quick
script was implemented to handle Fipamo loading classes seperately so
composer can manage itself, removing the need for updating it whenever I
add a new classs to the codebase
2 years ago
Ro 73e4243231 Removed TODO note for Carbon
Left a stray TODO in there that needed to be removed since Moment has
been replaced with Carbon.
2 years ago
Ro 3260e3b76b Updated dependencies, replaced Moment
Composer package dependencies hadn't been updated in awhile, so a part
of the clean up for the php 8.1 install, that has been handled

Moment was being used to handle date formatting but it hasn't been
updated in awhile either, so I switched to Carbon which is still in
active development.
2 years ago
Are0h a1c0d86580 update versioning, clean up npm
I updated the versioning to match in both composer.json and pacakge.json
config files. I need to start cleaning up the dependencies in the front
end scripting as well, so I started my updating them to see much work
needs to get done. Not too bad, but it's going to be a pretty
significant effort.
2 years ago
Are0h 197fb005de Added Markdown table conversion and version update
Added markdown table conversion to the html process so we get sexy
tables. Also updated the version number to prep for the latest beta
realease. Ha, took a minute but we're back on track
2 years ago
Are0h 00d41a3664 Update composer packages
Needed to update some packages rely on because it's been a minute since
they've been touched. I need to get better with doing that on a regular
basis.
3 years ago
Are0h 3fa3a9e0e6 removed stray console command for #78 updated
just had a stray trace in there that was removed and correct the issue
referene from the last update. oops.
3 years ago
Are0h 8734baf85e Fix for #76, editing upload que
Whew it took a bit but now the upload que on the page edit page is
editable. You can add and remove files as needed without having to add
all your files at once, which us how it previously worked. Still needs
to be tested a bit but the plumbing is up and running.

Also removed a stray php format config as it is no longer needed.
3 years ago
Are0h a31dff94cb Updated PHP lint to @PSR12 b/c @PSR2 is deprecated
So, @PSR12 is the recommended coding standard, so I updated the config
and reformatted the appropriate files.

Again. Whew.
3 years ago
Are0h 63eaba08e2 Added config for PHP formatting (PSR2)
I needed some consistent php formatting, so I plugged in a php fixer
config and then reformatted all PHP files so it's all consistent.

Fixed an ID issue with the page-edit template that was causing page
editing to fail.
3 years ago
Are0h d9c9f7744e Fixed white space issue, page edit style tweaks
There was a white space issue that made text displayed title and tags
text appear missaligned. It turned out to be a small layout problem that
was cleaned up by getting rid of white space in the textarea element
itself.

Also got in there and fixed some lingering css issues that was causing
the svg icon colors to be off in some of the butttons.
3 years ago
Are0h b2c7dae322 Page Editor style fixes
The page editor UI was looking very shaky, so I went in there and
cleaned it up. The nesting is a bit intense, so I'm gonna think about
better ways of laying that out that aren't so convoluted.
3 years ago
Are0h 2501a19685 UI design tweaks
There were some inconsistencies in the UI due to all the changes that
were made to the styleshets, so I fixed the obvious ones that were show
stoppers.

There's more in there to be smoothed out, so this is just the start.
3 years ago
Are0h b8b763637f finished scss stylint refactor for remaining pages
finished up refacting all of the style sheets to be brought in line with
the stylint scss standard. the standard will probably change as i tweak
the rules but the foundation is solid and it's rendering so it's a
great place to start

i'll go through the ui to make sure everything is in tact and i'll make
the necessary adjustments

i should probably refactor some structures as well as they nesting is a
bit overly complicated
3 years ago
Are0h 61b9acb280 I swapped out sass for scss file for styling because scss is a bit more
accessible because of its similarity with base css.

I also plugged in stylint to normalize a css standard throughout the
project to work with prettier, which handles formatting

The structure scss file has been brought in line with the new standard
but the remaining need to be adjusted as well. Those will be added with
an additional commit.
3 years ago
Are0h aa3301fb66 hotfix for images in editor uploads 3 years ago
Are0h 9baaed6d50 formatting changes 3 years ago
Are0h 2e30d6eb26 fix for open graph image render, minor tweaks to class importing 3 years ago
Are0h 7393e4572c readme tweak 3 years ago
are0h a841063ddb template update and clean up 3 years ago
are0h 692926c816 script check 3 years ago
are0h b230f3f15d fixes for nav editing 3 years ago
are0h d7c5fb7a70 dev env tweaks 3 years ago
are0h d98bccdd1f missed a class reference. oops 3 years ago
are0h 382c314af0 fixes for restore from backup file 3 years ago
Ro 6279ad4730 fixes for site init 3 years ago
Ro 2b7db3cc88 removed unecessary mixins 3 years ago
Ro a70c98afa0 fixes for site back up and mailer, turned on md list rendering 3 years ago
Ro 8ad3fa38c5 respeced class imports to psr-4 standard, fixed asset moving, upgraded theme rendering 3 years ago
Ro 1351b98ee4 cleaned up create page process, update page edit template to handle empty files 3 years ago
Ro 2210e39aee added remaining upload types, updated templates for new file types 3 years ago
Ro 523b611ac5 fixed weird form post bug, updated page listing display for new assets 3 years ago
Ro fe74fd6e07 fixed css issue with text edit area 3 years ago
Ro 2ed2cd3803 fix for page-edit template, oops 3 years ago
Ro f24a6b5099 implemented video uploading, updated styles and templates 3 years ago
Ro 3c52bca8ba started implementation of multiple file uploads and sorting 3 years ago
Ro 8f9021bb7d added progress bar to entry image uploads 3 years ago
Ro 53864becc1 implemented progress upload indicator in notifications 3 years ago
Ro 601fd6b1ab fix for weird css file deletion thing 3 years ago
Ro b69559541a edit format bar always stays on screen 3 years ago
Ro 8684c8b1ac removed stray var dump... oops 3 years ago
Ro c15b6cdc5b updated production assets 3 years ago
Ro 7cabb1d1f0 more text editor touch ups, fix for page delete option 3 years ago
Ro f1a8ef67bc another patch for textarea misalignment bug 3 years ago
Ro 10081c4323 fix for text editor alignment issue. finally 3 years ago
Ro b70308d990 fixed src removal from image tags with relative urls, add iframe tag to allowed list 3 years ago
Ro fdf2319783 re-inserted feature img into feature and recent lists. oops 3 years ago
Ro 71dc41e950 fix for page rendering always defaulting to page 3 years ago
Ro db385d938c not fix for template and empty layout for new page creation 3 years ago
Ro d2f02eea50 edited ignore file to include new script. duh. 3 years ago
Ro dad43f4a19 pages marked as menu items render as non-blog pages 3 years ago
Ro 7775c1d409 expanded and streamlined markdown rendering 3 years ago
Ro 0742e06c45 cleand up text editor layout, tweaked editor colors, re-activated editor options 3 years ago
Ro 682406515d added assets compiling scripts, added syntax highlighting for text editor, fix for #73 3 years ago
Ro c0c3b60fd5 added feature image to tags to display page 3 years ago
Ro 4f4fee807c fix for #69, updated settings ui 3 years ago
Ro 1c2ba579df fix for #68, updated page edit ui 3 years ago
Ro 03c629462b fix for #75, fix for adding image to entry text 3 years ago
Ro f119bdc773 fix for #72, index page not using page themes 3 years ago
Ro 39775e624d hot fix for adding images two recent and featured links 3 years ago
Ro 7e38b4edb8 quick patch for #66 3 years ago
Ro 3994e97829 moved layout selector in page edit ui 3 years ago
Ro c867b6c508 adde page preview feature, updated page edit ui with preview option button 3 years ago
Ro 49e53a9638 added styled page layout selector, page renders selected layout 3 years ago
Ro a8355b2da4 created new Theme data class for theme stuff, added custom page view, added view select for page edit screen 3 years ago
Ro bbfe37597a fixes for #63, #64, #65, updated composer dependencies 3 years ago
Ro e6cda301cf #59 - added toggle to render pages when page is edited 3 years ago
Ro 4796431076 completes #58 default theme links adapt to dynamic rendering, no page rendering if dynamic active 3 years ago
Ro 35c780bba6 added dynamic page rendering for index, archives, tages and blog pages 3 years ago
Ro e5cffd39d7 fix for #60 - render flag false fix 3 years ago
Ro d6f6f771ac hot fix for page creation (token not being shared on create mode) 3 years ago
Ro 9fe8ce1e4c #56 moves global assets from theme if not present in public dir 3 years ago
Ro 1bb13ce771 #57 notifications ui position tweak 3 years ago
Ro 934d29f4cf added field check for page edits to make sure unnecessary fields are not being added 3 years ago
Ro ccbf55bb54 added form token auth to page editing, updated API 3 years ago
Ro fdc6cb2cf2 added form token to session to validate form submission from frontend 3 years ago
Ro f2450b2be5 fixed incorrect input type (#52), cleaned up site restore process (#53) 3 years ago
Ro d7c2827115 updated composer dependencies 3 years ago
Ro 8df5e68024 re-activated site back up... for now... 3 years ago
Ro 734c6d36f1 Admin API tweaks, added check for theme render flag for one pagers 3 years ago
Ro 183a620b1e changed auth process to just ask server if session is active 3 years ago
Ro b3c47d6721 overdid it with the image upload auth, making it a regular upload 3 years ago
Ro cad32ace74 fixed image upload request that required token authorization 3 years ago
Ro 7d3f2d13a4 adds externalAPI key in settings if not present in original settings file when restoring 3 years ago
Ro a1932e1a24 added missing eternal API toggle to settings template 3 years ago
Ro b24f0a6adb quick patch for CORS check while in site init state 3 years ago
Ro 0ec49de8ab admin api commenting tweak 3 years ago
Ro 83b4aff716 added admin API method for getting site and member info 3 years ago
Ro 13c9d05019 tweaks for API classes, filled out commenting for docs, added jsdoc config 3 years ago
Ro 1f1c611afe fixed token check, fixed empty image page post 3 years ago
Ro ab40219d9b added key check to use AdminAPI, updated front end classes 3 years ago
Ro 2785ef6982 updated AdminAPI for remote use, removed UtilityAPI from public library (methods should only be local) 3 years ago
Ro b9056b64df more commenting for API classess, edited constructor for Admin and Util, updated backend API, added jsdoc 3 years ago
Ro ebdda2c089 updated front end controller scripts 3 years ago
Ro e40e566302 edited and commented Admin API, removed DataEvents class 3 years ago
Ro f7e3b3b55e edited and commented methods for Utility API, removed DataEvents class 3 years ago
Ro 8101b16cf9 edited method names for Content and Utility API, updated base class 3 years ago
Ro 45fd8be25f reorganized API methods into new files 3 years ago
Ro 2d84ec9e33 added featured and menu options for page API, cleaned up API json return 3 years ago
Ro 24242d4bf0 updated API request URLs to use keys 3 years ago
Ro 8417e692d7 removed pagination from Pages API request, added API request for tags 3 years ago
Ro 65def75433 added api key to settings UI 3 years ago
Ro 3df2720009 added CORS handling, added external API access toggle to settings UI and updated front end script 4 years ago
Ro 2f1f6678b7 changed fipamo logo name to avoid confusion with imported theme logo 4 years ago
Ro a542b2d884 removed data events from fipamo api, added content api methods, cleaned up front end js 4 years ago
Ro 6cd28c06c0 version update 4 years ago
Ro b7aafed112 quick fix for composer settings file 4 years ago
Ro 20fc9c64a1 ui overall part 4: responsive touch up 4 years ago
Ro 0765ea4555 ui overall part 3: settings, site menu editor 4 years ago
Ro 033fe5e48b ui overall part 2: dash index, pages index 4 years ago
Ro 8e3d359486 ui overall part 1: login, init, pass reset forms 4 years ago
Ro b51d63633f expanded composer json 4 years ago
Ro 8f1e3a55e7 #44 password recovery plugged in 4 years ago
Ro 9462b91246 added phpmailer to dependencies for mail services(smtp, mailgun), update js Mailer class 4 years ago
Ro bedb6fdfe5 added email template, mail api and mail utility class, tweak to Mailer.js 4 years ago
Ro 89f84499b2 make page feature image meta image 4 years ago
Ro 1f46eeffa0 full image url for meta image, fixed minor page template error 4 years ago
Ro 7002ba8014 ignore button clicks when processing requests 4 years ago
Ro 08d034a8d1 fixed meta images in header for default theme 4 years ago
Ro dd0e5ce1ee updated base theme script 4 years ago
Ro c89fe5be30 removed redundant restore button, WIP’d mail button, move theme assets on render 4 years ago
Ro 4d44ea2a06 added base style and script assets for dash 4 years ago
Ro 95aecde73b quick patch to render class for dynamic theme rendering 4 years ago
Ro f3dfd3411a added meta data to page template 4 years ago
Ro 06787aac30 moved site restore to utility class, updated set up script, fixed minor error in front end api restore request 4 years ago
Ro b8cf4e403a fixed a typo in the README 4 years ago
Ro 53fd1a47c5 fixed minor error when updating avi in settings 4 years ago
Ro c6f7c56f4a Activated site back up via zip and added download link in settings 4 years ago
Ro 9afec7554c activated site restore from zip, fixed imgs to rendering src 4 years ago
Ro b98707bb0d install site activated, fixed large image upload issue(php setting), fixed page indexing 4 years ago
Ro ba38e32dd5 fix for code tag being sanitized on html render 4 years ago
Ro b09e1c7164 pages rendering to html 4 years ago
Ro 444189e527 created new App class to start up app and move off of index 4 years ago
Ro 9283a7f5b3 tag html rendering implemented 4 years ago
Ro c78772e2c0 added Sorting class to handle organizing tags and archives organizing for page rendering. added empty Render class for rendering 4 years ago
Ro 39809a60ec added navigation editor template and methods, moved markdown converstion to DocTools class 4 years ago
Ro 594df048cf updating menu items in settings when pages is saved 4 years ago
Ro 20cc4abad9 moved member auth to API class 4 years ago
Ro 179f007fab setting sync and settings image uploading turned back on 4 years ago
Ro b68d4c190e settings paged plugged in, scoping out page publishing api methodology 4 years ago
Ro a699fd1926 removed unnecessary api requests 4 years ago
Ro 2b79a52275 minor fix to pagination 4 years ago
Ro 043bd25cf7 current index updates when new page added 4 years ago
Ro bc6fc33592 display per session status clean up 4 years ago
Ro 9cf0cbfbe4 moved page editing api methodology to its own api class, session check for pages section 4 years ago
Ro ed2105edcc cleaned up page creation 4 years ago
Ro 1b9252fef0 page editing cleaned up, fixed date formatting, fixed page filtering, add Image API path 4 years ago
Ro 395850adb8 cleaned up date formatting for display 4 years ago
Ro 72c9b3f9e6 rebuilt create/edit page template, added navigation, turned on logout mehthod 4 years ago
Ro b75d045eec fixed pagination indexing 4 years ago
Ro 8e9b6ac422 plugged in filtered pagination for entry pages 4 years ago
Ro 6c3653277d plugged in page list display 4 years ago
Ro c4232a0a01 dash index displaying recents, css tweaks, added bulma 4 years ago
Ro 5ad1118244 clean up API, re-connected API to front end, base template tweak 4 years ago
Ro 083faa7c1d removed config files 4 years ago
Ro 1288bbc32b fixed checking session active state bug 4 years ago
Ro f3aa86d472 git ignore tweak to save index. oops 4 years ago
Ro 0ea15ae4b2 added custom session manager, moved index to safe directory 4 years ago
Ro b1cc12673c plugged in APIController, turned on login, added lodash! 4 years ago
Ro f3f2a6502b normalized url routing and cleaned up templating structure 4 years ago
Ro cf752fd8c0 set up views structure, started Auth class for session management 4 years ago
Ro 31d5e1192c markdown file retrival working, got rid of unnecessary configs 4 years ago
Ro e459366c46 working out page routing 4 years ago
Ro 3617565210 new scaffolding set up 4 years ago
Ro 67a47355d2 added basic routing and page rendering 4 years ago
Ro 05ff48a51c begin transition to php environment for rebuild 4 years ago
Ro 125256838c clean up to move nodejs-archive-branch 4 years ago
Ro 31feb32f96 grapped patch from beta release for broken archive links 4 years ago
Ro 1d7f4a20f7 updated version number, format fix for file 4 years ago
Ro ca481d2b91 added notification for adding images in post editor, added animation to working icon 4 years ago
Ro fdde954822 fixed marking index as feature bug 4 years ago
Ro 1130bcabdb pages re-indexing up and running, added button to settings under MAINTENANCE tab 4 years ago
Ro 7df3d22a29 color tweaks, fixed settings header cutting of action buttons isssue, updated monospace font list 4 years ago
Ro 2788e64e3b converted stylus files to sass, removed stylus dependencies 4 years ago
Ro 16486d771f re-added nodemon to dev and debug scripts 4 years ago
Ro a407eeb9be just tidying up a bit 4 years ago
Ro 92a5169949 fix for saving uploaded image url in pages, type tweak for dashboard 4 years ago
Ro 62b9744040 state error with notifications fix 4 years ago
Ro dd70fa1348 fix for notification animation bug 4 years ago
Ro 04f77806ac notifications position fix, bumped version number 4 years ago
Ro d9d004468a opn graph meta edits, log out made public, improved notifications 4 years ago
Ro 812be36edb bumped version number 4 years ago
Ro ba92cf5f61 fixed bug that was saving setting feature background url incorrectly 4 years ago
Ro d404925bcf aligned with latest beta release 4 years ago
Ro ad1ff0e44a patched view fixes from beta-branch 4 years ago
Ro c91166a1aa minor touchups 4 years ago
Ro 126361fca8 updated init with empty config fix, added site restore by verifying backup file 4 years ago
Ro efb20eeeb3 fixed git ignore remant blocking new api path 4 years ago
Ro 96e7fddcdf git ignore update 4 years ago
Ro 11b93e3451 back up method restores public blog images, site settings and markdown pages 4 years ago
Ro 1fa21322fb cleaned up backups on front end and backend 4 years ago
Ro 682bc32a46 added back up functionality and ability to download latest back up, latest backup displayed in settings 4 years ago
Ro c90797433d package json clean up 4 years ago
Ro fd97aca57a updated version number 4 years ago
Ro ef6add4be0 added nodemon to dev dependecies so it doesnt have to installed globally 4 years ago
Ro 287b227d2c added pm2 to dependancy list so it does not need to be installed globally 4 years ago
Ro f32a2ab9bb site port now configurable, removed kit from frame, fixed nav sort 4 years ago
Ro f6b0207c3d got damn line breaks 4 years ago
Ro fcc9738696 fixed readme links 4 years ago
Are0h 2ba21b0b2e updated readme to fix links 4 years ago
Ro 2bdaf70088 added basic reindexing method for dates to Utils 4 years ago
Ro 45e2a7f891 imported index template edit from beta branch 4 years ago
Ro ffb7fca50a added line breaks to readme 4 years ago
Are0h 24aaffa13e Update 'README.md' 4 years ago
Ro df246db551 more readme edits 4 years ago
Ro ff76cfbf31 added docs links readme 4 years ago
Are0h b970974ab9 Update 'README.md' 4 years ago
Ro e386322f7e imported tag rendering fix from beta release branch 4 years ago
Ro b6f89e22b8 do not add index to recent pages list 4 years ago
Ro cff38d338f merged tag render fix from beta branch 4 years ago
Ro ad09a61ab7 added directory check to init when making index md file 4 years ago
Ro 575fea388b tweaked init form style, redirects to login when set up complete 4 years ago
Ro cc1e709358 current theme assets are moved to public when rendering pages 4 years ago
Ro 4f1993516f found weird stylus source map error. just turned off source mapping for now 4 years ago
Ro fe2b0f17bb stray console log 4 years ago
Ro 518f0aeb20 added public methods for getting paginated entry data and single entry data to front end API 4 years ago
Ro 634011059d finally added a damn favicon 4 years ago
Ro dca45315f4 edited git ignore file to add default global images 4 years ago
Ro 92dfe67391 removed tag pages where corresponding page is not published or deleted, fixed settings button overlay so its not blocking links 4 years ago
Ro 302147df57 plugged in feeaturd posts into template 4 years ago
Ro a4b945d31d cleaned up setting ui to make saving, publishing more accessible, turned on render on save functionality 4 years ago
Ro ef9665f12b removed comment 4 years ago
Ro 09efd3c348 mailer is an admin method, so added auth check to request 4 years ago
Ro 5227b1faa1 removed preview temporarily, got mailer api working again 4 years ago
Ro 9a14d6cf5c Starting getting the README together for the beta 4 years ago
Ro 53da617ee4 user session data is updated when user info is edited 4 years ago
Ro df9ebc7706 when title changes when editing a page, remove old html and markdown pages 4 years ago
Ro 27338da86c split fipamo api into two parts to handle admin and non admin requests 4 years ago
Ro 957a389b8b consolidated fipamo api admin methods 4 years ago
Ro 0fa1bebc8a sets page menu status to false when corresponding menu item is removed from menu 4 years ago
Ro 75b4cb9ac2 changed Fipamo API methods to be based on tasks, not api call type 4 years ago
Ro a92f624b75 added meta data to html rendering 4 years ago
Ro cf08362a36 cleaned up console logs 4 years ago
Ro 56fc6cbe7b cleaned up and fixed pagination, pages not published are not show on archive page 4 years ago
Ro 4387591661 dash index item style and layout tweaks 4 years ago
Ro e1418dd1a1 added option labels to dash recent items 4 years ago
Ro 35a20479fe found and fixed navigation order updating bug. whew. 4 years ago
Ro 9dd8be25f4 index markdown page renders to correct file name on change, changed published flag to true in index template file 4 years ago
Ro 473849c993 moved API JSON response parsing to API request method 4 years ago
Ro 192998bdb4 cleaned up console logs 4 years ago
Ro 5a9a14deaa pages marked unpublished are not rendered. changing publish status to false removes rendered html page 4 years ago
Ro 33decbea9a added parcel to dev dependencies after removed globally 4 years ago
Ro c73312165b added welcome message to template rendering 4 years ago
Ro 33f4765a87 navigation updates correctly when pages are pinned to menu, menu items deleted when page is deleted 4 years ago
Ro 6ed3797b3a added some quick notes to update rendering, changed index template id to 0 since it is always present 4 years ago
Ro 9c1dbe00ad quick readme edit 4 years ago
Ro 03e8fbe82f index page now created as part of blog init process 4 years ago
Ro fe5c581497 plugged front in error notification for API calls 4 years ago
Ro 1aea87faf0 fixed upload dirs creation when not present, added error pages for routes 4 years ago
Ro af72b343eb quick reminder comment for error page 4 years ago
Ro cf89b48d17 added settings loading to API to fix caching, added site init and onboarding, added settings templates to make site set up easier 4 years ago
Ro e6b3917c51 moved settings retrieval to Settting data class to get rid of settings caching problem 4 years ago
Ro 36d6631df9 created Fipamo API Library, moved all API urls to API class 4 years ago
Ro ca6e9e488b removed uneccessary util files, moved token set up to API util constructor, notifications style tweak 4 years ago
Ro eeeb4f9af6 index page cannot be deleted 4 years ago
Ro 54c7690e26 tightened up notifciations display 4 years ago
Ro 8bdc7cbfe9 tightned up archive filtering, removed index and deleted pages links on archive html page 5 years ago
Ro f7e40b713d added archive page that contains all site pages 5 years ago
Ro a746ddd0aa deleted paged no longer render, render resolves once instead of multiple times 5 years ago
Ro c1615602c8 fixed page path bug, added path to nav ui and api payload, added navigation to render template methodology 5 years ago
Ro ee7af528cd cleaned up/updated node modules, fixed page edit bug, updated bcrypt 5 years ago
Ro a3a274ea61 made date pretty for dash index listing, quick style fix to compensate for long titles 5 years ago
Ro bd15252475 turned off date picker, cleaned up page edit UI 5 years ago
Ro c2517997c7 added meta tag data to page render method, added page display limiter to dash index 5 years ago
Ro 7243e5ec32 inserted directory exists check when rendering md and html, completed index and page html rendering sequence chain 5 years ago
Ro f6fc242d9c added markdown page organization and path variable to md meta for orgainzied html rendering 5 years ago
Ro 21520b1d60 added auth to nav update method, moved nav update method to nad data class 5 years ago
Ro f3ae41cd2a cleaned up config file read for making new pages 5 years ago
Ro 6c24660bbb added auth check to settings updating, moved settings sync to setting data class 5 years ago
Ro 161f441b84 made separate file for tags, fixed config caching error when creating new post 5 years ago
Ro 7dae73bed9 fixed layout not setting on new pages 5 years ago
Ro 0f26dcb62a moved indexing to setting file, simplified updating index count 5 years ago
Ro c4f6ed7357 quick clean up commit 5 years ago
Ro d257d94a80 added tag rendering events, added data utilty class 5 years ago
Ro 3f4089a6d3 turned off page edit options scroll adjustment, fixed page creation redirect 5 years ago
Ro eae80b0014 removed syntax highlighting in editor. will revist later 5 years ago
Ro 050dfb0b66 fixed page rendering bug after switching methodology to class, TAG PAGES ARE RENDERING BITCH 5 years ago
Ro 8e365216ea fixed extra spacing bug when sorting tags 5 years ago
Ro fad2c4bc8d cleaned up package scripts, added tag sorting to settings 5 years ago
Ro 4ff6f22e25 slight tweak so theme activation is drag and drop 5 years ago
Ro 38cfc1fc6c basic page rendering working index 5 years ago
Ro f10b25e698 fixed API authentication bug. whew. 5 years ago
Ro 8052c861bf added page rendering framework to API 5 years ago
Ro cf363125b7 filled out READ ME a bit more 5 years ago
Ro 52bb5f36a9 moved auth methods to their own standalone class 5 years ago
Ro ea1795e0fa added Navigation data class, menu updates on page soft delete 5 years ago
Ro 7b6af21c77 cleaned up auth in api calls, added page delete, moved edit page methods to Book data class 5 years ago
Ro 0f6ce7c3d8 token encyrption working. never send token to the front end. 5 years ago
Ro f3339089ff completed move to v1 API, made specific API request class, started plugging in API authorization methodology 5 years ago
Ro d329522091 navigation sorting working again 5 years ago
Ro 03a96dfed1 cleaned up save settings payload, added render on save toggle 5 years ago
Ro ab19d8027e set up settings api, site background and avi image uploading cleaned up and working 5 years ago
Ro 4175bb631e cleaded up settings display. ignoring json in prettier 5 years ago
Ro 477533ceb5 smooted out settings update after new post, activated page listing and sorting 5 years ago
Ro 532748f688 fixed post image uploading, cleaned up text editor styles (FINALLY), plugged in error page renderererer 5 years ago
Ro 84542228a3 cleaned up libraries file, polished page updating, added page creation 5 years ago
Ro 7103f5ca8e cleaned up package json, plugged in basic notifications system 5 years ago
Ro 74225b627e basic markdown file rending working. fuck. yes. 5 years ago
Ro 849c5e2ac0 switched to web safe fonts for now, streamline file uploads, now tracking upload progress. 5 years ago
Ro 018bfc410b request promise way too large, switching back to custom request method 5 years ago
Ro 7897a8bca9 cleaned up dependecies, initiated db-less post editing methodology 5 years ago
Ro d536871fd4 added pages config json(may not need), synced editor to markdown metadata, resolved new asset dependency paths 5 years ago
Ro 5824f36e47 corrected dependency paths 5 years ago
Ro 6b11b10965 folder rename 5 years ago
Ro 540a9e4129 project restructuring 5 years ago
Ro 18ba90b310 moved admin views to brain, seperated front end code and styles to seperate src folder 5 years ago
Ro 4bde21599e modified pages data retrival method 5 years ago
Ro 19cb97b9c4 started new api for retrieving markdown pages, dashboard displaying files for editing 5 years ago
Ro c549e5ba7c refactored auth system 5 years ago
Ro 12d19bc3e9 cleaned up class dependancies, moving auth to new methodology 5 years ago
Ro dac1193a78 removed all sequelize declarations... whew... 5 years ago
Ro 006c01f39e restructed cotent folders, removed assets that automatically from repo 5 years ago
Ro bdc84bc330 restructuring brain set up 5 years ago
Ro 327cb7a25d started removing all postgress dependencies 5 years ago

@ -1 +1,13 @@
{ "presets": ["env"] }
{
"presets": [],
"plugins": [
[
"prismjs",
{
"languages": ["html", "markdown", "markup"],
"theme": "okaidia",
"css": false
}
]
]
}

@ -1,69 +1,70 @@
{
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {}
},
"rules": {
"constructor-super": 2,
"for-direction": 2,
"getter-return": 2,
"no-case-declarations": 2,
"no-class-assign": 2,
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-console": 1,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-control-regex": 1,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-func-assign": 2,
"no-global-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-mixed-spaces-and-tabs": 2,
"no-new-symbol": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-self-assign": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-undef": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"no-unused-labels": 2,
"no-unused-vars": 2,
"no-useless-escape": 1,
"require-yield": 2,
"use-isnan": 2,
"valid-typeof": 2,
"no-duplicate-imports": 2
},
"env": {
"node": true,
"browser": true,
"es6": true
},
"globals": {
"_": false,
"hljs": false,
"Sortable": false
}
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {}
},
"rules": {
"constructor-super": 2,
"for-direction": 2,
"getter-return": 2,
"no-case-declarations": 2,
"no-class-assign": 2,
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-console": 1,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-control-regex": 1,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-func-assign": 2,
"no-global-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-mixed-spaces-and-tabs": 2,
"no-new-symbol": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-self-assign": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-undef": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"no-unused-labels": 2,
"no-unused-vars": 1,
"no-useless-escape": 1,
"require-yield": 2,
"use-isnan": 2,
"valid-typeof": 2,
"no-duplicate-imports": 2
},
"env": {
"node": true,
"browser": true,
"es6": true
},
"globals": {
"_": false,
"hljs": false,
"Sortable": false,
"Prism": false
}
}

49
.gitignore vendored

@ -1,20 +1,43 @@
node_modules/
src/node_modules/
.parcel-cache/
.sass-cache/
.cache/
content/folio-images
content/client-images
content/blog-images
content/user-images
.nova/
!public/
public/*
!public/favicon.ico
!public/index.php
!public/assets
public/assets/*
!public/assets/css
public/assets/css/*
!public/assets/css/dash
!public/assets/scripts
public/assets/scripts/*
!public/assets/scripts/dash.js
!public/assets/scripts/dash.js.map
!public/assets/images
public/assets/images/*
!public/assets/images/global/
!public/assets/images/global/*
!content/
content/*
!content/themes
content/themes/*
!content/themes/fipamo-default
!content/themes/fipamo-default/*
vendor/
cache/
_temp
.ftpconfig
.vscode/
config.development.json
*.swp
/_migrations/
/config.json
config/config.json
brain/models/_backup/
/_maintenance/
/migrations
config/settings.json
config/folks.json
config/pages.json
config/tags.json
*.DS_Store
/forfipamo
site-settings.json
config.codekit3
/config/backups

@ -0,0 +1,74 @@
<?php
$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->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' => false,
'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',
],
//Other rules here...
])
->setLineEnding("\n");

@ -1,5 +1,7 @@
.babelrc
README.md
*.pug
*.styl
*.twig
*.sass
*.json
*.php
*.md

@ -1,17 +1,36 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": true,
"parser": "babel",
"proseWrap": "preserve",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"useTabs": true,
"tabWidth": 4,
"printWidth": 100
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
},
{
"files": "*.scss",
"options": {
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"printWidth": 90
}
},
{
"files": "*.js",
"options": {
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"bracketSameLine": false,
"jsxSingleQuote": true,
"proseWrap": "preserve",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"useTabs": true,
"tabWidth": 4,
"printWidth": 90
}
}
]
}

@ -1,8 +0,0 @@
const path = require('path');
module.exports = {
'config': path.resolve('config', 'config.json'),
'models-path': path.resolve('brain', 'models'),
'seeders-path': path.resolve('config', 'seeders'),
'migrations-path': path.resolve('config', 'migrations')
}

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

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

@ -1,3 +1,9 @@
# Fipamo
# Fipamo means to save
The most chill blog framework ever
The Fipamo project was born from a need for a simple, easy to use no data blog platform that doesn't require much effort to set up and maintain. Fipamo uses Markdown to handle posts and renders them to flat html so you can serve them from anywhere. No complicated set ups. No long list of dependencies. Just set up and go.
Because it's the 21 century. This should be easy.
## Check the (WIP) Docs to get you started. <br>
[Getting Started](https://koodu.ubiqueros.com/are0h/Fipamo/wiki/00---Start) <br>

@ -0,0 +1,10 @@
<?php
spl_autoload_register(function ($className) {
$file = dirname(__DIR__) . '\\' . $className . '.php';
$file = str_replace('\\', DIRECTORY_SEPARATOR, $file);
//echo $file;
if (file_exists($file)) {
include $file;
}
});

@ -1,205 +0,0 @@
import DateUtils from '../../tools/utilities/DateUtils';
import StringUtils from '../../tools/utilities/StringUtils';
import * as DataEvent from '../../tools/events/DataEvent';
import sanitize from 'sanitize-html';
import RightsManager, {
TASK_CREATE,
TASK_UPDATE,
OBJECT_POST
} from '../../tools/utilities/RightsManager';
const express = require('express');
const router = express.Router();
const multer = require('multer');
const md = require('markdown-it')('commonmark');
const fs = require('fs-extra');
const Models = require('../../models');
const dateUtils = new DateUtils();
const rightsManager = new RightsManager();
const uploadPath =
'./content/blog-images/' +
dateUtils.getDate('year', new Date()) +
'/' +
dateUtils.getDate('month', new Date());
const Sequelize = require('sequelize');
const Op = Sequelize.Op;
const _ = require('lodash');
fs.ensureDir(uploadPath, () => {
//console.log(err) // => null
// dir has now been created, including the directory it is to be placed in
});
var storage = multer.diskStorage({
destination: function(req, file, cb) {
cb(null, uploadPath);
},
filename: function(req, file, cb) {
var splice = file.originalname.split(':');
cb(null, splice[0]);
}
});
var feature_upload = multer({
storage: storage
}).array('feature_image');
var post_upload = multer({
storage: storage
}).array('post_image');
//** SYNC POSTS */
router.post('/sync', (req, res) => {
let payload = req.body;
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_POST, TASK_UPDATE)) {
for (let index = 0; index < payload.length; index++) {
const item = payload[index];
Models.FreshPost.findOne({
where: {
post: {
[Op.contains]: {
uuid: item.post.uuid
}
}
}
})
.then(found => {
let buffed = sanitize(item.post.plaintext, {
allowedTags: ['del', 'a', 'iframe', 'img'],
allowedAttributes: {
a: ['href', 'name', 'target'],
img: ['src'],
iframe: [
'height',
'width',
'src',
'frameborder',
'allow',
'allowfullscreen'
]
}
});
buffed = new StringUtils().decodeHTML(buffed);
item.post.plaintext = buffed;
item.post.html = md.render(buffed, {
html: true,
xhtmlOut: true
});
if (!_.isEqual(item.post, found.post)) {
found
.update(item)
.then(() => {
//console.log('UPDATED', updated);
})
.catch(() => {
//console.log("***ERROR***", err);
});
} else {
//chilld
}
})
.catch(() => {
//console.log("***ERRRORZ****", err);
Models.FreshPost.create(item).then(() => {
//console.log(fresh)
});
});
}
res.json({
message: 'postsSynced'
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
router.get('/json/:filter?', function(req, res) {
var filter = req.params.filter;
Models.FreshPost.findAll({
order: [['id', 'DESC']]
})
.then(function(posts) {
let newlist = [];
for (let index = 0; index < posts.length; index++) {
let item = posts[index].post;
switch (filter) {
case 'not-deleted':
if (typeof item.deleted == 'undefined' || item.deleted == false) {
newlist.push(posts[index]);
} else {
continue;
}
break;
default:
newlist.push(posts[index]);
break;
}
}
res.json(newlist);
})
.catch(() => {
//next(err);
});
});
/***
POST IMAGE
*/
router.post('/add-post-image', function(req, res) {
//console.log(req.body);
if (!req.session.user)
return res.json({
message: 'You need to be logged in, champ.'
});
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_POST, TASK_CREATE)) {
post_upload(req, res, function(err) {
if (err) {
//console.log('Error in Saving Entry: ' + err);
res.json({
message: err
});
throw err;
} else {
var postImage = req.files[0].path;
return res.json({
message: DataEvent.POST_IMAGE_ADDED,
url: postImage.substr(7, postImage.length)
});
}
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
router.post('/add-feature-image', function(req, res) {
//console.log(req.body);
if (!req.session.user)
return res.json({
message: 'You need to be logged in, champ.'
});
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_POST, TASK_CREATE)) {
feature_upload(req, res, function(err) {
if (err) {
//console.log('Error in Saving Entry: ' + err);
res.json({
message: err
});
throw err;
} else {
var postImage = req.files[0].path;
return res.json({
message: DataEvent.FEATURE_IMAGE_ADDED,
url: postImage.substr(7, postImage.length)
});
}
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
module.exports = router;

@ -1,212 +0,0 @@
import DateUtils from '../../tools/utilities/DateUtils';
import * as DataEvent from '../../tools/events/DataEvent';
import RightsManager, {
TASK_CREATE,
TASK_UPDATE,
OBJECT_POST,
OBJECT_SETTINGS
} from '../../tools/utilities/RightsManager';
const express = require('express');
const router = express.Router();
const multer = require('multer');
const fs = require('fs-extra');
const Models = require('../../models');
const dateUtils = new DateUtils();
const rightsManager = new RightsManager();
const uploadPath =
'./content/user-images/' +
dateUtils.getDate('year', new Date()) +
'/' +
dateUtils.getDate('month', new Date());
fs.ensureDir(uploadPath, () => {
//console.log(err) // => null
// dir has now been created, including the directory it is to be placed in
});
var storage = multer.diskStorage({
destination: function(req, file, cb) {
cb(null, uploadPath);
},
filename: function(req, file, cb) {
var splice = file.originalname.split(':');
cb(null, splice[0]);
}
});
var avatar_upload = multer({
storage: storage
}).array('avatar_upload');
var background_upload = multer({
storage: storage
}).array('background_upload');
//** SYNC POSTS */
router.post('/sync', (req, res) => {
let payload = req.body;
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_SETTINGS, TASK_UPDATE)) {
fs.readJson('config/site-settings.json')
.then(obj => {
if (user.hande != payload.handle || user.email != payload.email) {
user.update({
handle: payload.handle,
email: payload.email
})
.then(() => {
//console.log('UPDATED');
})
.catch(() => {
//console.log('ERR', err);
});
} else {
//console.log('USER NOT UPDATED');
}
obj.url = payload.url;
obj.title = payload.title;
obj.description = payload.descriptions;
obj.private = payload.private;
obj.theme = payload.theme;
obj.background = payload.background; //TODO: make this url relative
//mail stuff
obj.email.active = payload.mailSettings.activeProtocol;
obj.email.smtp.domain = payload.mailSettings.smtp.domain;
obj.email.smtp.email = payload.mailSettings.smtp.email;
obj.email.smtp.password = payload.mailSettings.smtp.password;
obj.email.mailgun.domain = payload.mailSettings.mailgun.domain;
obj.email.mailgun['api-key'] = payload.mailSettings.mailgun.key;
fs.writeJson('config/site-settings.json', obj)
.then(() => {
res.json({
message: DataEvent.SETTINGS_UPDATED
});
})
.catch(() => {
//console.error(err);
});
})
.catch(() => {
//console.error(err);
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
router.get('/nav', function(req, res) {
fs.readJson('config/site-settings.json')
.then(obj => {
fs.writeJson('config/site-settings.json', obj)
.then(() => {
res.json(obj.menu);
})
.catch(() => {
//console.error(err);
});
})
.catch(() => {
//console.error(err);
});
});
router.post('/nav-sync', (req, res) => {
let payload = req.body;
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_SETTINGS, TASK_UPDATE)) {
fs.readJson('config/site-settings.json')
.then(obj => {
obj.menu = payload;
fs.writeJson('config/site-settings.json', obj)
.then(() => {
res.json({
message: DataEvent.SETTINGS_UPDATED
});
})
.catch(() => {
//console.error(err);
});
})
.catch(() => {
//console.error(err);
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
/***
UPLOAD AVATAR
*/
router.post('/add-avatar', function(req, res) {
//console.log(req.body);
if (!req.session.user)
return res.json({
message: 'You need to be logged in, champ.'
});
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_POST, TASK_CREATE)) {
avatar_upload(req, res, function(err) {
if (err) {
res.json({
message: err
});
throw err;
} else {
var avatar = req.files[0].path;
user.update({
avatar: avatar.substr(7, avatar.length)
})
.then(updated => {
req.session.user = updated;
})
.catch(() => {
//console.log('ERR', err);
});
return res.json({
message: DataEvent.AVATAR_UPLOADED,
url: avatar.substr(7, avatar.length)
});
}
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
/***
UPLOAD FEATURE BACKGROUND
*/
router.post('/add-feature-background', function(req, res) {
//console.log(req.body);
if (!req.session.user)
return res.json({
message: 'You need to be logged in, champ.'
});
Models.User.findById(req.session.user.id).then(user => {
if (rightsManager.check(user.role, OBJECT_POST, TASK_CREATE)) {
background_upload(req, res, function(err) {
if (err) {
res.json({
message: err
});
throw err;
} else {
var bgImage = req.files[0].path;
return res.json({
message: DataEvent.SITE_BACKGROUND_UPLOADED,
url: bgImage.substr(7, bgImage.length)
});
}
});
} else {
res.json({
message: "Nah. You can't do that. Talk to the admin, sport."
});
}
});
});
module.exports = router;

@ -1,74 +0,0 @@
var express = require('express');
var router = express.Router();
var nodemailer = require('nodemailer');
var mg = require('nodemailer-mailgun-transport');
const fs = require('fs-extra');
const pug = require('pug');
router.post('/', function(req, res) {
fs.readJson('config/site-settings.json')
.then(settings => {
let transport = '';
var auth = '';
switch (settings.email.active) {
case 'option-smtp':
auth = {
host: settings.email.smtp.domain,
port: 587,
secure: false,
auth: {
type: 'login',
email: settings.email.smtp,
password: settings.email.smtp.password
}
};
transport = nodemailer.createTransport(auth);
break;
case 'option-mg':
auth = {
auth: {
api_key: settings.email.mailgun['api-key'],
domain: settings.email.mailgun.domain
}
};
transport = nodemailer.createTransport(mg(auth));
break;
}
let render = pug.compileFile('themes/dash/email/base.pug');
let html = render({
title: settings.title,
header: 'a note from ' + settings.title,
content: req.body.content,
footer: 'powered by fipamo'
});
transport.sendMail(
{
from: 'control@playvico.us',
to: 'are0h@protonmail.com', // An array if you have multiple recipients.
subject: 'Hey beautiful',
//You can use "html:" to send HTML email content. It's magic!
html: html
//You can use "text:" to send plain-text content. It's oldschool!
//text: 'Mailgun rocks, pow pow!'
},
function(err, info) {
if (err) {
//console.log(err);
res.json({
message: 'MAIL ERROR',
desc: err
});
} else {
//console.log(info);
res.json({
message: 'MAIL SENT',
desc: info
});
}
}
);
})
.catch(() => {
//console.error(err);
});
});
module.exports = router;

@ -0,0 +1,81 @@
<?php
namespace brain\api\v1;
use brain\data\Auth;
use brain\data\Session;
class AuthAPI
{
public function __construct()
{
}
public static function status()
{
$result = [];
//internal check for admin action
if (Auth::status()) {
$result = [
'message' => 'Authorized',
'type' => 'apiUseAuthorized',
'token' => Session::get('token'),
];
} else {
$result = [
'message' => 'Not Authorized',
'type' => 'apiUseNotAuthorized',
];
}
return $result;
}
public static function login($body)
{
$result = [];
switch (Auth::login($body)) {
case 'no_name':
$result = [
'message' => 'Need to see some id, champ',
'type' => 'requestLame',
];
break;
case 'bad_pass':
$result = [
'message' => 'Check your password, sport',
'type' => 'requestLame',
];
break;
default:
$result = [
'message' => 'Welcome back',
'type' => 'requestGood',
];
break;
}
return $result;
}
public static function logout($body)
{
Auth::logout($body);
$result = [
'message' => 'Till next time, g.',
'type' => 'TASK_LOGOUT',
];
return $result;
}
public static function requestSecret($body)
{
$result = Auth::findSecret($body);
return $result;
}
public static function resetPassword($body)
{
$result = Auth::makeNewPassword($body);
return $result;
}
}

@ -0,0 +1,73 @@
<?php
namespace brain\api\v1;
use brain\utility\FileUploader;
use brain\data\Settings;
use brain\data\Member;
class FilesAPI
{
public function __construct()
{
}
public static function uploadFiles($request, $type = null)
{
$upload = $request->getUploadedFiles(); //grab uploaded files
$options = $request->getParsedBody();
$file = $upload['upload_files'][0]; //front end sends one by one for progress tracking, so grab first
$type = $file->getClientMediaType();
$filesPath = '';
$path = date('Y') . '/' . date('m');
$response = [];
switch ($type) {
case 'image/jpeg':
case 'image/png':
case 'image/gif':
case 'image/svg':
if (isset($options["source"])) {
if ($options["source"] == "avatar-upload") {
$filesPath = '/assets/images/user/' . $path . '/';
Member::updateData(
'avi',
$filesPath . $file->getClientFileName()
);
} else {
$filesPath = '/assets/images/user/' . $path . '/';
Settings::updateGlobalData(
'background',
$filesPath . '/' . $file->getClientFileName()
);
}
} else {
$filesPath = '/assets/images/blog/' . $path . '/';
}
break;
case 'video/mp4':
$filesPath = '/assets/video/blog/' . $path . '/';
break;
case 'audio/mpeg':
$filesPath = '/assets/sound/blog/' . $path . '/';
break;
case 'application/pdf':
case 'text/plain':
case 'text/rtf':
$filesPath = '/assets/docs/blog/' . $path . '/';
break;
}
FileUploader::uploadFile('../public' . $filesPath, $file);
$response = [
'message' => "File Uploaded. Great!",
"filePath" => $filesPath . urlencode($file->getClientFileName()),
"fileName" => urlencode($file->getClientFileName()),
'type' => $type,
];
return $response;
}
}

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

@ -0,0 +1,34 @@
<?php
namespace brain\api\v1;
use brain\utility\Setup;
class InitAPI
{
public function __construct()
{
}
public static function handleInitTasks($task, $request)
{
//check if a site config already exists. if it does, deny set up request
//restore to previous version of site while a config exists is only accessible
//through settings.
if (Setup::status()) {
$result = ['type' => 'blogInitFail', 'message' => 'Site already set up'];
} else {
switch ($task) {
case 'init':
$result = Setup::init($request);
break;
case 'restore':
$result = Setup::restore($request);
break;
}
}
return $result;
}
}

@ -0,0 +1,32 @@
<?php
namespace brain\api\v1;
use brain\data\Session;
use brain\utility\Mailer;
class MailerAPI
{
public function __construct()
{
}
public static function handleMail($request, $body, $response)
{
// if testing, verify session is active
// add clean method for sending programmtic emails
if ($body['mail_task'] == 'TESTING') {
if (Session::active()) {
$result = Mailer::sendmail($body);
} else {
$result = [
'message' => 'You need to be logged in for this, champ.',
'type' => 'MAILER_ERROR',
];
}
} else {
}
return $result;
}
}

@ -0,0 +1,179 @@
<?php
namespace brain\api\v1;
use brain\data\Book;
use brain\data\Settings;
use brain\data\Session;
use brain\utility\StringTools;
use function _\filter;
class PagesAPI
{
public function __construct()
{
}
public static function getPageContent($request, $args)
{
$task = $args['fourth'];
$pages = (new Book('../content/pages'))->getContents();
$content = [];
foreach ($pages as $page) {
$entry = [
'id' => $page['id'],
'uuid' => $page['uuid'],
'title' => $page['title'],
'feature' => $page['feature'],
'path' => $page['path'],
'layout' => $page['layout'],
'tags' => $page['tags'],
'author' => $page['author'],
'created' => $page['created'],
'updated' => $page['updated'],
'deleted' => $page['deleted'],
'menu' => $page['menu'],
'featured' => $page['featured'],
'published' => $page['published'],
'slug' => $page['slug'],
'content' => StringTools::sanitizeContent($page['content']),
];
array_push($content, $entry);
}
switch ($task) {
case 'published':
$published = filter($content, function ($item) {
return $item['published'] == true && $item['deleted'] == false;
});
$result = ['pages' => $published, 'totalItems' => count($published)];
break;
case 'featured':
$featured = filter($content, function ($item) {
return $item['featured'] == true && $item['deleted'] == false;
});
$result = [
'pages' => $featured,
'totalItems' => count($featured),
];
break;
case 'menu':
$menu = filter($content, function ($item) {
return $item['menu'] == true && $item['deleted'] == false;
});
$result = ['pages' => $menu, 'totalItems' => count($menu)];
break;
case 'single':
$uuid = $args['fifth'];
$page = (new Book('../content/pages'))->findPageById($uuid);
$entry = [
'id' => $page['id'],
'uuid' => $page['uuid'],
'title' => $page['title'],
'feature' => $page['feature'],
'path' => $page['path'],
'layout' => $page['layout'],
'tags' => $page['tags'],
'author' => $page['author'],
'created' => $page['created'],
'updated' => $page['updated'],
'deleted' => $page['deleted'],
'menu' => $page['menu'],
'featured' => $page['featured'],
'published' => $page['published'],
'slug' => $page['slug'],
'content' => StringTools::sanitizeContent($page['content']),
];
$result = $entry;
break;
case 'tags':
$result = Settings::getTags();
break;
default:
$result = [
'message' => "Hm, no task. That's unfortunate",
'type' => 'TASK_NONE',
];
break;
}
return $result;
}
public static function handlePageTask($request, $args)
{
$task = $args['fourth'];
switch ($task) {
case 'delete':
case 'create':
case 'write':
$body = json_decode(file_get_contents("php://input"), true);
$passed = true;
if (!isset($body['form_token'])) {
$result = [
'message' => 'No form token. Not good, sport.',
'type' => 'TASK_FORM_AUTH',
];
} else {
if ($body['form_token'] == Session::get('form_token')) {
$keys = [
'id',
'uuid',
'layout',
'current_title',
'content',
'title',
'created',
'slug',
'tags',
'menu',
'featured',
'published',
'form_token',
'imageList',
"fileList",
"remote"
];
foreach ($body as $key => $item) {
if (!in_array($key, $keys)) {
//found unnecessary key, so reject submission
var_dump($key);
$passed = false;
}
}
if ($passed) {
$result = (new Book())->editPage($task, $request);
} else {
$result = [
'message' => 'Unneccessary key found. Post not authorized, slick.',
'type' => 'TASK_FORM_AUTH',
];
}
} else {
$result = [
'message' => 'Form token, auth failed. Uh oh.',
'type' => 'TASK_FORM_AUTH',
];
}
}
break;
case 'add-entry-image':
$result = ImagesAPI::uploadImage($request);
break;
default:
$result = [
'message' => "Hm, no task. That's unfortunate",
'type' => 'TASK_NONE',
];
break;
}
return $result;
}
}

@ -0,0 +1,153 @@
<?php
namespace brain\api\v1;
use brain\data\Render;
use brain\data\Settings;
use brain\data\Session;
use brain\utility\Maintenance;
class SettingsAPI
{
public function __construct()
{
}
public static function handleSettingsTask($request, $args, $body = null)
{
$task = $args['fourth'];
switch ($task) {
case 'publish':
//check settings to see if site is a one pager
$config = new Settings();
$settings = $config->getSettings();
$theme = $settings['global']['theme'];
$themeConfig = json_decode(
file_get_contents('../content/themes/' . $theme . '/theme.json'),
true
);
//check to see if dynamic rendering is active
if (
isset($settings['global']['dynamicRender']) &&
$settings['global']['dynamicRender'] === 'true'
) {
$result = [
'message' => "Dynamic Render Active! You're good!",
'type' => 'RENDER_SUCCESS',
];
} else {
$render = new Render();
if (isset($themeConfig['render'])) {
//rendering for one page sites
if (!$themeConfig['render'] || $themeConfig['render'] === 'false') {
$render->renderIndex();
$result = [
'message' => 'Index Rendered. HAND CLAPS',
'type' => 'RENDER_SUCCESS',
];
} else {
$render->renderTags();
$render->renderArchive();
$render->renderPages();
$result = [
'message' => 'Site Rendered. GOOD EFFORT',
'type' => 'RENDER_SUCCESS',
];
}
} else {
// just incase the render flag is missing
$render->renderTags();
$render->renderArchive();
$render->renderPages();
$result = [
'message' => 'Site Rendered. GOOD EFFORT',
'type' => 'RENDER_SUCCESS',
];
}
}
//if render flag is set and false, just render index page for one page sites
//otherwise, render all pages according to theme template files
break;
case 'add-avatar':
$result = ImagesAPI::uploadImage($request, 'avatar');
break;
case 'add-feature-background':
$result = ImagesAPI::uploadImage($request, 'background');
break;
case 'sync':
Settings::sync($body);
$result = [
'message' => "Settings Synced. You're doing great!",
'type' => 'settingsUpdated',
];
break;
case 'nav-sync':
Settings::navSync($body);
$result = [
'message' => 'Navigation updated. Very slick!',
'type' => 'menuUpdated',
];
break;
default:
$result = [
'message' => "Hm, no task. That's unfortunate",
'type' => 'TASK_NONE',
];
break;
}
return $result;
}
public static function getInfo($request, $args)
{
$task = $args['fourth'];
switch ($task) {
case 'site':
$config = new Settings();
$settings = $config->getSettings();
$data = [
'title' => $settings['global']['title'],
'base_url' => $settings['global']['base_url'],
'description' => $settings['global']['descriptions'],
];
$result = [
'message' => 'Settings Found',
'type' => 'GET_SETTINGS',
'data' => $data,
];
break;
case 'member':
if (Session::active()) {
$member = $member = Session::get('member');
$data = ['handle' => $member['handle'], 'email' => $member['email']];
$result = [
'message' => 'Member Info Found',
'type' => 'GET_MEMBER_INFO',
'data' => $data,
];
} else {
$result = [
'message' => "Not logged in. C'mon, bruh",
'type' => 'TASK_NONE',
];
}
break;
default:
$result = [
'message' => 'No Settings found. Frowny Face',
'type' => 'TASK_NONE',
];
break;
}
return $result;
}
public static function createBackup()
{
$result = Maintenance::makeBackup();
return $result;
}
}

@ -1,59 +0,0 @@
const express = require('express');
const router = express.Router();
const bCrypt = require('bcrypt-nodejs');
const jwt = require('jsonwebtoken');
const Models = require('../../models');
/**
* Get Auth Status
*/
router.get('/', function(req, res) {
var token = req.headers['x-access-token'];
if (!token) return res.status(401).send({ auth: false, message: 'No token provided.' });
jwt.verify(token, 'super-secret-string', function(err, decoded) {
if (err)
return res.status(500).send({ auth: false, message: 'Failed to authenticate token.' });
res.status(200).send(decoded);
});
});
/**
* Login Member and return token
*/
router.post('/login', function(req, res) {
Models.User.findOne({
where: {
handle: req.body.handle
}
})
.then(user => {
if (!isValidPassword(user, req.body.password)) {
return res.json({
message: 'CHECK YOUR PASSWORD'
});
}
let token = jwt.sign({ id: user._id }, 'super-secret-string', {
expiresIn: 86400 // expires in 24 hours
});
let session = req.session;
session.user = user;
session.token = token;
res.json({ auth: 'Yes', token: session.token });
})
.catch(() => {
return res.json({
message: 'NOT FOUND, HAWS'
});
});
});
//router.post('/logout', function(req, res) {});
module.exports = router;
function isValidPassword(user, password) {
return bCrypt.compareSync(password, user.password);
}

@ -1,94 +0,0 @@
var express = require('express');
var path = require('path');
//var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var MemoryStore = require('memorystore')(session);
var flash = require('connect-flash');
var theme = 'default-dark';
var app = express();
//var request = require('request');
// view engine setup
app.set('views', path.join(__dirname, '../themes'));
app.set('view engine', 'pug');
app.use(logger('dev'));
app.use(bodyParser.json({ limit: '50mb' }));
app.use(
bodyParser.urlencoded({
extended: false,
limit: '50mb'
})
);
app.use(cookieParser());
app.use(express.static(path.join(__dirname, '../public'), { extensions: ['html'] }));
//app.use(express.static(path.join(__dirname, '../content')));
//app.use(express.static(path.join(__dirname, '../themes')));
app.use(
session({
store: new MemoryStore({
checkPeriod: 86400000 // prune expired entries every 24h
}),
secret: '1KqZ18W8KskE1iSw',
saveUninitialized: false,
resave: false,
cookie: {
maxAge: 608800000
}
})
);
app.use(flash());
//sections
var front = require('./routes/front/index')(session);
var back = require('./routes/back/index');
var postDashboard = require('./routes/back/dash_posts');
var settingsDashboard = require('./routes/back/dash_settings');
var navDashboard = require('./routes/back/dash_nav');
//api
var postLibrary = require('./api/content/posts');
var settings = require('./api/content/settings');
var mailer = require('./api/mail/mailer');
var auth = require('./api/v1/auth');
// API PATHS
app.use('/api/post', postLibrary);
app.use('/api/settings', settings);
app.use('/api/mail', mailer);
app.use('/api/v1/auth', auth);
// PAGES
app.use('/', front);
app.use('/@/dashboard', back);
app.use('/@/dashboard/posts', postDashboard);
app.use('/@/dashboard/settings', settingsDashboard);
app.use('/@/dashboard/navigation', navDashboard);
//app.use('/mailer', mailer);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res) {
res.status(err.status || 500);
res.render(theme + '/error', {
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res) {
res.status(err.status || 500);
res.render(theme + '/error', {
message: err.message,
error: {}
});
});
module.exports = app;

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

@ -0,0 +1,226 @@
<?php
namespace brain\controller;
use brain\data\Book;
use brain\data\Session;
use brain\data\Settings;
use brain\data\Themes;
use brain\utility\Setup;
use brain\utility\Sorting;
use Carbon\Carbon;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Views\Twig;
class DashControl
{
public static function start(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
): ResponseInterface {
$view = Twig::fromRequest($request);
$pageOptions = [];
$template = '';
if (Setup::status()) {
switch (isset($args['second']) ? $args['second'] : 'index') {
case 'settings':
if (Session::active()) {
$config = new Settings();
$settings = $config->getSettings();
$themes = (new Themes())->getThemes(); // $config->getThemes();
$template = 'dash/settings.twig';
$member = Session::get('member');
$form_token = Session::get('form_token');
$updated = new Carbon($settings['global']['last_backup']);
$pageOptions = [
'title' => 'Settings',
'private' => $settings['global']['private'],
'renderOnSave' => $settings['global']['renderOnSave'],
'background' => $settings['global']['background'],
'member' => $member,
'ftoken' => $form_token,
'siteTitle' => $settings['global']['title'],
'baseUrl' => $settings['global']['base_url'],
'desc' => $settings['global']['descriptions'],
'lastBackup' => $updated->format('Y M D d'),
'currentTheme' => $settings['global']['theme'],
'themes' => $themes,
'apiStatus' => isset($settings['global']['externalAPI'])
? $settings['global']['externalAPI']
: 'false',
'dynamicRenderStatus' => isset(
$settings['global']['dynamicRender']
)
? $settings['global']['dynamicRender']
: 'false',
'mailOption' => $settings['email']['active'],
'mailConfig' => $settings['email'],
'status' => Session::active(),
];
} else {
header('Location: /dashboard');
exit();
}
break;
case 'navigation':
if (Session::active()) {
$config = new Settings();
$settings = $config->getSettings();
$template = 'dash/navigation.twig';
$pageOptions = [
'title' => 'Edit Menu',
'status' => Session::active(),
'menu' => $settings['menu'],
];
} else {
header('Location: /dashboard');
exit();
}
break;
case 'pages':
if (Session::active()) {
$currentPage = isset($args['fourth']) ? $args['fourth'] : 1;
$filter = isset($args['third']) ? $args['third'] : 'all';
$data = (new Book())->getPages($currentPage, 4, $filter);
$template = 'dash/book.twig';
$pageOptions = [
'title' => 'Contents',
'entryCount' => $data['entryCount'],
'numOfPages' => $data['numOfPages'],
'currentPage' => $currentPage,
'filter' => $data['paginate']['sort'],
'stats' => $data['stats'],
'pages' => $data['pages'],
'paginate' => $data['paginate'],
'status' => Session::active(),
];
} else {
header('Location: /dashboard');
exit();
}
break;
case 'page':
if (Session::active()) {
$template = 'dash/page-edit.twig';
$mode = $args['third'];
$uuid = $args['fourth'];
switch ($mode) {
case 'edit':
$page = (new Book())->findPageById($uuid);
$views = [];
if (!isset($page['layout'])) {
$page['layout'] = "page";
}
if (str_contains($page['layout'], 'index')) {
$views = (new Themes())->getCustomIndex();
} else {
$views = (new Themes())->getCustomViews();
}
$imageList = [];
$fileList = [];
if (isset($page['feature'])) {
$imageList = explode(',', $page['feature']);
}
if (isset($page['files'])) {
$fileList = explode(',', $page['files']);
}
$images = [];
$files = [];
foreach ($imageList as $item) {
$image = trim($item);
if (!empty($image)) {
array_push($images, $image);
}
}
foreach ($fileList as $item) {
$file = trim($item);
if (!empty($file)) {
array_push($files, $file);
}
}
$pageOptions = [
'title' => $page['title'],
'page' => $page,
'mode' => $mode,
'token' => Session::get('form_token'),
'status' => Session::active(),
'images' => $images,
'files' => $files,
'views' => $views,
];
break;
case 'preview':
$config = new Settings();
$settings = $config->getSettings();
$loader = new \Twig\Loader\FilesystemLoader(
'../content/themes/' . $settings['global']['theme'] .
'/'
);
$display = new \Twig\Environment($loader, []);
$book = new Book();
$page = $book->findPageById($uuid);
$pageOptions = Sorting::page($page);
$preview = $page['layout'] .
'.twig';
$html = $display->render($preview, $pageOptions);
$response->getBody()->write($html);
return $response;
break;
default:
$pageOptions = [
'title' => 'Fipamo | Create Page',
'token' => Session::get('form_token'),
'mode' => $mode,
'status' => Session::active(),
];
break;
}
} else {
header('Location: /dashboard');
exit();
}
break;
case 'logout':
Session::kill();
header('Location: /dashboard');
exit();
break;
case 'reset-password':
$template = 'dash/reset-password.twig';
$pageOptions = [
'title' => 'Reset Password',
];
break;
default:
$template = 'dash/start.twig';
if (Session::active()) {
$pageOptions = [
'title' => 'Start',
'status' => Session::active(),
'data' => (new Book())->getPages(1, 4),
];
} else {
$pageOptions = [
'title' => 'Welcome to Fipamo',
'status' => Session::active(),
];
}
break;
}
} else {
$template = 'dash/init.twig';
$pageOptions = ['title' => 'Fipamo Setup'];
}
return $view->render($response, $template, $pageOptions);
}
}

@ -0,0 +1,110 @@
<?php
namespace brain\controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Views\Twig;
use brain\data\Settings;
use brain\utility\Sorting;
use function _\find;
class IndexControl
{
public static function start(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
): ResponseInterface {
//unset($_SESSION);
$config = new Settings();
$settings = $config->getSettings();
$view = Twig::fromRequest($request);
//checks dynamic render flag for site render status
if ($settings['global']['dynamicRender']) {
if ($settings['global']['dynamicRender'] == 'true') {
$loader = new \Twig\Loader\FilesystemLoader('../content/themes');
$display = new \Twig\Environment($loader, []);
$template = '';
$pageOptions = [];
$pageInfo = [
'keywords' => isset($settings['global']['keywords'])
? $settings['global']['keywords']
: 'fipamo, blog, jamstack, php, markdown, js',
'description' => $settings['global']['descriptions'],
'image' => $settings['global']['base_url'] . $settings['global']['background'],
'baseURL' => $settings['global']['base_url'],
];
if (isset($args['first'])) {
switch ($args['first']) {
case 'tags':
$template = $settings['global']['theme'] . '/tags.twig';
$tag = trim($args['second']);
$taglist = Sorting::tags();
$item = find($taglist, ['tag_name' => $tag]);
$pageOptions = [
'title' => 'Pages Tagged as ' . $item['tag_name'],
'background' => $pageInfo['image'],
'tag_list' => $item['pages'],
'info' => $pageInfo,
'menu' => $settings['menu'],
'dynamicRender' => $settings['global']['dynamicRender'],
];
break;
case 'archives':
$archive = Sorting::archive();
$template = $settings['global']['theme'] . '/archive.twig';
$pageOptions = [
'title' => 'Archive',
'background' => $pageInfo['image'],
'archives' => $archive,
'info' => $pageInfo,
'menu' => $settings['menu'],
'dynamicRender' => $settings['global']['dynamicRender'],
];
break;
default:
//check if page is a menu item, if not render along path as usual
$page = [];
$book = new Book();
if (is_numeric($args['first'])) {
$page = $book->findPageBySlug($args['third']);
} else {
$page = $book->findPageBySlug($args['first']);
}
$template = $settings['global']['theme'] . '/' . $page['layout'] . '.twig';
$pageOptions = Sorting::page($page);
break;
}
} else {
//index
$template = $settings['global']['theme'] . '/' . $page['layout'] . '.twig';
$book = new Book('');
$page = $book->findPageBySlug();
$pageOptions = Sorting::page($page);
}
$html = $display->render($template, $pageOptions);
$response->getBody()->write($html);
return $response;
} else {
//if dynamic flag is false, load up html
$view = Twig::fromRequest($request);
$html = file_get_contents('../public/index.html');
$response->getBody()->write($html);
return $response;
}
} else {
//if flag is not present, default to static html
$view = Twig::fromRequest($request);
$html = file_get_contents('../public/index.html');
$response->getBody()->write($html);
return $response;
}
}
}

@ -0,0 +1,47 @@
<?php
namespace brain\controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
class RouteControl
{
//TODO: Add additional HTTP Methods to better organize API control paths
public function get(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
): ResponseInterface {
switch (isset($args['first']) ? $args['first'] : 'index') {
case 'dashboard':
return DashControl::start($request, $response, $args);
break;
case 'api':
return APIControl::get($request, $response, $args);
break;
default:
return IndexControl::start($request, $response, $args);
break;
}
}
public function post(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
): ResponseInterface {
switch (isset($args['first']) ? $args['first'] : 'index') {
case 'api':
return APIControl::post($request, $response, $args);
break;
default:
$result = [
'message' => "Nothing matches this route. That's unfortunate",
'type' => 'TASK_NONE',
];
$response->getBody()->write(json_encode($result));
return $response->withHeader('Content-Type', 'application/json');
}
}
}

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

@ -0,0 +1,230 @@
<?php
namespace brain\data;
use Carbon\Carbon;
use brain\utility\DocTools;
use brain\utility\StringTools;
use function _\find;
use function _\filter;
class Book
{
public function __construct()
{
}
public function findPageById(string $uuid)
{
$content = $this->getContents();
$page = find($content, ['uuid' => $uuid]);
return $page;
}
public function findPageBySlug(string $slug = null)
{
$content = $this->getContents();
if (isset($slug)) {
$page = find($content, ['slug' => $slug]);
} else {
$page = find($content, ['layout' => 'index']);
}
return $page;
}
public function editPage($task, $request)
{
$content = $this->getContents();
$body = json_decode(file_get_contents("php://input"), true);
//$body = find($content, ["uuid" => $parsed["id"]]);
$page = find($content, ['uuid' => $body['uuid']]);
$files = $request->getUploadedFiles();
$member = Session::get('member');
if ($task != 'create') {
$path = date('Y', date($page['rawCreated'])) .
'/' .
date('m', date($page['rawCreated']));
} else {
$path = date('Y') . '/' . date('m');
}
$page_feature = '';
$page_files = '';
if ($task == 'delete') {
$deleted = 'true';
$body['menu'] = 'false';
$body['published'] = 'false';
$body['featured'] = 'false';
} else {
$deleted = isset($page['deleted']) ? $page['deleted'] : 'false';
}
$created = $task != 'create' ? new Carbon($page['rawCreated']) : Carbon::now();
$updated = Carbon::now();
// grab current index from settings and update
$id = $task != 'create' ? $body['id'] : Settings::getCurrentIndex();
$uuid = $task != 'create' ? $body['uuid'] : StringTools::createUUID();
// now that variables are done, set to body object and then convert to markdown to save
$body['id'] = $id;
$body['uuid'] = $uuid;
//$body['feature'] = $page_feature;
//$body['files'] = $page_files;
$body['path'] = $path;
$body['author'] = $member['handle'];
$body['created'] = $created->format("Y-m-d\TH:i:sP");
$body['updated'] = $updated->format("Y-m-d\TH:i:sP");
$body['deleted'] = $deleted;
$write = DocTools::objectToMD($body);
// if layout is index, change path to file
if ($body['layout'] == 'index') {
$writePath = '../content/pages/start/index.md';
} else {
$writePath = '../content/pages/' . $path . '/' . $body['slug'] . '.md';
}
$status = DocTools::writePages($task, $path, $writePath, $write);
if ($status) {
$config = new Settings();
$settings = $config->getSettings();
$message = '';
if (
$settings['global']['renderOnSave'] == 'true' &&
$settings['global']['dynamicRender'] == 'false'
) {
$render = new Render();
$render->renderTags();
$render->renderArchive();
$render->renderPages();
$message = 'Filed edited and rendered. NOICE.';
} else {
$message = 'File edited. Nice work';
}
$response = [
'message' => $message,
'type' => $task == 'write' ? 'postUpdated' : 'postAdded',
'id' => $uuid,
];
// TODO: When form submission is successful, make new form token
// Session token doesn't reset on the front end, so turning this off for now
// $form_token = md5(uniqid(microtime(), true));
// Session::set("form_token", $form_token);
// once saved, update menu
$body['path'] = $path;
Settings::updateMenu($body);
Settings::updateTags();
// if new page added, update current index in Settings file
if ($task == 'create') {
Settings::updateIndex();
}
} else {
$response = [
'message' => "Uh oh. File save problem. Don't panic",
'type' => 'postError',
'id' => $uuid,
];
}
return $response;
}
public function getPages(int $page, int $limit, string $sort = null)
{
$content = $this->getContents();
$published = filter($content, function ($item) {
return $item['published'] == true && $item['deleted'] == false;
});
$deleted = filter($content, function ($item) {
return $item['deleted'] == true;
});
// $all = $content;
$all = filter($content, function ($item) {
return $item['deleted'] == false;
});
$filter = isset($sort) ? $sort : 'all';
switch ($filter) {
case 'published':
$filtered = $published;
break;
case 'deleted':
$filtered = $deleted;
break;
default:
$filtered = $all;
break;
}
$numOfPages = ceil(count($filtered) / ($limit + 1));
$folder = [];
if (count($filtered) != 0) {
if (count($filtered) < $limit) {
$limit = count($filtered) - 1;
}
$range = $page * $limit - $limit;
if ($range != 0) {
$range = $range + 1;
}
for ($i = 0; $i <= $limit; ++$i) {
if (isset($filtered[$i + $range])) {
array_push($folder, $filtered[$i + $range]);
} else {
// chill out
}
}
}
$prev = $page - 1;
if ($prev <= 0) {
$prev = $numOfPages;
}
$next = $page + 1;
if ($next > $numOfPages) {
$next = 1;
}
return [
'pages' => $folder,
'numOfPages' => $numOfPages,
'entryCount' => count($filtered),
'paginate' => [
'sort' => $sort,
'nextPage' => $next,
'prevPage' => $prev,
],
'stats' => [
'all' => count($all),
'published' => count($published),
'deleted' => count($deleted),
],
];
}
public function getContents()
{
// test new contents data class
// $new = (new Contents("../content/pages"))->getAll();
$contents = (new Contents('../content/pages'))->getAll();
return $contents;
}
}

@ -0,0 +1,193 @@
<?php
namespace brain\data;
use HtmlSanitizer\SanitizerBuilder;
use League\CommonMark\MarkdownConverter;
use League\CommonMark\Environment\Environment;
use HtmlSanitizer\Extension\Basic\BasicExtension;
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\FrontMatter\FrontMatterExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
use League\CommonMark\Extension\FrontMatter\Output\RenderedContentWithFrontMatter;
use function _\orderBy;
class Contents
{
public $files = [];
public $config = [];
public function __construct($folder)
{
$this->read($folder);
}
public function read($folder)
{
$folders = glob("$folder/*", GLOB_ONLYDIR);
foreach ($folders as $folder) {
//$this->files[] = $folder . "/";
$this->read($folder);
}
$files = array_filter(glob("$folder/*md"), 'is_file');
foreach ($files as $file) {
$this->files[] = $file;
}
}
public function getAll()
{
$environment = new Environment($this->config);
$environment->addExtension(new CommonMarkCoreExtension());
// Add the extension
$environment->addExtension(new FrontMatterExtension());
//Add Strikethrough rendering
$environment->addExtension(new StrikethroughExtension());
//add attributes to elements in markdown
$environment->addExtension(new AttributesExtension());
//add table rendering
$environment->addExtension(new TableExtension());
// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
$contents = [];
foreach ($this->files as $file) {
//get meta and html from file
$result = $converter->convertToHtml(file_get_contents($file));
$meta = [];
if ($result instanceof RenderedContentWithFrontMatter) {
$meta = $result->getFrontMatter();
}
//get raw markdown from file
$frontMatterExtension = new FrontMatterExtension();
$parsed = $frontMatterExtension
->getFrontMatterParser()
->parse(file_get_contents($file));
//never trust the front end. clean it up
//add what sanitizer extensions we need manually
$builder = new SanitizerBuilder();
$builder->registerExtension(new BasicExtension());
$builder->registerExtension(new IframeExtension());
$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
$builder->registerExtension(
new \HtmlSanitizer\Extension\Relative\A\AExtension()
);
$builder->registerExtension(
new \HtmlSanitizer\Extension\Relative\Image\ImageExtension()
);
$detergent = [
'extensions' => ['basic', 'list', 'relative-a', 'relative-image', 'iframe', 'table'],
'tags' => [
'div' => [
'allowed_attributes' => ['class', 'title', 'id', 'style'],
],
'img' => [
'allowed_attributes' => ['src', 'alt', 'title', 'class'],
],
'iframe' => [
'allowed_attributes' => ['height', 'width', 'title', 'src'],
],
],
];
$sanitizer = $builder->build($detergent);
$scrubbed = $sanitizer->sanitize($result->getContent());
if (isset($meta['feature'])) {
$featureList = explode(',', $meta['feature']);
} else {
$featureList = "";
}
$docs = '';
if (isset($meta['files'])) {
$fileList = explode(',', $meta['files']);
$docs = $meta['files'];
} else {
$fileList = [];
$docs = '';
}
$media = [];
$files = [];
if ($featureList != '') {
foreach ($featureList as $file) {
$item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION);
if ($item != null || $item != '') {
array_push($media, ['file' => $item, 'type' => trim($ext)]);
}
}
}
if ($fileList != "") {
foreach ($fileList as $file) {
$item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION);
if ($item != null || $item != '') {
array_push($files, ['file' => $item, 'type' => trim($ext)]);
}
}
}
//sort attributes into page object
$page = [
'id' => $meta['id'],
'uuid' => $meta['uuid'],
'title' => $meta['title'],
'feature' => $meta['feature'],
'files' => $docs,
'path' => $meta['path'],
'layout' => $meta['layout'],
'tags' => $meta['tags'],
'author' => $meta['author'],
'created' => date('Y M D d', $meta['created']),
'updated' => date('Y M D d', $meta['updated']),
'rawCreated' => $meta['created'],
'rawUpdated' => $meta['updated'],
'createdYear' => date('Y', $meta['created']),
'createdMonth' => date('m', $meta['created']),
'deleted' => $meta['deleted'],
'menu' => $meta['menu'],
'featured' => $meta['featured'],
'published' => $meta['published'],
'slug' => $meta['slug'],
'filePath' => $file,
'content' => $parsed->getContent(),
'html' => $scrubbed,
'media' => $media,
'docs' => $files
];
//checks for duplicates
$uuid = $meta['uuid'];
$found = current(
array_filter($contents, function ($item) use ($uuid) {
return isset($item['uuid']) && $uuid == $item['uuid'];
})
);
// if uuid is not present, add it
if (!$found) {
array_push($contents, $page);
}
}
$contents = orderBy($contents, ['id'], ['desc']);
return $contents;
}
}

@ -0,0 +1,61 @@
<?php
namespace brain\data;
use Carbon\Carbon;
use brain\utility\DocTools;
use function _\find;
class Member
{
public function __construct()
{
}
public static function verifyKey(string $key)
{
if (isset($key)) {
$folks = (new Settings())->getFolks();
$found = find($folks, ['key' => $key]);
if ($found) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public static function updateData(string $key, string $data, $secret = null)
{
$folks = (new Settings())->getFolks();
if (isset($secret)) {
$found = find($folks, ['secret' => $secret]);
} else {
$member = Session::get('member');
$found = find($folks, ['handle' => $member['handle']]);
}
$found[$key] = $data;
//record time updated
$updated = Carbon::now();
$found['updated'] = $updated->format("Y-m-d\TH:i:sP");
$newFolks = [];
array_push($newFolks, $found);
//save updated file
DocTools::writeSettings('../config/folks.json', $newFolks);
//update member data in session
if (!isset($secret)) {
$member = [
'handle' => $found['handle'],
'email' => $found['email'],
'role' => $found['role'],
'avatar' => $found['avi'],
'key' => $found['key'],
];
Session::set('member', $member);
}
}
}

@ -0,0 +1,204 @@
<?php
namespace brain\data;
use brain\utility\Sorting;
use brain\utility\DocTools;
use function _\find;
class Render
{
public $loader;
public $twig;
public $pageInfo;
public $menu;
public $background;
public function __construct()
{
$config = new Settings();
//TODO: Add theme folder to loader
$settings = $config->getSettings();
$this->menu = $settings['menu'];
$this->theme = $settings['global']['theme'];
$this->loader = new \Twig\Loader\FilesystemLoader('../content/themes/' . $this->theme);
$this->twig = new \Twig\Environment($this->loader, []);
$this->pageInfo = [
'keywords' => isset($settings['global']['keywords'])
? $settings['global']['keywords']
: 'fipamo, blog, jamstack, php, markdown, js',
'description' => $settings['global']['descriptions'],
'image' => $settings['global']['base_url'] . $settings['global']['background'],
'baseURL' => $settings['global']['base_url'],
];
//move global theme image assets to public folder
foreach (
new \DirectoryIterator('../content/themes/' . $this->theme . '/assets/images/global/') as $file
) {
if ($file->isDot()) {
continue;
}
if (!is_file('../public/assets/images/global/' . $file->getFileName())) {
copy(
'../content/themes/' .
$this->theme .
'/assets/images/global/' .
$file->getFileName(),
'../public/assets/images/global/' . $file->getFileName()
);
} else {
//image is already there, so chill
}
//print $file->getFilename() . "\n";
}
//copy current theme assets to public
//clear files in css and scripts folder
$styles = glob('../public/assets/css/*'); // get all file names
foreach ($styles as $file) { // iterate files
if (is_file($file)) {
//don't erase dashboard css
if (!$file == '../public/assets/css/dash.css') {
unlink($file); // delete file
}
}
}
$scripts = glob('../public/assets/scripts/*'); // get all file names
foreach ($scripts as $file) { // iterate files
if (is_file($file)) {
if (!$file == '../public/assets/scripts/Start.js') {
unlink($file); // delete file
}
}
}
//copy theme assets to public
$newcss = glob('../content/themes/' . $this->theme . '/assets/css/*');
foreach ($newcss as $file) { // iterate files
if (is_file($file)) {
$path = explode('/', $file);
copy($file, '../public/assets/css/' . $path[6]);
}
}
$newjs = glob('../content/themes/' . $this->theme . '/assets/scripts/*');
foreach ($newjs as $file) { // iterate files
if (is_file($file)) {
$path = explode('/', $file);
copy($file, '../public/assets/scripts/' . $path[6]);
}
}
}
public function renderPages()
{
$pages = (new Book())->getContents();
$recent = [];
$featured = [];
$limit = 4;
foreach ($pages as $page) {
$pageOptions = Sorting::page($page);
$layout = $page['layout'];
//new pages have no layout, so defautl for now
if ($layout == '' || $layout == null) {
$layout = 'page';
}
$template = $layout . '.twig';
if (str_contains($layout, 'index')) {
$location = '../public/index.html';
$dir = null;
} else {
// if page is a menu item, render the page on public root
if ($page['menu'] == 'true') {
$location = '../public/' . $page['slug'] . '.html';
$dir = '../public/';
} else {
$location = '../public/' . $page['path'] . '/' . $page['slug'] . '.html';
$dir = '../public/' . $page['path'];
}
}
$html = $this->twig->render($template, $pageOptions);
DocTools::writeHTML($location, $html, $dir);
}
}
public function renderArchive()
{
$archive = Sorting::archive();
$template = 'archive.twig';
$pageOptions = [
'title' => 'Archive',
'background' => $this->pageInfo['image'],
'archives' => $archive,
'info' => $this->pageInfo,
'menu' => $this->menu,
'media' => [['file' => $this->pageInfo['image'], 'type' => trim(pathinfo($this->pageInfo['image'], PATHINFO_EXTENSION))]],
];
$html = $this->twig->render($template, $pageOptions);
$location = '../public/archives.html';
DocTools::writeHTML($location, $html);
}
public function renderTags()
{
$list = Sorting::tags();
foreach ($list as $item) {
$template = 'tags.twig';
$pageOptions = [
'title' => 'Pages Tagged as ' . $item['tag_name'],
'background' => $this->pageInfo['image'],
'tag_list' => $item['pages'],
'info' => $this->pageInfo,
'menu' => $this->menu,
'media' => [['file' => $this->pageInfo['image'], 'type' => trim(pathinfo($this->pageInfo['image'], PATHINFO_EXTENSION))]],
];
$html = $this->twig->render($template, $pageOptions);
$location = '../public/tags/' . $item['slug'] . '.html';
//if tags folder doesn't exist, make it
if (!is_dir('../public/tags')) {
mkdir('../public/tags', 0755, true);
} else {
}
if (!is_file($location)) {
file_put_contents($location, $html);
} else {
($new = fopen($location, 'w')) or die('Unable to open file!');
fwrite($new, $html);
fclose($new);
}
}
}
public function renderIndex()
{
//TODO: Need to fix this to account for new index templating system
$pages = (new Book())->getContents();
$index = find($pages, ['layout' => 'index']);
$template = 'index.twig';
$location = '../public/index.html';
$dir = null;
$meta = [
'who' => $index['author'],
'when' => $index['created'],
];
$pageOptions = [
'title' => $index['title'],
'background' => $index['feature'],
'meta' => $meta,
];
$html = $this->twig->render($template, $pageOptions);
DocTools::writeHTML($location, $html, $dir);
}
}

@ -0,0 +1,93 @@
<?php
namespace brain\data;
use ReallySimpleJWT\Token;
class Session
{
private static $file = '../content/.session';
private static $data = [
'member' => '',
'token' => '',
'form_token' => '',
];
public static function start()
{
if (!is_file(self::$file)) {
file_put_contents(self::$file, json_encode(self::$data));
} else {
($new = fopen(self::$file, 'w')) or die('Unable to open file!');
fwrite($new, json_encode(self::$data));
fclose($new);
}
}
public static function active()
{
if (!is_file(self::$file)) {
return false;
} else {
$data = json_decode(file_get_contents(self::$file), true);
if ($data['member'] != null) {
$secret = (new Settings())->getFolks('secret');
if ($secret == null) {
return false;
} else {
if (
Token::validate($data['token'], $secret) &&
Token::validateExpiration($data['token'], $secret)
) {
return true;
} else {
return false;
}
}
} else {
return false;
}
}
}
public static function verifyToken($token)
{
$data = json_decode(file_get_contents(self::$file), true);
if ($data['member'] != null) {
$secret = (new Settings())->getFolks('secret');
if (
Token::validate($token, $secret) &&
Token::validateExpiration($token, $secret)
) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public static function set($key, $value)
{
$data = json_decode(file_get_contents(self::$file), true);
$data[$key] = $value;
($fresh = fopen(self::$file, 'w')) or die('Unable to open file!');
fwrite($fresh, json_encode($data));
fclose($fresh);
}
public static function get($key)
{
$data = json_decode(file_get_contents(self::$file), true);
return $data[$key];
}
public static function kill()
{
($fresh = fopen(self::$file, 'w')) or die('Unable to open file!');
fwrite($fresh, json_encode(self::$data));
fclose($fresh);
}
}

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

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

@ -0,0 +1,33 @@
<?php
namespace brain\init;
use brain\utility\HandleCors;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
class App
{
public function __construct()
{
// when a new class is made, run composer dump-autoload
// set up cors
new HandleCors();
$app = AppFactory::create();
$twig = Twig::create('../brain/views/');
$app->add(TwigMiddleware::create($app, $twig));
// set up routing
$app->get(
'/[{first}[/{second}[/{third}[/{fourth}[/{fifth}]]]]]',
"brain\controller\RouteControl:get"
);
$app->post(
'/[{first}[/{second}[/{third}[/{fourth}]]]]',
"brain\controller\RouteControl:post"
);
// start the app
$app->run();
}
}

@ -1,37 +0,0 @@
module.exports = function(sequelize, DataTypes) {
var FreshPost = sequelize.define(
'FreshPost',
{
post: {
type: DataTypes.JSONB
}
},
{
timestamps: false,
// don't delete database entries but set the newly added attribute deletedAt
// to the current date (when deletion was done). paranoid will only work if
// timestamps are enabled
paranoid: false,
// don't use camelcase for automatically added attributes but underscore style
// so updatedAt will be updated_at
underscored: true,
// disable the modification of table names; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: false,
// define the table's name
tableName: 'FreshPosts',
// Enable optimistic locking. When enabled, sequelize will add a version count attriubte
// to the model and throw an OptimisticLockingError error when stale instances are saved.
// Set to true or a string with the attribute name you want to use to enable.
version: false
}
);
return FreshPost;
};

@ -1,84 +0,0 @@
module.exports = function (sequelize, DataTypes) {
var Post = sequelize.define('Post', {
uuid: {
type: DataTypes.STRING(50),
unique: true,
allowNull: false
},
title: {
type: DataTypes.STRING(500),
allowNull: true
},
slug: {
type: DataTypes.STRING(500),
unique: false,
allowNull: true
},
tags: {
type: DataTypes.STRING(2000),
unique: false,
allowNull: true
},
entry_html: {
type: DataTypes.TEXT,
unique: false,
allowNull: true
},
entry_plaintext: {
type: DataTypes.TEXT,
unique: false,
allowNull: true
},
feature_image: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
page: {
type: DataTypes.BOOLEAN,
unique: false,
allowNull: true
},
featured: {
type: DataTypes.BOOLEAN,
unique: false,
allowNull: true
},
author_id: {
type: DataTypes.INTEGER,
unique: false,
allowNull: true
},
origin_date: {
type: DataTypes.INTEGER,
unique: false,
allowNull: true
}
}, {
timestamps: true,
// don't delete database entries but set the newly added attribute deletedAt
// to the current date (when deletion was done). paranoid will only work if
// timestamps are enabled
paranoid: true,
// don't use camelcase for automatically added attributes but underscore style
// so updatedAt will be updated_at
underscored: true,
// disable the modification of table names; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: false,
// define the table's name
tableName: 'Posts',
// Enable optimistic locking. When enabled, sequelize will add a version count attriubte
// to the model and throw an OptimisticLockingError error when stale instances are saved.
// Set to true or a string with the attribute name you want to use to enable.
version: true
});
return Post;
};

@ -1,55 +0,0 @@
module.exports = function (sequelize, DataTypes) {
var User = sequelize.define('User', {
avatar: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
handle: {
type: DataTypes.STRING,
unique: true,
allowNull: true
},
email: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
role: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
password: {
type: DataTypes.STRING,
unique: true,
allowNull: false
}
}, {
timestamps: true,
// don't delete database entries but set the newly added attribute deletedAt
// to the current date (when deletion was done). paranoid will only work if
// timestamps are enabled
paranoid: true,
// don't use camelcase for automatically added attributes but underscore style
// so updatedAt will be updated_at
underscored: true,
// disable the modification of table names; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: false,
// define the table's name
tableName: 'Users',
// Enable optimistic locking. When enabled, sequelize will add a version count attriubte
// to the model and throw an OptimisticLockingError error when stale instances are saved.
// Set to true or a string with the attribute name you want to use to enable.
version: true
});
return User;
};

@ -1,36 +0,0 @@
'use strict';
const fs = require('fs');
const path = require('path');
const Sequelize = require('sequelize');
const basename = path.basename(__filename);
const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../../config/config.json')[env];
const db = {};
let sequelize;
if (config.use_env_variable) {
sequelize = new Sequelize(process.env[config.use_env_variable], config);
} else {
sequelize = new Sequelize(config.database, config.username, config.password, config);
}
fs.readdirSync(__dirname)
.filter(file => {
return file.indexOf('.') !== 0 && file !== basename && file.slice(-3) === '.js';
})
.forEach(file => {
const model = sequelize['import'](path.join(__dirname, file));
db[model.name] = model;
});
Object.keys(db).forEach(modelName => {
if (db[modelName].associate) {
db[modelName].associate(db);
}
});
db.sequelize = sequelize;
db.Sequelize = Sequelize;
module.exports = db;

@ -1,82 +0,0 @@
const express = require('express');
const router = express.Router();
const Models = require('../../models');
const fs = require('fs-extra');
const _ = require('lodash');
var settings = [];
//--------------------------
// SETTINGS
//--------------------------
router.get('/', function(req, res) {
fs.readJson('config/site-settings.json')
.then(obj => {
settings = [];
settings = obj;
})
.catch(() => {
//console.error(err)
});
if (req.session.user) {
Models.User.findById(req.session.user.id).then(() => {
Models.FreshPost.findAll({
order: [['id', 'DESC']]
})
.then(posts => {
let pages = [];
if (settings.menu.length == 0) {
for (let index = 0; index < posts.length; index++) {
let item = posts[index].post;
if (item.page == true || item.page == 'true')
pages.push({
id: posts[index].id,
uuid: posts[index].post.uuid,
title: posts[index].post.title,
slug: posts[index].post.slug
});
}
} else {
let newpages = [];
pages = settings.menu;
for (let index = 0; index < posts.length; index++) {
let item = posts[index].post;
if (item.page == true || item.page == 'true')
newpages.push({
id: posts[index].id,
uuid: posts[index].post.uuid,
title: posts[index].post.title,
slug: posts[index].post.slug
});
}
for (let i = 0; i < newpages.length; i++) {
if (
_.findIndex(pages, function(o) {
return o.id == newpages[i].id;
}) != -1
) {
//console.log("FOUND")
} else {
pages.push({
id: newpages[i].id,
uuid: newpages[i].uuid,
title: newpages[i].title,
slug: newpages[i].slug
});
}
}
}
res.render('dash/navigation', {
pages: pages,
welcome: 'Edit Navigation',
user_status: true,
title: 'Dashboard | Navigation'
});
})
.catch(() => {
//console.log('ERROR', err);
});
});
} else {
res.redirect('/@/dashboard');
}
});
module.exports = router;

@ -1,170 +0,0 @@
import DateUtils from '../../tools/utilities/DateUtils';
var express = require('express');
var router = express.Router();
var Models = require('../../models');
var hljs = require('highlight.js/lib/highlight');
var hljs_md = require('highlight.js/lib/languages/markdown');
hljs.registerLanguage('markdown', hljs_md);
var Sequelize = require('sequelize');
const Op = Sequelize.Op;
const dateUtils = new DateUtils();
//--------------------------
// POSTS
//--------------------------
router.get('/list/:filter?/:page?', function(req, res) {
var pageNum = req.params.page;
var filter = req.params.filter;
if (pageNum == '' || pageNum == null) pageNum = 1;
if (filter == '' || filter == null) filter = 'all';
if (req.session.user) {
Models.FreshPost.findAll({
order: [['id', 'DESC']]
})
.then(function(posts) {
let all = [];
let deleted = [];
let published = [];
let pages = [];
let featured = [];
for (let index = 0; index < posts.length; index++) {
let item = posts[index].post;
if (typeof item.deleted == 'undefined' || item.deleted == false) {
all.push(posts[index]);
if (item.published == 'true') published.push(posts[index]);
if (item.page == 'true') pages.push(posts[index]);
if (item.featured == 'true') featured.push(posts[index]);
} else {
deleted.push(posts[index]);
}
}
var filtered;
switch (filter) {
case 'published':
filtered = published;
break;
case 'deleted':
filtered = deleted;
break;
default:
filtered = all;
break;
}
var count = Math.round(filtered.length / 6);
var pageItems = [];
var itemLimit = 6;
var rangeStart = pageNum * itemLimit - itemLimit;
for (var i = 0; i < itemLimit; i++) {
try {
if (filtered[i + rangeStart].id != null) {
pageItems.push(filtered[i + rangeStart]);
}
} catch (e) {
//console.log("NO POST", e)
}
}
res.render('dash/posts-index', {
title: 'Dashbord | Posts',
mode: 'admin',
welcome: 'Your Posts',
items: pageItems,
page_info: {
all: all.length,
deleted: deleted.length,
published: published.length,
pages: pages.length,
featured: featured.length
},
page_index: pageNum,
page_count: count,
postFilter: filter,
user_status: true
});
})
.then(() => {
//console.log(value);
})
.catch(() => {
//next(err);
});
} else {
res.redirect('/@/dashboard');
}
});
//--------------------------
// BLOG POST ADD DISPLAY
//--------------------------
router.get('/add/new', function(req, res) {
if (req.session.user) {
res.render('dash/post-edit', {
title: 'Dashboard New Post',
user_status: true,
welcome: 'New Post',
mode: 'admin',
date:
dateUtils.getDate('year', new Date()) +
'-' +
dateUtils.getDate('month', new Date()) +
'-' +
dateUtils.getDate('day', new Date()),
status: ['false', 'false', 'false'],
edit: false
});
} else {
res.redirect('/@/dashboard');
}
});
//--------------------------
// BLOG POST EDIT DISPLAY
//--------------------------
router.get('/edit/:id', function(req, res) {
if (req.session.user) {
Models.FreshPost.findOne({
where: {
post: {
[Op.contains]: {
uuid: req.params.id
}
}
}
})
.then(item => {
let featured = 'null';
if (item.post.feature != null || item.post.feature != '')
featured = item.post.feature.substr(8, item.post.feature.length);
let pretty = hljs.highlight('markdown', item.post.plaintext).value;
let sexydate =
dateUtils.getDate('year', item.post.created) +
'-' +
dateUtils.getDate('month', item.post.created) +
'-' +
dateUtils.getDate('day', item.post.created);
res.render('dash/post-edit', {
id: item.id,
title: 'Edit Post',
user_status: true,
welcome: 'Edit Post',
mode: 'admin',
post: item.post,
date: sexydate,
colored: pretty,
html: item.post.plaintext,
feature: featured,
status: [
String(item.post.page),
String(item.post.featured),
String(item.post.published)
],
edit: true
});
})
.then(() => {
//console.log("VALUE: " + value);
})
.catch(() => {
//console.log(err);
});
} else {
res.redirect('/@/dashboard');
}
});
module.exports = router;

@ -1,70 +0,0 @@
const express = require('express');
const router = express.Router();
const FileHound = require('filehound');
const Models = require('../../models');
const fs = require('fs-extra');
var settings = [];
//--------------------------
// SETTINGS
//--------------------------
router.get('/', function(req, res) {
fs.readJson('config/site-settings.json')
.then(obj => {
settings = obj;
})
.catch(() => {
//console.error(err)
});
let themes = [];
FileHound.create()
.paths('themes')
.ext('json')
.find()
.then(files => {
files.forEach(file => {
fs.readJson(file)
.then(theme => {
if (theme.name == settings.theme) {
themes.push({
theme: theme,
current: 'true'
});
} else {
themes.push({
theme: theme,
current: 'false'
});
}
})
.catch(() => {
//console.error(err)
});
});
if (req.session.user) {
let memberInfo = [];
Models.User.findById(req.session.user.id).then(user => {
memberInfo.push({
handle: user.handle,
email: user.email,
avi: user.avatar
});
themes.sort(function(a, b) {
var textA = a.theme.name.toUpperCase();
var textB = b.theme.name.toUpperCase();
return textA < textB ? -1 : textA > textB ? 1 : 0;
});
res.render('dash/settings', {
title: 'Dashboard | Settings',
welcome: 'Your Settings',
user_status: true,
themes: themes,
settings: settings,
member: memberInfo[0]
});
});
} else {
res.redirect('/@/dashboard');
}
});
});
module.exports = router;

@ -1,52 +0,0 @@
const express = require('express');
const router = express.Router();
const Models = require('../../models');
//--------------------------
// Index
//--------------------------
router.get('/', function(req, res) {
var loggedIn = false;
if (req.session.user) loggedIn = true;
Models.FreshPost.findAll({
order: [['id', 'DESC']]
})
.then(function(posts) {
let title = 'Fipamo Dashboard';
let welcome = '';
!loggedIn
? (welcome = 'Hello.')
: (welcome = 'Welcome back, ' + req.session.user.handle);
let filtered = [];
for (let index = 0; index < posts.length; index++) {
let item = posts[index].post;
if (typeof item.deleted == 'undefined' || item.deleted == false) {
filtered.push(posts[index]);
} else {
continue;
}
}
res.render('dash/index', {
title: title,
welcome: welcome,
user_status: loggedIn,
items: filtered
});
})
.then(() => {
//console.log(value);
})
.catch(() => {
//next(err);
});
});
//--------------------------
// Logout
//--------------------------
router.post('/logout', function(req, res) {
req.logout();
return res.json({
message: 'LOGGED OUT'
});
});
module.exports = router;

@ -1,46 +0,0 @@
var express = require('express');
var router = express.Router();
var Models = require('../../models');
var config = require('../../../config.json');
router.get('/:page_num?', function (req, res) {
var page_num = req.params.page_num;
var pageNum = page_num;
if (page_num == null)
pageNum = 1
Models.Bookmark.findAll({
order: [['id', 'DESC']]
}).then(function (bookmarks) {
//console.log("num: "+pageNum);
//real page count
var count = Math.floor(bookmarks.length / 10);
var pageItems = [];
var itemLimit = 10;
var rangeStart = (pageNum * itemLimit) - itemLimit;
//console.log("RANGE START "+rangeStart);
for (var i = 0; i < itemLimit; i++) {
try {
if (bookmarks[i + rangeStart].id != null) {
//console.log(bookmarks[i+rangeStart]._id )
pageItems.push(bookmarks[i + rangeStart]);
}
} catch (e) {
//console.log(e)
}
}
//console.log("items count: "+pageItems.length)
res.render(config.theme+'/fipamo', {
theme: config.theme,
title: 'The Twelfth House | Fipamo',
page_index: pageNum,
page_count: Math.round(bookmarks.length / 10),
items: pageItems,
mode: 'bookmarks'
});
}).then(function (value) {
//console.log(value);
}).catch(function (err) {
console.log(err);
})
});
router.get('/:id', function (req, res) {});
module.exports = router;

@ -1,17 +0,0 @@
var express = require('express');
var router = express.Router();
//var Models = require('../../models');
var config = require('../../../config/site-settings.json');
module.exports = function() {
//--------------------------
// Index
//--------------------------
router.get('/:page?', function(req, res) {
res.render(config.theme + '/index', {
theme: config.theme,
title: config.title,
user_status: 'What up, random person'
});
});
return router;
};

@ -1,68 +0,0 @@
var express = require('express');
var router = express.Router();
var Models = require('../../models');
var config = require('../../../config.json');
router.get('/', function(req, res) {
res.redirect('/blog/page/1');
});
router.get('/page/:page_num?', function (req, res) {
var page_num = req.params.page_num;
var pageNum = page_num;
if (page_num == null)
pageNum = 1
Models.Post.findAll({
order: [['id', 'DESC']]
}).then(function (post) {
//console.log("num: "+pageNum);
//real page count
var count = Math.floor(post.length / 6);
var pageItems = [];
var itemLimit = 6;
var rangeStart = (pageNum * itemLimit) - itemLimit;
//console.log("RANGE START "+rangeStart);
for (var i = 0; i < itemLimit; i++) {
try {
if (post[i + rangeStart].id != null) {
pageItems.push(post[i + rangeStart]);
}
} catch (e) {
//console.log(e)
}
}
//console.log("items count: "+pageItems.length)
res.render(config.theme+'/blog', {
theme: config.theme,
title: 'The Twelfth House | Thoughts and Such',
page_index: pageNum,
page_count: Math.round(post.length / 6),
items: pageItems,
mode: 'blog'
});
}).then(function (value) {
//console.log(value);
}).catch(function (err) {
console.log(err);
})
});
router.get('/:id', function(req, res) {
Models.Post.findOne({where:{slug: req.params.id}}).then((post) => {
console.log(post.feature_image)
res.render(config.theme+'/blog-post', {
theme: config.theme,
title: post.title,
entry: post.entry_html,
feature_image: JSON.parse(post.feature_image),
mode:'blog'
});
}).catch((err) => {
console.log(err);
});
});
module.exports = router;

@ -1,37 +0,0 @@
var express = require('express');
var router = express.Router();
var Models = require('../../models');
var config = require('../../../config.json');
router.get('/', function(req, res) {
Models.FolioProject.findAll({order:[['sortIndex', 'DESC']]}).then(projects=> {
res.render(config.theme+'/work', {
theme: config.theme,
title: 'The Twelfth House | Creative Works and Projects',
projects: projects,
mode: 'projects'
});
}).then(function(value) {
//console.log(value);
}).catch(function(err) {
//next(err);
})
});
router.get('/:id', function(req, res) {
Models.FolioProject.findOne({where:{slug: req.params.id}}).then((project) => {
res.render(config.theme+'/work-project', {
title: project.title,
type: project.type,
desc: project.description,
images: JSON.parse(project.images),
mode:'folio',
url:project.url
});
}).catch((err) => {
console.log(err);
});
});
module.exports = router;

@ -1,37 +0,0 @@
export const REQUEST_GOOD = 'requestGood';
export const REQUEST_LAME = 'requestLame';
export const IMG_REQUEST_GOOD = 'imgRequestGood';
export const IMG_REQUEST_LAME = 'imgRequestLame';
export const SETTINGS_LOADED = 'dataLoaded';
export const HTML_LOADED = 'htmlLoaded';
export const ARCHIVES_JSON_LOADED = 'archivesJSONLoaded';
export const ARCHIVES_PAGE_LOADED = 'archivesPAGELoaded';
export const ARCHIVES_ENTRY_LOADED = 'archivesEntryLoaded';
export const PROJECT_UPDATED = 'projectUpdated';
export const PROJECT_ADDED = 'projectAdded';
export const PROJECTS_SORTED = 'projectsSorted';
export const POST_IMAGE_ADDED = 'postImageAdded';
export const FEATURE_IMAGE_ADDED = 'featureImageAdded';
export const POST_ERROR = 'postError';
export const POST_ADDED = 'postAdded';
export const POST_UPDATED = 'postUpdated';
export const POST_DELETED = 'postImageAdded';
export const POSTS_SYNCED = 'postsSynced';
export const LOCAL_DB_READY = 'localDBReady';
export const SETTINGS_UPDATED = 'settingsUpdated';
export const AVATAR_UPLOADED = 'avatarUploaded';
export const SITE_BACKGROUND_UPLOADED = 'siteBackgroundUploaded';
class DataEvent
{
//--------------------------
// methods
//--------------------------
//--------------------------
// event handlers
//--------------------------
}
export default new DataEvent

@ -1,156 +0,0 @@
import * as DataEvent from '../events/DataEvent';
import DateUtils from '../utilities/DateUtils';
import { position } from 'caret-pos';
import EventEmitter from '../events/EventEmitter';
import * as EditorEvent from '../events/EditorEvent';
class TextEditor extends EventEmitter {
/**
* Text Editor UI Component
* @constructor
* @param {object} textEditor - Text area that will edit text
* @param {number} scrollLimit - YPos where editor position will become fixed
*/
//--------------------------
// constructor
//--------------------------
constructor(textEditor, scrollLimit) {
super();
hljs.initHighlightingOnLoad();
this.dateUtils = new DateUtils();
this.textEditor = textEditor;
this.fixLimit = scrollLimit;
this.caretPos = null;
this.url = '';
this.setInputs();
window.addEventListener('scroll', () => {
var fixLimit = this.fixLimit;
if (window.pageYOffset >= fixLimit) {
document.getElementById('edit-control').style.position = 'fixed';
} else {
document.getElementById('edit-control').style.position = 'relative';
}
});
this.refresh();
}
//--------------------------
// methods
//--------------------------
setInputs() {
let self = this;
var editorButtons = document.querySelectorAll('.editor-button');
for (var i = 0, length = editorButtons.length; i < length; i++) {
editorButtons[i].addEventListener('click', e => this.handleEditorOption(e), false);
}
this.textEditor.addEventListener('input', e => {
let htmlTagRe = /<[a-z][\s\S]*>/g;
let text = this.textEditor.innerText;
if (e.inputType == 'insertParagraph') return; //cursor setting gets weird on return, so just back out
if (text.search(htmlTagRe) > -1) {
let caret = position(this.textEditor).pos;
self.refresh();
position(this.textEditor, caret);
}
});
}
refresh() {
var spiffed = hljs.highlight('markdown', this.textEditor.innerText).value;
spiffed = spiffed.replace(new RegExp('\r?\n', 'g'), '<br>');
var temp = document.createElement('div');
temp.innerText = spiffed;
this.textEditor.innerHTML = temp.innerText;
this.textEditor.style.maxWidth = '900px';
}
notify(type, data) {
switch (type) {
case DataEvent.POST_UPDATED:
document.getElementById('submit-update').classList.add('icon-hide');
document.getElementById('submit-good').classList.remove('icon-hide');
document.getElementById('edit-update').classList.remove('submit-start');
document.getElementById('edit-update').classList.add('submit-cool');
setTimeout(() => {
document.getElementById('submit-update').classList.remove('icon-hide');
document.getElementById('submit-good').classList.add('icon-hide');
document.getElementById('edit-update').classList.add('submit-start');
document.getElementById('edit-update').classList.remove('submit-cool');
}, 2000);
break;
case DataEvent.POST_ADDED:
// do nothing
break;
case EditorEvent.EDITOR_UPLOAD_POST_IMAGE:
position(this.textEditor, this.caretPos);
var sel, range;
//var pulled;
sel = window.getSelection(); //console.log(sel)
//console.log(note.message)
if (sel.rangeCount) {
range = sel.getRangeAt(0);
//pulled = sel.getRangeAt(0).toString();
range.deleteContents();
range.insertNode(
document.createTextNode('![image alt text](' + data + " 'image title')")
);
}
this.refresh();
break;
}
}
//--------------------------
// event handlers
//--------------------------
handleEditorOption(e) {
e.preventDefault();
var sel, range, pulled;
sel = window.getSelection(); //console.log(sel)
if (sel.rangeCount) {
range = sel.getRangeAt(0);
pulled = sel.getRangeAt(0).toString();
range.deleteContents();
switch (e.target.id) {
case 'edit-bold':
range.insertNode(document.createTextNode('**' + pulled + '**'));
break;
case 'edit-italic':
range.insertNode(document.createTextNode('*' + pulled + '*'));
break;
case 'edit-strikethrough':
range.insertNode(document.createTextNode('<del>' + pulled + '</del>'));
break;
case 'edit-header1':
range.insertNode(document.createTextNode('# ' + pulled));
break;
case 'edit-header2':
range.insertNode(document.createTextNode('## ' + pulled));
break;
case 'edit-header3':
range.insertNode(document.createTextNode('### ' + pulled));
break;
case 'edit-image':
this.caretPos = position(this.textEditor).pos;
this.emitEvent(EditorEvent.EDITOR_UPLOAD_POST_IMAGE);
break;
case 'submit-save':
case 'edit-save':
this.emitEvent(EditorEvent.EDITOR_SAVE);
break;
case 'submit-update':
case 'edit-update':
this.emitEvent(EditorEvent.EDITOR_UPDATE);
break;
case 'edit-link':
range.insertNode(document.createTextNode('[' + pulled + '](PASTE URL HERE)'));
break;
case 'edit-delete':
this.emitEvent(EditorEvent.EDITOR_DELETE);
break;
default:
//range.insertNode(document.createTextNode("[" + self.url + "](PASTE URL HERE)"));
break;
}
}
this.refresh();
}
}
export default TextEditor;

@ -1,178 +0,0 @@
'use strict';
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../utilities/DataUtils';
import Dexie from 'dexie';
import * as DataEvent from '../events/DataEvent';
export var COUNT;
export var FINAL_KEY;
export default class DBUtils {
//--------------------------
// constructor
//--------------------------
constructor() {
/**
* NOTE: DB ERRORS REPLICATE.
* WHEN FIXING A BUG, FIX DATA WITH JSON BACKUP
*/
this.dataUtils = new DataUtils();
this.db = new Dexie('fipamo_posts');
this.db.version(1).stores({
postList: 'id,post'
});
this.db.postList.toArray(array => {
COUNT = array.length;
FINAL_KEY = 0;
if (COUNT != 0) FINAL_KEY = array[COUNT - 1].id;
});
}
//--------------------------
// methods
//--------------------------
modify(id, postData) {
let self = this;
let freshID;
return new Promise(function(resolve, reject) {
if (id == null) {
self.db.postList
.put(postData)
.then(fresh => {
freshID = fresh;
})
.catch(e => {
let err = {
message: 'PUT ERROR',
error: e
};
return err;
});
} else {
//console.log("UPDATED", postData);
self.db.postList
.update(Number(id), {
post: postData
})
.then(() => {})
.catch(e => {
let err = {
message: 'UPDATE ERROR',
error: e
};
return err;
});
}
self.db.postList.toArray(array => {
self.syncRemote(array, freshID)
.then(response => {
resolve({
response
});
})
.catch(err => {
reject({
err
});
});
});
});
}
syncLocal(array) {
let self = this;
return new Promise(function(resolve, reject) {
self.db.postList.clear().then(() => {
self.db.postList
.bulkAdd(array)
.then(() => {
self.db.postList.toArray(() => {
let event = DataEvent.LOCAL_DB_READY;
resolve({
event
});
});
})
.catch(Dexie.BulkError, e => {
reject({
e
});
});
});
});
}
syncRemote(db, newPostId) {
let self = this;
return new Promise(function(resolve, reject) {
self.dataUtils
.request(
'/api/post/sync',
DataEvent.POSTS_SYNCED,
REQUEST_TYPE_POST,
CONTENT_TYPE_JSON,
db
)
.then(response => {
let bounce = {
message: response,
newPost: newPostId
};
resolve(bounce);
})
.catch(err => {
reject(err);
});
});
}
getPost(id) {
let self = this;
if (id == null) {
return new Promise(function(resolve, reject) {
self.db.postList
.toArray(array => {
resolve(array);
})
.catch(err => {
reject(err);
});
});
} else {
return new Promise(function(resolve, reject) {
self.db.postList
.get(Number(id))
.then(obj => {
resolve(obj);
})
.catch(err => {
reject(err);
});
});
}
}
archivePost(id, archive) {
let self = this;
return new Promise(function(resolve, reject) {
self.db.postList
.update(Number(id), {
post: archive
})
.then(() => {
self.db.postList.toArray(array => {
self.syncRemote(array, null)
.then(response => {
resolve({
response
});
})
.catch(err => {
reject({
err
});
});
});
})
.catch(() => {
//console.log('ERROR', e);
});
});
}
//--------------------------
// event handlers
//--------------------------
}

@ -1,27 +0,0 @@
class DOMUtils {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
getWindowXY() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight || e.clientHeight || g.clientHeight;
var dimensions = {
windowHeight: y,
windowWidth: x
};
return dimensions;
}
//--------------------------
// event handlers
//--------------------------
}
export default DOMUtils;

@ -1,102 +0,0 @@
class DateUtils {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
getMKtime() {
var time =
new Date(
new Date().getFullYear(),
new Date().getMonth(),
new Date().getDate(),
new Date().getHours(),
new Date().getMinutes(),
new Date().getSeconds(),
0
).getTime() / 1000;
return time;
}
convertMKtime(seconds) {
var date = new Date(seconds * 1000);
return date;
}
getDate(type, rawdate) {
var day =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCDate())
: String(new Date().getUTCDate());
var month =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCMonth() + 1)
: String(new Date().getUTCMonth() + 1);
var year =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCFullYear())
: String(new Date().getUTCFullYear());
var hour =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCHours())
: String(new Date().getUTCHours());
var minute =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCMinutes())
: String(new Date().getUTCMinutes());
var seconds =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCSeconds())
: String(new Date().getUTCSeconds());
var millisecond =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getUTCMilliseconds())
: String(new Date().getUTCMilliseconds());
var offset =
rawdate != null || rawdate != ''
? String(new Date(rawdate).getTimezoneOffset())
: String(new Date().getTimezoneOffset());
if (day.length == 1) day = String('0' + day);
if (month.length == 1) month = String('0' + month);
offset = String(offset / 60);
if (offset.length == 1) offset = String('0' + offset);
switch (type) {
case 'day':
return day;
case 'month':
return month;
case 'year':
return year;
case 'stamp':
return String(
year +
'-' +
month +
'-' +
day +
' ' +
hour +
':' +
minute +
':' +
seconds +
'.' +
millisecond +
'-' +
offset
);
default:
return String(year + '-' + month + '-' + day);
}
}
//--------------------------
// event handlers
//--------------------------
}
export default DateUtils;

@ -1,137 +0,0 @@
export const roles = {
hnic: {
client_admin: {
create: true,
read: true,
update: true,
delete: true
},
client_user: {
create: true,
read: true,
update: true,
delete: true
},
client_project: {
create: true,
read: true,
update: true,
delete: true
},
folio_project: {
create: true,
read: true,
update: true,
delete: true
},
bookmark: {
create: true,
read: true,
update: true,
delete: true
},
post: {
create: true,
read: true,
update: true,
delete: true
},
settings: {
create: true,
read: true,
update: true,
delete: true
}
},
client: {
client_admin: {
create: false,
read: true,
update: false,
delete: false
},
client_user: {
create: true,
read: true,
update: true,
delete: true
},
client_project: {
create: true,
read: true,
update: true,
delete: false
},
folio_project: {
create: false,
read: false,
update: false,
delete: false
}
},
user: {
client_admin: {
create: false,
read: false,
update: false,
delete: false
},
client_user: {
create: false,
read: true,
update: false,
delete: false
},
client_project: {
create: false,
read: true,
update: true,
delete: false
},
folio_project: {
create: false,
read: false,
update: false,
delete: false
},
bookmark: {
create: true,
read: true,
update: true,
delete: true
},
post: {
create: false,
read: false,
update: false,
delete: false
}
}
};
export const TASK_CREATE = 'create';
export const TASK_UPDATE = 'update';
export const TASK_READ = 'read';
export const TASK_DELETE = 'delete';
export const OBJECT_CLIENT_ADMIN = 'client_admin';
export const OBJECT_CLIENT_USER = 'client_user';
export const OBJECT_PROJECT_CLIENT = 'client_project';
export const OBJECT_PROJECT_FOLIO = 'folio_project';
export const OBJECT_BOOKMARK = 'bookmark';
export const OBJECT_POST = 'post';
export const OBJECT_SETTINGS = 'settings';
export default class RightsManager {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
check(role, object, task) {
//console.log(role + " *** " + object + " *** " + task);
return roles[role][object][task];
}
//--------------------------
// event handlers
//--------------------------
}

@ -0,0 +1,144 @@
<?php
namespace brain\utility;
class DocTools
{
public function __construct()
{
}
public static function writePages($task, $path, $fileLocation, $fileContents)
{
try {
if ($task == 'create') {
if (!is_dir('../content/pages/' . $path)) {
//Directory does not exist, so lets create it.
mkdir('../content/pages/' . $path, 0755, true);
}
file_put_contents($fileLocation, $fileContents);
} else {
($new = fopen($fileLocation, 'w')) or die('Unable to open file!');
fwrite($new, $fileContents);
fclose($new);
}
return true;
} catch (Error $error) {
return false;
}
}
public static function writeSettings($fileLocation, $fileContents)
{
if (!is_file($fileLocation)) {
file_put_contents($fileLocation, json_encode($fileContents));
} else {
($new = fopen($fileLocation, 'w')) or die('Unable to open file!');
fwrite($new, json_encode($fileContents));
fclose($new);
}
}
public static function writeHTML($location, $html, $path = null)
{
if ($path != null) {
if (!is_dir($path)) {
//Directory does not exist, so lets create it.
mkdir($path, 0755, true);
}
}
if (!is_file($location)) {
file_put_contents($location, $html);
} else {
($new = fopen($location, 'w')) or die('Unable to open file!');
fwrite($new, $html);
fclose($new);
}
}
public static function deleteFolder($path)
{
if (!empty($path) && is_dir($path)) {
$dir = new \RecursiveDirectoryIterator(
$path,
\RecursiveDirectoryIterator::SKIP_DOTS
); //upper dirs are not included,otherwise DISASTER HAPPENS :)
$files = new \RecursiveIteratorIterator(
$dir,
\RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($files as $f) {
if (is_file($f)) {
unlink($f);
} else {
$empty_dirs[] = $f;
}
}
if (!empty($empty_dirs)) {
foreach ($empty_dirs as $eachDir) {
rmdir($eachDir);
}
}
rmdir($path);
}
}
public static function objectToMD($object)
{
$markdown = "---\n" .
'id: ' .
$object['id'] .
"\n" .
'uuid: ' .
$object['uuid'] .
"\n" .
'title: ' .
"'" .
$object['title'] .
"'" .
"\n" .
'feature: ' .
$object['imageList'] .
"\n" .
'files: ' .
$object['fileList'] .
"\n" .
'path: ' .
$object['path'] .
"\n" .
'layout: ' .
$object['layout'] .
"\n" .
'tags: ' .
$object['tags'] .
"\n" .
'author: ' .
$object['author'] .
"\n" .
'created: ' .
$object['created'] .
"\n" .
'updated: ' .
$object['updated'] .
"\n" .
'deleted: ' .
$object['deleted'] .
"\n" .
'slug: ' .
$object['slug'] .
"\n" .
'menu: ' .
$object['menu'] .
"\n" .
'published: ' .
$object['published'] .
"\n" .
'featured: ' .
$object['featured'] .
"\n---\n" .
$object['content'];
return $markdown;
}
}

@ -0,0 +1,32 @@
<?php
namespace brain\utility;
class FileUploader
{
public static function uploadFile(string $directory, $file)
{
$response = [];
try {
if (!is_dir($directory)) {
// Directory does not exist, so lets create it.
mkdir($directory, 0755, true);
}
// $upload = move_uploaded_file($file->getClientFileName(), $directory);
// $extension = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
// see http://php.net/manual/en/function.random-bytes.php
// $basename = bin2hex(random_bytes(8));
// $filename = sprintf("%s.%0.8s", $basename, $extension);
// echo "**FILE** " . $file->getClientFileName();
$file->moveTo($directory . '/' . urlencode($file->getClientFileName()));
} catch (RuntimeException $e) {
echo 'ERROR ' . $e->getMessage();
// echo "failed to upload image: " . $e->getMessage();
// throw new Error("Failed to upload image file");
}
}
}

@ -0,0 +1,61 @@
<?php
namespace brain\utility;
use brain\data\Settings;
class HandleCors
{
public function __construct()
{
//look to see if settings file exists. kinda important
if (file_exists('../config/settings.json')) {
//check settings to see if external api access is allowed
$config = new Settings();
$settings = $config->getSettings();
if ($settings['global']['externalAPI']) {
//echo "API STATUS: " . $settings["global"]["externalAPI"];
if ($settings['global']['externalAPI'] == 'true') {
//echo "API ACCESS ACTIVE";
// checks to see if origin is set
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
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
} else {
//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
//header("Access-Control-Allow-Origin: *");
}
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 600'); // cache for 10 minutes
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
header(
'Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT'
);
} //Make sure you remove those you do not want to support
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
header(
"Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"
);
}
//Just exit with 200 OK with the above headers for OPTIONS method
exit(0);
}
} else {
//echo "API ACCESS ACTIVE";
}
} else {
//value doesn't exist, so whatevs
//echo "API ACCESS VALUE NOT PRESENT";
}
} else {
//init state, so chill
}
}
}

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

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

@ -0,0 +1,230 @@
<?php
namespace brain\utility;
use Carbon\Carbon;
use function _\find;
class SetUp
{
public static function status()
{
if (file_exists('../config/settings.json')) {
return true;
} else {
return false;
}
}
public static function init($body)
{
//grab template files
$newFolks = json_decode(
file_get_contents('../config/init/folks-template.json'),
true
);
$newSettings = json_decode(
file_get_contents('../config/init/settings-template.json'),
true
);
//get form values
//$body = $request->getParsedBody();
$handle = $body['new_member_handle'];
$email = $body['new_member_email'];
$pass = $body['new_member_pass'];
$title = $body['new_member_title'];
$now = Carbon::now();
//setup folks config
$hash = password_hash($pass, PASSWORD_DEFAULT);
$newFolks[0]['id'] = 0;
$newFolks[0]['handle'] = $handle;
$newFolks[0]['email'] = $email;
$newFolks[0]['password'] = $hash;
$newFolks[0]['key'] = password_hash($email, PASSWORD_DEFAULT);
$newFolks[0]['secret'] = StringTools::randomString(12);
$newFolks[0]['role'] = 'hnic';
$newFolks[0]['created'] = $now->format("Y-m-d\TH:i:sP");
$newFolks[0]['updated'] = $now->format("Y-m-d\TH:i:sP");
//set up settings config
$newSettings['global']['title'] = $title;
//create index file
//$rightNow = $now->format("Y-m-d\TH:i:sP");
//var_dump($now->format("Y-m-d\TH:i:sP"));
$index = [
'id' => 1,
'uuid' => StringTools::createUUID(),
'title' => 'FIRST!',
'imageList' => '/assets/images/global/default-bg.jpg',
'fileList' => '',
'path' => 'content/pages/start',
'layout' => 'index',
'tags' => 'start, welcome',
'author' => $handle,
'created' => $now->format("Y-m-d\TH:i:sP"),
'updated' => $now->format("Y-m-d\TH:i:sP"),
'deleted' => 'false',
'slug' => 'first',
'menu' => 'false',
'featured' => 'false',
'published' => 'true',
'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.",
];
$freshIndex = DocTools::objectToMD($index);
//once all files created, write down
DocTools::writeSettings('../config/settings.json', $newSettings);
DocTools::writeSettings('../config/folks.json', $newFolks);
DocTools::writeSettings('../config/tags.json', []);
DocTools::writePages(
'create',
'start',
'../content/pages/start/index.md',
$freshIndex
);
//if there is an older session file, get rid of it
if (is_file('../content/.session')) {
unlink('../content/.session');
}
$result = ['type' => 'blogInitGood', 'message' => 'Site Created'];
return $result;
}
public static function restore($request)
{
$result = [
'type' => 'requestLame',
'message' => 'Still working on it.',
];
$body = $request->getParsedBody();
$backup = $request->getUploadedFiles();
$file = $backup['backup-upload'];
//NOTE: If this fails check 'post_max_size' in php.ini
$size = $file->getSize();
$name = $file->getClientFileName();
//park it so it can be read
$file->moveTo('../content' . '/' . $name);
//open it and get files to verify user
$zip = new \ZipArchive();
if ($zip->open('../content' . '/' . $name) === true) {
$folks = json_decode($zip->getFromName('settings/folks.json'), true);
$found = find($folks, ['handle' => $body['restore_member_handle']]);
//if member is found in back up, check pass
if ($found) {
if (password_verify($body['restore_member_pass'], $found['password'])) {
//backup verified, restore site
//set new secret key for older folks configs
$newFolks = [];
if (!isset($found['secret'])) {
$found['secret'] = StringTools::randomString(12);
}
array_push($newFolks, $found);
//dump files in folder
$zip->extractTo('../content');
//move to appropriate spots
/*
rename(
"../content/settings/settings.json",
"../config/settings.json"
);
*/
//load up old config file
$newConfig = json_decode(
file_get_contents('../content/settings/settings.json'),
true
);
//check for key, add if not there
if (!isset($newConfig['global']['externalAPI'])) {
$newConfig['global']['externalAPI'] = 'false';
}
//write new config file
DocTools::writeSettings('../config/settings.json', $newConfig);
//rename("../content/settings/folks.json", "../config/folks.json");
DocTools::writeSettings('../config/folks.json', $newFolks);
rename('../content/settings/tags.json', '../config/tags.json');
//images path for blog and user
$blogImagePath = '../public/assets/images/blog';
$userImagePath = '../public/assets/images/user';
//check to see if image dirs are empty, if not chill
if ($globs = glob($blogImagePath . '/*')) {
//directory not empty, relax
} else {
rename('../content/public/assets/images/blog', $blogImagePath);
}
if ($globs = glob($userImagePath . '/*')) {
//directory not empty, relax
} else {
rename('../content/public/assets/images/user', $userImagePath);
}
rename('../content/content/pages/', '../content/pages');
//legacy check for old file structure
if (is_file('../content/pages/index.md')) {
if (!is_dir('../content/pages/start')) {
//Directory does not exist, so lets create it.
mkdir('../content/pages/start', 0755, true);
//move start page to appropriate spot
rename(
'../content/pages/index.md',
'../content/pages/start/index.md'
);
}
} else {
//chill
}
//clean up
DocTools::deleteFolder('../content/settings');
DocTools::deleteFolder('../content/public');
DocTools::deleteFolder('../content/content');
$result = [
'type' => 'requestGood',
'message' => 'Site Restored! Redirecting',
];
} else {
$result = [
'type' => 'requestLame',
'message' => 'Check that password, champ.',
];
}
} else {
$result = [
'type' => 'requestLame',
'message' => 'No member found by that name, hoss',
];
}
$zip->close();
$zipPath = '../content/' . $name;
//trash zip when done
unlink($zipPath);
} else {
$result = [
'type' => 'requestLame',
'message' => 'Could not open backup. RATS!',
];
}
return $result;
}
}

@ -0,0 +1,269 @@
<?php
namespace brain\utility;
use brain\data\Book;
use brain\data\Settings;
use Mni\FrontYAML\Parser;
use function _\filter;
use function _\find;
class Sorting
{
private static $p_tags = [];
private static $p_archive = [];
public function __construct()
{
}
public static function tags()
{
$pages = (new Book('../content/pages'))->getContents();
foreach ($pages as $page) {
$temp = [];
if (isset($page['tags'])) {
$temp = explode(',', $page['tags']);
foreach ($temp as $tag) {
$label = trim($tag);
if (!find(self::$p_tags, ['tag_name' => $label])) {
array_push(self::$p_tags, [
'tag_name' => $label,
'slug' => StringTools::safeString($label),
'pages' => self::tagPages($label, $pages),
]);
}
}
}
}
return self::$p_tags;
}
private static function tagPages($tag, $pages)
{
$tagged = [];
foreach ($pages as $page) {
if (isset($page['tags'])) {
if (strpos($page['tags'], $tag) !== false) {
array_push($tagged, [
'title' => $page['title'],
'slug' => $page['slug'],
'path' => $page['path'],
'feature' => $page['feature'],
]);
}
}
}
return $tagged;
}
public static function archive()
{
$pages = (new Book('../content/pages'))->getContents();
$years = [];
$archive = [];
foreach ($pages as $page) {
// $year = date("Y", date($page["rawCreated"]));
$date = explode('/', $page['path']);
// echo $page["title"] . " : " . $year . "\n";
if (!find($years, ['year' => trim($date[0])])) {
$findPages = filter($pages, ['createdYear' => trim($date[0])]);
// var_dump($findPages);
array_push(
$years,
[
'year' => trim($date[0]),
'count' => count($findPages),
]
);
}
}
foreach ($years as $year) {
$sorted = [];
$filtered = filter($pages, ['createdYear' => $year['year']]);
foreach ($filtered as $obj) {
$month = date('m', date($obj['rawCreated']));
if (!find($sorted, ['month' => $month])) {
$perMonth = filter(
$pages,
[
'path' => $year['year'] . '/' . $month,
'deleted' => false,
'published' => true,
'layout' => 'page',
]
);
array_push($sorted, [
'month' => $month,
'full_month' => date('F', date($obj['rawCreated'])),
'count' => count($perMonth),
'pages' => $perMonth,
]);
}
}
array_push(self::$p_archive, [
'year' => $year['year'],
'year_data' => $sorted,
]);
}
return self::$p_archive;
}
public static function page($page)
{
$config = new Settings();
$settings = $config->getSettings();
$pageOption = [];
$pageInfo = [
'keywords' => isset($settings['global']['keywords'])
? $settings['global']['keywords']
: 'fipamo, blog, jamstack, php, markdown, js',
'description' => $settings['global']['descriptions'],
'image' => $settings['global']['base_url'] . $settings['global']['background'],
'baseURL' => $settings['global']['base_url'],
];
$tags = [];
if (isset($page['tags'])) {
$taglist = explode(',', $page['tags']);
foreach ($taglist as $tag) {
$label = trim($tag);
array_push($tags, [
'label' => $label . ' ',
'slug' => StringTools::safeString($label),
]);
}
}
$meta = [
'who' => $page['author'],
'when' => $page['created'],
'tags' => $tags,
];
// render markdown content and clean it
$parser = new Parser();
$rendered = $parser->parse($page['content']);
$sanitizer = \HtmlSanitizer\Sanitizer::create([
'extensions' => ['basic', 'image', 'list', 'code'],
'tags' => [
'img' => [
'allowed_attributes' => ['src', 'alt', 'title', 'class'],
'allowed_hosts' => null,
],
],
]);
$preclean = $sanitizer->sanitize($rendered->getContent());
// just clean renderd string for now, Sanitize doesn't like relative img urls
// so another option is needed
$cleaned = strip_tags($rendered->getContent(), [
'a',
'br',
'p',
'strong',
'br',
'img',
'iframe',
'ul',
'li',
'i',
'em',
'h1',
'h2',
'h3',
'pre',
'code',
]);
// if page feature isn't empty, find image from list and set it as background image
// if it is empty, just use global background
if ($page['feature'] != '' || $page['feature'] != null) {
$media = explode(',', $page['feature']);
$set = false;
foreach ($media as $file) {
$item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION);
if ($ext != 'mp4' && !$set) {
$pageInfo['image'] = $pageInfo['baseURL'] . $item;
$set = true;
}
}
}
if ($page['layout'] == 'index') {
// $template = $this->theme . "/index.twig";
// $location = "../public/index.html";
// $dir = null;
$recent = [];
$featured = [];
$limit = 4;
$pages = (new Book())->getContents();
foreach ($pages as $item) {
if (!$item['deleted'] &&
$item['published'] &&
$item['menu'] != 'true'
) {
if (count($recent) < $limit) {
array_push($recent, [
'path' => $item['path'],
'slug' => $item['slug'],
'title' => $item['title'],
'feature' => $item['feature'],
]);
}
if ($item['featured'] == true) {
if (count($featured) < $limit) {
array_push($featured, [
'path' => $item['path'],
'slug' => $item['slug'],
'title' => $item['title'],
'feature' => $item['feature'],
]);
}
}
}
}
$pageOptions = [
'title' => $page['title'],
'background' => $page['feature'],
'content' => $page['html'], // $cleaned,
'meta' => $meta,
'recent' => $recent,
'featured' => $featured,
'info' => $pageInfo,
'menu' => $settings['menu'],
'dynamicRender' => $settings['global']['dynamicRender'],
'media' => $page['media'],
'files' => $page['docs'],
];
} else {
// $template = $this->theme . "/page.twig";
// $location = "../public/" . $page["path"] . "/" . $page["slug"] . ".html";
// $dir = "../public/" . $page["path"];
$pageOptions = [
'title' => $page['title'],
'background' => $page['feature'],
'content' => $page['html'], // $cleaned,
'meta' => $meta,
'info' => $pageInfo,
'menu' => $settings['menu'],
'dynamicRender' => $settings['global']['dynamicRender'],
'media' => $page['media'],
'files' => $page['docs'],
];
}
return $pageOptions;
}
}

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

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="theme-color" content="#1d3040"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
{% block title %}
{{ title }}
{% endblock %}
</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% if status %}
<header>
{% apply spaceless %}
<nav class="top-nav">
<a href="/dashboard"><img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/></a>
<h1>{{ title }}</h1>
<div class="nav-right">
{% if status %}
{% apply spaceless %}
{{ include("dash/partials/navigation.twig") }}
{% endapply %}
{% endif %}
</div>
</nav>
<div class="notify" role="note">
{% apply spaceless %}
{{ include("dash/partials/notifications.twig") }}
{% endapply %}
</div>
{% endapply %}
{% endif %}
</header>
<main>
{% apply spaceless %}
{% block mainContent %}{% endblock %}
{% endapply %}
</main>
<footer></footer>
<script type="module" src="/assets/scripts/dash.js"></script>
</body>
</html>

@ -0,0 +1,80 @@
{% extends "dash/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=vdthg">
{% endblock %}
{% block mainContent %}
<section role="book-index-header">
<div role="book-index-header-left">
{{ filter }}
Pages
</div>
<div role="book-index-header-right">
<a href="/dashboard/pages/all" title="view all pages">
<button>
<i class="ti ti-clipboard-list"></i>
{{ stats['all'] }}
</button>
</a>
<a href="/dashboard/pages/published" title="view publised pages">
<button>
<i class="ti ti-clipboard-check"></i>
{{ stats['published'] }}
</button>
</a>
<a href="/dashboard/pages/deleted" title="view deleted pages">
<button>
<i class="ti ti-clipboard-off"></i>
{{ stats['deleted'] }}
</button>
</a>
</section>
<section role="book-index-pages">
{% for page in pages %}
{% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link">
<div class="page-video">
<video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
<div id="meta">
{{ include("dash/partials/recent-meta.twig") }}
</div>
</div>
</a>
{% else %}
<a class="page-link" href="/dashboard/page/edit/{{ page.uuid }}">
<div class="page-bg" style="background: url({{ page.media[0].file }}) no-repeat center center / cover #fc6399">
<div id="meta">
{{ include("dash/partials/recent-meta.twig") }}
</div>
</div>
</a>
{% endif %}
{% endfor %}
{% if numOfPages > 1 %}
<div role="paginate">
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['prevPage'] }}">
<i class="ti ti-square-arrow-left"></i>
</a>
<span class="count">
{{ currentPage }}
of
{{ numOfPages }}
</span>
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['nextPage'] }}">
<i class="ti ti-square-arrow-right"></i>
</a>
</div>
{% endif %}
</section>
{% endblock %}

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>
{{title}}
</title>
<style type="text/css">
/* reset */
#outlook a {
padding: 0;
}
/* Force Outlook to provide a "view in browser" menu link. */
.ExternalClass {
width: 100%;
}
/* Force Hotmail to display emails at full width */
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
/* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
p {
margin: 0;
padding: 0;
font-size: 0px;
line-height: 0px;
}
/* squash Exact Target injected paragraphs */
table td {
border-collapse: collapse;
}
/* Outlook 07, 10 padding issue fix */
table {
border-collapse: collapse;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
/* remove spacing around Outlook 07, 10 tables */
/* bring inline */
img {
display: block;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
a {
text-decoration: none;
color: #000001;
}
/* text link */
a.phone {
text-decoration: none;
color: #000001 !important;
pointer-events: auto;
cursor: default;
}
/* phone link, use as wrapper on phone numbers */
span {
font-size: 13px;
line-height: 17px;
font-family: monospace;
color: #000001;
}
</style>
</head>
<body>
<table cellpadding='0' cellspacing='0' border='0' style="margin:0; padding:0; width:100%; line-height: 100% !important;">
<tr>
<td valign='top'>
{# edge wrapper #}
<table cellpadding='0' cellspacing='0' border='0' align='center' width='600' style='background: #374857;'>
<tr>
<td valign='top' style='vertical-align: top;')>
{# info table start #}
<table cellpadding='0' cellspacing='0' border='0' align='center' style='width:100%'>
<tr>
<td valign='top' style='vertical-align: top;text-align: center; padding: 10px'>
<span style='font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#f5ab35; font-size:20px; font-weight: bold;'>
{{ header }}
</span>
</td>
</tr>
<tr>
<td valign='top' style='vertical-align: top; background: #161d23; padding:10px;'>
<span style='font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#cecece; font-size:16px;'>
{{ content }}
</span>
</td>
</tr>
<tr>
<td valign='top' style='vertical-align: top; padding: 10px;'>
<span style='font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#b2cce5; font-size:12px;'>
{{ footer }}
</span>
</td>
</tr>
</table>
{# info table end #}
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,16 @@
<div>
<a href="/dashboard">
<img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/>
</a>
</div>
<form id="init-restore" method="POST">
<input type="text" name="restore_member_handle" id="restore_member_handle" placeholder="handle"/><input type="password" name="restore_member_pass" id="restore_member_pass" placeholder="password"/>
<div>
<label>Grab your backup zip</label>
<input id="backup-upload" type="file" name="backup-upload" placeholder="Backup Zip"/>
</div>
<br/><br/>
<button id="blog-restore" data-action='blog-restore' type='submit'>RESTORE</button>
<br/><br/>
<button class="init-option" id="init-switch-fresh">OR INSTALL FROM SCRATCH</button>
</form>

@ -0,0 +1,15 @@
<div>
<a href="/dashboard">
<img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/>
</a>
</div>
<form id="init-form" method="POST" onsubmit="return false;">
<input type="text" name="new_member_handle" id="new_member_handle" placeholder="handle"/>
<input type="text" name="new_member_email" id="new_member_email" placeholder="email"/>
<input type="text" name="new_member_pass" id="new_member_pass" placeholder="password"/>
<input type="text" name="new_member_pass2" id="new_member_pass2" placeholder="password confirm"/>
<input type="text" name="new_member_title" id="new_member_title" placeholder="title"/>
<button id="init-blog" data-action='blog-init' type='submit'>SET UP YOUR SITE</button>
<br/><br/>
<button class="init-option" id="init-switch-restore">RESTORE FROM BACKUP</button>
</form>

@ -0,0 +1,13 @@
<section class="login">
<div>
<img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/>
</div>
<form id="login" class='login' name="login" method="POST" onsubmit="return false;">
<input type="text" name="handle" class="form-control" placeholder="Handle" required/>
<input type="password" name="password" class="form-control" placeholder="Password" required/>
<button id="login-btn" class='login-btn'>
ID, PLEASE
</button>
<a href="/dashboard/reset-password">?</a>
</form>
</section>

@ -0,0 +1,21 @@
<div>
<a href="/dashboard">
<img id="the-logo" src="/assets/images/global/fipamo-logo.svg"/>
</a>
</div>
<form id="reset" class='login' name="reset" action="/dashboard/login" method="POST">
<input type="password" id="new_password" name="new_password" class="form-control" placeholder="New Password" required/>
<input type="password" id="new_password2" name="new_password2" class="form-control" placeholder="New Password Confirm" required">
<input type="password" id="secret" name="secret" class="form-control" placeholder="Account Secret" required/>
<button id="reset-btn" class='login-btn' type='submit'>
RESET PASSWORD
</button><br/>
<p>
Use this to get your secret to verify it's you. If your email is set up, the secret will be sent there. If not, the form will be updated automatically(but please set up your email, once you reset your password).
</p>
<input type="text" id="email" name="email" class="form-control" placeholder="email to verify" required/>
<button id="get-secret-btn" class='login-btn' type='submit'>
VERIFY EMAIL
</button><br/><br/>
</form>

@ -0,0 +1,24 @@
{% extends "dash/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css">
{% endblock %}
{% block mainContent %}
<article role="site-restore">
<section role="restore-fresh">
{% apply spaceless %}
{{ include("dash/forms/init-fresh.twig") }}
{% endapply %}
</section>
<section role="restore-backup">
{% apply spaceless %}
{{ include("dash/forms/init-backup.twig") }}
{% endapply %}
</section>
</article>
{% endblock %}

@ -0,0 +1,30 @@
{% extends "dash/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=sdsdsds">
{% endblock %}
{% block mainContent %}
<article role="navigation">
<section id="nav-items">
{% for item in menu %}
<div id="{{ item.id }}" class="nav-item" data-slug="{{ item.slug }}" data-uuid="{{ item.uuid }}" data-path="{{ item.path }}">
<i class="ti ti-arrows-move-vertical"></i>
<label>{{ item.title }}</label>
<div id="nav-btns">
<button id="edit-item" class="nav-btn" data-id="{{ item.uuid }}" title="edit page">
<i class="ti ti-edit"></i>
</button>
<button id="remove-item" class="nav-btn" data-uuid="{{ item.uuid }}" data-id="{{ item.id }}" title="delete from menu">
<i class="ti ti-x"></i>
</button>
</div>
</div>
{% endfor %}
</section>
</article>
{% endblock %}

@ -0,0 +1,206 @@
{% extends "dash/_frame.twig" %}
{#
if page is in 'edit' mode, set variables
if not, just make them empty
#}
{% if mode == 'edit' %}
{% set id = page['id'] %}
{% set uuid = page['uuid'] %}
{% set slug = page['slug'] %}
{% set layout = page['layout'] %}
{% set feature = page['feature'] %}
{% set tags = page['tags'] %}
{% set content = page['content'] %}
{% set date = page['created'] %}
{% set updated = page['updated'] %}
{% set media = page['media'] %}
{% set files = page['docs'] %}
{% else %}
{% set id = '' %}
{% set uuid = '' %}
{% set slug = '' %}
{% set layout = 'page' %}
{% set feature = '' %}
{% set title = '' %}
{% set tags = '' %}
{% set content = '' %}
{% set date = '' %}
{% set updated = '' %}
{% set media = '' %}
{% set files = '' %}
{% endif %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=vdthg">
{% endblock %}
{% block mainContent %}
<section data-index="{{ id }}" data-uuid="{{ uuid }}" data-slug="{{ slug }}" data-layout="{{ layout }}" role="file-manager">
{% if page['feature'] == null %}
<div role="file-drop">
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
</div>
<label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list"></div>
<label role="list-title">FILES</label>
<div role="page-files-list"></div>
{% else %}
<div role="file-drop">
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
</div>
<label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list">
{% if media|length > 1 %}
{% for item in media %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp4" %}
<div id="{{ loop.index0 }}" class="video-item" data-source="{{ item.file }}">
<video>
<source src="{{ item.file }}"/>
</video>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="{{ loop.index0 }}" class="img-item" data-source="{{ item.file }}" style="background: url({{ item.file }}) no-repeat center center / cover">
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% endfor %}
{% else %}
{% if media[0] != '' %}
{% set fileName = media[0].file|split('/') %}
{% if media[0].type == "mp4" %}
<div id="0" class="video-item" data-source="{{ media[0].file }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %}
<div id="0" class="img-item" data-source="{{ media[0].file }}" style="background: url({{ media[0].file }}) no-repeat center center / cover">
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% else %}
{% endif %}
{% endif %}
</div>
<label role="list-title">FILES</label>
<div role="page-files-list">
{% if files|length > 1 %}
{% for item in files %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp3" %}
<div id="{{ loop.index0 }}" class="audio-item" data-source="{{ item.file }}">
<audio controls>
<source src="{{ item.file }}"/>
</audio>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="{{ loop.index0 }}" class="file-item" data-source="{{ item.file }}">
<a href="{{ item.file }}" target="_blank">{{ fileName[6] }}"</a>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% endfor %}
{% else %}
{% if files[0] != '' %}
{% set fileName = files[0].file|split('/') %}
{% if files[0].type == "mp3" %}
<div id="0" class="audio-item" data-source="{{ files[0].file }}">
<audio controls>
<source src="{{ files[0].file }}"/>
</audio>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="0" class="file-item" data-source="{{ files[0].file }}">
<a href="{{ item.file }}" target="_blank">{{ fileName[6] }}"</a>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% else %}
{% endif %}
{% endif %}
</div>
{% endif %}
</section>
<section role="page-meta">
<div role="page-meta-wrapper">
<div role="page-title">
<strong>TITLE</strong>
<textarea id="post-title-text" type="text" name="post-title-text" class="post-edit" placeholder="TITLE">{{ title }}</textarea>
</div>
<div role="page-tags">
<strong>TAGS</strong>
<textarea id="post-tags" type="text" name="post-tags" class="form-control" placeholder="tags [comma seperated]">{{ tags }}</textarea>
</div>
<div role="page-layouts">
<strong>LAYOUTS</strong>
<select id="page-templates">
{% for view in views %}
{% if view == page['layout'] %}
<option value={{ view }} selected>{{ view }}</option>
{% else %}
<option value={{ view }}>{{ view }}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div role="page-options">
<strong>OPTIONS</strong>
{% apply spaceless %}
{{ include("dash/partials/options.twig") }}
{% endapply %}
</div>
<div role="page-updated">
<strong>UPDATED</strong>
<span id="post-date" type="text">
{{ updated }}
</span>
</div>
<div role="page-created">
<strong>CREATED</strong>
<span id="post-date" type="text">
{{ date }}
</span>
<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="form_token" name="token" type="hidden" value="{{ token }}"></div>
</div>
</div>
</section>
<section role="text-editor">
{% apply spaceless %}
{{ include("dash/partials/editor.twig") }}
{% endapply %}
<div role="edit-post-wrapper">
<textarea id="edit" spellcheck="false" class="language-md">{{ content }}</textarea>
<pre id="highlight">
<code id="highlight-content" class="language-md"></code>
</pre>
</div>
</section>
{% endblock %}

@ -0,0 +1,38 @@
<div role="text-editor-control">
<button id="edit-bold" class="content-editor-btn-text editor-button" title="bold">
<i id="edit-bold" class="ti ti-bold"></i>
</button>
<button id="edit-italic" class="content-editor-btn-text editor-button" title="italic">
<i id="edit-italic" class="ti ti-italic"></i>
</button>
<button id="edit-strikethrough" class="content-editor-btn-text editor-button" title="strikethrough">
<i id="edit-strikethrough" class="ti ti-strikethrough"></i>
</button>
<button id="edit-link" class="content-editor-btn-icon editor-button" title="insert link">
<i id="edit-link" class="ti ti-link"></i>
</button>
<button id="edit-header1" class="content-editor-btn-text editor-button" title="header 1">
<i id="edit-header1" class="ti ti-h-1"></i>
</button>
<button id="edit-header2" class="content-editor-btn-text editor-button" title="header 2">
<i id="edit-header2" class="ti ti-h-2"></i>
</button>
<button id="edit-header3" class="content-editor-btn-text editor-button" title="header 3">
<i id="edit-header3" class="ti ti-h-3"></i>
</button>
<button id="edit-image" class="content-editor-btn-icon editor-button" title="insert image">
<i id="edit-image" class="ti ti-photo"></i>
</button>
{% if mode == "edit" %}
<button id="edit-update" class="post-sumbit-btn submit-start editor-button" data-action='blog-update' data-id="{{ page['uuid'] }} type='submit' title=" bold">
<i id="edit-update" class="ti ti-device-floppy"></i>
</button>
<button id="edit-delete" class="content-editor-btn-icon editor-button submit-delete" for="post-delete" title='delete post'>
<i id="edit-delete" class="ti ti-x"></i>
</button>
{% else %}
<button id="edit-save" class="post-sumbit-btn submit-start editor-button" data-action='blog-add' type='submit'>
<i id="edit-save" class="ti ti-file-plus"></i>
</button>
{% endif %}
</div>

@ -0,0 +1,30 @@
<section class="index-header">
<div class="index-header-left">
<h1>Recent</h1>
</div>
<div class="index-header-right"></div>
</section>
<section class="index-recent-pages">
{% if data["entryCount"] != 0 %}
{% for page in data['pages'] %}
{% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-video-link recent-link">
{{ include("dash/partials/recent-meta.twig") }}
<video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
</a>
{% else %}
<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 #fc6399">
{{ include("dash/partials/recent-meta.twig") }}
</a>
{% endif %}
{% endfor %}
{% else %}
There are no pages
{% endif %}
</section>

@ -0,0 +1,31 @@
{% if mailOption == "option-smtp" %}
<div id="mail-smtp" data-enabled='true'>
<input type='text' name='smtp-domain' id='smtp-domain' placeholder='domain'value="{{mailConfig['smtp']['domain']}}"/>
<input type='text' name='smtp-email' id='smtp-email' placeholder='email' value="{{mailConfig['smtp']['email']}}" />
<input type='text' name='smtp-pass' id='smtp-pass' placeholder='password' value="{{mailConfig['smtp']['password']}}"/>
</div>
<div id="mail-mg" data-enabled='false'>
<input type='text' name='mg-domain' id='mg-domain' placeholder='domain' value="{{mailConfig['mailgun']['domain']}}" />
<input type='text' name='mg-key' id='mg-key' placeholder='api key' value="{{mailConfig['mailgun']['key']}}"/>
</div>
{% elseif(mailOption == 'option-mg') %}
<div id="mail-smtp" data-enabled='false'>
<input type='text' name='smtp-domain' id='smtp-domain' placeholder='domain'value="{{mailConfig['smtp']['domain']}}"/>
<input type='text' name='smtp-email' id='smtp-email' placeholder='email' value="{{mailConfig['smtp']['email']}}" />
<input type='text' name='smtp-pass' id='smtp-pass' placeholder='password' value="{{mailConfig['smtp']['password']}}"/>
</div>
<div id="mail-mg" data-enabled='true'>
<input type='text' name='mg-domain' id='mg-domain' placeholder='domain' value="{{mailConfig['mailgun']['domain']}}" />
<input type='text' name='mg-key' id='mg-key' placeholder='api key' value="{{mailConfig['mailgun']['key']}}"/>
</div>
{% else %}
<div id="mail-smtp" data-enabled='false'>
<input type='text' name='smtp-domain' id='smtp-domain' placeholder='domain'value="{{mailConfig['smtp']['domain']}}"/>
<input type='text' name='smtp-email' id='smtp-email' placeholder='email' value="{{mailConfig['smtp']['email']}}" />
<input type='text' name='smtp-pass' id='smtp-pass' placeholder='password' value="{{mailConfig['smtp']['password']}}"/>
</div>
<div id="mail-mg" data-enabled='false'>
<input type='text' name='mg-domain' id='mg-domain' placeholder='domain' value="{{mailConfig['mailgun']['domain']}}" />
<input type='text' name='mg-key' id='mg-key' placeholder='api key' value="{{mailConfig['mailgun']['key']}}"/>
</div>
{% endif %}

@ -0,0 +1,57 @@
<div class="menu">
{% if title == "Settings" %}
{% apply spaceless %}
{{ include("dash/partials/submenu_settings.twig") }}
{% endapply %}
{% elseif title=="Start" %}
{% apply spaceless %}
{{ include("dash/partials/submenu_start.twig") }}
{% endapply %}
{% endif %}
<a id="settings" href="/dashboard/settings" title="settings">
<button>
<i class="ti ti-home-cog"></i>
</button>
</a>
<a id="navigation" href="/dashboard/navigation" title="edit navigation">
<button>
<i class="ti ti-arrow-autofit-height"></i>
</button>
</a>
<a id="navigation" href="/dashboard/logout" title="log out">
<button>
<i class="ti ti-logout"></i>
</button>
</a>
</div>
<button class="menu-toggle">
<i class="ti ti-menu-2"></i>
</button>
<div class="mobile-menu">
{% if title == "Settings" %}
{% apply spaceless %}
{{ include("dash/partials/submenu_settings.twig") }}
{% endapply %}
{% elseif title=="Start" %}
{% apply spaceless %}
{{ include("dash/partials/submenu_start.twig") }}
{% endapply %}
{% endif %}
<a id="settings" href="/dashboard/settings" title="settings">
<button>
<i class="ti ti-home-cog"></i>
</button>
</a>
<a id="navigation" href="/dashboard/navigation" title="edit navigation">
<button>
<i class="ti ti-arrow-autofit-height"></i>
</button>
</a>
<a id="navigation" href="/dashboard/logout" title="log out">
<button>
<i class="ti ti-logout"></i>
</button>
</a>
</div>

@ -0,0 +1,10 @@
<div class="notify-message">
<div class="notify-icons">
<i class="ti ti-mood-smile notify-good"></i>
<i class="ti ti-mood-sad notify-notgood"></i>
<i class="ti ti-settings notify-working"></i>
</div>
<div class="notify-text">
<span class="response-text">Hey Hey</span>
</div>
</div>

@ -0,0 +1,40 @@
{% if page['menu'] %}
{% set menu = 'true' %}
{% else %}
{% set menu = 'false' %}
{% endif %}
{% if page['featured'] %}
{% set featured = 'true' %}
{% else %}
{% set featured = 'false' %}
{% endif %}
{% if page['published'] %}
{% set published = 'true' %}
{% else %}
{% set published = 'false' %}
{% endif %}
<br>
<button id="option-menu-pin" class="option-inactive post-option-btn" data-active="{{ menu }}" title='Pin to Menu'>
<svg id="option-page-icon" role="icon">
<use id="option-page-icon" xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/>
</svg>
</button>
<button id="option-feature" class="option-inactive post-option-btn" data-active="{{ featured }}" title='Feature'>
<svg id="option-feature-icon" role="icon">
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
</svg>
</button>
<button id="option-published" class="option-inactive post-option-btn" data-active="{{ published }}" title='Published'>
<svg id="option-published-icon" role="icon">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
</svg>
</button>
<a href="/dashboard/page/preview/{{ uuid }}" target="_blank">
<button id="option-preview" class="option-inactive post-option-btn" data-active="false" title='preview page'>
<svg id="option-preview-icon" role="icon">
<use id="option-preview-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye"/>
</svg>
</button>
</a>

@ -0,0 +1,37 @@
{% if page.menu == 'true' %}
{% set menu = "true" %}
{% else %}
{% set menu = "false" %}
{% endif %}
{% if page.published == 'true' %}
{% set published = "true" %}
{% else %}
{% set published = "false" %}
{% endif %}
{% if page.featured == 'true' %}
{% set featured = "true" %}
{% else %}
{% set featured = "false" %}
{% endif %}
<aside>
<strong>
{{ page.updated }}
</strong>
<hr/>
<strong>
{{ page.title }}
</strong>
<hr/>
<button data-active="{{ menu }}">
<i class="ti ti-navigation"></i>
</button>
<button data-active="{{ published }}">
<i class="ti ti-world"></i>
</button>
<button data-active="{{ featured }}">
<i class="ti ti-star"></i>
</button>
</aside>

@ -0,0 +1,11 @@
<div class="submenu">
<button id="save-toggle" title="save settings">
<i class="ti ti-device-floppy"></i>
</button>
<button id="publish-pages" title="publish site">
<i class="ti ti-world-upload"></i>
</button>
<button id="render-toggle" title="render on save toggle" data-render="{{ renderOnSave }}">
<i class="ti ti-circle-dashed"></i>
</button>
</div>

@ -0,0 +1,12 @@
<div class="submenu">
<a href='/dashboard/pages' title="view pages">
<button>
<i class="ti ti-book-2"></i>
</button>
</a>
<a href='/dashboard/page/add/new' title="add new page">
<button>
<i class="ti ti-square-plus"></i>
</button>
</a>
</div>

@ -0,0 +1,18 @@
{% extends "dash/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css">
{% endblock %}
{% block mainContent %}
<section role="password-reset">
{% apply spaceless %}
{{ include("dash/forms/reset.twig") }}
{% endapply %}
</section>
{% endblock %}

@ -0,0 +1,123 @@
{% extends "dash/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=cvnbm">
{% endblock %}
{% block mainContent %}
<article class="settings">
<section class="member-settings">
<div class="member-avatar">
<div class="avatar" style="background: url({{ member['avatar'] }} ) no-repeat center center / cover"></div>
<input id="avatar-upload" type="file" name="avatar-upload"/>
</div>
<div class="site-background">
<div class="background" style="background: url({{ background }} ) no-repeat center center / cover"></div>
<input id="background-upload" type="file" name="backgrond-upload"/>
</div>
<div>
<input type='text' name='handle' id='settings-handle' placeholder='handle' value="{{ member['handle'] }}" autofocus/>
<input type='text' name='email' id='settings-email' placeholder='email' value="{{ member['email'] }}" autofocus/>
<input type='text' name='base-url' id='settings-url' placeholder='url' value="{{ baseUrl }}" autofocus/>
<input type='text' name='base-title' id='settings-title' placeholder='site title' value="{{ siteTitle }}" autofocus/>
<textarea id="settings-desc" type='text' name='settings_desc' class='settings-dec' placeholder='description stuff' , autofocus>{{ desc }}</textarea>
</div>
<div>
<button id="create-backup">
<i class="ti ti-disc"></i>
<span>BACK UP YOUR SITE</span>
</button><br/>
{% if lastBackup != '' %}
LAST BACK UP<br/>
<a href="/api/v1/files">{{ lastBackup }}</a><br/>
{% else %}
<span>span No back ups. Frowny face.</span>
{% endif %}
</div>
<div class="features">
{% if apiStatus is defined and apiStatus == "true" %}
<button id="api-access-toggle" title="allow external api" data-enabled="true">
<i class="ti ti-phone-incoming"></i>
<span id="api-status">API ACCESS ENABLED</span>
</button>
{% else %}
<button id="api-access-toggle" title="allow external api" data-enabled="false">
<i class="ti ti-phone-incoming"></i>
<span id="api-status">API ACCESS NOT ENABLED</span>
</button>
{% endif %}
{% if dynamicRenderStatus is defined and dynamicRenderStatus == "true" %}
<button id="dynamic-render-toggle" title="allow external api" data-enabled="true">
<i class="ti ti-arrow-merge"></i>
<span id="dynamic-render-status">DYNAMIC PAGE RENDERING</span>
</button>
{% else %}
<button id="dynamic-render-toggle" title="allow external api" data-enabled="false">
<i class="ti ti-arrow-merge"></i>
<span id="dynamic-render-status">STATIC PAGE RENDERING</span>
</button>
{% endif %}
</div>
<div class="theme">
<label>Themes</label><br/>
{% for theme in themes %}
{% if theme.name == currentTheme %}
<button id="{{ theme.name }}" class="theme-select" data-enabled="true">
<i class="ti ti-brush"></i>
<span>{{ theme['display-name'] }}</span>
</button>
{% else %}
<button href="#" id="{{ theme.name }}" class="theme-select" data-enabled="false">
<i class="ti ti-brush-off"></i>
<span>{{ theme['display-name'] }}</span>
</button>
{% endif %}
{% endfor %}
</div>
<div class="mail">
<label>Email</label><br/>
{% if mailOption == "option-none" or mailOption == "" %}
<a href="#" class="mail-option" id="option-none" data-enabled="true">NONE</a>
{% else %}
<a href="#" class="mail-option" id="option-none" data-enabled="false">NONE</a>
{% endif %}
{% if mailOption == "option-mg" or mailOption == "" %}
<a href="#" class="mail-option" id="option-mg" data-enabled="true">MAILGUN</a>
{% else %}
<a href="#" class="mail-option" id="option-mg" data-enabled="false">MAILGUN</a>
{% endif %}
{% if mailOption == "option-smtp" or mailOption == "" %}
<a href="#" class="mail-option" id="option-smtp" data-enabled="true">SMTP</a>
{% else %}
<a href="#" class="mail-option" id="option-smtp" data-enabled="false">SMTP</a>
{% endif %}
{% apply spaceless %}
{{ include("dash/partials/mailforms.twig") }}
{% endapply %}
<button id="send-mail">
<i class="ti ti-mailbox"></i>
<span>TEST MAIL</span>
</button>
</div>
<div>
<label>API KEY</label>
<br/>
{{ member['key'] }}
<br/>
<label>FORM TOKEN</label><br/>
{{ ftoken }}
</div>
</section>
</article>
{% endblock %}

@ -0,0 +1,19 @@
{% extends "dash/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=dfdfrtr">
{% endblock %}
{% block mainContent %}
{% if status %}
{% apply spaceless %}
{{ include("dash/partials/index.twig") }}
{% endapply %}
{% else %}
{{ include("dash/forms/login.twig") }}
{% endif %}
{% endblock %}

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
{% block title %}
{{ title }}
{% endblock %}
</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
<div id="main-content" class="main-container"> {% block mainContent %}{% endblock %}
</section>
</body>
</html>
</div>
<footer>
{% if options['showFooter'] is defined %}
<!-- NO FOOTER -->
{% else %}
<div class="inner">
<div class="columns">
<div id="footer_left" class="column">
<a href="#">About</a><br/>
</div>
<div id="footer_right " class="column">
<a href="#">FAQ</a><br/>
</div>
</div>
</div>
{% endif %}
</footer>
{% block javascripts %}{% endblock %}</body></html>

@ -0,0 +1,17 @@
{% extends "front/_frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/public/assets/css/base.css">
{% endblock %}
{% block mainContent %}
This is the index page, boss
{% endblock %}
{% block javascripts %}
<script src="/public/assets/scripts/dash.min.js" type="text/javascript"></script>
{% endblock %}

@ -0,0 +1,37 @@
{
"name": "are0h/fipamo",
"descriptions": "The most chill no database blog framework ever.",
"version": "2.6.1-beta",
"homepage": "https://fipamo.blog",
"authors": [
{
"name": "Are0h",
"homepage": "https://roiskinda.cool"
}
],
"support": {
"source": "https://koodu.ubiqueros.com/are0h/Fipamo",
"wiki": "https://koodu.ubiqueros.com/are0h/Fipamo/wiki/?action=_pages",
"issues": "https://koodu.ubiqueros.com/are0h/Fipamo/issues"
},
"require": {
"slim/slim": "4.*",
"slim/psr7": "^1.2",
"twig/twig": "^3.0",
"slim/twig-view": "^3.0",
"mnapoli/front-yaml": "^1.8",
"lodash-php/lodash-php": "^0.0.7",
"rbdwllr/reallysimplejwt": "^4.0",
"tgalopin/html-sanitizer": "^1.4",
"phpmailer/phpmailer": "^6.4",
"league/commonmark": "^2.1",
"symfony/yaml": "^5.4",
"olegatro/html-sanitizer-relative": "^1.0",
"nesbot/carbon": "^2.62"
},
"scripts": {
"start": [
"@php -S localhost:8000 -t public/"
]
}
}

3257
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -1,30 +0,0 @@
{
"url": "DOMAIN_URL",
"theme": "default",
"development": {
"database": "DATABASE",
"user": "DATABASE_USER",
"password": "DATABASE_PASS",
"dialect": "postgres",
"host": "localhost",
"operatorsAliases": false,
"pool": {
"max": 9,
"min": 0,
"idle": 10000
}
},
"production": {
"database": "DATABASE",
"user": "DATABASE_USER",
"password": "DATABASE_PASS",
"operatorsAliases": false,
"host": "localhost",
"dialect": "postgres",
"pool": {
"max": 9,
"min": 0,
"idle": 10000
}
}
}

@ -0,0 +1,15 @@
[
{
"id": "",
"handle": "",
"avi": "/assets/images/global/default-avi.png",
"email": "",
"password": "",
"key": "",
"secret": "",
"role": "",
"created": "",
"updated": "",
"deleted": null
}
]

@ -0,0 +1,31 @@
{
"global": {
"base_url": "http://your.domain",
"title": "This is a Title",
"descriptions": "Because it should be easy.",
"background": "/assets/images/global/default-bg.jpg",
"private": "true",
"renderOnSave": "false",
"theme": "fipamo-default",
"display_limit": 5,
"last_backup": null,
"externalAPI": "false",
"dynamicRender": "false"
},
"library_stats": {
"current_index": 1
},
"email": {
"active": "none",
"smtp": {
"domain": "",
"email": "",
"password": ""
},
"mailgun": {
"domain": "",
"api-key": ""
}
},
"menu": []
}

@ -1,21 +0,0 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn('Posts', 'featured', {
type: Sequelize.BOOLEAN,
unique: false,
allowNull: true,
defaultValue: false
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn('Posts', 'featured', {
type: Sequelize.BOOLEAN,
unique: false,
allowNull: true,
defaultValue: false
});
}
};

@ -1,21 +0,0 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn('Posts', 'published', {
type: Sequelize.BOOLEAN,
unique: false,
allowNull: true,
defaultValue: false
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn('Posts', 'published', {
type: Sequelize.BOOLEAN,
unique: false,
allowNull: true,
defaultValue: false
});
}
};

@ -1,22 +0,0 @@
{
"url": "http://your.domain",
"title": "This is the title",
"description": "A few words describing the site",
"theme": "default-light",
"private": "false",
"feautred-url":"fancybackground.something",
"email":
{
"smtp":
{
"domain": "",
"email": "",
"password": ""
},
"mailgun":
{
"domain": "",
"api-key": ""
}
}
}

@ -1,139 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Email title or subject</title>
<style type="text/css">
/* reset */
#outlook a {
padding: 0;
}
/* Force Outlook to provide a "view in browser" menu link. */
.ExternalClass {
width: 100%;
}
/* Force Hotmail to display emails at full width */
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
/* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
p {
margin: 0;
padding: 0;
font-size: 0px;
line-height: 0px;
}
/* squash Exact Target injected paragraphs */
table td {
border-collapse: collapse;
}
/* Outlook 07, 10 padding issue fix */
table {
border-collapse: collapse;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
/* remove spacing around Outlook 07, 10 tables */
/* bring inline */
img {
display: block;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
a {
text-decoration: none;
color: #000001;
}
/* text link */
a.phone {
text-decoration: none;
color: #000001 !important;
pointer-events: auto;
cursor: default;
}
/* phone link, use as wrapper on phone numbers */
span {
font-size: 13px;
line-height: 17px;
font-family: monospace;
color: #000001;
}
</style>
<!--[if gte mso 9]>
<style>
/* Target Outlook 2007 and 2010 */
</style>
<![endif]-->
</head>
<body style="width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; background: #161d23;">
<!-- body wrapper -->
<table cellpadding="0" cellspacing="0" border="0" style="margin:0; padding:0; width:100%; line-height: 100% !important;">
<tr>
<td valign="top">
<!-- edge wrapper -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" style="background: #374857;">
<tr>
<td valign="top" style="vertical-align: top;">
<!-- ///////////////////////////////////////////////////// -->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:100%">
<tr>
<td valign="top" style="vertical-align: top;text-align: center; padding: 10px">
<span style="font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#f5ab35; font-size:20px; font-weight: bold;">
HEADER
</span>
</td>
</tr>
<tr>
<td valign="top" style="vertical-align: top; background: #161d23; padding:10px;">
<span style="font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#cecece; font-size:16px;">
BIG BODY
</span>
</td>
</tr>
<tr>
<td valign="top" style="vertical-align: top; padding: 10px;">
<span style="font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#b2cce5; font-size:12px;">
footer text
</span>
</td>
</tr>
</table>
<!-- //////////// -->
</td>
</tr>
</table>
<!-- / edge wrapper -->
</td>
</tr>
</table>
<!-- / page wrapper -->
</body>
</html>

@ -0,0 +1,45 @@
{% extends "frame.twig" %}
{% block title %}
{{ title }}
{% endblock %}
{% block mainContent %}
<section>
<div class="page-title">
<span>{{title}}</span>
</div>
</section>
<article>
<div class="page">
{% for item in archives %}
<div class="archive-item">
<span class="year">
{{item.year}}
</span>
{% for data in item.year_data %}
<div class="archive-month">
<span class="month">
{{data.full_month}}
</span>
{% for page in data.pages %}
{% if dynamicRender is defined %}
{% if dynamicRender == 'true' %}
<a href="{{ "/"~item.year~"/"~data.month~"/"~page.slug }}">{{page.title}}</a><br />
{% else %}
<a href="{{ "/"~item.year~"/"~data.month~"/"~page.slug~".html" }}">{{page.title}}</a><br />
{% endif %}
{% else %}
<a href="{{ "/"~item.year~"/"~data.month~"/"~page.slug~".html" }}">{{page.title}}</a><br />
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</article>
{% endblock %}

@ -0,0 +1,600 @@
h1, h2, h3 {
color: #ebe5d4;
}
h1 {
font-size: 2em;
font-weight: 400;
}
h2 {
font-size: 1.75em;
font-weight: 400;
}
h3 {
font-size: 1.5em;
font-weight: 300;
}
html {
line-height: 1.15;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
footer,
header,
nav,
section {
display: block;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
line-height: 1em;
}
figcaption,
figure,
main {
display: block;
}
figure {
margin: 1em 40px;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
pre {
font-family: monospace, monospace;
font-size: 1em;
}
a {
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
a:active,
a:hover {
outline-width: 0;
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted;
}
b,
strong {
font-weight: inherit;
font-weight: bolder;
}
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
dfn {
font-style: italic;
}
mark {
background-color: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 60%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.55em;
background: #151d26;
color: #151d26;
border-radius: 2px;
padding: 0 2px 0 2px;
margin: 0 2px 0 0;
}
audio,
video {
display: inline-block;
}
audio:not([controls]) {
display: none;
height: 0;
}
img {
border-style: none;
}
svg:not(:root) {
overflow: hidden;
}
button,
input,
optgroup,
select,
textarea {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button, html [type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
[type=button]::-moz-focus-inner,
[type=reset]::-moz-focus-inner,
[type=submit]::-moz-focus-inner,
button::-moz-focus-inner {
border-style: none;
padding: 0;
}
[type=button]:-moz-focusring,
[type=reset]:-moz-focusring,
[type=submit]:-moz-focusring,
button:-moz-focusring {
outline: 1px dotted ButtonText;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
progress {
display: inline-block;
vertical-align: baseline;
}
textarea {
overflow: auto;
}
[type=checkbox],
[type=radio] {
box-sizing: border-box;
padding: 0;
}
[type=number]::-webkit-inner-spin-button,
[type=number]::-webkit-outer-spin-button {
height: auto;
}
[type=search] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type=search]::-webkit-search-cancel-button,
[type=search]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
details,
menu {
display: block;
}
summary {
display: list-item;
}
canvas {
display: inline-block;
}
template {
display: none;
}
[hidden] {
display: none;
}
form {
display: inline-block;
}
form a {
color: #151d26;
}
form p {
background: #e8c33e;
color: #151d26;
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 Helvetica, Arial, sans-serif;
display: inline-block;
background: #151d26;
color: #e8c33e;
}
textarea {
border: 0;
border-radius: 3px;
color: #ebe5d4;
font: 15px Helvetica, Arial, sans-serif;
background: #151d26;
}
button, input[type=submit] {
background: #7ED07E;
color: #151d26;
font: 20px Helvetica, Arial, sans-serif;
border-radius: 5px;
position: relative;
cursor: pointer;
border: 0;
padding: 10px 0 5px 0;
transition: all 0.3s linear;
}
select {
font: 14px Helvetica, Arial, sans-serif;
border: 1px solid #FC6399;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
color: #151d26;
}
::-webkit-input-placeholder {
font: 25px Helvetica, Arial, sans-serif;
color: #ebe5d4;
}
:-moz-placeholder {
/* Firefox 18- */
font: 25px Helvetica, Arial, sans-serif;
color: #ebe5d4;
}
::-moz-placeholder {
/* Firefox 19+ */
font: 15px Helvetica, Arial, sans-serif;
color: #ebe5d4;
}
:-ms-input-placeholder {
font: 25px Helvetica, Arial, sans-serif;
color: #ebe5d4;
}
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
font: 400 1.2em/1.4em Helvetica, Arial, sans-serif;
}
html body {
background: #ebe5d4;
margin: 0;
padding: 0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
}
html body a {
color: #151d26;
text-decoration: none;
border-bottom: 1px solid #7ED07E;
}
html body a:hover {
border-bottom: 1px solid #FC6399;
}
html body code {
background: #32302f;
color: #7ED07E;
border-radius: 3px;
padding: 3px;
}
html body pre {
background: #32302f;
color: #7ED07E;
border-radius: 3px;
padding: 3px;
}
html body code {
color: #FC6399;
background: none;
}
html body svg.icons {
width: 25px;
fill: #ebe5d4;
}
html body header {
background: #151d26;
height: 90%;
width: 100%;
border-top: #ebe5d4 3px solid;
}
html body header #media {
width: 100%;
height: 90%;
position: absolute;
}
html body header #media .slide {
transition: all 0.7s linear;
width: 100%;
height: 100%;
position: absolute;
}
html body header #media .hide {
opacity: 0;
}
html body header #media .show {
opacity: 1;
}
html body header #media video {
width: 100%;
height: 100%;
object-fit: cover;
}
html body header nav {
width: 97%;
margin: 10px auto;
z-index: 1000;
position: relative;
color: #151d26;
}
html body header nav .left, html body header nav .right {
width: 50%;
display: inline-block;
vertical-align: top;
}
html body header nav .left a.logo-link {
border-bottom: none;
margin: 0 0 20px 0;
display: block;
}
html body header nav .left a.logo-link #logo {
width: 50px;
border-bottom: none;
}
html body header nav .right {
text-align: right;
}
html body header nav .right a.menu-link {
background: #FC6399;
margin-bottom: 4px;
padding: 3px;
border-radius: 2px;
display: inline-block;
font-size: 0.8em;
border-bottom: none;
}
html body header nav .right a.menu-link:hover {
background: #FC6399;
}
html body .container {
z-index: 2;
background: #ebe5d4;
line-height: 30px;
font-weight: lighter;
width: 100%;
color: #32302f;
}
html body .container article {
position: relative;
width: 80%;
height: 80%;
max-width: 840px;
background: #ebe5d4;
vertical-align: top;
color: #32302f;
margin: 0 auto;
}
html body .container article .index, html body .container article .page {
padding: 0 0 15px 0;
}
html body .container article .index img, html body .container article .page img {
display: block;
width: 100%;
}
html body .container article .index h1, html body .container article .index h2, html body .container article .page h1, html body .container article .page h2 {
color: #151d26;
}
html body .container article .index p, html body .container article .page p {
font: 300 1.25em/1.6em Helvetica, Arial, sans-serif;
}
html body .container article .index .page_files .page_doc a, html body .container article .page .page_files .page_doc a {
background: #32302f;
border-radius: 3px;
color: #ebe5d4;
padding: 3px;
margin: 0 5px 0 0;
}
html body .container article .index .meta, html body .container article .page .meta {
font: 500 0.8em/1.3em Helvetica, Arial, sans-serif;
padding: 5px 0 0 0;
border-top: 1px solid #151d26;
background: #ebe5d4;
}
html body .container article .index .meta a, html body .container article .page .meta a {
font-size: 0.8em;
font-weight: 400;
}
html body .container article .index .archive-item, html body .container article .page .archive-item {
padding: 15px 0 20px 0;
}
html body .container article .index .archive-item span.year, html body .container article .page .archive-item span.year {
font-size: 1.5em;
font-weight: 500;
padding: 5px;
display: block;
color: #151d26;
}
html body .container article .index .archive-item .archive-month, html body .container article .page .archive-item .archive-month {
display: inline-block;
vertical-align: top;
width: 30%;
padding: 5px;
}
html body .container article .index .archive-item .archive-month span.month, html body .container article .page .archive-item .archive-month span.month {
color: #FC6399;
font-size: 1.5em;
font-weight: 300;
padding: 5px;
display: block;
}
html body .container section {
padding: 0 0 20px 0;
background: #151d26;
}
html body .container section a {
color: #ebe5d4;
}
html body .container section .index-lists, html body .container section .page-title {
max-width: 840px;
width: 80%;
margin: 0 auto;
padding: 20px 0 0 0;
}
html body .container section .index-lists span, html body .container section .page-title span {
font-size: 2em;
color: #FC6399;
font-weight: 400;
width: 80%;
margin: 0 auto;
padding: 20px 0 0 0;
}
html body .container section .index-lists .recent, html body .container section .index-lists .featured, html body .container section .page-title .recent, html body .container section .page-title .featured {
display: inline-block;
width: 50%;
vertical-align: top;
}
html body .container section .index-lists label, html body .container section .page-title label {
background: #32302f;
color: #ebe5d4;
font-size: 1.5em;
line-height: 1.3;
}
html body footer {
background: #ebe5d4;
padding: 10px;
color: #151d26;
font-size: 0.8em;
font-weight: 600;
height: 100px;
}
html body footer .inner {
margin: 20px auto;
width: 80%;
max-width: 840px;
}
html body footer .inner a {
color: #FC6399;
}
html body header nav {
width: 98%;
}
html body header span {
font-size: 2.5em;
}
html body header .container article .index .archive-item .archive-month, html body header .container article .page .archive-item .archive-month {
width: 45%;
}
html body header nav {
width: 96%;
}
html body header .container article .index, html body header .container article .page {
margin: 0;
}
html body header .container article .index p, html body header .container article .page p {
font: 300 1em/1.6em Helvetica, Arial, sans-serif;
}
html body header .container section .index-lists .recent, html body header .container section .index-lists .featured {
width: 100% !important;
}
html body header nav {
width: 95%;
}
html body .container article .index, html body .container article .page {
margin: 0;
}
html body .container article .index p, html body .container article .page p {
font: 300 0.9em/1.7em Helvetica, Arial, sans-serif;
}
html body .container article .index .archive-item .archive-month, html body .container article .page .archive-item .archive-month {
width: 95%;
}
/*# sourceMappingURL=base.css.map */

@ -0,0 +1 @@
{"version":3,"sourceRoot":"","sources":["../../../styles/_typography.sass","../../../styles/_normalize.sass","../../../styles/_colors.sass","../../../styles/_forms.sass","../../../styles/_structure.sass"],"names":[],"mappings":"AAGA;EACI;;;AAEJ;EACI;EACA;;;AAEJ;EACI;EACA;;;AAEJ;EACI;EACA;;;AChBJ;EACI;EACA;EACA;;;AAEJ;EACI;;;AAEJ;AAAA;AAAA;AAAA;AAAA;AAAA;EAMI;;;AAEJ;EACI;EACA;EACA;;;AAEJ;AAAA;AAAA;EAGI;;;AAEJ;EACI;;;AAEJ;EACI;EACA;EACA;;;AAEJ;EACI;EACA;;;AACJ;EACI;EACA;;;AAEJ;AAAA;EAEI;;;AAEJ;EACI;EACA;EACA;;;AAEJ;AAAA;EAEI;EACA;;;AAGJ;AAAA;EAEI;EACA;;;AAEJ;EACI;;;AAEJ;EACI;EACA;;;AAEJ;EACI;;;AAEJ;AAAA;EAEI;EACA;EACA;EACA;;;AAEJ;EACI;;;AAEJ;EACI;EACA,YCnFM;EDoFN,OCpFM;EDqFN;EACA;EACA;;;AAEJ;AAAA;EAEI;;;AAGA;EACI;EACA;;;AAER;EACI;;;AAGA;EACI;;;AAER;AAAA;AAAA;AAAA;AAAA;EAKI;EACA;EACA;EACA;;;AAEJ;AAAA;EAEI;;;AAEJ;AAAA;EAEI;;;AAEJ;AAAA;AAAA;EAGI;;;AAEJ;AAAA;AAAA;AAAA;EAII;EACA;;;AAEJ;AAAA;AAAA;AAAA;EAII;;;AAEJ;EACI;EACA;EACA;;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA;;;AAEJ;EACI;EACA;;;AAEJ;EACI;;;AAEJ;AAAA;EAEI;EACA;;;AAEJ;AAAA;EAEI;;;AAEJ;EACI;EACA;;;AAEJ;AAAA;EAEI;;;AAEJ;EACI;EACA;;;AAEJ;AAAA;EAEI;;;AAEJ;EACI;;;AAEJ;EACI;;;AAEJ;EACI;;;AAEJ;EACI;;;AEpMJ;EACI;;AACA;EACI,ODHE;;ACIN;EACI,YDHI;ECIJ,ODNE;ECOF;EACA;EACA;EACA;;;AAER;EACI;EACA;EACA;EACA;EACA;EACA;EACA,YDnBM;ECoBN,ODlBQ;;;ACoBZ;EACI;EACA;EACA,ODrBK;ECsBL;EACA,YD3BM;;;AC6BV;EACI,YD3BS;EC4BT,OD/BM;ECgCN;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEJ;EACI;EACA;EACA;EACA;EACA;EACA,OD9CM;;;ACgDV;EACI;EACA,OD9CK;;;ACgDT;AACI;EACA;EACA,ODnDK;;;ACqDT;AACI;EACA;EACA,ODxDK;;;AC0DT;EACI;EACA,OD5DK;;;AEJT;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE,YFLK;EEML;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE,OFpBI;EEqBJ;EACA;;AAEA;EACE;;AAEJ;EACE,YFvBG;EEwBH,OF1BO;EE2BP;EACA;;AAEF;EACE,YF7BG;EE8BH,OFhCO;EEiCP;EACA;;AACF;EACE,OFtCO;EEuCP;;AAEF;EACE;EACA,MFxCG;;AE0CL;EACE,YF/CI;EEgDJ;EACA;EACA;;AACA;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;;AACF;EACE;EACA;EACA;;AACJ;EACE;EACA;EACA;EACA;EACA,OFzEE;;AE0EF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;;AACN;EACE;;AACA;EACE,YFxFC;EEyFD;EACA;EACA;EACA;EACA;EACA;;AACA;EACE,YFhGD;;AEkGT;EACE;EACA,YFjGG;EEkGH;EACA;EACA;EAEA,OFrGG;;AEsGH;EACE;EACA;EACA;EACA;EAEA,YF7GC;EE8GD;EACA,OF9GC;EE+GD;;AAGA;EACE;;AACA;EACE;EACA;;AACF;EACE,OF7HF;;AE8HA;EACE;;AAIE;EACE,YF/HP;EEgIO;EACA,OFlIP;EEmIO;EACA;;AACN;EACE;EACA;EACA;EACA,YFzIH;;AE0IG;EACE;EACA;;AAEJ;EACE;;AACA;EACE;EACA;EACA;EACA;EACA,OFzJJ;;AE0JE;EACE;EACA;EACA;EACA;;AACA;EACE,OF/JH;EEgKG;EACA;EACA;EACA;;AACV;EACE;EACA,YFvKE;;AEwKF;EACE,OFrKD;;AEsKD;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA,OFjLC;EEkLD;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;;AACF;EACE,YFvLH;EEwLG,OFzLH;EE0LG;EACA;;AAER;EACE,YF9LG;EE+LH;EACA,OFpMI;EEqMJ;EACA;EACA;;AACA;EACE;EACA;EACA;;AACA;EACE,OF5MG;;AEkNP;EACE;;AACF;EACE;;AAKM;EACE;;AAIV;EACE;;AAGE;EACE;;AACA;EACE;;AAGF;EACE;;AAIR;EACE;;AAGA;EACE;;AACA;EACE;;AAEA;EACE","file":"base.css"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save