Compare commits

...

107 Commits

Author SHA1 Message Date
Marcel Kapfer 36bef95804
Updated README 2018-01-04 00:50:36 +01:00
Marcel Kapfer 49cc36a5c8
Added feature graphic. 2018-01-04 00:36:51 +01:00
Marcel Kapfer 776789da6c Merge branch 'stable' of gitlab.com:mmk2410/rangitaki 2017-05-20 21:03:30 +02:00
Marcel Kapfer 9665f098db README: add Gitter chatroom badge 2017-05-20 21:01:42 +02:00
Marcel Kapfer (mmk2410) b775ab99eb Added tests for BlogListGenerator 2016-12-30 00:05:40 +01:00
Marcel Kapfer (mmk2410) 00d3149360 Hide url blogs from selection field in the rcc 2016-12-30 00:05:01 +01:00
Marcel Kapfer (mmk2410) 623395064f composer update 2016-12-30 00:04:12 +01:00
Marcel Kapfer (mmk2410) 9ac51e0523 Improved testability of BlogListGenerator 2016-12-29 21:59:55 +01:00
Marcel Kapfer (mmk2410) 89e756819d Made BlogListGenerator PSR-2 conform 2016-12-29 21:54:37 +01:00
Marcel Kapfer (mmk2410) 0bb2dede4d Nav item with link to external page 2016-12-29 09:40:35 +01:00
Marcel Kapfer (mmk2410) 65263d4ca0 Added emacs files to gitignore 2016-12-29 09:39:59 +01:00
Marcel Kapfer (mmk2410) 161cfc3187 Merge branch 'release-1.5.0' into stable 2016-08-03 18:34:51 +02:00
Marcel Kapfer (mmk2410) 72bbd8d046 Version bump to 1.5.0 2016-08-03 18:32:40 +02:00
Marcel Kapfer (mmk2410) 92451f15ea Update Script for 1.5.0 2016-08-03 18:29:16 +02:00
Marcel Kapfer (mmk2410) c1a7ede3bc Better code style 2016-08-03 17:19:59 +02:00
Marcel Kapfer (mmk2410) 1aa4b42c0c Prevented a few error logs 2016-08-03 17:16:58 +02:00
Marcel Kapfer (mmk2410) 54132c7218 added excerpt feature to config script 2016-08-03 16:38:50 +02:00
Marcel Kapfer (mmk2410) b439cf27d7 removed nearly useless debug script 2016-08-03 16:33:01 +02:00
Marcel Kapfer (mmk2410) bbdacffc7d Excerpt feature. https://phab.mmk2410.org/T121
Res T121
2016-08-02 19:53:08 +02:00
Marcel Kapfer (mmk2410) 72e11c425e theme recompile 2016-08-02 19:50:54 +02:00
Marcel Kapfer 34e9dd31e4 Merge branch 'correct-meta-tags' into 'master'
correct meta tags

Correct https://gitlab.com/mmk2410/rangitaki/merge_requests/2 

See merge request !3
2016-07-17 09:58:13 +00:00
Stefan 4aeb468fe1 correct meta tags 2016-07-17 08:42:46 +02:00
Marcel Kapfer (mmk2410) e6245524a4 better code style for ArticleGenerator::getArray 2016-06-06 22:22:16 +02:00
Marcel Kapfer (mmk2410) 17e4e5570e "temporary" fix for ArticleGenerator::getSummary 2016-06-06 22:21:38 +02:00
Marcel Kapfer (mmk2410) ad2ff5236b unit test for ArticleGenerator 2016-06-06 22:19:49 +02:00
Marcel Kapfer (mmk2410) 67186f6910 Unit test for Config.php 2016-06-05 22:37:05 +02:00
Marcel Kapfer (mmk2410) 25f1ff3188 still trying to make gitlab ci work 2016-06-04 16:46:36 +02:00
Marcel Kapfer (mmk2410) 6b7bf70ec1 Fixed .gitlab-ci.yml 2016-06-04 10:13:01 +02:00
Marcel Kapfer (mmk2410) 8dc9b50d38 Fixed .gitlab-ci.yml 2016-06-04 10:10:50 +02:00
Marcel Kapfer (mmk2410) cc053c88a1 Fixed .gitlab-ci.yml 2016-06-04 10:07:35 +02:00
Marcel Kapfer (mmk2410) d01570a451 Fixed .gitlab-ci.yml 2016-06-04 10:06:15 +02:00
Marcel Kapfer (mmk2410) 92166b921e Add .gitlab-ci.yml 2016-06-04 10:00:38 +02:00
Marcel Kapfer (mmk2410) 03a24c883b tests 2016-06-04 09:59:11 +02:00
Marcel Kapfer (mmk2410) f938e60c2e Merge branch 'master' of gitlab.com:mmk2410/rangitaki 2016-06-04 09:46:34 +02:00
Marcel Kapfer (mmk2410) 7532af8a80 init script for debugging 2016-06-04 09:45:59 +02:00
Marcel Kapfer (mmk2410) c20c0b4ff9 Merge branch 'stable' of gitlab.com:mmk2410/rangitaki into stable 2016-06-03 16:46:31 +02:00
Marcel Kapfer (mmk2410) 1d79aa4c21 Merge branch 'release-1.4.4' into stable 2016-06-03 16:45:54 +02:00
Marcel Kapfer (mmk2410) 39f022d2dd Version bump to 1.4.4 2016-06-03 16:41:53 +02:00
Marcel Kapfer (mmk2410) e994eb074a Update Script for 1.4.4 2016-06-03 16:39:47 +02:00
Marcel Kapfer (mmk2410) f1cfc0c08c feed: Switched to new PicoFeed implementation 2016-06-03 15:31:37 +02:00
Marcel Kapfer (mmk2410) 6d1a7c7e09 feed: New dependencies, YAML config 2016-06-03 15:30:41 +02:00
Marcel Kapfer (mmk2410) 9fa47ecfd5 Updated copyright text 2016-06-03 15:28:02 +02:00
Marcel Kapfer (mmk2410) 0baffcc5cf Check first if value exists 2016-06-03 15:25:59 +02:00
Marcel Kapfer (mmk2410) 352095a6d2 Fixed .gitignore to prevent hiding the rcc/feed directory.
Ref T118
2016-06-03 15:20:09 +02:00
Marcel Kapfer (mmk2410) 6c9aa05cbb Merge branch 'release-1.4.3' into stable 2016-05-21 21:22:49 +02:00
Marcel Kapfer (mmk2410) 7210e8e1e1 Version bump to 1.4.3 2016-05-21 21:20:47 +02:00
Marcel Kapfer (mmk2410) 8eab76ed20 Update script for version 1.4.3: fixes 2016-05-21 21:20:00 +02:00
Marcel Kapfer (mmk2410) 780db2ae07 Update script for version 1.4.3 2016-05-21 21:06:13 +02:00
Marcel Kapfer (mmk2410) 0c080a2237 Updated texts 2016-05-21 19:57:36 +02:00
Marcel Kapfer (mmk2410) fcb64f23eb nextDESIGN added to delivered themes 2016-05-21 19:51:56 +02:00
Marcel Kapfer (mmk2410) f497b7b87b [FIX] Background layer not removed if drawer closes 2016-05-21 19:49:33 +02:00
Marcel Kapfer (mmk2410) bdc617ffef [FIX] Missing space in drawer between "Blogs on" and blogname. 2016-05-21 19:46:33 +02:00
Marcel Kapfer (mmk2410) e05dc0b173 Merge branch 'release-1.4.2' into stable 2016-05-18 14:52:30 +02:00
Marcel Kapfer (mmk2410) a6019319a2 Version bump 1.4.2 2016-05-18 14:51:13 +02:00
Marcel Kapfer (mmk2410) 71f67d506e Update Script for 1.4.2 2016-05-18 14:47:51 +02:00
Marcel Kapfer (mmk2410) b67c9b3415 FIX: Password verification not implemented in RCC login page 2016-05-18 14:46:10 +02:00
Marcel Kapfer (mmk2410) e059544e90 Merge branch 'release-1.4.1' into stable 2016-05-18 13:37:42 +02:00
Marcel Kapfer (mmk2410) 3a8494417e Version bump to 1.4.1 2016-05-18 13:33:28 +02:00
Marcel Kapfer (mmk2410) d33ff8f984 Update script for 1.4.1 2016-05-18 13:32:44 +02:00
Marcel Kapfer (mmk2410) 007aea9b10 FIX: Missing nodejs dependencies 2016-05-18 07:39:41 +02:00
Marcel Kapfer (mmk2410) 52835db8db FIX: Go Back didn't work 2016-05-18 07:38:40 +02:00
Marcel Kapfer (mmk2410) fb937319db Store password as hash
Resolves T117
2016-05-17 22:37:36 +02:00
Marcel Kapfer (mmk2410) 5e45579ef1 Switch to HTTP Basic Auth
Resolves T115
2016-05-17 22:36:26 +02:00
Marcel Kapfer (mmk2410) 42f1992c97 Require SSL for the RCC.
Resolves T116
2016-05-17 22:34:33 +02:00
Marcel Kapfer (mmk2410) 655b982f9d FIX: Missing nodejs dependencies 2016-05-17 20:59:54 +02:00
Marcel Kapfer (mmk2410) 1b0c92bb31 FIX: Disqus not migrated to new config 2016-05-17 20:58:50 +02:00
Marcel Kapfer (mmk2410) e2d8082c1f Merge branch 'release-1.4.0' into stable 2016-05-07 17:43:03 +02:00
Marcel Kapfer (mmk2410) 23617b21bc Version bump to 1.4.0 2016-05-07 17:41:31 +02:00
Marcel Kapfer (mmk2410) 41c273b962 update script for 1.4.0 2016-05-07 17:32:30 +02:00
Marcel Kapfer (mmk2410) 60b094d5fa add composer's vendor directory 2016-05-07 12:59:40 +02:00
Marcel Kapfer (mmk2410) 01a3860d73 Merged CHANGELOG.txt and CHANGELOG.md 2016-05-03 17:35:42 +02:00
Marcel Kapfer (mmk2410) 999998b60b Version Bump to 1.4.0-beta 2016-04-27 12:54:04 +02:00
Marcel Kapfer (mmk2410) 474efd25f3 npm, Gulp, Minimize
Resolves T30, T29
2016-04-26 20:24:17 +02:00
Marcel Kapfer (mmk2410) bc694dc6a0 CSS themes converted in SASS
Ref T30
2016-04-26 19:35:46 +02:00
Marcel Kapfer (mmk2410) 8330a1ce98 CSS rewritten in SASS
Ref T30
2016-04-26 19:09:39 +02:00
Marcel Kapfer (mmk2410) e10db31a00 Example JavaScript extension rewritten in CoffeeScript
Ref T30
2016-04-26 17:57:39 +02:00
Marcel Kapfer (mmk2410) d50341259d Rewritten app.js in CoffeeScript
Ref T30
2016-04-25 20:33:00 +02:00
Marcel Kapfer (mmk2410) 432b8d307a Open article link in a new tab
Fixes T34
2016-04-25 18:47:02 +02:00
Marcel Kapfer (mmk2410) 5d051c1b0e init script 2016-04-23 15:27:11 +02:00
Marcel Kapfer (mmk2410) 319d3d6138 Pagination fix 2016-04-23 15:26:35 +02:00
Marcel Kapfer (mmk2410) 297cf418c0 Better code style 2016-04-22 19:46:46 +02:00
Marcel Kapfer (mmk2410) ac65f5ee70 Config switch to YAML 2016-04-22 19:28:27 +02:00
Marcel Kapfer (mmk2410) edca0cc8cc removed obsolete config.php 2016-04-22 18:50:07 +02:00
Marcel Kapfer (mmk2410) 9773669684 Config switch script 2016-04-22 18:49:14 +02:00
Marcel Kapfer (mmk2410) f632bf2de5 Remove Debug Outputs 2016-04-22 18:20:40 +02:00
Marcel Kapfer (mmk2410) e0dc2622c2 API auth 2016-04-22 18:18:21 +02:00
Marcel Kapfer (mmk2410) 39da838ebd RCC init script 2016-04-21 09:56:53 +02:00
Marcel Kapfer (mmk2410) d82f8e8011 Config class: write yaml file 2016-04-21 09:46:45 +02:00
Marcel Kapfer (mmk2410) 4e91eeb3ab API: Auth implementation 2016-04-18 17:30:12 +02:00
Marcel Kapfer (mmk2410) 01a6fb914f API: Media files 2016-04-18 11:04:41 +02:00
Marcel Kapfer (mmk2410) 339e2eee36 Composer: codeguy/Upload 2016-04-18 11:04:26 +02:00
Marcel Kapfer (mmk2410) 2c4ce6cb50 API: List 2016-04-18 09:57:11 +02:00
Marcel Kapfer (mmk2410) 9947a5f033 Cleanup 2016-04-18 09:56:52 +02:00
Marcel Kapfer (mmk2410) cb491341df Better code with isset() 2016-04-18 09:53:47 +02:00
Marcel Kapfer (mmk2410) 6d1928da70 YAML Config Implement and post api 2016-04-17 17:00:18 +02:00
Marcel Kapfer (mmk2410) 331465857c README.md update 2016-04-17 10:45:57 +02:00
mmk2410 e9c09311fe Fix: Feeds didn't show article content 2016-03-12 10:28:46 +01:00
mmk2410 681f4c3c83 Fix; Problem inserting password after instering wrong password 2016-03-11 18:58:26 +01:00
mmk2410 75b705ee2c Code Improvements 2016-03-11 18:54:58 +01:00
mmk2410 08ee5eaf39 Update script fix 2016-02-16 17:21:41 +01:00
Marcel Kapfer (mmk2410) 078237c7ec Update Readme
Update readme for Rangitaki version 1.3.
2016-02-16 15:11:25 +01:00
mmk2410 05d583f17f Changelog 2016-02-16 14:54:07 +01:00
mmk2410 fda6e3d811 Switch to Composer 2016-02-16 14:19:57 +01:00
mmk2410 ce709fec80 Atom feed 2016-02-16 14:19:17 +01:00
mmk2410 5d041ff6f8 Do-not-track 2016-02-16 14:16:20 +01:00
mmk2410 bd28332252 Update Script for 1.3.0 2016-02-16 14:15:56 +01:00
mmk2410 c9279b8f1d File imporvements 2016-02-16 14:15:21 +01:00
734 changed files with 47442 additions and 1843 deletions

4
.gitignore vendored
View File

@ -1,3 +1 @@
nbproject/
.idea/
completer.hist
*~

11
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,11 @@
image: php:7.0
before_script:
- bash ci/docker_install.sh > /dev/null
stages:
- test
test:
script:
- phpunit tests/

191
CHANGELOG.md Normal file
View File

