aboutsummaryrefslogtreecommitdiffstats
path: root/core/include
AgeCommit message (Collapse)AuthorFilesLines
2022-03-14Include category data in feed item templateThomas Lange1-0/+17
Include the category data and the category tree data in the feed item template in the same way as on the post's "main" or "item" template. So in the feed item template, the available parameters are now: $POST (already existed before) $USER (already existed before) $CATEGORY (added with this commit) $CATEGORIES (added with this commit) See the template documentation in the wiki for more information.
2021-08-26Don't use wrapper function "escapeHTML" internallyThomas Lange1-2/+2
Don't use the template function "escapeHTML" internally and replace all occurrences outside of the template files with "htmlspecialchars".
2021-08-03Show current page in categories <title> elementThomas Lange1-1/+2
Posts in a category are paginated, so display the number of the current page in square brackets within the categories <title> element.
2021-07-24Create feed item's GUID manually in template fileThomas Lange1-1/+4
Do not rely on the "$POST['GUID']" template parameter anymore and create the GUID for the feed item manually in the feed item's template file. The application internal function "generatePseudoGUID" has been removed and the function "generateItemTemplateData" will not return the "GUID" part anymore (which was only used by the feed item template anyway). For backward compatibility, the "$POST['GUID']" template parameter will still be present in the feed item template, but not in other templates!
2021-07-24Use correct config option for redirect singlesThomas Lange4-4/+4
In addition to the last commit, use the correct configuration option in the code to check if single items should be redirected.
2021-07-22Catch possible PDOException for search requestThomas Lange1-2/+6
Catch possible PDOException on search requests with queries like "*" and pass the exception message to the template for displaying.
2021-07-22Add pagination for search resultsThomas Lange1-1/+22
Add pagination for search results in the admin and default theme.
2021-07-20Rename and reorganize several "get count" methodsThomas Lange2-7/+5
2021-07-11Modify parameter list for getAll methodThomas Lange1-1/+2
2021-07-10Remove pages from the RSS feed (readme)Thomas Lange1-40/+24
This commit removes the pages from the RSS feed. I decided so because a page is a "timeless" object intended for things like the imprint, about page, privacy policy and similar stuff. It also makes things easier. The new primary feed URL is "/feed/" and shows only posts. The page feed ("/feed/page/") has been removed and will throw a 404 Not Found error. The visitors who already subscribed to the old post feed ("/feed/post/") are automatically 301-redirected to the new location ("/feed/"). The following system language variables have been removed: * feed_name_items * feed_name_pages * feed_name_posts The following configuration options have been removed: * PAGE.FEED_SIZE * PAGE.FEED_SORT * PAGE.FEED_GUID Furthermore, the template file "feed/item_post.php" has been renamed to "feed/item.php" since there is now only one type of feed item. If the system cannot find the "feed/item.php", it tries "feed/item_post.php" instead (for backward compatibility with older themes).
2021-07-02Add generic function to create pagination templateThomas Lange6-6/+20
This commit adds and uses the new function createPaginationTemplate to create the generic pagination template for various entity lists. This function replaces the many old confusing functions: * generateNaviTemplate * generatePageNaviTemplate * generatePostNaviTemplate * generateUserNaviTemplate * generateCategoryNaviTemplate * generateCategoryPostNaviTemplate
2021-07-01Add option CATEGORY.LIST_SORT to application.phpThomas Lange1-2/+0
The option CATEGORY.LIST_SORT is currently only used for sorting the children categories of a category, not for sorting the categories on the category overview page. This is because the sorting of the categories in the category overview is handelnd internally with a virtual table column "_depth" which sorts the categories by name *and* its sub categories (like a tree). Thus, there is currently no user option to sort the category overview.
2021-07-01Bugfix: Use empty check instead of issetThomas Lange1-1/+1
If no category tree was found, the array is empty but isset evaluates to true. This fixes the mistake and uses an empty check instead.
2021-07-01Add function generateCategoryPostNaviTemplateThomas Lange1-1/+1
Add and use the function generateCategoryPostNaviTemplate to build the pagination template for posts in a category. This fixes a mistake. TODO: Get rid of that confusing function mess!
2021-07-01Add category system to categorize posts (readme)Thomas Lange3-0/+220
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-06-22Implement new Repository and Entity classesThomas Lange9-292/+276
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-21Remove unnecessary $ItemTemplate variablesThomas Lange5-16/+4
2021-06-21Rename some template variablesThomas Lange6-14/+14
2021-06-21Rename "attr" method of Item class to "get"Thomas Lange7-8/+8
2021-06-21Use function getMarkdownImageURLsThomas Lange1-1/+1
2021-06-21Use getEntityURL method of Application classThomas Lange6-7/+7
This commit replaces all calls to "$Item->getURL()" with calls to the previously added "getEntityURL" method of the "Application" class.
2021-06-19Remove unused variableThomas Lange1-1/+0
2021-06-14Remove more redundant try/catch blocksThomas Lange9-352/+251
Remove all try/catch blocks where the exception handling did not differ from the exception handler already defined by "set_exception_handler".
2019-10-29Remove PHP closing tags and add LF to text filesThomas Lange9-9/+0
Remove the unnecessary PHP closing tags and ensure that *all* text files ending with a LF character.
2018-02-14Add configuration option "$ITEM.SINGLE_REDIRECT"Thomas Lange3-3/+33
Each option can be set to "TRUE" or "FALSE" (the default value is "FALSE"). For example, if you only have one user and "USER.SINGLE_REDIRECT" is set to "TRUE", then requests to "/user/" will be automatically redirected to "/user/username/".
2017-10-24You can now access item data in the main.php template (the file which ↵Thomas Lange3-0/+14
contains the basic HTML framework) for pages, posts and users. This makes it possible to use the optional argument field in the content editor to add additional HTML <meta> tags (or something else) for a specific page, post or user if you implement this functionality into your template. The following snippet shows how you can access the item data in the main.php template and which parameters are defined for each type of item (currently, there are three types: PAGE, POST and USER): if(isset($TYPE)) { switch($TYPE) { case 'PAGE': # $PAGE and associated $USER is accessible var_dump($PAGE['ARGV']); break; case 'POST': # $POST and associated $USER is accessible var_dump($POST['ARGV']); break; case 'USER': # $USER is accessible var_dump($USER['ARGV']); break; default: # Nothing } }
2017-10-24Some comments have been updated, unnecessary whitespace at the end of some ↵Thomas Lange3-3/+6
files was removed and some missing PHP closing tags were added.
2017-07-07The function "makeSlugURL" has been renamed to "generateSlug" because the ↵Thomas Lange1-2/+8
name was misleading because the function did not generate a complete URL, but only a partial string (the slug) for the final URL. By the way, some improvements were made to the code.
2017-05-30 Several changes have been made in this commit, which together with the ↵v2.2Thomas Lange4-15/+15
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-05A significant increase in the response time has been achieved, since the ↵v2.1Thomas Lange3-3/+3
template parameters "$ITEM['BODY']['TEXT']" and "$ITEM['BODY']['HTML']" are now no longer strings but closures (anonymous functions). This means that the underlying logic, which parses the content or converts it into Markdown, is not executed until one of these parameters is really needed and called in the template (which maybe significantly increases the response time on a long list of items which not use one of those two parameters). This means that within templates you now have to call these parameters in the following way (note the brackets at the end, which represent a function call): <?=$ITEM['BODY']['TEXT']()?> <?=$ITEM['BODY']['HTML']()?> In the background, the anonymous functions are called and executes $Item->getBody() and $Item->getHTML() only when needed. Previously, $Item->getBody() and $Item->getHTML() were basically executed and the parsed content was passed to the template, regardless of whether these parameters are required in the template or not!
2017-04-24Nested function calls for generating the meta description are removed and a ↵Thomas Lange3-3/+3
function was added to perform this task.
2017-04-19Comments added and unnecessary "abs" function calls removed.Thomas Lange3-3/+12
2017-04-11The system directory has been moved to a non-public directory. After the ↵v1.2Thomas Lange9-0/+691
commit e33c245d910e55b8cab407a03e669470509a705d, it is no longer necessary that the directory is publicly accessible via HTTP because all requests are running through the router.