aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace
AgeCommit message (Collapse)AuthorFilesLines
2021-07-17Reduce the redundant mapping logic in repositoriesThomas Lange2-49/+33
Reduce the redundant mapping logic in the repository classes by using the new methods "fetchEntity" and "fetchEntities".
2021-07-11Modify parameter list for getAll methodThomas Lange1-3/+3
2021-07-11Reuse prepared statement in update methodThomas Lange1-4/+0
Reuse the already defined prepared statement in the update method of the Category repository instead of creating a new one.
2021-07-02Clarify comment in determineFallbackSchemaVersionThomas Lange1-1/+1
If the migration table does not yet exist, the user sits *either* at 0, 1, 2, 3 or 4; not *between* 0 and 4 (which would be 1, 2 or 3).
2021-07-01Add category system to categorize posts (readme)Thomas Lange5-6/+181
This commit implements a new category system to categorize posts. Each category can have an unlimited number of nested children categories. A single post don't necessarily need to be in a category, but it can. Each category can have a full content body like posts or pages, so you have enough space to describe the content of your categories. Please note that you need to have at least the following MySQL/MariaDB versions to use the category system, because it uses "WITH RECURSIVE" database queries, the so-called "Common-Table-Expressions (CTE)". MariaDB: 10.2.2 MySQL: 8.0 See: https://mariadb.com/kb/en/with/ See: https://dev.mysql.com/doc/refman/8.0/en/with.html
2021-07-01Update database schema for coming category systemThomas Lange1-1/+1
This commit updates the database schema and adds a new migration for the upcoming category system. Please note that you need to have at least the following MySQL/MariaDB versions to use the category system later: MariaDB: 10.2.2 MySQL: 8.0
2021-07-01Bugfix: Explicitly check for FALSE in MigratorThomas Lange1-1/+2
Explicitly check for boolean FALSE because the result can be string "0" when directly upgrading from release v1.0 which has schema version "0".
2021-07-01Update database schema: Make id columns unsignedThomas Lange1-1/+1
This commit updates the database schema and adds a new migration to modify the signed integer columns to make them unsigned.
2021-06-29Add WHERE filter option to getCount methodThomas Lange1-4/+23
2021-06-28Bugfix: Remove explicit parameter type intThomas Lange1-3/+3
2021-06-27Allow NULL value comparison in WHERE clauseThomas Lange1-2/+6
2021-06-25Fix wrong property name in Repository classThomas Lange1-2/+2
2021-06-25Reorganize namespacesThomas Lange11-27/+44
2021-06-24Return NULL instead of config string if unsetThomas Lange1-1/+1
2021-06-24Implement database schema MigratorThomas Lange2-0/+196
This commit implements the new database schema Migrator which keeps track of the on-disk schema and the schema used by the codebase. It tries to makes future database schema upgrades user-friendlier.
2021-06-24Set Database attribute in Application classThomas Lange1-1/+13
2021-06-22Add missing static keywords and fix typosThomas Lange2-4/+4
2021-06-22Implement new Repository and Entity classesThomas Lange26-362/+480
This commit adds new Repository and Entity classes which are better abstracted from the rest of the application. They dont know anymore about configuration options or how to parse to HTML because this is not the job for the ORM but for other parts of the application. The previous commits were a preparation for this big change. An entity now represents just a single record from a specific table of the database – nothing more. The repositories job is it to fetch or update records of the database and instantiate the entities. Another problem that was solved is the high amount of database queries that was needed before. For example, on the blogs home page first were all 10 latest post IDs fetched from the database and then another query was executed with "WHERE id = :id" for *each* single post?! ... This problem is solved with the new repository classes; they now use a single query to fetch and build the entities of the 10 latest posts. This change also solves the problem with database queries spread across the application and limits the exzessive use of try/catch blocks which were used before. The new classes make the whole code much cleaner. :)
2021-06-21Rename "attr" method of Item class to "get"Thomas Lange2-4/+4
2021-06-21Remove getArguments method from Item classThomas Lange1-20/+0
2021-06-21Remove unused methods from Item classThomas Lange1-50/+0
2021-06-21Remove getGUID methods from Item classesThomas Lange4-35/+0
2021-06-21Remove getURL methods from Item classesThomas Lange4-34/+0
2021-06-21Use getEntityURL method of Application classThomas Lange1-1/+1
This commit replaces all calls to "$Item->getURL()" with calls to the previously added "getEntityURL" method of the "Application" class.
2021-06-21Add method getEntityURL to Application classThomas Lange1-0/+20
This commit adds the method "getEntityURL" to the "Application" class. This method takes an instance of "Item" as parameter and then builds the absolute URL of the item from its attribute data.
2021-06-20Call password_verify directly in login scriptThomas Lange1-7/+0
2021-06-19Rename CRUD methods of Attribute classThomas Lange1-3/+3
2021-06-14Remove useless AttributeInterfaceThomas Lange2-7/+1
2021-06-12Remove function "getRandomValue"Thomas Lange1-1/+1
This commit removes the "getRandomValue" function. In addition, the Application class now calls PHPs "random_bytes" function directly.
2021-05-20Update Parsedown library to version 1.7.4v2.4.3Thomas Lange1-5/+38
This commit updates the Parsedown library to version 1.7.4. The patch to prevent tab indentations in code blocks from being converted to spaces is already applied here. See: 78c5974cd34559d0130d8be509935e2c992cd9ca
2020-12-31Remove PHP closing tags and add LF in "core/namespace/User/*"Thomas Lange4-4/+0
In addition to the last commit, remove the unnecessary PHP closing tags from the end of the files and ensure that the files ending with an LF character.
2019-10-29Remove PHP closing tags and add LF to text filesThomas Lange23-23/+0
Remove the unnecessary PHP closing tags and ensure that *all* text files ending with a LF character.
2019-04-26Rename "template" directory to "theme"Thomas Lange2-3/+3
This commit renames the "template" directory to "theme" because "theme" is the more correct term here.
2018-09-09Use function "parseUnicodeEmoticons"Thomas Lange1-0/+1
We will now use this function (in addition to "parseEmoticons") to parse already UTF-8 encoded unicode emoticons (instead of the ASCII emoticons for which "parseEmoticons" is responsible) from the markdown content.
2018-03-29Update Parsedown library to version 1.7.1v2.4.2Thomas Lange2-24/+195
This commit updates the Parsedown library to the latest version 1.7.1. The patch to prevent that tab indentations in code blocks are being converted to spaces (see 78c5974cd34559d0130d8be509935e2c992cd9ca) is already applied here. In addition, the patch file itself is now shipped within the same directory where the Parsedown.php resides.
2017-11-04The Parsedown library has been patched to prevent tab indentations from ↵Thomas Lange1-21/+10
being converted to spaces: For example, if you had used the markdown syntax for displaying source code in your post, Parsedown had replaced your semantically correct tab indentations with hard spaces. This behavior meant that the code that was displayed after parsing was no longer exactly the code you inserted into the content editor. If someone had copied source code from your post into his IDE, then your tab indentations were gone because of the spaces. That's why I hacked the Parsedown library and created a patch: https://github.com/erusev/parsedown/issues/508
2017-10-23The methods "setCookie" and "getCookie" have been added to the HTTP class.Thomas Lange1-0/+14
2017-10-22Implemented: A full-text search functionality for posts and pages in the ↵Thomas Lange1-0/+14
administration area. In addition, some markup within the "/*/index.php" files of the admin template was re-formatted.
2017-09-02An unnecessary "else" block in admin/auth.php was removed and spelling ↵Thomas Lange1-1/+1
mistakes and inconsistencies in some comments were corrected.
2017-08-11Several changes have been made in this commit, which together with the ↵v2.3Thomas Lange2-31/+37
previous commits result in version 2.3: + Optimization: Originally, the core and template languages were completely separated in the logic of the Language class and you had to use "$Language->text()" to get a core language string and "$Language->template()" to get a template language string. Since this commit, the core and template language strings are still located in different files, but you now have to use "$Language->text()" for core and template language strings both. Thus, you can now even overwrite a core language string from the language file of a template if the core language string does not satisfy you. + Deprecated: The method "$Language->template()" was marked as deprecated and will be removed in further versions (currently, it's just an alias for "$Language->text()"). Template upgrade to version 2.3 (only for customized templates): SEARCH: $Language->template REPLACE: $Language->text
2017-05-31Two changes have been made in this commit:Thomas Lange1-8/+8
+ Update [core]: Parsedown has been updated to version 1.6.2. + Optimization [admin template]: The markdown buttons have been placed directly above the content editor. + Optimization [admin template]: The content editor has been visually embellished (padding from the parent was removed).
2017-05-30 Several changes have been made in this commit, which together with the ↵v2.2Thomas Lange2-42/+36
previous commits result in version 2.2 [changed template parameters]: + Implemented [core]: A new method called "getAll" has been added to the "Attribute" class which now returns all attributes as key->value array. The first parameter can be an array with attribute names which shall be excluded from returning. + Optimization [core]: The function "generateItemData" has been renamed to "generateItemTemplateData" and has been restructured to use the new implemented method "getAll" from the "Attribute" class. + Optimization [core]: The function "generateNaviTemplate" has been added and the functions "generatePageNaviTemplate", "generatePostNaviTemplate" and "generateUserNaviTemplate" have been restructured to make use of the new "generateNaviTemplate" function to reduce duplicate code. + Optimization [core]: Several files within the admin directory has been optimized to use the new "getAll" method of the "Attribute" class. + Optimization [core]: Several code optimizations have been made to the "HTTP" class. + Optimization [admin template]: All occurences of $PAGE['ID'], $POST['ID'] and $USER['ID'] have been replaced with $PAGE['ATTR']['ID'], $POST['ATTR']['ID'] and $USER['ATTR']['ID'] to make it more consistent. You now have to use ['ATTR']['ID'] instead of ['ID'] in your templates to get the ID of an item! Template upgrade to version 2.2 (only for customized templates): SEARCH: ['ID'] REPLACE: ['ATTR']['ID']
2017-05-21Bugfixes: There were two problems with the internal sorting of items which ↵v2.1.2Thomas Lange1-4/+4
have been fixed. This results in version 2.1.2 (database update recommended): + Bugfix [core]: If the insertion date of a newly created item has been placed to a datetime in the past after which other items have already appeared, the sorting of the forward and backward functionality has been interrupted because the WHERE clause in the database query had the condition that the next item must have a higher ID and the previous item must have a lower ID than the current one. If this newly created item was the last one and the insertion date had been placed to a datetime in the past, no next item could be fetched because THIS is already the item with the highest ID and the correct sorting by time_insert for this item has stopped working. + Bugfix [core]: If one or more items had exactly the same insertion time, the items with the exact same time has been appeard within the overview list in an order which did not correspond to the insertion sequence. There were several ways to fix this problem, but this would result in more complicated database queries and more code. To fix the problem in the simplest way, the column "time_insert" now has a UNIQUE index to prevent two or more items from having the exactly same insertion time. Database update to version 2.1.2 (no existing data will be lost or changed): ALTER TABLE `page` ADD UNIQUE KEY `time_insert` (`time_insert`); ALTER TABLE `post` ADD UNIQUE KEY `time_insert` (`time_insert`); ALTER TABLE `user` ADD UNIQUE KEY `time_insert` (`time_insert`);
2017-05-14Disable the automatic linking of URLs which are not explicitly wrapped ↵Thomas Lange1-0/+1
around "<" and ">" in markdown syntax.
2017-05-12Bugfix: If the database password is removed within the first "getDatabase" ↵Thomas Lange1-2/+0
call, it will prevent that a new connection can be enforced when calling "getDatabase(TRUE)" because the password was removed in the first call before and doesn't exist anymore (the database connection will fail because of an invalid connection password).
2017-05-12The method "getLanguage" has been restructured.Thomas Lange1-1/+4
2017-04-29ItemFactory does not need to implement FactoryInterface because it is ↵Thomas Lange1-1/+1
already implemented in the parent Factory class.
2017-04-29Two changes have been made in this commit:Thomas Lange1-3/+6
+ The method "Item::getArguments" has been optimized and checks now the syntax of the argument names (only A-Z, a-z, 0-9 and underscores are allowed). + The admin template has been changed and displays now the used arguments of an item within the list.
2017-04-27Several changes have been made in this commit, which together with the ↵v2.0Thomas Lange4-0/+20
previous commits result in version 2.0 (database update required): + 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`;
2017-04-11The control structures "require_once" have been replaced by a simple ↵Thomas Lange1-2/+2
"require" (except within the 403.php and 404.php where it makes sense, because these files can be directly called or included).