@ -0,0 +1,191 @@
# Changelog
- [S] = stable release
- [B] = beta release
- [D] = development release
- [S] release are always compared to the previous [S] release.
## Version 1.5.0 (2016-08-03) [S]
- **[FEATURE]** Ability to only show post excerpts on overview pages
- **[FIX]** Fixed twitter username not specified in connfig.yaml
- **[FIX]** Fixed wrong OpenGraph meta tags
- **[CODE]** Further improved code style
- **[CODE]** Added unit tests for Config.php and ArticleGenerator.php
- **[NOTE]** If you have own language file, please update them. See also the upgrade guide
## Version 1.4.4 (2016-06-03) [S]
- **[FIX]** Error when trying to create a feed
## Version 1.4.3 (2016-05-21) [S]
- **[FIX]** Missing space in drawer between "Blogs on" and blogname
- **[FIX]** Background layer was not removed if drawer was closed
- **[FEATURE]** nextDESIGN theme added to delivered themes
- **[NOTE]** The update script to 1.4.3 works with 1.4.0, 1.4.1 and 1.4.2
## Version 1.4.2 (2016-05-18) [S]
- [FIX]: Password verification not implemented in RCC login page
## Version 1.4.1 (2016-05-18) [S]
- Switch to HTTP Basic Auth for the RCC API
- Store password as hash
- Require SSL for using the RCC and the RCC API
- [FIX] Drawer "Go back" does not work
- [FIX] Missing nodejs dependencies
- [FIX] Disqus not completly migrated to new config
## Version 1.4.0 (2016-05-07) [S]
- Fix: Feeds contain no text
- Switch to YAML as config language
- Scripts for
- Switching from config.php to config.yaml
- Initializing RCC
- Initializing Rangitaki
- Rangitaki API
- Switch from JavaScript to CoffeeScript
- Switch from CSS to SASS
- Building and minimizing with Gulp
- Open links in articles in a new tab
- Better code style: PSR-2
## Version 1.4.0-beta (2016-04-27) [B]
- Fix: Feeds contain no text
- Switch to YAML as config language
- Scripts for
- Switching from config.php to config.yaml
- Initializing RCC
- Initializing Rangitaki
- Rangitaki API
- Switch from JavaScript to CoffeeScript
- Switch from CSS to SASS
- Building and minimizing with Gulp
- Open links in articles in a new tab
- Better code style: PSR-2
## Version 1.3.0 (2016-02-16) [S]
- Respecting do-not-track
- Atom feed
- Title fix
- Switch to composer
## Version 1.2.1 (2016-01-11) [S]
- Support for PHP 7
## Version 1.2.0 (2015-12-24) [S]
- Pagination: Split your blog posts over several page
- JavaScript Extension Support
- RCC: Write Posts
- RCC: Delete Posts
- RCC: Upload Media
- RCC: Edit Posts
## Version 1.1.90 (2015-12-21) [B]
- BUGFIX: ArticleGenerator error when no tags set
- Pagination: Localized strings
## Version 1.1.2 (2015-12-20) [D]
- Pagination
- Code style imporvements
## Version 1.1.1 (2015-12-07) [D]
- BUGFIX: RCC: new post: post title was the blog title
- BUGFIX: RCC: new post filename just the date without the time.
- Code highlight css themable
- JavaScript extension support. Just put your extension into ./extensions/
- Link in RCC to go directly to the blog
- RCC: Delete posts
- RCC: Edit posts
## Version 1.1.0 (2015-11-22) [D]
- RCC: Write blog posts
- RCC: Media Upload
- Drawer: Key listener ('ESC' to close, 'm; to open)
- Drawer: Highlight Blogs when hovering
- Drawer: 'X' button
- Metatags / Title based on subblog and / or article
- Update script
## Version 1.0.0 (2015-08-22) [S]
- Post writing in Markdown with a few keywords for the title, tags, date and the author (all optional)
- Multiple blogs
- A Subpages for each article with a comment box (Disqus; can be disabled)
- Share buttons (FAB; can be disabled)
- Disqus integration (can be disabled)
- Fast and easy configuration
- Google Analytics (optional)
- Twitter and OpenGraph meta tags
- Different themes
- Easy localization (just 3 (!) strings)
- Custom footer
- Navigation drawer (can be disabled)
- Tags
- Set author and date
- Mobile-first
- Rangitaki Control Center (aka RCC; optional, Read the RCC Documentation)
- Online post upload
## Version 0.9.0 (2015-07-25) [B]
- BUGFIX: 'Blogs of {BLOG NAME}' always shown (even if there are no other blogs)
- pictures in articles not centred
- long links longer than article card (especially a problem on mobile devices)
- Localization strings are now grouped in one array
- Better code (in some parts)
## Version 0.8.0 (2015-07-14) [B]
- Bugfixes and other improvements
## Version 0.7.0 (2015-07-05) [D]
## Version 0.6.0 (2015-07-03) [D]
- Localization support. More information will follow soon
- Theme support. More information will follow (hopefully) soon
- Various improvements (Check the commits for more)
## Version 0.5.0 (2015-06-16) [D]
- Improvements to the Rangitaki Control Center (rcc)
- Material Design (Blog and rcc)
## Version 0.4 (2015-06-14) [D]
- Multiple Blogs
- Online post upload (optional)
- Tags
- Author
## Version 0.3 (2015-06-11) [D]
- Portation of all main features of Version 0.2.2
- Code highlighting
*The first release with the name Rangitaki.
The following releases are of pBlog.*
## Version 0.2.2 (2015-05-13) [S]
- Links are now underlined, when you hover over them
- Simplified it to add the disqus comments
- Added and configuration option for setting a favicon
- Added the option to use Google Analytics
## Version 0.2.1 / pBlog 2.1 (2015-03-29) [S]
- Fix problems when creating article links
TODO: previous releases

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Marcel Kapfer
Copyright (c) 2015 - 2016 Marcel Kapfer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,18 +1,20 @@
# Rangitaki PHP blogging engine
[![Join the chat at https://gitter.im/rangitaki/rangitaki](https://badges.gitter.im/canax/view.svg)](https://gitter.im/rangitaki/view?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Rangitaki is a simple to use and easy to configure blogging engine, written in PHP and it has absolutely no database dependencies.
Tested with PHP version 5.5 until 7.0.
![Rangitaki](https://marcel-kapfer.de/blog/media/with-name.png)
![Rangitaki](https://gitlab.com/mmk2410/rangitaki/raw/master/feature-graphic.png)
[Website](https://marcel-kapfer.de/rangitaki)
[Wiki](https://gitlab.com/mmk2410/rangitaki/wikis/home)
[About](https://marcel-kapfer.de/rangitaki/about)
[About](https://gitlab.com/mmk2410/rangitaki/wikis/about)
[Documentation](https://marcel-kapfer.de/rangitaki/docs)
[Documentation](https://gitlab.com/mmk2410/rangitaki/wikis/docs)
[Quick Starting Guide](https://marcel-kapfer.de/rangitaki/docs/quick)
[Quick Starting Guide](https://gitlab.com/mmk2410/rangitaki/wikis/docs/quickstart)
## What is it?
@ -29,7 +31,7 @@ My goal for Rangitaki was (and still is) to create a blogging engine without dat
- Google Analytics (optional)
- Twitter and OpenGraph meta tags
- Different themes
- Easy localization (just 3 (!) strings)
- Easy localization (just a few strings)
- Custom footer
- Navigation drawer (can be disabled)
- Tags
@ -37,15 +39,15 @@ My goal for Rangitaki was (and still is) to create a blogging engine without dat
- Mobile-first
- JavaScript Extension Support
- Pagination support
- Rangitaki Control Center (RCC; optional, read the [RCC Documentation](https://marcel-kapfer.de/rangitaki/docs/rcc))
- Online post upload
- More will come...
- Atom feed generation
- Rangitaki Control Center (RCC; optional, read the [RCC Documentation](https://gitlab.com/mmk2410/rangitaki/wikis/docs/rcc)
- Have a look under 'What is that RCC?' in this readme
## Did you say 'themes'?
Yes. Rangitaki has a theme support which makes it easy to customize your blog concerning design.
[Read the theme guide](https://marcel-kapfer.de/rangitaki/docs/themes)
[Read the theme guide](https://gitlab.com/mmk2410/rangitaki/wikis/docs/themes)
## What is that RCC?
@ -56,39 +58,34 @@ It has the following features:
- Post deleting
- Post editing
- Media upload
- Atom feed generation
[Read the RCC documentation](https://marcel-kapfer.de/rangitaki/docs/rcc)
[Read the RCC documentation](https://gitlab.com/mmk2410/rangitaki/wikis/docs/rcc)
## Where can I see an example?
## Used Libraries
- Official Rangitaki blog [marcel-kapfer.de/rangitaki/blog](https://marcel-kapfer.de/rangitaki/blog)
- My personal blog
[marcel-kapfer.de/blog](https://marcel-kapfer.de/blog)
Would you like to see your Rangitaki blog here? Write me a message at [marcelmichaelkapfer@yahoo.co.nz](mailto:marcelmichaelkapfer@yahoo.co.nz)
## Used Library
- For converting the Markdown blog articles into HTML code I use [Parsedown](http://parsedown.org)
- For converting the Markdown blog articles into HTML code Rangitaki uses [Parsedown](http://parsedown.org).
- For creating the atom feeds Rangitaki uses [picoFeed](https://github.com/fguillot/picoFeed)
## Contributing
## Issues, Requests, etc.
For bug reports, feature requests and all other questions or recommendations feel free to create an issue here at [GitLab](https://gitlab.com/mmk2410/rangitaki/issues).
## Code
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create New Pull Request
5. Create new merge request
Read also the [contributing documentation](https://marcel-kapfer.de/rangitaki/docs/contrib)
Read also the [contributing documentation](https://gitlab.com/mmk2410/rangitaki/wikis/docs/contribute)
## Social
You can follow my personal Twitter and Google+ account to receive news about the Rangitaki blogging engine.
You can follow me on Twitter or subscribe my blog to receive news about Rangitaki.
- [Twitter @mmk2410](https://twitter.com/mmk2410)
- [Google+ +MarcelKapfer](https://plus.google.com/+MarcelMichaelKapfer/posts)
## Trello
- [Trello Board](https://trello.com/b/7qb5I6EQ/rangitaki)
- [Blog mmk2410.org](https://mmk2410.org/), you can view the current posts about Rangitaki on [this page](https://mmk2410.org/tag/rangitaki/).

67
bin/config.php Normal file
View File

@ -0,0 +1,67 @@
<?php
// Marcel Kapfer (mmk2410)
// Script for moving from config.php to config.yaml
// License: MIT
require 'res/php/Config.php';
require 'config.php';
use mmk2410\rbe\config\Config as Config;
if ($bloghome == "yes") {
$bloghome = "on";
}
if ($blogintro == "yes") {
$blogintro = "on";
}
if ($sharefab == "yes") {
$sharefab = "on";
}
if ($rcc == "yes") {
$rcc = "on";
}
if ($nav_drawer == "yes") {
$nav_drawer = "on";
}
$yaml = array(
"blog" => array(
"title" => $blogtitle,
"author" => $blogauthor,
"description" => $blogdescription,
"home" => $bloghome,
"homeurl" => $bloghomeurl,
"homename" => $bloghomename,
"mainname" => $blogmainname,
"intro" => $blogintro,
"disqus" => $blogdisqus,
"analytics" => $bloganalytics,
"footer" => $blogfooter,
"url" => $blogurl
),
"design" => array(
"fab" => $sharefab,
"drawer" => $nav_drawer,
"theme" => $theme,
"pagination" => $pagination,
"favicon" => $favicon,
),
"rcc" => array(
"rcc" => "off",
"api" => "off",
),
"language" => $language,
);
$config = new Config('config.yaml', 'vendor/autoload.php');
if ($config->writeConfig($yaml)) {
echo "YAML config saved.\nYou can delete the config.php file\n";
} else {
echo "Failed to save YAML config.";
}

112
bin/init.php Normal file
View File

@ -0,0 +1,112 @@
<?php
// Marcel Kapfer (mmk2410)
// PHP script for initializing Rangitaki
// MIT License
error_reporting(0);
require 'res/php/Config.php';
use mmk2410\rbe\config\Config as Config;
$config = new Config('config.yaml', 'vendor/autoload.php');
if (!file_exists('config.yaml')) {
$yaml = array();
} else {
$yaml = $config->getConfig();
}
// blog part
$yaml["blog"]["title"] = get("Title of your blog", $yaml["blog"]["title"], "Example Blog");
$yaml["blog"]["author"] = get("Your name:", $yaml["blog"]["author"], "John");
$yaml["blog"]["description"] = get("A description of your blog:", $yaml["blog"]["description"], "A short description of your blog");
$yaml["blog"]["home"] = getBool("Do you have a top site? (on/off)", $yaml["blog"]["home"], "on");
if ($yaml["blog"]["home"] == "on") {
$yaml["blog"]["homeurl"] = get("Path / Url to home page", $yaml["blog"]["homeurl"], "../");
$yaml["blog"]["homename"] = get("Name of your home page", $yaml["blog"]["homename"], "Home");
}
$yaml["blog"]["mainname"] = get("Name of the main blog (if empty, the blog title will be used)", "");
$yaml["blog"]["intro"] = getBool("Do you want a blog intro text? (on/off)", $yaml["blog"]["intro"], "on");
$yaml["blog"]["disqus"] = get("Your Disqus shortname (Leave empty to disable)", $yaml["blog"]["disqus"], "");
$yaml["blog"]["analytics"] = get("Google Analytics ID (Leave empty to disable)", $yaml["blog"]["analytics"], "");
$yaml["blog"]["footer"] = get("The footer of your blog", $yaml["blog"]["footer"], "Example Blog 2016 CC-BY-SA 4.0");
// design part
$yaml["design"]["fab"] = getBool("Would you like to use the share buttons (on/off)", $yaml["design"]["blog"], "on");
$yaml["design"]["drawer"] = getBool("Would you like the use the navigation drawer? (on/off)", $yaml["design"]["drawer"], "on");
$themes = getDir('./themes');
$yaml["design"]["theme"] = get("Which theme would you like to use? (" . $themes . ")", $yaml["design"]["theme"], "material-light");
$yaml["design"]["pagination"] =
get("Which posts should be displayed on one page (0 to disable)", $yaml["design"]["pagination"], "0");
$yaml["design"]["excerpt"] =
getBool("Should be overview pages only show a excerpt of the full posts? (on/off)", $yaml["design"]["excerpt"], "off");
$yaml["design"]["favicon"] = get("URL to your favicon", $yaml["design"]["favicon"], "https://example.com/fav.ico");
// rcc
$yaml["rcc"]["rcc"] = "off";
$yaml["rcc"]["api"] = "off";
// languages
$langs = getDir('./lang');
$yaml["language"] = get("Choose a language (" . $langs . ")", $yaml["language"], "en");
// social media
$yaml["social"]["twitter"] = get("Your Twitter username:", $yaml["social"]["twitter"], "");
$config->writeConfig($yaml);
function get($question, $value, $default)
{
if (isset($value) && $value != "") {
$input = readline($question . " (" . $value . "): ");
if ($input == "") {
return $value;
} else {
return $input;
}
} else {
$input = readline($question . " (" . $default . ")" . ": ");
if ($input == "") {
return $default;
} else {
return $input;
}
}
}
function getBool($question, $value, $default)
{
if (isset($value) && $value != "") {
$input = "someval";
while (!in_array($input, array("on", "off", ""))) {
$input = readline($question . " (" . $value . "): ");
}
if ($input == "") {
return $value;
} else {
return $input;
}
} else {
$input = "";
while (!in_array($input, array("on", "off"))) {
$input = readline($question . " (" . $default . ")" . ": ");
}
if ($input == "") {
return $default;
} else {
return $input;
}
}
}
function getDir($path)
{
$dir = scandir($path, SCANDIR_SORT_DESCENDING);
unset($dir[sizeof($dir) - 1]);
unset($dir[sizeof($dir) - 1]);
return implode(", ", $dir);
}

76
bin/init_rcc.php Normal file
View File

@ -0,0 +1,76 @@
<?php
// Marcel Kapfer (mmk2410)
// PHP script for initializing the RCC
// License: MIT
require 'res/php/Config.php';
use mmk2410\rbe\config\Config as Config;
echo 'RCC Initializion Script' . "\n";
$username = readline("Username: ");
if ($username == "") {
echo "No username given. Aborting...\n";
exit();
}
echo 'Password: ';
$password = readline("Password: ");
if ($password == "") {
echo "No password given. Aborting...\n";
exit();
}
$options = [
'cost' => 12
];
$password = password_hash($password, PASSWORD_BCRYPT, $options);
$username = '$username = "' . $username . '";';
$password = '$password = \'' . $password . '\';';
$file = '<?php' . "\n" . $username . "\n" . $password . "\n";
if (file_put_contents('./rcc/password.php', $file)) {
chmod('./rcc/password.php', 0640);
echo "\nPassword successfully saved.\n";
}
$config = new Config('config.yaml', 'vendor/autoload.php');
$yaml = $config->getConfig();
$rccOn = "";
while (!(in_array($rccOn, array("y", "Y", "n", "N")))) {
$rccOn = readline("Enable RCC: (y/n) ");
}
if (in_array($rccOn, array("y", "Y"))) {
$yaml["rcc"]["rcc"] = "on";
} else {
$yaml["rcc"]["rcc"] = "off";
}
$apiOn = "";
while (!(in_array($apiOn, array("Y", "y", "n", "N")))) {
$apiOn = readline("Enable RCC API: (y/n) ");
}
if (in_array($apiOn, array("y", "Y"))) {
$yaml["rcc"]["api"] = "on";
} else {
$yaml["rcc"]["api"] = "off";
}
$config = new Config('config.yaml', 'vendor/autoload.php');
if ($config->writeConfig($yaml)) {
echo "Changes saved.\n";
} else {
echo "Failed to save changes.\n";
}

2
blogs/external.md Normal file
View File

@ -0,0 +1,2 @@
%TITLE: Docs
%URL: https://mmk2410.org/rangitaki/docs/

View File

@ -2,13 +2,8 @@
This is the Blog of the Blog Engine **Rangitaki**
Rangitaki is based on PHP, XML and Markdown. It is easy to install and to configure.
Rangitaki is based on PHP and Markdown. It is easy to install and to configure.
The latest Version of the 0.2 series is **0.2.2**
The latest version of Rangitaki is 1.4.3.
The latest Version of the development stream isn' ready yet.
** !IMPORTANT! Please read [this](index.php?article=About-the-Future-of-pBlog) for more information about the different versions of pBlog.**
You can find the source code on [GitHub](https://github.com/mmk2410/Rangitaki).
You can find the source code on [GitLab](https://gitlab.com/mmk2410/rangitaki).

15
ci/docker_install.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Only install dependencies for Docker
[[ ! -e /.dockerenv ]] && [[ ! -e /.dockerinit ]] && exit 0
set -xe
# Install git
apt-get update -yqq
apt-get install git -yqq
# Install phpunit
curl -o /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar
chmod +x /usr/local/bin/phpunit

20
composer.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "mmk2410/rangitaki",
"description": "A simple PHP blogging engine without any database requirements",
"type": "project",
"require": {
"erusev/parsedown": "^1.6",
"fguillot/picofeed": "^0.1.18",
"slim/slim": "^3.0",
"symfony/yaml": "^3.0",
"codeguy/upload": "^1.3"
},
"license": "MIT License",
"authors": [
{
"name": "Marcel Kapfer (mmk2410)",
"email": "marcelmichaelkapfer@yahoo.co.nz"
}
],
"minimum-stability": "stable"
}

496
composer.lock generated Normal file
View File

@ -0,0 +1,496 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "ccdcfdb56ed68253e2388261fbb6d1b3",
"packages": [
{
"name": "codeguy/upload",
"version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/codeguy/Upload.git",
"reference": "6a9e5e1fb58d65346d0e557db2d46fb25efd3e37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codeguy/Upload/zipball/6a9e5e1fb58d65346d0e557db2d46fb25efd3e37",
"reference": "6a9e5e1fb58d65346d0e557db2d46fb25efd3e37",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"autoload": {
"psr-0": {
"Upload": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": "http://www.joshlockhart.com/"
}
],
"description": "Handle file uploads with extensible validation and storage strategies",
"homepage": "http://github.com/codeguy/Upload",
"keywords": [
"file",
"upload",
"validation"
],
"time": "2013-07-07T17:01:41+00:00"
},
{
"name": "container-interop/container-interop",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/container-interop/container-interop.git",
"reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e",
"reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Interop\\Container\\": "src/Interop/Container/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
"time": "2014-12-30T15:22:37+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.6.1",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/20ff8bbb57205368b4b42d094642a3e52dac85fb",
"reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"time": "2016-11-02T15:56:58+00:00"
},
{
"name": "fguillot/picofeed",
"version": "v0.1.28",
"source": {
"type": "git",
"url": "https://github.com/fguillot/picoFeed.git",
"reference": "9da506c308bcb40b6fc630f9123466028c03170b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fguillot/picoFeed/zipball/9da506c308bcb40b6fc630f9123466028c03170b",
"reference": "9da506c308bcb40b6fc630f9123466028c03170b",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"php": ">=5.3.0",
"zendframework/zendxml": "^1.0"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "2.0.4",
"phpunit/phpunit": "4.8.26",
"symfony/yaml": "2.8.7"
},
"suggest": {
"ext-curl": "PicoFeed will use cURL if present"
},
"bin": [
"picofeed"
],
"type": "library",
"autoload": {
"psr-0": {
"PicoFeed": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frédéric Guillot"
}
],
"description": "Modern library to handle RSS/Atom feeds",
"homepage": "https://github.com/fguillot/picoFeed",
"time": "2016-12-29T00:06:41+00:00"
},
{
"name": "nikic/fast-route",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/FastRoute.git",
"reference": "f3dcf5130e634b6123d40727d612ec6aa4f61fb3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/f3dcf5130e634b6123d40727d612ec6aa4f61fb3",
"reference": "f3dcf5130e634b6123d40727d612ec6aa4f61fb3",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"FastRoute\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov",
"email": "nikic@php.net"
}
],
"description": "Fast request router for PHP",
"keywords": [
"router",
"routing"
],
"time": "2016-10-20T17:36:47+00:00"
},
{
"name": "pimple/pimple",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a",
"reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Pimple": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Pimple, a simple Dependency Injection Container",
"homepage": "http://pimple.sensiolabs.org",
"keywords": [
"container",
"dependency injection"
],
"time": "2015-09-11T15:10:35+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "slim/slim",
"version": "3.7.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef",
"reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef",
"shasum": ""
},
"require": {
"container-interop/container-interop": "^1.1",
"nikic/fast-route": "^1.0",
"php": ">=5.5.0",
"pimple/pimple": "^3.0",
"psr/http-message": "^1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0",
"squizlabs/php_codesniffer": "^2.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Slim\\": "Slim"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Allen",
"email": "rob@akrabat.com",
"homepage": "http://akrabat.com"
},
{
"name": "Josh Lockhart",
"email": "hello@joshlockhart.com",
"homepage": "https://joshlockhart.com"
},
{
"name": "Gabriel Manricks",
"email": "gmanricks@me.com",
"homepage": "http://gabrielmanricks.com"
},
{
"name": "Andrew Smith",
"email": "a.smith@silentworks.co.uk",
"homepage": "http://silentworks.co.uk"
}
],
"description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
"homepage": "https://slimframework.com",
"keywords": [
"api",
"framework",
"micro",
"router"
],
"time": "2016-12-20T20:30:47+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "a7095af4b97a0955f85c8989106c249fa649011f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f",
"reference": "a7095af4b97a0955f85c8989106c249fa649011f",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"symfony/console": "~2.8|~3.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2016-12-10T10:07:06+00:00"
},
{
"name": "zendframework/zendxml",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/zendframework/ZendXml.git",
"reference": "7b64507bc35d841c9c5802d67f6f87ef8e1a58c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/ZendXml/zipball/7b64507bc35d841c9c5802d67f6f87ef8e1a58c9",
"reference": "7b64507bc35d841c9c5802d67f6f87ef8e1a58c9",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^3.7 || ^4.0",
"squizlabs/php_codesniffer": "^1.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"ZendXml\\": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Utility library for XML usage, best practices, and security in PHP",
"homepage": "http://packages.zendframework.com/",
"keywords": [
"security",
"xml",
"zf2"
],
"time": "2016-02-04T21:02:08+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@ -1,84 +0,0 @@
<?php
/**
* PHP Version 5.6
*
* Rangitaki Project
* This is the configuration file. You can configure here all necessary
* (and possible) options without editing the index.php file.
* Every line has an description about what you can change here.
* Don't delete any strings. You can set your value after the '=' sign
* and between the apostrophes.
*
* Make sure that every line ends with an semicolon (';').
*
* @category Config
* @package Rbe
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
// Blog Title / Set here an individual title of yourblog by replacing
// Rangitaki Blog with it.
$blogtitle = 'Example Blog';
// Blog Author - Set here your name
$blogauthor = 'John';
// Blog description
$blogdescription = 'A short description of your blog';
// Home - set yes if you want to link to your homepage and no if not
$bloghome = 'yes';
// Home URL - Set here the url to your main page. Either as a path (e.g. '../')
// or as an url (e.g. 'http://github.com')
$bloghomeurl = '../';
// Home name - Set here an individual name for your main page
$bloghomename = 'Home';
// Main Blog name -> Set a specific name for your main blog
// This value is empty by default
$blogmainname = '';
// Intro - set yes if you have a blog intro and no if you don't have one
$blogintro = 'yes';
// Disqus - Provide here your Disqus shortname. Leave empty if you don't
// want to use it.
$blogdisqus = 'rangitaki';
// Share FAB - this enables or disables the share button
$sharefab = 'yes';
// Google Analytics - Provide here your Google Analytics Tracking-ID. Leave
// empty if you don't want to use it.
$bloganalytics = '';
// Footer - set here the text for your footer (e.g. a copyright info). You can
// replace the whole text after the '=' with your own one.
$blogfooter = 'Rangitaki ' . date("Y") .
' <a href="https://github.com/mmk2410/Rangitaki" target="blank">
github.com/mmk2410/Rangitaki</a>';
// This enables the optional rangitaki control center. Please read the
// documentation before you enable it.
$rcc = 'yes';
// Here you can disable and enable the navigation menu. Usefull if you have
// no subblogs and no home directory
$nav_drawer = 'yes';
// Set here the name of your theme. Read the documentation for more themes
$theme = 'material-light';
// Set here your language. The file must exist in the lang directory
$language = "en";
// pagination: how many articles should be on one page
// set to 0 to disable it
$pagination = 0;
// Favicon - Set here the path to your favicon
$favicon = "http://example.com/res/img/favicon.png";

27
config.yaml Normal file
View File

@ -0,0 +1,27 @@
blog:
title: 'Example Blog'
author: John
description: 'A short description of your blog'
home: 'on'
homeurl: ../
homename: Home
mainname: ''
intro: 'on'
disqus: rangitaki
analytics: ''
footer: "Rangitaki 2016 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">\n gitlab.com/mmk2410/rangitaki</a>"
url: 'https://example.com/blog/'
design:
excerpt: "off"
fab: 'on'
drawer: 'on'
theme: material-light
pagination: 0
excerpt: 'off'
favicon: 'http://example.com/res/img/favicon.png'
rcc:
rcc: 'on'
api: 'on'
language: en
social:
twitter: ''

View File

@ -1,11 +1 @@
/**
* Created by mmk2410 on 12/5/15.
*
* Example JavaScript file to demonstrate the rangitaki extension support
*/
function main() {
console.log("Welcome Developer! \nYou're seeing the output of a javascript extension for the rangitaki blogging engine.")
}
$(document).ready(main());
(function(){var e;e=function(){return console.log("Welcome Developer! \nYou're seeing the output of a\nJavaScript extension for the Rangitaki blogging engine.")},$(document).ready(e())}).call(this);

BIN
feature-graphic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

14
feed/.atom Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<generator uri="https://github.com/fguillot/picoFeed">PicoFeed</generator>
<title>Example Blog</title>
<id>https://marcel-kapfer.de/rangitaki/blog/</id>
<updated>2016-02-16T10:52:47+00:00</updated>
<link rel="alternate" type="text/html" href="https://marcel-kapfer.de/rangitaki/blog/"/>
<link rel="self" type="application/atom+xml" href="https://marcel-kapfer.de/rangitaki/blog//feed/feed.atom"/>
<author>
<name>John</name>
<email></email>
<uri>https://marcel-kapfer.de/rangitaki/blog/</uri>
</author>
</feed>

67
gulpfile.coffee Normal file
View File

@ -0,0 +1,67 @@
###
2015 - 2016 (c) by Marcel Kapfer (mmk2410)
Licensed under MIT License
Rangitaki Gulp File
###
gulp = require 'gulp'
sass = require 'gulp-sass'
sourcemaps = require 'gulp-sourcemaps'
minifyCss = require 'gulp-csso'
coffee = require 'gulp-coffee'
coffeelint = require 'gulp-coffeelint'
uglify = require 'gulp-uglify'
merge = require 'merge-stream'
del = require 'del'
size = require 'gulp-size'
gulp.task 'coffee', ->
main = gulp.src './src/coffee/*.coffee'
.pipe coffeelint()
.pipe coffeelint.reporter()
.pipe coffee()
.pipe uglify()
.pipe gulp.dest './res/js/'
extensions = gulp.src './src/coffee-extensions/*.coffee'
.pipe coffeelint()
.pipe coffeelint.reporter()
.pipe coffee()
.pipe uglify()
.pipe gulp.dest './extensions/'
merge(main, extensions)
.pipe size {title: 'Coffee'}
gulp.task 'sass', ->
main = gulp.src './src/sass/*.sass'
.pipe sourcemaps.init()
.pipe sass {
outputStyle: 'compressed'
}
.pipe sourcemaps.write './'
.pipe gulp.dest './res/css/'
theme = gulp.src './src/sass-themes/*.sass'
.pipe sourcemaps.init()
.pipe sass {
outputStyle: 'compressed'
}
.pipe sourcemaps.write './'
.pipe gulp.dest './themes/'
merge(theme, main)
.pipe size {title: 'SASS'}
gulp.task 'clean', del.bind null, ['res/css/no-nav.css', 'res/css/rangitaki.css', 'themes/', 'res/js/app.js']
gulp.task 'init', ['coffee', 'sass']
gulp.task 'default', ->
gulp.watch './src/**/*.sass', ['sass']
gulp.watch './src/**/*.coffee', ['coffee']

186
index.php
View File

@ -1,15 +1,11 @@
<!DOCTYPE HTML>
<!--
Rangitaki Blogging Engine
GitHub: https://github.com/mmk2410/Rangitaki
Code: https://gitlab.com/mmk2410/rangitaki
Issus and Project Management: https://phab.mmk2410.org
Web: https://marcel-kapfer.de/rangitaki
Twitter: @Rangitaki
Google+: +Rangitaki
-->
<!--
COPYRIGHT (c) 2015 mmk2410
MIT License
2015 - 2016 Marcel Kapfer (mmk2410)
License: MIT
-->
<html>
<?php
@ -26,11 +22,22 @@ MIT License
*/
// Getting necessary php files
date_default_timezone_set('UTC');
require 'config.php'; // Config file (this must be the first line)
require './lang/' . $language . ".php"; // Language file
require_once 'res/php/Parsedown.php'; // The soul of the beast: Parsedown
require __DIR__ . '/vendor/autoload.php'; // loading composer libs
require './res/php/Config.php';
require_once './res/php/BlogListGenerator.php';
use mmk2410\rbe\config\Config as Config;
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
$configParser = new Config('config.yaml', 'vendor/autoload.php');
$config = $configParser->getConfig();
require './lang/' . $config["language"] . ".php"; // Language file
require_once 'res/php/ArticleGenerator.php'; // The article generator
require_once './res/php/BlogListGenerator.php'; // and the blog list generator
// Getting some variables ($_GET and $_SERVER)
$getblog = filter_input(INPUT_GET, "blog"); // get the blog variable
$getarticle = filter_input(INPUT_GET, "article"); // get the article variable
@ -40,16 +47,16 @@ $url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") .
$pagenumber = filter_input(INPUT_GET, "page"); // get the pagenumber
// Pagination algorithm
if ($pagination == 0) {
$pagination = false;
if ($config["design"]["pagination"] == 0) {
$config["design"]["pagination"] = false;
} else {
// pag_max: the newest post to show on a page
$pag_max = $pagination * ( $pagenumber + 1 );
$pag_max = $config["design"]["pagination"] * ( $pagenumber + 1 );
// pag_min: the oldest post to show on a page
$pag_min = $pag_max - $pagination;
$pag_min = $pag_max - $config["design"]["pagination"];
if ($pagenumber > 0) {
// Disable the blog intro if not on first page
$blogintro = "no";
$config["blog"]["intro"] = "off";
}
}
@ -70,10 +77,10 @@ if (isset($getarticle)) {
= ArticleGenerator::getTitle($articlesdir, $getarticle . '.md');
}
// Make sure that the entry has a title, because main.md hasn't one
if (empty($blogmainname)) {
$blogmaintitle = $blogtitle;
if (empty($config["blog"]["mainname"])) {
$blogmaintitle = $config["blog"]["title"];
} else {
$blogmaintitle = $blogmainname;
$blogmaintitle = $config["blog"]["mainname"];
}
if (isset($getblog)) {
$subblogtitle = BlogListGenerator::getName('./blogs/' . $getblog . '.md');
@ -86,16 +93,20 @@ if (isset($getarticle)) {
} else {
$hd_subblog_title = $subblogtitle;
}
// url of the feed
$feedurl = $config["blog"]["url"] . "/feed/" . $blog . ".atom";
?>
<head>
<meta charset="utf-8">
<title><?php echo $hd_subblog_title; ?></title>
<title><?php echo $config["blog"]["title"] . " » " .$hd_subblog_title; ?></title>
<!--Metatags-->
<meta name="author"
content="<?php echo $blogauthor; // Set the blog author ?>"/>
content="<?php echo $config["blog"]["author"]; // Set the blog author ?>"/>
<meta name="description"
content="<?php echo $blogdescription; // the blog description ?>"/>
content="<?php echo $config["blog"]["description"]; // the blog description ?>"/>
<!-- Meta tag for responsive ui-->
<meta name='viewport'
content='width=device-width, initial-scale=1.0,
@ -104,25 +115,35 @@ if (isset($getarticle)) {
<meta property="og:title" content="<?php echo $hd_subblog_title; ?>"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="<?php echo $url; ?>"/>
<meta property="og:image" content="<?php echo $favicon; ?>"/>
<meta property="og:description" content="<?php echo $blogdescription; ?>"/>
<meta property="og:locale:alternate" content="<?php echo $lang; ?>"/>
<meta property="og:image" content="<?php echo $config['design']['favicon']; ?>"/>
<meta property="og:description" content="<?php echo $config['blog']['description']; ?>"/>
<!-- Twitter meta tags -->
<meta name="twitter:card" content="summary"/>
<meta name="twitter:site" content="<?php echo $twitter; ?>"/>
<meta name="twitter:site" content="<?php echo $config['social']['twitter']; ?>"/>
<meta name="twitter:title" content="<?php echo $hd_subblog_title; ?>"/>
<meta name="twitter:description" content="<?php echo $blogdescription; ?>"/>
<meta name="twitter:image" content="<?php echo $favicon; ?>"/>
<meta name="twitter:description" content="<?php echo $config['blog']['description']; ?>"/>
<meta name="twitter:image" content="<?php echo $config['design']['favicon']; ?>"/>
<meta name="twitter:url" content="<?php echo $url; ?>"/>
<!-- atom feed -->
<?php
if (file_exists("feed/" . $blog . ".atom")) {
?>
<link rel='alternate' type='application/atom+xml' title='Atom 0.3' href=
'<?php
echo $feedurl;
?>'>
<?php
}
?>
<!--CSS files-->
<link rel="stylesheet" type="text/css" href="res/css/rangitaki.css"/>
<!-- stylesheet for code highlighting-->
<link rel="stylesheet" href="./res/css/github-gist.css">
<link rel="stylesheet" type="text/css"
href="themes/<?php echo $theme; // getting the theme stylesheet?>.css"/>
href="themes/<?php echo $config['design']['theme']; // getting the theme stylesheet?>.css"/>
<?php
// Checking if the drawer is enabled
if ($nav_drawer == 'no') {
if ($config["design"]["drawer"] != 'on') {
// Loading additional stylesheet for disabling the drawer?>
<link rel="stylesheet" type="text/css" href="res/css/no-nav.css"/>
<?php
@ -133,8 +154,8 @@ if (isset($getarticle)) {
type='text/css'> <!--Font-->
<!--Favicons-->
<link rel="shortcut icon" type="image/x-icon"
href="<?php echo $favicon; ?>"/>
<link rel="apple-touch-icon-precomposed" href="<?php echo $favicon; ?>">
href="<?php echo $config['design']['favicon']; ?>"/>
<link rel="apple-touch-icon-precomposed" href="<?php echo $config['design']['favicon']; ?>">
<!-- JavaScript Pt. 1: HightlightJS (get and load): Code highlighting-->
<script src="./res/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
@ -143,7 +164,7 @@ if (isset($getarticle)) {
<body>
<?php
// Checking if the navigation drawer is enabled. If not -> skip it
if ($nav_drawer == "yes") {
if ($config["design"]["drawer"] == "on") {
?>
<!--
Darken the background when fading the drawer in. See also the JS file
@ -164,8 +185,8 @@ if ($nav_drawer == "yes") {
echo "<section>";
// 1. Set localized string 2. Set blogtitle
echo "<div class='nav-item-static'>" .
$BLOGLANG['Blogs on'] .
" $blogtitle:</div>";
$BLOGLANG['Blogs on'] . " " . $config["blog"]["title"] .
":</div>";
// iterating through the blogs/ directory
foreach ($blogs as $navblog) {
// check if filename is larger than three chars and if the
@ -174,8 +195,10 @@ if ($nav_drawer == "yes") {
if ($getblog == "") { // Run when on main blog
if ($navblog != "main.md") { // excluding main blog
// creating navigation item
BlogListGenerator::listBlog(
"./blogs/", $navblog, $blogtitle
echo BlogListGenerator::listBlog(
"./blogs/",
$navblog,
$config["blog"]["title"]
);
}
} else {
@ -183,8 +206,10 @@ if ($nav_drawer == "yes") {
// -> this blog will be excluded
if ($getblog . ".md" != $navblog) {
// creating navigation item
BlogListGenerator::listBlog(
"./blogs/", $navblog, $blogmaintitle
echo BlogListGenerator::listBlog(
"./blogs/",
$navblog,
$blogmaintitle
);
}
}
@ -195,17 +220,24 @@ if ($nav_drawer == "yes") {
// If viewing a blog or a tag
?>
<!-- Set a back item instead of the blogs. -->
<a class="nav-item" onclick="goBack()">Go back</a>
<a class="nav-item" onclick="history.go(-1);">Go back</a>
<?php
}
if ($bloghome == "yes") { // If a blog home is existend
if ($config["blog"]["home"] == "on") { // If a blog home is existend
?>
<div class="divider"></div>
<a class="nav-item" href="<?php echo $bloghomeurl; ?>">
<?php echo $bloghomename; ?>
<a class="nav-item" href="<?php echo $config['blog']['homeurl']; ?>">
<?php echo $config['blog']['homename']; ?>
</a>
<?php
}
if (file_exists("feed/" . $blog . ".atom")) { ?>
<div class="divider"></div>
<a class="nav-item" href=
'<?php
echo $feedurl;
?>'>Feed</a><?php
}
?>
</div> <!-- End of the navigation drawer-->
<?php
@ -222,13 +254,13 @@ if ($nav_drawer == "yes") {
<img src="./res/img/menu.svg" class="nav-img"/>
<!-- Blog title with subblog title and links to each one-->
<!-- link to main blog-->
<nobr><span class="title"><a href="./"><?php echo $blogtitle; ?>
<nobr><span class="title"><a href="./"><?php echo $config["blog"]["title"]; ?>
<?php
if (empty($getblog)) { // if not on a subblog
if (!empty($blogmainname)) {
if (!empty($config['blog']['mainname'])) {
// If you see a (square) here : This is not a bug,
// but a missing sign in your font
echo "" . $blogmainname;
echo "" . $config['blog']['mainname'];
}
} else { // On subblog: set also a link to the subblog
?>
@ -252,7 +284,7 @@ if ($nav_drawer == "yes") {
// Blog Intro text
if (file_exists("blogs/$blog.md")
&& $getarticle == ""
&& $blogintro == "yes"
&& $config["blog"]["intro"] == "on"
&& $gettag == ""
) {
// only shown if not in article or tag view
@ -268,11 +300,11 @@ if ($nav_drawer == "yes") {
?>
<section class="card" id="intro">
<div class="articletext">
<?php // generate the html text from the markdown file
$intro = Parsedown::instance()
->setBreaksEnabled(true)// with linebreaks
->text($file);
echo $intro; // PRINTS THE SH****
<?php // generate the html text from the markdown file
$intro = Parsedown::instance()
->setBreaksEnabled(true)// with linebreaks
->text($file);
echo $intro; // PRINTS THE SH****
?>
</div>
</section>
@ -293,7 +325,11 @@ if ($nav_drawer == "yes") {
if (strlen($article) >= 3 && substr($article, -3) == ".md") {
// generate the article
ArticleGenerator::newArticle(
$articlesdir, $article, $getblog
$articlesdir,
$article,
$getblog,
$config["design"]["excerpt"],
$BLOGLANG["Read More"]
);
}
}
@ -308,27 +344,39 @@ if ($nav_drawer == "yes") {
// check if the file is a article file
if (strlen($article) >= 3 && substr($article, -3) == ".md") {
// generate the article
if ($pagination) {
if ($config["design"]["pagination"]) {
if ($posts_amount < $pag_max && $posts_amount >= $pag_min) {
ArticleGenerator::newArticle(
$articlesdir, $article, $getblog
$articlesdir,
$article,
$getblog,
$config["design"]["excerpt"],
$BLOGLANG["Read More"]
);
}
} else {
ArticleGenerator::newArticle(
$articlesdir, $article, $getblog
$articlesdir,
$article,
$getblog,
$config["design"]["excerpt"],
$BLOGLANG["Read More"]
);
}
}
$posts_amount++;
}
if ($pagination) {
if ($config["design"]["pagination"]) {
include './res/php/Pagination.php';
}
} elseif (isset($getarticle)) { // ARTICLE VIEW
// generate the requested article
ArticleGenerator::newArticle(
$articlesdir, $getarticle . ".md", $getblog
$articlesdir,
$getarticle . ".md",
$getblog,
'off',
$BLOGLANG["Read More"]
);
include './res/php/Disqus.php'; // include disques
} else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN
@ -336,16 +384,16 @@ if ($nav_drawer == "yes") {
}
?>
<div class="footer">
<?php echo $blogfooter; //print the blog footer?>
<?php echo $config["blog"]["footer"]; //print the blog footer?>
</div>
<?php
// show the fab if it's enabled
if ($sharefab == "yes") {
if ($config["design"]["fab"] == "on") {
?>
<div class="fabmenu">
<div class="subfab"><!--Email subfab-->
<a href='mailto:?subject=<?php
echo $blogtitle;
echo $config["blog"]["title"];
?>&body=<?php
echo $BLOGLANG['Check out this blog'];
?>: <?php
@ -374,7 +422,7 @@ if ($nav_drawer == "yes") {
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php
echo $url;
?>&t=<?php
echo "echo $blogtitle"
echo "echo " . $config["blog"]["title"];
?>' target="blank">
<img src="./res/img/facebook.svg" class="subfab-img"/>
</a>
@ -391,14 +439,14 @@ if ($nav_drawer == "yes") {
<script src="./res/js/app.js"></script> <!--include main javascript-->
<!-- JS extension support -->
<?php
if(file_exists("./extensions")) {
$extensions = scandir('./extensions');
foreach ($extensions as $extension) {
if (substr($extension, -3) == ".js") {
echo "<script src='./extensions/$extension'></script>";
}
if (file_exists("./extensions")) {
$extensions = scandir('./extensions');
foreach ($extensions as $extension) {
if (substr($extension, -3) == ".js") {
echo "<script src='./extensions/$extension'></script>";
}
}
}
?>
<?php
require './res/php/GoogleAnalytics.php'; // include google analytics

View File

@ -8,4 +8,5 @@ $BLOGLANG = [
"Check out" => "Schau dir das an:",
"Next Page" => "Nächste Seite",
"Previous Page" => "Vorherige Seite",
"Read More" => "Weiterlesen",
];

View File

@ -8,4 +8,5 @@ $BLOGLANG = [
"Check out" => "Check out:",
"Next Page" => "Next Page",
"Previous Page" => "Previous Page",
"Read More" => "Read More",
];

37
package.json Normal file
View File

@ -0,0 +1,37 @@
{
"name": "rangitaki",
"version": "1.5.0",
"description": "A simple PHP blogging engine without any database dependencies",
"main": "index.php",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@gitlab.com/mmk2410/rangitaki.git"
},
"keywords": [
"blogging",
"php"
],
"author": "Marcel Kapfer (mmk2410)",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/mmk2410/rangitaki/issues"
},
"homepage": "https://gitlab.com/mmk2410/rangitaki#README",
"devDependencies": {
"coffee-script": "^1.10.0",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-coffee": "^2.3.2",
"gulp-coffeelint": "^0.6.0",
"gulp-csso": "^2.0.0",
"gulp-sass": "^2.3.1",
"gulp-size": "^2.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-uglify": "^1.5.3",
"merge-stream": "^1.0.0",
"node-sass": "^3.7.0"
}
}

22
rcc/api/auth/auth.php Normal file
View File

@ -0,0 +1,22 @@
<?php
// Marcel Kapfer (mmk2410)
// License: MIT License
// HTTP Basic Auth for the API
$basedir = "../../../";
require '../../ssl.php';
require '../../password.php';
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="RCC API"');
header('HTTP/1.1 401 Unauthorized');
echo "Access denied to the RCC API!";
exit;
} elseif ($_SERVER['PHP_AUTH_USER'] != $username ||
!password_verify($_SERVER['PHP_AUTH_PW'], $password)) {
header('HTTP/1.1 401 Unauthorized');
echo "Wrong credentials: Access denied!";
exit;
}

59
rcc/api/list/index.php Normal file
View File

@ -0,0 +1,59 @@
<?php
// Marcel Kapfer (mmk2410)
// License: MIT License
// api for fetching various lists
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../../../vendor/autoload.php';
require '../../../res/php/Config.php';
use \mmk2410\rbe\config\Config as Config;
$config = new Config("../../../config.yaml", '../../../vendor/autoload.php');
$settings = $config->getConfig();
include '../auth/auth.php';
if ($settings["rcc"]["api"] == "on" && $settings["rcc"]["rcc"] == "on") {
$app = new \Slim\App();
/**
* api for get the list of blogs and if $_GET["blog"] is set the list of
* blogs posts in that blog
*
* @param string $_GET["blog"] optional name of the blog
*
* @return JSON json string containing the blogs / blog posts
*/
$app->get('/', function (Request $request, Response $response) {
$blog = $_GET["blog"];
if (!isset($blog)) {
$files = scandir('../../../blogs/', SCANDIR_SORT_DESCENDING);
unset($files[sizeof($files) - 1]);
unset($files[sizeof($files) - 1]);
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($files, 201);
return $response;
}
$path = "../../../articles/" . $blog . "/";
$files = scandir($path, SCANDIR_SORT_DESCENDING);
unset($files[sizeof($files) - 1]);
unset($files[sizeof($files) - 1]);
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($files, 201);
return $response;
});
$app->run();
}

48
rcc/api/media/index.php Normal file
View File

@ -0,0 +1,48 @@
<?php
// Marcel Kapfer (mmk2410)
// License: MIT License
// api for uploading files
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../../../vendor/autoload.php';
require '../../../res/php/Config.php';
require '../../../res/php/ArticleGenerator.php';
use \mmk2410\rbe\config\Config as Config;
$config = new Config("../../../config.yaml", '../../../vendor/autoload.php');
$settings = $config->getConfig();
include '../auth/auth.php';
if ($settings["rcc"]["api"] == "on" && $settings["rcc"]["rcc"] == "on") {
$app = new \Slim\App();
/**
* api for uploading files
*
* @return JSON json string with status
*/
$app->post('/', function (Request $request, Response $response) {
$storage = new \Upload\Storage\FileSystem('../../../media/');
$file = new \Upload\File('file', $storage);
try {
$file->upload();
$data = array("code" => 201);
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 201);
} catch (\Exception $e) {
$errors = $file->getErrors();
$data = array("code" => 500, "error" => $Errors);
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 500);
}
return $response;
});
$app->run();
}

141
rcc/api/post/index.php Normal file
View File

@ -0,0 +1,141 @@
<?php
// Marcel Kapfer (mmk2410)
// License: MIT License
// api for accessing blog posts
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../../../vendor/autoload.php';
require '../../../res/php/Config.php';
require '../../../res/php/ArticleGenerator.php';
use \mmk2410\rbe\config\Config as Config;
$config = new Config("../../../config.yaml", '../../../vendor/autoload.php');
$settings = $config->getConfig();
include '../auth/auth.php';
if ($settings["rcc"]["api"] == "on" && $settings["rcc"]["rcc"] == "on") {
$app = new \Slim\App();
/**
* api for fetching a blog post
*
* @param string $_GET["blog"] name of the blog
* @param string $_GET["post"] filename of the blog post
*
* @return JSON json string containing the blog post
*/
$app->get('/', function (Request $request, Response $response) {
$blog = $_GET["blog"];
$post = $_GET["post"];
if (!isset($blog) || !isset($post)) {
$data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'Not enough arguments');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 400);
return $response;
}
$path = "../../../articles/" . $blog . "/";
$data =
ArticleGenerator::getArray($path, $post);
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 201);
return $response;
});
/**
* api for changing/creating a blog post
*
* @param string $_POST["data"] all data
*/
$app->post('/', function (Request $request, Response $response) {
$blog = $_POST["blog"];
$post = $_POST["post"];
$title = $_POST["title"];
$author = $_POST["author"];
$date = $_POST["date"];
$tags = $_POST["tags"];
$text = $_POST["text"];
if (!isset($blog) || !isset($post) || (!isset($title) && !isset($text))) {
$data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'Not enough arguments');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 400);
return $response;
}
$text = str_replace('\n', '<br>', $text);
$md = <<<EOD
%TITLE: $title
%DATE: $date
%AUTHOR: $author
%TAGS: $tags
$text
EOD;
$path = "../../../articles/$blog/$post";
if (file_put_contents($path, $md)) {
$data = array('code' => 201, 'status' => 'Post created successfully');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 201);
} else {
$data = array('code' => 500, 'status' => 'Internal server error');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 500);
}
return $response;
});
/**
* api for deleting a blog post
*
* @param string $_GET["blog"] name of the blog
* @param string $_GET["post"] filename of the blog post
*
* @return JSON json string containing the blog post
*/
$app->delete('/', function (Request $request, Response $response) {
$blog = $_GET["blog"];
$post = $_GET["post"];
if (!isset($blog) || !isset($post)) {
$data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'Not enough arguments');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 400);
return $response;
}
$path = "../../../articles/$blog/$post";
if (!file_exists($path)) {
$data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'No such file');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 400);
return $response;
}
if (!unlink($path)) {
$data = array('code' => 500, 'status' => 'Bad Request', 'error' => 'Internal server error');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 500);
return $response;
}
$data = array('code' => 201, 'status' => 'File successfully deleted');
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withJson($data, 201);
return $response;
});
$app->run();
}

View File

@ -1,112 +1,172 @@
<?php
/**
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* Edit page of RCC (Rangitaki Control Center)
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
date_default_timezone_set('UTC');
?>
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
user-scalable=0" name="viewport"/>
<meta name="theme-color" content="#383838">
<meta name="description" content="Rangitaki Control Center (RCC)">
<link rel="stylesheet" href="../res/rcc.css"/>
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
400italic,100,100italic,900' rel='stylesheet'
type='text/css'> <!--Font-->
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<?php
session_start();
if ($_SESSION['login']) {
include_once("../../res/php/ArticleGenerator.php");
$directory = "./../../articles/" . $_GET['blog'] . "/";
$article = $_GET['post'] . ".md";
?>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<?php
session_start();
if ($_SESSION['login']) {
include_once "../../res/php/ArticleGenerator.php";
$directory = "./../../articles/" . $_GET['blog'] . "/";
$article = $_GET['post'] . ".md";
?>
<!-- Edit Post -->
<section class="card">
<div class="headline">Edit Post</div>
<p>Title:<br><br><input type="text" class="itextfield"
value="<?php echo ArticleGenerator::getTitle($directory, $article) ?>"
name="title"
id="title"/>
<p>Title:
<br><br>
<input type="text" class="itextfield"
value="<?php
echo ArticleGenerator::getTitle($directory, $article);
?>" name="title" id="title"/>
</p>
<p>Date:<br><br><input type="text" class="itextfield"
value="<?php echo ArticleGenerator::getDate($directory, $article) ?>" name="date"
id="date"/>
<p>Date:
<br><br>
<input type="text" class="itextfield"
value="<?php
echo ArticleGenerator::getDate($directory, $article);
?>" name="date" id="date"/>
</p>
<p>Author:<br><br><input type="text"
value="<?php echo ArticleGenerator::getAuthor($directory, $article) ?>"
class="itextfield" name="author"
id="author"/></p>
<p>Author:
<br><br>
<input type="text" class="itextfield"
value="<?php
echo ArticleGenerator::getAuthor($directory, $article);
?>" name="author" id="author"/>
</p>
<p>Tags:<br><br><input type="text"
value="<?php
$tags = "";
foreach (ArticleGenerator::getTags($directory, $article) as $tag) {
$tags = $tags . ', ' . $tag;
}
$tags = substr($tags, 2);
echo $tags;
?>"
class="itextfield" name="tags"
id="tags"/></p>
<p>Tags:
<br><br>
<input type="text" class="itextfield"
value="<?php
$tags = "";
foreach (
ArticleGenerator::getTags($directory, $article)
as $tag) {
$tags = $tags . ', ' . $tag;
}
$tags = substr($tags, 2);
echo $tags;
?>" name="tags" id="tags"/>
</p>
<p>Text:</p>
<textarea class="itextarea" name="text" id="text">
<?php echo ArticleGenerator::getText($directory, $article) ?>
<?php
echo ArticleGenerator::getText($directory, $article);
?>
</textarea>
<br><br>
<a class="button" id="save_changes">SAVE CHANGES</a>
</section>
<!-- Go Back -->
<section class="card">
<div class="headline">Back</div>
<p>
Go back to the RCC home. All changes will be lost.
</p>
<a class="button" href="../">BACK</a>
</section>
<?php
} else {
?>
<?php
} else {
?>
<!-- Access denied -->
<section class="card">
<div class="headline">Access denied</div>
<p>
The access to this area is not granted. Make sure you're logged in.
The access to this area is not granted. Make sure you're logged
in.
</p>
<a class="button" href="../">BACK</a>
</section>
<?php
}
?>
</div>
<script>
var getVariables = <?php echo json_encode($_GET); ?>;
</script>
<script src="../../res/js/jquery-2.1.4.min.js"></script>
<script src="../res/rcc.js"></script>
<script src="../res/edit.js"></script>
<?php
}
?>
</div>
<script>
var getVariables = <?php echo json_encode($_GET); ?>;
</script>
<script src="../../res/js/jquery-2.1.4.min.js"></script>
<script src="../res/rcc.js"></script>
<script src="../res/edit.js"></script>
</body>
</html>

148
rcc/feed/index.php Normal file
View File

@ -0,0 +1,148 @@
<?php
/**
* PHP Version 7
*
* @category Atom_Feed
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://gitlab.com/mmk2410/rangitaki
*
* Feed Generator
*
* The MIT License
*
* Copyright 2015 - 2016 (c) mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
date_default_timezone_set('UTC');
require "../../vendor/autoload.php";
require "../../res/php/Config.php";
require_once "../../res/php/ArticleGenerator.php";
use PicoFeed\Syndication\AtomFeedBuilder;
use PicoFeed\Syndication\AtomItemBuilder;
use \mmk2410\rbe\config\Config as Config;
$config = new Config('../../config.yaml', '../../vendor/autoload.php');
$settings = $config->getConfig();
include '../ssl.php';
session_start();
if ($_SESSION['login']) {
$art_dir = "./../../articles/" . $_GET['blog'] . "/";
$feed_path = "./../../feed/" . $_GET['blog'] . ".atom";
if ($_GET['blog'] == "main") {
$blogtitle = $settings['blog']['title'];
} else {
$blogtitl = $settings['blog']['title'] . " - " . ucwords($_GET['blog']);
}
$feedBuilder = AtomFeedBuilder::create()
->withTitle($blogtitle)
->withAuthor($settings['blog']['author'])
->withFeedUrl($settings['blog']['url'] . "/feed/" . $_GET['blog'] . ".atom")
->withSiteUrl($settings['blog']['url'])
->withDate(new DateTime(date(DATE_ATOM)));
$articles = scandir($art_dir, 1);
$amount = 0;
foreach ($articles as $article) {
if (strlen($article) >= 3 && substr($article, -3) == ".md") {
if ($amount == 10) {
break;
} else {
$file = ArticleGenerator::getText($art_dir, $article);
$text = Parsedown::instance()
->setBreaksEnabled(true)// with linebreaks
->text($file);
if (new DateTime(date(DATE_ATOM, strtotime($datestring))) != null) {
$date = new DateTime(
date(
DATE_ATOM,
strtotime($datestring)
)
);
} else {
$date = new DateTime(date(DATE_ATOM));
}
$date = new DateTime(date(DATE_ATOM));
$feedBuilder
->withItem(AtomItemBuilder::create($feedBuilder)
->withTitle(
ArticleGenerator::getTitle($art_dir, $article)
)
->withUrl(
$settings['blog']['url'] . "./?article=" . substr($article, 0, strlen($article) - 3)
)
->withAuthor(
ArticleGenerator::getAuthor($art_dir, $article)
)
->withPublishedDate(
parseDate(ArticleGenerator::getDate($art_dir, $article))
)
->withUpdatedDate(
parseDate(ArticleGenerator::getDate($art_dir, $article))
)
->withSummary(
ArticleGenerator::getSummary($art_dir, $article)
)
->withContent($text));
$amount += 1;
}
}
}
$feed = $feedBuilder->build();
$file = fopen($feed_path, "w");
if (fwrite($file, $feed) === false) {
echo "-1";
exit;
}
fclose($file);
echo "0";
}
function parseDate($datestring)
{
$datetime = new DateTime(date(DATE_ATOM));
try {
$datetime = new DateTime(
date(
DATE_ATOM,
strtotime($datestring)
)
);
} catch (Exception $e) {
$datetime = new DateTime(date(DATE_ATOM));
}
return $datetime;
}

View File

@ -1,205 +1,326 @@
<?php
/**
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* Main page of RCC (Rangitaki Control Center)
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
require '../vendor/autoload.php';
require '../res/php/Config.php';
require "./../res/php/BlogListGenerator.php";
use \mmk2410\rbe\config\Config as Config;
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
$config = new Config("../config.yaml", '../vendor/autoload.php');
$settings = $config->getConfig();
include './ssl.php';
?>
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
user-scalable=0" name="viewport"/>
<meta name="theme-color" content="#383838">
<meta name="description" content="Rangitaki Control Center (RCC)">
<link rel="stylesheet" href="./res/rcc.css"/>
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
400italic,100,100italic,900' rel='stylesheet'
type='text/css'> <!--Font-->
</head>
<body>
<div class="header">
<a href="./" class="title">Rangitaki Control Center</a>
<a href="../" class="back">Back to the blog</a>
</div>
<div class="main">
<div class="header">
<a href="./" class="title">Rangitaki Control Center</a>
<a href="../" class="back">Back to the blog</a>
</div>
<div class="main">
<?php
$config = $settings;
if ($config["rcc"]["rcc"] == "on") {
include 'password.php';
session_start();
if (isset($_POST['passwd'])) {
$passwd = $_POST['passwd'];
$_SESSION['passwd'] = $_POST['passwd'];
} elseif (isset($_SESSION['passwd'])) {
$passwd = $_SESSION['passwd'];
}
if ($passwd == "") {
?>
<!-- Login Card -->
<section class="card">
<div class="headline">Log In</div>
<form action="./" method="post">
<p>Password:
<br><br>
<input type="password" class="itextfield" name="passwd"/>
</p>
<input type="Submit" class="button" value="Log in"/>
</form>
</section>
<?php
require '../config.php';
if ($rcc == "yes") {
include 'password.php';
session_start();
if (isset($_POST['passwd'])) {
$passwd = $_POST['passwd'];
$_SESSION['passwd'] = $_POST['passwd'];
} else if (isset($_SESSION['passwd'])) {
$passwd = $_SESSION['passwd'];
}
if ($passwd == "") {
?>
<section class="card">
<div class="headline">Log In</div>
<form action="./" method="post">
<p>Password:<br><br><input type="password" class="itextfield" name="passwd"/></p>
<input type="Submit" class="button" value="Log in"/>
</form>
</section>
<?php
} else {
if ($passwd == $password) {
$_SESSION['login'] = true;
include_once("./../res/php/BlogListGenerator.php");
?>
<section class="card">
<div class="headline">Post Upload</div>
<form enctype="multipart/form-data" action="uploaded/" method="POST">
<select name="blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
?>
</select>
<input type="hidden" name="MAX_FILE_SIZE" value="100000"/>
<input id="" name="userfile" type="file" value="Choose a file"/>
<br>
<br>
<input id="button" type="submit" value="Upload" class="button"/>
</form>
</section>
<section class="card">
<div class="headline">New Post</div>
<form action="newpost/" method="POST">
<p>Blog:</p>
<select name="blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
?>
</select>
<p>Title:<br><br><input type="text" class="itextfield" name="title"/></p>
<p>Date:<br><br><input type="text" class="itextfield" name="date"/></p>
<p>Author:<br><br><input type="text" class="itextfield" name="author"/></p>
<p>Tags:<br><br><input type="text" class="itextfield" name="tags"/></p>
<p>Text:</p>
<textarea class="itextarea" name="text"></textarea>
<br><br>
<input id="button" type="submit" value="Post" class="button"/>
</form>
</section>
<section class="card">
<div class="headline">Edit post</div>
<p>
First select the blog of the post you wan't to edit.
</p>
<p id="edit_select_blog">
<select name="blog" id="edit_selected_blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
?>
</select>
</p>
<a class="button" id="edit_get_posts">GET POSTS</a>
</section>
<section class="card">
<div class="headline">Delete Post</div>
<p>
First select the subblog of the post you want to delete.
</p>
<p id="delete_select_blog">
<select name="blog" id="delete_selected_blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
?>
</select>
</p>
<a class="button" id="delete_get_posts">GET POSTS</a>
</section>
<section class="card">
<div class="headline">Media Upload</div>
<form enctype="multipart/form-data" action="media/" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000"/>
<input id="" name="userfile" type="file" value="Choose a file"/>
<br>
<br>
<input id="button" type="submit" value="Upload" class="button"/>
</form>
</section>
<?php
} else {
?>
<section class="card">
<div class="headline">Wrong Password</div>
<p>
Please go back and try again.
</p>
<a href="./" class="button">GO BACK</a>
</section>
<?php
}
}
} else {
if (password_verify($passwd, $password)) {
$_SESSION['login'] = true;
?>
<!-- Post Upload -->
<section class="card">
<div class="headline">Post Upload</div>
<form enctype="multipart/form-data" action="uploaded/"
method="POST">
<select name="blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
}
?>
</select>
<input type="hidden" name="MAX_FILE_SIZE" value="100000"/>
<input id="" name="userfile" type="file" value="Choose a file"/>
<br><br>
<input id="button" type="submit" value="Upload" class="button"/>
</form>
</section>
<!-- New Post -->
<section class="card">
<div class="headline">New Post</div>
<form action="newpost/" method="POST">
<p>Blog:</p>
<select name="blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
}
?>
</select>
<p>Title:
<br><br>
<input type="text" class="itextfield" name="title"/>
</p>
<p>Date:
<br><br>
<input type="text" class="itextfield" name="date"/>
</p>
<p>Author:
<br><br>
<input type="text" class="itextfield" name="author"/>
</p>
<p>Tags:
<br><br>
<input type="text" class="itextfield" name="tags"/>
</p>
<p>Text:</p>
<textarea class="itextarea" name="text"></textarea>
<br><br>
<input id="button" type="submit" value="Post"
class="button"/>
</form>
</section>
<!-- Edit post -->
<section class="card">
<div class="headline">Edit post</div>
<p>
First select the blog of the post you wan't to edit.
</p>
<p id="edit_select_blog">
<select name="blog" id="edit_selected_blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
}
?>
</select>
</p>
<a class="button" id="edit_get_posts">GET POSTS</a>
</section>
<!-- Delete Post -->
<section class="card">
<div class="headline">Delete Post</div>
<p>
First select the subblog of the post you want to delete.
</p>
<p id="delete_select_blog">
<select name="blog" id="delete_selected_blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
}
?>
</select>
</p>
<a class="button" id="delete_get_posts">GET POSTS</a>
</section>
<!-- Media Upload -->
<section class="card">
<div class="headline">Media Upload</div>
<form enctype="multipart/form-data" action="media/" method="POST">
<input type="hidden" name="MAX_FILE_SIZE"
value="100000000000"/>
<input id="" name="userfile" type="file" value="Choose a file"/>
<br><br>
<input id="button" type="submit" value="Upload" class="button"/>
</form>
</section>
<!-- Atom Feed Generator -->
<section class="card">
<div class="headline">Atom Feed Generator</div>
<p>
<select name="blog" id="generate_atom_blog">
<?php
$blogs = scandir("../blogs/");
foreach ($blogs as $blog) {
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
$blog = substr($blog, 0, -3);
echo "<option value='$blog'>$blog</option>";
}
}
}
?>
</select>
</p>
<a class="button" id="generate_atom">GENERATE</a>
</section>
<?php
} else {
?>
<!-- Wrong Password -->
<section class="card">
<div class="headline">Wrong Password</div>
<p>
The entered password was wrong, please try again.
</p>
<form action="./" method="post">
<p>Password:
<br><br>
<input type="password" class="itextfield" name="passwd"/>
</p>
<input type="Submit" class="button" value="Log in"/>
</form>
</section>
<?php
}
}
} else {
?>
<!-- Not enabled -->
<section class="card">
<div class="headline">Rangitaki Control Center</div>
<p>
The Rangitaki Control Center is disabled. You can enable it in your config file. But please read first
the documentation.
The Rangitaki Control Center is disabled. You can enable
it in your config file. But please read first the
documentation.
</p>
</section>
<?php
}
?>
<section class="card" id="back-card">
<div class="headline">Back</div>
<p>
Go back to your blog.
</p>
<a href="../" class="button">GO BACK</a>
</section>
</div>
<script src="./res/rcc.js"></script>
<script src="../res/js/jquery-2.1.4.min.js"></script>
<script src="./res/delete.js"></script>
<script src="./res/edit.js"></script>
<?php
}
?>
<!-- Back -->
<section class="card" id="back-card">
<div class="headline">Back</div>
<p>Go back to your blog.</p>
<a href="../" class="button">GO BACK</a>
</section>
</div>
<script src="./res/rcc.js"></script>
<script src="../res/js/jquery-2.1.4.min.js"></script>
<script src="./res/delete.js"></script>
<script src="./res/edit.js"></script>
<script src="./res/atom.js"></script>
</body>
</html>

View File

@ -1,60 +1,100 @@
<?php
/**
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* Media page of RCC (Rangitaki Control Center)
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
?>
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<link rel="stylesheet" href="../res/rcc.css" />
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">File Upload</div>
<?php
session_start();
if($_SESSION['login']) {
if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>";
} else {
$uploaddir = "../../media/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
<head>
<meta charset="UTF-8">
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<p>The post was successfully uploaded and is now published.</p>";
} else {
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
}
}
?><a href="../" class="button">GO BACK</a><?php
}
?>
</section>
</div>
</body>
<title>Rangitaki Control Center</title>
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
user-scalable=0" name="viewport"/>
<meta name="theme-color" content="#383838">
<meta name="description" content="Rangitaki Control Center (RCC)">
<link rel="stylesheet" href="../res/rcc.css"/>
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
400italic,100,100italic,900' rel='stylesheet'
type='text/css'> <!--Font-->
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">File Upload</div>
<?php
session_start();
if ($_SESSION['login']) {
if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>";
} else {
$uploaddir = "../../media/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo
"<p>
The post was successfully uploaded and is now published.
</p>";
} else {
echo
"<p>During the uploading process an error occured! <br>
Error Code:"
. ($_FILES['userfile']['error'] . "</p>");
}
}
?>
<a href="../" class="button">GO BACK</a>
<?php
}
?>
</section>
</div>
</body>
</html>

View File

@ -1,54 +1,82 @@
<?php
/**
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* Newpost page of RCC (Rangitaki Control Center)
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
date_default_timezone_set('UTC');
?>
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
user-scalable=0" name="viewport"/>
<meta name="theme-color" content="#383838">
<meta name="description" content="Rangitaki Control Center (RCC)">
<link rel="stylesheet" href="../res/rcc.css"/>
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
400italic,100,100italic,900' rel='stylesheet'
type='text/css'> <!--Font-->
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">New Post</div>
<?php
session_start();
if ($_SESSION['login']) {
$title = $_POST["title"];
$date = $_POST["date"];
$author = $_POST["author"];
$tags = $_POST["tags"];
$text = $_POST["text"];
$blog = $_POST["blog"];
$md = <<<EOD
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">New Post</div>
<?php
session_start();
if ($_SESSION['login']) {
$title = $_POST["title"];
$date = $_POST["date"];
$author = $_POST["author"];
$tags = $_POST["tags"];
$text = $_POST["text"];
$blog = $_POST["blog"];
$md = <<<EOD
%TITLE: $title
%DATE: $date
%AUTHOR: $author
@ -56,18 +84,23 @@ THE SOFTWARE.
$text
EOD;
$filename = date("Y-m-d-H-i-s") . ".md";
$handle = fopen("../../articles/$blog/$filename", "c");
fwrite($handle, $md);
if (fclose($handle)) {
echo "Post successfully published.";
} else {
echo "Some error happend, while publishing.";
}
?><a href="../" class="button">GO BACK</a><?php
}
?>
</section>
</div>
$filename = date("Y-m-d-H-i-s") . ".md";
$handle = fopen("../../articles/$blog/$filename", "c");
fwrite($handle, $md);
if (fclose($handle)) {
echo "Post successfully published.";
} else {
echo "Some error happend, while publishing.";
}
?>
<a href="../" class="button">GO BACK</a>
<?php
}
?>
</section>
</div>
</body>
</html>

View File

@ -1,3 +1,3 @@
<?php
// Set here your RCC password
$password = "setyourpassword";
$username = "test";
$password = '$2y$12$nHitKTwHqU4GmI3ADVE05eH/723fCNgdQ65kQ53FyZUVVB03BjfCO';

25
rcc/res/atom.js Normal file
View File

@ -0,0 +1,25 @@
/**
* JavaScript for the ajax request to generate a atom feed
*
* Copyright (c) 2016 by mmk2410
* License: MIT License
*/
function main() {
// listener and function for calling the ajax request to create the
// requested atom feed
$("#generate_atom").click(function () {
var selectedBlog = $("#generate_atom_blog").val();
$.get("feed/index.php", {
blog: selectedBlog
}, function (data) {
if (data == "0") {
alert("Atom feed sucessfully created.");
} else {
alert("Failed to create atom feed.");
}
});
});
}
$(document).ready(main());

View File

@ -1,30 +1,45 @@
/**
* Created by mmk2410 on 12/6/15.
* JavaScript for the ajax request to delete blog post
*
* JavaScript for the functionality to delete blogs
* Copyright (c) 2016 by mmk2410
* License: MIT License
*/
function main() {
// listener and function for recieving the posts of the selected blogs
$("#delete_get_posts").click(function () {
var selectedBlog = $("#delete_selected_blog").val();
$.get("res/get_posts.php", {
blog: selectedBlog
}, function (data) {
$("#delete_select_post").remove();
$("#delete_select_post_info").remove();
$("#delete_post_button").remove();
$("#delete_get_posts").after("<p id='delete_select_post'></p>");
$("#delete_get_posts").after("<p id='delete_select_post_info'>Now select the post you want to delete. " +
"Remember that once a post is deleted it can't be restored.</p>");
$("#delete_select_post").append("<select id='delete_selected_post'></select>");
$("#delete_get_posts").after(
"<p id='delete_select_post_info'>" +
"Now select the post you want to delete. " +
"Remember that once a post is deleted it can't be restored.</p>"
);
$("#delete_select_post").append(
"<select id='delete_selected_post'></select>"
);
$.each($.parseJSON(data), function (index, value) {
var post = value.substring(0, value.length - 3);
$("#delete_selected_post").append("<option value='" + post + "'>" + post + "</option>");
$("#delete_selected_post").append(
"<option value='" + post + "'>" + post + "</option>"
);
});
$("#delete_select_post").after("<a class='button' id='delete_post_button' " +
"onclick='deletePostButton()'>DELETE POST</a>")
$("#delete_select_post").after(
"<a class='button' id='delete_post_button' " +
"onclick='deletePostButton()'>DELETE POST</a>"
);
});
});
@ -37,10 +52,12 @@ function deletePostButton() {
var selectedBlog = $("#delete_selected_blog").val();
var selectedPost = $("#delete_selected_post").val();
$.get("res/delete_post.php", {
blog: selectedBlog,
post: selectedPost
}, function (data) {
$("#delete_select_post").remove();
$("#delete_select_post_info").remove();
$("#delete_post_button").remove();
@ -51,7 +68,10 @@ function deletePostButton() {
} else if (data == "941") {
alert("ERROR 941: No blog as get argument given");
} else if (data == "961") {
alert("ERROR 961: Error while deleting the file. Check if the web server has the permission to do so.");
alert(
"ERROR 961: Error while deleting the file. Check if the" +
"web server has the permission to do so."
);
} else if (data == "0") {
alert("Post successfully deleted.");
}
@ -59,4 +79,4 @@ function deletePostButton() {
}
$(document).ready(main());
$(document).ready(main());

View File

@ -1,7 +1,36 @@
<?php
/**
* User: mmk2410
* Date: 12/6/15
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* delete post script
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Error Codes:
* 901 No post given as get argument
@ -9,17 +38,24 @@
* 941 No blog given as get argument
* 961 Error while deleting the post
*/
$post = $_GET["post"];
$blog = $_GET["blog"];
if (!isset($post)) {
echo "901";
} else if (!isset($blog)) {
echo "941";
} else if (!file_exists("./../../articles/$blog/$post.md")) {
echo "921";
} else {
if (unlink("./../../articles/$blog/$post.md")) {
echo "0";
session_start();
if ($_SESSION['login']) {
if (!isset($post)) {
echo "901";
} else if (!isset($blog)) {
echo "941";
} else if (!file_exists("./../../articles/$blog/$post.md")) {
echo "921";
} else {
if (unlink("./../../articles/$blog/$post.md")) {
echo "0";
}
echo "961";
}
echo "961";
}
?>

View File

@ -1,41 +1,54 @@
/**
* Created by mmk2410 on 12/6/15.
* JavaScript for the ajax request to edit a article
*
* JavaScript for the functionality to delete blogs
* Copyright (c) 2016 by mmk2410
* License: MIT License
*/
function main() {
// listener and function for recieving the posts of the selected blogs
$("#edit_get_posts").click(function () {
var selectedBlog = $("#edit_selected_blog").val();
$.get("res/get_posts.php", {
blog: selectedBlog
}, function (data) {
$("#edit_select_post").remove();
$("#edit_select_post_info").remove();
$("#edit_post_button").remove();
$("#edit_get_posts").after("<p id='edit_select_post'></p>");
$("#edit_get_posts").after("<p id='edit_select_post_info'>Now select the post you want to edit.</p>");
$("#edit_select_post").append("<select id='edit_selected_post'></select>");
$("#edit_get_posts").after(
"<p id='edit_select_post_info'>" +
"Now select the post you want to edit.</p>"
);
$("#edit_select_post").append(
"<select id='edit_selected_post'></select>"
);
$.each($.parseJSON(data), function (index, value) {
var post = value.substring(0, value.length - 3);
$("#edit_selected_post").append("<option value='" + post + "'>" + post + "</option>");
$("#edit_selected_post").append(
"<option value='" + post + "'>" + post + "</option>"
);
});
$("#edit_select_post").after("<a class='button' id='edit_post_button' " +
"onclick='editPostButton()'>EDIT POST</a>")
$("#edit_select_post").after(
"<a class='button' id='edit_post_button' " +
"onclick='editPostButton()'>EDIT POST</a>"
);
});
});
$("#save_changes").click(function () {
var postTitle = $("#title").val();
var postDate = $("#date").val();
var postAuthor = $("#author").val();
var postTags = $("#tags").val();
var postText = $("#text").val();
var file = "../../articles/" + getVariables['blog'] + "/" + getVariables['post'] + ".md";
console.log(file);
var file = "../../articles/" + getVariables.blog +
"/" + getVariables.post + ".md";
$.post("../res/save.php", {
title: postTitle,
@ -69,4 +82,4 @@ function editPostButton() {
}
$(document).ready(main());
$(document).ready(main());

View File

@ -1,25 +1,58 @@
<?php
/**
* User: mmk2410
* Date: 12/6/15
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* get post script
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Error Codes:
* 901 No blog given as get argument
* 921 No blog with the given name available
*/
$blog = $_GET["blog"];
if (!isset($blog)) {
echo "901";
} else if (!file_exists("./../../blogs/$blog.md")) {
echo "921";
} else {
$posts = array();
$i = 0;
foreach (scandir("./../../articles/$blog/") as $article) {
if (substr($article, -3) == ".md") {
$posts[$i] = $article;
$i++;
session_start();
if ($_SESSION['login']) {
$blog = $_GET["blog"];
if (!isset($blog)) {
echo "901";
} else if (!file_exists("./../../blogs/$blog.md")) {
echo "921";
} else {
$posts = array();
$i = 0;
foreach (scandir("./../../articles/$blog/") as $article) {
if (substr($article, -3) == ".md") {
$posts[$i] = $article;
$i++;
}
}
print json_encode($posts);
}
print json_encode($posts);
}
}

View File

@ -1,30 +1,29 @@
/*
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Created on : Jun 14, 2015, 6:13:38 PM
Author : mmk2410
*/
* RCC cascade style sheet
*
* Copyright (C) 2015-2016 Marcel Kapfer (mmk2410)
* MIT License
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/* BODY */
@ -38,19 +37,19 @@ body{
.main{
height: 100%;
width: 100%;
margin-left: 0px;
margin-left: 0;
}
/* HEADER */
.header{
background-color: #ff4415;
position: fixed;
top: 0px;
right: 0px;
left: 0px;
top: 0;
right: 0;
left: 0;
width: 100%;
height: 64px;
box-shadow: 2px 0px 2px 2px rgba(62, 62, 62, 0.45);
box-shadow: 2px 0 2px 2px rgba(62, 62, 62, 0.45);
}
.title{
@ -82,7 +81,7 @@ body{
background: #fff;
border-radius: 2px;
padding: 24px;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
margin-bottom: 40px;
max-width: 1160px;
}
@ -145,9 +144,9 @@ body{
border-width: 1px;
border-style: solid;
border-color: #ff4415;
box-shadow: 0.4px 1px 1.5px 1px #aaa;
-moz-box-shadow: 0.4px 1px 1.5px 1px #aaa;
-webkit-box-shadow: 0.4px 1px 1.5px 1px #aaa;
-moz-box-shadow: 0.4px 1px 1.5px 1px #aaa;
box-shadow: 0.4px 1px 1.5px 1px #aaa;
border-radius: 2px;
margin-top: 4px;
margin-bottom: 5px;
@ -158,6 +157,10 @@ body{
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-o-transition-property: box-shadow;
-o-transition-delay: 50ms;
-o-transition-duration: 125ms;
-o-transition-timing-function: ease;
-moz-transition-property: box-shadow;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
@ -170,12 +173,13 @@ body{
}
.button:hover, .button:hover {
box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa; }
box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
}
input.button{
padding: 0px 8px;
padding: 0 8px;
}
/* INPUT FIELD */
@ -192,6 +196,10 @@ input.button{
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-o-transition-property: border-bottom-color;
-o-transition-delay: 50ms;
-o-transition-duration: 125ms;
-o-transition-timing-function: ease;
-moz-transition-property: border-bottom-color;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
@ -224,6 +232,10 @@ input.button{
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-o-transition-property: border-bottom-color;
-o-transition-delay: 50ms;
-o-transition-duration: 125ms;
-o-transition-timing-function: ease;
-moz-transition-property: border-bottom-color;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
@ -273,4 +285,4 @@ form{
#back-card {
display: none;
}
}
}

View File

@ -1,20 +1,32 @@
/**
* JavaScript for RCC
*
* Copyright (c) 2016 by mmk2410
* License: MIT License
*/
window.onload = function () {
var t = document.getElementsByTagName('textarea')[0];
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width')));
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (
t.offsetHeight + parseInt(
window.getComputedStyle(t, null).getPropertyValue('border-top-width')
)
);
/**
* The following three code clocks are for proper resizing of the input textarea
* The following three code clocks are for proper resizing of the input
* textarea
*/
var resize = function (t) {
t.style.height = 'auto';
t.style.height = (t.scrollHeight + offset ) + 'px';
}
};
t.addEventListener && t.addEventListener('input', function (event) {
resize(t);
});
t['attachEvent'] && t.attachEvent('onkeyup', function () {
t.attachEvent && t.attachEvent('onkeyup', function () {
resize(t);
});
}
};

View File

@ -1,11 +1,46 @@
<?php
$title = $_POST["title"];
$date = $_POST["date"];
$author = $_POST["author"];
$tags = $_POST["tags"];
$text = $_POST["text"];
$filename = $_POST["file"];
$md = <<<EOD
/**
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
session_start();
if ($_SESSION['login']) {
$title = $_POST["title"];
$date = $_POST["date"];
$author = $_POST["author"];
$tags = $_POST["tags"];
$text = $_POST["text"];
$filename = $_POST["file"];
$md = <<<EOD
%TITLE: $title
%DATE: $date
%AUTHOR: $author
@ -13,10 +48,11 @@ $md = <<<EOD
$text
EOD;
if (file_put_contents($filename, $md)) {
echo 0;
} else if (file_exists(($filename))) {
echo 1;
} else {
echo -1;
if (file_put_contents($filename, $md)) {
echo 0;
} else if (file_exists(($filename))) {
echo 1;
} else {
echo -1;
}
}

11
rcc/ssl.php Normal file
View File

@ -0,0 +1,11 @@
<?php
// Marcel Kapfer (mmk2410) / Wilson O'Sullivan
// License: MIT License
// SSL Verification
if (isset($settings["rcc"]["debug"]) && $settings["rcc"]["debug"] != "on") {
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
header('HTTP/1.1 400 Bad Request');
exit();
}
}

View File

@ -1,61 +1,102 @@
<?php
/**
* PHP Version 7
*
* @category Blogging
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link https://mmk2410.org/rangitaki
*
* Main page of RCC (Rangitaki Control Center)
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
?>
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<link rel="stylesheet" href="../res/rcc.css" />
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">File Upload</div>
<?php
session_start();
if($_SESSION['login']) {
if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>";
} else {
$blog = filter_input(INPUT_POST, "blog");
$uploaddir = "../..//articles/$blog/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
<head>
<meta charset="UTF-8">
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<p>The post was successfully uploaded and is now published.</p>";
} else {
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
}
}
?><a href="../" class="button">GO BACK</a><?php
}
?>
</section>
</div>
</body>
<title>Rangitaki Control Center</title>
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
user-scalable=0" name="viewport"/>
<meta name="theme-color" content="#383838">
<meta name="description" content="Rangitaki Control Center (RCC)">
<link rel="stylesheet" href="./res/rcc.css"/>
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
400italic,100,100italic,900' rel='stylesheet'
type='text/css'> <!--Font-->
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">File Upload</div>
<?php
session_start();
if ($_SESSION['login']) {
if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>";
} else {
$blog = filter_input(INPUT_POST, "blog");
$uploaddir = "../..//articles/$blog/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo
"<p>The post was successfully uploaded and is now
published.</p>";
} else {
echo
"<p>During the uploading process an error occured! <br>
Error Code:"
. ($_FILES['userfile']['error'] . "</p>");
}
}
?>
<a href="../" class="button">GO BACK</a>
<?php
}
?>
</section>
</div>
</body>
</html>

View File

@ -1,57 +1,3 @@
/*
Rangitaki Project
.nav{display:none}.nav-img{display:none}@media screen and (min-width: 1440px){.header{left:0}.main{margin-left:0;width:100%}}@media screen and (max-width: 720px){.title{left:25px}}
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Created on : Jun 18, 2015, 7:07:45 PM
Author : mmk2410
*/
/*
A stylesheet for overriding the default styles if the navigation drawer is disabled
*/
.nav{ /* hide the navigation drawer */
display: none;
}
.nav-img{ /* hide the hamburger icon */
display: none;
}
@media screen and (min-width: 1440px) { /* large devices */
.header { /* full width */
left: 0;
}
.main{ /* full width */
margin-left: 0;
width: 100%;
}
}
@media screen and (max-width: 720px){ /* small devices */
.title{ /* move the title more to the left */
left: 25px;
}
}
/*# sourceMappingURL=no-nav.css.map */

1
res/css/no-nav.css.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"no-nav.css","sources":["no-nav.sass"],"sourcesContent":["/*\n * Rangitaki Project\n *\n * The MIT License\n *\n * Copyright 2015 mmk2410.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * A stylesheet for overriding the default styles if the navigation drawer is disabled\n */\n\n.nav {\n display: none; }\n\n.nav-img {\n display: none; }\n\n@media screen and (min-width: 1440px) {\n .header {\n left: 0; }\n\n .main {\n margin-left: 0;\n width: 100%; } }\n\n@media screen and (max-width: 720px) {\n\n .title {\n left: 25px; } }\n"],"mappings":"AA4BA,AAAA,IAAI,AAAC,CACD,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,QAAQ,AAAC,CACL,OAAO,CAAE,IAAK,CAAG,AAErB,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,MAAM,EACzB,AAAA,OAAO,AAAC,CACJ,IAAI,CAAE,CAAE,CAAG,AAEf,AAAA,KAAK,AAAC,CACF,WAAW,CAAE,CAAE,CACf,KAAK,CAAE,IAAK,CAAG,CAEvB,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK,EAExB,AAAA,MAAM,AAAC,CACH,IAAI,CAAE,IAAK,CAAG","names":[]}

View File

@ -1,305 +1,3 @@
/*
Rangitaki Project
body{margin-top:94px}.main{height:100%;margin-left:0}.overlay{opacity:0;position:fixed;top:0;left:0;background-color:black;width:100%;z-index:30;height:100%;display:none}.header{top:0;right:0;left:0;width:100%;height:64px;position:absolute}.title{color:#fff;font-size:23px;text-decoration:none;line-height:64px;vertical-align:middle;left:75px}.title>a{text-decoration:none;color:#fff}.fadeout{position:absolute;height:64px;top:0;right:0;width:40px}.nav-img{height:26px;padding:19px;cursor:pointer}.nav{width:300px;position:fixed;height:100%;top:0;left:-301px;z-index:40}.nav-item,.nav-item-static{text-decoration:none;text-indent:0;display:inline-block;height:48px;vertical-align:middle;width:284px;line-height:48px;padding-left:16px;transition:background-color 125ms ease-in-out 0ms}.nav-close{cursor:pointer}.nav-close-img{height:35px;padding:12px}.nav-item{cursor:pointer}.divider{width:100%}.card{margin-right:auto;margin-left:auto;width:75%;padding:24px;margin-bottom:40px;max-width:1160px}.card a{-moz-hyphens:auto;-epub-hyphens:auto;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;word-wrap:break-word}.headline{display:block;padding-bottom:8px}.card img{max-width:100%;max-height:400px;display:block;margin-left:auto;margin-right:auto}.author{display:block}.readmore{padding:12px 0 25px 0}.fabmenu{position:fixed;bottom:20px;right:20px}.fab{height:60px;width:60px;border-radius:30px;cursor:pointer}.fab-img{width:28px;padding:15px}.subfab{height:45px;width:45px;border-radius:30px;margin-right:auto;margin-left:auto;margin-bottom:25px;display:none}.subfab-img{width:22px;padding:12px}.pag_buttons{margin-right:auto;margin-left:auto;width:calc(75% + 48px);margin-bottom:80px;max-width:1160px;text-align:right}.button{text-decoration:none;color:#fff;line-height:36px;min-width:64px;text-align:center;height:36px;padding:8px;margin-top:4px;margin-bottom:5px;cursor:pointer}.pag_next{margin-left:8px}.footer a{transition:border-bottom-color 150ms ease-in-out 100ms}.footer a:hover{border-bottom-color:#383838}@media screen and (min-width: 1440px){.nav{left:0;padding-top:64px}.nav-close-img{display:none}.nav-close{display:none}.nav-img{display:none}.header{left:300px}.main{margin-left:300px;width:calc(100% - 300px)}}@media screen and (max-width: 720px){.card{width:82%}.pag_buttons{width:calc(82% + 48px)}}
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Created on : Jun 14, 2015, 6:13:38 PM
Author : mmk2410
*/
/* BODY */
body{
margin-top: 94px; /* Set enough space for the header */
}
.main{ /* main content */
height: 100%;
margin-left: 0;
}
.overlay { /* overlay: used for a darker background when the navigation drawer is open */
opacity: 0;
position: fixed;
top: 0;
left: 0;
background-color: black;
width: 100%;
z-index: 30;
height: 100%;
display: none; /* because the thing is hidden at the beginning and shown with js */
}
/* HEADER */
.header{
top: 0;
right: 0;
left: 0;
width: 100%;
height: 64px;
position: absolute;
}
.title{ /* title in the header */
color: #fff;
font-size: 23px;
text-decoration: none;
line-height: 64px;
vertical-align: middle;
left: 75px;
}
.title > a{ /* and a a styling */
text-decoration: none;
color: #fff;
}
.fadeout{ /* a fadeout if the title is to long */
position: absolute;
height: 64px;
top: 0;
right: 0;
width: 40px;
}
.nav-img{ /* the hamburger icon */
height: 26px;
padding: 19px;
cursor: pointer;
}
/* NAV DRAWER */
.nav{ /* the main object */
width: 300px;
position: fixed;
height: 100%;
top: 0;
left: -301px;
z-index: 40;
}
.nav-item, .nav-item-static{ /* a nav-item */
text-decoration: none;
text-indent: 0;
display: inline-block;
height: 48px;
vertical-align: middle;
width: 284px;
line-height: 48px;
padding-left: 16px;
transition: background-color 125ms ease-in-out 0ms;
}
.nav-close {
cursor: pointer;
}
.nav-close-img{ /* the hamburger icon */
height: 35px;
padding: 12px;
}
.nav-item{ /* additional setting for clickable nav items */
cursor: pointer;
}
.divider{ /* a simple divider with all options. better than <hr> */
width: 100%;
}
/* MAIN */
.card{ /* just a card */
margin-right: auto;
margin-left: auto;
width: 75%;
padding: 24px;
margin-bottom: 40px;
max-width: 1160px;
}
.card a{ /* and another a styling */
-moz-hyphens: auto;
-epub-hyphens: auto;
-ms-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
word-wrap: break-word; /* until here: break long links */
}
.card a:hover{ /* hovered card links; just here to help you create a own theme*/
}
.headline{ /* title in a card */
display: block;
padding-bottom: 8px;
}
.card img{ /* image in a card*/
max-width: 100%; /* regulate width */
max-height: 400px; /* regulate height */
display: block; /* centered */
margin-left: auto; /* centerd */
margin-right: auto; /* centred */
}
.date{ /* possibility to style the date */
}
.articletext{ /* posibitlity to style the text */
}
.author{ /* styling for the author */
display: block;
}
.tag{ /* possibility to style the text */
}
/* FAB */
.fabmenu{ /* surrounds the complete fab menu */
position: fixed;
bottom: 20px;
right: 20px;
}
.fab{ /* the main fab (always visible if enabled) */
height: 60px;
width: 60px;
border-radius: 30px;
cursor: pointer;
}
.fab-img{ /* fab image for the main fab */
width: 28px;
padding: 15px;
}
.subfab{ /* a smaller fab in the fab menu */
height: 45px;
width: 45px;
border-radius: 30px;
margin-right: auto;
margin-left: auto;
margin-bottom: 25px;
display: none;
}
.subfab-img{ /* and the image for it */
width: 22px;
padding: 12px;
}
/* BUTTON */
.pag_buttons {
margin-right: auto;
margin-left: auto;
width: calc(75% + 48px);
margin-bottom: 80px;
max-width: 1160px;
text-align: right;
}
.button {
text-decoration: none;
color: #fff;
line-height: 36px;
min-width: 64px;
text-align: center;
height: 36px;
padding: 8px;
margin-top: 4px;
margin-bottom: 5px;
cursor: pointer;
}
.pag_next{
margin-left: 8px;
}
/* FOOTER */
.footer{ /* possibility for styling the footer */
}
.footer a{ /* styling of the footer a */
transition: border-bottom-color 150ms ease-in-out 100ms;
}
.footer a:hover{ /* and the hovered one*/
border-bottom-color: #383838;
}
@media screen and (min-width: 1440px) { /* make it responsive: large devices */
.nav{ /* always show navigation bar */
left: 0;
padding-top: 64px;
}
.nav-close-img {
display: none;
}
.nav-close {
display: none;
}
.nav-img{ /* always hide navigation bar icon*/
display: none;
}
.header{ /* move header to the right */
left: 300px;
}
.main{ /* move main content to the right and limit its width */
margin-left: 300px;
width: calc(100% - 300px);
}
}
@media screen and (max-width: 720px){ /* make it responsive: small devices */
.card{ /* wider cards */
width: 82%;
}
.pag_buttons {
width: calc(82% + 48px);
}
}
/*# sourceMappingURL=rangitaki.css.map */

File diff suppressed because one or more lines are too long

View File

@ -1,112 +1 @@
/*
* Rangitaki Project
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var main = function () { // main function; called below
var fabActive = false; // fab hidden at begin
$('.fabmenu').click( // action on fab click
function () {
if (!(fabActive)) { // if fab is hidden
fabFadeIn(); // fade fab in
fabActive = true; // fab = active
} else { // if fab is shown
fabFadeOut(); // fade fab out
fabActive = false; // fab = hidden
}
}
);
var navOpen = false; // nav hidden at begin
$('.nav-img, .overlay, .nav-close').click( // action on hamburger click
function () {
if (!(navOpen)) { // if nav is hidden
openNav(); // open the nav drawer
navOpen = true; // nav = open
} else { // if nav is closed
closeNav(); // close the nav drawer
navOpen = false; // nav = closed
}
}
);
/**
* Keyhandling for the navigation drawer.
* opens the drawer on 'm' (key code: 77)
* closes the drawer on 'Esc' (key code: 27)
*/
$(document).keyup(function (e) {
if (navOpen && (e.which === 27)) {
closeNav();
navOpen = false;
} else if (!(navOpen) && (e.which === 77)) {
openNav();
navOpen = true;
}
});
};
$(document).ready(main); // run if document is loaded
function goBack() { // go back function
history.go(-1);
}
function fabFadeIn() { // fade fab in
$('.subfab').fadeIn(125); // fade subfabs in
$('.fab-img').fadeOut( // fade fab share image out
60, function callback() {
$('.fab-img').attr("src", "./res/img/close.svg"); // change to fab close image
}
);
$('.fab-img').fadeIn(60); // fade fab close image in
}
function fabFadeOut() { // fade fab out
$('.subfab').fadeOut(125); // fade subfabs out
$('.fab-img').fadeOut( // fade fab close image out
60, function callback() {
$('.fab-img').attr("src", "./res/img/share.svg"); // change to fab share image
}
);
$('.fab-img').fadeIn(60); // fade fab share image in
}
function openNav() { // fade navigation drawer in
$('.nav').animate({"left": "0px"}, 125); // slide in
$('.overlay').show(); // set overlay to show ...
$('.overlay').animate({"opacity": "0.4"}, 125); // ... and fade to a darker transparent color
}
function closeNav() { // fade navigation drawer out
$('.nav').animate({"left": "-301px"}, 125); // slide out
$('.overlay').animate(
{"opacity": "0.0"}, 125, function () { // fade the overlay to complete transparency
$('.overlay').hide(); // hide it then
}
);
}
(function(){var n,t,a,e,r;e=function(){var e,i;return e=!1,$(".fabmenu").click(function(){return e?(a(),e=!1):(t(),e=!0)}),i=!1,$(".nav-img, .overlay, .nav-close").click(function(){return i?(n(),i=!1):(r(),i=!0)}),$(document).keyup(function(t){return i&&27===t.which?(n(),i=!1):i||77!==t.which?void 0:(r(),i=!0)}),$(".articletext a").attr("target","_blank")},$(document).ready(e),t=function(){return $(".subfab").fadeIn(125),$(".fab-img").fadeOut(60,function(){return $(".fab-img").attr("src","./res/img/close.svg"),$(".fab-img").fadeIn(60)})},a=function(){return $(".subfab").fadeOut(125),$(".fab-img").fadeOut(60,function(){return $(".fab-img").attr("src","./res/img/share.svg"),$(".fab-img").fadeIn(60)})},r=function(){return $(".nav").animate({left:"0px"},125),$(".overlay").show(),$(".overlay").animate({opacity:"0.4"},125)},n=function(){return $(".nav").animate({left:"-301px"},125),$(".overlay").animate({opacity:"0.0"},125,function(){return $(".overlay").css({display:"none"})})}}).call(this);

View File

@ -1,5 +1,15 @@
<?php
/*
/**
* PHP Version 7
*
* Since there is no initialize function, I recommend to use the short access syntay
*
* @category Articles
* @package RangitakiPHP
* @author mmk2410 <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*
* Rangitaki Project
*
* The MIT License
@ -26,7 +36,8 @@
*/
/**
* The article generator class is a collection of functions for generating the article of markdown
* The article generator class is a collection of functions for generating the
* article of markdown
*
* Since there is no initialize function, I recommend to use the short access syntay
*
@ -42,11 +53,13 @@ class ArticleGenerator
/**
* A function to create one new article
*
* @param string $directory The directory where the article files are stored
* @param string $articlefile The name of the article file
* @param string $blog The name of the current blog
* @param string $directory The directory where the article files are stored
* @param string $articlefile The name of the article file
* @param string $blog The name of the current blog
*
* @return Null
*/
function newArticle($directory, $articlefile, $blog)
function newArticle($directory, $articlefile, $blog, $excerpt, $readmore)
{
$article = file_get_contents($directory . $articlefile); // get the file
@ -83,12 +96,39 @@ class ArticleGenerator
echo "<div class='articletext'>";
// print only a excerpt of the post
// with at least 200 characters if possible.
if ( $excerpt == 'on' ) {
$emptyline = strpos($article, "\n\n");
if ( $emptyline !== false ) {
if ( $emptyline < 200) {
$emptyline2 = strpos($article, "\n\n", $emptyline);
if ( $emptyline2 !== false ) {
$article = substr($article, 0, $emptyline2);
} else {
$article = substr($article, 0, $emptyline);
}
} else {
$article = substr($article, 0, $emptyline);
}
} else {
// correct $excerpt for use in line 127.
$excerpt = 'off';
}
}
echo Parsedown::instance()
->setBreaksEnabled(true)
->text($article); // print now the article text as html
echo "</div>";
if ( $excerpt == 'on' ) {
echo "<div class='readmore'><a href='$link'>$readmore</a></div>";
}
if (isset($author)) {
echo "<span class='author'>$author</span>"; // print the author
}
@ -172,6 +212,31 @@ class ArticleGenerator
}
}
/**
* A function to get a short summary of a text
*
* @param $directory The directory where the article is stored
* @param $articlefile The name of the article file
*
* @return string
*/
static function getSummary($directory, $articlefile)
{
$text = ArticleGenerator::getText($directory, $articlefile);
$pos = stripos($text, "\n\n");
if ($pos !== false) {
$offset = $pos;
$pos = stripos($text, ".", $offset);
$summary = substr($text, 0, $pos) . ".";
return trim($summary);
} else {
return $text;
}
}
/**
* A function to get the author of an article
*
@ -227,4 +292,50 @@ class ArticleGenerator
return $article;
}
/**
* A function to get a array of the article
*
* @param $directory The directory where the article is stored
* @param $articlefile The name of the article file
* @return string
*/
public function getArray($directory, $articlefile)
{
$article = file_get_contents($directory . $articlefile);
$title = "";
$date = "";
$author = "";
$tags = array();
if (substr($article, 0, 6) == "%TITLE") { // get and remove the title
$title = substr($article, 8, strpos($article, "\n") - 8);
$article = substr($article, strpos($article, "\n") + 1);
}
if (substr($article, 0, 5) == "%DATE") { // get and remove the title
$date = substr($article, 7, strpos($article, "\n") - 7);
$article = substr($article, strpos($article, "\n") + 1);
}
if (substr($article, 0, 7) == "%AUTHOR") { // get and remove the title
$author = substr($article, 9, strpos($article, "\n") - 9);
$article = substr($article, strpos($article, "\n") + 1);
}
if (substr($article, 0, 5) == "%TAGS") { // get and remove the tags
$tags = substr($article, 7, strpos($article, "\n") - 7); // get the tags
$tags = explode(", ", $tags); // split them into an array
$article = substr($article, strpos($article, "\n") + 1);
}
$data = array(
"title" => $title,
"date" => $date,
"author" => $author,
"tags" => $tags,
"text" => $article
);
return $data;
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Version 5.6
* PHP Version 7
*
* Rangitaki Project
*
@ -10,7 +10,7 @@
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
namespace mmk2410\rbe\BlogListGenerator;
/**
* The blog list generator class is a collection of functions for generating
@ -37,7 +37,7 @@ class BlogListGenerator
*
* @return None
*/
function listBlog($directory, $blogname, $blogmaintitle)
public function listBlog($directory, $blogname, $blogmaintitle)
{
// get content of the blog file;
$blog = file_get_contents($directory . $blogname);
@ -46,18 +46,25 @@ class BlogListGenerator
// check if the first line includes a title
if (substr($blog, 0, 6) == "%TITLE") {
// grab the title
$blog = substr($blog, 8, strpos($blog, "\n") - 8);
$itemname = substr($blog, 8, strpos($blog, "\n") - 8);
// if on main blog
if ($blog == "main") {
if ($itemname == "main") {
// create a nav item to the main blog
echo "<a class='nav-item' href='./'>$blogmaintitle</a>";
$atag = "<a class='nav-item' href='./'>$blogmaintitle</a>";
} else {
// create a link to the blog
$link = "./?blog=" . substr($blogname, 0, -3);
// create a nav item to the blog
echo "<a class='nav-item' href='$link'>$blog</a>";
$atag = "<a class='nav-item' href='$link'>$itemname</a>";
}
$blog = substr($blog, strpos($blog, "\n") + 1);
}
// nav item as link to external page
if (substr($blog, 0, 4) == "%URL") {
$itemurl = substr($blog, 6, strpos($blog, "\n") - 6);
$atag = "<a class='nav-item' href='$itemurl'>$itemname</a>";
}
return $atag;
}
/**
@ -67,7 +74,7 @@ class BlogListGenerator
*
* @return string
*/
function getName($file)
public function getName($file)
{
// get the content of the blog file
$blog = file_get_contents($file);
@ -89,7 +96,7 @@ class BlogListGenerator
*
* @return int Amount of files
*/
static function getArticleAmount($blog)
public static function getArticleAmount($blog)
{
$directory = "./articles/" . $blog . "/";
if (!file_exists($directory)) {
@ -97,7 +104,7 @@ class BlogListGenerator
} else {
$i = 0;
$handle = opendir($directory);
while (($file = readdir($handle)) !== false ) {
while (($file = readdir($handle)) !== false) {
if (!in_array($file, array('.','..'))) {
$i++;
}
@ -105,5 +112,26 @@ class BlogListGenerator
return $i;
}
}
/**
* A function returning the external linkn of
* a blog.
*
* @param string $blog the blog name
* @param string $dir root directory of installation
*
* @return string link to external page else null
*/
public function getExternalLink($blog, $dir)
{
$path = $dir . "/blogs/" . $blog;
$blog = file_get_contents($path) . "\n";
if (substr($blog, 0, 6) == "%TITLE") {
$blog = substr($blog, strpos($blog, "\n") + 1);
}
if (substr($blog, 0, 4) == "%URL") {
return substr($blog, 6, strpos($blog, "\n") - 6);
}
return null;
}
}

74
res/php/Config.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**
* PHP Version 7
*
* Configuration parser for yaml configuration files
*
* @category Configuration
* @package Rbe
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
namespace mmk2410\rbe\config;
/**
* PHP Version 7
*
* Configuration parser for yaml configuration files
*
* @category Configuration
* @package Rbe
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
class Config
{
/**
* Path to yaml file
* @var string
*/
private $file;
/**
* Constructor for the Config class
*
* @param $config path to the yaml file
* @param $composer path to the composer autoload
*/
public function __construct($config, $composer)
{
$this->file = $config;
require $composer;
}
/**
* Return yaml config as PHP array
*
* @return config array
*/
public function getConfig()
{
$yaml = new \Symfony\Component\Yaml\Parser();
return $yaml->parse(file_get_contents($this->file));
}
/*
* Write array into confi*
* Write array into config file
*
* @param array config new config
*
* @return FALSE if failed to write
*/
public function writeConfig($config)
{
$dumper = new \Symfony\Component\Yaml\Dumper();
$yaml = $dumper->dump($config, 2);
return file_put_contents($this->file, $yaml);
}
}

View File

@ -22,12 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?php if ($blogdisqus) { // check if disqus is enabled ?>
<?php if ($config['blog']['disqus']) { // check if disqus is enabled ?>
<section class="card">
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = '<?php echo $blogdisqus; ?>';
var disqus_shortname = '<?php echo $config['blog']['disqus']; ?>';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {

View File

@ -26,9 +26,10 @@
*/
if ($bloganalytics) { // check if google analytics is enabled
?>
<script>
if ($config["blog"]["analytics"]) { // check if google analytics is enabled
if (!($_SERVER['HTTP_DNT'] == 1)) {
?>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
@ -36,7 +37,7 @@ if ($bloganalytics) { // check if google analytics is enabled
(i[r].q = i[r].q || []).push(arguments);
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
@ -45,8 +46,9 @@ if ($bloganalytics) { // check if google analytics is enabled
ga('create', '<?php echo $bloganalytics; ?>', 'auto');
ga('send', 'pageview');
</script>
</script>
<?php
<?php
}
}
?>

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Version 5
* PHP Version 7
*
* PHP script for creating the next / prev page links
*
@ -11,26 +11,33 @@
* @link http://marcel-kapfer.de/rangitaki
*/
require_once "BlogListGenerator.php";
require_once "config.php";
require_once "lang/" . $language . ".php";
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
if ($pagination) {
require_once './res/php/Config.php';
$configParser = new mmk2410\rbe\config\Config('./config.yaml', './vendor/autoload.php');
$conf = $configParser->getConfig();
require_once "lang/" . $config["language"] . ".php";
if ($blog["design"]["pagination"]) {
?>
<div class="pag_buttons">
<?php
<?php
if ($pag_min > 0) {
if (isset($getblog)) {
?>
?>
<a href="<?php
echo "?blog=" . $getblog . "&page=" . ($pagenumber - 1);
?>" class="pag_prev button"><?php echo $BLOGLANG["Previous Page"]; ?></a>
<?php
<?php
} else {
?>
?>
<a href="<?php
echo "?page=" . ($pagenumber - 1);
?>" class="pag_prev button"><?php echo $BLOGLANG['Previous Page']; ?></a>
<?php
<?php
}
}
if (isset($getblog)) {
@ -40,20 +47,20 @@ if ($pagination) {
}
if ($pag_max < BlogListGenerator::getArticleAmount($pag_blog)) {
if (isset($getblog)) {
?>
?>
<a href="<?php
echo "?blog=" . $getblog . "&page=" . ($pagenumber + 1);
?>" class="pag_next button"><?php echo $BLOGLANG["Next Page"]; ?></a>
<?php
<?php
} else {
?>
?>
<a href="<?php
echo "?page=" . ($pagenumber + 1);
?>" class="pag_next button"><?php echo $BLOGLANG["Next Page"];?></a>
<?php
<?php
}
}
?>
?>
</div>
<?php
}

View File

@ -0,0 +1,38 @@
###
Rangitaki Project
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
###
###
This is a example JavaScript extension for Rangitaki
###
main = () ->
console.log """
Welcome Developer! \nYou're seeing the output of a
JavaScript extension for the Rangitaki blogging engine.
"""
$(document).ready main()

87
src/coffee/app.coffee Normal file
View File

@ -0,0 +1,87 @@
###
Rangitaki Project
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
###
main = () ->
# FAB
fabActive = false
$('.fabmenu').click ->
if !fabActive
fabFadeIn()
fabActive = true
else
fabFadeOut()
fabActive = false
# Navigation Drawer
navOpen = false
$('.nav-img, .overlay, .nav-close').click ->
if !navOpen
openNav()
navOpen = true
else
closeNav()
navOpen = false
###
Keyhandling for the navigation drawer.
opens the drawer on 'm' (key code: 77)
closes the drawer on 'Esc' (key code: 27)
###
$(document).keyup (e) ->
if navOpen and e.which is 27
closeNav()
navOpen = false
else if !navOpen and e.which == 77
openNav()
navOpen = true
# Make every link in articles target="_blank"
$('.articletext a').attr 'target', '_blank'
$(document).ready main
fabFadeIn = () ->
$('.subfab').fadeIn 125
$('.fab-img').fadeOut 60, ->
$('.fab-img').attr "src", "./res/img/close.svg"
$('.fab-img').fadeIn 60
fabFadeOut = () ->
$('.subfab').fadeOut 125
$('.fab-img').fadeOut 60, ->
$('.fab-img').attr "src", "./res/img/share.svg"
$('.fab-img').fadeIn 60
openNav = () ->
$('.nav').animate {"left": "0px"}, 125
$('.overlay').show()
$('.overlay').animate {"opacity": "0.4"}, 125
closeNav = () ->
$('.nav').animate {"left": "-301px"}, 125
$('.overlay').animate {"opacity": "0.0"}, 125, ->
$('.overlay').css {"display": "none"}

View File

@ -0,0 +1,179 @@
/*
* Rangitaki Project
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
body
font-family: "Roboto", sans-serif
background: #f6f6f6
color: #383838
background-image: url(//example.com/res/img/intro.svg)
background-size: cover
background-attachment: fixed
background-position: top center
background-repeat: no-repeat
.header
background-color: rgba(0, 0, 0, 0.45)
position: fixed
.title
color: #fff
position: absolute
.title > a
color: #fff
.fadeout
background: -moz-linear-gradient(left, rgba(30,87,153,0) 0%, rgba(0, 0, 0, 0.45) 100%)
background: -webkit-linear-gradient(left, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%)
background: -o-linear-gradient(left, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%)
background: -ms-linear-gradient(left, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%)
background: linear-gradient(to right, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%)
.nav
background-color: #fff
border-right: 1px solid #e0e0e0
.nav-item, .nav-item-static
color: #383838
.nav-item
font-weight: 600
.nav-item:active
background-color: #e2e2e2
.divider
border-bottom: 1px solid #e0e0e0
.card
background: #fff
border-radius: 2px
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
.card a
color: #ff4415
text-decoration: none
border-bottom: 1px solid transparent
border-bottom-color: transparent
transition: border-bottom-color 150ms ease-in-out 100ms
.card a:hover
border-bottom-color: #ff4415
.headline
font-size: 24px
color: #383838!important
text-decoration: none
border-bottom: none!important
.headline:hover
color: #ff4415!important
.date
font-size: 13px
.articletext
font-size: 14px
line-height: 24px
.author
font-size: 13px
.tag
font-size: 13px
.fab
background-color: #ff4415
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
.subfab
background-color: #fff
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
.button
border-width: 1px
border-style: solid
text-transform: uppercase
-webkit-box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
-moz-box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
border-radius: 2px
letter-spacing: 0.4px
font-weight: 700
font-size: 14px
transition-property: box-shadow
transition-delay: 50ms
transition-duration: 125ms
transition-timing-function: ease
-o-transition-property: box-shadow
-o-transition-delay: 50ms
-o-transition-duration: 125ms
-o-transition-timing-function: ease
-moz-transition-property: box-shadow
-moz-transition-delay: 50ms
-moz-transition-duration: 125ms
-moz-transition-timing-function: ease
-webkit-transition-property: box-shadow
-webkit-transition-delay: 50ms
-webkit-transition-duration: 125ms
-webkit-transition-timing-function: ease
.button:hover, .button:hover
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85)
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85)
box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85)
.pag_next
background-color: #ff4415
border-color: #ff4415
.pag_prev
background-color: #fff
border-color: #fff
color: #383838
.footer
font-size: 12px
text-align: center
color: #fff
text-shadow: 1px 1px rgba(55, 55, 55, 0.3)
.footer a
color: #fff
text-shadow: 1px 1px rgba(175, 175, 175, 0.3)
text-decoration: none
border-bottom: 1px solid transparent
border-bottom-color: transparent
.footer a:hover
border-bottom-color: #fff
@media screen and (min-width: 1440px)
.nav
background-color: rgba(255, 255, 255, 0.8)

View File

@ -0,0 +1,161 @@
/*
* Rangitaki Project
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
body
font-family: "Roboto", sans-serif
background: #303030
color: #fff
.header
background-color: #212121
position: fixed
box-shadow: 2px 0 2px 2px rgba(32, 32, 32, 0.85)
.title
color: #fff
position: absolute
> a
color: #fff
.fadeout
background: -moz-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #212121 100%)
/* FF3.6+
background: -webkit-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #212121 100%)
/* Chrome10+,Safari5.1+
background: -o-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #212121 100%)
/* Opera 11.10+
background: -ms-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #212121 100%)
/* IE10+
background: linear-gradient(to right, rgba(30, 87, 153, 0) 0%, #212121 100%)
/* W3C
.nav
background-color: #424242
border-right: 1px solid #1f1f1f
.nav-item, .nav-item-static
color: #fff
.nav-item
font-weight: 600
&:active
background-color: #383838
.divider
border-bottom: 1px solid #1f1f1f
.card
background: #424242
border-radius: 2px
box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
a
color: #ff4415
text-decoration: none
border-bottom: 1px solid transparent
border-bottom-color: transparent
transition: border-bottom-color 150ms ease-in-out 100ms
&:hover
border-bottom-color: #ff4415
.headline
font-size: 24px
color: #fff !important
text-decoration: none
border-bottom: none !important
&:hover
color: #ff4415 !important
.date
font-size: 13px
.articletext
font-size: 14px
line-height: 24px
.author, .tag
font-size: 13px
.fab
background-color: #ff4415
box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
.subfab
background-color: #424242
box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
.button
text-transform: uppercase
border-width: 1px
border-style: solid
-webkit-box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
-moz-box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
box-shadow: 0 1px 1.5px 1.5px rgba(42, 42, 42, 0.65)
border-radius: 2px
letter-spacing: 0.4px
font-weight: 700
font-size: 14px
transition-property: box-shadow
transition-delay: 50ms
transition-duration: 125ms
transition-timing-function: ease
-o-transition-property: box-shadow
-o-transition-delay: 50ms
-o-transition-duration: 125ms
-o-transition-timing-function: ease
-moz-transition-property: box-shadow
-moz-transition-delay: 50ms
-moz-transition-duration: 125ms
-moz-transition-timing-function: ease
-webkit-transition-property: box-shadow
-webkit-transition-delay: 50ms
-webkit-transition-duration: 125ms
-webkit-transition-timing-function: ease
&:hover
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85)
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85)
box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85)
.pag_next
background-color: #ff4415
border-color: #ff4415
.pag_prev
background-color: #424242
border-color: #424242
color: #CCCCCC
.footer
font-size: 12px
text-align: center
color: #fff
a
color: #fff
text-decoration: none
border-bottom: 1px solid transparent
border-bottom-color: transparent
&:hover
border-bottom-color: #fff

View File

@ -0,0 +1,156 @@
/*
* Rangitaki Project
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
body
font-family: "Roboto", sans-serif
background: #f6f6f6
color: #383838
.header
background-color: #ff4415
position: fixed
box-shadow: 2px 0 2px 2px rgba(62, 62, 62, 0.45)
.title
color: #fff
position: absolute
> a
color: #fff
.fadeout
background: -moz-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #ff4415 100%)
background: -webkit-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #ff4415 100%)
background: -o-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #ff4415 100%)
background: -ms-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #ff4415 100%)
background: linear-gradient(to right, rgba(30, 87, 153, 0) 0%, #ff4415 100%)
/* W3C
.nav
background-color: #fff
border-right: 1px solid #e0e0e0
.nav-item, .nav-item-static
color: #383838
.nav-item
font-weight: 600
&:hover, &:active
background-color: #e2e2e2
.divider
border-bottom: 1px solid #e0e0e0
.card
background: #fff
border-radius: 2px
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
a
color: #ff4415
text-decoration: none
border-bottom: 1px solid transparent
border-bottom-color: transparent
transition: border-bottom-color 150ms ease-in-out 100ms
&:hover
border-bottom-color: #ff4415
.headline
font-size: 24px
color: #383838 !important
text-decoration: none
border-bottom: none !important
&:hover
color: #ff4415 !important
.date
font-size: 13px
.articletext
font-size: 14px
line-height: 24px
.author, .tag
font-size: 13px
.fab
background-color: #ff4415
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
.subfab
background-color: #fff
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
.button
text-transform: uppercase
border-width: 1px
border-style: solid
-webkit-box-shadow: 0.4px 1px 1.5px 1px #aaa
-moz-box-shadow: 0.4px 1px 1.5px 1px #aaa
box-shadow: 0.4px 1px 1.5px 1px #aaa
border-radius: 2px
letter-spacing: 0.4px
font-weight: 700
font-size: 14px
transition-property: box-shadow
transition-delay: 50ms
transition-duration: 125ms
transition-timing-function: ease
-o-transition-property: box-shadow
-o-transition-delay: 50ms
-o-transition-duration: 125ms
-o-transition-timing-function: ease
-moz-transition-property: box-shadow
-moz-transition-delay: 50ms
-moz-transition-duration: 125ms
-moz-transition-timing-function: ease
-webkit-transition-property: box-shadow
-webkit-transition-delay: 50ms
-webkit-transition-duration: 125ms
-webkit-transition-timing-function: ease
&:hover
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa
box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa
.pag_next
background-color: #ff4415
border-color: #ff4415
.pag_prev
background-color: #fff
border-color: #fff
color: #383838
.footer
font-size: 12px
text-align: center
a
color: #383838
text-decoration: none
border-bottom: 1px solid transparent
border-bottom-color: transparent
&:hover
border-bottom-color: #383838

View File

@ -0,0 +1,194 @@
/*
*The MIT License
*
*Copyright 2015 mmk2410.
*
*Permission is hereby granted, free of charge, to any person obtaining a copy
*of this software and associated documentation files (the "Software"), to deal
*in the Software without restriction, including without limitation the rights
*to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*copies of the Software, and to permit persons to whom the Software is
*furnished to do so, subject to the following conditions:
*
*The above copyright notice and this permission notice shall be included in
*all copies or substantial portions of the Software.
*
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*THE SOFTWARE.
/*
* Created on : Jun 18, 2015, 6:39:37 PM
* Author : mmk2410
$font: "Fira Sans", sans-serif
$background: #f0f0f0
$text-color: #383838
$primary-color: #4CAF50
$header-shadow: rgba(62, 62, 62, 0.45)
$white: #FFFFFF
$fadeout-color: rgba(30, 87, 153, 0)
$border: #e0e0e0
$active-color: #e2e2e2
$fab-shadow: rgba(62, 62, 62, 0.3)
$footer-background: #2D2D2D
body
font-family: $font
background: $background
color: $text-color
margin: 130px 0 0
::selection, ::-moz-selection
color: $background
background-color: $primary-color
.header
height: 55px
background-color: $primary-color
position: fixed
box-shadow: 2px 0 2px 2px $header-shadow
.title
line-height: 55px
color: $white
position: absolute
left: 0
margin-left: calc(20% + 24px)
> a
color: $white
text-decoration: none
.fadeout
height: 55px
background: -moz-linear-gradient(left, $fadeout-color 0%, $primary-color 100%)
background: -webkit-linear-gradient(left, $fadeout-color 0%, $primary-color 100%)
background: -o-linear-gradient(left, $fadeout-color 0%, $primary-color 100%)
background: -ms-linear-gradient(left, $fadeout-color 0%, $primary-color 100%)
background: linear-gradient(to right, $fadeout-color 0%, $primary-color 100%)
.nav-img
padding: 14px 19px
.nav
background-color: $white
border-right: 1px solid $border
.nav-item, .nav-item-static
color: $text-color
.nav-item
font-weight: 600
&:hover
color: $primary-color
&:active
background-color: $active-color
.divider
border-bottom: 1px solid $border
.card
background: none
border-radius: 0
box-shadow: none
margin: 0 20% 100px
width: auto
a
color: $primary-color
text-decoration: none
border-bottom: 1px solid transparent
transition: border-bottom-color 150ms ease-in-out 100ms
&:hover
border-bottom-color: #4CAF50
.headline
font-size: 30px
line-height: 50px
color: #383838 !important
text-decoration: none
border-bottom: none !important
&:hover
color: #4CAF50 !important
.date
font-size: 13px
.articletext
margin-top: 30px
font-size: 16px
line-height: 30px
.author, .tag
font-size: 13px
.fab
background-color: $primary-color
box-shadow: 0 1px 1.5px 1.5px $fab-shadow
.subfab
background-color: $white
box-shadow: 0 1px 1.5px 1.5px $fab-shadow
.button
color: $primary-color
border-bottom: 1px solid transparent
margin: 0
min-width: 0
padding: 0
line-height: 16px
height: 16px
transition-property: border-bottom-color
transition-delay: 50ms
transition-duration: 125ms
transition-timing-function: ease
-moz-transition-property: border-bottom-color
-moz-transition-delay: 50ms
-moz-transition-duration: 125ms
-moz-transition-timing-function: ease
-webkit-transition-property: border-bottom-color
-webkit-transition-delay: 50ms
-webkit-transition-duration: 125ms
-webkit-transition-timing-function: ease
&:hover
border-bottom-color: $primary-color
.pag_prev
float: left
.button:last-child
float: none
.footer
text-align: center
height: 60px
background-color: $footer-background
line-height: 60px
width: 100%
color: $white
a
color: $white
text-decoration: none
border-bottom: 1px solid transparent
&:hover
border-bottom-color: $white
.hljs
background: none
@media screen and (min-width: 1440px)
.title
margin-left: calc(20% - 40px)
.nav
padding-top: 55px
@media screen and (max-width: 800px)
body
margin-top: 80px
.title
margin-left: 20%
.card
margin: 0 5% 100px

46
src/sass/no-nav.sass Normal file
View File

@ -0,0 +1,46 @@
/*
* Rangitaki Project
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* A stylesheet for overriding the default styles if the navigation drawer is disabled
*/
.nav
display: none
.nav-img
display: none
@media screen and (min-width: 1440px)
.header
left: 0
.main
margin-left: 0
width: 100%
@media screen and (max-width: 720px)
.title
left: 25px

252
src/sass/rangitaki.sass Normal file
View File

@ -0,0 +1,252 @@
/*
* Rangitaki Project
*
* The MIT License
*
* Copyright 2015 mmk2410.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* A stylesheet for overriding the default styles if the navigation drawer is disabled
*/
/* BODY */
body
margin-top: 94px
.main
height: 100%
margin-left: 0
.overlay
opacity: 0
position: fixed
top: 0
left: 0
background-color: black
width: 100%
z-index: 30
height: 100%
display: none
/* HEADER */
.header
top: 0
right: 0
left: 0
width: 100%
height: 64px
position: absolute
.title
color: #fff
font-size: 23px
text-decoration: none
line-height: 64px
vertical-align: middle
left: 75px
.title > a
text-decoration: none
color: #fff
.fadeout
position: absolute
height: 64px
top: 0
right: 0
width: 40px
.nav-img
height: 26px
padding: 19px
cursor: pointer
/* NAV DRAWER */
.nav
width: 300px
position: fixed
height: 100%
top: 0
left: -301px
z-index: 40
.nav-item, .nav-item-static
text-decoration: none
text-indent: 0
display: inline-block
height: 48px
vertical-align: middle
width: 284px
line-height: 48px
padding-left: 16px
transition: background-color 125ms ease-in-out 0ms
.nav-close
cursor: pointer
.nav-close-img
height: 35px
padding: 12px
.nav-item
cursor: pointer
.divider
width: 100%
/* MAIN */
.card
margin-right: auto
margin-left: auto
width: 75%
padding: 24px
margin-bottom: 40px
max-width: 1160px
.card a
-moz-hyphens: auto
-epub-hyphens: auto
-ms-hyphens: auto
-webkit-hyphens: auto
hyphens: auto
word-wrap: break-word
.card a:hover
.headline
display: block
padding-bottom: 8px
.card img
max-width: 100%
max-height: 400px
display: block
margin-left: auto
margin-right: auto
.date
.articletext
.author
display: block
.tag
.readmore
padding: 12px 0 25px 0
/* FAB */
.fabmenu
position: fixed
bottom: 20px
right: 20px
.fab
height: 60px
width: 60px
border-radius: 30px
cursor: pointer
.fab-img
width: 28px
padding: 15px
.subfab
height: 45px
width: 45px
border-radius: 30px
margin-right: auto
margin-left: auto
margin-bottom: 25px
display: none
.subfab-img
width: 22px
padding: 12px
/* BUTTON */
.pag_buttons
margin-right: auto
margin-left: auto
width: calc(75% + 48px)
margin-bottom: 80px
max-width: 1160px
text-align: right
.button
text-decoration: none
color: #fff
line-height: 36px
min-width: 64px
text-align: center
height: 36px
padding: 8px
margin-top: 4px
margin-bottom: 5px
cursor: pointer
.pag_next
margin-left: 8px
/* FOOTER */
.footer
.footer a
transition: border-bottom-color 150ms ease-in-out 100ms
.footer a:hover
border-bottom-color: #383838
@media screen and (min-width: 1440px)
.nav
left: 0
padding-top: 64px
.nav-close-img
display: none
.nav-close
display: none
.nav-img
display: none
.header
left: 300px
.main
margin-left: 300px
width: calc(100% - 300px)
@media screen and (max-width: 720px)
.card
width: 82%
.pag_buttons
width: calc(82% + 48px)

View File

@ -0,0 +1,91 @@
<?php
require_once 'PHPUnit/Autoload.php';
include 'res/php/ArticleGenerator.php';
class ArticleGeneratorTest extends \PHPUnit_Framework_TestCase
{
public function testGetArray()
{
$result = [
"title" => "The Rangitaki logo 2",
"date" => "24 July 2015",
"tags" => array(
"design", "artwork", "logo",
),
"author" => "",
"text" => "
This is the official Rangitaki logo.
![The Rangitaki logo](media/example.png)
It is saved in the example blog directory.
",
];
$this->assertEquals(
$result,
ArticleGenerator::getArray("articles/example/", "2015-07-25-example.md")
);
}
public function testGetText()
{
$result = "
This is the official Rangitaki logo.
![The Rangitaki logo](media/example.png)
It is saved in the example blog directory.
";
$this->assertEquals(
$result,
ArticleGenerator::getText("articles/example/", "2015-07-25-example.md")
);
}
public function testGetAuthor()
{
$result = "";
$this->assertEquals(
$result,
ArticleGenerator::getAuthor("articles/example/", "2015-07-25-example.md")
);
}
public function testGetSummary()
{
$result = "This is the official Rangitaki logo.";
$this->assertEquals(
$result,
ArticleGenerator::getSummary("articles/example/", "2015-07-25-example.md")
);
}
public function testGetTags()
{
$result = [ "design", "artwork", "logo" ];
$this->assertEquals(
$result,
ArticleGenerator::getTags("articles/example/", "2015-07-25-example.md")
);
}
public function testGetDate()
{
$result = "24 July 2015";
$this->assertEquals(
$result,
ArticleGenerator::getDate("articles/example/", "2015-07-25-example.md")
);
}
public function testGetTitle()
{
$result = "The Rangitaki logo 2";
$this->assertEquals(
$result,
ArticleGenerator::getTitle("articles/example/", "2015-07-25-example.md")
);
}
}

View File

@ -0,0 +1,39 @@
<?php
use PHPUnit\Framework\TestCase;
require 'res/php/BlogListGenerator.php';
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
class BlogListGeneratorTest extends TestCase
{
public function testListBlog()
{
$this->assertEquals("<a class='nav-item' href='./?blog=example'>Example</a>",
BlogListGenerator::listBlog("./blogs/", "example.md", "Example Blog")
);
$this->assertEquals("<a class='nav-item' href='https://mmk2410.org/rangitaki/docs/'>Docs</a>",
BlogListGenerator::listBlog("./blogs/", "external.md", "Example Blog")
);
}
public function testGetName()
{
$this->assertEquals("Example", BlogListGenerator::getName("blogs/example.md"));
}
public function testGetArticleAmount()
{
$this->assertEquals(5, BlogListGenerator::getArticleAmount("example"));
}
public function testGetExternaleLink()
{
$this->assertEquals(null,
BlogListGenerator::getExternalLink("example.md", '.')
);
$this->assertEquals("https://mmk2410.org/rangitaki/docs/",
BlogListGenerator::getExternalLink("external.md", '.')
);
}
}

83
tests/ConfigTest.php Normal file
View File

@ -0,0 +1,83 @@
<?php
namespace mmk2410\rbe\tests\config;
require_once 'PHPUnit/Autoload.php';
require 'res/php/Config.php';
use \mmk2410\rbe\config\Config as Config;
class ConfigTest extends \PHPUnit_Framework_TestCase
{
public function testGetConfig()
{
$config = [
"blog" => array(
"title" => "Example Blog",
"author" => "John",
"description" => "A short description of your blog",
"home" => "on",
"homeurl" => "../",
"homename" => "Home",
"mainname" => "",
"intro" => "on",
"disqus" => "rangitaki",
"analytics" => "",
"footer" =>
"Rangitaki 2016 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">\n gitlab.com/mmk2410/rangitaki</a>", "url" => "https://example.com/blog/",
),
"design" => array(
"fab" => "on",
"drawer" => "on",
"theme" => "material-light",
"pagination" => 0,
"favicon" => "http://example.com/res/img/favicon.png",
),
"rcc" => array(
"rcc" => "on",
"api" => "on",
),
"language" => "en",
];
$configParser = new Config("./config.yaml", "./vendor/autoload.php");
$this->assertEquals($config, $configParser->getConfig());
}
public function testWriteReadConfig()
{
$changedConfig = [
"blog" => array(
"title" => "Examples Blog",
"author" => "Wilson O'Sullivan",
"description" => "A long description of your blog",
"home" => "on",
"homeurl" => "../",
"homename" => "Exit",
"mainname" => "",
"intro" => "on",
"disqus" => "",
"analytics" => "",
"footer" =>
"pBlog 1102 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">
\n gitlab.com/mmk2410/rangitaki</a>", "url" => "https://example.com/blog/",
),
"design" => array(
"fab" => "off",
"drawer" => "off",
"theme" => "material-dark",
"pagination" => "-1",
"favicon" => "http://sample.com/res/img/favicon.png",
),
"rcc" => array(
"rcc" => "on",
"api" => "off",
),
"language" => "en",
];
$configParser = new Config("/tmp/config-test.yaml", "./vendor/autoload.php");
$configParser->writeConfig($changedConfig);
$this->assertEquals($changedConfig, $configParser->getConfig());
}
}

View File

@ -1,207 +1,3 @@
/*
The MIT License
body{font-family:"Roboto", sans-serif;background:#f6f6f6;color:#383838;background-image:url(//example.com/res/img/intro.svg);background-size:cover;background-attachment:fixed;background-position:top center;background-repeat:no-repeat}.header{background-color:rgba(0,0,0,0.45);position:fixed}.title{color:#fff;position:absolute}.title>a{color:#fff}.fadeout{background:-moz-linear-gradient(left, rgba(30,87,153,0) 0%, rgba(0,0,0,0.45) 100%);background:-webkit-linear-gradient(left, rgba(30,87,153,0) 0%, rgba(0,0,0,0.45) 100%);background:-o-linear-gradient(left, rgba(30,87,153,0) 0%, rgba(0,0,0,0.45) 100%);background:-ms-linear-gradient(left, rgba(30,87,153,0) 0%, rgba(0,0,0,0.45) 100%);background:linear-gradient(to right, rgba(30,87,153,0) 0%, rgba(0,0,0,0.45) 100%)}.nav{background-color:#fff;border-right:1px solid #e0e0e0}.nav-item,.nav-item-static{color:#383838}.nav-item{font-weight:600}.nav-item:active{background-color:#e2e2e2}.divider{border-bottom:1px solid #e0e0e0}.card{background:#fff;border-radius:2px;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.card a{color:#ff4415;text-decoration:none;border-bottom:1px solid transparent;border-bottom-color:transparent;transition:border-bottom-color 150ms ease-in-out 100ms}.card a:hover{border-bottom-color:#ff4415}.headline{font-size:24px;color:#383838 !important;text-decoration:none;border-bottom:none !important}.headline:hover{color:#ff4415 !important}.date{font-size:13px}.articletext{font-size:14px;line-height:24px}.author{font-size:13px}.tag{font-size:13px}.fab{background-color:#ff4415;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.subfab{background-color:#fff;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.button{border-width:1px;border-style:solid;text-transform:uppercase;-webkit-box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65);-moz-box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65);box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65);border-radius:2px;letter-spacing:0.4px;font-weight:700;font-size:14px;transition-property:box-shadow;transition-delay:50ms;transition-duration:125ms;transition-timing-function:ease;-o-transition-property:box-shadow;-o-transition-delay:50ms;-o-transition-duration:125ms;-o-transition-timing-function:ease;-moz-transition-property:box-shadow;-moz-transition-delay:50ms;-moz-transition-duration:125ms;-moz-transition-timing-function:ease;-webkit-transition-property:box-shadow;-webkit-transition-delay:50ms;-webkit-transition-duration:125ms;-webkit-transition-timing-function:ease}.button:hover,.button:hover{-webkit-box-shadow:0.5px 1.8px 2.1px 1.4px rgba(32,32,32,0.85);-moz-box-shadow:0.5px 1.8px 2.1px 1.4px rgba(32,32,32,0.85);box-shadow:0.5px 1.8px 2.1px 1.4px rgba(32,32,32,0.85)}.pag_next{background-color:#ff4415;border-color:#ff4415}.pag_prev{background-color:#fff;border-color:#fff;color:#383838}.footer{font-size:12px;text-align:center;color:#fff;text-shadow:1px 1px rgba(55,55,55,0.3)}.footer a{color:#fff;text-shadow:1px 1px rgba(175,175,175,0.3);text-decoration:none;border-bottom:1px solid transparent;border-bottom-color:transparent}.footer a:hover{border-bottom-color:#fff}@media screen and (min-width: 1440px){.nav{background-color:rgba(255,255,255,0.8)}}
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Created on : Jun 18, 2015, 6:39:37 PM
Author : mmk2410
*/
body{
font-family: "Roboto", sans-serif;
background: #f6f6f6;
color: #383838;
background-image: url(//marcel-kapfer.de/res/img/intro.svg);
background-size: cover;
background-attachment: fixed;
background-position: top center;
background-repeat: no-repeat;
}
.header{
background-color: rgba(0, 0, 0, 0.45);
position: fixed;
}
.title{
color: #fff;
position: absolute;
}
.title > a{
color: #fff;
}
.fadeout{
background: -moz-linear-gradient(left, rgba(30,87,153,0) 0%, rgba(0, 0, 0, 0.45) 100%); /* FF3.6+ */
background: -webkit-linear-gradient(left, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(30,87,153,0) 0%,rgba(0, 0, 0, 0.45) 100%); /* W3C */
}
.nav{
background-color: #fff;
border-right: 1px solid #e0e0e0;
}
.nav-item, .nav-item-static{
color: #383838;
}
.nav-item{
font-weight: 600;
}
.nav-item:active{
background-color: #e2e2e2;
}
.divider{
border-bottom: 1px solid #e0e0e0;
}
.card{
background: #fff;
border-radius: 2px;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
}
.card a{
color: #ff4415;
text-decoration: none;
border-bottom: 1px solid transparent;
border-bottom-color: transparent;
transition: border-bottom-color 150ms ease-in-out 100ms;
}
.card a:hover{
border-bottom-color: #ff4415;
}
.headline{
font-size: 24px;
color: #383838!important;
text-decoration: none;
border-bottom: none!important;
}
.headline:hover {
color: #ff4415!important;
}
.date{
font-size: 13px;
}
.articletext{
font-size: 14px;
line-height: 24px;
}
.author{
font-size: 13px;
}
.tag{
font-size: 13px;
}
.fab{
background-color: #ff4415;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
}
.subfab{
background-color: #fff;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
}
.button {
border-width: 1px;
border-style: solid;
text-transform: uppercase;
box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
-moz-box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
-webkit-box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
border-radius: 2px;
letter-spacing: 0.4px;
font-weight: 700;
font-size: 14px;
transition-property: box-shadow;
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-moz-transition-property: box-shadow;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
-moz-transition-timing-function: ease;
-webkit-transition-property: box-shadow;
-webkit-transition-delay: 50ms;
-webkit-transition-duration: 125ms;
-webkit-transition-timing-function: ease;
}
.button:hover, .button:hover {
box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85);
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85);
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85);
}
.pag_next{
background-color: #ff4415;
border-color: #ff4415;
}
.pag_prev{
background-color: #fff;
border-color: #fff;
color: #383838;
}
.footer{
font-size: 12px;
text-align: center;
color: #fff;
text-shadow: 1px 1px rgba(55, 55, 55, 0.3);
}
.footer a{
color: #fff;
text-shadow: 1px 1px rgba(175, 175, 175, 0.3);
text-decoration: none;
border-bottom: 1px solid transparent;
border-bottom-color: transparent;
}
.footer a:hover{
border-bottom-color: #fff;
}
@media screen and (min-width: 1440px) {
.nav{
background-color: rgba(255, 255, 255, 0.8);
}
}
/*# sourceMappingURL=background-img.css.map */

File diff suppressed because one or more lines are too long

View File

@ -1,193 +1,3 @@
/*
The MIT License
body{font-family:"Roboto", sans-serif;background:#303030;color:#fff}.header{background-color:#212121;position:fixed;box-shadow:2px 0 2px 2px rgba(32,32,32,0.85)}.title{color:#fff;position:absolute}.title>a{color:#fff}.fadeout{background:-moz-linear-gradient(left, rgba(30,87,153,0) 0%, #212121 100%);background:-webkit-linear-gradient(left, rgba(30,87,153,0) 0%, #212121 100%);background:-o-linear-gradient(left, rgba(30,87,153,0) 0%, #212121 100%);background:-ms-linear-gradient(left, rgba(30,87,153,0) 0%, #212121 100%);background:linear-gradient(to right, rgba(30,87,153,0) 0%, #212121 100%)}.nav{background-color:#424242;border-right:1px solid #1f1f1f}.nav-item,.nav-item-static{color:#fff}.nav-item{font-weight:600}.nav-item:active{background-color:#383838}.divider{border-bottom:1px solid #1f1f1f}.card{background:#424242;border-radius:2px;box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65)}.card a{color:#ff4415;text-decoration:none;border-bottom:1px solid transparent;border-bottom-color:transparent;transition:border-bottom-color 150ms ease-in-out 100ms}.card a:hover{border-bottom-color:#ff4415}.headline{font-size:24px;color:#fff !important;text-decoration:none;border-bottom:none !important}.headline:hover{color:#ff4415 !important}.date{font-size:13px}.articletext{font-size:14px;line-height:24px}.author,.tag{font-size:13px}.fab{background-color:#ff4415;box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65)}.subfab{background-color:#424242;box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65)}.button{text-transform:uppercase;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65);-moz-box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65);box-shadow:0 1px 1.5px 1.5px rgba(42,42,42,0.65);border-radius:2px;letter-spacing:0.4px;font-weight:700;font-size:14px;transition-property:box-shadow;transition-delay:50ms;transition-duration:125ms;transition-timing-function:ease;-o-transition-property:box-shadow;-o-transition-delay:50ms;-o-transition-duration:125ms;-o-transition-timing-function:ease;-moz-transition-property:box-shadow;-moz-transition-delay:50ms;-moz-transition-duration:125ms;-moz-transition-timing-function:ease;-webkit-transition-property:box-shadow;-webkit-transition-delay:50ms;-webkit-transition-duration:125ms;-webkit-transition-timing-function:ease}.button:hover{-webkit-box-shadow:0.5px 1.8px 2.1px 1.4px rgba(32,32,32,0.85);-moz-box-shadow:0.5px 1.8px 2.1px 1.4px rgba(32,32,32,0.85);box-shadow:0.5px 1.8px 2.1px 1.4px rgba(32,32,32,0.85)}.pag_next{background-color:#ff4415;border-color:#ff4415}.pag_prev{background-color:#424242;border-color:#424242;color:#CCCCCC}.footer{font-size:12px;text-align:center;color:#fff}.footer a{color:#fff;text-decoration:none;border-bottom:1px solid transparent;border-bottom-color:transparent}.footer a:hover{border-bottom-color:#fff}
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Created on : Jun 18, 2015, 6:39:37 PM
Author : mmk2410
*/
body{
font-family: "Roboto", sans-serif;
background: #303030;
color: #fff;
}
.header{
background-color: #212121;
position: fixed;
box-shadow: 2px 0px 2px 2px rgba(32, 32, 32, 0.85);
}
.title{
color: #fff;
position: absolute;
}
.title > a{
color: #fff;
}
.fadeout{
background: -moz-linear-gradient(left, rgba(30,87,153,0) 0%, #212121 100%); /* FF3.6+ */
background: -webkit-linear-gradient(left, rgba(30,87,153,0) 0%,#212121 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(30,87,153,0) 0%,#212121 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(30,87,153,0) 0%,#212121 100%); /* IE10+ */
background: linear-gradient(to right, rgba(30,87,153,0) 0%,#212121 100%); /* W3C */
}
.nav{
background-color: #424242;
border-right: 1px solid #1f1f1f;
}
.nav-item, .nav-item-static{
color: #fff;
}
.nav-item{
font-weight: 600;
}
.nav-item:active{
background-color: #383838;
}
.divider{
border-bottom: 1px solid #1f1f1f;
}
.card{
background: #424242;
border-radius: 2px;
box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
}
.card a{
color: #ff4415;
text-decoration: none;
border-bottom: 1px solid transparent;
border-bottom-color: transparent;
transition: border-bottom-color 150ms ease-in-out 100ms;
}
.card a:hover{
border-bottom-color: #ff4415;
}
.headline{
font-size: 24px;
color: #fff!important;
text-decoration: none;
border-bottom: none!important;
}
.headline:hover {
color: #ff4415!important;
}
.date{
font-size: 13px;
}
.articletext{
font-size: 14px;
line-height: 24px;
}
.author{
font-size: 13px;
}
.tag{
font-size: 13px;
}
.fab{
background-color: #ff4415;
box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
}
.subfab{
background-color: #424242;
box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
}
.button{
text-transform: uppercase;
border-width: 1px;
border-style: solid;
box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
-moz-box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
-webkit-box-shadow: 0px 1px 1.5px 1.5px rgba(42, 42, 42, 0.65);
border-radius: 2px;
letter-spacing: 0.4px;
font-weight: 700;
font-size: 14px;
transition-property: box-shadow;
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-moz-transition-property: box-shadow;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
-moz-transition-timing-function: ease;
-webkit-transition-property: box-shadow;
-webkit-transition-delay: 50ms;
-webkit-transition-duration: 125ms;
-webkit-transition-timing-function: ease;
}
.button:hover, .button:hover {
box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85);
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85);
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px rgba(32, 32, 32, 0.85);
}
.pag_next{
background-color: #ff4415;
border-color: #ff4415;
}
.pag_prev{
background-color: #424242;
border-color: #424242;
color: #CCCCCC;
}
.footer{
font-size: 12px;
text-align: center;
color: #fff;
}
.footer a{
color: #fff;
text-decoration: none;
border-bottom: 1px solid transparent;
border-bottom-color: transparent;
}
.footer a:hover{
border-bottom-color: #fff;
}
/*# sourceMappingURL=material-dark.css.map */

File diff suppressed because one or more lines are too long

View File

@ -1,196 +1,3 @@
/*
The MIT License
body{font-family:"Roboto", sans-serif;background:#f6f6f6;color:#383838}.header{background-color:#ff4415;position:fixed;box-shadow:2px 0 2px 2px rgba(62,62,62,0.45)}.title{color:#fff;position:absolute}.title>a{color:#fff}.fadeout{background:-moz-linear-gradient(left, rgba(30,87,153,0) 0%, #ff4415 100%);background:-webkit-linear-gradient(left, rgba(30,87,153,0) 0%, #ff4415 100%);background:-o-linear-gradient(left, rgba(30,87,153,0) 0%, #ff4415 100%);background:-ms-linear-gradient(left, rgba(30,87,153,0) 0%, #ff4415 100%);background:linear-gradient(to right, rgba(30,87,153,0) 0%, #ff4415 100%)}.nav{background-color:#fff;border-right:1px solid #e0e0e0}.nav-item,.nav-item-static{color:#383838}.nav-item{font-weight:600}.nav-item:hover,.nav-item:active{background-color:#e2e2e2}.divider{border-bottom:1px solid #e0e0e0}.card{background:#fff;border-radius:2px;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.card a{color:#ff4415;text-decoration:none;border-bottom:1px solid transparent;border-bottom-color:transparent;transition:border-bottom-color 150ms ease-in-out 100ms}.card a:hover{border-bottom-color:#ff4415}.headline{font-size:24px;color:#383838 !important;text-decoration:none;border-bottom:none !important}.headline:hover{color:#ff4415 !important}.date{font-size:13px}.articletext{font-size:14px;line-height:24px}.author,.tag{font-size:13px}.fab{background-color:#ff4415;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.subfab{background-color:#fff;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.button{text-transform:uppercase;border-width:1px;border-style:solid;-webkit-box-shadow:0.4px 1px 1.5px 1px #aaa;-moz-box-shadow:0.4px 1px 1.5px 1px #aaa;box-shadow:0.4px 1px 1.5px 1px #aaa;border-radius:2px;letter-spacing:0.4px;font-weight:700;font-size:14px;transition-property:box-shadow;transition-delay:50ms;transition-duration:125ms;transition-timing-function:ease;-o-transition-property:box-shadow;-o-transition-delay:50ms;-o-transition-duration:125ms;-o-transition-timing-function:ease;-moz-transition-property:box-shadow;-moz-transition-delay:50ms;-moz-transition-duration:125ms;-moz-transition-timing-function:ease;-webkit-transition-property:box-shadow;-webkit-transition-delay:50ms;-webkit-transition-duration:125ms;-webkit-transition-timing-function:ease}.button:hover{-webkit-box-shadow:0.5px 1.8px 2.1px 1.4px #aaa;-moz-box-shadow:0.5px 1.8px 2.1px 1.4px #aaa;box-shadow:0.5px 1.8px 2.1px 1.4px #aaa}.pag_next{background-color:#ff4415;border-color:#ff4415}.pag_prev{background-color:#fff;border-color:#fff;color:#383838}.footer{font-size:12px;text-align:center}.footer a{color:#383838;text-decoration:none;border-bottom:1px solid transparent;border-bottom-color:transparent}.footer a:hover{border-bottom-color:#383838}
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Created on : Jun 18, 2015, 6:39:37 PM
Author : mmk2410
*/
body{
font-family: "Roboto", sans-serif;
background: #f6f6f6;
color: #383838;
}
.header{
background-color: #ff4415;
position: fixed;
box-shadow: 2px 0px 2px 2px rgba(62, 62, 62, 0.45);
}
.title{
color: #fff;
position: absolute;
}
.title > a{
color: #fff;
}
.fadeout{
background: -moz-linear-gradient(left, rgba(30,87,153,0) 0%, #ff4415 100%); /* FF3.6+ */
background: -webkit-linear-gradient(left, rgba(30,87,153,0) 0%,#ff4415 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(30,87,153,0) 0%,#ff4415 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(30,87,153,0) 0%,#ff4415 100%); /* IE10+ */
background: linear-gradient(to right, rgba(30,87,153,0) 0%,#ff4415 100%); /* W3C */
}
.nav{
background-color: #fff;
border-right: 1px solid #e0e0e0;
}
.nav-item, .nav-item-static{
color: #383838;
}
.nav-item{
font-weight: 600;
}
.nav-item:hover{
background-color: #e2e2e2;
}
.nav-item:active{
background-color: #e2e2e2;
}
.divider{
border-bottom: 1px solid #e0e0e0;
}
.card{
background: #fff;
border-radius: 2px;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
}
.card a{
color: #ff4415;
text-decoration: none;
border-bottom: 1px solid transparent;
border-bottom-color: transparent;
transition: border-bottom-color 150ms ease-in-out 100ms;
}
.card a:hover{
border-bottom-color: #ff4415;
}
.headline{
font-size: 24px;
color: #383838!important;
text-decoration: none;
border-bottom: none!important;
}
.headline:hover {
color: #ff4415!important;
}
.date{
font-size: 13px;
}
.articletext{
font-size: 14px;
line-height: 24px;
}
.author{
font-size: 13px;
}
.tag{
font-size: 13px;
}
.fab{
background-color: #ff4415;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
}
.subfab{
background-color: #fff;
box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3);
}
.button {
text-transform: uppercase;
border-width: 1px;
border-style: solid;
box-shadow: 0.4px 1px 1.5px 1px #aaa;
-moz-box-shadow: 0.4px 1px 1.5px 1px #aaa;
-webkit-box-shadow: 0.4px 1px 1.5px 1px #aaa;
border-radius: 2px;
letter-spacing: 0.4px;
font-weight: 700;
font-size: 14px;
transition-property: box-shadow;
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-moz-transition-property: box-shadow;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
-moz-transition-timing-function: ease;
-webkit-transition-property: box-shadow;
-webkit-transition-delay: 50ms;
-webkit-transition-duration: 125ms;
-webkit-transition-timing-function: ease;
}
.button:hover, .button:hover {
box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
-moz-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
-webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa;
}
.pag_next{
background-color: #ff4415;
border-color: #ff4415;
}
.pag_prev{
background-color: #fff;
border-color: #fff;
color: #383838;
}
.footer{
font-size: 12px;
text-align: center;
}
.footer a{
color: #383838;
text-decoration: none;
border-bottom: 1px solid transparent;
border-bottom-color: transparent;
}
.footer a:hover{
border-bottom-color: #383838;
}
/*# sourceMappingURL=material-light.css.map */

File diff suppressed because one or more lines are too long

3
themes/nextDESIGN.css Normal file
View File

@ -0,0 +1,3 @@
body{font-family:"Fira Sans",sans-serif;background:#f0f0f0;color:#383838;margin:130px 0 0}::selection,::-moz-selection{color:#f0f0f0;background-color:#4CAF50}.header{height:55px;background-color:#4CAF50;position:fixed;box-shadow:2px 0 2px 2px rgba(62,62,62,0.45)}.title{line-height:55px;color:#fff;position:absolute;left:0;margin-left:calc(20% + 24px)}.title>a{color:#fff;text-decoration:none}.fadeout{height:55px;background:-moz-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:-webkit-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:-o-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:-ms-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:linear-gradient(to right, rgba(30,87,153,0) 0%, #4CAF50 100%)}.nav-img{padding:14px 19px}.nav{background-color:#fff;border-right:1px solid #e0e0e0}.nav-item,.nav-item-static{color:#383838}.nav-item{font-weight:600}.nav-item:hover{color:#4CAF50}.nav-item:active{background-color:#e2e2e2}.divider{border-bottom:1px solid #e0e0e0}.card{background:none;border-radius:0;box-shadow:none;margin:0 20% 100px;width:auto}.card a{color:#4CAF50;text-decoration:none;border-bottom:1px solid transparent;transition:border-bottom-color 150ms ease-in-out 100ms}.card a:hover{border-bottom-color:#4CAF50}.headline{font-size:30px;line-height:50px;color:#383838 !important;text-decoration:none;border-bottom:none !important}.headline:hover{color:#4CAF50 !important}.date{font-size:13px}.articletext{margin-top:30px;font-size:16px;line-height:30px}.author,.tag{font-size:13px}.fab{background-color:#4CAF50;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.subfab{background-color:#fff;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.button{color:#4CAF50;border-bottom:1px solid transparent;margin:0;min-width:0;padding:0;line-height:16px;height:16px;transition-property:border-bottom-color;transition-delay:50ms;transition-duration:125ms;transition-timing-function:ease;-moz-transition-property:border-bottom-color;-moz-transition-delay:50ms;-moz-transition-duration:125ms;-moz-transition-timing-function:ease;-webkit-transition-property:border-bottom-color;-webkit-transition-delay:50ms;-webkit-transition-duration:125ms;-webkit-transition-timing-function:ease}.button:hover{border-bottom-color:#4CAF50}.pag_prev{float:left}.button:last-child{float:none}.footer{text-align:center;height:60px;background-color:#2D2D2D;line-height:60px;width:100%;color:#fff}.footer a{color:#fff;text-decoration:none;border-bottom:1px solid transparent}.footer a:hover{border-bottom-color:#fff}.hljs{background:none}@media screen and (min-width: 1440px){.title{margin-left:calc(20% - 40px)}.nav{padding-top:55px}}@media screen and (max-width: 800px){body{margin-top:80px}.title{margin-left:20%}.card{margin:0 5% 100px}}
/*# sourceMappingURL=nextDESIGN.css.map */

File diff suppressed because one or more lines are too long

55
update-scripts/1-2-1_1-3-0.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
# Update script for Rangitaki from version 1.2.1 to 1.3.0
version="1.3.0"
tmp="./rbe-tmp"
new="./rbe-new"
conf="./config.php"
echo "Downloading version $version from GitHub..."
mkdir $new
cd $new || exit
wget -c https://github.com/mmk2410/Rangitaki/archive/v"$version".zip
echo "Extracting"
unzip v"$version".zip
rm v"$version".zip
mv ./rangitaki-"$version"/* ./
rm ./rangitaki-"$version"
cd ../ || exit
mkdir $tmp
echo "Updating ressources..."
rm -rf ./res/php/
mv $new/res/php ./res/
echo "Updating RCC..."
cp ./rcc/password.php $tmp
rm -rf ./rcc
mv $new/rcc ./
rm ./rcc/password.php
mv $tmp/password.php ./rcc/
echo "Updating core..."
rm ./index.php
mv $new/index.php ./
echo "Preparing composer..."
mv $new/vendor ./
mv $new/composer.lock ./
mv $new/composer.json ./
echo "Creating empty feeds directory..."
mkdir ./feed
echo "Cleaning up..."
rm -rf $new
rm -rf $tmp
echo "Update config file..."
echo "// Blog URL - set here the url of your blog" >> $conf
echo -n 'Enter the blog URL:'
read -r url
echo "\$blogurl = \"$url\";" >> $conf
echo "Your Rangitaki installation is updated to version $version"

View File

@ -0,0 +1,80 @@
#!/bin/bash
# Update script for Rangitaki from version 1.3.0 to 1.4.0
version="1.4.0"
new="./rbe-new"
echo "Downloading version $version from GitLab..."
git clone https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout master
cd ../
fi
echo "Updating ressources..."
rm -rf ./res/
mv $new/res/ ./
echo "Updating extensions..."
rm ./extensions/example.js
mv $new/extensions/* ./extensions/
echo "Importing binaries..."
mv $new/bin/ ./
echo "Importing source files..."
mv $new/src/ ./
echo "Updating extensions..."
rm ./themes/material-light.css
rm ./themes/material-dark.css
rm ./themes/background-img.css
mv $new/themes/* ./themes/
echo "Updating RCC..."
rm -rf ./rcc
mv $new/rcc ./
rm ./rcc/password.php
echo "Updating core..."
rm ./index.php
mv $new/index.php ./
echo "Preparing composer..."
rm -rf ./vendor/
rm composer.lock
rm composer.json
mv $new/vendor ./
mv $new/composer.lock ./
mv $new/composer.json ./
echo "Preparing npm..."
mv $new/package.json ./
echo "Updating Changelog..."
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "Preparing gulp..."
mv $new/gulpfile.coffee ./
echo "Cleaning up..."
if [[ $1 != "--debug" ]]; then
rm -rf $new
fi
echo "Update config file..."
php bin/config.php
if [ -d "./update-scripts" ]; then
echo "Remove obsolete update scripts folder."
rm -rf "./update-scripts"
fi
echo "Your Rangitaki installation is updated to version $version"

70
update-scripts/1-4-0_1-4-1.sh Executable file
View File

@ -0,0 +1,70 @@
#!/bin/bash
# Update script for Rangitaki from version 1.4.0 to 1.4.1
version="1.4.1"
new="./rbe-new"
echo -n "Downloading version $version from GitLab... "
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout master
cd ../
fi
echo "done"
echo -n "Updating ressources... "
rm -rf ./res/
mv $new/res/ ./
echo "done"
echo -n "Updating binaries... "
rm -rf ./bin
mv $new/bin/ ./
echo "done"
echo -n "Updating source files... "
rm -rf ./src
mv $new/src/ ./
echo "done"
echo -n "Updating RCC... "
rm -rf ./rcc
mv $new/rcc ./
rm ./rcc/password.php
echo "done"
echo -n "Updating core... "
rm ./index.php
mv $new/index.php ./
echo "done"
echo -n "Updating npm... "
mv $new/package.json ./
echo "done"
echo -n "Updating Changelog... "
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "done"
if [[ $1 != "--debug" ]]; then
echo -n "Cleaning up... "
rm -rf $new
echo "done"
fi
if [ -d "./update-scripts" ]; then
echo -n "Remove obsolete update scripts folder... "
rm -rf "./update-scripts"
echo "done"
fi
echo "$version" > ./VERSION
echo "Your Rangitaki installation is updated to version $version"

48
update-scripts/1-4-1_1-4-2.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# Update script for Rangitaki from version 1.4.0 to 1.4.1
version="1.4.2"
new="./rbe-new"
echo -n "Downloading version $version from GitLab... "
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout master
cd ../
fi
echo "done"
echo -n "Updating RCC... "
mv ./rcc/password.php ./
rm -rf ./rcc
mv $new/rcc ./
rm ./rcc/password.php
mv ./password.php ./rcc/
echo "done"
echo -n "Updating Changelog... "
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "done"
if [[ $1 != "--debug" ]]; then
echo -n "Cleaning up... "
rm -rf $new
echo "done"
fi
if [ -d "./update-scripts" ]; then
echo -n "Remove obsolete update scripts folder... "
rm -rf "./update-scripts"
echo "done"
fi
echo "$version" > ./VERSION
echo "Your Rangitaki installation is updated to version $version"

78
update-scripts/1-4-2_1-4-3.sh Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
# Update script for Rangitaki from version 1.4.2 to 1.4.3
# Also works from 1.4.0 to 1.4.3
version="1.4.3"
new="./rbe-new"
echo -n "Downloading version $version from GitLab... "
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout -q master
cd ../
fi
echo "done"
echo -n "Updating ressources... "
rm -rf ./res/
mv $new/res/ ./
echo "done"
echo -n "Updating source files... "
rm ./src/coffee/app.coffee
mv $new/src/coffee/app.coffee ./src/coffee/
mv $new/src/sass-themes/nextDESIGN.sass ./src/sass-themes/
echo "done"
echo -n "Updating RCC... "
rm -rf ./rcc
mv $new/rcc ./
rm ./rcc/password.php
echo "done"
echo -n "Updating core... "
rm ./index.php
mv $new/index.php ./
echo "done"
echo -n "Updating binaries... "
rm -rf ./bin
mv $new/bin/ ./
echo "done"
echo -n "Updating themes... "
rm ./themes/material-light.css*
rm ./themes/material-dark.css*
rm ./themes/background-img.css*
mv $new/themes/* ./themes/
echo "done"
echo -n "Updating npm... "
mv $new/package.json ./
echo "done"
echo -n "Updating Changelog... "
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "done"
echo -n "Cleaning up... "
if [[ $1 != "--debug" ]]; then
echo -n "Cleaning up... "
rm -rf $new
echo "done"
fi
if [ -d "./update-scripts" ]; then
echo -n "Remove obsolete update scripts folder... "
rm -rf "./update-scripts"
echo "done"
fi
echo "Your Rangitaki installation is updated to version $version"

51
update-scripts/1-4-3_1-4-4.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
# Update script for Rangitaki from version 1.4.3 to 1.4.4
version="1.4.4"
new="./rbe-new"
echo -n "Downloading version $version from GitLab... "
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout -q master
cd ../
fi
echo "done"
echo -n "Updating RCC... "
mv ./rcc/password.php ./password.php
rm -rf ./rcc/
mv $new/rcc ./
rm ./rcc/password.php
mv ./password.php ./rcc/password.php
echo "done"
echo -n "Updating npm... "
mv $new/package.json ./
echo "done"
echo -n "Updating Changelog... "
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "done"
echo -n "Cleaning up... "
if [[ $1 != "--debug" ]]; then
echo -n "Cleaning up... "
rm -rf $new
echo "done"
fi
if [ -d "./update-scripts" ]; then
echo -n "Remove obsolete update scripts folder... "
rm -rf "./update-scripts"
echo "done"
fi
echo "Your Rangitaki installation is updated to version $version"

84
update-scripts/1-4-4_1-5-0.sh Executable file
View File

@ -0,0 +1,84 @@
#!/bin/bash
# Update script for Rangitaki from version 1.4.4 to 1.5.0
version="1.5.0"
new="./rbe-new"
echo -n "Downloading version $version from GitLab... "
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout -q master
cd ../
fi
echo "done"
echo -n "Updating ressources... "
rm -rf ./res/
mv $new/res/ ./
echo "done"
echo -n "Updating languages... "
rm -rf ./lang/de.php
rm -rf ./lang/en.php
mv $new/lang/* ./lang/
echo "done"
echo -n "Updating source files... "
rm ./src/sass/rangitaki.sass
mv $new/src/sass/rangitaki.sass ./src/sass/
echo "done"
echo -n "Updating core... "
rm ./index.php
mv $new/index.php ./
echo "done"
echo -n "Updating binaries... "
rm -rf ./bin
mv $new/bin/ ./
echo "done"
echo -n "Updating themes... "
rm ./themes/material-light.css*
rm ./themes/material-dark.css*
rm ./themes/background-img.css*
rm ./themes/nextDESIGN.css*
mv $new/themes/* ./themes/
echo "done"
echo -n "Updating npm... "
mv $new/package.json ./
echo "done"
echo -n 'Updating config script... '
echo "social:" >> ./config.yaml
echo " twitter: ''" >> ./config.yaml
sed -i "s/design:/design:\n excerpt: 'off'/" config.yaml
echo "done"
echo -n "Updating Changelog... "
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "done"
echo -n "Cleaning up... "
if [[ $1 != "--debug" ]]; then
echo -n "Cleaning up... "
rm -rf $new
echo "done"
fi
if [ -d "./update-scripts" ]; then
echo -n "Remove obsolete update scripts folder... "
rm -rf "./update-scripts"
echo "done"
fi
echo "Your Rangitaki installation is updated to version $version"
echo "Run php ./bin/init.php to use set the values for the new features."

7
vendor/autoload.php vendored Normal file
View File

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitd1db2574a85c0ba6f142743249ba228f::getLoader();

1
vendor/bin/picofeed vendored Symbolic link
View File

@ -0,0 +1 @@
../fguillot/picofeed/picofeed

19
vendor/codeguy/upload/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2012 Josh Lockhart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

75
vendor/codeguy/upload/README.md vendored Normal file
View File

@ -0,0 +1,75 @@
# Upload
## Usage
This component simplifies file validation and uploading. Assume a file is uploaded with this HTML form:
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="foo" value=""/>
<input type="submit" value="Upload File"/>
</form>
When the HTML form is submitted, the server-side PHP code can validate and upload the file like this:
<?php
$storage = new \Upload\Storage\FileSystem('/path/to/directory');
$file = new \Upload\File('foo', $storage);
// Optionally you can rename the file on upload
$new_filename = uniqid();
$file->setName($new_filename);
// Validate file upload
// MimeType List => http://www.webmaster-toolkit.com/mime-types.shtml
$file->addValidations(array(
// Ensure file is of type "image/png"
new \Upload\Validation\Mimetype('image/png'),
// Ensure file is no larger than 5M (use "B", "K", M", or "G")
new \Upload\Validation\Size('5M')
));
// Access data about the file that has been uploaded
$data = array(
'name' => $file->getNameWithExtension(),
'extension' => $file->getExtension(),
'mime' => $file->getMimetype(),
'size' => $file->getSize(),
'md5' => $file->getMd5(),
'dimensions' => $file->getDimensions()
);
// Try to upload file
try {
// Success!
$file->upload();
} catch (\Exception $e) {
// Fail!
$errors = $file->getErrors();
}
## How to Install
Install composer in your project:
curl -s https://getcomposer.org/installer | php
Create a composer.json file in your project root:
{
"require": {
"codeguy/upload": "*"
}
}
Install via composer:
php composer.phar install
## Author
[Josh Lockhart](https://github.com/codeguy)
## License
MIT Public License

25
vendor/codeguy/upload/composer.json vendored Normal file
View File

@ -0,0 +1,25 @@
{
"name": "codeguy/upload",
"type": "library",
"description": "Handle file uploads with extensible validation and storage strategies",
"keywords": ["upload", "validation", "file"],
"homepage": "http://github.com/codeguy/Upload",
"license": "MIT",
"authors": [
{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": "https://github.com/codeguy/"
}
],
"require": {
"php": ">=5.3.0",
"ext-fileinfo": "*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": { "Upload": "src" }
}
}

21
vendor/codeguy/upload/phpunit.xml vendored Normal file
View File

@ -0,0 +1,21 @@
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="Upload Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/Upload/</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -0,0 +1,77 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload;
/**
* Autoloader
*
* This class provides a default PSR-0 autoloader if not using Composer.
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
* @package Upload
*/
class Autoloader
{
/**
* The project's base directory
* @var string
*/
static protected $base;
/**
* Register autoloader
*/
static public function register()
{
self::$base = dirname(__FILE__) . '/../';
spl_autoload_register(array(new self, 'autoload'));
}
/**
* Autoload classname
* @param string $className The class to load
*/
static public function autoload($className)
{
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strripos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
require self::$base . $fileName;
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace Upload\Exception;
class UploadException extends \RuntimeException
{
}

View File

@ -0,0 +1,381 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload;
/**
* File
*
* This class provides the implementation for an uploaded file. It exposes
* common attributes for the uploaded file (e.g. name, extension, media type)
* and allows you to attach validations to the file that must pass for the
* upload to succeed.
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
* @package Upload
*/
class File extends \SplFileInfo
{
/********************************************************************************
* Static Properties
*******************************************************************************/
/**
* Upload error code messages
* @var array
*/
protected static $errorCodeMessages = array(
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3 => 'The uploaded file was only partially uploaded',
4 => 'No file was uploaded',
6 => 'Missing a temporary folder',
7 => 'Failed to write file to disk',
8 => 'A PHP extension stopped the file upload'
);
/**
* Lookup hash to convert file units to bytes
* @var array
*/
protected static $units = array(
'b' => 1,
'k' => 1024,
'm' => 1048576,
'g' => 1073741824
);
/********************************************************************************
* Instance Properties
*******************************************************************************/
/**
* Storage delegate
* @var \Upload\Storage\Base
*/
protected $storage;
/**
* Validations
* @var array[\Upload\Validation\Base]
*/
protected $validations;
/**
* Validation errors
* @var array
*/
protected $errors;
/**
* Original file name provided by client (for internal use only)
* @var string
*/
protected $originalName;
/**
* File name (without extension)
* @var string
*/
protected $name;
/**
* File extension (without leading dot)
* @var string
*/
protected $extension;
/**
* File mimetype (e.g. "image/png")
* @var string
*/
protected $mimetype;
/**
* Upload error code (for internal use only)
* @var int
* @link http://www.php.net/manual/en/features.file-upload.errors.php
*/
protected $errorCode;
/**
* Constructor
* @param string $key The file's key in $_FILES superglobal
* @param \Upload\Storage\Base $storage The method with which to store file
* @throws \Upload\Exception\UploadException If file uploads are disabled in the php.ini file
* @throws \InvalidArgumentException If $_FILES key does not exist
*/
public function __construct($key, \Upload\Storage\Base $storage)
{
if (!isset($_FILES[$key])) {
throw new \InvalidArgumentException("Cannot find uploaded file identified by key: $key");
}
$this->storage = $storage;
$this->validations = array();
$this->errors = array();
$this->originalName = $_FILES[$key]['name'];
$this->errorCode = $_FILES[$key]['error'];
parent::__construct($_FILES[$key]['tmp_name']);
}
/**
* Get name
* @return string
*/
public function getName()
{
if (!isset($this->name)) {
$this->name = pathinfo($this->originalName, PATHINFO_FILENAME);
}
return $this->name;
}
/**
* Set name (without extension)
* @param string $name
* @return \Upload\File Self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get file name with extension
* @return string
*/
public function getNameWithExtension()
{
return sprintf('%s.%s', $this->getName(), $this->getExtension());
}
/**
* Get file extension (without leading dot)
* @return string
*/
public function getExtension()
{
if (!isset($this->extension)) {
$this->extension = strtolower(pathinfo($this->originalName, PATHINFO_EXTENSION));
}
return $this->extension;
}
/**
* Get mimetype
* @return string
*/
public function getMimetype()
{
if (!isset($this->mimeType)) {
$finfo = new \finfo(FILEINFO_MIME);
$mimetype = $finfo->file($this->getPathname());
$mimetypeParts = preg_split('/\s*[;,]\s*/', $mimetype);
$this->mimetype = strtolower($mimetypeParts[0]);
unset($finfo);
}
return $this->mimetype;
}
/**
* Get md5
* @return string
*/
public function getMd5()
{
return md5_file($this->getPathname());
}
/**
* Get image dimensions
* @return array formatted array of dimensions
*/
public function getDimensions()
{
list($width, $height) = getimagesize($this->getPathname());
return array(
'width' => $width,
'height' => $height
);
}
/********************************************************************************
* Validate
*******************************************************************************/
/**
* Add file validations
* @param \Upload\Validation\Base|array[\Upload\Validation\Base] $validations
*/
public function addValidations($validations)
{
if (!is_array($validations)) {
$validations = array($validations);
}
foreach ($validations as $validation) {
if ($validation instanceof \Upload\Validation\Base) {
$this->validations[] = $validation;
}
}
}
/**
* Get file validations
* @return array[\Upload\Validation\Base]
*/
public function getValidations()
{
return $this->validations;
}
/**
* Validate file
* @return bool True if valid, false if invalid
*/
public function validate()
{
// Validate is uploaded OK
if ($this->isOk() === false) {
$this->errors[] = self::$errorCodeMessages[$this->errorCode];
}
// Validate is uploaded file
if ($this->isUploadedFile() === false) {
$this->errors[] = 'The uploaded file was not sent with a POST request';
}
// User validations
foreach ($this->validations as $validation) {
if ($validation->validate($this) === false) {
$this->errors[] = $validation->getMessage();
}
}
return empty($this->errors);
}
/**
* Get file validation errors
* @return array[String]
*/
public function getErrors()
{
return $this->errors;
}
/**
* Add file validation error
* @param string
* @return \Upload\File Self
*/
public function addError($error)
{
$this->errors[] = $error;
return $this;
}
/********************************************************************************
* Upload
*******************************************************************************/
/**
* Upload file (delegated to storage object)
* @param string $newName Give the file it a new name
* @return bool
* @throws \Upload\Exception\UploadException If file does not validate
*/
public function upload($newName = null)
{
if ($this->validate() === false) {
throw new \Upload\Exception\UploadException('File validation failed');
}
// Update the name, leaving out the extension
if (is_string($newName)) {
$this->name = pathinfo($newName, PATHINFO_FILENAME);
}
return $this->storage->upload($this, $newName);
}
/********************************************************************************
* Helpers
*******************************************************************************/
/**
* Is this file uploaded with a POST request?
*
* This is a separate method so that it can be stubbed in unit tests to avoid
* the hard dependency on the `is_uploaded_file` function.
*
* @return bool
*/
public function isUploadedFile()
{
return is_uploaded_file($this->getPathname());
}
/**
* Is this file OK?
*
* This method inspects the upload error code to see if the upload was
* successful or if it failed for a variety of reasons.
*
* @link http://www.php.net/manual/en/features.file-upload.errors.php
* @return bool
*/
public function isOk()
{
return ($this->errorCode === UPLOAD_ERR_OK);
}
/**
* Convert human readable file size (e.g. "10K" or "3M") into bytes
* @param string $input
* @return int
*/
public static function humanReadableToBytes($input)
{
$number = (int)$input;
$unit = strtolower(substr($input, -1));
if (isset(self::$units[$unit])) {
$number = $number * self::$units[$unit];
}
return $number;
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload\Storage;
/**
* Upload Storage Base
*
* This class defines the interface that must be implemented by each
* concrete Upload storage subclass.
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
*/
abstract class Base
{
abstract public function upload(\Upload\File $file, $newName = null);
}

View File

@ -0,0 +1,114 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload\Storage;
/**
* FileSystem Storage
*
* This class uploads files to a designated directory on the filesystem.
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
* @package Upload
*/
class FileSystem extends \Upload\Storage\Base
{
/**
* Upload directory
* @var string
*/
protected $directory;
/**
* Overwrite existing files?
* @var bool
*/
protected $overwrite;
/**
* Constructor
* @param string $directory Relative or absolute path to upload directory
* @param bool $overwrite Should this overwrite existing files?
* @throws \InvalidArgumentException If directory does not exist
* @throws \InvalidArgumentException If directory is not writable
*/
public function __construct($directory, $overwrite = false)
{
if (!is_dir($directory)) {
throw new \InvalidArgumentException('Directory does not exist');
}
if (!is_writable($directory)) {
throw new \InvalidArgumentException('Directory is not writable');
}
$this->directory = rtrim($directory, '/') . DIRECTORY_SEPARATOR;
$this->overwrite = $overwrite;
}
/**
* Upload
* @param \Upload\File $file The file object to upload
* @param string $newName Give the file it a new name
* @return bool
* @throws \RuntimeException If overwrite is false and file already exists
*/
public function upload(\Upload\File $file, $newName = null)
{
if (is_string($newName)) {
$fileName = strpos($newName, '.') ? $newName : $newName.'.'.$file->getExtension();
} else {
$fileName = $file->getNameWithExtension();
}
$newFile = $this->directory . $fileName;
if ($this->overwrite === false && file_exists($newFile)) {
$file->addError('File already exists');
throw new \Upload\Exception\UploadException('File already exists');
}
return $this->moveUploadedFile($file->getPathname(), $newFile);
}
/**
* Move uploaded file
*
* This method allows us to stub this method in unit tests to avoid
* hard dependency on the `move_uploaded_file` function.
*
* @param string $source The source file
* @param string $destination The destination file
* @return bool
*/
protected function moveUploadedFile($source, $destination)
{
return move_uploaded_file($source, $destination);
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload\Validation;
/**
* Upload Validation Base
*
* This class provides the common implementation and abstract interface
* for all concrete Upload validation subclasses.
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
* @package Upload
*/
abstract class Base
{
/**
* The error message for this validation
* @var string
*/
protected $message;
/**
* Set error message
* @param string $message
*/
public function setMessage($message)
{
$this->message = $message;
}
/**
* Get error message
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* Validate file
* @param \Upload\File $file
* @return bool True if file is valid, false if file is not valid
*/
abstract public function validate(\Upload\File $file);
}

View File

@ -0,0 +1,95 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload\Validation;
/**
* Validate File Extension
*
* This class validates an uploads file extension. It takes file extension with out dot
* or array of extensions. For example: 'png' or array('jpg', 'png', 'gif').
*
* WARING! Validation only by file extension not very secure.
*
* @author Alex Kucherenko <kucherenko.email@gmail.com>
* @package Upload
*/
class Extension extends \Upload\Validation\Base
{
/**
* Array of cceptable file extensions without leading dots
* @var array
*/
protected $allowedExtensions;
/**
* Error message
* @var string
*/
protected $message = 'Invalid file extension. Must be one of: %s';
/**
* Constructor
*
* @param string|array $allowedExtensions Allowed file extensions
* @example new \Upload\Validation\Extension(array('png','jpg','gif'))
* @example new \Upload\Validation\Extension('png')
*/
public function __construct($allowedExtensions)
{
if (is_string($allowedExtensions)) {
$allowedExtensions = array($allowedExtensions);
}
array_filter($allowedExtensions, function ($val) {
return strtolower($val);
});
$this->allowedExtensions = $allowedExtensions;
}
/**
* Validate
* @param \Upload\File $file
* @return bool
*/
public function validate(\Upload\File $file)
{
$fileExtension = strtolower($file->getExtension());
$isValid = true;
if (!in_array($fileExtension, $this->allowedExtensions)) {
$this->setMessage(sprintf($this->message, implode(', ', $this->allowedExtensions)));
$isValid = false;
}
return $isValid;
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload\Validation;
/**
* Validate Upload Media Type
*
* This class validates an upload's media type (e.g. "image/png").
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
* @package Upload
*/
class Mimetype extends \Upload\Validation\Base
{
/**
* Valid media types
* @var array
*/
protected $mimetypes;
/**
* Error message
* @var string
*/
protected $message = 'Invalid mimetype';
/**
* Constructor
* @param array $mimetypes Array of valid mimetypes
*/
public function __construct($mimetypes)
{
if (!is_array($mimetypes)) {
$mimetypes = array($mimetypes);
}
$this->mimetypes = $mimetypes;
}
/**
* Validate
* @param \Upload\File $file
* @return bool
*/
public function validate(\Upload\File $file)
{
return in_array($file->getMimetype(), $this->mimetypes);
}
}

View File

@ -0,0 +1,104 @@
<?php
/**
* Upload
*
* @author Josh Lockhart <info@joshlockhart.com>
* @copyright 2012 Josh Lockhart
* @link http://www.joshlockhart.com
* @version 1.0.0
*
* MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Upload\Validation;
/**
* Validate Upload File Size
*
* This class validates an uploads file size using maximum and (optionally)
* minimum file size bounds (inclusive). Specify acceptable file sizes
* as an integer (in bytes) or as a human-readable string (e.g. "5MB").
*
* @author Josh Lockhart <info@joshlockhart.com>
* @since 1.0.0
* @package Upload
*/
class Size extends \Upload\Validation\Base
{
/**
* Minimum acceptable file size (bytes)
* @var int
*/
protected $minSize;
/**
* Maximum acceptable file size (bytes)
* @var int
*/
protected $maxSize;
/**
* Error message
* @var string
*/
protected $message = 'Invalid file size';
/**
* Constructor
* @param int $maxSize Maximum acceptable file size in bytes (inclusive)
* @param int $minSize Minimum acceptable file size in bytes (inclusive)
*/
public function __construct($maxSize, $minSize = 0)
{
if (is_string($maxSize)) {
$maxSize = \Upload\File::humanReadableToBytes($maxSize);
}
$this->maxSize = $maxSize;
if (is_string($minSize)) {
$minSize = \Upload\File::humanReadableToBytes($minSize);
}
$this->minSize = $minSize;
}
/**
* Validate
* @param \Upload\File $file
* @return bool
*/
public function validate(\Upload\File $file)
{
$fileSize = $file->getSize();
$isValid = true;
if ($fileSize < $this->minSize) {
$this->setMessage('File size is too small');
$isValid = false;
}
if ($fileSize > $this->maxSize) {
$this->setMessage('File size is too large');
$isValid = false;
}
return $isValid;
}
}

176
vendor/codeguy/upload/tests/FileTest.php vendored Normal file
View File

@ -0,0 +1,176 @@
<?php
class FileTest extends PHPUnit_Framework_TestCase
{
protected $assetsDirectory;
protected $storage;
/********************************************************************************
* Setup
*******************************************************************************/
public function setUp()
{
$this->assetsDirectory = dirname(__FILE__) . '/assets';
$_FILES['foo'] = array(
'name' => 'foo.txt',
'tmp_name' => $this->assetsDirectory . '/foo.txt',
'error' => UPLOAD_ERR_OK
);
}
public function getNewFile()
{
if (is_null($this->storage)) {
// Prepare storage
$this->storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('upload'),
array($this->assetsDirectory)
);
$this->storage->expects($this->any())
->method('upload')
->will($this->returnValue(true));
}
// Prepare file
$file = $this->getMock(
'\Upload\File',
array('isUploadedFile'),
array('foo', $this->storage)
);
$file->expects($this->any())
->method('isUploadedFile')
->will($this->returnValue(true));
return $file;
}
/********************************************************************************
* Tests
*******************************************************************************/
/**
* @expectedException \InvalidArgumentException
*/
public function testConstructionWithInvalidKey()
{
$file = new \Upload\File('bar', new \Upload\Storage\FileSystem($this->assetsDirectory));
}
public function testGetName()
{
$file = $this->getNewFile();
$this->assertEquals('foo', $file->getName());
}
public function testGetNameWithExtension()
{
$file = $this->getNewFile();
$this->assertEquals('foo.txt', $file->getNameWithExtension());
}
public function testGetNameWithExtensionUsingCustomName()
{
$file = $this->getNewFile();
$file->setName('bar');
$this->assertEquals('bar.txt', $file->getNameWithExtension());
}
public function testGetMimetype()
{
$file = $this->getNewFile();
$this->assertEquals('text/plain', $file->getMimetype());
}
public function testAddValidationErrors()
{
$file = $this->getNewFile();
$file->addError('Error');
$this->assertEquals(1, count($file->getErrors()));
}
public function testIsValidIfNoValidations()
{
$file = $this->getNewFile();
$this->assertEmpty($file->getErrors());
}
public function testWillUploadIfNoValidations()
{
$file = $this->getNewFile();
$this->assertTrue($file->upload());
}
public function testAddValidations()
{
$file = $this->getNewFile();
$file->addValidations(new \Upload\Validation\Mimetype(array(
'text/plain'
)));
$this->assertEquals(1, count($file->getValidations()));
}
public function testWillUploadWithPassingValidations()
{
$file = $this->getNewFile();
$file->addValidations(new \Upload\Validation\Mimetype(array(
'text/plain'
)));
$this->assertTrue($file->upload());
}
/**
* @expectedException \Upload\Exception\UploadException
*/
public function testWillNotUploadWithFailingValidations()
{
$file = $this->getNewFile();
$file->addValidations(new \Upload\Validation\Mimetype(array(
'image/png'
)));
$file->upload();
}
public function testPopulatesErrorsWithFailingValidations()
{
$file = $this->getNewFile();
$file->addValidations(new \Upload\Validation\Mimetype(array(
'image/png'
)));
try {
$file->upload();
} catch(\Upload\Exception\UploadException $e) {
$this->assertEquals(1, count($file->getErrors()));
}
}
public function testValidationFailsIfUploadErrorCode()
{
$_FILES['foo']['error'] = 4;
$file = $this->getNewFile();
$this->assertFalse($file->validate());
}
public function testValidationFailsIfNotUploadedFile()
{
$file = $this->getMock(
'\Upload\File',
array('isUploadedFile'),
array('foo', new \Upload\Storage\FileSystem($this->assetsDirectory))
);
$file->expects($this->any())
->method('isUploadedFile')
->will($this->returnValue(false));
$this->assertFalse($file->validate());
}
public function testParsesHumanFriendlyFileSizes()
{
$this->assertEquals(100, \Upload\File::humanReadableToBytes('100'));
$this->assertEquals(102400, \Upload\File::humanReadableToBytes('100K'));
$this->assertEquals(104857600, \Upload\File::humanReadableToBytes('100M'));
$this->assertEquals(107374182400, \Upload\File::humanReadableToBytes('100G'));
$this->assertEquals(100, \Upload\File::humanReadableToBytes('100F')); // <-- Unrecognized. Assume bytes.
}
}

View File

@ -0,0 +1,79 @@
<?php
class FileSystemTest extends PHPUnit_Framework_TestCase
{
/**
* Setup (each test)
*/
public function setUp()
{
// Path to test assets
$this->assetsDirectory = dirname(__DIR__) . '/assets';
// Reset $_FILES superglobal
$_FILES['foo'] = array(
'name' => 'foo.txt',
'tmp_name' => $this->assetsDirectory . '/foo.txt',
'error' => 0
);
}
public function testInstantiationWithValidDirectory()
{
try {
$storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('upload'),
array($this->assetsDirectory)
);
} catch(\InvalidArgumentException $e) {
$this->fail('Unexpected argument thrown during instantiation with valid directory');
}
}
/**
* @expectedException \InvalidArgumentException
*/
public function testInstantiationWithInvalidDirectory()
{
$storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('upload'),
array('/foo')
);
}
/**
* Test won't overwrite existing file
* @expectedException \RuntimeException
*/
public function testWillNotOverwriteFile()
{
$storage = new \Upload\Storage\FileSystem($this->assetsDirectory, false);
$file = new \Upload\File('foo', $storage);
$file->upload();
}
/**
* Test will overwrite existing file
*/
public function testWillOverwriteFile()
{
$storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('moveUploadedFile'),
array($this->assetsDirectory, true)
);
$storage->expects($this->any())
->method('moveUploadedFile')
->will($this->returnValue(true));
$file = $this->getMock(
'\Upload\File',
array('isUploadedFile'),
array('foo', $storage)
);
$file->expects($this->any())
->method('isUploadedFile')
->will($this->returnValue(true));
$this->assertTrue($file->upload());
}
}

View File

@ -0,0 +1,43 @@
<?php
class ExtensionTest extends PHPUnit_Framework_TestCase
{
/**
* Setup (each test)
*/
public function setUp()
{
// Path to test assets
$this->assetsDirectory = dirname(__DIR__) . '/assets';
// Create stubbed storage instance
$this->storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('upload'),
array($this->assetsDirectory)
);
$this->storage->expects($this->any())
->method('upload')
->will($this->returnValue(true));
// Reset $_FILES superglobal
$_FILES['foo'] = array(
'name' => 'foo.txt',
'tmp_name' => $this->assetsDirectory . '/foo.txt',
'error' => 0
);
}
public function testValidExtension()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Extension('txt');
$this->assertTrue($validation->validate($file));
}
public function testInvalidExtension()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Extension('csv');
$this->assertFalse($validation->validate($file));
}
}

View File

@ -0,0 +1,47 @@
<?php
class MimetypeTest extends PHPUnit_Framework_TestCase
{
/**
* Setup (each test)
*/
public function setUp()
{
// Path to test assets
$this->assetsDirectory = dirname(__DIR__) . '/assets';
// Create stubbed storage instance
$this->storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('upload'),
array($this->assetsDirectory)
);
$this->storage->expects($this->any())
->method('upload')
->will($this->returnValue(true));
// Reset $_FILES superglobal
$_FILES['foo'] = array(
'name' => 'foo.txt',
'tmp_name' => $this->assetsDirectory . '/foo.txt',
'error' => 0
);
}
public function testValidMimetype()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Mimetype(array(
'text/plain'
));
$this->assertTrue($validation->validate($file));
}
public function testInvalidMimetype()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Mimetype(array(
'image/png'
));
$this->assertFalse($validation->validate($file));
}
}

View File

@ -0,0 +1,57 @@
<?php
class SizeTest extends PHPUnit_Framework_TestCase
{
/**
* Setup (each test)
*/
public function setUp()
{
// Path to test assets
$this->assetsDirectory = dirname(__DIR__) . '/assets';
// Create stubbed storage instance
$this->storage = $this->getMock(
'\Upload\Storage\FileSystem',
array('upload'),
array($this->assetsDirectory)
);
$this->storage->expects($this->any())
->method('upload')
->will($this->returnValue(true));
// Reset $_FILES superglobal
$_FILES['foo'] = array(
'name' => 'foo.txt',
'tmp_name' => $this->assetsDirectory . '/foo.txt',
'error' => 0
);
}
public function testValidFileSize()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Size(500);
$this->assertTrue($validation->validate($file));
}
public function testValidFileSizeWithHumanReadableArgument()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Size('500B');
$this->assertTrue($validation->validate($file));
}
public function testInvalidFileSize()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Size(400);
$this->assertFalse($validation->validate($file));
}
public function testInvalidFileSizeWithHumanReadableArgument()
{
$file = new \Upload\File('foo', $this->storage);
$validation = new \Upload\Validation\Size('400B');
$this->assertFalse($validation->validate($file));
}
}

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