Refactoring : sécurité (XSS), découpage en modules inc/* et js/admin/*, IDs résolus par slug, perf (caches, cron Gravatar, assets auto-hébergés), tests
This commit is contained in:
@@ -116,20 +116,22 @@ function thalim_get_author_data($user_id) {
|
||||
? thalim_bilingual(get_user_meta($user_id, 'affiliation_autre', true) ?: '', $lang)
|
||||
: $v;
|
||||
})(),
|
||||
'bio' => wpautop( make_clickable( get_user_meta($user_id, 'biographie', true) ?: '' ) ),
|
||||
'bio_en' => wpautop( make_clickable( get_user_meta($user_id, 'biographie_en', true) ?: '' ) ),
|
||||
// wp_kses_post: ces champs sont éditables par les contributeurs (profil)
|
||||
// et rendus en |raw dans author.twig → XSS stocké sans filtrage.
|
||||
'bio' => wpautop( make_clickable( wp_kses_post( get_user_meta($user_id, 'biographie', true) ?: '' ) ) ),
|
||||
'bio_en' => wpautop( make_clickable( wp_kses_post( get_user_meta($user_id, 'biographie_en', true) ?: '' ) ) ),
|
||||
'domaines_tags' => $domaines_tags,
|
||||
'domaines' => wpautop( make_clickable( get_user_meta($user_id, 'autres_domaines_de_recherches', true) ?: '' ) ),
|
||||
'domaines_en' => wpautop( make_clickable( get_user_meta($user_id, 'autres_domaines_de_recherches_en', true) ?: '' ) ),
|
||||
'recherches' => wpautop( get_user_meta($user_id, 'recherches_en_cours', true) ?: '' ),
|
||||
'recherches_en' => wpautop( get_user_meta($user_id, 'recherches_en_cours_en', true) ?: '' ),
|
||||
'domaines' => wpautop( make_clickable( wp_kses_post( get_user_meta($user_id, 'autres_domaines_de_recherches', true) ?: '' ) ) ),
|
||||
'domaines_en' => wpautop( make_clickable( wp_kses_post( get_user_meta($user_id, 'autres_domaines_de_recherches_en', true) ?: '' ) ) ),
|
||||
'recherches' => wpautop( wp_kses_post( get_user_meta($user_id, 'recherches_en_cours', true) ?: '' ) ),
|
||||
'recherches_en' => wpautop( wp_kses_post( get_user_meta($user_id, 'recherches_en_cours_en', true) ?: '' ) ),
|
||||
'axes' => $axes,
|
||||
'titre_these' => thalim_bilingual(get_user_meta($user_id, 'titre_de_these', true) ?: '', $lang),
|
||||
'date_soutenance' => get_user_meta($user_id, 'date_de_soutenance', true) ?: '',
|
||||
'directeur_thalim'=> $directeur_thalim,
|
||||
'autre_directeur' => get_user_meta($user_id, 'autre_directeur_de_these', true) ?: '',
|
||||
'resume_these' => wpautop( get_user_meta($user_id, 'resume_de_la_these', true) ?: '' ),
|
||||
'resume_these_en' => wpautop( get_user_meta($user_id, 'resume_de_la_these_en', true) ?: '' ),
|
||||
'resume_these' => wpautop( wp_kses_post( get_user_meta($user_id, 'resume_de_la_these', true) ?: '' ) ),
|
||||
'resume_these_en' => wpautop( wp_kses_post( get_user_meta($user_id, 'resume_de_la_these_en', true) ?: '' ) ),
|
||||
'email' => $show_email ? $user->user_email : '',
|
||||
'liens_externes' => $liens_externes,
|
||||
'documents' => $documents,
|
||||
@@ -148,7 +150,8 @@ function thalim_get_author_data($user_id) {
|
||||
* Returns an array sorted by post count (descending).
|
||||
*/
|
||||
function thalim_get_author_posts_by_category($user_id) {
|
||||
$excluded_cats = [12, 31]; // séances de séminaire, etc.
|
||||
$seance_cat = thalim_cat_id('seance');
|
||||
$excluded_cats = array_filter([ $seance_cat, thalim_cat_id('non-classe') ]);
|
||||
$lang = thalim_current_language();
|
||||
|
||||
$posts = Timber::get_posts([
|
||||
@@ -166,7 +169,6 @@ function thalim_get_author_posts_by_category($user_id) {
|
||||
],
|
||||
],
|
||||
'thalim_event_date_order' => true,
|
||||
'lang' => '',
|
||||
]);
|
||||
|
||||
$groups = [];
|
||||
@@ -205,29 +207,28 @@ function thalim_get_author_posts_by_category($user_id) {
|
||||
$groups[$cat_id]['posts'][] = $post;
|
||||
}
|
||||
|
||||
// Séances de séminaire — dedicated group. Posts in cat 12 where the member
|
||||
// is listed in `membres`/`autre_membres`. Cards use the parent séminaire
|
||||
// permalink with a #seance-{ID} hash (see thalim_get_card_data).
|
||||
// Séances de séminaire — dedicated group. Posts in the séance category
|
||||
// where the member is listed in `membres`/`autre_membres`. Cards use the
|
||||
// parent séminaire permalink with a #seance-{ID} hash (see thalim_get_card_data).
|
||||
$seances = Timber::get_posts([
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => -1,
|
||||
'category__in' => [12],
|
||||
'category__in' => [ $seance_cat ],
|
||||
'meta_query' => [
|
||||
'relation' => 'OR',
|
||||
[ 'key' => 'membres', 'value' => $user_id ],
|
||||
[ 'key' => 'autre_membres', 'value' => $user_id ],
|
||||
],
|
||||
'thalim_event_date_order' => true,
|
||||
'lang' => '',
|
||||
]);
|
||||
if (count($seances) > 0) {
|
||||
$seance_cat = get_term(12, 'category');
|
||||
$groups[12] = [
|
||||
'cat_id' => 12,
|
||||
'cat_name' => $seance_cat && !is_wp_error($seance_cat)
|
||||
? thalim_cat_name($seance_cat, $lang)
|
||||
$seance_term = get_term($seance_cat, 'category');
|
||||
$groups[$seance_cat] = [
|
||||
'cat_id' => $seance_cat,
|
||||
'cat_name' => $seance_term && !is_wp_error($seance_term)
|
||||
? thalim_cat_name($seance_term, $lang)
|
||||
: ($lang === 'en' ? 'Seminar sessions' : 'Séances de séminaire'),
|
||||
'cat_url' => get_category_link(12),
|
||||
'cat_url' => get_category_link($seance_cat),
|
||||
'posts' => $seances,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user