main
inicio
12
.env
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
DB_HOST=73C3E4C\SQL2022
|
||||||
|
DB_DATABASE=Importaciones_HC
|
||||||
|
DB_USERNAME=sa
|
||||||
|
DB_PASSWORD=Soluciones01
|
||||||
|
|
||||||
|
ENCRYPTION_KEY=6a7f92d3c8d1e5b3b0ac23ff1926a7c9
|
||||||
|
ENCRYPTION_IV=7c9f4a2d1e3b5f7a
|
||||||
|
|
||||||
|
|
||||||
|
RECAPTCHA_SECRET=6LfkMB8rAAAAAFWMAZmIqtN0ocDzg9t1g0_xbkkN
|
||||||
|
|
||||||
|
SMTP_PASS=N036p7y!
|
||||||
5
.htaccess
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Redirige todo hacia la carpeta public
|
||||||
|
RewriteCond %{REQUEST_URI} !^/IMPORTADORES/public/
|
||||||
|
RewriteRule ^(.*)$ public/$1 [L]
|
||||||
257
app/controllers/agentes.php
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../helpers/session.php';
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
require_once __DIR__ . '/../helpers/bitacoras.php';
|
||||||
|
require_once __DIR__ . '/../helpers/env.php';
|
||||||
|
|
||||||
|
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
|
|
||||||
|
function dashboard() {
|
||||||
|
if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'agente_aduanal') {
|
||||||
|
header("Location: /IMPORTADORES/login");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aquí puedes conectar a la BD si vas a mostrar métricas
|
||||||
|
// Ejemplo:
|
||||||
|
// $conn = getConnection();
|
||||||
|
// $sql = "SELECT COUNT(*) FROM solicitudes_importadores WHERE request_status = 'pending'";
|
||||||
|
// ...
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/agentes/dashboard.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function importadores_activos() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false) || $_SESSION['tipo_usuario'] !== 'agente_aduanal') {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT id_importador, nombre_empresa, email, telefono, creado_en
|
||||||
|
FROM importadores
|
||||||
|
WHERE estatus = 'aprobado'
|
||||||
|
ORDER BY creado_en DESC";
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
$importadores = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$importadores[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/agentes/importadores_activos.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function solicitudes_pendientes() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false) || $_SESSION['tipo_usuario'] !== 'agente_aduanal') {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT request_id, company_name, rfc, email, phone, request_date,opinion_file
|
||||||
|
FROM solicitudes_importadores
|
||||||
|
WHERE request_status = 'pending'
|
||||||
|
ORDER BY request_date DESC";
|
||||||
|
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
$solicitudes = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$solicitudes[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/agentes/solicitudes_pendientes.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function aprobar_solicitud()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener la solicitud
|
||||||
|
$sql = "SELECT * FROM solicitudes_importadores WHERE request_id = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
||||||
|
$solicitud = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$solicitud) {
|
||||||
|
die("❌ Solicitud no encontrada.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validar que no haya sido aprobada ya
|
||||||
|
if ($solicitud['request_status'] === 'approved') {
|
||||||
|
die("⚠️ Esta solicitud ya fue aprobada.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preparar datos
|
||||||
|
$nombre = decrypt($solicitud['company_name']);
|
||||||
|
$email = $solicitud['email'];
|
||||||
|
$tipo = 'importador';
|
||||||
|
|
||||||
|
// Generar contraseña aleatoria
|
||||||
|
$password_plain = bin2hex(random_bytes(5));
|
||||||
|
$password_hash = password_hash($password_plain, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
// Encriptar datos sensibles
|
||||||
|
$nombre_encrypt = encrypt($nombre);
|
||||||
|
$email_encrypt = encrypt($email);
|
||||||
|
|
||||||
|
// Insertar en usuarios_sistema
|
||||||
|
$sqlInsert = "INSERT INTO usuarios_sistema (nombre, email, password_hash, tipo_usuario, activo, creado_en)
|
||||||
|
VALUES (?, ?, ?, ?, 1, GETDATE())";
|
||||||
|
$stmtInsert = sqlsrv_query($conn, $sqlInsert, [
|
||||||
|
$nombre_encrypt, $email_encrypt, $password_hash, $tipo
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$stmtInsert) {
|
||||||
|
die("❌ Error al crear usuario: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualizar solicitud
|
||||||
|
$sqlUpdate = "UPDATE solicitudes_importadores
|
||||||
|
SET request_status = 'approved', approval_date = GETDATE(), approved_by = ?
|
||||||
|
WHERE request_id = ?";
|
||||||
|
$stmtUpdate = sqlsrv_query($conn, $sqlUpdate, [$_SESSION['usuario_id'] ?? null, $id]);
|
||||||
|
|
||||||
|
if (!$stmtUpdate) {
|
||||||
|
die("❌ Error al actualizar solicitud: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enviar correo al importador
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
|
try {
|
||||||
|
$mail->isSMTP();
|
||||||
|
$mail->Host = 'secure.emailsrvr.com';
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = 'noreply@aduanasoft.com.mx';
|
||||||
|
$mail->Password = $_ENV['SMTP_PASS'];
|
||||||
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||||
|
$mail->Port = 587;
|
||||||
|
|
||||||
|
$mail->setFrom('noreply@aduanasoft.com.mx', 'SIIH | AduanaSoft');
|
||||||
|
$mail->addAddress($email);
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$mail->isHTML(true);
|
||||||
|
$mail->Subject = 'Tu acceso a la plataforma SIIH ha sido autorizado';
|
||||||
|
|
||||||
|
$mail->Body = "
|
||||||
|
<div style='font-family: Segoe UI, sans-serif; background-color: #f4f6f9; padding: 40px;'>
|
||||||
|
<div style='max-width: 600px; margin: auto; background: #fff; border: 1px solid #ddd; border-radius: 10px; overflow: hidden;'>
|
||||||
|
<div style='background: linear-gradient(to right, #003366, #0055A5); padding: 20px; text-align: center;'>
|
||||||
|
<h2 style='color: white;'>¡Bienvenido a SIIH!</h2>
|
||||||
|
</div>
|
||||||
|
<div style='padding: 30px; color: #333; font-size: 16px;'>
|
||||||
|
<p>Tu registro como importador ha sido aprobado. Aquí tienes tus credenciales de acceso:</p>
|
||||||
|
<p><strong>Correo:</strong> $email</p>
|
||||||
|
<p><strong>Contraseña:</strong> $password_plain</p>
|
||||||
|
<p>📌 Te recomendamos cambiar tu contraseña una vez que ingreses al sistema.</p>
|
||||||
|
<p><a href='http://siih.aduanasoft.com/IMPORTADORES/login' class='btn btn-primary'>Ir al sistema</a></p>
|
||||||
|
</div>
|
||||||
|
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
||||||
|
© " . date('Y') . " SIIH · Desarrollado por AduanaSoft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>";
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log("Error al enviar correo: {$mail->ErrorInfo}");
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: /IMPORTADORES/AGENTES/solicitudes_pendientes");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function activos() {
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT id_usuario, nombre, email, tipo_usuario, creado_en, activo
|
||||||
|
FROM usuarios_sistema
|
||||||
|
WHERE tipo_usuario = 'importador'
|
||||||
|
ORDER BY creado_en DESC";
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
$importadores = [];
|
||||||
|
|
||||||
|
if ($stmt) {
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$row['nombre'] = decrypt($row['nombre']);
|
||||||
|
$row['email'] = decrypt($row['email']);
|
||||||
|
$importadores[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/agentes/importadores_activos.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function toggle_estado() {
|
||||||
|
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false) || $_SESSION['tipo_usuario'] !== 'agente_aduanal') {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT activo FROM usuarios_sistema WHERE id_usuario = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
||||||
|
|
||||||
|
if (!$stmt || !($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))) {
|
||||||
|
die("❌ Usuario no encontrado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$nuevoEstado = $row['activo'] == 1 ? 0 : 1;
|
||||||
|
|
||||||
|
$update = "UPDATE usuarios_sistema SET activo = ? WHERE id_usuario = ?";
|
||||||
|
$result = sqlsrv_query($conn, $update, [$nuevoEstado, $id]);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
die("❌ Error al actualizar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guardar en bitácora
|
||||||
|
require_once __DIR__ . '/../helpers/bitacoras.php';
|
||||||
|
registrar_bitacora_usuario($_SESSION['usuario_id'], 'toggle_estado', "Modificó estado del usuario $id a $nuevoEstado");
|
||||||
|
|
||||||
|
header("Location: /IMPORTADORES/agentes/activos");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
43
app/controllers/bitacoras.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
function login()
|
||||||
|
{
|
||||||
|
if (!isset($_SESSION['usuario_id'])) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT id, id_usuario, email, ip, fecha, exito, detalle FROM bitacora_login ORDER BY fecha DESC";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
|
||||||
|
$logins = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$logins[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/bitacoras/bitacora_login.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function usuarios()
|
||||||
|
{
|
||||||
|
if (!isset($_SESSION['usuario_id'])) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT id_bitacora, usuario_id, accion, descripcion, fecha FROM bitacora_usuarios ORDER BY fecha DESC";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
|
||||||
|
$cambios = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$cambios[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/bitacoras/bitacora_usuarios.php';
|
||||||
|
}
|
||||||
304
app/controllers/choferes.php
Normal file
@@ -0,0 +1,304 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
|
||||||
|
function lista() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
c.*,
|
||||||
|
(c.nombre + ' ' + c.apellido) AS nombre_completo,
|
||||||
|
tr.nombre AS transportista
|
||||||
|
FROM dbo.choferes c
|
||||||
|
JOIN dbo.transportistas tr
|
||||||
|
ON c.transportista_id = tr.id_transportista
|
||||||
|
WHERE tr.id_usuario = ?
|
||||||
|
AND c.status = 1
|
||||||
|
ORDER BY c.created_at DESC
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$usr]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en lista(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
$choferes = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$choferes[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/choferes/lista.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function crear() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// OJO: aquí usamos "activo" según tu esquema original
|
||||||
|
$sql = "
|
||||||
|
SELECT id_transportista, nombre
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_usuario = ? AND activo = 1
|
||||||
|
ORDER BY nombre
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$usr]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en crear(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
$transportistas = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$transportistas[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/choferes/crear.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function guardar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
$transportista_id = $_POST['transportista_id'] ?? null;
|
||||||
|
$nombre = trim($_POST['nombre'] ?? '');
|
||||||
|
$apellido = trim($_POST['apellido'] ?? '');
|
||||||
|
$licencia = trim($_POST['numero_licencia'] ?? '');
|
||||||
|
$telefono = trim($_POST['telefono'] ?? '');
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
$fecha_ingreso = $_POST['fecha_ingreso'] ?: null;
|
||||||
|
|
||||||
|
if (!$transportista_id || $nombre === '' || $apellido === '' || $licencia === '') {
|
||||||
|
die("❌ Todos los campos obligatorios deben llenarse.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manejo de foto
|
||||||
|
$fotoUrl = null;
|
||||||
|
if (!empty($_FILES['foto']['tmp_name'])) {
|
||||||
|
$ext = strtolower(pathinfo($_FILES['foto']['name'], PATHINFO_EXTENSION));
|
||||||
|
$dest = __DIR__ . '/../../public/uploads/chofer_'.uniqid().".{$ext}";
|
||||||
|
if (!is_dir(dirname($dest))) mkdir(dirname($dest), 0755, true);
|
||||||
|
if (move_uploaded_file($_FILES['foto']['tmp_name'], $dest)) {
|
||||||
|
$fotoUrl = "/IMPORTADORES/public/uploads/" . basename($dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "
|
||||||
|
INSERT INTO dbo.choferes
|
||||||
|
(transportista_id, nombre, apellido, numero_licencia, telefono, email, fecha_ingreso, foto_url, status)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1)
|
||||||
|
";
|
||||||
|
$params = [
|
||||||
|
(int)$transportista_id,
|
||||||
|
$nombre,
|
||||||
|
$apellido,
|
||||||
|
$licencia,
|
||||||
|
$telefono,
|
||||||
|
$email,
|
||||||
|
$fecha_ingreso,
|
||||||
|
$fotoUrl
|
||||||
|
];
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en guardar(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/choferes/lista?created=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT c.*, tr.nombre AS transportista
|
||||||
|
FROM dbo.choferes c
|
||||||
|
JOIN dbo.transportistas tr
|
||||||
|
ON c.transportista_id = tr.id_transportista
|
||||||
|
WHERE c.id_chofer = ?
|
||||||
|
AND tr.id_usuario = ?
|
||||||
|
AND c.status = 1
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [(int)$id, $_SESSION['usuario_id']]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en editar(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
$chofer = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
||||||
|
if (!$chofer) {
|
||||||
|
die("❌ Chofer no encontrado o no autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ Aquí convertimos fecha_ingreso a string YYYY-MM-DD
|
||||||
|
if ($chofer['fecha_ingreso'] instanceof DateTime) {
|
||||||
|
$chofer['fecha_ingreso'] = $chofer['fecha_ingreso']->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lista de transportistas
|
||||||
|
$sql2 = "
|
||||||
|
SELECT id_transportista, nombre
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_usuario = ? AND activo = 1
|
||||||
|
ORDER BY nombre
|
||||||
|
";
|
||||||
|
$stmt2 = sqlsrv_query($conn, $sql2, [$_SESSION['usuario_id']]);
|
||||||
|
if ($stmt2 === false) {
|
||||||
|
die("Error en editar() [transportistas]: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
$transportistas = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt2, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$transportistas[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/choferes/editar.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la actualización de un chofer
|
||||||
|
*/
|
||||||
|
function actualizar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_POST['id_chofer'] ?? null;
|
||||||
|
$transportista_id = $_POST['transportista_id'] ?? null;
|
||||||
|
$nombre = trim($_POST['nombre'] ?? '');
|
||||||
|
$apellido = trim($_POST['apellido'] ?? '');
|
||||||
|
$licencia = trim($_POST['numero_licencia']?? '');
|
||||||
|
$telefono = trim($_POST['telefono'] ?? '');
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
$fecha_ingreso = $_POST['fecha_ingreso'] ?: null;
|
||||||
|
$status = isset($_POST['status']) ? 1 : 0;
|
||||||
|
|
||||||
|
// Validación básica
|
||||||
|
if (
|
||||||
|
!$id || !is_numeric($id) ||
|
||||||
|
!$transportista_id || !is_numeric($transportista_id) ||
|
||||||
|
$nombre === '' || $apellido === '' || $licencia === ''
|
||||||
|
) {
|
||||||
|
die("❌ Datos inválidos o incompletos.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manejo de foto nueva (opcional)
|
||||||
|
$fotoUrl = null;
|
||||||
|
if (!empty($_FILES['foto']['tmp_name']) && $_FILES['foto']['error'] === UPLOAD_ERR_OK) {
|
||||||
|
$ext = strtolower(pathinfo($_FILES['foto']['name'], PATHINFO_EXTENSION));
|
||||||
|
$dest = __DIR__ . '/../../public/uploads/chofer_'.uniqid().".{$ext}";
|
||||||
|
if (!is_dir(dirname($dest))) {
|
||||||
|
mkdir(dirname($dest), 0755, true);
|
||||||
|
}
|
||||||
|
if (move_uploaded_file($_FILES['foto']['tmp_name'], $dest)) {
|
||||||
|
$fotoUrl = "/IMPORTADORES/public/uploads/" . basename($dest);
|
||||||
|
} else {
|
||||||
|
error_log("Error al mover foto en actualizar(): {$dest}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
if ($fotoUrl) {
|
||||||
|
$sql = "
|
||||||
|
UPDATE dbo.choferes SET
|
||||||
|
transportista_id = ?,
|
||||||
|
nombre = ?,
|
||||||
|
apellido = ?,
|
||||||
|
numero_licencia = ?,
|
||||||
|
telefono = ?,
|
||||||
|
email = ?,
|
||||||
|
fecha_ingreso = ?,
|
||||||
|
foto_url = ?,
|
||||||
|
status = ?,
|
||||||
|
updated_at = GETDATE()
|
||||||
|
WHERE id_chofer = ?
|
||||||
|
";
|
||||||
|
$params = [
|
||||||
|
(int)$transportista_id,
|
||||||
|
$nombre,
|
||||||
|
$apellido,
|
||||||
|
$licencia,
|
||||||
|
$telefono,
|
||||||
|
$email,
|
||||||
|
$fecha_ingreso,
|
||||||
|
$fotoUrl,
|
||||||
|
$status,
|
||||||
|
(int)$id
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$sql = "
|
||||||
|
UPDATE dbo.choferes SET
|
||||||
|
transportista_id = ?,
|
||||||
|
nombre = ?,
|
||||||
|
apellido = ?,
|
||||||
|
numero_licencia = ?,
|
||||||
|
telefono = ?,
|
||||||
|
email = ?,
|
||||||
|
fecha_ingreso = ?,
|
||||||
|
status = ?,
|
||||||
|
updated_at = GETDATE()
|
||||||
|
WHERE id_chofer = ?
|
||||||
|
";
|
||||||
|
$params = [
|
||||||
|
(int)$transportista_id,
|
||||||
|
$nombre,
|
||||||
|
$apellido,
|
||||||
|
$licencia,
|
||||||
|
$telefono,
|
||||||
|
$email,
|
||||||
|
$fecha_ingreso,
|
||||||
|
$status,
|
||||||
|
(int)$id
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error en actualizar(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/choferes/lista?updated=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* “Soft-delete” (status = 0) de un chofer
|
||||||
|
*/
|
||||||
|
function eliminar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "
|
||||||
|
UPDATE dbo.choferes
|
||||||
|
SET status = 0,
|
||||||
|
updated_at = GETDATE()
|
||||||
|
WHERE id_chofer = ?
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [(int)$id]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error en eliminar(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/choferes/lista?deleted=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
5
app/controllers/home.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function index() {
|
||||||
|
include __DIR__ . '/../../views/home/inicio.php';
|
||||||
|
}
|
||||||
16
app/controllers/importadores.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../helpers/session.php';
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
|
||||||
|
function dashboard()
|
||||||
|
{
|
||||||
|
if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador') {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nombreImportador = $_SESSION['usuario_nombre'];
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/importadores/dashboard_importador.php';
|
||||||
|
}
|
||||||
76
app/controllers/login.php
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../helpers/session.php';
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
require_once __DIR__ . '/../helpers/bitacoras.php';
|
||||||
|
require_once __DIR__ . '/../helpers/env.php';
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
|
function index()
|
||||||
|
{
|
||||||
|
include __DIR__ . '/../../views/login/index.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function validar()
|
||||||
|
{
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'] ?? 'N/A';
|
||||||
|
|
||||||
|
if (empty($email) || empty($password)) {
|
||||||
|
$_SESSION['login_error'] = 'Debes ingresar ambos campos.';
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$emailEncrypted = encrypt($email);
|
||||||
|
|
||||||
|
$sql = "SELECT id_usuario, nombre, email, password_hash, tipo_usuario, activo
|
||||||
|
FROM usuarios_sistema
|
||||||
|
WHERE email = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$emailEncrypted]);
|
||||||
|
|
||||||
|
if ($stmt && $row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
|
||||||
|
if (!$row['activo']) {
|
||||||
|
registrarBitacora($conn, $row['id_usuario'], $email, $ip, 0, 'Usuario inactivo');
|
||||||
|
$_SESSION['login_error'] = 'Tu usuario está inactivo.';
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password_verify($password, $row['password_hash'])) {
|
||||||
|
$_SESSION['usuario_id'] = $row['id_usuario'];
|
||||||
|
$_SESSION['usuario_nombre'] = decrypt($row['nombre']);
|
||||||
|
$_SESSION['usuario_email'] = $email;
|
||||||
|
$_SESSION['tipo_usuario'] = $row['tipo_usuario'];
|
||||||
|
|
||||||
|
registrarBitacora($conn, $row['id_usuario'], $email, $ip, 1, 'Login exitoso');
|
||||||
|
|
||||||
|
// Redirección por rol
|
||||||
|
if ($row['tipo_usuario'] === 'importador') {
|
||||||
|
header('Location: /IMPORTADORES/importadores/dashboard');
|
||||||
|
} elseif ($row['tipo_usuario'] === 'agente_aduanal') {
|
||||||
|
header('Location: /IMPORTADORES/AGENTES/dashboard');
|
||||||
|
} else {
|
||||||
|
header('Location: /IMPORTADORES/importadores/dashboard');
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
registrarBitacora($conn, $row['id_usuario'], $email, $ip, 0, 'Contraseña incorrecta');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
registrarBitacora($conn, null, $email, $ip, 0, 'Usuario no encontrado');
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['login_error'] = 'Credenciales incorrectas.';
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
162
app/controllers/registro.php
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
|
||||||
|
function index() {
|
||||||
|
include __DIR__ . '/../../views/registro/form.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../helpers/env.php';
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function enviar() {
|
||||||
|
// Validar reCAPTCHA
|
||||||
|
$captchaResponse = $_POST['g-recaptcha-response'] ?? '';
|
||||||
|
|
||||||
|
if (!$captchaResponse) {
|
||||||
|
die("❌ Debes completar el reCAPTCHA.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$secretKey = $_ENV['RECAPTCHA_SECRET'];
|
||||||
|
|
||||||
|
$verifyUrl = "https://www.google.com/recaptcha/api/siteverify";
|
||||||
|
$data = [
|
||||||
|
'secret' => $secretKey,
|
||||||
|
'response' => $captchaResponse
|
||||||
|
];
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
'http' => [
|
||||||
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||||
|
'method' => 'POST',
|
||||||
|
'content' => http_build_query($data)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$context = stream_context_create($options);
|
||||||
|
$result = file_get_contents($verifyUrl, false, $context);
|
||||||
|
$response = json_decode($result);
|
||||||
|
|
||||||
|
if (!$response->success) {
|
||||||
|
die("❌ Error de verificación reCAPTCHA.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$empresa = encrypt($_POST['company_name'] ?? '');
|
||||||
|
$rfc = encrypt($_POST['rfc'] ?? '');
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
$telefono = $_POST['phone'] ?? '';
|
||||||
|
$archivo = $_FILES['opinion_file'];
|
||||||
|
|
||||||
|
// Validar archivo
|
||||||
|
if ($archivo['error'] !== 0 || pathinfo($archivo['name'], PATHINFO_EXTENSION) !== 'pdf') {
|
||||||
|
die("Archivo inválido. Solo se permiten PDFs.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Guardar archivo
|
||||||
|
$nombreArchivo = uniqid() . '_' . basename($archivo['name']);
|
||||||
|
$rutaDestino = __DIR__ . '/../../storage/opiniones/' . $nombreArchivo;
|
||||||
|
move_uploaded_file($archivo['tmp_name'], $rutaDestino);
|
||||||
|
|
||||||
|
// Insertar en la base de datos
|
||||||
|
$sql = "INSERT INTO solicitudes_importadores
|
||||||
|
(company_name, rfc, email, phone, opinion_file, request_status, request_date)
|
||||||
|
VALUES (?, ?, ?, ?, ?, 'pending', GETDATE())";
|
||||||
|
|
||||||
|
$params = [$empresa, $rfc, $email, $telefono, $nombreArchivo];
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
|
||||||
|
if ($stmt === false) {
|
||||||
|
die(print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Configuración SMTP
|
||||||
|
$mail->isSMTP();
|
||||||
|
$mail->Host = 'secure.emailsrvr.com';
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = 'noreply@aduanasoft.com.mx';
|
||||||
|
$mail->Password = $_ENV['SMTP_PASS']; // desde el .env
|
||||||
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||||
|
$mail->Port = 587;
|
||||||
|
|
||||||
|
// Correo remitente y destinatario
|
||||||
|
$mail->setFrom('noreply@aduanasoft.com.mx', 'SIIH | AduanaSoft');
|
||||||
|
$mail->addAddress($email); // destinatario principal
|
||||||
|
|
||||||
|
// Formato y contenido
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$mail->isHTML(true);
|
||||||
|
$mail->Subject = 'Confirmación de solicitud de registro | SIIH';
|
||||||
|
|
||||||
|
$fechaRegistro = date('d/m/Y H:i');
|
||||||
|
// Consulta configuración institucional
|
||||||
|
$sqlConf = "SELECT TOP 1 * FROM configuracion_sistema";
|
||||||
|
$stmtConf = sqlsrv_query($conn, $sqlConf);
|
||||||
|
$conf = sqlsrv_fetch_array($stmtConf, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
$nombrePlataforma = $conf['nombre_plataforma'] ?? 'Sistema Integral para Importadores de Hidrocarburos';
|
||||||
|
$siglas = $conf['siglas'] ?? 'SIIH';
|
||||||
|
$logoUrl = $conf['logo_url'] ?? 'assets/img/logo_siih.png';
|
||||||
|
$color1 = explode(',', $conf['colores_primarios'] ?? '#003366,#0055A5')[0];
|
||||||
|
$color2 = explode(',', $conf['colores_primarios'] ?? '#003366,#0055A5')[1];
|
||||||
|
|
||||||
|
$mail->Body = "
|
||||||
|
<div style='font-family: Segoe UI, sans-serif; background-color: #f4f6f9; padding: 40px;'>
|
||||||
|
<div style='max-width: 600px; margin: auto; background: #fff; border: 1px solid #ddd; border-radius: 10px; overflow: hidden;'>
|
||||||
|
<div style='background: linear-gradient(to right, #FFF, $color2); padding: 20px; text-align: center;'>
|
||||||
|
<img src='http://{$_SERVER['HTTP_HOST']}/IMPORTADORES/public/$logoUrl' alt='Logo $siglas' style='height: 140px;'>
|
||||||
|
<h2 style='color: #fff; margin-top: 10px;'>Confirmación de Registro</h2>
|
||||||
|
</div>
|
||||||
|
<div style='padding: 30px; color: #333;'>
|
||||||
|
<p style='font-size: 16px;'>¡Hola!</p>
|
||||||
|
<p style='font-size: 15px;'>Tu solicitud de registro ha sido recibida exitosamente en <strong>$nombrePlataforma</strong>.</p>
|
||||||
|
|
||||||
|
<hr style='margin: 20px 0;'>
|
||||||
|
|
||||||
|
<p><strong>📋 Empresa:</strong> " . htmlspecialchars($_POST['company_name']) . "</p>
|
||||||
|
<p><strong>📞 Teléfono:</strong> " . htmlspecialchars($telefono) . "</p>
|
||||||
|
<p><strong>🕓 Fecha de registro:</strong> $fechaRegistro</p>
|
||||||
|
|
||||||
|
<hr style='margin: 20px 0;'>
|
||||||
|
|
||||||
|
<p style='font-size: 14px;'>Un agente aduanal revisará tu información y te notificará por este medio cuando tu solicitud sea aprobada.</p>
|
||||||
|
<p style='font-size: 14px;'>Por favor, mantente atento a tu correo (y revisa también tu carpeta de spam o promociones).</p>
|
||||||
|
|
||||||
|
<p style='margin-top: 30px; font-size: 13px; color: #888;'>Este es un mensaje automático enviado por el sistema de registro de importadores.</p>
|
||||||
|
</div>
|
||||||
|
<div style='background: #f1f1f1; text-align: center; padding: 15px; font-size: 12px; color: #666;'>
|
||||||
|
© " . date('Y') . " $siglas · Desarrollado por AduanaSoft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log("Error al enviar correo: {$mail->ErrorInfo}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/registro/gracias.php';
|
||||||
|
}
|
||||||
297
app/controllers/sistemas.php
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
require_once __DIR__ . '/../helpers/env.php';
|
||||||
|
require_once __DIR__ . '/../helpers/crypto.php';
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
function index() {
|
||||||
|
header("Location: /IMPORTADORES/sistemas/login");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function login() {
|
||||||
|
// Si es GET, mostrar el formulario
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
|
include __DIR__ . '/../../views/admin/login_sistemas.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si es POST, procesar login
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
$clave = $_POST['clave'] ?? '';
|
||||||
|
|
||||||
|
if ($email === 'sistemas@aduanasoft.com.mx' && $clave === 'rootSecure2025!') {
|
||||||
|
$_SESSION['usuario_sistemas'] = true;
|
||||||
|
header("Location: /IMPORTADORES/sistemas/alta_usuarios");
|
||||||
|
} else {
|
||||||
|
echo "❌ Acceso denegado.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function alta_usuarios() {
|
||||||
|
if (!($_SESSION['usuario_sistemas'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT * FROM usuarios_sistema ORDER BY creado_en DESC";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
|
||||||
|
$usuarios = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$usuarios[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/admin/alta_usuarios.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function guardar_usuario()
|
||||||
|
{
|
||||||
|
if (!($_SESSION['usuario_sistemas'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// 1. Capturar y validar datos
|
||||||
|
$nombre = trim($_POST['nombre'] ?? '');
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
$tipo = $_POST['tipo_usuario'] ?? '';
|
||||||
|
|
||||||
|
if (empty($nombre) || empty($email) || empty($password) || empty($tipo)) {
|
||||||
|
die("❌ Todos los campos son obligatorios.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($tipo, ['importador', 'agente_aduanal'])) {
|
||||||
|
die("❌ Tipo de usuario inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Encriptar datos sensibles
|
||||||
|
$nombre_encrypted = encrypt($nombre);
|
||||||
|
$email_encrypted = encrypt($email);
|
||||||
|
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
// 3. Validar duplicado por email encriptado
|
||||||
|
$sqlCheck = "SELECT COUNT(*) AS total FROM usuarios_sistema WHERE email = ?";
|
||||||
|
$stmtCheck = sqlsrv_query($conn, $sqlCheck, [$email_encrypted]);
|
||||||
|
$rowCheck = sqlsrv_fetch_array($stmtCheck, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($rowCheck['total'] > 0) {
|
||||||
|
die("❌ Este correo ya está registrado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Insertar usuario
|
||||||
|
$sqlInsert = "INSERT INTO usuarios_sistema (nombre, email, password_hash, tipo_usuario, activo, creado_en)
|
||||||
|
VALUES (?, ?, ?, ?, 1, GETDATE())";
|
||||||
|
$params = [$nombre_encrypted, $email_encrypted, $password_hash, $tipo];
|
||||||
|
|
||||||
|
$stmtInsert = sqlsrv_query($conn, $sqlInsert, $params);
|
||||||
|
|
||||||
|
if ($stmtInsert === false) {
|
||||||
|
die("❌ Error al guardar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Redirigir
|
||||||
|
header("Location: /IMPORTADORES/sistemas/alta_usuarios");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
session_start();
|
||||||
|
session_unset(); // Limpia variables de sesión
|
||||||
|
session_destroy(); // Destruye la sesión
|
||||||
|
|
||||||
|
header("Location: /IMPORTADORES/sistemas/login");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle_estado() {
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_sistemas'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener el estado actual
|
||||||
|
$sqlEstado = "SELECT activo FROM usuarios_sistema WHERE id_usuario = ?";
|
||||||
|
$stmtEstado = sqlsrv_query($conn, $sqlEstado, [$id]);
|
||||||
|
|
||||||
|
if (!$stmtEstado || !($row = sqlsrv_fetch_array($stmtEstado, SQLSRV_FETCH_ASSOC))) {
|
||||||
|
die("❌ Usuario no encontrado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$nuevoEstado = $row['activo'] ? 0 : 1;
|
||||||
|
|
||||||
|
// Actualizar estado
|
||||||
|
$sqlUpdate = "UPDATE usuarios_sistema SET activo = ? WHERE id_usuario = ?";
|
||||||
|
$stmtUpdate = sqlsrv_query($conn, $sqlUpdate, [$nuevoEstado, $id]);
|
||||||
|
|
||||||
|
if (!$stmtUpdate) {
|
||||||
|
die("❌ Error al actualizar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: /IMPORTADORES/sistemas/alta_usuarios");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function reset_password() {
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_sistemas'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔐 Generar contraseña aleatoria de 10 caracteres
|
||||||
|
$randomPassword = bin2hex(random_bytes(5)); // genera algo como 'a8c4f1b92d'
|
||||||
|
$passwordHash = password_hash($randomPassword, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$sqlEmail = "SELECT email FROM usuarios_sistema WHERE id_usuario = ?";
|
||||||
|
$stmtEmail = sqlsrv_query($conn, $sqlEmail, [$id]);
|
||||||
|
$row = sqlsrv_fetch_array($stmtEmail, SQLSRV_FETCH_ASSOC);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "UPDATE usuarios_sistema SET password_hash = ? WHERE id_usuario = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$passwordHash, $id]);
|
||||||
|
|
||||||
|
if (!$stmt) {
|
||||||
|
die("❌ Error al actualizar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔁 Redirigir pasando la contraseña como parámetro temporal (solo visible para el admin)
|
||||||
|
header("Location: /IMPORTADORES/sistemas/alta_usuarios?reset=ok&pass=" . urlencode($randomPassword) . "&email=" . urlencode(decrypt($row['email'])));
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function enviar_password() {
|
||||||
|
$email = $_GET['email'] ?? '';
|
||||||
|
$pass = $_GET['pass'] ?? '';
|
||||||
|
|
||||||
|
if (!$email || !$pass) {
|
||||||
|
http_response_code(400);
|
||||||
|
echo "Datos incompletos.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$mail->isSMTP();
|
||||||
|
$mail->Host = 'secure.emailsrvr.com';
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = 'noreply@aduanasoft.com.mx';
|
||||||
|
$mail->Password = $_ENV['SMTP_PASS'];
|
||||||
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||||
|
$mail->Port = 587;
|
||||||
|
|
||||||
|
$mail->setFrom('noreply@aduanasoft.com.mx', 'SIIH | AduanaSoft');
|
||||||
|
$mail->addAddress($email);
|
||||||
|
|
||||||
|
$mail->isHTML(true);
|
||||||
|
$mail->Subject = 'Nueva contraseña de acceso';
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$logoURL='http://siih.aduanasoft.com/IMPORTADORES/public/assets/img/logo_siih.png';
|
||||||
|
$mail->Body = "
|
||||||
|
<div style='font-family: Segoe UI, sans-serif; background-color: #f4f6f9; padding: 40px;'>
|
||||||
|
<div style='max-width: 600px; margin: auto; background: #fff; border: 1px solid #ddd; border-radius: 10px; overflow: hidden;'>
|
||||||
|
<div style='background: linear-gradient(to right, #003366, #0055A5); padding: 20px; text-align: center;'>
|
||||||
|
<img src='$logoURL' alt='Logo $siglas' style='height: 80px; width: 80px; margin-bottom: 10px;'>
|
||||||
|
<h2 style='color: white;'>Contraseña restablecida</h2>
|
||||||
|
</div>
|
||||||
|
<div style='padding: 30px; color: #333; font-size: 16px;'>
|
||||||
|
<p>Tu contraseña de acceso al <strong>$nombreSistema</strong> ha sido restablecida por el administrador.</p>
|
||||||
|
<p style='margin-top: 20px; font-size: 18px;'>
|
||||||
|
<strong>Nueva contraseña:</strong><br>
|
||||||
|
<span style='background-color: #f0f0f0; padding: 10px 15px; border-radius: 5px; display: inline-block; font-family: monospace;'>$pass</span>
|
||||||
|
</p>
|
||||||
|
<p style='margin-top: 20px;'>Por favor, cambia esta contraseña una vez que inicies sesión.</p>
|
||||||
|
<hr style='margin: 30px 0;'>
|
||||||
|
<p style='font-size: 14px; color: #888;'>Este es un mensaje automático generado por el sistema. Si no solicitaste esta acción, contacta al administrador.</p>
|
||||||
|
</div>
|
||||||
|
<div style='background: #e9ecef; text-align: center; padding: 15px; font-size: 13px; color: #666;'>
|
||||||
|
© " . date('Y') . " $siglas · Desarrollado por AduanaSoft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
echo "Correo enviado";
|
||||||
|
} catch (Exception $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo "Error al enviar correo: {$mail->ErrorInfo}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function bitacora_login() {
|
||||||
|
if (!($_SESSION['usuario_sistemas'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT * FROM bitacora_login ORDER BY fecha DESC";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
|
||||||
|
$registros = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$registros[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/admin/bitacora_login.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
function bitacora_usuarios() {
|
||||||
|
if (!($_SESSION['usuario_sistemas'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT * FROM bitacora_usuarios ORDER BY fecha DESC";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
|
||||||
|
$registros = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$registros[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/admin/bitacora_usuarios.php';
|
||||||
|
}
|
||||||
245
app/controllers/solicitud_importacion.php
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listado de solicitudes de importación (facturas) del importador logueado
|
||||||
|
*/
|
||||||
|
function lista() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$id_importador = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
f.*,
|
||||||
|
tr.nombre AS transportista,
|
||||||
|
(c.nombre + ' ' + c.apellido) AS chofer,
|
||||||
|
f.foto_solicitud_url
|
||||||
|
FROM dbo.solicitud_importacion_factura f
|
||||||
|
JOIN dbo.transportistas tr
|
||||||
|
ON f.transportista_id = tr.id_transportista
|
||||||
|
LEFT JOIN dbo.choferes c
|
||||||
|
ON f.chofer_id = c.id_chofer
|
||||||
|
WHERE f.id_importador = ?
|
||||||
|
AND f.status = 1
|
||||||
|
ORDER BY f.created_at DESC
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id_importador]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("Error en lista(): " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$facturas = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
if ($row['fecha_factura'] instanceof DateTime) {
|
||||||
|
$row['fecha_factura'] = $row['fecha_factura']->format('Y-m-d');
|
||||||
|
}
|
||||||
|
$facturas[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/solicitud_importacion/lista.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formulario de nueva factura
|
||||||
|
*/
|
||||||
|
function crear() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$id_importador = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Carga de datos para selects
|
||||||
|
$transportistas = [];
|
||||||
|
$stmtT = sqlsrv_query($conn, "SELECT id_transportista,nombre FROM dbo.transportistas WHERE id_usuario=? AND activo=1 ORDER BY nombre",[$id_importador]);
|
||||||
|
while ($r = sqlsrv_fetch_array($stmtT, SQLSRV_FETCH_ASSOC)) { $transportistas[] = $r; }
|
||||||
|
|
||||||
|
$choferes = [];
|
||||||
|
$stmtC = sqlsrv_query($conn, "SELECT c.id_chofer, c.nombre+' '+c.apellido AS nombre FROM dbo.choferes c JOIN dbo.transportistas t ON c.transportista_id=t.id_transportista WHERE t.id_usuario=? AND c.status=1 ORDER BY c.nombre",[$id_importador]);
|
||||||
|
while ($r = sqlsrv_fetch_array($stmtC, SQLSRV_FETCH_ASSOC)) { $choferes[] = $r; }
|
||||||
|
|
||||||
|
$paises = [];
|
||||||
|
$stmtP = sqlsrv_query($conn, "SELECT id_pais,nombre FROM dbo.paises ORDER BY nombre");
|
||||||
|
while ($r = sqlsrv_fetch_array($stmtP, SQLSRV_FETCH_ASSOC)) { $paises[] = $r; }
|
||||||
|
|
||||||
|
$aduanas = [];
|
||||||
|
$stmtA = sqlsrv_query($conn, "SELECT aduana_seccion,nombre FROM dbo.aduanas ORDER BY aduana_seccion");
|
||||||
|
while ($r = sqlsrv_fetch_array($stmtA, SQLSRV_FETCH_ASSOC)) { $aduanas[] = $r; }
|
||||||
|
|
||||||
|
$incoterms = [];
|
||||||
|
$stmtI = sqlsrv_query($conn, "SELECT INCOTERM,DESCESPANOL FROM dbo.gIncoterms ORDER BY INCOTERM");
|
||||||
|
while ($r = sqlsrv_fetch_array($stmtI, SQLSRV_FETCH_ASSOC)) { $incoterms[] = $r; }
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/solicitud_importacion/crear.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la creación de una nueva factura y sus partidas
|
||||||
|
*/
|
||||||
|
function guardar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
$id_importador = $_SESSION['usuario_id'];
|
||||||
|
$aduana_seccion = $_POST['anexo22_apendice'] ?? null;
|
||||||
|
$num_factura = trim($_POST['numero_factura'] ?? '');
|
||||||
|
$fecha = $_POST['fecha_factura'] ?? null;
|
||||||
|
$incoterm = $_POST['incoterm'] ?? null;
|
||||||
|
$pais_proveedor = $_POST['pais_proveedor'] ?? null;
|
||||||
|
$tipo_moneda = $_POST['tipo_moneda'] ?? null;
|
||||||
|
$valor_factura = $_POST['valor_factura'] ?? null;
|
||||||
|
$vinculacion = $_POST['vinculacion'] ?? 0;
|
||||||
|
$transportista_id = $_POST['transportista_id'] ?? null;
|
||||||
|
$chofer_id = $_POST['chofer_id'] ?? null;
|
||||||
|
$status = isset($_POST['status']) ? 1 : 0;
|
||||||
|
|
||||||
|
if (empty($num_factura) || empty($fecha) || empty($transportista_id) || empty($chofer_id)) {
|
||||||
|
die("❌ Faltan campos obligatorios.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Foto solicitud
|
||||||
|
$fotoUrl=null;
|
||||||
|
if (!empty($_FILES['foto_solicitud']['tmp_name']) && $_FILES['foto_solicitud']['error']===UPLOAD_ERR_OK) {
|
||||||
|
$ext=pathinfo($_FILES['foto_solicitud']['name'],PATHINFO_EXTENSION);
|
||||||
|
$dest=__DIR__.'/../../public/uploads/solicitud_'.uniqid().".$ext";
|
||||||
|
if (!is_dir(dirname($dest))) mkdir(dirname($dest),0755,true);
|
||||||
|
if(move_uploaded_file($_FILES['foto_solicitud']['tmp_name'],$dest)) {
|
||||||
|
$fotoUrl="/IMPORTADORES/public/uploads/".basename($dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "INSERT INTO dbo.solicitud_importacion_factura
|
||||||
|
(id_importador,aduana,anexo22_apendice,numero_factura,fecha_factura,
|
||||||
|
numero_pedimento,incoterm,pais_proveedor,tipo_moneda,
|
||||||
|
valor_factura,vinculacion,transportista_id,chofer_id,foto_solicitud_url,status)
|
||||||
|
VALUES(?,?,?,?,?,NULL,?,?,?,?,?,?,?,?,?)";
|
||||||
|
$params=[
|
||||||
|
$id_importador,
|
||||||
|
$aduana_seccion,
|
||||||
|
$aduana_seccion,
|
||||||
|
$num_factura,
|
||||||
|
$fecha,
|
||||||
|
$incoterm,
|
||||||
|
$pais_proveedor,
|
||||||
|
$tipo_moneda,
|
||||||
|
$valor_factura,
|
||||||
|
$vinculacion,
|
||||||
|
(int)$transportista_id,
|
||||||
|
(int)$chofer_id,
|
||||||
|
$fotoUrl,
|
||||||
|
$status
|
||||||
|
];
|
||||||
|
$stmt=sqlsrv_query($conn,$sql,$params);
|
||||||
|
if($stmt===false) die("Error en guardar():".print_r(sqlsrv_errors(),true));
|
||||||
|
|
||||||
|
// Obtener nuevo ID
|
||||||
|
$idRow=sqlsrv_query($conn,'SELECT SCOPE_IDENTITY() AS id');
|
||||||
|
$new=sqlsrv_fetch_array($idRow,SQLSRV_FETCH_ASSOC);
|
||||||
|
$id_solicitud=(int)$new['id'];
|
||||||
|
|
||||||
|
// Partidas
|
||||||
|
if(!empty($_POST['partidas'])&&is_array($_POST['partidas'])){
|
||||||
|
$sqlP="INSERT INTO dbo.solicitud_importacion_partidas
|
||||||
|
(id_solicitud,descripcion,precio_unitario)
|
||||||
|
VALUES(?,?,?)";
|
||||||
|
foreach($_POST['partidas'] as $p){
|
||||||
|
$d=trim($p['descripcion']??'');
|
||||||
|
$u=floatval($p['precio_unitario']??0);
|
||||||
|
if($d!==''&&$u>0) sqlsrv_query($conn,$sqlP,[$id_solicitud,$d,$u]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/solicitud_importacion/lista?created=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formulario de edición de factura
|
||||||
|
*/
|
||||||
|
function editar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login'); exit;
|
||||||
|
}
|
||||||
|
$id_solicitud = $_GET['id']??null;
|
||||||
|
if(!$id_solicitud||!is_numeric($id_solicitud)) die("❌ ID inválido.");
|
||||||
|
$id_importador=$_SESSION['usuario_id'];
|
||||||
|
$conn=getConnection();
|
||||||
|
|
||||||
|
$stmt=sqlsrv_query($conn,
|
||||||
|
"SELECT * FROM dbo.solicitud_importacion_factura WHERE id_solicitud=? AND id_importador=?",
|
||||||
|
[(int)$id_solicitud,$id_importador]
|
||||||
|
);
|
||||||
|
if($stmt===false) die(print_r(sqlsrv_errors(),true));
|
||||||
|
$factura=sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC);
|
||||||
|
if(!$factura) die("❌ No autorizado.");
|
||||||
|
if($factura['fecha_factura'] instanceof DateTime)
|
||||||
|
$factura['fecha_factura']=$factura['fecha_factura']->format('Y-m-d');
|
||||||
|
|
||||||
|
// Carga selects (igual que crear)
|
||||||
|
// Transportistas
|
||||||
|
$transportistas=[]; $stmtT=sqlsrv_query($conn,"SELECT id_transportista,nombre FROM dbo.transportistas WHERE id_usuario=? AND activo=1 ORDER BY nombre",[$id_importador]);
|
||||||
|
while($r=sqlsrv_fetch_array($stmtT,SQLSRV_FETCH_ASSOC)) $transportistas[]=$r;
|
||||||
|
// Choferes
|
||||||
|
$choferes=[]; $stmtC=sqlsrv_query($conn,"SELECT c.id_chofer,c.nombre+' '+c.apellido AS nombre FROM dbo.choferes c JOIN dbo.transportistas t ON c.transportista_id=t.id_transportista WHERE t.id_usuario=? AND c.status=1 ORDER BY c.nombre",[$id_importador]);
|
||||||
|
while($r=sqlsrv_fetch_array($stmtC,SQLSRV_FETCH_ASSOC)) $choferes[]=$r;
|
||||||
|
// Paises
|
||||||
|
$paises=[]; $stmtP=sqlsrv_query($conn,"SELECT id_pais,nombre FROM dbo.paises ORDER BY nombre");
|
||||||
|
while($r=sqlsrv_fetch_array($stmtP,SQLSRV_FETCH_ASSOC)) $paises[]=$r;
|
||||||
|
// Aduanas
|
||||||
|
$aduanas=[]; $stmtA=sqlsrv_query($conn,"SELECT aduana_seccion,nombre FROM dbo.aduanas ORDER BY aduana_seccion");
|
||||||
|
while($r=sqlsrv_fetch_array($stmtA,SQLSRV_FETCH_ASSOC)) $aduanas[]=$r;
|
||||||
|
// Incoterms
|
||||||
|
$incoterms=[]; $stmtI=sqlsrv_query($conn,"SELECT INCOTERM,DESCESPANOL FROM dbo.gIncoterms ORDER BY INCOTERM");
|
||||||
|
while($r=sqlsrv_fetch_array($stmtI,SQLSRV_FETCH_ASSOC)) $incoterms[]=$r;
|
||||||
|
|
||||||
|
// Partidas existentes
|
||||||
|
$partidas=[];
|
||||||
|
$stmtPar=sqlsrv_query($conn,"SELECT id_partida,descripcion,precio_unitario FROM dbo.solicitud_importacion_partidas WHERE id_solicitud=? ORDER BY id_partida",[(int)$id_solicitud]);
|
||||||
|
while($r=sqlsrv_fetch_array($stmtPar,SQLSRV_FETCH_ASSOC)) $partidas[]=$r;
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/solicitud_importacion/editar.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la actualización de una factura y sus partidas
|
||||||
|
*/
|
||||||
|
function actualizar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) die("⚠️ No autorizado.");
|
||||||
|
$id_solicitud=(int)($_POST['id_solicitud']??0);
|
||||||
|
// Validaciones similares a guardar()
|
||||||
|
// ... omito por brevedad, copia de guardar() + UPDATE ...
|
||||||
|
|
||||||
|
$conn=getConnection();
|
||||||
|
// Actualizar factura
|
||||||
|
$sqlU = "UPDATE dbo.solicitud_importacion_factura SET
|
||||||
|
aduana=?,anexo22_apendice=?,numero_factura=?,fecha_factura=?,incoterm=?,pais_proveedor=?,tipo_moneda=?,valor_factura=?,vinculacion=?,transportista_id=?,chofer_id=?,foto_solicitud_url=?,status=?,updated_at=GETDATE()
|
||||||
|
WHERE id_solicitud=? AND id_importador=?";
|
||||||
|
// Ejecutar UPDATE con parámetros
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// Borrar partidas previas
|
||||||
|
sqlsrv_query($conn,"DELETE FROM dbo.solicitud_importacion_partidas WHERE id_solicitud=?",[$id_solicitud]);
|
||||||
|
// Reinsertar partidas igual que guardar()
|
||||||
|
// ...
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/solicitud_importacion/lista?updated=ok'); exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* “Soft-delete” de una factura
|
||||||
|
*/
|
||||||
|
function eliminar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) { header('Location: /IMPORTADORES/login'); exit; }
|
||||||
|
$id=(int)($_GET['id']??0);
|
||||||
|
$conn=getConnection();
|
||||||
|
sqlsrv_query($conn,"UPDATE dbo.solicitud_importacion_factura SET status=0,updated_at=GETDATE() WHERE id_solicitud=? AND id_importador=?",[$id,$_SESSION['usuario_id']]);
|
||||||
|
header('Location: /IMPORTADORES/solicitud_importacion/lista?deleted=ok'); exit;
|
||||||
|
}
|
||||||
|
|
||||||
319
app/controllers/transportes.php
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listado de transportes (sólo activos) para el importador logueado
|
||||||
|
*/
|
||||||
|
function lista() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Sólo mostrar transportes de los transportistas que le pertenecen al usuario
|
||||||
|
$sql = "
|
||||||
|
SELECT t.*, tr.nombre AS transportista
|
||||||
|
FROM dbo.transportes t
|
||||||
|
JOIN dbo.transportistas tr
|
||||||
|
ON t.id_transportista = tr.id_transportista
|
||||||
|
WHERE tr.id_usuario = ? AND t.status = 1
|
||||||
|
ORDER BY t.creado_en DESC
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$usr]);
|
||||||
|
$transportes = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$transportes[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/transportes/lista.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formulario de alta de transporte
|
||||||
|
*/
|
||||||
|
function crear() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Traer transportistas propios para el select
|
||||||
|
$sql = "
|
||||||
|
SELECT id_transportista, nombre
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_usuario = ? AND activo = 1
|
||||||
|
ORDER BY nombre
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$usr]);
|
||||||
|
$transportistas = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$transportistas[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/transportes/crear.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la creación de un nuevo transporte
|
||||||
|
*/
|
||||||
|
function guardar() {
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
$vehiculo = trim($_POST['vehiculo'] ?? '');
|
||||||
|
$identFiscal= trim($_POST['identificador_fiscal'] ?? '');
|
||||||
|
$idTrans = $_POST['id_transportista'] ?? null;
|
||||||
|
|
||||||
|
if ($vehiculo === '' || $identFiscal === '' || !$idTrans) {
|
||||||
|
die("❌ Todos los campos son obligatorios.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manejo de foto
|
||||||
|
$fotoUrl = null;
|
||||||
|
if (!empty($_FILES['foto']['tmp_name'])) {
|
||||||
|
$ext = pathinfo($_FILES['foto']['name'], PATHINFO_EXTENSION);
|
||||||
|
$dest = __DIR__ . '/../../public/uploads/transporte_'.uniqid().".{$ext}";
|
||||||
|
if (move_uploaded_file($_FILES['foto']['tmp_name'], $dest)) {
|
||||||
|
// ruta relativa
|
||||||
|
$fotoUrl = "/IMPORTADORES/public/uploads/" . basename($dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "
|
||||||
|
INSERT INTO dbo.transportes
|
||||||
|
(vehiculo, identificador_fiscal, foto_url, status, id_transportista)
|
||||||
|
VALUES (?, ?, ?, 1, ?)
|
||||||
|
";
|
||||||
|
$params = [$vehiculo, $identFiscal, $fotoUrl, $idTrans];
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error al guardar: ".print_r(sqlsrv_errors(),true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/transportes/lista?created=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formulario de edición
|
||||||
|
*/
|
||||||
|
function editar() {
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
$conn = getConnection();
|
||||||
|
// Validar pertenencia igual que en index()
|
||||||
|
$sql = "
|
||||||
|
SELECT t.*, tr.nombre AS transportista
|
||||||
|
FROM dbo.transportes t
|
||||||
|
JOIN dbo.transportistas tr
|
||||||
|
ON t.id_transportista = tr.id_transportista
|
||||||
|
WHERE t.id_transporte = ?
|
||||||
|
AND tr.id_usuario = ?
|
||||||
|
AND t.status = 1
|
||||||
|
";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id, $_SESSION['usuario_id']]);
|
||||||
|
$t = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
||||||
|
if (!$t) die("❌ Transporte no encontrado o no autorizado.");
|
||||||
|
|
||||||
|
// Mismo select de transportistas que en crear()
|
||||||
|
$sql2 = "
|
||||||
|
SELECT id_transportista, nombre
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_usuario = ? AND activo = 1
|
||||||
|
ORDER BY nombre
|
||||||
|
";
|
||||||
|
$stmt2 = sqlsrv_query($conn, $sql2, [$_SESSION['usuario_id']]);
|
||||||
|
$transportistas = [];
|
||||||
|
while ($r=sqlsrv_fetch_array($stmt2,SQLSRV_FETCH_ASSOC)) $transportistas[]=$r;
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/transportes/editar.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la actualización
|
||||||
|
*/
|
||||||
|
function actualizar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
$id = $_POST['id_transporte'] ?? null;
|
||||||
|
$vehiculo = trim($_POST['vehiculo'] ?? '');
|
||||||
|
$identFiscal = trim($_POST['identificador_fiscal'] ?? '');
|
||||||
|
$idTrans = $_POST['id_transportista'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id) || $vehiculo === '' || $identFiscal === '' || !$idTrans) {
|
||||||
|
die("❌ Faltan datos.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// —– Manejo de nueva foto —–
|
||||||
|
$fotoUrl = null;
|
||||||
|
if (isset($_FILES['foto']) && $_FILES['foto']['error'] === UPLOAD_ERR_OK) {
|
||||||
|
$ext = strtolower(pathinfo($_FILES['foto']['name'], PATHINFO_EXTENSION));
|
||||||
|
$dest = __DIR__ . '/../../public/uploads/transporte_'.uniqid().".{$ext}";
|
||||||
|
if (!is_dir(dirname($dest))) {
|
||||||
|
mkdir(dirname($dest), 0755, true);
|
||||||
|
}
|
||||||
|
if (move_uploaded_file($_FILES['foto']['tmp_name'], $dest)) {
|
||||||
|
$fotoUrl = "/IMPORTADORES/public/uploads/" . basename($dest);
|
||||||
|
} else {
|
||||||
|
error_log("Error al mover archivo en actualizar(): {$dest}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// —– Construye el UPDATE dinámico —–
|
||||||
|
if ($fotoUrl) {
|
||||||
|
$sql = "
|
||||||
|
UPDATE dbo.transportes SET
|
||||||
|
vehiculo = ?,
|
||||||
|
identificador_fiscal = ?,
|
||||||
|
id_transportista = ?,
|
||||||
|
foto_url = ?
|
||||||
|
WHERE id_transporte = ?
|
||||||
|
";
|
||||||
|
$params = [$vehiculo, $identFiscal, $idTrans, $fotoUrl, $id];
|
||||||
|
} else {
|
||||||
|
$sql = "
|
||||||
|
UPDATE dbo.transportes SET
|
||||||
|
vehiculo = ?,
|
||||||
|
identificador_fiscal = ?,
|
||||||
|
id_transportista = ?
|
||||||
|
WHERE id_transporte = ?
|
||||||
|
";
|
||||||
|
$params = [$vehiculo, $identFiscal, $idTrans, $id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error al actualizar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: /IMPORTADORES/transportes/lista?updated=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* “Soft-delete” (status = 0)
|
||||||
|
*/
|
||||||
|
function eliminar() {
|
||||||
|
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id||!is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "UPDATE dbo.transportes SET status = 0 WHERE id_transporte = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error al eliminar: ".print_r(sqlsrv_errors(),true));
|
||||||
|
}
|
||||||
|
header('Location: /IMPORTADORES/transportes/lista?deleted=ok');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formulario de importación masiva
|
||||||
|
*/
|
||||||
|
function masivo() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
include __DIR__ . '/../../views/transportes/importar_masivo.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la importación masiva desde CSV
|
||||||
|
*/
|
||||||
|
function importarGuardar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validar subida del archivo
|
||||||
|
if (!isset($_FILES['csv']) || $_FILES['csv']['error'] !== UPLOAD_ERR_OK) {
|
||||||
|
$_SESSION['import_result'] = [
|
||||||
|
'imported' => 0,
|
||||||
|
'errors' => ["Error al subir el archivo CSV."]
|
||||||
|
];
|
||||||
|
header('Location: /IMPORTADORES/transportes/importar');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = $_FILES['csv']['tmp_name'];
|
||||||
|
$handle = fopen($tmp, 'r');
|
||||||
|
$headers = fgetcsv($handle, 1000, ',');
|
||||||
|
$conn = getConnection();
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$imported = 0;
|
||||||
|
$errors = [];
|
||||||
|
$row = 1;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 1000, ',')) !== false) {
|
||||||
|
$row++;
|
||||||
|
if (count($data) < 3) {
|
||||||
|
$errors[] = "Fila $row: formato incorrecto.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list($vehiculo, $identFiscal, $idTrans) = array_map('trim', $data);
|
||||||
|
|
||||||
|
// Validaciones básicas
|
||||||
|
if ($vehiculo === '' || $identFiscal === '' || !is_numeric($idTrans)) {
|
||||||
|
$errors[] = "Fila $row: datos incompletos o inválidos.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verificar que el transportista pertenezca al usuario
|
||||||
|
$sqlCheck = "SELECT COUNT(*) AS cnt
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_transportista = ? AND id_usuario = ?";
|
||||||
|
$stmtCheck = sqlsrv_query($conn, $sqlCheck, [$idTrans, $usr]);
|
||||||
|
$rCheck = sqlsrv_fetch_array($stmtCheck, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($rCheck['cnt'] == 0) {
|
||||||
|
$errors[] = "Fila $row: transportista $idTrans no válido.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insertar sin foto
|
||||||
|
$sql = "INSERT INTO dbo.transportes
|
||||||
|
(vehiculo, identificador_fiscal, foto_url, status, id_transportista)
|
||||||
|
VALUES (?, ?, NULL, 1, ?)";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$vehiculo, $identFiscal, $idTrans]);
|
||||||
|
if ($stmt === false) {
|
||||||
|
$errors[] = "Fila $row: error al insertar.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$imported++;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
// Guardar resultado en sesión y redirigir de vuelta al formulario
|
||||||
|
$_SESSION['import_result'] = [
|
||||||
|
'imported' => $imported,
|
||||||
|
'errors' => $errors
|
||||||
|
];
|
||||||
|
header('Location: /IMPORTADORES/transportes/masivo');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
457
app/controllers/transportistas.php
Normal file
@@ -0,0 +1,457 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
function guardar() {
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Capturar campos del formulario
|
||||||
|
$clave = $_POST['clave'];
|
||||||
|
$nombre = $_POST['nombre'];
|
||||||
|
$rfc = $_POST['rfc'];
|
||||||
|
$curp = $_POST['curp'] ?? null;
|
||||||
|
$dom = $_POST['domicilio'];
|
||||||
|
$pais = $_POST['pais'];
|
||||||
|
$entidad = $_POST['entidad'];
|
||||||
|
$ciudad = $_POST['ciudad'];
|
||||||
|
$tel = $_POST['telefono'];
|
||||||
|
$caat = $_POST['caat'];
|
||||||
|
$usr_id = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
// Validaciones básicas…
|
||||||
|
// INSERT incluyendo id_usuario
|
||||||
|
$sql = "INSERT INTO dbo.transportistas
|
||||||
|
(clave_identificador, nombre, rfc, curp, domicilio, pais,
|
||||||
|
entidad_federativa, ciudad, telefono, caat, id_usuario)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
$params = [
|
||||||
|
$clave, $nombre, $rfc, $curp, $dom,
|
||||||
|
$pais, $entidad, $ciudad, $tel, $caat,
|
||||||
|
$usr_id
|
||||||
|
];
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) {
|
||||||
|
die("❌ Error al guardar transportista: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirigir de vuelta a la lista o mostrar mensaje…
|
||||||
|
header("Location: /IMPORTADORES/transportistas/lista?success=1");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../config/database.php';
|
||||||
|
|
||||||
|
function alta() {
|
||||||
|
$conn = getConnection();
|
||||||
|
// 1) Cargar países
|
||||||
|
$sql = "SELECT id_pais, nombre FROM paises ORDER BY nombre";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql);
|
||||||
|
$paises = [];
|
||||||
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$paises[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/transportistas/alta.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// AJAX: devuelve los estados de un país dado
|
||||||
|
function estados() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
$pais = $_GET['pais'] ?? '';
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT id_estado, nombre FROM estados WHERE pais_id = ? ORDER BY nombre";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$pais]);
|
||||||
|
$out = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$out[] = $r;
|
||||||
|
}
|
||||||
|
echo json_encode($out);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AJAX: devuelve las ciudades de un estado dado
|
||||||
|
function ciudades() {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
$estado = $_GET['estado'] ?? '';
|
||||||
|
$conn = getConnection();
|
||||||
|
$sql = "SELECT id_ciudad, nombre FROM ciudades WHERE estado_id = ? ORDER BY nombre";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$estado]);
|
||||||
|
$out = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$out[] = $r;
|
||||||
|
}
|
||||||
|
echo json_encode($out);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function lista() {
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/transportistas/lista.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Descarga la plantilla CSV para carga masiva
|
||||||
|
*/
|
||||||
|
function template() {
|
||||||
|
$file = __DIR__ . '/../../public/downloads/transportistas_template.csv';
|
||||||
|
if (!file_exists($file)) {
|
||||||
|
http_response_code(404);
|
||||||
|
echo "❌ Plantilla no encontrada.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
header('Content-Type: text/csv; charset=UTF-8');
|
||||||
|
header('Content-Disposition: attachment; filename="transportistas_template.csv"');
|
||||||
|
readfile($file);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa la carga masiva desde un CSV
|
||||||
|
*/
|
||||||
|
function importar() {
|
||||||
|
// 1) Verificar sesión
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
$usr_id = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
// 2) Validar archivo subido
|
||||||
|
if (!isset($_FILES['archivo_csv']) || $_FILES['archivo_csv']['error'] !== UPLOAD_ERR_OK) {
|
||||||
|
die("❌ Debes subir un archivo CSV válido.");
|
||||||
|
}
|
||||||
|
$ext = pathinfo($_FILES['archivo_csv']['name'], PATHINFO_EXTENSION);
|
||||||
|
if (strtolower($ext) !== 'csv') {
|
||||||
|
die("❌ Solo se permiten archivos .csv");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) Abrir y leer CSV
|
||||||
|
$fh = fopen($_FILES['archivo_csv']['tmp_name'], 'r');
|
||||||
|
if (!$fh) {
|
||||||
|
die("❌ No se pudo abrir el archivo.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) Encabezados esperados
|
||||||
|
$header = fgetcsv($fh, 1000, ',');
|
||||||
|
$expected = [
|
||||||
|
'clave_identificador','nombre','rfc','curp',
|
||||||
|
'telefono','caat','pais_id','estado_id',
|
||||||
|
'ciudad_id','domicilio'
|
||||||
|
];
|
||||||
|
if ($header === false || array_map('trim', $header) !== $expected) {
|
||||||
|
fclose($fh);
|
||||||
|
die("❌ Encabezado de CSV inválido. Debe contener: " . implode(',', $expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
$errors = [];
|
||||||
|
$rowNum = 1;
|
||||||
|
|
||||||
|
while (($row = fgetcsv($fh, 2000, ',')) !== false) {
|
||||||
|
$rowNum++;
|
||||||
|
// asegurarse de tener todas las columnas
|
||||||
|
if (count($row) < count($expected)) {
|
||||||
|
$errors[] = "Fila $rowNum: faltan columnas.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// mapear valores y trim
|
||||||
|
list($clave,$nombre,$rfc,$curp,$tel,$caat,$pais,$estado,$ciudad,$dom) = array_map('trim', $row);
|
||||||
|
|
||||||
|
// validar obligatorios
|
||||||
|
if ($clave==='' || $nombre==='' || $rfc==='' || $tel==='' || $caat===''
|
||||||
|
|| $pais==='' || $estado==='' || $ciudad==='' || $dom==='') {
|
||||||
|
$errors[] = "Fila $rowNum: faltan datos obligatorios.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5) Insertar en BD
|
||||||
|
$sql = "INSERT INTO dbo.transportistas
|
||||||
|
(clave_identificador, nombre, rfc, curp, telefono, caat,
|
||||||
|
pais, entidad_federativa, ciudad, domicilio, id_usuario)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
$params = [
|
||||||
|
$clave, $nombre, $rfc, $curp, $tel,
|
||||||
|
$caat, $pais, $estado, $ciudad, $dom,
|
||||||
|
$usr_id
|
||||||
|
];
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||||
|
if ($stmt === false) {
|
||||||
|
$errors[] = "Fila $rowNum: error al guardar → " . print_r(sqlsrv_errors(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($fh);
|
||||||
|
|
||||||
|
// 6) Redirigir con resultado
|
||||||
|
if (count($errors) > 0) {
|
||||||
|
$_SESSION['import_errors'] = $errors;
|
||||||
|
header('Location: /IMPORTADORES/transportistas/bulk_upload?status=error');
|
||||||
|
} else {
|
||||||
|
$_SESSION['import_success'] = true;
|
||||||
|
header('Location: /IMPORTADORES/transportistas/bulk_upload?status=ok');
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bulk_upload() {
|
||||||
|
|
||||||
|
include __DIR__ . '/../../views/transportistas/bulk_upload.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ajax_lista() {
|
||||||
|
// 1) Autorización
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
http_response_code(403);
|
||||||
|
echo json_encode([]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// 2) Parámetros de DataTables
|
||||||
|
$draw = intval($_GET['draw'] ?? 0);
|
||||||
|
$start = intval($_GET['start'] ?? 0);
|
||||||
|
$length = intval($_GET['length'] ?? 10);
|
||||||
|
$search = $_GET['search']['value'] ?? '';
|
||||||
|
|
||||||
|
// Mapeo columnas
|
||||||
|
$cols = ['id_transportista','clave_identificador','nombre','rfc','ciudad','creado_en'];
|
||||||
|
$orderColIdx = intval($_GET['order'][0]['column'] ?? 5);
|
||||||
|
$orderDir = strtoupper($_GET['order'][0]['dir'] ?? 'ASC') === 'DESC' ? 'DESC' : 'ASC';
|
||||||
|
$orderCol = in_array($orderColIdx, range(0,5)) ? $cols[$orderColIdx] : 'creado_en';
|
||||||
|
|
||||||
|
// 3) Total registros sin filtro
|
||||||
|
$sqlTotal = "SELECT COUNT(*) AS total FROM dbo.transportistas WHERE id_usuario = ? AND activo = 1";
|
||||||
|
$stmt = sqlsrv_query($conn, $sqlTotal, [$usr]);
|
||||||
|
$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
||||||
|
$recordsTotal = (int)$row['total'];
|
||||||
|
|
||||||
|
// 4) Total registros con filtro
|
||||||
|
$where = "id_usuario = ? AND activo = 1 ";
|
||||||
|
$params = [$usr];
|
||||||
|
if ($search !== '') {
|
||||||
|
$where .= " AND (clave_identificador LIKE ? OR nombre LIKE ? OR rfc LIKE ? OR ciudad LIKE ?)";
|
||||||
|
$like = "%{$search}%";
|
||||||
|
$params = array_merge($params, [$like, $like, $like, $like]);
|
||||||
|
}
|
||||||
|
$sqlFiltered = "SELECT COUNT(*) AS total FROM dbo.transportistas WHERE $where";
|
||||||
|
$stmtF = sqlsrv_query($conn, $sqlFiltered, $params);
|
||||||
|
$rowF = sqlsrv_fetch_array($stmtF, SQLSRV_FETCH_ASSOC);
|
||||||
|
$recordsFiltered = (int)$rowF['total'];
|
||||||
|
|
||||||
|
// 5) Datos de la página
|
||||||
|
$sqlData = "
|
||||||
|
SELECT id_transportista, clave_identificador, nombre, rfc, ciudad, creado_en
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE $where
|
||||||
|
ORDER BY $orderCol $orderDir
|
||||||
|
OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
|
||||||
|
";
|
||||||
|
// agregar offset/limit al final
|
||||||
|
$params[] = $start;
|
||||||
|
$params[] = $length;
|
||||||
|
$stmtD = sqlsrv_query($conn, $sqlData, $params);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
while ($r = sqlsrv_fetch_array($stmtD, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$data[] = [
|
||||||
|
$r['id_transportista'],
|
||||||
|
$r['clave_identificador'],
|
||||||
|
$r['nombre'],
|
||||||
|
$r['rfc'],
|
||||||
|
$r['ciudad'],
|
||||||
|
$r['creado_en'] instanceof DateTime
|
||||||
|
? $r['creado_en']->format('Y-m-d H:i')
|
||||||
|
: ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6) Devolver JSON
|
||||||
|
header('Content-Type: application/json; charset=UTF-8');
|
||||||
|
echo json_encode([
|
||||||
|
"draw" => $draw,
|
||||||
|
"recordsTotal" => $recordsTotal,
|
||||||
|
"recordsFiltered" => $recordsFiltered,
|
||||||
|
"data" => $data
|
||||||
|
]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editar() {
|
||||||
|
// 1) Verificar sesión
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
// 2) Obtener el ID y validarlo
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID de transportista inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// 3) Consultar el transportista (pertenece al usuario)
|
||||||
|
$sql = "SELECT * FROM dbo.transportistas
|
||||||
|
WHERE id_transportista = ? AND id_usuario = ?";
|
||||||
|
$stmt = sqlsrv_query($conn, $sql, [$id, $usr]);
|
||||||
|
$t = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
||||||
|
if (!$t) {
|
||||||
|
die("❌ Transportista no encontrado o no autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) Cargar listas de países, estados y ciudades
|
||||||
|
// --- Países ---
|
||||||
|
$paises = [];
|
||||||
|
$rs = sqlsrv_query($conn, "SELECT id_pais, nombre FROM dbo.paises ORDER BY nombre");
|
||||||
|
while ($r = sqlsrv_fetch_array($rs, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$paises[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Estados para el país actual ---
|
||||||
|
$estados = [];
|
||||||
|
$rs = sqlsrv_query(
|
||||||
|
$conn,
|
||||||
|
"SELECT id_estado, nombre FROM dbo.estados WHERE pais_id = ? ORDER BY nombre",
|
||||||
|
[$t['pais']]
|
||||||
|
);
|
||||||
|
while ($r = sqlsrv_fetch_array($rs, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$estados[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Ciudades para el estado actual ---
|
||||||
|
$ciudades = [];
|
||||||
|
$rs = sqlsrv_query(
|
||||||
|
$conn,
|
||||||
|
"SELECT id_ciudad, nombre FROM dbo.ciudades WHERE estado_id = ? ORDER BY nombre",
|
||||||
|
[$t['entidad_federativa']]
|
||||||
|
);
|
||||||
|
while ($r = sqlsrv_fetch_array($rs, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$ciudades[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5) Renderizar la vista
|
||||||
|
include __DIR__ . '/../../views/transportistas/editar.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Procesa el POST de actualización
|
||||||
|
*/
|
||||||
|
function actualizar() {
|
||||||
|
session_start();
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
die("⚠️ No autorizado.");
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
|
||||||
|
// 1) Capturar y validar datos
|
||||||
|
$id = $_POST['id_transportista'] ?? null;
|
||||||
|
$clave = trim($_POST['clave'] ?? '');
|
||||||
|
$nombre= trim($_POST['nombre'] ?? '');
|
||||||
|
$rfc = trim($_POST['rfc'] ?? '');
|
||||||
|
$curp = trim($_POST['curp'] ?? '');
|
||||||
|
$tel = trim($_POST['telefono'] ?? '');
|
||||||
|
$caat = trim($_POST['caat'] ?? '');
|
||||||
|
$pais = $_POST['pais'] ?? '';
|
||||||
|
$estado= $_POST['entidad'] ?? '';
|
||||||
|
$ciudad= $_POST['ciudad'] ?? '';
|
||||||
|
$dom = trim($_POST['domicilio'] ?? '');
|
||||||
|
|
||||||
|
if (!$id || !is_numeric($id)
|
||||||
|
|| $clave===''||$nombre===''||$rfc===''||$tel===''||$caat===''
|
||||||
|
|| $pais===''||$estado===''||$ciudad===''||$dom===''
|
||||||
|
) {
|
||||||
|
die("❌ Faltan datos obligatorios.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// 2) Verificar que exista y pertenezca al usuario
|
||||||
|
$sqlChk = "SELECT COUNT(*) AS cnt
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_transportista = ? AND id_usuario = ?";
|
||||||
|
$stmtChk = sqlsrv_query($conn, $sqlChk, [$id, $usr]);
|
||||||
|
$rowChk = sqlsrv_fetch_array($stmtChk, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($rowChk['cnt'] == 0) {
|
||||||
|
die("❌ Transportista no encontrado o no autorizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) Ejecutar UPDATE
|
||||||
|
$sqlUpd = "UPDATE dbo.transportistas SET
|
||||||
|
clave_identificador = ?,
|
||||||
|
nombre = ?,
|
||||||
|
rfc = ?,
|
||||||
|
curp = ?,
|
||||||
|
telefono = ?,
|
||||||
|
caat = ?,
|
||||||
|
pais = ?,
|
||||||
|
entidad_federativa = ?,
|
||||||
|
ciudad = ?,
|
||||||
|
domicilio = ?
|
||||||
|
WHERE id_transportista = ?";
|
||||||
|
$params = [
|
||||||
|
$clave, $nombre, $rfc, $curp, $tel,
|
||||||
|
$caat, $pais, $estado, $ciudad, $dom,
|
||||||
|
$id
|
||||||
|
];
|
||||||
|
$stmtUpd = sqlsrv_query($conn, $sqlUpd, $params);
|
||||||
|
if ($stmtUpd === false) {
|
||||||
|
die("❌ Error al actualizar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) Redirigir con éxito
|
||||||
|
header("Location: /IMPORTADORES/transportistas/lista?edit=ok");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function eliminar() {
|
||||||
|
session_start();
|
||||||
|
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||||
|
header('Location: /IMPORTADORES/login');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$usr = $_SESSION['usuario_id'];
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id || !is_numeric($id)) {
|
||||||
|
die("❌ ID inválido.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
// Verificar que el transportista exista y pertenezca al usuario
|
||||||
|
$sqlChk = "SELECT COUNT(*) AS cnt
|
||||||
|
FROM dbo.transportistas
|
||||||
|
WHERE id_transportista = ? AND id_usuario = ? AND activo = 1";
|
||||||
|
$stmtChk = sqlsrv_query($conn, $sqlChk, [$id, $usr]);
|
||||||
|
$rowChk = sqlsrv_fetch_array($stmtChk, SQLSRV_FETCH_ASSOC);
|
||||||
|
if ($rowChk['cnt'] == 0) {
|
||||||
|
die("❌ Transportista no encontrado o ya eliminado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soft-delete
|
||||||
|
$sqlDel = "UPDATE dbo.transportistas
|
||||||
|
SET activo = 0
|
||||||
|
WHERE id_transportista = ?";
|
||||||
|
$stmtDel = sqlsrv_query($conn, $sqlDel, [$id]);
|
||||||
|
if ($stmtDel === false) {
|
||||||
|
die("❌ Error al eliminar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirigir con parámetro para SweetAlert
|
||||||
|
header("Location: /IMPORTADORES/transportistas/lista?deleted=ok");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
20
app/helpers/bitacoras.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function registrarBitacora($conn, $idUsuario, $email, $ip, $exito, $detalle) {
|
||||||
|
$sql = "INSERT INTO bitacora_login (id_usuario, email, ip, exito, detalle)
|
||||||
|
VALUES (?, ?, ?, ?, ?)";
|
||||||
|
$params = [$idUsuario, $email, $ip, $exito, $detalle];
|
||||||
|
sqlsrv_query($conn, $sql, $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
function registrar_bitacora_usuario($usuarioId, $accion, $descripcion) {
|
||||||
|
$conn = getConnection();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO bitacora_usuarios (usuario_id, accion, descripcion)
|
||||||
|
VALUES (?, ?, ?)";
|
||||||
|
$params = [$usuarioId, $accion, $descripcion];
|
||||||
|
|
||||||
|
sqlsrv_query($conn, $sql, $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
12
app/helpers/crypto.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
function encrypt($data) {
|
||||||
|
$key = $_ENV['ENCRYPTION_KEY'];
|
||||||
|
$iv = $_ENV['ENCRYPTION_IV'];
|
||||||
|
return base64_encode(openssl_encrypt($data, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv));
|
||||||
|
}
|
||||||
|
|
||||||
|
function decrypt($data) {
|
||||||
|
$key = $_ENV['ENCRYPTION_KEY'];
|
||||||
|
$iv = $_ENV['ENCRYPTION_IV'];
|
||||||
|
return openssl_decrypt(base64_decode($data), 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
|
||||||
|
}
|
||||||
11
app/helpers/env.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
function loadEnv($path = __DIR__ . '/../../.env') {
|
||||||
|
if (!file_exists($path)) return;
|
||||||
|
|
||||||
|
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (str_starts_with(trim($line), '#')) continue;
|
||||||
|
list($name, $value) = explode('=', $line, 2);
|
||||||
|
$_ENV[trim($name)] = trim($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
app/helpers/session.php
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
if (session_status() === PHP_SESSION_NONE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
5
composer.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"phpmailer/phpmailer": "^6.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
100
composer.lock
generated
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "baf0b1b659e688a64051c5ee9742a77e",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "phpmailer/phpmailer",
|
||||||
|
"version": "v6.9.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||||
|
"reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2f5c94fe7493efc213f643c23b1b1c249d40f47e",
|
||||||
|
"reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-filter": "*",
|
||||||
|
"ext-hash": "*",
|
||||||
|
"php": ">=5.5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||||
|
"doctrine/annotations": "^1.2.6 || ^1.13.3",
|
||||||
|
"php-parallel-lint/php-console-highlighter": "^1.0.0",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.3.2",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3.5",
|
||||||
|
"roave/security-advisories": "dev-latest",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7.2",
|
||||||
|
"yoast/phpunit-polyfills": "^1.0.4"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
|
||||||
|
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
|
||||||
|
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
|
||||||
|
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
|
||||||
|
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
|
||||||
|
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
|
||||||
|
"psr/log": "For optional PSR-3 debug logging",
|
||||||
|
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
|
||||||
|
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PHPMailer\\PHPMailer\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-2.1-only"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Marcus Bointon",
|
||||||
|
"email": "phpmailer@synchromedia.co.uk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jim Jagielski",
|
||||||
|
"email": "jimjag@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andy Prevost",
|
||||||
|
"email": "codeworxtech@users.sourceforge.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Brent R. Matzelle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
||||||
|
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.3"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/Synchro",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-11-24T18:04:13+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": {},
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": {},
|
||||||
|
"platform-dev": {},
|
||||||
|
"plugin-api-version": "2.6.0"
|
||||||
|
}
|
||||||
22
config/database.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../app/helpers/env.php';
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
|
function getConnection()
|
||||||
|
{
|
||||||
|
$serverName = $_ENV['DB_HOST'];
|
||||||
|
$connectionOptions = [
|
||||||
|
"Database" => $_ENV['DB_DATABASE'],
|
||||||
|
"Uid" => $_ENV['DB_USERNAME'],
|
||||||
|
"PWD" => $_ENV['DB_PASSWORD'],
|
||||||
|
"CharacterSet" => "UTF-8"
|
||||||
|
];
|
||||||
|
|
||||||
|
$conn = sqlsrv_connect($serverName, $connectionOptions);
|
||||||
|
|
||||||
|
if (!$conn) {
|
||||||
|
die("❌ Error al conectar: " . print_r(sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $conn;
|
||||||
|
}
|
||||||
5
public/.htaccess
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /IMPORTADORES/
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
|
||||||
BIN
public/assets/img/logo_siih.png
Normal file
|
After Width: | Height: | Size: 287 KiB |
1
public/downloads/transportes_masivo_template.csv
Normal file
@@ -0,0 +1 @@
|
|||||||
|
vehiculo,identificador_fiscal,id_transportista
|
||||||
|
11
public/downloads/transportistas_template.csv
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
clave_identificador,nombre,rfc,curp,telefono,caat,pais_id,estado_id,ciudad_id,domicilio
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
,,,,,,,,,
|
||||||
|
41
public/index.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
// Carga conexión a la base de datos y funciones de entorno
|
||||||
|
require_once __DIR__ . '/../config/database.php';
|
||||||
|
require_once __DIR__ . '/../app/helpers/env.php';
|
||||||
|
|
||||||
|
loadEnv();
|
||||||
|
|
||||||
|
// Captura la ruta limpia desde .htaccess
|
||||||
|
$url = $_GET['url'] ?? '';
|
||||||
|
$segments = explode('/', trim($url, '/'));
|
||||||
|
|
||||||
|
// Determina controlador y método
|
||||||
|
$controllerName = $segments[0] ?: 'home'; // por defecto 'home'
|
||||||
|
$methodName = $segments[1] ?? 'index';
|
||||||
|
$params = array_slice($segments, 2);
|
||||||
|
|
||||||
|
// Ruta del archivo controlador
|
||||||
|
$controllerFile = __DIR__ . '/../app/controllers/' . $controllerName . '.php';
|
||||||
|
|
||||||
|
if (file_exists($controllerFile)) {
|
||||||
|
require_once $controllerFile;
|
||||||
|
|
||||||
|
if (function_exists($methodName)) {
|
||||||
|
call_user_func_array($methodName, $params);
|
||||||
|
} else {
|
||||||
|
echo "❌ Método '$methodName' no encontrado en el controlador '$controllerName'.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "❌ Controlador '$controllerName' no encontrado.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ejemplo de router dinámico
|
||||||
|
if ($controllerName === 'sistemas' && $methodName === 'guardar_usuario') {
|
||||||
|
require_once __DIR__ . '/../app/controllers/sistemas.php';
|
||||||
|
guardar_usuario();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
public/uploads/chofer_68122e66ddaff.gif
Normal file
|
After Width: | Height: | Size: 999 KiB |
BIN
public/uploads/chofer_681232e5a8dd7.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
public/uploads/chofer_6812331bf3bba.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/chofer_68125ed7ce2cd.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
public/uploads/solicitud_68125c84a4b4d.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/solicitud_68125e3a40803.jpg
Normal file
|
After Width: | Height: | Size: 173 KiB |
BIN
public/uploads/solicitud_68125e8368a2b.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/solicitud_68126815b1386.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/solicitud_6812727d32de4.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/transporte_680fc8e6b704e.JPG
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
public/uploads/transporte_680fcad3e3e82.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/transporte_6811259bc7b84.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
public/uploads/transporte_681125a8ae468.jpg
Normal file
|
After Width: | Height: | Size: 159 KiB |
BIN
public/uploads/transporte_681133cd1151c.jpg
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
public/uploads/transporte_681133ea7039f.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
public/uploads/transporte_681133ffcb6da.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/uploads/transporte_68113411f2aa4.jpg
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
public/uploads/transporte_6811341f399b5.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
public/uploads/transporte_6811345a8b196.jpg
Normal file
|
After Width: | Height: | Size: 144 KiB |
BIN
public/uploads/transporte_681275accce84.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
33
public/ver_opinion.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// 🚨 Paso 1: Validar sesión de usuario
|
||||||
|
if (!isset($_SESSION['usuario_id'])) {
|
||||||
|
http_response_code(403);
|
||||||
|
echo "Acceso denegado. Debes iniciar sesión.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🚨 Paso 2: Validar parámetro
|
||||||
|
if (!isset($_GET['file']) || empty($_GET['file'])) {
|
||||||
|
http_response_code(400);
|
||||||
|
echo "Archivo no especificado.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$archivo = basename($_GET['file']); // Previene path traversal (../)
|
||||||
|
$ruta = realpath(__DIR__ . '/../storage/opiniones/' . $archivo);
|
||||||
|
|
||||||
|
// 🚨 Paso 3: Validar que el archivo exista y esté dentro del folder permitido
|
||||||
|
$directorioPermitido = realpath(__DIR__ . '/../storage/opiniones/');
|
||||||
|
if (!$ruta || !file_exists($ruta) || strpos($ruta, $directorioPermitido) !== 0) {
|
||||||
|
http_response_code(404);
|
||||||
|
echo "Archivo no encontrado o fuera de rango.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ Paso 4: Mostrar el archivo
|
||||||
|
header('Content-Type: application/pdf');
|
||||||
|
header('Content-Disposition: inline; filename="' . $archivo . '"');
|
||||||
|
readfile($ruta);
|
||||||
|
exit;
|
||||||
BIN
storage/opiniones/6805be64b72ef_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805bed552765_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805bfa7eaa37_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805bfd606243_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805bff9e8fef_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805c71cec51d_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805de98d3792_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805def812194_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805dfa2a17e1_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805e03cc1b37_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805e3a6dc219_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805e4e7f203b_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805e55869f95_ALICIA.pdf
Normal file
BIN
storage/opiniones/6805e5deb4c6e_ALICIA.pdf
Normal file
BIN
storage/opiniones/680654f728c18_Manual_Pinginator.pdf
Normal file
BIN
storage/opiniones/68065fd31b5d9_PROTOTIPO 1.pdf
Normal file
BIN
storage/opiniones/680697b2a9ec4_Doc1.pdf
Normal file
BIN
storage/opiniones/6807f9772179c_Manual_Pinginator.pdf
Normal file
BIN
storage/opiniones/6810dedca76a4_ACUSE_COVE_IVA-0256.pdf
Normal file
22
vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload.php @generated by Composer
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID < 50600) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, $err);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo $err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException($err);
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
|
return ComposerAutoloaderInit2185d2f99bcd56787481d9357a5972d3::getLoader();
|
||||||
579
vendor/composer/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,579 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||||
|
*
|
||||||
|
* $loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (eg. for PEAR packages)
|
||||||
|
* $loader->setUseIncludePath(true);
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
* @see https://www.php-fig.org/psr/psr-0/
|
||||||
|
* @see https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
/** @var \Closure(string):void */
|
||||||
|
private static $includeFile;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $vendorDir;
|
||||||
|
|
||||||
|
// PSR-4
|
||||||
|
/**
|
||||||
|
* @var array<string, array<string, int>>
|
||||||
|
*/
|
||||||
|
private $prefixLengthsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var array<string, list<string>>
|
||||||
|
*/
|
||||||
|
private $prefixDirsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr4 = array();
|
||||||
|
|
||||||
|
// PSR-0
|
||||||
|
/**
|
||||||
|
* List of PSR-0 prefixes
|
||||||
|
*
|
||||||
|
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, list<string>>>
|
||||||
|
*/
|
||||||
|
private $prefixesPsr0 = array();
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr0 = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
private $classMap = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $classMapAuthoritative = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, bool>
|
||||||
|
*/
|
||||||
|
private $missingClasses = array();
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
|
private $apcuPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, self>
|
||||||
|
*/
|
||||||
|
private static $registeredLoaders = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|null $vendorDir
|
||||||
|
*/
|
||||||
|
public function __construct($vendorDir = null)
|
||||||
|
{
|
||||||
|
$this->vendorDir = $vendorDir;
|
||||||
|
self::initializeIncludeClosure();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
if (!empty($this->prefixesPsr0)) {
|
||||||
|
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixesPsr4()
|
||||||
|
{
|
||||||
|
return $this->prefixDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirs()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirsPsr4()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string> Array of classname => path
|
||||||
|
*/
|
||||||
|
public function getClassMap()
|
||||||
|
{
|
||||||
|
return $this->classMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $classMap Class to filename map
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addClassMap(array $classMap)
|
||||||
|
{
|
||||||
|
if ($this->classMap) {
|
||||||
|
$this->classMap = array_merge($this->classMap, $classMap);
|
||||||
|
} else {
|
||||||
|
$this->classMap = $classMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix, either
|
||||||
|
* appending or prepending to the ones previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param list<string>|string $paths The PSR-0 root directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
$paths = (array) $paths;
|
||||||
|
if (!$prefix) {
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->fallbackDirsPsr0
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$this->fallbackDirsPsr0,
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$first = $prefix[0];
|
||||||
|
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($prepend) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->prefixesPsr0[$first][$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$this->prefixesPsr0[$first][$prefix],
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace, either
|
||||||
|
* appending or prepending to the ones previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param list<string>|string $paths The PSR-4 base directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addPsr4($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
$paths = (array) $paths;
|
||||||
|
if (!$prefix) {
|
||||||
|
// Register directories for the root namespace.
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->fallbackDirsPsr4
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$this->fallbackDirsPsr4,
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||||
|
// Register directories for a new namespace.
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||||
|
} elseif ($prepend) {
|
||||||
|
// Prepend directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$paths,
|
||||||
|
$this->prefixDirsPsr4[$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Append directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$this->prefixDirsPsr4[$prefix],
|
||||||
|
$paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix,
|
||||||
|
* replacing any others previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param list<string>|string $paths The PSR-0 base directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr0 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace,
|
||||||
|
* replacing any others previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param list<string>|string $paths The PSR-4 base directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPsr4($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr4 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include path for class files.
|
||||||
|
*
|
||||||
|
* @param bool $useIncludePath
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setUseIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns off searching the prefix and fallback directories for classes
|
||||||
|
* that have not been registered with the class map.
|
||||||
|
*
|
||||||
|
* @param bool $classMapAuthoritative
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||||
|
{
|
||||||
|
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should class lookup fail if not found in the current class map?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isClassMapAuthoritative()
|
||||||
|
{
|
||||||
|
return $this->classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||||
|
*
|
||||||
|
* @param string|null $apcuPrefix
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setApcuPrefix($apcuPrefix)
|
||||||
|
{
|
||||||
|
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getApcuPrefix()
|
||||||
|
{
|
||||||
|
return $this->apcuPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param bool $prepend Whether to prepend the autoloader or not
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
|
||||||
|
if (null === $this->vendorDir) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prepend) {
|
||||||
|
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||||
|
} else {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
|
||||||
|
if (null !== $this->vendorDir) {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
* @return true|null True if loaded, null otherwise
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
$includeFile = self::$includeFile;
|
||||||
|
$includeFile($file);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|false The path if found, false otherwise
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
// class map lookup
|
||||||
|
if (isset($this->classMap[$class])) {
|
||||||
|
return $this->classMap[$class];
|
||||||
|
}
|
||||||
|
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||||
|
if ($hit) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->findFileWithExtension($class, '.php');
|
||||||
|
|
||||||
|
// Search for Hack files if we are running on HHVM
|
||||||
|
if (false === $file && defined('HHVM_VERSION')) {
|
||||||
|
$file = $this->findFileWithExtension($class, '.hh');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
apcu_add($this->apcuPrefix.$class, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === $file) {
|
||||||
|
// Remember that this class does not exist.
|
||||||
|
$this->missingClasses[$class] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||||
|
*
|
||||||
|
* @return array<string, self>
|
||||||
|
*/
|
||||||
|
public static function getRegisteredLoaders()
|
||||||
|
{
|
||||||
|
return self::$registeredLoaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $class
|
||||||
|
* @param string $ext
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private function findFileWithExtension($class, $ext)
|
||||||
|
{
|
||||||
|
// PSR-4 lookup
|
||||||
|
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
|
||||||
|
$first = $class[0];
|
||||||
|
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||||
|
$subPath = $class;
|
||||||
|
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||||
|
$subPath = substr($subPath, 0, $lastPos);
|
||||||
|
$search = $subPath . '\\';
|
||||||
|
if (isset($this->prefixDirsPsr4[$search])) {
|
||||||
|
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||||
|
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||||
|
if (file_exists($file = $dir . $pathEnd)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-4 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 lookup
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||||
|
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->prefixesPsr0[$first])) {
|
||||||
|
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||||
|
if (0 === strpos($class, $prefix)) {
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 include paths.
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private static function initializeIncludeClosure()
|
||||||
|
{
|
||||||
|
if (self::$includeFile !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope isolated include.
|
||||||
|
*
|
||||||
|
* Prevents access to $this/self from included files.
|
||||||
|
*
|
||||||
|
* @param string $file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
self::$includeFile = \Closure::bind(static function($file) {
|
||||||
|
include $file;
|
||||||
|
}, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
396
vendor/composer/InstalledVersions.php
vendored
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is copied in every Composer installed project and available to all
|
||||||
|
*
|
||||||
|
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||||
|
*
|
||||||
|
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||||
|
*
|
||||||
|
* @final
|
||||||
|
*/
|
||||||
|
class InstalledVersions
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private static $selfDir = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var mixed[]|null
|
||||||
|
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||||
|
*/
|
||||||
|
private static $installed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private static $installedIsLocalDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private static $canGetVendors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static $installedByVendor = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackages()
|
||||||
|
{
|
||||||
|
$packages = array();
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
$packages[] = array_keys($installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === \count($packages)) {
|
||||||
|
return $packages[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names with a specific type e.g. 'library'
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackagesByType($type)
|
||||||
|
{
|
||||||
|
$packagesByType = array();
|
||||||
|
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
foreach ($installed['versions'] as $name => $package) {
|
||||||
|
if (isset($package['type']) && $package['type'] === $type) {
|
||||||
|
$packagesByType[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packagesByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package is installed
|
||||||
|
*
|
||||||
|
* This also returns true if the package name is provided or replaced by another package
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @param bool $includeDevRequirements
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (isset($installed['versions'][$packageName])) {
|
||||||
|
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package satisfies a version constraint
|
||||||
|
*
|
||||||
|
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||||
|
*
|
||||||
|
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||||
|
*
|
||||||
|
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||||
|
* @param string $packageName
|
||||||
|
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||||
|
{
|
||||||
|
$constraint = $parser->parseConstraints((string) $constraint);
|
||||||
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||||
|
|
||||||
|
return $provided->matches($constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||||
|
*
|
||||||
|
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||||
|
* whether a given version of a package is installed, and not just whether it exists
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string Version constraint usable with composer/semver
|
||||||
|
*/
|
||||||
|
public static function getVersionRanges($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' || ', $ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getPrettyVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||||
|
*/
|
||||||
|
public static function getReference($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||||
|
*/
|
||||||
|
public static function getInstallPath($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||||
|
*/
|
||||||
|
public static function getRootPackage()
|
||||||
|
{
|
||||||
|
$installed = self::getInstalled();
|
||||||
|
|
||||||
|
return $installed[0]['root'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw installed.php data for custom implementations
|
||||||
|
*
|
||||||
|
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||||
|
*/
|
||||||
|
public static function getRawData()
|
||||||
|
{
|
||||||
|
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
self::$installed = include __DIR__ . '/installed.php';
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
public static function getAllRawData()
|
||||||
|
{
|
||||||
|
return self::getInstalled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you reload the static array from another file
|
||||||
|
*
|
||||||
|
* This is only useful for complex integrations in which a project needs to use
|
||||||
|
* this class but then also needs to execute another project's autoloader in process,
|
||||||
|
* and wants to ensure both projects have access to their version of installed.php.
|
||||||
|
*
|
||||||
|
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||||
|
* the data it needs from this class, then call reload() with
|
||||||
|
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||||
|
* the project in which it runs can then also use this class safely, without
|
||||||
|
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||||
|
*
|
||||||
|
* @param array[] $data A vendor/composer/installed.php data set
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||||
|
*/
|
||||||
|
public static function reload($data)
|
||||||
|
{
|
||||||
|
self::$installed = $data;
|
||||||
|
self::$installedByVendor = array();
|
||||||
|
|
||||||
|
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
|
||||||
|
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
|
||||||
|
// so we have to assume it does not, and that may result in duplicate data being returned when listing
|
||||||
|
// all installed packages for example
|
||||||
|
self::$installedIsLocalDir = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getSelfDir()
|
||||||
|
{
|
||||||
|
if (self::$selfDir === null) {
|
||||||
|
self::$selfDir = strtr(__DIR__, '\\', '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$selfDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static function getInstalled()
|
||||||
|
{
|
||||||
|
if (null === self::$canGetVendors) {
|
||||||
|
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed = array();
|
||||||
|
$copiedLocalDir = false;
|
||||||
|
|
||||||
|
if (self::$canGetVendors) {
|
||||||
|
$selfDir = self::getSelfDir();
|
||||||
|
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||||
|
$vendorDir = strtr($vendorDir, '\\', '/');
|
||||||
|
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir];
|
||||||
|
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||||
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||||
|
$required = require $vendorDir.'/composer/installed.php';
|
||||||
|
self::$installedByVendor[$vendorDir] = $required;
|
||||||
|
$installed[] = $required;
|
||||||
|
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
|
||||||
|
self::$installed = $required;
|
||||||
|
self::$installedIsLocalDir = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
|
||||||
|
$copiedLocalDir = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||||
|
$required = require __DIR__ . '/installed.php';
|
||||||
|
self::$installed = $required;
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::$installed !== array() && !$copiedLocalDir) {
|
||||||
|
$installed[] = self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed;
|
||||||
|
}
|
||||||
|
}
|
||||||
21
vendor/composer/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
10
vendor/composer/autoload_classmap.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_classmap.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
|
);
|
||||||
9
vendor/composer/autoload_namespaces.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_namespaces.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
);
|
||||||
10
vendor/composer/autoload_psr4.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_psr4.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
|
||||||
|
);
|
||||||
38
vendor/composer/autoload_real.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
|
class ComposerAutoloaderInit2185d2f99bcd56787481d9357a5972d3
|
||||||
|
{
|
||||||
|
private static $loader;
|
||||||
|
|
||||||
|
public static function loadClassLoader($class)
|
||||||
|
{
|
||||||
|
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||||
|
require __DIR__ . '/ClassLoader.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Composer\Autoload\ClassLoader
|
||||||
|
*/
|
||||||
|
public static function getLoader()
|
||||||
|
{
|
||||||
|
if (null !== self::$loader) {
|
||||||
|
return self::$loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
|
spl_autoload_register(array('ComposerAutoloaderInit2185d2f99bcd56787481d9357a5972d3', 'loadClassLoader'), true, true);
|
||||||
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
|
spl_autoload_unregister(array('ComposerAutoloaderInit2185d2f99bcd56787481d9357a5972d3', 'loadClassLoader'));
|
||||||
|
|
||||||
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
call_user_func(\Composer\Autoload\ComposerStaticInit2185d2f99bcd56787481d9357a5972d3::getInitializer($loader));
|
||||||
|
|
||||||
|
$loader->register(true);
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
}
|
||||||
|
}
|
||||||
36
vendor/composer/autoload_static.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_static.php @generated by Composer
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
class ComposerStaticInit2185d2f99bcd56787481d9357a5972d3
|
||||||
|
{
|
||||||
|
public static $prefixLengthsPsr4 = array (
|
||||||
|
'P' =>
|
||||||
|
array (
|
||||||
|
'PHPMailer\\PHPMailer\\' => 20,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixDirsPsr4 = array (
|
||||||
|
'PHPMailer\\PHPMailer\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $classMap = array (
|
||||||
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
{
|
||||||
|
return \Closure::bind(function () use ($loader) {
|
||||||
|
$loader->prefixLengthsPsr4 = ComposerStaticInit2185d2f99bcd56787481d9357a5972d3::$prefixLengthsPsr4;
|
||||||
|
$loader->prefixDirsPsr4 = ComposerStaticInit2185d2f99bcd56787481d9357a5972d3::$prefixDirsPsr4;
|
||||||
|
$loader->classMap = ComposerStaticInit2185d2f99bcd56787481d9357a5972d3::$classMap;
|
||||||
|
|
||||||
|
}, null, ClassLoader::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
90
vendor/composer/installed.json
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "phpmailer/phpmailer",
|
||||||
|
"version": "v6.9.3",
|
||||||
|
"version_normalized": "6.9.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||||
|
"reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2f5c94fe7493efc213f643c23b1b1c249d40f47e",
|
||||||
|
"reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-filter": "*",
|
||||||
|
"ext-hash": "*",
|
||||||
|
"php": ">=5.5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||||
|
"doctrine/annotations": "^1.2.6 || ^1.13.3",
|
||||||
|
"php-parallel-lint/php-console-highlighter": "^1.0.0",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.3.2",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3.5",
|
||||||
|
"roave/security-advisories": "dev-latest",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7.2",
|
||||||
|
"yoast/phpunit-polyfills": "^1.0.4"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
|
||||||
|
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
|
||||||
|
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
|
||||||
|
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
|
||||||
|
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
|
||||||
|
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
|
||||||
|
"psr/log": "For optional PSR-3 debug logging",
|
||||||
|
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
|
||||||
|
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
|
||||||
|
},
|
||||||
|
"time": "2024-11-24T18:04:13+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PHPMailer\\PHPMailer\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-2.1-only"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Marcus Bointon",
|
||||||
|
"email": "phpmailer@synchromedia.co.uk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jim Jagielski",
|
||||||
|
"email": "jimjag@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andy Prevost",
|
||||||
|
"email": "codeworxtech@users.sourceforge.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Brent R. Matzelle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
||||||
|
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.3"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/Synchro",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../phpmailer/phpmailer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"dev-package-names": []
|
||||||
|
}
|
||||||
32
vendor/composer/installed.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php return array(
|
||||||
|
'root' => array(
|
||||||
|
'name' => '__root__',
|
||||||
|
'pretty_version' => '1.0.0+no-version-set',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => null,
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev' => true,
|
||||||
|
),
|
||||||
|
'versions' => array(
|
||||||
|
'__root__' => array(
|
||||||
|
'pretty_version' => '1.0.0+no-version-set',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => null,
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'phpmailer/phpmailer' => array(
|
||||||
|
'pretty_version' => 'v6.9.3',
|
||||||
|
'version' => '6.9.3.0',
|
||||||
|
'reference' => '2f5c94fe7493efc213f643c23b1b1c249d40f47e',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
26
vendor/composer/platform_check.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// platform_check.php @generated by Composer
|
||||||
|
|
||||||
|
$issues = array();
|
||||||
|
|
||||||
|
if (!(PHP_VERSION_ID >= 50500)) {
|
||||||
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.5.0". You are running ' . PHP_VERSION . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($issues) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
15
vendor/phpmailer/phpmailer/.editorconfig
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
46
vendor/phpmailer/phpmailer/COMMITMENT
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
GPL Cooperation Commitment
|
||||||
|
Version 1.0
|
||||||
|
|
||||||
|
Before filing or continuing to prosecute any legal proceeding or claim
|
||||||
|
(other than a Defensive Action) arising from termination of a Covered
|
||||||
|
License, we commit to extend to the person or entity ('you') accused
|
||||||
|
of violating the Covered License the following provisions regarding
|
||||||
|
cure and reinstatement, taken from GPL version 3. As used here, the
|
||||||
|
term 'this License' refers to the specific Covered License being
|
||||||
|
enforced.
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly
|
||||||
|
and finally terminates your license, and (b) permanently, if the
|
||||||
|
copyright holder fails to notify you of the violation by some
|
||||||
|
reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you
|
||||||
|
have received notice of violation of this License (for any work)
|
||||||
|
from that copyright holder, and you cure the violation prior to 30
|
||||||
|
days after your receipt of the notice.
|
||||||
|
|
||||||
|
We intend this Commitment to be irrevocable, and binding and
|
||||||
|
enforceable against us and assignees of or successors to our
|
||||||
|
copyrights.
|
||||||
|
|
||||||
|
Definitions
|
||||||
|
|
||||||
|
'Covered License' means the GNU General Public License, version 2
|
||||||
|
(GPLv2), the GNU Lesser General Public License, version 2.1
|
||||||
|
(LGPLv2.1), or the GNU Library General Public License, version 2
|
||||||
|
(LGPLv2), all as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
'Defensive Action' means a legal proceeding or claim that We bring
|
||||||
|
against you in response to a prior proceeding or claim initiated by
|
||||||
|
you or your affiliate.
|
||||||
|
|
||||||
|
'We' means each contributor to this repository as of the date of
|
||||||
|
inclusion of this file, including subsidiaries of a corporate
|
||||||
|
contributor.
|
||||||
|
|
||||||
|
This work is available under a Creative Commons Attribution-ShareAlike
|
||||||
|
4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).
|
||||||
502
vendor/phpmailer/phpmailer/LICENSE
vendored
Normal file
@@ -0,0 +1,502 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
231
vendor/phpmailer/phpmailer/README.md
vendored
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
[](https://supportukrainenow.org/)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# PHPMailer – A full-featured email creation and transfer class for PHP
|
||||||
|
|
||||||
|
[](https://github.com/PHPMailer/PHPMailer/actions)
|
||||||
|
[](https://codecov.io/gh/PHPMailer/PHPMailer)
|
||||||
|
[](https://packagist.org/packages/phpmailer/phpmailer)
|
||||||
|
[](https://packagist.org/packages/phpmailer/phpmailer)
|
||||||
|
[](https://packagist.org/packages/phpmailer/phpmailer)
|
||||||
|
[](https://phpmailer.github.io/PHPMailer/)
|
||||||
|
[](https://api.securityscorecards.dev/projects/github.com/PHPMailer/PHPMailer)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Probably the world's most popular code for sending email from PHP!
|
||||||
|
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
|
||||||
|
- Integrated SMTP support – send without a local mail server
|
||||||
|
- Send emails with multiple To, CC, BCC, and Reply-to addresses
|
||||||
|
- Multipart/alternative emails for mail clients that do not read HTML email
|
||||||
|
- Add attachments, including inline
|
||||||
|
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
|
||||||
|
- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SMTPS and SMTP+STARTTLS transports
|
||||||
|
- Validates email addresses automatically
|
||||||
|
- Protects against header injection attacks
|
||||||
|
- Error messages in over 50 languages!
|
||||||
|
- DKIM and S/MIME signing support
|
||||||
|
- Compatible with PHP 5.5 and later, including PHP 8.2
|
||||||
|
- Namespaced to prevent name clashes
|
||||||
|
- Much more!
|
||||||
|
|
||||||
|
## Why you might need it
|
||||||
|
Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments.
|
||||||
|
|
||||||
|
Formatting email correctly is surprisingly difficult. There are myriad overlapping (and conflicting) standards, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong, if not unsafe!
|
||||||
|
|
||||||
|
The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP client allows email sending on all platforms without needing a local mail server. Be aware though, that the `mail()` function should be avoided when possible; it's both faster and [safer](https://exploitbox.io/paper/Pwning-PHP-Mail-Function-For-Fun-And-RCE.html) to use SMTP to localhost.
|
||||||
|
|
||||||
|
*Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that
|
||||||
|
you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/)
|
||||||
|
, [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail), etc.
|
||||||
|
|
||||||
|
## License
|
||||||
|
This software is distributed under the [LGPL 2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution.
|
||||||
|
|
||||||
|
## Installation & loading
|
||||||
|
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"phpmailer/phpmailer": "^6.9.2"
|
||||||
|
```
|
||||||
|
|
||||||
|
or run
|
||||||
|
|
||||||
|
```sh
|
||||||
|
composer require phpmailer/phpmailer
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer; they are not part of PHPMailer.
|
||||||
|
|
||||||
|
If you want to use XOAUTH2 authentication, you will also need to add a dependency on the `league/oauth2-client` and appropriate service adapters package in your `composer.json`, or take a look at
|
||||||
|
by @decomplexity's [SendOauth2 wrapper](https://github.com/decomplexity/SendOauth2), especially if you're using Microsoft services.
|
||||||
|
|
||||||
|
Alternatively, if you're not using Composer, you
|
||||||
|
can [download PHPMailer as a zip file](https://github.com/PHPMailer/PHPMailer/archive/master.zip), (note that docs and examples are not included in the zip file), then copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
require 'path/to/PHPMailer/src/Exception.php';
|
||||||
|
require 'path/to/PHPMailer/src/PHPMailer.php';
|
||||||
|
require 'path/to/PHPMailer/src/SMTP.php';
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally.
|
||||||
|
|
||||||
|
## Legacy versions
|
||||||
|
PHPMailer 5.2 (which is compatible with PHP 5.0 — 7.0) is no longer supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases.
|
||||||
|
|
||||||
|
### Upgrading from 5.2
|
||||||
|
The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects – [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
|
||||||
|
|
||||||
|
### Minimal installation
|
||||||
|
While installing the entire package manually or with Composer is simple, convenient, and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP (*very* unlikely!), you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
|
||||||
|
|
||||||
|
## A Simple Example
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
//Import PHPMailer classes into the global namespace
|
||||||
|
//These must be at the top of your script, not inside a function
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\SMTP;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
//Load Composer's autoloader
|
||||||
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
|
//Create an instance; passing `true` enables exceptions
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
//Server settings
|
||||||
|
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||||
|
$mail->isSMTP(); //Send using SMTP
|
||||||
|
$mail->Host = 'smtp.example.com'; //Set the SMTP server to send through
|
||||||
|
$mail->SMTPAuth = true; //Enable SMTP authentication
|
||||||
|
$mail->Username = 'user@example.com'; //SMTP username
|
||||||
|
$mail->Password = 'secret'; //SMTP password
|
||||||
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
||||||
|
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
||||||
|
|
||||||
|
//Recipients
|
||||||
|
$mail->setFrom('from@example.com', 'Mailer');
|
||||||
|
$mail->addAddress('joe@example.net', 'Joe User'); //Add a recipient
|
||||||
|
$mail->addAddress('ellen@example.com'); //Name is optional
|
||||||
|
$mail->addReplyTo('info@example.com', 'Information');
|
||||||
|
$mail->addCC('cc@example.com');
|
||||||
|
$mail->addBCC('bcc@example.com');
|
||||||
|
|
||||||
|
//Attachments
|
||||||
|
$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
|
||||||
|
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
|
||||||
|
|
||||||
|
//Content
|
||||||
|
$mail->isHTML(true); //Set email format to HTML
|
||||||
|
$mail->Subject = 'Here is the subject';
|
||||||
|
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
||||||
|
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
echo 'Message has been sent';
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through Gmail, building contact forms, sending to mailing lists, and more.
|
||||||
|
|
||||||
|
If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance.
|
||||||
|
|
||||||
|
That's it. You should now be ready to use PHPMailer!
|
||||||
|
|
||||||
|
## Localization
|
||||||
|
PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder, you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
|
||||||
|
|
||||||
|
```php
|
||||||
|
//To load the French version
|
||||||
|
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
|
||||||
|
```
|
||||||
|
|
||||||
|
We welcome corrections and new languages – if you're looking for corrections, run the [Language/TranslationCompletenessTest.php](https://github.com/PHPMailer/PHPMailer/blob/master/test/Language/TranslationCompletenessTest.php) script in the tests folder and it will show any missing translations.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, head for [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) as it's frequently updated.
|
||||||
|
|
||||||
|
Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps).
|
||||||
|
|
||||||
|
To reduce PHPMailer's deployed code footprint, examples are not included if you load PHPMailer via Composer or via [GitHub's zip file download](https://github.com/PHPMailer/PHPMailer/archive/master.zip), so you'll need to either clone the git repository or use the above links to get to the examples directly.
|
||||||
|
|
||||||
|
Complete generated API documentation is [available online](https://phpmailer.github.io/PHPMailer/).
|
||||||
|
|
||||||
|
You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](https://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailer/PHPMailerTest.php) a good reference for how to do various operations such as encryption.
|
||||||
|
|
||||||
|
If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](https://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
[PHPMailer tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/) use PHPUnit 9, with [a polyfill](https://github.com/Yoast/PHPUnit-Polyfills) to let 9-style tests run on older PHPUnit and PHP versions.
|
||||||
|
|
||||||
|
[](https://github.com/PHPMailer/PHPMailer/actions)
|
||||||
|
|
||||||
|
If this isn't passing, is there something you can do to help?
|
||||||
|
|
||||||
|
## Security
|
||||||
|
Please disclose any vulnerabilities found responsibly – report security issues to the maintainers privately.
|
||||||
|
|
||||||
|
See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) and [PHPMailer's security advisories on GitHub](https://github.com/PHPMailer/PHPMailer/security).
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Please submit bug reports, suggestions, and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
|
||||||
|
|
||||||
|
We're particularly interested in fixing edge cases, expanding test coverage, and updating translations.
|
||||||
|
|
||||||
|
If you found a mistake in the docs, or want to add something, go ahead and amend the wiki – anyone can edit it.
|
||||||
|
|
||||||
|
If you have git clones from prior to the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Please *don't* use the SourceForge or Google Code projects any more; they are obsolete and no longer maintained.
|
||||||
|
|
||||||
|
## Sponsorship
|
||||||
|
Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), the world's only privacy-first email marketing system.
|
||||||
|
|
||||||
|
<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="550" alt="Smartmessages.net privacy-first email marketing logo"></a>
|
||||||
|
|
||||||
|
Donations are very welcome, whether in beer 🍺, T-shirts 👕, or cold, hard cash 💰. Sponsorship through GitHub is a simple and convenient way to say "thank you" to PHPMailer's maintainers and contributors – just click the "Sponsor" button [on the project page](https://github.com/PHPMailer/PHPMailer). If your company uses PHPMailer, consider taking part in Tidelift's enterprise support programme.
|
||||||
|
|
||||||
|
## PHPMailer For Enterprise
|
||||||
|
|
||||||
|
Available as part of the Tidelift Subscription.
|
||||||
|
|
||||||
|
The maintainers of PHPMailer and thousands of other packages are working with Tidelift to deliver commercial
|
||||||
|
support and maintenance for the open-source packages you use to build your applications. Save time, reduce risk, and
|
||||||
|
improve code health, while paying the maintainers of the exact packages you
|
||||||
|
use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-phpmailer?utm_source=packagist-phpmailer-phpmailer&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
See [changelog](changelog.md).
|
||||||
|
|
||||||
|
## History
|
||||||
|
- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](https://sourceforge.net/projects/phpmailer/).
|
||||||
|
- [Marcus Bointon](https://github.com/Synchro) (`coolbru` on SF) and Andy Prevost (`codeworxtech`) took over the project in 2004.
|
||||||
|
- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
|
||||||
|
- Marcus created [his fork on GitHub](https://github.com/Synchro/PHPMailer) in 2008.
|
||||||
|
- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer in 2013.
|
||||||
|
- PHPMailer moves to [the PHPMailer organisation](https://github.com/PHPMailer) on GitHub in 2013.
|
||||||
|
|
||||||
|
### What's changed since moving from SourceForge?
|
||||||
|
- Official successor to the SourceForge and Google Code projects.
|
||||||
|
- Test suite.
|
||||||
|
- Continuous integration with GitHub Actions.
|
||||||
|
- Composer support.
|
||||||
|
- Public development.
|
||||||
|
- Additional languages and language strings.
|
||||||
|
- CRAM-MD5 authentication support.
|
||||||
|
- Preserves full repo history of authors, commits, and branches from the original SourceForge project.
|
||||||
37
vendor/phpmailer/phpmailer/SECURITY.md
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Security notices relating to PHPMailer
|
||||||
|
|
||||||
|
Please disclose any security issues or vulnerabilities found through [Tidelift's coordinated disclosure system](https://tidelift.com/security) or to the maintainers privately.
|
||||||
|
|
||||||
|
PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the `$patternselect` parameter to `validateAddress()` is set to `'php'` (the default, defined by `PHPMailer::$validator`), and the global namespace contains a function called `php`, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names. Recorded as [CVE-2021-3603](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603). Reported by [Vikrant Singh Chauhan](mailto:vi@hackberry.xyz) via [huntr.dev](https://www.huntr.dev/).
|
||||||
|
|
||||||
|
PHPMailer versions 6.4.1 and earlier contain a possible remote code execution vulnerability through the `$lang_path` parameter of the `setLanguage()` method. If the `$lang_path` parameter is passed unfiltered from user input, it can be set to [a UNC path](https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths), and if an attacker is also able to persuade the server to load a file from that UNC path, a script file under their control may be executed. This vulnerability only applies to systems that resolve UNC paths, typically only Microsoft Windows.
|
||||||
|
PHPMailer 6.5.0 mitigates this by no longer treating translation files as PHP code, but by parsing their text content directly. This approach avoids the possibility of executing unknown code while retaining backward compatibility. This isn't ideal, so the current translation format is deprecated and will be replaced in the next major release. Recorded as [CVE-2021-34551](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-34551). Reported by [Jilin Diting Information Technology Co., Ltd](https://listensec.com) via Tidelift.
|
||||||
|
|
||||||
|
PHPMailer versions between 6.1.8 and 6.4.0 contain a regression of the earlier CVE-2018-19296 object injection vulnerability as a result of [a fix for Windows UNC paths in 6.1.8](https://github.com/PHPMailer/PHPMailer/commit/e2e07a355ee8ff36aba21d0242c5950c56e4c6f9). Recorded as [CVE-2020-36326](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-36326). Reported by Fariskhi Vidyan via Tidelift. 6.4.1 fixes this issue, and also enforces stricter checks for URL schemes in local path contexts.
|
||||||
|
|
||||||
|
PHPMailer versions 6.1.5 and earlier contain an output escaping bug that occurs in `Content-Type` and `Content-Disposition` when filenames passed into `addAttachment` and other methods that accept attachment names contain double quote characters, in contravention of RFC822 3.4.1. No specific vulnerability has been found relating to this, but it could allow file attachments to bypass attachment filters that are based on matching filename extensions. Recorded as [CVE-2020-13625](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-13625). Reported by Elar Lang of Clarified Security.
|
||||||
|
|
||||||
|
PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing `phar://` paths into `addAttachment()` and other functions that may receive unfiltered local paths, possibly leading to RCE. Recorded as [CVE-2018-19296](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-19296). See [this article](https://knasmueller.net/5-answers-about-php-phar-exploitation) for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as `phar://`. Reported by Sehun Oh of cyberone.kr.
|
||||||
|
|
||||||
|
PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it is not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
|
||||||
|
|
||||||
|
PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
|
||||||
|
|
||||||
|
PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
|
||||||
|
|
||||||
|
PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
|
||||||
|
|
||||||
|
PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending.
|
||||||
|
|
||||||
|
PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
|
||||||
|
|
||||||
|
PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack.
|
||||||
|
|
||||||
|
Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747).
|
||||||
|
|
||||||
|
PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734).
|
||||||
|
|
||||||
|
PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807).
|
||||||
|
|
||||||
|
PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215).
|
||||||
|
|
||||||
1
vendor/phpmailer/phpmailer/VERSION
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
6.9.3
|
||||||
80
vendor/phpmailer/phpmailer/composer.json
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"name": "phpmailer/phpmailer",
|
||||||
|
"type": "library",
|
||||||
|
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Marcus Bointon",
|
||||||
|
"email": "phpmailer@synchromedia.co.uk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jim Jagielski",
|
||||||
|
"email": "jimjag@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andy Prevost",
|
||||||
|
"email": "codeworxtech@users.sourceforge.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Brent R. Matzelle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/Synchro",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||||
|
},
|
||||||
|
"lock": false
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.0",
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-filter": "*",
|
||||||
|
"ext-hash": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||||
|
"doctrine/annotations": "^1.2.6 || ^1.13.3",
|
||||||
|
"php-parallel-lint/php-console-highlighter": "^1.0.0",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.3.2",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3.5",
|
||||||
|
"roave/security-advisories": "dev-latest",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7.2",
|
||||||
|
"yoast/phpunit-polyfills": "^1.0.4"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
|
||||||
|
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
|
||||||
|
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
|
||||||
|
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
|
||||||
|
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
|
||||||
|
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
|
||||||
|
"psr/log": "For optional PSR-3 debug logging",
|
||||||
|
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication",
|
||||||
|
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PHPMailer\\PHPMailer\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"PHPMailer\\Test\\": "test/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": "LGPL-2.1-only",
|
||||||
|
"scripts": {
|
||||||
|
"check": "./vendor/bin/phpcs",
|
||||||
|
"test": "./vendor/bin/phpunit --no-coverage",
|
||||||
|
"coverage": "./vendor/bin/phpunit",
|
||||||
|
"lint": [
|
||||||
|
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
182
vendor/phpmailer/phpmailer/get_oauth_token.php
vendored
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPMailer - PHP email creation and transport class.
|
||||||
|
* PHP Version 5.5
|
||||||
|
* @package PHPMailer
|
||||||
|
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||||
|
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||||
|
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||||
|
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||||
|
* @author Brent R. Matzelle (original founder)
|
||||||
|
* @copyright 2012 - 2020 Marcus Bointon
|
||||||
|
* @copyright 2010 - 2012 Jim Jagielski
|
||||||
|
* @copyright 2004 - 2009 Andy Prevost
|
||||||
|
* @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License
|
||||||
|
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an OAuth2 token from an OAuth2 provider.
|
||||||
|
* * Install this script on your server so that it's accessible
|
||||||
|
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
|
||||||
|
* e.g.: http://localhost/phpmailer/get_oauth_token.php
|
||||||
|
* * Ensure dependencies are installed with 'composer install'
|
||||||
|
* * Set up an app in your Google/Yahoo/Microsoft account
|
||||||
|
* * Set the script address as the app's redirect URL
|
||||||
|
* If no refresh token is obtained when running this file,
|
||||||
|
* revoke access to your app and run the script again.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PHPMailer\PHPMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aliases for League Provider Classes
|
||||||
|
* Make sure you have added these to your composer.json and run `composer install`
|
||||||
|
* Plenty to choose from here:
|
||||||
|
* @see https://oauth2-client.thephpleague.com/providers/thirdparty/
|
||||||
|
*/
|
||||||
|
//@see https://github.com/thephpleague/oauth2-google
|
||||||
|
use League\OAuth2\Client\Provider\Google;
|
||||||
|
//@see https://packagist.org/packages/hayageek/oauth2-yahoo
|
||||||
|
use Hayageek\OAuth2\Client\Provider\Yahoo;
|
||||||
|
//@see https://github.com/stevenmaguire/oauth2-microsoft
|
||||||
|
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
|
||||||
|
//@see https://github.com/greew/oauth2-azure-provider
|
||||||
|
use Greew\OAuth2\Client\Provider\Azure;
|
||||||
|
|
||||||
|
if (!isset($_GET['code']) && !isset($_POST['provider'])) {
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<form method="post">
|
||||||
|
<h1>Select Provider</h1>
|
||||||
|
<input type="radio" name="provider" value="Google" id="providerGoogle">
|
||||||
|
<label for="providerGoogle">Google</label><br>
|
||||||
|
<input type="radio" name="provider" value="Yahoo" id="providerYahoo">
|
||||||
|
<label for="providerYahoo">Yahoo</label><br>
|
||||||
|
<input type="radio" name="provider" value="Microsoft" id="providerMicrosoft">
|
||||||
|
<label for="providerMicrosoft">Microsoft</label><br>
|
||||||
|
<input type="radio" name="provider" value="Azure" id="providerAzure">
|
||||||
|
<label for="providerAzure">Azure</label><br>
|
||||||
|
<h1>Enter id and secret</h1>
|
||||||
|
<p>These details are obtained by setting up an app in your provider's developer console.
|
||||||
|
</p>
|
||||||
|
<p>ClientId: <input type="text" name="clientId"><p>
|
||||||
|
<p>ClientSecret: <input type="text" name="clientSecret"></p>
|
||||||
|
<p>TenantID (only relevant for Azure): <input type="text" name="tenantId"></p>
|
||||||
|
<input type="submit" value="Continue">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
$providerName = '';
|
||||||
|
$clientId = '';
|
||||||
|
$clientSecret = '';
|
||||||
|
$tenantId = '';
|
||||||
|
|
||||||
|
if (array_key_exists('provider', $_POST)) {
|
||||||
|
$providerName = $_POST['provider'];
|
||||||
|
$clientId = $_POST['clientId'];
|
||||||
|
$clientSecret = $_POST['clientSecret'];
|
||||||
|
$tenantId = $_POST['tenantId'];
|
||||||
|
$_SESSION['provider'] = $providerName;
|
||||||
|
$_SESSION['clientId'] = $clientId;
|
||||||
|
$_SESSION['clientSecret'] = $clientSecret;
|
||||||
|
$_SESSION['tenantId'] = $tenantId;
|
||||||
|
} elseif (array_key_exists('provider', $_SESSION)) {
|
||||||
|
$providerName = $_SESSION['provider'];
|
||||||
|
$clientId = $_SESSION['clientId'];
|
||||||
|
$clientSecret = $_SESSION['clientSecret'];
|
||||||
|
$tenantId = $_SESSION['tenantId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//If you don't want to use the built-in form, set your client id and secret here
|
||||||
|
//$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
|
||||||
|
//$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
|
||||||
|
|
||||||
|
//If this automatic URL doesn't work, set it yourself manually to the URL of this script
|
||||||
|
$redirectUri = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
||||||
|
//$redirectUri = 'http://localhost/PHPMailer/redirect';
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'clientId' => $clientId,
|
||||||
|
'clientSecret' => $clientSecret,
|
||||||
|
'redirectUri' => $redirectUri,
|
||||||
|
'accessType' => 'offline'
|
||||||
|
];
|
||||||
|
|
||||||
|
$options = [];
|
||||||
|
$provider = null;
|
||||||
|
|
||||||
|
switch ($providerName) {
|
||||||
|
case 'Google':
|
||||||
|
$provider = new Google($params);
|
||||||
|
$options = [
|
||||||
|
'scope' => [
|
||||||
|
'https://mail.google.com/'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'Yahoo':
|
||||||
|
$provider = new Yahoo($params);
|
||||||
|
break;
|
||||||
|
case 'Microsoft':
|
||||||
|
$provider = new Microsoft($params);
|
||||||
|
$options = [
|
||||||
|
'scope' => [
|
||||||
|
'wl.imap',
|
||||||
|
'wl.offline_access'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'Azure':
|
||||||
|
$params['tenantId'] = $tenantId;
|
||||||
|
|
||||||
|
$provider = new Azure($params);
|
||||||
|
$options = [
|
||||||
|
'scope' => [
|
||||||
|
'https://outlook.office.com/SMTP.Send',
|
||||||
|
'offline_access'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $provider) {
|
||||||
|
exit('Provider missing');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET['code'])) {
|
||||||
|
//If we don't have an authorization code then get one
|
||||||
|
$authUrl = $provider->getAuthorizationUrl($options);
|
||||||
|
$_SESSION['oauth2state'] = $provider->getState();
|
||||||
|
header('Location: ' . $authUrl);
|
||||||
|
exit;
|
||||||
|
//Check given state against previously stored one to mitigate CSRF attack
|
||||||
|
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
|
||||||
|
unset($_SESSION['oauth2state']);
|
||||||
|
unset($_SESSION['provider']);
|
||||||
|
exit('Invalid state');
|
||||||
|
} else {
|
||||||
|
unset($_SESSION['provider']);
|
||||||
|
//Try to get an access token (using the authorization code grant)
|
||||||
|
$token = $provider->getAccessToken(
|
||||||
|
'authorization_code',
|
||||||
|
[
|
||||||
|
'code' => $_GET['code']
|
||||||
|
]
|
||||||
|
);
|
||||||
|
//Use this to interact with an API on the users behalf
|
||||||
|
//Use this to get a new access token if the old one expires
|
||||||
|
echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken());
|
||||||
|
}
|
||||||
26
vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Afrikaans PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: kon nie geverifieer word nie.';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon nie aan SMTP-verbind nie.';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data nie aanvaar nie.';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'Boodskapliggaam leeg.';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'Onbekende kodering: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'Kon nie uitvoer nie: ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'Kon nie lêer oopmaak nie: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'Lêerfout: Kon nie lêer oopmaak nie: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'Die volgende Van adres misluk: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'Kon nie posfunksie instansieer nie.';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'Ongeldige adres: ';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer word nie ondersteun nie.';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'U moet ten minste een ontvanger e-pos adres verskaf.';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: Die volgende ontvangers het misluk: ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'Ondertekening Fout: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP-verbinding () misluk.';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'SMTP-bediener fout: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'Kan nie veranderlike instel of herstel nie: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'Uitbreiding ontbreek: ';
|
||||||
27
vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Arabic PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author bahjat al mostafa <bahjat983@hotmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'خطأ SMTP : لا يمكن تأكيد الهوية.';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'خطأ SMTP: لا يمكن الاتصال بالخادم SMTP.';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'خطأ SMTP: لم يتم قبول المعلومات .';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'نص الرسالة فارغ';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'ترميز غير معروف: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'لا يمكن تنفيذ : ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'لا يمكن الوصول للملف: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'خطأ في الملف: لا يمكن فتحه: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'خطأ على مستوى عنوان المرسل : ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'لا يمكن توفير خدمة البريد.';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح: ';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية فشل في الارسال لكل من : ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'لا يمكن تعيين أو إعادة تعيين متغير: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'الإضافة غير موجودة: ';
|
||||||
35
vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assamese PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author Manish Sarkar <manish.n.manish@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'SMTP ত্ৰুটি: প্ৰমাণীকৰণ কৰিব নোৱাৰি';
|
||||||
|
$PHPMAILER_LANG['buggy_php'] = 'আপোনাৰ PHP সংস্কৰণ এটা বাগৰ দ্বাৰা প্ৰভাৱিত হয় যাৰ ফলত নষ্ট বাৰ্তা হব পাৰে । ইয়াক সমাধান কৰিবলে, প্ৰেৰণ কৰিবলে SMTP ব্যৱহাৰ কৰক, আপোনাৰ php.ini ত mail.add_x_header বিকল্প নিষ্ক্ৰিয় কৰক, MacOS বা Linux লৈ সলনি কৰক, বা আপোনাৰ PHP সংস্কৰণ 7.0.17+ বা 7.1.3+ লৈ সলনি কৰক ।';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'SMTP ত্ৰুটি: SMTP চাৰ্ভাৰৰ সৈতে সংযোগ কৰিবলে অক্ষম';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP ত্ৰুটি: তথ্য গ্ৰহণ কৰা হোৱা নাই';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'বাৰ্তাৰ মূখ্য অংশ খালী।';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'অজ্ঞাত এনকোডিং: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'এক্সিকিউট কৰিব নোৱাৰি: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'সম্প্ৰসাৰণ নোহোৱা হৈছে: ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'ফাইল অভিগম কৰিবলে অক্ষম: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'ফাইল ত্ৰুটি: ফাইল খোলিবলৈ অক্ষম: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'নিম্নলিখিত প্ৰেৰকৰ ঠিকনা(সমূহ) ব্যৰ্থ: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'মেইল ফাংচনৰ এটা উদাহৰণ সৃষ্টি কৰিবলে অক্ষম';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'প্ৰেৰণ কৰিব নোৱাৰি: অবৈধ ইমেইল ঠিকনা: ';
|
||||||
|
$PHPMAILER_LANG['invalid_header'] = 'অবৈধ হেডাৰৰ নাম বা মান';
|
||||||
|
$PHPMAILER_LANG['invalid_hostentry'] = 'অবৈধ হোষ্টেন্ট্ৰি: ';
|
||||||
|
$PHPMAILER_LANG['invalid_host'] = 'অবৈধ হস্ট:';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = 'মেইলাৰ সমৰ্থিত নহয়।';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'আপুনি অন্ততঃ এটা গন্তব্য ইমেইল ঠিকনা দিব লাগিব';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP ত্ৰুটি: নিম্নলিখিত গন্তব্যস্থানসমূহ ব্যৰ্থ: ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'স্বাক্ষৰ কৰাত ব্যৰ্থ: ';
|
||||||
|
$PHPMAILER_LANG['smtp_code'] = 'SMTP কড: ';
|
||||||
|
$PHPMAILER_LANG['smtp_code_ex'] = 'অতিৰিক্ত SMTP তথ্য: ';
|
||||||
|
$PHPMAILER_LANG['smtp_detail'] = 'বিৱৰণ:';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP সংযোগ() ব্যৰ্থ';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'SMTP চাৰ্ভাৰৰ ত্ৰুটি: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'চলক নিৰ্ধাৰণ কৰিব পৰা নগল: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'অনুপস্থিত সম্প্ৰসাৰণ: ';
|
||||||
27
vendor/phpmailer/phpmailer/language/phpmailer.lang-az.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Azerbaijani PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author @mirjalal
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'SMTP xətası: Giriş uğursuz oldu.';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'SMTP xətası: SMTP serverinə qoşulma uğursuz oldu.';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP xətası: Verilənlər qəbul edilməyib.';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'Boş mesaj göndərilə bilməz.';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'Qeyri-müəyyən kodlaşdırma: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'Əmr yerinə yetirilmədi: ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'Fayla giriş yoxdur: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'Fayl xətası: Fayl açıla bilmədi: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'Göstərilən poçtlara göndərmə uğursuz oldu: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'Mail funksiyası işə salına bilmədi.';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'Düzgün olmayan e-mail adresi: ';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = ' - e-mail kitabxanası dəstəklənmir.';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'Ən azı bir e-mail adresi daxil edilməlidir.';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP xətası: Aşağıdakı ünvanlar üzrə alıcılara göndərmə uğursuzdur: ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'İmzalama xətası: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP serverinə qoşulma uğursuz oldu.';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri xətası: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'Dəyişənin quraşdırılması uğursuz oldu: ';
|
||||||
|
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
|
||||||
27
vendor/phpmailer/phpmailer/language/phpmailer.lang-ba.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bosnian PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author Ermin Islamagić <ermin@islamagic.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela prijava.';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Nije moguće spojiti se sa SMTP serverom.';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'Nepoznata kriptografija: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje sa navedenih e-mail adresa nije uspjelo: ';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedene e-mail adrese nije uspjelo: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: ';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'Definišite barem jednu adresu primaoca.';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP server nije uspjelo.';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'SMTP greška: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'Nije moguće postaviti varijablu ili je vratiti nazad: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'Nedostaje ekstenzija: ';
|
||||||
27
vendor/phpmailer/phpmailer/language/phpmailer.lang-be.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Belarusian PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author Aleksander Maksymiuk <info@setpro.pl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'Памылка SMTP: памылка ідэнтыфікацыі.';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'Памылка SMTP: нельга ўстанавіць сувязь з SMTP-серверам.';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'Памылка SMTP: звесткі непрынятыя.';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'Пустое паведамленне.';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'Невядомая кадыроўка тэксту: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'Нельга выканаць каманду: ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'Няма доступу да файла: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'Нельга адкрыць файл: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'Няправільны адрас адпраўніка: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'Нельга прымяніць функцыю mail().';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'Нельга даслаць паведамленне, няправільны email атрымальніка: ';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'Запоўніце, калі ласка, правільны email атрымальніка.';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = ' - паштовы сервер не падтрымліваецца.';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'Памылка SMTP: няправільныя атрымальнікі: ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'Памылка подпісу паведамлення: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'Памылка сувязі з SMTP-серверам.';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'Памылка SMTP: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'Нельга ўстанавіць або перамяніць значэнне пераменнай: ';
|
||||||
|
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
|
||||||
27
vendor/phpmailer/phpmailer/language/phpmailer.lang-bg.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bulgarian PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author Mikhail Kyosev <mialygk@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: Не може да се удостовери пред сървъра.';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: Не може да се свърже с SMTP хоста.';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: данните не са приети.';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'Съдържанието на съобщението е празно';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'Неизвестно кодиране: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'Не може да се изпълни: ';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'Няма достъп до файл: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'Файлова грешка: Не може да се отвори файл: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'Следните адреси за подател са невалидни: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'Не може да се инстанцира функцията mail.';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'Невалиден адрес: ';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = ' - пощенски сървър не се поддържа.';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'Трябва да предоставите поне един email адрес за получател.';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Следните адреси за Получател са невалидни: ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'Грешка при подписване: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP провален connect().';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'SMTP сървърна грешка: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'Не може да се установи или възстанови променлива: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'Липсва разширение: ';
|
||||||
35
vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bengali PHPMailer language file: refer to English translation for definitive list
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author Manish Sarkar <manish.n.manish@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG['authenticate'] = 'SMTP ত্রুটি: প্রমাণীকরণ করতে অক্ষম৷';
|
||||||
|
$PHPMAILER_LANG['buggy_php'] = 'আপনার PHP সংস্করণ একটি বাগ দ্বারা প্রভাবিত হয় যার ফলে দূষিত বার্তা হতে পারে। এটি ঠিক করতে, পাঠাতে SMTP ব্যবহার করুন, আপনার php.ini এ mail.add_x_header বিকল্পটি নিষ্ক্রিয় করুন, MacOS বা Linux-এ স্যুইচ করুন, অথবা আপনার PHP সংস্করণকে 7.0.17+ বা 7.1.3+ এ পরিবর্তন করুন।';
|
||||||
|
$PHPMAILER_LANG['connect_host'] = 'SMTP ত্রুটি: SMTP সার্ভারের সাথে সংযোগ করতে অক্ষম৷';
|
||||||
|
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP ত্রুটি: ডেটা গ্রহণ করা হয়নি৷';
|
||||||
|
$PHPMAILER_LANG['empty_message'] = 'বার্তার অংশটি খালি।';
|
||||||
|
$PHPMAILER_LANG['encoding'] = 'অজানা এনকোডিং: ';
|
||||||
|
$PHPMAILER_LANG['execute'] = 'নির্বাহ করতে অক্ষম: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'এক্সটেনশন অনুপস্থিত:';
|
||||||
|
$PHPMAILER_LANG['file_access'] = 'ফাইল অ্যাক্সেস করতে অক্ষম: ';
|
||||||
|
$PHPMAILER_LANG['file_open'] = 'ফাইল ত্রুটি: ফাইল খুলতে অক্ষম: ';
|
||||||
|
$PHPMAILER_LANG['from_failed'] = 'নিম্নলিখিত প্রেরকের ঠিকানা(গুলি) ব্যর্থ হয়েছে: ';
|
||||||
|
$PHPMAILER_LANG['instantiate'] = 'মেল ফাংশনের একটি উদাহরণ তৈরি করতে অক্ষম৷';
|
||||||
|
$PHPMAILER_LANG['invalid_address'] = 'পাঠাতে অক্ষম: অবৈধ ইমেল ঠিকানা: ';
|
||||||
|
$PHPMAILER_LANG['invalid_header'] = 'অবৈধ হেডার নাম বা মান';
|
||||||
|
$PHPMAILER_LANG['invalid_hostentry'] = 'অবৈধ হোস্টেন্ট্রি: ';
|
||||||
|
$PHPMAILER_LANG['invalid_host'] = 'অবৈধ হোস্ট:';
|
||||||
|
$PHPMAILER_LANG['mailer_not_supported'] = 'মেইলার সমর্থিত নয়।';
|
||||||
|
$PHPMAILER_LANG['provide_address'] = 'আপনাকে অবশ্যই অন্তত একটি গন্তব্য ইমেল ঠিকানা প্রদান করতে হবে৷';
|
||||||
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP ত্রুটি: নিম্নলিখিত গন্তব্যগুলি ব্যর্থ হয়েছে: ';
|
||||||
|
$PHPMAILER_LANG['signing'] = 'স্বাক্ষর করতে ব্যর্থ হয়েছে: ';
|
||||||
|
$PHPMAILER_LANG['smtp_code'] = 'SMTP কোড: ';
|
||||||
|
$PHPMAILER_LANG['smtp_code_ex'] = 'অতিরিক্ত SMTP তথ্য:';
|
||||||
|
$PHPMAILER_LANG['smtp_detail'] = 'বর্ণনা: ';
|
||||||
|
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP সংযোগ() ব্যর্থ হয়েছে৷';
|
||||||
|
$PHPMAILER_LANG['smtp_error'] = 'SMTP সার্ভার ত্রুটি: ';
|
||||||
|
$PHPMAILER_LANG['variable_set'] = 'পরিবর্তনশীল সেট করা যায়নি: ';
|
||||||
|
$PHPMAILER_LANG['extension_missing'] = 'অনুপস্থিত এক্সটেনশন: ';
|
||||||