aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-04-27 12:37:01 +0200
committerThomas Lange <code@nerdmind.de>2017-04-27 12:37:01 +0200
commit22dacc02179643ddd4578a34cf8693ef86791cf7 (patch)
treee5d575fcf12d30aee0eb21e4259ed5d611df37de
parent39944454324b4c66b8cf2444cca17c149208dfac (diff)
downloadblog-2.0.tar.gz
blog-2.0.tar.xz
blog-2.0.zip
Several changes have been made in this commit, which together with the previous commits result in version 2.0 (database update required):v2.0
+ Implemented [core]: A new database field has been added to all tables to define optional "arguments" for a page, post or user through the content editor. These arguments will be parsed into key->value pairs and can be used within templates to do something special. Please read the wiki of this repository for further information about this new feature. + Bugfix [core]: The function "makeSlugURL" had not convert uppercase umlauts to lowercase because "strtolower" was used instead of the multibyte equivalent "mb_strtolower". + Optimization [core]: The first regular expression within the function "makeSlugURL" has been optimized (checking for uppercase characters at this point is unnecessary because $string is only lowercase). + Optimization [all templates]: Markup for the pagination.php has been simplified (a little bit). + Optimization [admin template]: The javascript for the arrow key navigation has been outsourced to the main.js file. + Optimization [admin template]: The javascript file will now be included with the "defer" attribute. + Optimization [standard template]: Some language variables have been changed. Database update to version 2.0 (no existing data will be lost or changed): ALTER TABLE `page` ADD `argv` VARCHAR(100) NULL DEFAULT NULL AFTER `body`; ALTER TABLE `post` ADD `argv` VARCHAR(100) NULL DEFAULT NULL AFTER `body`; ALTER TABLE `user` ADD `argv` VARCHAR(100) NULL DEFAULT NULL AFTER `body`;
-rw-r--r--admin/page/insert.php6
-rw-r--r--admin/page/update.php6
-rw-r--r--admin/post/insert.php4
-rw-r--r--admin/post/update.php6
-rw-r--r--admin/user/insert.php4
-rw-r--r--admin/user/update.php4
-rw-r--r--core/functions.php8
-rw-r--r--core/namespace/Item.php17
-rw-r--r--core/namespace/Page/Attribute.php1
-rw-r--r--core/namespace/Post/Attribute.php1
-rw-r--r--core/namespace/User/Attribute.php1
-rw-r--r--database.sql21
-rw-r--r--template/admin/html/main.php2
-rw-r--r--template/admin/html/page/form.php3
-rw-r--r--template/admin/html/pagination.php51
-rw-r--r--template/admin/html/post/form.php3
-rw-r--r--template/admin/html/user/form.php3
-rw-r--r--template/admin/rsrc/main.js16
-rw-r--r--template/standard/html/pagination.php35
-rw-r--r--template/standard/lang/de.php4
-rw-r--r--template/standard/lang/en.php2
21 files changed, 122 insertions, 76 deletions
diff --git a/admin/page/insert.php b/admin/page/insert.php
index fc89b20..5731b6f 100644
--- a/admin/page/insert.php
+++ b/admin/page/insert.php
@@ -12,12 +12,13 @@ require '../../core/application.php';
$Attribute = new Page\Attribute();
-if(HTTP::issetPOST('id', 'user', 'slug', 'name', 'body', 'time_insert', 'time_update', 'insert')) {
+if(HTTP::issetPOST('id', 'user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'insert')) {
$Attribute->set('id', HTTP::POST('id') ? HTTP::POST('id') : FALSE);
$Attribute->set('user', HTTP::POST('user'));
$Attribute->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : makeSlugURL(HTTP::POST('name')));
$Attribute->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL);
- $Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : FALSE);
+ $Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL);
+ $Attribute->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL);
$Attribute->set('time_insert', HTTP::POST('time_insert') ? HTTP::POST('time_insert') : date('Y-m-d H:i:s'));
$Attribute->set('time_update', HTTP::POST('time_update') ? HTTP::POST('time_update') : date('Y-m-d H:i:s'));
@@ -61,6 +62,7 @@ try {
'SLUG' => $Attribute->get('slug'),
'NAME' => $Attribute->get('name'),
'BODY' => $Attribute->get('body'),
+ 'ARGV' => $Attribute->get('argv'),
'TIME_INSERT' => $Attribute->get('time_insert'),
'TIME_UPDATE' => $Attribute->get('time_update'),
],
diff --git a/admin/page/update.php b/admin/page/update.php
index a5e723e..dc92073 100644
--- a/admin/page/update.php
+++ b/admin/page/update.php
@@ -17,11 +17,12 @@ try {
$Page = Page\Factory::build(HTTP::GET('id'));
$Attribute = $Page->getAttribute();
- if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'time_insert', 'time_update', 'update')) {
+ if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'update')) {
$Attribute->set('user', HTTP::POST('user'));
$Attribute->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : makeSlugURL(HTTP::POST('name')));
$Attribute->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL);
- $Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : FALSE);
+ $Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL);
+ $Attribute->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL);
$Attribute->set('time_insert', HTTP::POST('time_insert') ? HTTP::POST('time_insert') : date('Y-m-d H:i:s'));
$Attribute->set('time_update', HTTP::POST('time_update') ? HTTP::POST('time_update') : date('Y-m-d H:i:s'));
@@ -63,6 +64,7 @@ try {
'SLUG' => $Attribute->get('slug'),
'NAME' => $Attribute->get('name'),
'BODY' => $Attribute->get('body'),
+ 'ARGV' => $Attribute->get('argv'),
'TIME_INSERT' => $Attribute->get('time_insert'),
'TIME_UPDATE' => $Attribute->get('time_update'),
],
diff --git a/admin/post/insert.php b/admin/post/insert.php
index bcfb679..4587a87 100644
--- a/admin/post/insert.php
+++ b/admin/post/insert.php
@@ -12,12 +12,13 @@ require '../../core/application.php';
$Attribute = new Post\Attribute();
-if(HTTP::issetPOST('id', 'user', 'slug', 'name', 'body', 'time_insert', 'time_update', 'insert')) {
+if(HTTP::issetPOST('id', 'user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'insert')) {
$Attribute->set('id', HTTP::POST('id') ? HTTP::POST('id') : FALSE);
$Attribute->set('user', HTTP::POST('user'));
$Attribute->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : makeSlugURL(HTTP::POST('name')));
$Attribute->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL);
$Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL);
+ $Attribute->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL);
$Attribute->set('time_insert', HTTP::POST('time_insert') ? HTTP::POST('time_insert') : date('Y-m-d H:i:s'));
$Attribute->set('time_update', HTTP::POST('time_update') ? HTTP::POST('time_update') : date('Y-m-d H:i:s'));
@@ -61,6 +62,7 @@ try {
'SLUG' => $Attribute->get('slug'),
'NAME' => $Attribute->get('name'),
'BODY' => $Attribute->get('body'),
+ 'ARGV' => $Attribute->get('argv'),
'TIME_INSERT' => $Attribute->get('time_insert'),
'TIME_UPDATE' => $Attribute->get('time_update'),
],
diff --git a/admin/post/update.php b/admin/post/update.php
index 109c056..7e3610f 100644
--- a/admin/post/update.php
+++ b/admin/post/update.php
@@ -17,11 +17,12 @@ try {
$Post = Post\Factory::build(HTTP::GET('id'));
$Attribute = $Post->getAttribute();
- if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'time_insert', 'time_update', 'update')) {
+ if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'update')) {
$Attribute->set('user', HTTP::POST('user'));
$Attribute->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : makeSlugURL(HTTP::POST('name')));
$Attribute->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL);
- $Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : FALSE);
+ $Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL);
+ $Attribute->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL);
$Attribute->set('time_insert', HTTP::POST('time_insert') ? HTTP::POST('time_insert') : date('Y-m-d H:i:s'));
$Attribute->set('time_update', HTTP::POST('time_update') ? HTTP::POST('time_update') : date('Y-m-d H:i:s'));
@@ -63,6 +64,7 @@ try {
'SLUG' => $Attribute->get('slug'),
'NAME' => $Attribute->get('name'),
'BODY' => $Attribute->get('body'),
+ 'ARGV' => $Attribute->get('argv'),
'TIME_INSERT' => $Attribute->get('time_insert'),
'TIME_UPDATE' => $Attribute->get('time_update'),
],
diff --git a/admin/user/insert.php b/admin/user/insert.php
index 334b1ad..81daf98 100644
--- a/admin/user/insert.php
+++ b/admin/user/insert.php
@@ -12,7 +12,7 @@ require '../../core/application.php';
$Attribute = new User\Attribute();
-if(HTTP::issetPOST('id', 'slug', 'username', 'password', 'fullname', 'mailaddr', 'body', 'time_insert', 'time_update', 'insert')) {
+if(HTTP::issetPOST('id', 'slug', 'username', 'password', 'fullname', 'mailaddr', 'body', 'argv', 'time_insert', 'time_update', 'insert')) {
$Attribute->set('id', HTTP::POST('id') ? HTTP::POST('id') : FALSE);
$Attribute->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : makeSlugURL(HTTP::POST('username')));
$Attribute->set('username', HTTP::POST('username') ? HTTP::POST('username') : NULL);
@@ -20,6 +20,7 @@ if(HTTP::issetPOST('id', 'slug', 'username', 'password', 'fullname', 'mailaddr',
$Attribute->set('fullname', HTTP::POST('fullname') ? HTTP::POST('fullname') : NULL);
$Attribute->set('mailaddr', HTTP::POST('mailaddr') ? HTTP::POST('mailaddr') : NULL);
$Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL);
+ $Attribute->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL);
$Attribute->set('time_insert', HTTP::POST('time_insert') ? HTTP::POST('time_insert') : date('Y-m-d H:i:s'));
$Attribute->set('time_update', HTTP::POST('time_update') ? HTTP::POST('time_update') : date('Y-m-d H:i:s'));
@@ -54,6 +55,7 @@ try {
'FULLNAME' => $Attribute->get('fullname'),
'MAILADDR' => $Attribute->get('mailaddr'),
'BODY' => $Attribute->get('body'),
+ 'ARGV' => $Attribute->get('argv'),
'TIME_INSERT' => $Attribute->get('time_insert'),
'TIME_UPDATE' => $Attribute->get('time_update'),
],
diff --git a/admin/user/update.php b/admin/user/update.php
index 1e9fa75..cdacfa0 100644
--- a/admin/user/update.php
+++ b/admin/user/update.php
@@ -17,13 +17,14 @@ try {
$User = User\Factory::build(HTTP::GET('id'));
$Attribute = $User->getAttribute();
- if(HTTP::issetPOST('slug', 'username', 'password', 'fullname', 'mailaddr', 'body', 'time_insert', 'time_update', 'update')) {
+ if(HTTP::issetPOST('slug', 'username', 'password', 'fullname', 'mailaddr', 'body', 'argv', 'time_insert', 'time_update', 'update')) {
$Attribute->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : makeSlugURL(HTTP::POST('username')));
$Attribute->set('username', HTTP::POST('username') ? HTTP::POST('username') : NULL);
$Attribute->set('password', HTTP::POST('password') ? password_hash(HTTP::POST('password'), PASSWORD_BCRYPT, ['cost' => 10]) : FALSE);
$Attribute->set('fullname', HTTP::POST('fullname') ? HTTP::POST('fullname') : NULL);
$Attribute->set('mailaddr', HTTP::POST('mailaddr') ? HTTP::POST('mailaddr') : NULL);
$Attribute->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL);
+ $Attribute->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL);
$Attribute->set('time_insert', HTTP::POST('time_insert') ? HTTP::POST('time_insert') : date('Y-m-d H:i:s'));
$Attribute->set('time_update', HTTP::POST('time_update') ? HTTP::POST('time_update') : date('Y-m-d H:i:s'));
@@ -57,6 +58,7 @@ try {
'FULLNAME' => $Attribute->get('fullname'),
'MAILADDR' => $Attribute->get('mailaddr'),
'BODY' => $Attribute->get('body'),
+ 'ARGV' => $Attribute->get('argv'),
'TIME_INSERT' => $Attribute->get('time_insert'),
'TIME_UPDATE' => $Attribute->get('time_update'),
],
diff --git a/core/functions.php b/core/functions.php
index c6bdb1e..2e36524 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -90,6 +90,7 @@ function generateItemData(Item $Item): array {
'ID' => $Item->getID(),
'URL' => $Item->getURL(),
'GUID' => $Item->getGUID(),
+ 'ARGV' => $Item->getArguments(),
'PREV' => FALSE,
'NEXT' => FALSE,
@@ -108,6 +109,7 @@ function generateItemData(Item $Item): array {
'SLUG' => $Item->attr('slug'),
'NAME' => $Item->attr('name'),
'BODY' => $Item->attr('body'),
+ 'ARGV' => $Item->attr('argv'),
'TIME_INSERT' => $Item->attr('time_insert'),
'TIME_UPDATE' => $Item->attr('time_update')
]
@@ -136,6 +138,7 @@ function generateUserItemData(User\Item $User): array {
'ID' => $User->getID(),
'URL' => $User->getURL(),
'GUID' => $User->getGUID(),
+ 'ARGV' => $User->getArguments(),
'PREV' => FALSE,
'NEXT' => FALSE,
@@ -152,6 +155,7 @@ function generateUserItemData(User\Item $User): array {
'ATTR' => [
'SLUG' => $User->attr('slug'),
'BODY' => $User->attr('body'),
+ 'ARGV' => $User->attr('argv'),
'USERNAME' => $User->attr('username'),
'FULLNAME' => $User->attr('fullname'),
'MAILADDR' => $User->attr('mailaddr'),
@@ -323,9 +327,9 @@ function description($string, $length = 200, $replace = ' […]') {
# Generate a valid slug URL part from a string
#===============================================================================
function makeSlugURL($string) {
- $string = strtolower($string);
+ $string = mb_strtolower($string);
$string = str_replace(['ä', 'ö', 'ü', 'ß'], ['ae', 'oe', 'ue', 'ss'], $string);
- $string = preg_replace('/[^a-zA-Z0-9\-]/', '-', $string);
+ $string = preg_replace('/[^a-z0-9\-]/', '-', $string);
$string = preg_replace('/-+/', '-', $string);
return trim($string, '-');
diff --git a/core/namespace/Item.php b/core/namespace/Item.php
index f3b6ceb..426dd2a 100644
--- a/core/namespace/Item.php
+++ b/core/namespace/Item.php
@@ -102,6 +102,23 @@ abstract class Item implements ItemInterface {
}
#===============================================================================
+ # Return parsed arguments
+ #===============================================================================
+ public function getArguments(): array {
+ if($argv = $this->Attribute->get('argv')) {
+ foreach(explode('|', rtrim($argv, '|')) as $delimeter) {
+ $part = explode('=', $delimeter);
+
+ if(!empty($part[0])) {
+ $arguments[strtoupper($part[0])] = $part[1] ?? TRUE;
+ }
+ }
+ }
+
+ return $arguments ?? [];
+ }
+
+ #===============================================================================
# Return previous item ID
#===============================================================================
public function getPrevID(): int {
diff --git a/core/namespace/Page/Attribute.php b/core/namespace/Page/Attribute.php
index c12a2c8..b1c4e01 100644
--- a/core/namespace/Page/Attribute.php
+++ b/core/namespace/Page/Attribute.php
@@ -11,6 +11,7 @@ class Attribute extends \Attribute {
protected $slug = FALSE;
protected $name = FALSE;
protected $body = FALSE;
+ protected $argv = FALSE;
protected $time_insert = FALSE;
protected $time_update = FALSE;
diff --git a/core/namespace/Post/Attribute.php b/core/namespace/Post/Attribute.php
index 6f20183..73af3a2 100644
--- a/core/namespace/Post/Attribute.php
+++ b/core/namespace/Post/Attribute.php
@@ -11,6 +11,7 @@ class Attribute extends \Attribute {
protected $slug = FALSE;
protected $name = FALSE;
protected $body = FALSE;
+ protected $argv = FALSE;
protected $time_insert = FALSE;
protected $time_update = FALSE;
diff --git a/core/namespace/User/Attribute.php b/core/namespace/User/Attribute.php
index b161fa9..c83fdfc 100644
--- a/core/namespace/User/Attribute.php
+++ b/core/namespace/User/Attribute.php
@@ -13,6 +13,7 @@ class Attribute extends \Attribute {
protected $fullname = FALSE;
protected $mailaddr = FALSE;
protected $body = FALSE;
+ protected $argv = FALSE;
protected $time_insert = FALSE;
protected $time_update = FALSE;
diff --git a/database.sql b/database.sql
index efcd044..d85089a 100644
--- a/database.sql
+++ b/database.sql
@@ -8,7 +8,8 @@ CREATE TABLE `page` (
`user` tinyint(4) NOT NULL,
`slug` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`name` varchar(100) NOT NULL,
- `body` text NOT NULL
+ `body` text NOT NULL,
+ `argv` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- =============================================================================
@@ -21,7 +22,8 @@ CREATE TABLE `post` (
`user` tinyint(4) NOT NULL,
`slug` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`name` varchar(100) NOT NULL,
- `body` text NOT NULL
+ `body` text NOT NULL,
+ `argv` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
-- =============================================================================
@@ -36,18 +38,19 @@ CREATE TABLE `user` (
`password` char(64) CHARACTER SET latin1 DEFAULT NULL,
`fullname` varchar(40) NOT NULL,
`mailaddr` varchar(60) NOT NULL,
- `body` text NOT NULL
+ `body` text NOT NULL,
+ `argv` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- =============================================================================
-- Insert demo page, post and user
-- =============================================================================
-INSERT INTO `page` (`id`, `time_insert`, `time_update`, `user`, `slug`, `name`, `body`) VALUES
-(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 'example-page', 'Example Page', 'OK. You discovered that there is also a page functionality. But what is the difference between a **page** and a **post**? This is simple: There is not really much difference. But you can style posts and pages within the templates CSS completely independent from each other. For example, use **pages** for things like your imprint, your terms of use, your FAQ or other stuff. And **posts** for your main blog posts. A **page** (and also a **user**) has exactly the same functionality as already described within the [first post]({POST[1]})! 8)');
-INSERT INTO `post` (`id`, `time_insert`, `time_update`, `user`, `slug`, `name`, `body`) VALUES
-(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 'hello-world', 'Hello World!', 'Hello! This is the automatically generated first post on your new blog installation. You can type [Markdown](https://daringfireball.net/projects/markdown/) plaintext into the editor to format your content as you want. In this post you can see several examples to [format your content with Markdown](https://daringfireball.net/projects/markdown/syntax) and with the special features provided by this blog application. After you are familiar with the text formatting and done with the exploration of your new blog application, you can delete this post and create your own. Have fun! :)\r\n\r\n![Demo image: Computer Guy (Public Domain)]({FILE[\"image/content/computer-guy-public-domain.svg\"]})\r\n\r\n## Parsing emoticons (if `POST.EMOTICONS` is `TRUE` within your `configuration.php`)\r\n> You can insert one or more of the following emoticons into your posts by typing the emoticon as simple ASCII text. The emoticon parser will convert your ASCII emoticon to the HTML multibyte unicode equivalent. Each emoticon comes with an further explanation if you just hold your mouse over a emoticons face: \r\n> :) :( :D :P :O ;) ;( :| :X :/ 8) :S xD ^^\r\n\r\n## Dynamic internal URLs for items\r\nIf you want to link an item, please don\'t put the URL to the item hardcoded into your content! What if you want to change your site address (or the base directory) in the future? Then you have to change all links in your content. This is not cool! Thus, you can use the following code **without spaces between the braces** by knowing the ID of an item to link it dynamically:\r\n\r\n1. Example: `{ POST[1] }` \r\n{POST[1]}\r\n\r\n2. Example: `{ PAGE[1] }` \r\n{PAGE[1]}\r\n\r\n3. Example: `{ USER[1] }` \r\n{USER[1]}\r\n\r\n## Dynamic internal URLs for other resources\r\nThis also applies to any other resource that exists in the blog system and that you want to link to! You can link any other resource dynamically either relative to your base directory or relative to your resource directory for static content:\r\n\r\n* Example: `{ BASE[\"foo/bar/\"] }` \r\n{BASE[\"foo/bar/\"]}\r\n\r\n* Example: `{ FILE[\"foo/bar/\"] }` \r\n{FILE[\"foo/bar/\"]}\r\n\r\n### Anywhere …\r\nYou can use these codes anywhere in your markdown plaintext. This codes will be pre-parsed before the markdown parser gets the content. If the markdown parser begins then all codes already have been converted into the URLs.');
-INSERT INTO `user` (`id`, `time_insert`, `time_update`, `slug`, `username`, `password`, `fullname`, `mailaddr`, `body`) VALUES
-(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'change-me', 'ChangeMe', '$2y$10$jH48L1K1y9dB303aI2biN.ob0biZDuUbMxPKadi3wDqOIxj6yNT6K', 'John Doe', 'mail@example.org', 'Describe yourself.');
+INSERT INTO `page` (`id`, `time_insert`, `time_update`, `user`, `slug`, `name`, `body`, `argv`) VALUES
+(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 'example-page', 'Example Page', 'OK. You discovered that there is also a page functionality. But what is the difference between a **page** and a **post**? This is simple: There is not really much difference. But you can style posts and pages within the templates CSS completely independent from each other. For example, use **pages** for things like your imprint, your terms of use, your FAQ or other stuff. And **posts** for your main blog posts. A **page** (and also a **user**) has exactly the same functionality as already described within the [first post]({POST[1]})! 8)', NULL);
+INSERT INTO `post` (`id`, `time_insert`, `time_update`, `user`, `slug`, `name`, `body`, `argv`) VALUES
+(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 'hello-world', 'Hello World!', 'Hello! This is the automatically generated first post on your new blog installation. You can type [Markdown](https://daringfireball.net/projects/markdown/) plaintext into the editor to format your content as you want. In this post you can see several examples to [format your content with Markdown](https://daringfireball.net/projects/markdown/syntax) and with the special features provided by this blog application. After you are familiar with the text formatting and done with the exploration of your new blog application, you can delete this post and create your own. Have fun! :)\r\n\r\n![Demo image: Computer Guy (Public Domain)]({FILE[\"image/content/computer-guy-public-domain.svg\"]})\r\n\r\n## Parsing emoticons (if `POST.EMOTICONS` is `TRUE` within your `configuration.php`)\r\n> You can insert one or more of the following emoticons into your posts by typing the emoticon as simple ASCII text. The emoticon parser will convert your ASCII emoticon to the HTML multibyte unicode equivalent. Each emoticon comes with an further explanation if you just hold your mouse over a emoticons face: \r\n> :) :( :D :P :O ;) ;( :| :X :/ 8) :S xD ^^\r\n\r\n## Dynamic internal URLs for items\r\nIf you want to link an item, please don\'t put the URL to the item hardcoded into your content! What if you want to change your site address (or the base directory) in the future? Then you have to change all links in your content. This is not cool! Thus, you can use the following code **without spaces between the braces** by knowing the ID of an item to link it dynamically:\r\n\r\n1. Example: `{ POST[1] }` \r\n{POST[1]}\r\n\r\n2. Example: `{ PAGE[1] }` \r\n{PAGE[1]}\r\n\r\n3. Example: `{ USER[1] }` \r\n{USER[1]}\r\n\r\n## Dynamic internal URLs for other resources\r\nThis also applies to any other resource that exists in the blog system and that you want to link to! You can link any other resource dynamically either relative to your base directory or relative to your resource directory for static content:\r\n\r\n* Example: `{ BASE[\"foo/bar/\"] }` \r\n{BASE[\"foo/bar/\"]}\r\n\r\n* Example: `{ FILE[\"foo/bar/\"] }` \r\n{FILE[\"foo/bar/\"]}\r\n\r\n### Anywhere …\r\nYou can use these codes anywhere in your markdown plaintext. This codes will be pre-parsed before the markdown parser gets the content. If the markdown parser begins then all codes already have been converted into the URLs.', NULL);
+INSERT INTO `user` (`id`, `time_insert`, `time_update`, `slug`, `username`, `password`, `fullname`, `mailaddr`, `body`, `argv`) VALUES
+(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'change-me', 'ChangeMe', '$2y$10$jH48L1K1y9dB303aI2biN.ob0biZDuUbMxPKadi3wDqOIxj6yNT6K', 'John Doe', 'mail@example.org', 'Describe yourself.', NULL);
-- =============================================================================
-- Add keys for tables
diff --git a/template/admin/html/main.php b/template/admin/html/main.php
index d2fba38..bed186e 100644
--- a/template/admin/html/main.php
+++ b/template/admin/html/main.php
@@ -5,7 +5,7 @@
<meta name="referrer" content="origin-when-crossorigin" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="<?=Application::getTemplateURL('rsrc/main.css')?>" />
- <script src="<?=Application::getTemplateURL('rsrc/main.js')?>"></script>
+ <script defer src="<?=Application::getTemplateURL('rsrc/main.js')?>"></script>
<title><?=escapeHTML($NAME)?> | Administration</title>
</head>
<body>
diff --git a/template/admin/html/page/form.php b/template/admin/html/page/form.php
index 00a9c11..7d91af9 100644
--- a/template/admin/html/page/form.php
+++ b/template/admin/html/page/form.php
@@ -53,6 +53,9 @@
<section class="flex flex-padding">
<textarea id="content-editor" name="body" placeholder="[…]"><?=escapeHTML($FORM['DATA']['BODY'])?></textarea>
</section>
+ <section class="flex flex-padding background flex-arguments">
+ <input id="L_ARGV" name="argv" maxlength="100" placeholder="[ARGUMENT_FOO=one|ARGUMENT_BAR=two …]" value="<?=escapeHTML($FORM['DATA']['ARGV'])?>" />
+ </section>
<section class="flex flex-padding background flex-emoticons">
<ul class="button-list emoticons">
<?php foreach(getEmoticons() as $emoticon => $data):?>
diff --git a/template/admin/html/pagination.php b/template/admin/html/pagination.php
index 31b5378..42eb378 100644
--- a/template/admin/html/pagination.php
+++ b/template/admin/html/pagination.php
@@ -1,45 +1,30 @@
-<section id="site-navi">
+<div id="site-navi">
<?php if($THIS > 1): ?>
- <div><a href="<?=sprintf($HREF, $THIS-1)?>"><i class="fa fa-arrow-left"></i></a></div>
+ <div><a id="prev-site" href="<?=sprintf($HREF, $THIS-1)?>"><i class="fa fa-arrow-left"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-left"></i></a></div>
<?php endif; ?>
- <section>
- <div>
- <ol>
- <?php for($currentItem = 1; $currentItem <= $LAST; ++$currentItem): ?>
- <?php
- $href = sprintf($HREF, $currentItem);
- $class = NULL;
- $currentItemHTML = $currentItem;
- if($currentItem === $THIS) {
- $class = ' class="active"';
- }
+ <div>
+ <ol>
+ <?php
+ for($current = 1; $current <= $LAST; ++$current) {
+ $class = '';
+ $href = sprintf($HREF, $current);
- echo '<li'.$class.'><a href="'.$href.'">'.$currentItemHTML.'</a></li>';
- ?>
+ if($current === $THIS) {
+ $class = ' class="active"';
+ }
- <?php endfor; ?>
- </ol>
- </div>
- </section>
+ echo "<li{$class}><a href=\"{$href}\">{$current}</a></li>";
+ }
+ ?>
+ </ol>
+ </div>
<?php if($THIS < $LAST): ?>
- <div><a href="<?=sprintf($HREF, $THIS+1)?>"><i class="fa fa-arrow-right"></i></a></div>
+ <div><a id="next-site" href="<?=sprintf($HREF, $THIS+1)?>"><i class="fa fa-arrow-right"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-right"></i></a></div>
<?php endif; ?>
-</section>
-
-<script>
- var prevPageURL = <?php echo json_encode($THIS > 1 ? sprintf($HREF, $THIS-1) : FALSE); ?>;
- var nextPageURL = <?php echo json_encode($THIS < $LAST ? sprintf($HREF, $THIS+1) : FALSE); ?>;
-
- document.addEventListener('keyup', function(event) {
- if(!event.ctrlKey && !event.shiftKey) {
- (event.keyCode === 37 && prevPageURL) && (window.location.href = prevPageURL);
- (event.keyCode === 39 && nextPageURL) && (window.location.href = nextPageURL);
- }
- }, false)
-</script> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/template/admin/html/post/form.php b/template/admin/html/post/form.php
index 1156c6c..9603ded 100644
--- a/template/admin/html/post/form.php
+++ b/template/admin/html/post/form.php
@@ -53,6 +53,9 @@
<section class="flex flex-padding">
<textarea id="content-editor" name="body" placeholder="[…]"><?=escapeHTML($FORM['DATA']['BODY'])?></textarea>
</section>
+ <section class="flex flex-padding background flex-arguments">
+ <input id="L_ARGV" name="argv" maxlength="100" placeholder="[ARGUMENT_FOO=one|ARGUMENT_BAR=two …]" value="<?=escapeHTML($FORM['DATA']['ARGV'])?>" />
+ </section>
<section class="flex flex-padding background flex-emoticons">
<ul class="button-list emoticons">
<?php foreach(getEmoticons() as $emoticon => $data):?>
diff --git a/template/admin/html/user/form.php b/template/admin/html/user/form.php
index 4822dd5..374181c 100644
--- a/template/admin/html/user/form.php
+++ b/template/admin/html/user/form.php
@@ -59,6 +59,9 @@
<section class="flex flex-padding">
<textarea id="content-editor" name="body" placeholder="[…]"><?=escapeHTML($FORM['DATA']['BODY'])?></textarea>
</section>
+ <section class="flex flex-padding background flex-arguments">
+ <input id="L_ARGV" name="argv" maxlength="100" placeholder="[ARGUMENT_FOO=one|ARGUMENT_BAR=two …]" value="<?=escapeHTML($FORM['DATA']['ARGV'])?>" />
+ </section>
<section class="flex flex-padding background flex-emoticons">
<ul class="button-list emoticons">
<?php foreach(getEmoticons() as $emoticon => $data):?>
diff --git a/template/admin/rsrc/main.js b/template/admin/rsrc/main.js
index c874918..5405b29 100644
--- a/template/admin/rsrc/main.js
+++ b/template/admin/rsrc/main.js
@@ -1,4 +1,20 @@
//==============================================================================
+// Elements which contains the location of the previous and next site
+//==============================================================================
+var prev = document.getElementById("prev-site");
+var next = document.getElementById("next-site");
+
+//==============================================================================
+// Handle arrow keys and change the location to the desired direction
+//==============================================================================
+document.addEventListener("keyup", function(event) {
+ if(!event.ctrlKey && !event.shiftKey) {
+ (event.keyCode === 37 && prev) && (window.location.href = prev.getAttribute("href"));
+ (event.keyCode === 39 && next) && (window.location.href = next.getAttribute("href"));
+ }
+}, false);
+
+//==============================================================================
// Markdown tags to replace
//==============================================================================
var markdownTags = {
diff --git a/template/standard/html/pagination.php b/template/standard/html/pagination.php
index 7a9279a..df5293e 100644
--- a/template/standard/html/pagination.php
+++ b/template/standard/html/pagination.php
@@ -7,36 +7,33 @@
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
?>
-<section id="site-navi">
+<div id="site-navi">
<?php if($THIS > 1): ?>
<div><a id="prev-site" href="<?=sprintf($HREF, $THIS-1)?>"><i class="fa fa-arrow-left"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-left"></i></a></div>
<?php endif; ?>
- <section>
- <div>
- <ol>
- <?php for($currentItem = 1; $currentItem <= $LAST; ++$currentItem): ?>
- <?php
- $href = sprintf($HREF, $currentItem);
- $class = NULL;
- $currentItemHTML = $currentItem;
- if($currentItem === $THIS) {
- $class = ' class="active"';
- }
+ <div>
+ <ol>
+ <?php
+ for($current = 1; $current <= $LAST; ++$current) {
+ $class = '';
+ $href = sprintf($HREF, $current);
- echo '<li'.$class.'><a href="'.$href.'">'.$currentItemHTML.'</a></li>';
- ?>
+ if($current === $THIS) {
+ $class = ' class="active"';
+ }
- <?php endfor; ?>
- </ol>
- </div>
- </section>
+ echo "<li{$class}><a href=\"{$href}\">{$current}</a></li>";
+ }
+ ?>
+ </ol>
+ </div>
<?php if($THIS < $LAST): ?>
<div><a id="next-site" href="<?=sprintf($HREF, $THIS+1)?>"><i class="fa fa-arrow-right"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-right"></i></a></div>
<?php endif; ?>
-</section> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/template/standard/lang/de.php b/template/standard/lang/de.php
index d2b094c..fa8544f 100644
--- a/template/standard/lang/de.php
+++ b/template/standard/lang/de.php
@@ -62,11 +62,11 @@ $LANGUAGE['search_form_placeholder'] = 'Suchbegriff eingeben …';
# Error 403
#===============================================================================
$LANGUAGE['403_heading_text'] = 'Zugriff verweigert';
-$LANGUAGE['403_heading_desc'] = 'Der Zugriff auf diese Ressource des Servers wurde dir verweigert, da du die dafür notwendigen Berechtigungen nicht besitzt.';
+$LANGUAGE['403_heading_desc'] = 'Der Zugriff auf diese Ressource wurde dir verweigert, da du die dafür notwendigen Berechtigungen nicht besitzt.';
#===============================================================================
# Error 404
#===============================================================================
$LANGUAGE['404_heading_text'] = 'Nicht gefunden';
-$LANGUAGE['404_heading_desc'] = 'Die angeforderte Ressource konnte auf diesem Server nicht gefunden werden.';
+$LANGUAGE['404_heading_desc'] = 'Die angeforderte Ressource konnte nicht gefunden werden.';
?> \ No newline at end of file
diff --git a/template/standard/lang/en.php b/template/standard/lang/en.php
index c00ec36..c2d04d9 100644
--- a/template/standard/lang/en.php
+++ b/template/standard/lang/en.php
@@ -68,5 +68,5 @@ $LANGUAGE['403_heading_desc'] = 'You are denied to access this resource because
# Error 404
#===============================================================================
$LANGUAGE['404_heading_text'] = 'Not found';
-$LANGUAGE['404_heading_desc'] = 'The requested resource could not be found on this server.';
+$LANGUAGE['404_heading_desc'] = 'The requested resource could not be found.';
?> \ No newline at end of file