conversations: fix apostrofe en onclick + quitar bypass auth dev
This commit is contained in:
+5
-14
@@ -1,23 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
// MODO DESARROLLO: bypass auth temporalmente
|
// Verificar autenticación
|
||||||
// TODO: Quitar esto en producción
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
|
||||||
// Crear sesión temporal de prueba
|
|
||||||
$_SESSION['user_id'] = 1;
|
|
||||||
$_SESSION['username'] = 'admin';
|
|
||||||
$_SESSION['admin_logged_in'] = true; // Requerido para requireAuthentication()
|
|
||||||
error_log('⚠️ SESIÓN DE DESARROLLO CREADA - Quitar en producción');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verificar autenticación (comentado para desarrollo)
|
|
||||||
/*
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
if (!isset($_SESSION['user_id'])) {
|
||||||
header('Location: login.php');
|
header('Location: login.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
@@ -2774,8 +2762,11 @@ if (!isset($_SESSION['user_id'])) {
|
|||||||
const unreadClass = (conv.unread_count && conv.unread_count > 0 && !isActive) ? 'unread' : '';
|
const unreadClass = (conv.unread_count && conv.unread_count > 0 && !isActive) ? 'unread' : '';
|
||||||
const attentionClass = conv.advisor_requested ? ' attention' : '';
|
const attentionClass = conv.advisor_requested ? ' attention' : '';
|
||||||
|
|
||||||
|
// Escapar apóstrofes/comillas en nombre y teléfono para no romper el onclick
|
||||||
|
const safeName = (conv.name || '').replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||||
|
const safePhone = (conv.phone_number || '').replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||||
return `
|
return `
|
||||||
<div class="conversation-item ${isActive} ${unreadClass}${attentionClass}" data-user-id="${conv.user_id}" onclick="chat.openConversation(${conv.user_id}, '${conv.name}', '${conv.phone_number}')">
|
<div class="conversation-item ${isActive} ${unreadClass}${attentionClass}" data-user-id="${conv.user_id}" onclick="chat.openConversation(${conv.user_id}, '${safeName}', '${safePhone}')">
|
||||||
<div class="conversation-avatar-wrapper">
|
<div class="conversation-avatar-wrapper">
|
||||||
${avatar}
|
${avatar}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user