360 Secure SkillHub
360 安全技能中心

Joomla 5 — AF Kunming

面向指定 Joomla 站点的运维与内容管理 Skill:用 curl 调用 Joomla REST API 和 sppb5.php 端点,读写、发布或下架文章,操作 SP Page Builder、RSForm Pro、RSEvents Pro、FaLang、JSitemap 与 Helix Ultimate,并给出缓存清除、WAF 限制规避和写入后校验流程。需配置 API Token 等环境…

分类:自动化
andongne
andongne
热度 1.30
最近更新 2026-04-22 11:16:49

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add andongne/joomla-5
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
joomla
description
Joomla REST API integration for kunming-afchine.org. Use to read, create, update, or publish articles on the AF Kunming website. Supports SP Page Builder, RSForm Pro, RSEvents Pro, FaLang, JSitemap, and Helix Ultimate via the sppb5.php endpoint. Requires JOOMLA_API_TOKEN, JOOMLA_BASE_URL, and FALANG_SECRET_TOKEN env vars.

Joomla 5 — Alliance Française de Kunming

Site : kunming-afchine.org (Joomla 5, hébergé Gandi SD6, CDN Varnish)
Préfixe de table : bwhwo_

Variables d'environnement

Variable Usage
JOOMLA_BASE_URL https://kunming-afchine.org
JOOMLA_API_TOKEN Bearer token API REST Joomla
FALANG_SECRET_TOKEN Token header X-Falang-Token pour sppb5.php
FALANG_INJECT_URL URL base falang-inject (ex: https://kunming-afchine.org/falang-inject)

Références — lire en priorité


Règles critiques (apprises en production)

1. Toujours purger le cache après une modif DB

curl -s -X POST "$FALANG_INJECT_URL/sppb5.php?action=purge_cache" \
  -H "X-Falang-Token: $FALANG_SECRET_TOKEN" \
  -H "Content-Type: application/json" -d '{}'

Sans purge, la page frontend affiche l'ancien contenu même si la base est à jour.

2. WAF Gandi — apostrophes bloquées

Les apostrophes dans les SQL strings sont bloquées. Utiliser UNHEX('hex...') ou encoder les valeurs.

3. RSForm JS — balises <script> obligatoires

Le champ JS de RSForm est injecté via addCustomTag() sans balises. Toujours encadrer avec <script> / </script>.

4. Overrides template vides → rendu vide silencieux

Ne jamais laisser un fichier PHP d'override dans templates/shaper_languageschool/html/ avec 0 octet. Diagnostiquer un module vide en vérifiant ce dossier en priorité.

5. Sélecteurs RSForm avec []

Les champs array RSForm ont [] dans leur nom : form[Choix_exam][], form[Session][].

6. configuration.php inaccessible en écriture SFTP

Permissions 444 — modifier via patch_config dans sppb5.php ou via le backend Joomla.

7. Vérification post-écriture

Après tout write_query ou action DB, confirmer avec un select_query ou slice. Les retours silencieux existent.


API REST Joomla

Note réseau : utiliser --noproxy '*' avec curl.

Lister les articles récents

curl --noproxy '*' -s \
  -H "Authorization: Bearer $JOOMLA_API_TOKEN" \
  -H "Accept: application/vnd.api+json" \
  "$JOOMLA_BASE_URL/api/index.php/v1/content/articles?sort=-created&page[limit]=5"

Lire un article

curl --noproxy '*' -s \
  -H "Authorization: Bearer $JOOMLA_API_TOKEN" \
  "$JOOMLA_BASE_URL/api/index.php/v1/content/articles/{id}"

Créer un article

curl --noproxy '*' -s -X POST \
  -H "Authorization: Bearer $JOOMLA_API_TOKEN" \
  -H "Content-Type: application/json" \
  "$JOOMLA_BASE_URL/api/index.php/v1/content/articles" \
  -d '{
    "title": "Titre",
    "alias": "titre-slug",
    "articletext": "<p>Contenu HTML</p>",
    "catid": 30,
    "state": 1,
    "language": "*",
    "metadesc": "Description SEO"
  }'

Mettre à jour / dépublier

curl --noproxy '*' -s -X PATCH \
  -H "Authorization: Bearer $JOOMLA_API_TOKEN" \
  -H "Content-Type: application/json" \
  "$JOOMLA_BASE_URL/api/index.php/v1/content/articles/{id}" \
  -d '{"state": 0}'

Catégories principales

ID Nom
8 Médias / presse
10 Blog / TCF Canada
30 Actualités culturelles

États articles

Valeur Signification
1 Publié
0 Dépublié
-2 Corbeille

sppb5.php — Appel type

curl -s -X POST \
  "https://kunming-afchine.org/falang-inject/sppb5.php?action=<ACTION>" \
  -H "X-Falang-Token: $FALANG_SECRET_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Voir sppb5-actions.md pour la liste complète des actions.


SP Page Builder — Points clés

Positions search_from

Le paramètre search_from doit être avant la position de l'UID dans le JSON.
Positions homepage (record 173) → voir site-map.md.

Encodage emoji

Le WAF Gandi bloque les surrogates JSON et l'UTF-8 4 bytes. Utiliser des entités HTML :

E_MAPLE  = "&#127809;"       # 🍁
E_PAPER  = "&#128196;"       # 📄
E_LAPTOP = "&#128187;"       # 💻
E_FLEUR  = "&#9884;&#65039;" # ⚜️
E_ARROW  = "&#10148;"        # ➤

Helix Ultimate — custom_js et custom_css

Modifier via set_template_style_params (style_id=10).
custom_js est injecté via addScriptDeclaration() → inline dans <head>, wrappé en DOMContentLoaded.


FaLang (traductions zh-CN)

  • Endpoint : $FALANG_INJECT_URL/index.php
  • Paramètres : reference_table, reference_id (UID addon SP Builder, pas l'ID numérique)
  • language_id zh-CN = 4, modified_by = 898

Checklist post-intervention standard

  1. Vérifier le retour JSON de sppb5.php (success: true)
  2. Confirmer la valeur en base avec select_query si critique
  3. Appeler purge_cache
  4. Valider visuellement via web_fetch sur la page concernée