Improved content system, Removed trash, Fixed sitemap
Update .gitignore, .htaccess, and 11 more files...
This commit is contained in:
@@ -10,7 +10,7 @@ include_once 'langs.php';
|
||||
|
||||
// This helper requires PHP 8 or newer !
|
||||
|
||||
$SHOW_CONTENT_DEBUG_CARD = true;
|
||||
$SHOW_CONTENT_DEBUG_CARD = false;
|
||||
|
||||
// Defining constants and enums.
|
||||
abstract class ContentDisplayType {
|
||||
@@ -27,6 +27,7 @@ $content_error_message = "";
|
||||
$requested_tags = array();
|
||||
$raw_additional_tags = "";
|
||||
$filtered_content_index_data = NULL;
|
||||
$requested_item_data = NULL;
|
||||
|
||||
// Detecting content display type requested.
|
||||
$content_requested_url_part = explode("?", explode("#", preg_replace("^\/(content)^", "", l10n_url_switch(NULL)))[0])[0];
|
||||
@@ -91,7 +92,26 @@ if($requested_content_display_type == ContentDisplayType::SEARCH) {
|
||||
goto content_end;
|
||||
}
|
||||
} elseif($requested_content_display_type == ContentDisplayType::CONTENT) {
|
||||
// Attempting to get the requested ID.
|
||||
// Sanitizing the requested ID.
|
||||
if(!ctype_alnum(str_replace("-", "", $content_requested_url_part))) {
|
||||
$content_has_error = true;
|
||||
$content_error_message_key = "error.content.id.alphanumeric";
|
||||
goto content_end;
|
||||
}
|
||||
|
||||
// Loading the content's data.
|
||||
$content_file_path = realpath($dir_content . "/items/".$content_requested_url_part.".json");
|
||||
if($content_file_path) {
|
||||
// FIXME: Handle JSON errors cleanly
|
||||
$content_json = file_get_contents($content_file_path);
|
||||
$requested_item_data = json_decode($content_json, true);
|
||||
unset($content_json);
|
||||
} else {
|
||||
$content_has_error = true;
|
||||
$content_error_message_key = "error.content.data.not.exist";
|
||||
goto content_end;
|
||||
}
|
||||
unset($content_file_path);
|
||||
}
|
||||
|
||||
content_end:
|
||||
@@ -100,9 +120,9 @@ $content_error_message = localize($content_error_message_key);
|
||||
// These functions are placed here to prevent the main file from becoming impossible to read.
|
||||
function startMainCard($iconClasses, $title, $subTitle) {
|
||||
echo('<div class="card p-0 mx-0"><div class="px-card py-10 border-bottom px-20"><div class="container-fluid">');
|
||||
echo('<div class="row"><div class="col-4"><h2 class="card-title font-size-18 m-0">');
|
||||
echo('<div class="row"><div class="col-8"><h2 class="card-title font-size-18 m-0">');
|
||||
echo('<i class="'.$iconClasses.'"></i> '.localize($title).'</h2></div>');
|
||||
echo('<div class="col-8 text-right font-italic"><h2 class="card-title font-size-18 m-0 text-super-muted">'.$subTitle.'</h2>');
|
||||
echo('<div class="col-4 text-right font-italic"><h2 class="card-title font-size-18 m-0 text-super-muted">'.$subTitle.'</h2>');
|
||||
echo('</div></div></div></div>');
|
||||
}
|
||||
|
||||
|
@@ -105,11 +105,15 @@
|
||||
"error.content.tags.length": "The \"tags\" URL parameter is too long.",
|
||||
"error.content.tags.alphanumeric": "One of the tags given in the \"tags\" URL parameter is not a valid alphanumeric string.",
|
||||
"error.content.detect.type": "The type of requested content couldn't be determined.",
|
||||
"error.content.id.alphanumeric": "The requested resource's ID isn't valid.",
|
||||
"error.content.data.not.exist": "The requested resource's doesn't have an associated item file.",
|
||||
"error.content.data.no.title": "No title found !",
|
||||
|
||||
"content.title.error": "$content.title.error",
|
||||
"content.title.search": "Projects search",
|
||||
"content.title.article": "$content.title.article",
|
||||
"content.title.application": "$content.title.application",
|
||||
"content.title.error": "Error",
|
||||
"content.title.content": "Content",
|
||||
"content.title.search": "Search",
|
||||
"content.title.search.card.single": "Search result",
|
||||
"content.title.search.card.multiple": "Search results",
|
||||
"content.tags.requested": "Requested tags",
|
||||
"content.search.count.single": "result",
|
||||
"content.search.count.multiple": "results",
|
||||
@@ -219,7 +223,7 @@
|
||||
"error.404.title": "Erreur 404",
|
||||
"error.404.description": "La ressource demandée est introuvable sur le serveur !",
|
||||
|
||||
"error.content.title.generic": "Erreur de contenu",
|
||||
"error.content.title.generic": "Erreur",
|
||||
"error.content.title.empty": "Aucun contenu trouvé",
|
||||
"error.content.none": "Aucune erreur n'a été détectée.",
|
||||
"error.content.detect.category": "Impossibilité de détecter la catégorie de contenu demandée.",
|
||||
@@ -230,11 +234,15 @@
|
||||
"error.content.tags.length": "Le paramètre d'URL \"tags\" est trop long.",
|
||||
"error.content.tags.alphanumeric": "Un des tags donné dans le paramètre d'URL \"tags\" n'est pas une chaîne de texte alphanumérique valide.",
|
||||
"error.content.detect.type": "Le type de contenu désiré n'as pas pu être détecté.",
|
||||
"error.content.id.alphanumeric": "L'ID de la ressource demandée n'est pas valide.",
|
||||
"error.content.data.not.exist": "La ressource demandée n'a pas de fichier de données associé.",
|
||||
"error.content.data.no.title": "Aucun titre trouvé !",
|
||||
|
||||
"content.title.error": "$content.title.error",
|
||||
"content.title.search": "Recherche de projets",
|
||||
"content.title.article": "$content.title.article",
|
||||
"content.title.application": "$content.title.application",
|
||||
"content.title.error": "Erreur de contenu",
|
||||
"content.title.content": "Content",
|
||||
"content.title.search": "Recherche de contenu",
|
||||
"content.title.search.card.single": "Résultat de recherche",
|
||||
"content.title.search.card.multiple": "Résultats de recherche",
|
||||
"content.tags.requested": "Tags demandés",
|
||||
"content.search.count.single": "résultat",
|
||||
"content.search.count.multiple": "résultats",
|
||||
|
Reference in New Issue
Block a user